signalk-binnacle 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,9 +4,120 @@ All notable changes to Binnacle are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project aims to follow
5
5
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- <a id="unreleased"></a>
7
+ <a id="v090"></a>
8
8
 
9
- ## [Unreleased]
9
+ ## [0.9.0] - 2026-06-22
10
+
11
+ ### Added
12
+
13
+ - **Time travel.** Scrub the last 24 hours from a bottom strip: a marker walks the recorded track, a
14
+ four-metric readout (depth, wind, barometer, and speed over ground) snaps to the scrubbed time, and
15
+ the live vessel dims while you review. It reads the server history API and says plainly when no
16
+ history provider is installed.
17
+ - **POI search.** A themed panel lists the points of interest in the current map view as a two-line
18
+ list, sortable by name, type, distance, or bearing: each row leads with its category icon and name,
19
+ then shows its distance and bearing below. Hovering or focusing a row rings that point on the chart
20
+ without moving the map, and tapping a row rings it and opens its detail in the note popup, exactly as
21
+ tapping the marker on the chart does, so you can click through results while the list stays open.
22
+ - **Configurable bottom bar.** Choose which actions ride the bottom bar. A "Customize bottom toolbar" mode
23
+ in the menu pins or unpins any action (Center, Follow, Charts, Forecast, Tides, Anchor, and the rest);
24
+ Center, Follow, and Charts are pinned by default. The choice is saved with your profile and follows
25
+ you across devices. Pin more than fit and the extras collapse into a "More" button.
26
+
27
+ ### Changed
28
+
29
+ - The AIS targets list and the POI search now share one row and sort style, so the two panels read
30
+ and behave the same: a full-width sort control above a column of two-line rows.
31
+
32
+ ### Removed
33
+
34
+ - The plotter-extensions integration is gone: Binnacle no longer surfaces third-party Signal K
35
+ plugins' own buttons, panels, widgets, or iframes on the chart. Plugin data still renders through
36
+ Binnacle's own overlays (points of interest and notes, routes, waypoints, charts, and the symbols
37
+ from signalk-symbol-manager); this only drops the plugins' injected UI, which did not match the
38
+ app's design and duplicated built-in features such as the POI search.
39
+
40
+ ### Fixed
41
+
42
+ - On a secured Signal K server, the points-of-interest, AIS-trail, and history-track overlays now
43
+ fetch with a live auth token. They captured the token at map load, before sign-in finished, so they
44
+ stayed unauthenticated for the whole session and never loaded their data; the token is now read at
45
+ fetch time, the way the rest of the app already reads it.
46
+ - Offline caching sweeps stale precache entries from earlier builds, so a returning visit no longer
47
+ serves an outdated asset alongside the current one.
48
+ - The point-conditions valid-time line renders with its space restored before the middot ("Observed ·
49
+ 14:30" rather than "Observed· 14:30").
50
+ - A collision alarm now goes silent the instant the danger clears, instead of playing out the rest of
51
+ the beep burst it was partway through. Scheduled beeps are stopped, not just the repeating interval.
52
+ - A failed file read while importing a route GPX or a profile JSON file now shows "Could not read that
53
+ file." instead of doing nothing, so a flaky USB read is not mistaken for a cancel.
54
+ - A restored man-overboard mark is rebuilt from its known fields, so an unknown persisted field cannot
55
+ carry into the live mark.
56
+ - The anchor controls use a freshly approved auth token at once: a token that arrives or changes
57
+ mid-session is now read live, so an anchor action no longer needs a page reload to authenticate.
58
+ - A plugin enabled while the data stream was down (history, notifications, or anchor) is detected when
59
+ the stream reconnects, instead of staying dark until the page is reloaded.
60
+ - The "Here" conditions panel keeps reading the latest sample as a live observation during a long open
61
+ with no weather layer loaded, rather than drifting into treating it as a forecast step.
62
+ - A display token is corrected: the default waypoint marker and the disabled course-skip control hold
63
+ their colors under the night-red theme.
64
+
65
+ ### Changed
66
+
67
+ - Accessibility and packaging: the active saved item (the active profile or route) is now announced to
68
+ assistive technology with aria-current, matching its visual accent, and the browser tab and the
69
+ Signal K admin webapp view now show the Binnacle favicon.
70
+ - Internal: a reuse pass routed the remaining AIS, anchor, collision, MOB, notes, route, tides, track,
71
+ and weather overlays through the shared map source helpers, with no behavior change.
72
+ - Internal: a large modularization pass broke the biggest files into cohesive modules, components, and
73
+ controllers without changing behavior. The App.svelte composition root, the WeatherMap and ChartCanvas
74
+ widgets, the routes, layers, and weather panels, the notes overlay, and the pmtiles, themed-map,
75
+ wind-gl, and route-draft modules were split; the global stylesheet was split
76
+ one concern per module; and a whole-codebase reuse pass consolidated shared helpers (object guards,
77
+ GeoJSON source updates, the icon-offset expression, the JSON-or-default fetch helper, and the
78
+ provided-symbol overlay resolver). No user-facing behavior change.
79
+ - Internal: a whole-codebase consistency pass unified the four modal dialogs behind one shared frame,
80
+ the two collision surfaces behind one severity-color definition, and the safety-band overlays behind
81
+ one helper; named the remaining magic values; removed dead exports; tightened a few reactive and
82
+ hot-path operations; and held the design system to its tokens. No user-facing behavior change.
83
+
84
+ <a id="v080"></a>
85
+
86
+ ## [0.8.0] - 2026-06-20
87
+
88
+ ### Added
89
+
90
+ - Plotter extensions. Binnacle now hosts third-party plotter add-ons that other Signal K plugins ship,
91
+ implementing the Plotter Extensions API. An extension can place action buttons in the footer toolbar
92
+ (capped at three, with a More menu for the rest), slide-in side panels, on-chart instrument widgets,
93
+ and live display filters that hide non-matching markers and show a clearable chip. Widgets are placed
94
+ with a long press on the chart, which opens the context menu's Add widget item, and packed into the
95
+ chart corners. Try it with signalk-instrument-widgets and signalk-poi-search. With no extension
96
+ plugin installed nothing renders and the chart is untouched.
97
+ - Custom waypoint icons. When you drop a waypoint you can choose its icon from Binnacle's built-in
98
+ markers plus any symbols the signalk-symbol-manager plugin provides for the waypoint role, and each
99
+ waypoint renders with its chosen symbol. Icons resolve through namespaces: `binnacle:` is Binnacle's
100
+ built-in library (the default for a plain icon id), `custom:` is your own symbols from
101
+ signalk-symbol-manager, and an icon another app stored in its own namespace still renders so nothing
102
+ placed elsewhere disappears. The symbol rendering here was contributed by
103
+ [Joel Kozikowski](https://github.com/joelkoz) in
104
+ [#6](https://github.com/NearlCrews/signalk-binnacle/pull/6).
105
+
106
+ ### Fixed
107
+
108
+ - Saved tracks stay on screen when a periodic refresh hits a transient network failure, instead of
109
+ briefly blanking the list. This matches how routes and waypoints already behave.
110
+ - The severe-weather banner no longer ranks a thunderstorm watch, a storm-surge advisory, or a
111
+ tropical-storm watch above a gale warning.
112
+ - Chart map instances are fully released on teardown, closing a pointer-listener leak that kept a
113
+ map alive after the chart was destroyed.
114
+
115
+ ### Changed
116
+
117
+ - Internal consolidation and performance work across the app: shared modal, button, and numeric
118
+ readout styling unified into the global utilities, and several render and per-tick paths made
119
+ cheaper (the map layer ordering, the resources filter regex, and the overlay draws). No change to
120
+ behavior beyond the fixes above.
10
121
 
11
122
  <a id="v071"></a>
12
123
 
package/README.md CHANGED
@@ -15,27 +15,26 @@ A WebGL chart plotter for [Signal K](https://signalk.org).
15
15
  > is also not certified for safety-of-life navigation. Always carry redundant means of navigation,
16
16
  > cross-check against your primary instruments, and treat every display as advisory.
17
17
 
18
- ## What's new in 0.7.0
19
-
20
- AI route drafting and a routing workflow overhaul:
21
-
22
- - **AI route drafting and optimize (beta).** Describe a passage in plain language and review a drafted
23
- route, or tap Optimize on a route you drew, when signalk-crows-nest provides the route-draft
24
- endpoint. Each draft opens as an editable working route with a not-chart-verified banner, per-leg
25
- land, shallow, hazard, and fuel flags that state their source and datum, and an armed "I checked
26
- every leg" save. It is a beta assistant and cannot guarantee accuracy: review every leg against the
27
- official charts and your instruments before you navigate it. The control stays hidden on a server
28
- without the endpoint.
29
- - **Route editing on the chart.** A route shows its waypoints as dots the moment you draft, optimize,
30
- or edit it. Tap a leg in the panel to light its segment and end dots on the chart, tap a dot to
31
- light the legs it joins, drag a dot to move it, or tap a midpoint to insert one. The chart menu adds
32
- "Start a route here" so you begin a route from the spot you picked.
33
- - **AIS course vectors and reliability.** Moving AIS targets draw a short course predictor, red for a
34
- danger contact and amber for a warning. Plus a reliability pass: offline and runtime caching works
35
- again in a secure context, antimeridian-crossing routes frame the short way, and collision alerts no
36
- longer cry wolf at anchor.
37
-
38
- See the [changelog](CHANGELOG.md#v070) for the full list.
18
+ ## What's new in 0.9.0
19
+
20
+ This release adds a bunch of new features for reading and arranging the picture, plus a
21
+ codebase-wide polish pass:
22
+
23
+ - **Time travel.** Scrub the last 24 hours from a bottom strip. A marker walks the recorded track, a
24
+ four-metric readout (depth, wind, barometer, and speed over ground) snaps to the scrubbed time, and
25
+ the live vessel dims while you review. It reads the server history API and says plainly when no
26
+ history provider is installed.
27
+ - **POI search.** A themed panel lists the points of interest in the current map view as a two-line
28
+ list, sortable by name, type, distance, or bearing. Hovering or focusing a row rings that point on
29
+ the chart without moving the map, and tapping a row opens its detail in the note popup, exactly as
30
+ tapping the marker on the chart does, so you can click through results while the list stays open.
31
+ - **Configurable bottom bar.** Pin the actions you want on the bottom bar from a "Customize bottom
32
+ toolbar" mode in the menu. Center, Follow, and Charts are the default; your choice saves with your profile.
33
+ - **Consistency and polish.** A whole-codebase pass put the dialogs, the collision strips, and the
34
+ overlays behind shared frames and helpers, corrected a theme token so the night-red markers render
35
+ right, and let the anchor controls pick up a freshly approved login without a page reload.
36
+
37
+ See the [changelog](CHANGELOG.md#v090) for the full list.
39
38
 
40
39
  ## What it does
41
40
 
@@ -109,8 +108,11 @@ See the [changelog](CHANGELOG.md) for the full list.
109
108
 
110
109
  Binnacle is built on a current web stack and engineered to run on modest helm hardware:
111
110
 
112
- - **Front end.** Svelte 5 with runes, Vite, and TypeScript, linted and formatted with Biome, with
113
- module boundaries enforced by the build (Feature-Sliced Design plus a dependency-cruiser gate).
111
+ - **Front end.** Svelte 5 with runes, Vite, and TypeScript, linted and formatted with Biome. The code
112
+ is organized as cohesive, single-responsibility slices under a strict Feature-Sliced Design, with the
113
+ import boundaries enforced by the build through a dependency-cruiser gate, a modular stylesheet
114
+ assembled one concern per file, and shared UI primitives and helpers, so a new feature drops in
115
+ against stable interfaces rather than by surgery on the core.
114
116
  - **GPU rendering.** MapLibre GL JS draws the vector base map and chart layers on the GPU. The own
115
117
  vessel and every AIS target render as GPU symbol layers, and wind draws as a WebGL particle field
116
118
  advected through the forecast on the graphics card.
@@ -148,6 +150,26 @@ npm install signalk-binnacle
148
150
 
149
151
  **From source.** See [Development](#development) below.
150
152
 
153
+ ## Usage
154
+
155
+ Open Binnacle from the **Webapps** list in the Signal K admin UI, or go straight to
156
+ `http://your-sk-server:3000/signalk-binnacle/`. It opens on the chart, centered on your boat.
157
+
158
+ A few interactions cover most of the helm:
159
+
160
+ - **Open the context menu.** Long-press the chart on a touch screen, or right-click with a mouse, to
161
+ drop a waypoint, choose **Go to here** to navigate straight to that point, start a route or a
162
+ measurement, or place an on-chart widget.
163
+ - **Manage layers.** Open the **Layers** panel to toggle each chart, bathymetry source, and overlay,
164
+ fade it with the opacity slider, and drag the rows to reorder how they stack.
165
+ - **Switch themes.** Cycle the day, dusk, and night-red themes from the theme control. Night-red is
166
+ pure red on true black for a dark-adapted watch.
167
+ - **Mark a man overboard.** Tap the always-visible **MOB** button in the top bar and confirm to mark
168
+ the spot, raise the boat-wide alarm, and start the recovery strip.
169
+
170
+ For offline charts and tiles, see [Offline operation and SSL](#offline-operation-and-ssl-optional)
171
+ below.
172
+
151
173
  ## Offline operation and SSL (optional)
152
174
 
153
175
  SSL is not required. Binnacle runs fully over plain HTTP, which is how the Signal K server serves it
@@ -254,6 +276,11 @@ open data and open source:
254
276
  [Flanders Marine Institute (VLIZ)](https://www.vliz.be/) Marine Regions service for the maritime
255
277
  boundaries.
256
278
 
279
+ Custom chart symbols come from
280
+ [`signalk-symbol-manager`](https://github.com/joelkoz/signalk-symbol-manager) by
281
+ [Joel Kozikowski](https://github.com/joelkoz), who also contributed the symbol rendering Binnacle uses
282
+ in [#6](https://github.com/NearlCrews/signalk-binnacle/pull/6).
283
+
257
284
  Binnacle pairs well with sibling plugins such as
258
285
  [`signalk-crows-nest`](https://github.com/NearlCrews/signalk-crows-nest), which supplies the points
259
286
  of interest it renders, and works with any Signal K weather provider, such as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-binnacle",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "description": "WebGL chart plotter for Signal K",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -36,14 +36,15 @@
36
36
  "displayName": "Binnacle",
37
37
  "screenshots": [
38
38
  "./screenshots/01-chart.png",
39
- "./screenshots/02-routes.png",
40
- "./screenshots/03-anchorage.png",
41
- "./screenshots/04-profiles.png",
42
- "./screenshots/05-weather.png"
39
+ "./screenshots/02-points-of-interest.png",
40
+ "./screenshots/03-layers.png",
41
+ "./screenshots/04-weather.png",
42
+ "./screenshots/05-profiles.png"
43
43
  ],
44
44
  "recommends": [
45
45
  "signalk-crows-nest",
46
46
  "signalk-ssl",
47
+ "signalk-symbol-manager",
47
48
  "signalk-virtual-weather-sensors"
48
49
  ]
49
50
  },
@@ -1 +1 @@
1
- .uplot,.uplot *,.uplot :before,.uplot :after{box-sizing:border-box}.uplot{width:min-content;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{-webkit-user-select:none;user-select:none;position:relative}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{width:100%;height:100%;display:block;position:relative}.u-axis{position:absolute}.u-legend{text-align:center;margin:auto;font-size:14px}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{pointer-events:none;background:#00000012;position:absolute}.u-cursor-x,.u-cursor-y{pointer-events:none;will-change:transform;position:absolute;top:0;left:0}.u-hz .u-cursor-x,.u-vt .u-cursor-y{border-right:1px dashed #607d8b;height:100%}.u-hz .u-cursor-y,.u-vt .u-cursor-x{border-bottom:1px dashed #607d8b;width:100%}.u-cursor-pt{pointer-events:none;will-change:transform;border:0 solid;border-radius:50%;position:absolute;top:0;left:0;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.trend-chart.svelte-1tp75kj{min-block-size:120px;inline-size:100%}.trend-chart.svelte-1tp75kj .u-wrap{color:var(--text-muted)}.trend-charts.svelte-9vkdzs{gap:var(--space-4);flex-direction:column;display:flex}section.svelte-9vkdzs{gap:var(--space-1);flex-direction:column;display:flex}.head.svelte-9vkdzs{justify-content:space-between;align-items:baseline;gap:var(--space-2);display:flex}.latest.svelte-9vkdzs{color:var(--text-muted);font-size:var(--text-sm)}.latest.svelte-9vkdzs b:where(.svelte-9vkdzs){color:var(--text);font-family:var(--font-mono);font-size:var(--text-base)}
1
+ .uplot,.uplot *,.uplot :before,.uplot :after{box-sizing:border-box}.uplot{width:min-content;font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{-webkit-user-select:none;user-select:none;position:relative}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{width:100%;height:100%;display:block;position:relative}.u-axis{position:absolute}.u-legend{text-align:center;margin:auto;font-size:14px}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{pointer-events:none;background:#00000012;position:absolute}.u-cursor-x,.u-cursor-y{pointer-events:none;will-change:transform;position:absolute;top:0;left:0}.u-hz .u-cursor-x,.u-vt .u-cursor-y{border-right:1px dashed #607d8b;height:100%}.u-hz .u-cursor-y,.u-vt .u-cursor-x{border-bottom:1px dashed #607d8b;width:100%}.u-cursor-pt{pointer-events:none;will-change:transform;border:0 solid;border-radius:50%;position:absolute;top:0;left:0;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.trend-chart.svelte-1tp75kj{inline-size:100%}.trend-chart.svelte-1tp75kj .u-wrap{color:var(--text-muted)}.trend-charts.svelte-9vkdzs{gap:var(--space-4);flex-direction:column;display:flex}section.svelte-9vkdzs{gap:var(--space-1);flex-direction:column;display:flex}.head.svelte-9vkdzs{justify-content:space-between;align-items:baseline;gap:var(--space-2);display:flex}.latest.svelte-9vkdzs{color:var(--text-muted);font-size:var(--text-sm)}.latest.svelte-9vkdzs b:where(.svelte-9vkdzs){color:var(--text);font-size:var(--text-base)}
@@ -0,0 +1,10 @@
1
+ import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,b as c,c as l,d as u,g as d,h as f,j as p,k as m,l as h,m as g,o as _,p as v,s as y,t as b,u as x,v as S,w as C,x as w,y as T}from"./index-CZZNTPxC.js";var E=!0,ee=`uplot`,D=`u-hz`,te=`u-vt`,ne=`u-title`,re=`u-wrap`,ie=`u-under`,ae=`u-over`,oe=`u-axis`,se=`u-off`,ce=`u-select`,le=`u-cursor-x`,ue=`u-cursor-y`,de=`u-cursor-pt`,fe=`u-legend`,pe=`u-live`,me=`u-inline`,he=`u-series`,ge=`u-marker`,_e=`u-label`,ve=`u-value`,ye=`width`,be=`height`,xe=`top`,Se=`bottom`,Ce=`left`,we=`right`,O=`#000`,Te=`#0000`,Ee=`mousemove`,De=`mousedown`,Oe=`mouseup`,ke=`mouseenter`,Ae=`mouseleave`,je=`dblclick`,Me=`resize`,Ne=`scroll`,Pe=`change`,Fe=`dppxchange`,Ie=`--`,k=typeof window<`u`,Le=k?document:null,Re=k?window:null,ze=k?navigator:null,A,Be;function Ve(){let e=devicePixelRatio;A!=e&&(A=e,Be&&$e(Pe,Be,Ve),Be=matchMedia(`(min-resolution: ${A-.001}dppx) and (max-resolution: ${A+.001}dppx)`),Qe(Pe,Be,Ve),Re.dispatchEvent(new CustomEvent(Fe)))}function He(e,t){if(t!=null){let n=e.classList;!n.contains(t)&&n.add(t)}}function Ue(e,t){let n=e.classList;n.contains(t)&&n.remove(t)}function j(e,t,n){e.style[t]=n+`px`}function We(e,t,n,r){let i=Le.createElement(e);return t!=null&&He(i,t),n?.insertBefore(i,r),i}function Ge(e,t){return We(`div`,e,t)}var Ke=new WeakMap;function qe(e,t,n,r,i){let a=`translate(`+t+`px,`+n+`px)`;a!=Ke.get(e)&&(e.style.transform=a,Ke.set(e,a),t<0||n<0||t>r||n>i?He(e,se):Ue(e,se))}var Je=new WeakMap;function Ye(e,t,n){let r=t+n;r!=Je.get(e)&&(Je.set(e,r),e.style.background=t,e.style.borderColor=n)}var Xe=new WeakMap;function Ze(e,t,n,r){let i=t+``+n;i!=Xe.get(e)&&(Xe.set(e,i),e.style.height=n+`px`,e.style.width=t+`px`,e.style.marginLeft=r?-t/2+`px`:0,e.style.marginTop=r?-n/2+`px`:0)}var M={passive:!0},N={...M,capture:!0};function Qe(e,t,n,r){t.addEventListener(e,n,r?N:M)}function $e(e,t,n,r){t.removeEventListener(e,n,M)}k&&Ve();function et(e,t,n,r){let i;n||=0,r||=t.length-1;let a=r<=2147483647;for(;r-n>1;)i=a?n+r>>1:yt((n+r)/2),t[i]<e?n=i:r=i;return e-t[n]<=t[r]-e?n:r}function tt(e){return(t,n,r)=>{let i=-1,a=-1;for(let a=n;a<=r;a++)if(e(t[a])){i=a;break}for(let i=r;i>=n;i--)if(e(t[i])){a=i;break}return[i,a]}}var nt=e=>e!=null,P=e=>e!=null&&e>0,rt=tt(nt),it=tt(P);function at(e,t,n,r=0,i=!1){let a=i?it:rt,o=i?P:nt;[t,n]=a(e,t,n);let s=e[t],c=e[t];if(t>-1)if(r==1)s=e[t],c=e[n];else if(r==-1)s=e[n],c=e[t];else for(let r=t;r<=n;r++){let t=e[r];o(t)&&(t<s?s=t:t>c&&(c=t))}return[s??R,c??-R]}function ot(e,t,n,r){let i=wt(e),a=wt(t);e==t&&(i==-1?(e*=n,t/=n):(e/=n,t*=n));let o=n==10?Tt:Et,s=i==1?yt:bt,c=a==1?bt:yt,l=s(o(I(e))),u=c(o(I(t))),d=Ct(n,l),f=Ct(n,u);return n==10&&(l<0&&(d=V(d,-l)),u<0&&(f=V(f,-u))),r||n==2?(e=d*i,t=f*a):(e=B(e,d),t=Vt(t,f)),[e,t]}function st(e,t,n,r){let i=ot(e,t,n,r);return e==0&&(i[0]=0),t==0&&(i[1]=0),i}var ct=.1,lt={mode:3,pad:ct},ut={pad:0,soft:null,mode:0},dt={min:ut,max:ut};function ft(e,t,n,r){return Zt(n)?mt(e,t,n):(ut.pad=n,ut.soft=r?0:null,ut.mode=r?3:0,mt(e,t,dt))}function F(e,t){return e??t}function pt(e,t,n){for(t=F(t,0),n=F(n,e.length-1);t<=n;){if(e[t]!=null)return!0;t++}return!1}function mt(e,t,n){let r=n.min,i=n.max,a=F(r.pad,0),o=F(i.pad,0),s=F(r.hard,-R),c=F(i.hard,R),l=F(r.soft,R),u=F(i.soft,-R),d=F(r.mode,0),f=F(i.mode,0),p=t-e,m=Tt(p),h=St(I(e),I(t)),g=I(Tt(h)-m);(p<1e-24||g>10)&&(p=0,(e==0||t==0)&&(p=1e-24,d==2&&l!=R&&(a=0),f==2&&u!=-R&&(o=0)));let _=p||h||1e3,v=Ct(10,yt(Tt(_))),y=V(B(e-_*(p==0?e==0?.1:1:a),v/10),24),b=e>=l&&(d==1||d==3&&y<=l||d==2&&y>=l)?l:R,x=St(s,y<b&&e>=b?b:xt(b,y)),S=V(Vt(t+_*(p==0?t==0?.1:1:o),v/10),24),C=t<=u&&(f==1||f==3&&S>=u||f==2&&S<=u)?u:-R,w=xt(c,S>C&&t<=C?C:St(C,S));return x==w&&x==0&&(w=100),[x,w]}var ht=new Intl.NumberFormat(k?ze.language:`en-US`),gt=e=>ht.format(e),_t=Math,vt=_t.PI,I=_t.abs,yt=_t.floor,L=_t.round,bt=_t.ceil,xt=_t.min,St=_t.max,Ct=_t.pow,wt=_t.sign,Tt=_t.log10,Et=_t.log2,Dt=(e,t=1)=>_t.sinh(e)*t,Ot=(e,t=1)=>_t.asinh(e/t),R=1/0;function kt(e){return(Tt((e^e>>31)-(e>>31))|0)+1}function At(e,t,n){return xt(St(e,t),n)}function jt(e){return typeof e==`function`}function z(e){return jt(e)?e:()=>e}var Mt=()=>{},Nt=e=>e,Pt=(e,t)=>t,Ft=e=>null,It=e=>!0,Lt=(e,t)=>e==t,Rt=/\.\d*?(?=9{6,}|0{6,})/gm,zt=e=>{if(Jt(e)||Ht.has(e))return e;let t=`${e}`,n=t.match(Rt);if(n==null)return e;let r=n[0].length-1;if(t.indexOf(`e-`)!=-1){let[e,n]=t.split(`e`);return+`${zt(e)}e${n}`}return V(e,r)};function Bt(e,t){return zt(V(zt(e/t))*t)}function Vt(e,t){return zt(bt(zt(e/t))*t)}function B(e,t){return zt(yt(zt(e/t))*t)}function V(e,t=0){if(Jt(e))return e;let n=10**t;return L(e*n*(1+2**-52))/n}var Ht=new Map;function Ut(e){return((``+e).split(`.`)[1]||``).length}function H(e,t,n,r){let i=[],a=r.map(Ut);for(let o=t;o<n;o++){let t=I(o),n=V(Ct(e,o),t);for(let s=0;s<r.length;s++){let c=e==10?+`${r[s]}e${o}`:r[s]*n,l=(o>=0?0:t)+(o>=a[s]?0:a[s]),u=e==10?c:V(c,l);i.push(u),Ht.set(u,l)}}return i}var Wt={},Gt=[],Kt=[null,null],qt=Array.isArray,Jt=Number.isInteger,Yt=e=>e===void 0;function Xt(e){return typeof e==`string`}function Zt(e){let t=!1;if(e!=null){let n=e.constructor;t=n==null||n==Object}return t}function Qt(e){return typeof e==`object`&&!!e}var $t=Object.getPrototypeOf(Uint8Array),en=`__proto__`;function tn(e,t=Zt){let n;if(qt(e)){let r=e.find(e=>e!=null);if(qt(r)||t(r)){n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=tn(e[r],t)}else n=e.slice()}else if(e instanceof $t)n=e.slice();else if(t(e)){n={};for(let r in e)r!=en&&(n[r]=tn(e[r],t))}else n=e;return n}function U(e){let t=arguments;for(let n=1;n<t.length;n++){let r=t[n];for(let t in r)t!=en&&(Zt(e[t])?U(e[t],tn(r[t])):e[t]=tn(r[t]))}return e}var nn=0,rn=1,an=2;function on(e,t,n){for(let r=0,i,a=-1;r<t.length;r++){let o=t[r];if(o>a){for(i=o-1;i>=0&&e[i]==null;)e[i--]=null;for(i=o+1;i<n&&e[i]==null;)e[a=i++]=null}}}function sn(e,t){if(un(e)){let t=e[0].slice();for(let n=1;n<e.length;n++)t.push(...e[n].slice(1));return dn(t[0])||(t=ln(t)),t}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t][0],i=r.length;for(let e=0;e<i;e++)n.add(r[e])}let r=[Array.from(n).sort((e,t)=>e-t)],i=r[0].length,a=new Map;for(let e=0;e<i;e++)a.set(r[0][e],e);for(let n=0;n<e.length;n++){let o=e[n],s=o[0];for(let e=1;e<o.length;e++){let c=o[e],l=Array(i).fill(void 0),u=t?t[n][e]:rn,d=[];for(let e=0;e<c.length;e++){let t=c[e],n=a.get(s[e]);t===null?u!=nn&&(l[n]=t,u==an&&d.push(n)):l[n]=t}on(l,d,i),r.push(l)}}return r}var cn=typeof queueMicrotask>`u`?e=>Promise.resolve().then(e):queueMicrotask;function ln(e){let t=e[0],n=t.length,r=Array(n);for(let e=0;e<r.length;e++)r[e]=e;r.sort((e,n)=>t[e]-t[n]);let i=[];for(let t=0;t<e.length;t++){let a=e[t],o=Array(n);for(let e=0;e<n;e++)o[e]=a[r[e]];i.push(o)}return i}function un(e){let t=e[0][0],n=t.length;for(let r=1;r<e.length;r++){let i=e[r][0];if(i.length!=n)return!1;if(i!=t){for(let e=0;e<n;e++)if(i[e]!=t[e])return!1}}return!0}function dn(e,t=100){let n=e.length;if(n<=1)return!0;let r=0,i=n-1;for(;r<=i&&e[r]==null;)r++;for(;i>=r&&e[i]==null;)i--;if(i<=r)return!0;let a=St(1,yt((i-r+1)/t));for(let t=e[r],n=r+a;n<=i;n+=a){let r=e[n];if(r!=null){if(r<=t)return!1;t=r}}return!0}var fn=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],pn=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function mn(e){return e.slice(0,3)}var hn=pn.map(mn),gn={MMMM:fn,MMM:fn.map(mn),WWWW:pn,WWW:hn};function _n(e){return(e<10?`0`:``)+e}function vn(e){return(e<10?`00`:e<100?`0`:``)+e}var yn={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+``).slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>_n(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>_n(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>_n(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return t==0?12:t>12?t-12:t},AA:e=>e.getHours()>=12?`PM`:`AM`,aa:e=>e.getHours()>=12?`pm`:`am`,a:e=>e.getHours()>=12?`p`:`a`,mm:e=>_n(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>_n(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>vn(e.getMilliseconds())};function bn(e,t){t||=gn;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(e);)n.push(i[0][0]==`{`?yn[i[1]]:i[0]);return e=>{let r=``;for(let i=0;i<n.length;i++)r+=typeof n[i]==`string`?n[i]:n[i](e,t);return r}}var xn=new Intl.DateTimeFormat().resolvedOptions().timeZone;function Sn(e,t){let n;return t==`UTC`||t==`Etc/UTC`?n=new Date(+e+e.getTimezoneOffset()*6e4):t==xn?n=e:(n=new Date(e.toLocaleString(`en-US`,{timeZone:t})),n.setMilliseconds(e.getMilliseconds())),n}var Cn=e=>e%1==0,wn=[1,2,2.5,5],Tn=H(10,-32,0,wn),En=H(10,0,32,wn),Dn=En.filter(Cn),On=Tn.concat(En),kn=`{YYYY}`,An=`
2
+ {YYYY}`,jn=`{M}/{D}`,Mn=`
3
+ {M}/{D}`,Nn=`
4
+ {M}/{D}/{YY}`,Pn=`{h}:{mm}{aa}`,Fn=`
5
+ {h}:{mm}{aa}`,In=`:{ss}`,W=null;function Ln(e){let t=e*1e3,n=t*60,r=n*60,i=r*24,a=i*30,o=i*365,s=(e==1?H(10,0,3,wn).filter(Cn):H(10,-3,0,wn)).concat([t,t*5,t*10,t*15,t*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,a,a*2,a*3,a*4,a*6,o,o*2,o*5,o*10,o*25,o*50,o*100]),c=[[o,kn,W,W,W,W,W,W,1],[i*28,`{MMM}`,An,W,W,W,W,W,1],[i,jn,An,W,W,W,W,W,1],[r,`{h}{aa}`,Nn,W,Mn,W,W,W,1],[n,Pn,Nn,W,Mn,W,W,W,1],[t,In,`
6
+ {M}/{D}/{YY} {h}:{mm}{aa}`,W,`
7
+ {M}/{D} {h}:{mm}{aa}`,W,Fn,W,1],[e,`:{ss}.{fff}`,`
8
+ {M}/{D}/{YY} {h}:{mm}{aa}`,W,`
9
+ {M}/{D} {h}:{mm}{aa}`,W,Fn,W,1]];function l(t){return(s,c,l,u,d,f)=>{let p=[],m=d>=o,h=d>=a&&d<o,g=t(l),_=V(g*e,3),v=qn(g.getFullYear(),m?0:g.getMonth(),h||m?1:g.getDate()),y=V(v*e,3);if(h||m){let n=h?d/a:0,r=m?d/o:0,i=_==y?_:V(qn(v.getFullYear()+r,v.getMonth()+n,1)*e,3),s=new Date(L(i/e)),c=s.getFullYear(),l=s.getMonth();for(let a=0;i<=u;a++){let o=qn(c+r*a,l+n*a,1),s=o-t(V(o*e,3));i=V((+o+s)*e,3),i<=u&&p.push(i)}}else{let a=d>=i?i:d,o=y+(yt(l)-yt(_))+Vt(_-y,a);p.push(o);let m=t(o),h=m.getHours()+m.getMinutes()/n+m.getSeconds()/r,g=d/r,v=f/s.axes[c]._space;for(;o=V(o+d,e==1?0:3),!(o>u);)if(g>1){let e=yt(V(h+g,6))%24,n=t(o).getHours()-e;n>1&&(n=-1),o-=n*r,h=(h+g)%24;let i=p[p.length-1];V((o-i)/d,3)*v>=.7&&p.push(o)}else p.push(o)}return p}}return[s,c,l]}var[Rn,zn,Bn]=Ln(1),[Vn,Hn,Un]=Ln(.001);H(2,-53,53,[1]);function Wn(e,t){return e.map(e=>e.map((n,r)=>r==0||r==8||n==null?n:t(r==1||e[8]==0?n:e[1]+n)))}function Gn(e,t){return(n,r,i,a,o)=>{let s=t.find(e=>o>=e[0])||t[t.length-1],c,l,u,d,f,p;return r.map(t=>{let n=e(t),r=n.getFullYear(),i=n.getMonth(),a=n.getDate(),o=n.getHours(),m=n.getMinutes(),h=n.getSeconds(),g=r!=c&&s[2]||i!=l&&s[3]||a!=u&&s[4]||o!=d&&s[5]||m!=f&&s[6]||h!=p&&s[7]||s[1];return c=r,l=i,u=a,d=o,f=m,p=h,g(n)})}}function Kn(e,t){let n=bn(t);return(t,r,i,a,o)=>r.map(t=>n(e(t)))}function qn(e,t,n){return new Date(e,t,n)}function Jn(e,t){return t(e)}var Yn=`{YYYY}-{MM}-{DD} {h}:{mm}{aa}`;function Xn(e,t){return(n,r,i,a)=>a==null?Ie:t(e(r))}function Zn(e,t){let n=e.series[t];return n.width?n.stroke(e,t):n.points.width?n.points.stroke(e,t):null}function Qn(e,t){return e.series[t].fill(e,t)}var $n={show:!0,live:!0,isolate:!1,mount:Mt,markers:{show:!0,width:2,stroke:Zn,fill:Qn,dash:`solid`},idx:null,idxs:null,values:[]};function er(e,t){let n=e.cursor.points,r=Ge(),i=n.size(e,t);j(r,ye,i),j(r,be,i);let a=i/-2;j(r,`marginLeft`,a),j(r,`marginTop`,a);let o=n.width(e,t,i);return o&&j(r,`borderWidth`,o),r}function G(e,t){let n=e.series[t].points;return n._fill||n._stroke}function K(e,t){let n=e.series[t].points;return n._stroke||n._fill}function q(e,t){return e.series[t].points.size}var tr=[0,0];function nr(e,t,n){return tr[0]=t,tr[1]=n,tr}function rr(e,t,n,r=!0){return e=>{e.button==0&&(!r||e.target==t)&&n(e)}}function ir(e,t,n,r=!0){return e=>{(!r||e.target==t)&&n(e)}}var ar={show:!0,x:!0,y:!0,lock:!1,move:nr,points:{one:!1,show:er,size:q,width:0,stroke:K,fill:G},bind:{mousedown:rr,mouseup:rr,click:rr,dblclick:rr,mousemove:ir,mouseleave:ir,mouseenter:ir},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(e,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(e,t,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},or={show:!0,stroke:`rgba(0,0,0,0.07)`,width:2},sr=U({},or,{filter:Pt}),cr=U({},sr,{size:10}),lr=U({},or,{show:!1}),ur=`12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,dr=`bold 12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`,fr=1.5,pr={show:!0,scale:`x`,stroke:O,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:dr,side:2,grid:sr,ticks:cr,border:lr,font:ur,lineGap:fr,rotate:0},mr=`Value`,hr=`Time`,gr={show:!0,scale:`x`,auto:!1,sorted:1,min:R,max:-1/0,idxs:[]};function _r(e,t,n,r,i){return t.map(e=>e==null?``:gt(e))}function vr(e,t,n,r,i,a,o){let s=[],c=Ht.get(i)||0;n=o?n:V(Vt(n,i),c);for(let e=n;e<=r;e=V(e+i,c))s.push(Object.is(e,-0)?0:e);return s}function yr(e,t,n,r,i,a,o){let s=[],c=e.scales[e.axes[t].scale].log;i=Ct(c,yt((c==10?Tt:Et)(n))),c==10&&(i=On[et(i,On)]);let l=n,u=i*c;c==10&&(u=On[et(u,On)]);do s.push(l),l+=i,c==10&&!Ht.has(l)&&(l=V(l,Ht.get(i))),l>=u&&(i=l,u=i*c,c==10&&(u=On[et(u,On)]));while(l<=r);return s}function br(e,t,n,r,i,a,o){let s=e.scales[e.axes[t].scale].asinh,c=r>s?yr(e,t,St(s,n),r,i):[s],l=r>=0&&n<=0?[0]:[];return(n<-s?yr(e,t,St(s,-r),-n,i):[s]).reverse().map(e=>-e).concat(l,c)}var xr=/./,Sr=/[12357]/,Cr=/[125]/,wr=/1/,Tr=(e,t,n,r)=>e.map((e,i)=>t==4&&e==0||i%r==0&&n.test(e.toExponential()[+(e<0)])?e:null);function Er(e,t,n,r,i){let a=e.axes[n],o=a.scale,s=e.scales[o],c=e.valToPos,l=a._space,u=c(10,o),d=c(9,o)-u>=l?xr:c(7,o)-u>=l?Sr:c(5,o)-u>=l?Cr:wr;if(d==wr){let e=I(c(1,o)-u);if(e<l)return Tr(t.slice().reverse(),s.distr,d,bt(l/e)).reverse()}return Tr(t,s.distr,d,1)}function Dr(e,t,n,r,i){let a=e.axes[n],o=a.scale,s=a._space,c=e.valToPos,l=I(c(1,o)-c(2,o));return l<s?Tr(t.slice().reverse(),3,xr,bt(s/l)).reverse():t}function Or(e,t,n,r){return r==null?Ie:t==null?``:gt(t)}var kr={show:!0,scale:`y`,stroke:O,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:dr,side:3,grid:sr,ticks:cr,border:lr,font:ur,lineGap:fr,rotate:0};function Ar(e,t){return V((3+(e||1)*2)*t,3)}function jr(e,t){let{scale:n,idxs:r}=e.series[0],i=e._data[0],a=e.valToPos(i[r[0]],n,!0),o=I(e.valToPos(i[r[1]],n,!0)-a)/(e.series[t].points.space*A);return r[1]-r[0]<=o}var Mr={scale:null,auto:!0,sorted:0,min:R,max:-1/0},Nr=(e,t,n,r,i)=>i,Pr={show:!0,auto:!0,sorted:0,gaps:Nr,alpha:1,facets:[U({},Mr,{scale:`x`}),U({},Mr,{scale:`y`})]},Fr={scale:`y`,auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Nr,alpha:1,points:{show:jr,filter:null},values:null,min:R,max:-1/0,idxs:[],path:null,clip:null};function Ir(e,t,n,r,i){return n/10}var Lr={time:E,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Rr=U({},Lr,{time:!1,ori:1}),zr={};function Br(e,t){let n=zr[e];return n||(n={key:e,plots:[],sub(e){n.plots.push(e)},unsub(e){n.plots=n.plots.filter(t=>t!=e)},pub(e,t,r,i,a,o,s){for(let c=0;c<n.plots.length;c++)n.plots[c]!=t&&n.plots[c].pub(e,t,r,i,a,o,s)}},e!=null&&(zr[e]=n)),n}var Vr=1,Hr=2;function Ur(e,t,n){let r=e.mode,i=e.series[t],a=r==2?e._data[t]:e._data,o=e.scales,s=e.bbox,c=a[0],l=r==2?a[1]:a[t],u=r==2?o[i.facets[0].scale]:o[e.series[0].scale],d=r==2?o[i.facets[1].scale]:o[i.scale],f=s.left,p=s.top,m=s.width,h=s.height,g=e.valToPosH,_=e.valToPosV;return u.ori==0?n(i,c,l,u,d,g,_,f,p,m,h,Qr,ei,ni,ii,oi):n(i,c,l,u,d,_,g,p,f,h,m,$r,ti,ri,ai,si)}function Wr(e,t){let n=0,r=0,i=F(e.bands,Gt);for(let e=0;e<i.length;e++){let a=i[e];a.series[0]==t?n=a.dir:a.series[1]==t&&(a.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function Gr(e,t,n,r,i){let a=e.mode,o=e.series[t],s=a==2?o.facets[1].scale:o.scale,c=e.scales[s];return i==-1?c.min:i==1?c.max:c.distr==3?c.dir==1?c.min:c.max:0}function Kr(e,t,n,r,i,a){return Ur(e,t,(e,t,o,s,c,l,u,d,f,p,m)=>{let h=e.pxRound,g=s.dir*(s.ori==0?1:-1),_=s.ori==0?ei:ti,v,y;g==1?(v=n,y=r):(v=r,y=n);let b=h(l(t[v],s,p,d)),x=h(u(o[v],c,m,f)),S=h(l(t[y],s,p,d)),C=h(u(a==1?c.max:c.min,c,m,f)),w=new Path2D(i);return _(w,S,C),_(w,b,C),_(w,b,x),w})}function qr(e,t,n,r,i,a){let o=null;if(e.length>0){o=new Path2D;let s=t==0?ni:ri,c=n;for(let t=0;t<e.length;t++){let n=e[t];if(n[1]>n[0]){let e=n[0]-c;e>0&&s(o,c,r,e,r+a),c=n[1]}}let l=n+i-c;l>0&&s(o,c,r-10/2,l,r+a+10)}return o}function Jr(e,t,n){let r=e[e.length-1];r&&r[0]==t?r[1]=n:e.push([t,n])}function Yr(e,t,n,r,i,a,o){let s=[],c=e.length;for(let l=i==1?n:r;l>=n&&l<=r;l+=i)if(t[l]===null){let u=l,d=l;if(i==1)for(;++l<=r&&t[l]===null;)d=l;else for(;--l>=n&&t[l]===null;)d=l;let f=a(e[u]),p=d==u?f:a(e[d]),m=u-i;f=o<=0&&m>=0&&m<c?a(e[m]):f;let h=d+i;p=o>=0&&h>=0&&h<c?a(e[h]):p,p>=f&&s.push([f,p])}return s}function Xr(e){return e==0?Nt:e==1?L:t=>Bt(t,e)}function Zr(e){let t=e==0?Qr:$r,n=e==0?(e,t,n,r,i,a)=>{e.arcTo(t,n,r,i,a)}:(e,t,n,r,i,a)=>{e.arcTo(n,t,i,r,a)},r=e==0?(e,t,n,r,i)=>{e.rect(t,n,r,i)}:(e,t,n,r,i)=>{e.rect(n,t,i,r)};return(e,i,a,o,s,c=0,l=0)=>{c==0&&l==0?r(e,i,a,o,s):(c=xt(c,o/2,s/2),l=xt(l,o/2,s/2),t(e,i+c,a),n(e,i+o,a,i+o,a+s,c),n(e,i+o,a+s,i,a+s,l),n(e,i,a+s,i,a,l),n(e,i,a,i+o,a,c),e.closePath())}}var Qr=(e,t,n)=>{e.moveTo(t,n)},$r=(e,t,n)=>{e.moveTo(n,t)},ei=(e,t,n)=>{e.lineTo(t,n)},ti=(e,t,n)=>{e.lineTo(n,t)},ni=Zr(0),ri=Zr(1),ii=(e,t,n,r,i,a)=>{e.arc(t,n,r,i,a)},ai=(e,t,n,r,i,a)=>{e.arc(n,t,r,i,a)},oi=(e,t,n,r,i,a,o)=>{e.bezierCurveTo(t,n,r,i,a,o)},si=(e,t,n,r,i,a,o)=>{e.bezierCurveTo(n,t,i,r,o,a)};function ci(e){return(e,t,n,r,i)=>Ur(e,t,(t,a,o,s,c,l,u,d,f,p,m)=>{let{pxRound:h,points:g}=t,_,v;s.ori==0?(_=Qr,v=ii):(_=$r,v=ai);let y=V(g.width*A,3),b=(g.size-g.width)/2*A,x=V(b*2,3),S=new Path2D,C=new Path2D,{left:w,top:T,width:E,height:ee}=e.bbox;ni(C,w-x,T-x,E+x*2,ee+x*2);let D=e=>{if(o[e]!=null){let t=h(l(a[e],s,p,d)),n=h(u(o[e],c,m,f));_(S,t+b,n),v(S,t,n,b,0,vt*2)}};if(i)i.forEach(D);else for(let e=n;e<=r;e++)D(e);return{stroke:y>0?S:null,fill:S,clip:C,flags:3}})}function li(e){return(t,n,r,i,a,o)=>{r!=i&&(a!=r&&o!=r&&e(t,n,r),a!=i&&o!=i&&e(t,n,i),e(t,n,o))}}var ui=li(ei),di=li(ti);function fi(e){let t=F(e?.alignGaps,0);return(e,n,r,i)=>Ur(e,n,(a,o,s,c,l,u,d,f,p,m,h)=>{[r,i]=rt(s,r,i);let g=a.pxRound,_=e=>g(u(e,c,m,f)),v=e=>g(d(e,l,h,p)),y,b;c.ori==0?(y=ei,b=ui):(y=ti,b=di);let x=c.dir*(c.ori==0?1:-1),S={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Vr},C=S.stroke,w=!1;if(i-r>=m*4){let t=t=>e.posToVal(t,c.key,!0),n=null,a=null,l,u,d=_(o[x==1?r:i]),f=_(o[r]),p=_(o[i]),m=t(x==1?f+1:p-1);for(let e=x==1?r:i;e>=r&&e<=i;e+=x){let r=o[e],i=(x==1?r<m:r>m)?d:_(r),c=s[e];i==d?c==null?c===null&&(w=!0):(u=c,n==null?(y(C,i,v(u)),l=n=a=u):u<n?n=u:u>a&&(a=u)):(n!=null&&b(C,d,v(n),v(a),v(l),v(u)),c==null?(n=a=null,c===null&&(w=!0)):(u=c,y(C,i,v(u)),n=a=l=u),d=i,m=t(d+x))}n!=null&&n!=a&&d!=null&&b(C,d,v(n),v(a),v(l),v(u))}else for(let e=x==1?r:i;e>=r&&e<=i;e+=x){let t=s[e];t===null?w=!0:t!=null&&y(C,_(o[e]),v(t))}let[T,E]=Wr(e,n);if(a.fill!=null||T!=0){let t=S.fill=new Path2D(C),s=v(a.fillTo(e,n,a.min,a.max,T)),c=_(o[r]),l=_(o[i]);x==-1&&([l,c]=[c,l]),y(t,l,s),y(t,c,s)}if(!a.spanGaps){let l=[];w&&l.push(...Yr(o,s,r,i,x,_,t)),S.gaps=l=a.gaps(e,n,r,i,l),S.clip=qr(l,c.ori,f,p,m,h)}return E!=0&&(S.band=E==2?[Kr(e,n,r,i,C,-1),Kr(e,n,r,i,C,1)]:Kr(e,n,r,i,C,E)),S})}function pi(e){let t=F(e.align,1),n=F(e.ascDesc,!1),r=F(e.alignGaps,0),i=F(e.extend,!1);return(e,a,o,s)=>Ur(e,a,(c,l,u,d,f,p,m,h,g,_,v)=>{[o,s]=rt(u,o,s);let y=c.pxRound,{left:b,width:x}=e.bbox,S=e=>y(p(e,d,_,h)),C=e=>y(m(e,f,v,g)),w=d.ori==0?ei:ti,T={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Vr},E=T.stroke,ee=d.dir*(d.ori==0?1:-1),D=C(u[ee==1?o:s]),te=S(l[ee==1?o:s]),ne=te,re=te;i&&t==-1&&(re=b,w(E,re,D)),w(E,te,D);for(let e=ee==1?o:s;e>=o&&e<=s;e+=ee){let n=u[e];if(n==null)continue;let r=S(l[e]),i=C(n);t==1?w(E,r,D):w(E,ne,i),w(E,r,i),D=i,ne=r}let ie=ne;i&&t==1&&(ie=b+x,w(E,ie,D));let[ae,oe]=Wr(e,a);if(c.fill!=null||ae!=0){let t=T.fill=new Path2D(E),n=C(c.fillTo(e,a,c.min,c.max,ae));w(t,ie,n),w(t,re,n)}if(!c.spanGaps){let i=[];i.push(...Yr(l,u,o,s,ee,S,r));let f=c.width*A/2,p=n||t==1?f:-f,m=n||t==-1?-f:f;i.forEach(e=>{e[0]+=p,e[1]+=m}),T.gaps=i=c.gaps(e,a,o,s,i),T.clip=qr(i,d.ori,h,g,_,v)}return oe!=0&&(T.band=oe==2?[Kr(e,a,o,s,E,-1),Kr(e,a,o,s,E,1)]:Kr(e,a,o,s,E,oe)),T})}function mi(e,t,n,r,i,a,o=R){if(e.length>1){let s=null;for(let c=0,l=1/0;c<e.length;c++)if(t[c]!==void 0){if(s!=null){let t=I(e[c]-e[s]);t<l&&(l=t,o=I(n(e[c],r,i,a)-n(e[s],r,i,a)))}s=c}}return o}function hi(e){e||=Wt;let t=F(e.size,[.6,R,1]),n=e.align||0,r=e.gap||0,i=e.radius;i=i==null?[0,0]:typeof i==`number`?[i,0]:i;let a=z(i),o=1-t[0],s=F(t[1],R),c=F(t[2],1),l=F(e.disp,Wt),u=F(e.each,e=>{}),{fill:d,stroke:f}=l;return(e,t,i,p)=>Ur(e,t,(m,h,g,_,v,y,b,x,S,C,w)=>{let T=m.pxRound,E=n,ee=r*A,D=s*A,te=c*A,ne,re;_.ori==0?[ne,re]=a(e,t):[re,ne]=a(e,t);let ie=_.dir*(_.ori==0?1:-1),ae=_.ori==0?ni:ri,oe=_.ori==0?u:(e,t,n,r,i,a,o)=>{u(e,t,n,i,r,o,a)},se=F(e.bands,Gt).find(e=>e.series[0]==t),ce=se==null?0:se.dir,le=m.fillTo(e,t,m.min,m.max,ce),ue=T(b(le,v,w,S)),de,fe,pe,me=C,he=T(m.width*A),ge=!1,_e=null,ve=null,ye=null,be=null;d!=null&&(he==0||f!=null)&&(ge=!0,_e=d.values(e,t,i,p),ve=new Map,new Set(_e).forEach(e=>{e!=null&&ve.set(e,new Path2D)}),he>0&&(ye=f.values(e,t,i,p),be=new Map,new Set(ye).forEach(e=>{e!=null&&be.set(e,new Path2D)})));let{x0:xe,size:Se}=l;if(xe!=null&&Se!=null){E=1,h=xe.values(e,t,i,p),xe.unit==2&&(h=h.map(t=>e.posToVal(x+t*C,_.key,!0)));let n=Se.values(e,t,i,p);fe=Se.unit==2?n[0]*C:y(n[0],_,C,x)-y(0,_,C,x),me=mi(h,g,y,_,C,x,me),pe=me-fe+ee}else me=mi(h,g,y,_,C,x,me),pe=me*o+ee,fe=me-pe;pe<1&&(pe=0),he>=fe/2&&(he=0),pe<5&&(T=Nt);let Ce=pe>0,we=me-pe-(Ce?he:0);fe=T(At(we,te,D)),de=(E==0?fe/2:E==ie?0:fe)-E*ie*((E==0?ee/2:0)+(Ce?he/2:0));let O={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Te=ge?null:new Path2D,Ee=null;if(se!=null)Ee=e.data[se.series[1]];else{let{y0:n,y1:r}=l;n!=null&&r!=null&&(g=r.values(e,t,i,p),Ee=n.values(e,t,i,p))}let De=ne*fe,Oe=re*fe;for(let n=ie==1?i:p;n>=i&&n<=p;n+=ie){let r=g[n];if(r==null)continue;if(Ee!=null){let e=Ee[n]??0;if(r-e==0)continue;ue=b(e,v,w,S)}let i=y(_.distr!=2||l!=null?h[n]:n,_,C,x),a=b(F(r,le),v,w,S),o=T(i-de),s=T(St(a,ue)),c=T(xt(a,ue)),u=s-c;if(r!=null){let i=r<0?Oe:De,a=r<0?De:Oe;ge?(he>0&&ye[n]!=null&&ae(be.get(ye[n]),o,c+yt(he/2),fe,St(0,u-he),i,a),_e[n]!=null&&ae(ve.get(_e[n]),o,c+yt(he/2),fe,St(0,u-he),i,a)):ae(Te,o,c+yt(he/2),fe,St(0,u-he),i,a),oe(e,t,n,o-he/2,c,fe+he,u)}}return he>0?O.stroke=ge?be:Te:ge||(O._fill=m.width==0?m._fill:m._stroke??m._fill,O.width=0),O.fill=ge?ve:Te,O})}function gi(e,t){let n=F(t?.alignGaps,0);return(t,r,i,a)=>Ur(t,r,(o,s,c,l,u,d,f,p,m,h,g)=>{[i,a]=rt(c,i,a);let _=o.pxRound,v=e=>_(d(e,l,h,p)),y=e=>_(f(e,u,g,m)),b,x,S;l.ori==0?(b=Qr,S=ei,x=oi):(b=$r,S=ti,x=si);let C=l.dir*(l.ori==0?1:-1),w=v(s[C==1?i:a]),T=w,E=[],ee=[];for(let e=C==1?i:a;e>=i&&e<=a;e+=C)if(c[e]!=null){let t=s[e],n=v(t);E.push(T=n),ee.push(y(c[e]))}let D={stroke:e(E,ee,b,S,x,_),fill:null,clip:null,band:null,gaps:null,flags:Vr},te=D.stroke,[ne,re]=Wr(t,r);if(o.fill!=null||ne!=0){let e=D.fill=new Path2D(te),n=y(o.fillTo(t,r,o.min,o.max,ne));S(e,T,n),S(e,w,n)}if(!o.spanGaps){let e=[];e.push(...Yr(s,c,i,a,C,v,n)),D.gaps=e=o.gaps(t,r,i,a,e),D.clip=qr(e,l.ori,p,m,h,g)}return re!=0&&(D.band=re==2?[Kr(t,r,i,a,te,-1),Kr(t,r,i,a,te,1)]:Kr(t,r,i,a,te,re)),D})}function _i(e){return gi(vi,e)}function vi(e,t,n,r,i,a){let o=e.length;if(o<2)return null;let s=new Path2D;if(n(s,e[0],t[0]),o==2)r(s,e[1],t[1]);else{let n=Array(o),r=Array(o-1),a=Array(o-1),c=Array(o-1);for(let n=0;n<o-1;n++)a[n]=t[n+1]-t[n],c[n]=e[n+1]-e[n],r[n]=a[n]/c[n];n[0]=r[0];for(let e=1;e<o-1;e++)r[e]===0||r[e-1]===0||r[e-1]>0!=r[e]>0?n[e]=0:(n[e]=3*(c[e-1]+c[e])/((2*c[e]+c[e-1])/r[e-1]+(c[e]+2*c[e-1])/r[e]),isFinite(n[e])||(n[e]=0));n[o-1]=r[o-2];for(let r=0;r<o-1;r++)i(s,e[r]+c[r]/3,t[r]+n[r]*c[r]/3,e[r+1]-c[r]/3,t[r+1]-n[r+1]*c[r]/3,e[r+1],t[r+1])}return s}var yi=new Set;function bi(){for(let e of yi)e.syncRect(!0)}k&&(Qe(Me,Re,bi),Qe(Ne,Re,bi,!0),Qe(Fe,Re,()=>{J.pxRatio=A}));var xi=fi(),Si=ci();function Ci(e,t,n,r){return(r?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map((e,r)=>Ti(e,r,t,n))}function wi(e,t){return e.map((e,n)=>n==0?{}:U({},t,e))}function Ti(e,t,n,r){return U({},t==0?n:r,e)}function Ei(e,t,n){return t==null?Kt:[t,n]}var Di=Ei;function Oi(e,t,n){return t==null?Kt:ft(t,n,ct,!0)}function ki(e,t,n,r){return t==null?Kt:ot(t,n,e.scales[r].log,!1)}var Ai=ki;function ji(e,t,n,r){return t==null?Kt:st(t,n,e.scales[r].log,!1)}var Mi=ji;function Ni(e,t,n,r,i){let a=St(kt(e),kt(t)),o=t-e,s=et(i/r*o,n);do{let e=n[s],t=r*e/o;if(t>=i&&a+(e<5?Ht.get(e):0)<=17)return[e,t]}while(++s<n.length);return[0,0]}function Pi(e){let t,n;return e=e.replace(/(\d+)px/,(e,r)=>(t=L((n=+r)*A))+`px`),[e,t,n]}function Fi(e){e.show&&[e.font,e.labelFont].forEach(e=>{let t=V(e[2]*A,1);e[0]=e[0].replace(/[0-9.]+px/,t+`px`),e[1]=t})}function J(e,t,n){let r={mode:F(e.mode,1)},i=r.mode;function a(e,t,n,r){let i=t.valToPct(e);return r+n*(t.dir==-1?1-i:i)}function o(e,t,n,r){let i=t.valToPct(e);return r+n*(t.dir==-1?i:1-i)}function s(e,t,n,r){return t.ori==0?a(e,t,n,r):o(e,t,n,r)}r.valToPosH=a,r.valToPosV=o;let c=!1;r.status=0;let l=r.root=Ge(ee);if(e.id!=null&&(l.id=e.id),He(l,e.class),e.title){let t=Ge(ne,l);t.textContent=e.title}let u=We(`canvas`),d=r.ctx=u.getContext(`2d`),f=Ge(re,l);Qe(`click`,f,e=>{e.target===m&&(Y!=bi||X!=J)&&Z.click(r,e)},!0);let p=r.under=Ge(ie,f);f.appendChild(u);let m=r.over=Ge(ae,f);e=tn(e);let h=+F(e.pxAlign,1),g=Xr(h);(e.plugins||[]).forEach(t=>{t.opts&&(e=t.opts(r,e)||e)});let _=e.ms||.001,v=r.series=i==1?Ci(e.series||[],gr,Fr,!1):wi(e.series||[null],Pr),y=r.axes=Ci(e.axes||[],pr,kr,!0),b=r.scales={},x=r.bands=e.bands||[];x.forEach(e=>{e.fill=z(e.fill||null),e.dir=F(e.dir,-1)});let S=i==2?v[1].facets[0].scale:v[0].scale,C={axes:ri,series:Wr},w=(e.drawOrder||[`axes`,`series`]).map(e=>C[e]);function T(e){let t=e.distr==3?t=>Tt(t>0?t:e.clamp(r,t,e.min,e.max,e.key)):e.distr==4?t=>Ot(t,e.asinh):e.distr==100?t=>e.fwd(t):e=>e;return n=>{let r=t(n),{_min:i,_max:a}=e,o=a-i;return(r-i)/o}}function E(t){let n=b[t];if(n==null){let r=(e.scales||Wt)[t]||Wt;if(r.from!=null){E(r.from);let e=U({},b[r.from],r,{key:t});e.valToPct=T(e),b[t]=e}else{n=b[t]=U({},t==S?Lr:Rr,r),n.key=t;let e=n.time,a=n.range,o=qt(a);if((t!=S||i==2&&!e)&&(o&&(a[0]==null||a[1]==null)&&(a={min:a[0]==null?lt:{mode:1,hard:a[0],soft:a[0]},max:a[1]==null?lt:{mode:1,hard:a[1],soft:a[1]}},o=!1),!o&&Zt(a))){let e=a;a=(t,n,r)=>n==null?Kt:ft(n,r,e)}n.range=z(a||(e?Di:t==S?n.distr==3?Ai:n.distr==4?Mi:Ei:n.distr==3?ki:n.distr==4?ji:Oi)),n.auto=z(o?!1:n.auto),n.clamp=z(n.clamp||Ir),n._min=n._max=null,n.valToPct=T(n)}}}E(`x`),E(`y`),i==1&&v.forEach(e=>{E(e.scale)}),y.forEach(e=>{E(e.scale)});for(let t in e.scales)E(t);let O=b[S],Me=O.distr,Ne,Pe;O.ori==0?(He(l,D),Ne=a,Pe=o):(He(l,te),Ne=o,Pe=a);let k={};for(let e in b){let t=b[e];(t.min!=null||t.max!=null)&&(k[e]={min:t.min,max:t.max},t.min=t.max=null)}let ze=e.tzDate||(e=>new Date(L(e/_))),Be=e.fmtDate||bn,Ve=_==1?Bn(ze):Un(ze),Ke=Gn(ze,Wn(_==1?zn:Hn,Be)),Je=Xn(ze,Jn(Yn,Be)),Xe=[],M=r.legend=U({},$n,e.legend),N=r.cursor=U({},ar,{drag:{y:i==2}},e.cursor),tt=M.show,nt=N.show,P=M.markers;M.idxs=Xe,P.width=z(P.width),P.dash=z(P.dash),P.stroke=z(P.stroke),P.fill=z(P.fill);let rt,it,ut,dt=[],mt=[],ht,gt=!1,_t={};if(M.live){let e=v[1]?v[1].values:null;gt=e!=null,ht=gt?e(r,1,0):{_:0};for(let e in ht)_t[e]=Ie}if(tt)if(rt=We(`table`,fe,l),ut=We(`tbody`,null,rt),M.mount(r,rt),gt){it=We(`thead`,null,rt,ut);let e=We(`tr`,null,it);for(var yt in We(`th`,null,e),ht)We(`th`,_e,e).textContent=yt}else He(rt,me),M.live&&He(rt,pe);let wt={show:!0},Et={show:!1};function kt(e,t){if(t==0&&(gt||!M.live||i==2))return Kt;let n=[],a=We(`tr`,he,ut,ut.childNodes[t]);He(a,e.class),e.show||He(a,se);let o=We(`th`,null,a);if(P.show){let e=Ge(ge,o);if(t>0){let n=P.width(r,t);n&&(e.style.border=n+`px `+P.dash(r,t)+` `+P.stroke(r,t)),e.style.background=P.fill(r,t)}}let s=Ge(_e,o);for(var c in e.label instanceof HTMLElement?s.appendChild(e.label):s.textContent=e.label,t>0&&(P.show||(s.style.color=e.width>0?P.stroke(r,t):P.fill(r,t)),Nt(`click`,o,t=>{if(N._lock)return;wn(t);let n=v.indexOf(e);if((t.ctrlKey||t.metaKey)!=M.isolate){let e=v.some((e,t)=>t>0&&t!=n&&e.show);v.forEach((t,r)=>{r>0&&Gi(r,e?r==n?wt:Et:wt,!0,$.setSeries)})}else Gi(n,{show:!e.show},!0,$.setSeries)},!1),kn&&Nt(ke,o,t=>{N._lock||(wn(t),Gi(v.indexOf(e),$i,!0,$.setSeries))},!1)),ht){let e=We(`td`,ve,a);e.textContent=`--`,n.push(e)}return[a,n]}let Mt=new Map;function Nt(e,t,n,i=!0){let a=Mt.get(t)||{},o=N.bind[e](r,t,n,i);o&&(Qe(e,t,a[e]=o),Mt.set(t,a))}function Rt(e,t,n){let r=Mt.get(t)||{};for(let n in r)(e==null||n==e)&&($e(n,t,r[n]),delete r[n]);e??Mt.delete(t)}let zt=0,Vt=0,B=0,H=0,Jt=0,$t=0,en=Jt,nn=$t,rn=B,an=H,on=0,sn=0,ln=0,un=0;r.bbox={};let dn=!1,fn=!1,pn=!1,mn=!1,hn=!1,gn=!1;function _n(e,t,n){(n||e!=r.width||t!=r.height)&&vn(e,t),ii(!1),pn=!0,fn=!0,li()}function vn(e,t){r.width=zt=B=e,r.height=Vt=H=t,Jt=$t=0,Sn(),Cn();let n=r.bbox;on=n.left=Bt(Jt*A,.5),sn=n.top=Bt($t*A,.5),ln=n.width=Bt(B*A,.5),un=n.height=Bt(H*A,.5)}function yn(){let e=!1,t=0;for(;!e;){t++;let n=ti(t),i=ni(t);e=t==3||n&&i,e||(vn(r.width,r.height),fn=!0)}}function xn({width:e,height:t}){_n(e,t)}r.setSize=xn;function Sn(){let e=!1,t=!1,n=!1,r=!1;y.forEach((i,a)=>{if(i.show&&i._show){let{side:a,_size:o}=i,s=a%2,c=o+(i.label==null?0:i.labelSize);c>0&&(s?(B-=c,a==3?(Jt+=c,r=!0):n=!0):(H-=c,a==0?($t+=c,e=!0):t=!0))}}),Ln[0]=e,Ln[1]=n,Ln[2]=t,Ln[3]=r,B-=er[1]+er[3],Jt+=er[3],H-=er[2]+er[0],$t+=er[0]}function Cn(){let e=Jt+B,t=$t+H,n=Jt,r=$t;function i(i,a){switch(i){case 1:return e+=a,e-a;case 2:return t+=a,t-a;case 3:return n-=a,n+a;case 0:return r-=a,r+a}}y.forEach((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=i(t,e._size),e.label!=null&&(e._lpos=i(t,e.labelSize))}})}if(N.dataIdx==null){let e=N.hover,n=e.skip=new Set(e.skip??[]);n.add(void 0);let r=e.prox=z(e.prox),i=e.bias??=0;N.dataIdx=(e,a,o,s)=>{if(a==0)return o;let c=o,l=r(e,a,o,s)??R,u=l>=0&&l<R,d=O.ori==0?B:H,f=N.left,p=t[0],m=t[a];if(n.has(m[o])){c=null;let e=null,t=null,r;if(i==0||i==-1)for(r=o;e==null&&r-- >0;)n.has(m[r])||(e=r);if(i==0||i==1)for(r=o;t==null&&r++<m.length;)n.has(m[r])||(t=r);if(e!=null||t!=null)if(u){let n=e==null?-1/0:Ne(p[e],O,d,0),r=t==null?1/0:Ne(p[t],O,d,0),i=f-n,a=r-f;i<=a?i<=l&&(c=e):a<=l&&(c=t)}else c=t==null?e:e==null?t:o-e<=t-o?e:t}else u&&I(f-Ne(p[o],O,d,0))>l&&(c=null);return c}}let wn=e=>{N.event=e};N.idxs=Xe,N._lock=!1;let Tn=N.points;Tn.show=z(Tn.show),Tn.size=z(Tn.size),Tn.stroke=z(Tn.stroke),Tn.width=z(Tn.width),Tn.fill=z(Tn.fill);let En=r.focus=U({},e.focus||{alpha:.3},N.focus),kn=En.prox>=0,An=kn&&Tn.one,jn=[],Mn=[],Nn=[];function Pn(e,t){let n=Tn.show(r,t);if(n instanceof HTMLElement)return He(n,de),He(n,e.class),qe(n,-10,-10,B,H),m.insertBefore(n,jn[t]),n}function Fn(e,t){if(i==1||t>0){let t=i==1&&b[e.scale].time,n=e.value;e.value=t?Xt(n)?Xn(ze,Jn(n,Be)):n||Je:n||Or,e.label=e.label||(t?hr:mr)}if(An||t>0){e.width=e.width==null?1:e.width,e.paths=e.paths||xi||Ft,e.fillTo=z(e.fillTo||Gr),e.pxAlign=+F(e.pxAlign,h),e.pxRound=Xr(e.pxAlign),e.stroke=z(e.stroke||null),e.fill=z(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=Ar(St(1,e.width),1),n=e.points=U({},{size:t,width:St(1,t*.2),stroke:e.stroke,space:t*2,paths:Si,_stroke:null,_fill:null},e.points);n.show=z(n.show),n.filter=z(n.filter),n.fill=z(n.fill),n.stroke=z(n.stroke),n.paths=z(n.paths),n.pxAlign=e.pxAlign}if(tt){let n=kt(e,t);dt.splice(t,0,n[0]),mt.splice(t,0,n[1]),M.values.push(null)}if(nt){Xe.splice(t,0,null);let n=null;An?t==0&&(n=Pn(e,t)):t>0&&(n=Pn(e,t)),jn.splice(t,0,n),Mn.splice(t,0,0),Nn.splice(t,0,0)}Oa(`addSeries`,t)}function In(e,t){t??=v.length,e=i==1?Ti(e,t,gr,Fr):Ti(e,t,{},Pr),v.splice(t,0,e),Fn(v[t],t)}r.addSeries=In;function W(e){if(v.splice(e,1),tt){M.values.splice(e,1),mt.splice(e,1);let t=dt.splice(e,1)[0];Rt(null,t.firstChild),t.remove()}nt&&(Xe.splice(e,1),jn.splice(e,1)[0].remove(),Mn.splice(e,1),Nn.splice(e,1)),Oa(`delSeries`,e)}r.delSeries=W;let Ln=[!1,!1,!1,!1];function qn(e,t){if(e._show=e.show,e.show){let n=e.side%2,i=b[e.scale];i??=(e.scale=n?v[1].scale:S,b[e.scale]);let a=i.time;e.size=z(e.size),e.space=z(e.space),e.rotate=z(e.rotate),qt(e.incrs)&&e.incrs.forEach(e=>{!Ht.has(e)&&Ht.set(e,Ut(e))}),e.incrs=z(e.incrs||(i.distr==2?Dn:a?_==1?Rn:Vn:On)),e.splits=z(e.splits||(a&&i.distr==1?Ve:i.distr==3?yr:i.distr==4?br:vr)),e.stroke=z(e.stroke),e.grid.stroke=z(e.grid.stroke),e.ticks.stroke=z(e.ticks.stroke),e.border.stroke=z(e.border.stroke);let o=e.values;e.values=qt(o)&&!qt(o[0])?z(o):a?qt(o)?Gn(ze,Wn(o,Be)):Xt(o)?Kn(ze,o):o||Ke:o||_r,e.filter=z(e.filter||(i.distr>=3&&i.log==10?Er:i.distr==3&&i.log==2?Dr:Pt)),e.font=Pi(e.font),e.labelFont=Pi(e.labelFont),e._size=e.size(r,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(Ln[t]=!0,e._el=Ge(oe,f))}}function Zn(e,t,n,r){let[i,a,o,s]=n,c=t%2,l=0;return c==0&&(s||a)&&(l=t==0&&!i||t==2&&!o?L(pr.size/3):0),c==1&&(i||o)&&(l=t==1&&!a||t==3&&!s?L(kr.size/2):0),l}let Qn=r.padding=(e.padding||[Zn,Zn,Zn,Zn]).map(e=>z(F(e,Zn))),er=r._padding=Qn.map((e,t)=>e(r,t,Ln,0)),G,K=null,q=null,tr=i==1?v[0].idxs:null,nr=null,rr=!1;function ir(e,n){if(t=e??[],r.data=r._data=t,i==2){G=0;for(let e=1;e<v.length;e++)G+=t[e][0].length}else{t.length==0&&(r.data=r._data=t=[[]]),nr=t[0],G=nr.length;let e=t;if(Me==2){e=t.slice();let n=e[0]=Array(G);for(let e=0;e<G;e++)n[e]=e}r._data=t=e}if(ii(!0),Oa(`setData`),Me==2&&(pn=!0),n!==!1){let e=O;e.auto(r,rr)?or():Wi(S,e.min,e.max),mn||=N.left>=0,gn=!0,li()}}r.setData=ir;function or(){rr=!0;let e,n;i==1&&(G>0?(K=tr[0]=0,q=tr[1]=G-1,e=t[0][K],n=t[0][q],Me==2?(e=K,n=q):e==n&&(Me==3?[e,n]=ot(e,e,O.log,!1):Me==4?[e,n]=st(e,e,O.log,!1):O.time?n=e+L(86400/_):[e,n]=ft(e,n,ct,!0))):(K=tr[0]=e=null,q=tr[1]=n=null)),Wi(S,e,n)}let sr,cr,lr,ur,dr,fr,xr,Sr,Cr,wr;function Tr(e,t,n,r,i,a){e??=Te,n??=Gt,r??=`butt`,i??=Te,a??=`round`,e!=sr&&(d.strokeStyle=sr=e),i!=cr&&(d.fillStyle=cr=i),t!=lr&&(d.lineWidth=lr=t),a!=dr&&(d.lineJoin=dr=a),r!=fr&&(d.lineCap=fr=r),n!=ur&&d.setLineDash(ur=n)}function jr(e,t,n,r){t!=cr&&(d.fillStyle=cr=t),e!=xr&&(d.font=xr=e),n!=Sr&&(d.textAlign=Sr=n),r!=Cr&&(d.textBaseline=Cr=r)}function Mr(e,t,n,i,a=0){if(i.length>0&&e.auto(r,rr)&&(t==null||t.min==null)){let t=F(K,0),r=F(q,i.length-1),o=n.min==null?at(i,t,r,a,e.distr==3):[n.min,n.max];e.min=xt(e.min,n.min=o[0]),e.max=St(e.max,n.max=o[1])}}let Nr={min:null,max:null};function zr(){for(let e in b){let t=b[e];k[e]==null&&(t.min==null||k[S]!=null&&t.auto(r,rr))&&(k[e]=Nr)}for(let e in b){let t=b[e];k[e]==null&&t.from!=null&&k[t.from]!=null&&(k[e]=Nr)}k[S]!=null&&ii(!0);let e={};for(let t in k){let n=k[t];if(n!=null){let a=e[t]=tn(b[t],Qt);if(n.min!=null)U(a,n);else if(t!=S||i==2)if(G==0&&a.from==null){let e=a.range(r,null,null,t);a.min=e[0],a.max=e[1]}else a.min=R,a.max=-1/0}}if(G>0){v.forEach((n,a)=>{if(i==1){let i=n.scale,o=k[i];if(o==null)return;let s=e[i];if(a==0){let e=s.range(r,s.min,s.max,i);s.min=e[0],s.max=e[1],K=et(s.min,t[0]),q=et(s.max,t[0]),q-K>1&&(t[0][K]<s.min&&K++,t[0][q]>s.max&&q--),n.min=nr[K],n.max=nr[q]}else n.show&&n.auto&&Mr(s,o,n,t[a],n.sorted);n.idxs[0]=K,n.idxs[1]=q}else if(a>0&&n.show&&n.auto){let[r,i]=n.facets,o=r.scale,s=i.scale,[c,l]=t[a],u=e[o],d=e[s];u!=null&&Mr(u,k[o],r,c,r.sorted),d!=null&&Mr(d,k[s],i,l,i.sorted),n.min=i.min,n.max=i.max}});for(let t in e){let n=e[t],i=k[t];if(n.from==null&&(i==null||i.min==null)){let e=n.range(r,n.min==R?null:n.min,n.max==-1/0?null:n.max,t);n.min=e[0],n.max=e[1]}}}for(let t in e){let n=e[t];if(n.from!=null){let i=e[n.from];if(i.min==null)n.min=n.max=null;else{let e=n.range(r,i.min,i.max,t);n.min=e[0],n.max=e[1]}}}let n={},a=!1;for(let t in e){let r=e[t],i=b[t];if(i.min!=r.min||i.max!=r.max){i.min=r.min,i.max=r.max;let e=i.distr;i._min=e==3?Tt(i.min):e==4?Ot(i.min,i.asinh):e==100?i.fwd(i.min):i.min,i._max=e==3?Tt(i.max):e==4?Ot(i.max,i.asinh):e==100?i.fwd(i.max):i.max,n[t]=a=!0}}if(a){v.forEach((e,t)=>{i==2?t>0&&n.y&&(e._paths=null):n[e.scale]&&(e._paths=null)});for(let e in n)pn=!0,Oa(`setScale`,e);nt&&N.left>=0&&(mn=gn=!0)}for(let e in k)k[e]=null}function Ur(e){let t=At(K-1,0,G-1),n=At(q+1,0,G-1);for(;e[t]==null&&t>0;)t--;for(;e[n]==null&&n<G-1;)n++;return[t,n]}function Wr(){if(G>0){let e=v.some(e=>e._focus)&&wr!=En.alpha;e&&(d.globalAlpha=wr=En.alpha),v.forEach((e,n)=>{if(n>0&&e.show&&(Kr(n,!1),Kr(n,!0),e._paths==null)){let a=wr;wr!=e.alpha&&(d.globalAlpha=wr=e.alpha);let o=i==2?[0,t[n][0].length-1]:Ur(t[n]);e._paths=e.paths(r,n,o[0],o[1]),wr!=a&&(d.globalAlpha=wr=a)}}),v.forEach((e,t)=>{if(t>0&&e.show){let n=wr;wr!=e.alpha&&(d.globalAlpha=wr=e.alpha),e._paths!=null&&qr(t,!1);{let n=e._paths==null?null:e._paths.gaps,i=e.points.show(r,t,K,q,n),a=e.points.filter(r,t,i,n);(i||a)&&(e.points._paths=e.points.paths(r,t,K,q,a),qr(t,!0))}wr!=n&&(d.globalAlpha=wr=n),Oa(`drawSeries`,t)}}),e&&(d.globalAlpha=wr=1)}}function Kr(e,t){let n=t?v[e].points:v[e];n._stroke=n.stroke(r,e),n._fill=n.fill(r,e)}function qr(e,t){let n=t?v[e].points:v[e],{stroke:r,fill:i,clip:a,flags:o,_stroke:s=n._stroke,_fill:c=n._fill,_width:l=n.width}=n._paths;l=V(l*A,3);let u=null,f=l%2/2;t&&c==null&&(c=l>0?`#fff`:s);let p=n.pxAlign==1&&f>0;if(p&&d.translate(f,f),!t){let e=on-l/2,t=sn-l/2,n=ln+l,r=un+l;u=new Path2D,u.rect(e,t,n,r)}t?Yr(s,l,n.dash,n.cap,c,r,i,o,a):Jr(e,s,l,n.dash,n.cap,c,r,i,o,u,a),p&&d.translate(-f,-f)}function Jr(e,n,i,a,o,s,c,l,u,d,f){let p=!1;u!=0&&x.forEach((m,h)=>{if(m.series[0]==e){let e=v[m.series[1]],g=t[m.series[1]],_=(e._paths||Wt).band;qt(_)&&(_=m.dir==1?_[0]:_[1]);let y,b=null;e.show&&_&&pt(g,K,q)?(b=m.fill(r,h)||s,y=e._paths.clip):_=null,Yr(n,i,a,o,b,c,l,u,d,f,y,_),p=!0}}),p||Yr(n,i,a,o,s,c,l,u,d,f)}function Yr(e,t,n,r,i,a,o,s,c,l,u,f){Tr(e,t,n,r,i),(c||l||f)&&(d.save(),c&&d.clip(c),l&&d.clip(l)),f?(s&3)==3?(d.clip(f),u&&d.clip(u),Qr(i,o),Zr(e,a,t)):s&Hr?(Qr(i,o),d.clip(f),Zr(e,a,t)):s&Vr&&(d.save(),d.clip(f),u&&d.clip(u),Qr(i,o),d.restore(),Zr(e,a,t)):(Qr(i,o),Zr(e,a,t)),(c||l||f)&&d.restore()}function Zr(e,t,n){n>0&&(t instanceof Map?t.forEach((e,t)=>{d.strokeStyle=sr=t,d.stroke(e)}):t!=null&&e&&d.stroke(t))}function Qr(e,t){t instanceof Map?t.forEach((e,t)=>{d.fillStyle=cr=t,d.fill(e)}):t!=null&&e&&d.fill(t)}function $r(e,t,n,i){let a=y[e],o;if(i<=0)o=[0,0];else{let s=a._space=a.space(r,e,t,n,i);o=Ni(t,n,a._incrs=a.incrs(r,e,t,n,i,s),i,s)}return a._found=o}function ei(e,t,n,r,i,a,o,s,c,l){let u=o%2/2;h==1&&d.translate(u,u),Tr(s,o,c,l,s),d.beginPath();let f,p,m,g,_=i+(r==0||r==3?-a:a);n==0?(p=i,g=_):(f=i,m=_);for(let r=0;r<e.length;r++)t[r]!=null&&(n==0?f=m=e[r]:p=g=e[r],d.moveTo(f,p),d.lineTo(m,g));d.stroke(),h==1&&d.translate(-u,-u)}function ti(e){let t=!0;return y.forEach((n,i)=>{if(!n.show)return;let a=b[n.scale];if(a.min==null){n._show&&(t=!1,n._show=!1,ii(!1));return}else n._show||(t=!1,n._show=!0,ii(!1));let o=n.side,s=o%2,{min:c,max:l}=a,[u,d]=$r(i,c,l,s==0?B:H);if(d==0)return;let f=a.distr==2,p=n._splits=n.splits(r,i,c,l,u,d,f),m=a.distr==2?p.map(e=>nr[e]):p,h=a.distr==2?nr[p[1]]-nr[p[0]]:u,g=n._values=n.values(r,n.filter(r,m,i,d,h),i,d,h);n._rotate=o==2?n.rotate(r,g,i,d):0;let _=n._size;n._size=bt(n.size(r,g,i,e)),_!=null&&n._size!=_&&(t=!1)}),t}function ni(e){let t=!0;return Qn.forEach((n,i)=>{let a=n(r,i,Ln,e);a!=er[i]&&(t=!1),er[i]=a}),t}function ri(){for(let e=0;e<y.length;e++){let t=y[e];if(!t.show||!t._show)continue;let n=t.side,i=n%2,a,o,c=t.stroke(r,e),l=n==0||n==3?-1:1,[u,f]=t._found;if(t.label!=null){let s=t.labelGap*l,p=L((t._lpos+s)*A);jr(t.labelFont[0],c,`center`,n==2?xe:Se),d.save(),i==1?(a=o=0,d.translate(p,L(sn+un/2)),d.rotate((n==3?-vt:vt)/2)):(a=L(on+ln/2),o=p);let m=jt(t.label)?t.label(r,e,u,f):t.label;d.fillText(m,a,o),d.restore()}if(f==0)continue;let p=b[t.scale],m=i==0?ln:un,h=i==0?on:sn,_=t._splits,v=p.distr==2?_.map(e=>nr[e]):_,x=p.distr==2?nr[_[1]]-nr[_[0]]:u,S=t.ticks,C=t.border,w=S.show?S.size:0,T=L(w*A),E=L((t.alignTo==2?t._size-w-t.gap:t.gap)*A),ee=t._rotate*-vt/180,D=g(t._pos*A),te=D+(T+E)*l;o=i==0?te:0,a=i==1?te:0;let ne=t.font[0];jr(ne,c,t.align==1?Ce:t.align==2?we:ee>0?Ce:ee<0?we:i==0?`center`:n==3?we:Ce,ee||i==1?`middle`:n==2?xe:Se);let re=t.font[1]*t.lineGap,ie=_.map(e=>g(s(e,p,m,h))),ae=t._values;for(let e=0;e<ae.length;e++){let t=ae[e];if(t!=null){i==0?a=ie[e]:o=ie[e],t=``+t;let n=t.indexOf(`
10
+ `)==-1?[t]:t.split(/\n/gm);for(let e=0;e<n.length;e++){let t=n[e];ee?(d.save(),d.translate(a,o+e*re),d.rotate(ee),d.fillText(t,0,0),d.restore()):d.fillText(t,a,o+e*re)}}}S.show&&ei(ie,S.filter(r,v,e,f,x),i,n,D,T,V(S.width*A,3),S.stroke(r,e),S.dash,S.cap);let oe=t.grid;oe.show&&ei(ie,oe.filter(r,v,e,f,x),i,i==0?2:1,i==0?sn:on,i==0?un:ln,V(oe.width*A,3),oe.stroke(r,e),oe.dash,oe.cap),C.show&&ei([D],[1],+(i==0),i==0?1:2,i==1?sn:on,i==1?un:ln,V(C.width*A,3),C.stroke(r,e),C.dash,C.cap)}Oa(`drawAxes`)}function ii(e){v.forEach((t,n)=>{n>0&&(t._paths=null,e&&(i==1?(t.min=null,t.max=null):t.facets.forEach(e=>{e.min=null,e.max=null})))})}let ai=!1,oi=!1,si=[];function ci(){oi=!1;for(let e=0;e<si.length;e++)Oa(...si[e]);si.length=0}function li(){ai||=(cn(di),!0)}function ui(e,t=!1){ai=!0,oi=t,e(r),di(),t&&si.length>0&&queueMicrotask(ci)}r.batch=ui;function di(){if(dn&&=(zr(),!1),pn&&=(yn(),!1),fn){if(j(p,Ce,Jt),j(p,xe,$t),j(p,ye,B),j(p,be,H),j(m,Ce,Jt),j(m,xe,$t),j(m,ye,B),j(m,be,H),j(f,ye,zt),j(f,be,Vt),u.width=L(zt*A),u.height=L(Vt*A),y.forEach(({_el:e,_show:t,_size:n,_pos:r,side:i})=>{if(e!=null)if(t){let t=i===3||i===0?n:0,a=i%2==1;j(e,a?`left`:`top`,r-t),j(e,a?`width`:`height`,n),j(e,a?`top`:`left`,a?$t:Jt),j(e,a?`height`:`width`,a?H:B),Ue(e,se)}else He(e,se)}),sr=cr=lr=dr=fr=xr=Sr=Cr=ur=null,wr=1,fa(!0),Jt!=en||$t!=nn||B!=rn||H!=an){ii(!1);let e=B/rn,t=H/an;if(nt&&!mn&&N.left>=0){N.left*=e,N.top*=t,hi&&qe(hi,L(N.left),0,B,H),gi&&qe(gi,0,L(N.top),B,H);for(let n=0;n<jn.length;n++){let r=jn[n];r!=null&&(Mn[n]*=e,Nn[n]*=t,qe(r,bt(Mn[n]),bt(Nn[n]),B,H))}}if(Q.show&&!hn&&Q.left>=0&&Q.width>0){Q.left*=e,Q.width*=e,Q.top*=t,Q.height*=t;for(let e in ha)j(Vi,e,Q[e])}en=Jt,nn=$t,rn=B,an=H}Oa(`setSize`),fn=!1}zt>0&&Vt>0&&(d.clearRect(0,0,u.width,u.height),Oa(`drawClear`),w.forEach(e=>e()),Oa(`draw`)),Q.show&&hn&&(Hi(Q),hn=!1),nt&&mn&&(ua(null,!0,!1),mn=!1),M.show&&M.live&&gn&&(ca(),gn=!1),c||(c=!0,r.status=1,Oa(`ready`)),rr=!1,ai=!1}r.redraw=(e,t)=>{pn=t||!1,e===!1?li():Wi(S,O.min,O.max)};function fi(e,n){let i=b[e];if(i.from==null){if(G==0){let t=i.range(r,n.min,n.max,e);n.min=t[0],n.max=t[1]}if(n.min>n.max){let e=n.min;n.min=n.max,n.max=e}if(G>1&&n.min!=null&&n.max!=null&&n.max-n.min<1e-16)return;e==S&&i.distr==2&&G>0&&(n.min=et(n.min,t[0]),n.max=et(n.max,t[0]),n.min==n.max&&n.max++),k[e]=n,dn=!0,li()}}r.setScale=fi;let pi,mi,hi,gi,_i,vi,bi,J,Ii,Li,Y,X,Ri=!1,Z=N.drag,zi=Z.x,Bi=Z.y;nt&&(N.x&&(pi=Ge(le,m)),N.y&&(mi=Ge(ue,m)),O.ori==0?(hi=pi,gi=mi):(hi=mi,gi=pi),Y=N.left,X=N.top);let Q=r.select=U({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),Vi=Q.show?Ge(ce,Q.over?m:p):null;function Hi(e,t){if(Q.show){for(let t in e)Q[t]=e[t],t in ha&&j(Vi,t,e[t]);t!==!1&&Oa(`setSelect`)}}r.setSelect=Hi;function Ui(e){if(v[e].show)tt&&Ue(dt[e],se);else if(tt&&He(dt[e],se),nt){let t=An?jn[0]:jn[e];t!=null&&qe(t,-10,-10,B,H)}}function Wi(e,t,n){fi(e,{min:t,max:n})}function Gi(e,t,n,a){t.focus!=null&&ea(e),t.show!=null&&v.forEach((n,r)=>{r>0&&(e==r||e==null)&&(n.show=t.show,Ui(r),i==2?(Wi(n.facets[0].scale,null,null),Wi(n.facets[1].scale,null,null)):Wi(n.scale,null,null),li())}),n!==!1&&Oa(`setSeries`,e,t),a&&Ma(`setSeries`,r,e,t)}r.setSeries=Gi;function Ki(e,t){U(x[e],t)}function qi(e,t){e.fill=z(e.fill||null),e.dir=F(e.dir,-1),t??=x.length,x.splice(t,0,e)}function Ji(e){e==null?x.length=0:x.splice(e,1)}r.addBand=qi,r.setBand=Ki,r.delBand=Ji;function Yi(e,t){v[e].alpha=t,nt&&jn[e]!=null&&(jn[e].style.opacity=t),tt&&dt[e]&&(dt[e].style.opacity=t)}let Xi,Zi,Qi,$i={focus:!0};function ea(e){if(e!=Qi){let t=e==null,n=En.alpha!=1;v.forEach((r,a)=>{if(i==1||a>0){let i=t||a==0||a==e;r._focus=t?null:i,n&&Yi(a,i?1:En.alpha)}}),Qi=e,n&&li()}}tt&&kn&&Nt(Ae,rt,e=>{N._lock||(wn(e),Qi!=null&&Gi(null,$i,!0,$.setSeries))});function ta(e,t,n){let r=b[t];n&&(e=e/A-(r.ori==1?$t:Jt));let i=B;r.ori==1&&(i=H,e=i-e),r.dir==-1&&(e=i-e);let a=r._min,o=r._max,s=e/i,c=a+(o-a)*s,l=r.distr;return l==3?Ct(10,c):l==4?Dt(c,r.asinh):l==100?r.bwd(c):c}function na(e,n){return et(ta(e,S,n),t[0],K,q)}r.valToIdx=e=>et(e,t[0]),r.posToIdx=na,r.posToVal=ta,r.valToPos=(e,t,n)=>b[t].ori==0?a(e,b[t],n?ln:B,n?on:0):o(e,b[t],n?un:H,n?sn:0),r.setCursor=(e,t,n)=>{Y=e.left,X=e.top,ua(null,t,n)};function ra(e,t){j(Vi,Ce,Q.left=e),j(Vi,ye,Q.width=t)}function ia(e,t){j(Vi,xe,Q.top=e),j(Vi,be,Q.height=t)}let aa=O.ori==0?ra:ia,oa=O.ori==1?ra:ia;function sa(){if(tt&&M.live)for(let e=+(i==2);e<v.length;e++){if(e==0&&gt)continue;let t=M.values[e],n=0;for(let r in t)mt[e][n++].firstChild.nodeValue=t[r]}}function ca(e,t){if(e!=null&&(e.idxs?e.idxs.forEach((e,t)=>{Xe[t]=e}):Yt(e.idx)||Xe.fill(e.idx),M.idx=Xe[0]),tt&&M.live){for(let e=0;e<v.length;e++)(e>0||i==1&&!gt)&&la(e,Xe[e]);sa()}gn=!1,t!==!1&&Oa(`setLegend`)}r.setLegend=ca;function la(e,n){let i=v[e],a=e==0&&Me==2?nr:t[e],o;gt?o=i.values(r,e,n)??_t:(o=i.value(r,n==null?null:a[n],e,n),o=o==null?_t:{_:o}),M.values[e]=o}function ua(e,n,a){Ii=Y,Li=X,[Y,X]=N.move(r,Y,X),N.left=Y,N.top=X,nt&&(hi&&qe(hi,L(Y),0,B,H),gi&&qe(gi,0,L(X),B,H));let o,s=K>q;Xi=R,Zi=null;let c=O.ori==0?B:H,l=O.ori==1?B:H;if(Y<0||G==0||s){o=N.idx=null;for(let e=0;e<v.length;e++){let t=jn[e];t!=null&&qe(t,-10,-10,B,H)}kn&&Gi(null,$i,!0,e==null&&$.setSeries),M.live&&(Xe.fill(o),gn=!0)}else{let e,n,a;i==1&&(e=O.ori==0?Y:X,n=ta(e,S),o=N.idx=et(n,t[0],K,q),a=Ne(t[0][o],O,c,0));let s=-10,u=-10,d=0,f=0,p=!0,m=``,h=``;for(let e=+(i==2);e<v.length;e++){let g=v[e],_=Xe[e],y=_==null?null:i==1?t[e][_]:t[e][1][_],x=N.dataIdx(r,e,o,n),S=x==null?null:i==1?t[e][x]:t[e][1][x];if(gn=gn||S!=y||x!=_,Xe[e]=x,e>0&&g.show){let n=x==null?-10:x==o?a:Ne(i==1?t[0][x]:t[e][0][x],O,c,0),_=S==null?-10:Pe(S,i==1?b[g.scale]:b[g.facets[1].scale],l,0);if(kn&&S!=null){let t=O.ori==1?Y:X,n=I(En.dist(r,e,x,_,t));if(n<Xi){let r=En.bias;if(r!=0){let i=ta(t,g.scale),a=S>=0?1:-1,o=i>=0?1:-1;o==a&&(o==1?r==1?S>=i:S<=i:r==1?S<=i:S>=i)&&(Xi=n,Zi=e)}else Xi=n,Zi=e}}if(gn||An){let t,i;O.ori==0?(t=n,i=_):(t=_,i=n);let a,o,c,l,g,v,y=!0,b=Tn.bbox;if(b!=null){y=!1;let t=b(r,e);c=t.left,l=t.top,a=t.width,o=t.height}else c=t,l=i,a=o=Tn.size(r,e);if(v=Tn.fill(r,e),g=Tn.stroke(r,e),An)e==Zi&&Xi<=En.prox&&(s=c,u=l,d=a,f=o,p=y,m=v,h=g);else{let t=jn[e];t!=null&&(Mn[e]=c,Nn[e]=l,Ze(t,a,o,y),Ye(t,v,g),qe(t,bt(c),bt(l),B,H))}}}}if(An){let e=En.prox;if(gn||(Qi==null?Xi<=e:Xi>e||Zi!=Qi)){let e=jn[0];e!=null&&(Mn[0]=s,Nn[0]=u,Ze(e,d,f,p),Ye(e,m,h),qe(e,bt(s),bt(u),B,H))}}}if(Q.show&&Ri)if(e!=null){let[t,n]=$.scales,[r,i]=$.match,[a,o]=e.cursor.sync.scales,s=e.cursor.drag;if(zi=s._x,Bi=s._y,zi||Bi){let{left:s,top:u,width:d,height:f}=e.select,p=e.scales[a].ori,m=e.posToVal,h,g,_,v,y,x=t!=null&&r(t,a),S=n!=null&&i(n,o);x&&zi?(p==0?(h=s,g=d):(h=u,g=f),_=b[t],v=Ne(m(h,a),_,c,0),y=Ne(m(h+g,a),_,c,0),aa(xt(v,y),I(y-v))):aa(0,c),S&&Bi?(p==1?(h=s,g=d):(h=u,g=f),_=b[n],v=Pe(m(h,o),_,l,0),y=Pe(m(h+g,o),_,l,0),oa(xt(v,y),I(y-v))):oa(0,l)}else ga()}else{let e=I(Ii-_i),t=I(Li-vi);if(O.ori==1){let n=e;e=t,t=n}zi=Z.x&&e>=Z.dist,Bi=Z.y&&t>=Z.dist;let n=Z.uni;n==null?Z.x&&Z.y&&(zi||Bi)&&(zi=Bi=!0):zi&&Bi&&(zi=e>=n,Bi=t>=n,!zi&&!Bi&&(t>e?Bi=!0:zi=!0));let r,i;zi&&(O.ori==0?(r=bi,i=Y):(r=J,i=X),aa(xt(r,i),I(i-r)),Bi||oa(0,l)),Bi&&(O.ori==1?(r=bi,i=Y):(r=J,i=X),oa(xt(r,i),I(i-r)),zi||aa(0,c)),!zi&&!Bi&&(aa(0,0),oa(0,0))}if(Z._x=zi,Z._y=Bi,e==null){if(a){if(Aa!=null){let[e,t]=$.scales;$.values[0]=e==null?null:ta(O.ori==0?Y:X,e),$.values[1]=t==null?null:ta(O.ori==1?Y:X,t)}Ma(Ee,r,Y,X,B,H,o)}if(kn){let e=a&&$.setSeries,t=En.prox;Qi==null?Xi<=t&&Gi(Zi,$i,!0,e):Xi>t?Gi(null,$i,!0,e):Zi!=Qi&&Gi(Zi,$i,!0,e)}}gn&&(M.idx=o,ca()),n!==!1&&Oa(`setCursor`)}let da=null;Object.defineProperty(r,"rect",{get(){return da??fa(!1),da}});function fa(e=!1){e?da=null:(da=m.getBoundingClientRect(),Oa(`syncRect`,da))}function pa(e,t,n,r,i,a,o){N._lock||Ri&&e!=null&&e.movementX==0&&e.movementY==0||(ma(e,t,n,r,i,a,o,!1,e!=null),e==null?ua(t,!0,!1):ua(null,!0,!0))}function ma(e,t,n,i,a,o,c,l,u){if(da??fa(!1),wn(e),e!=null)n=e.clientX-da.left,i=e.clientY-da.top;else{if(n<0||i<0){Y=-10,X=-10;return}let[e,r]=$.scales,c=t.cursor.sync,[l,u]=c.values,[d,f]=c.scales,[p,m]=$.match,h=t.axes[0].side%2==1,g=O.ori==0?B:H,_=O.ori==1?B:H,v=h?o:a,y=h?a:o,x=h?i:n,S=h?n:i;if(n=d==null?x/v*g:p(e,d)?s(l,b[e],g,0):-10,i=f==null?S/y*_:m(r,f)?s(u,b[r],_,0):-10,O.ori==1){let e=n;n=i,i=e}}u&&(t==null||t.cursor.event.type==Ee)&&((n<=1||n>=B-1)&&(n=Bt(n,B)),(i<=1||i>=H-1)&&(i=Bt(i,H))),l?(_i=n,vi=i,[bi,J]=N.move(r,n,i)):(Y=n,X=i)}let ha={width:0,height:0,left:0,top:0};function ga(){Hi(ha,!1)}let _a,va,ya,ba;function xa(e,t,n,i,a,o,s){Ri=!0,zi=Bi=Z._x=Z._y=!1,ma(e,t,n,i,a,o,s,!0,!1),e!=null&&(Nt(Oe,Le,Sa,!1),Ma(De,r,bi,J,B,H,null));let{left:c,top:l,width:u,height:d}=Q;_a=c,va=l,ya=u,ba=d}function Sa(e,t,n,i,a,o,s){Ri=Z._x=Z._y=!1,ma(e,t,n,i,a,o,s,!1,!0);let{left:c,top:l,width:u,height:d}=Q,f=u>0||d>0,p=_a!=c||va!=l||ya!=u||ba!=d;if(f&&p&&Hi(Q),Z.setScale&&f&&p){let e=c,t=u,n=l,r=d;if(O.ori==1&&(e=l,t=d,n=c,r=u),zi&&Wi(S,ta(e,S),ta(e+t,S)),Bi)for(let e in b){let t=b[e];e!=S&&t.from==null&&t.min!=R&&Wi(e,ta(n+r,e),ta(n,e))}ga()}else N.lock&&(N._lock=!N._lock,ua(t,!0,e!=null));e!=null&&(Rt(Oe,Le),Ma(Oe,r,Y,X,B,H,null))}function Ca(e,t,n,r,i,a,o){if(N._lock)return;wn(e);let s=Ri;if(Ri){let e=!0,t=!0,n,r;O.ori==0?(n=zi,r=Bi):(n=Bi,r=zi),n&&r&&(e=Y<=10||Y>=B-10,t=X<=10||X>=H-10),n&&e&&(Y=Y<bi?0:B),r&&t&&(X=X<J?0:H),ua(null,!0,!0),Ri=!1}Y=-10,X=-10,Xe.fill(null),ua(null,!0,!0),s&&(Ri=s)}function wa(e,t,n,i,a,o,s){N._lock||(wn(e),or(),ga(),e!=null&&Ma(je,r,Y,X,B,H,null))}function Ta(){y.forEach(Fi),_n(r.width,r.height,!0)}Qe(Fe,Re,Ta);let Ea={};Ea.mousedown=xa,Ea.mousemove=pa,Ea.mouseup=Sa,Ea.dblclick=wa,Ea.setSeries=(e,t,n,i)=>{let a=$.match[2];n=a(r,t,n),n!=-1&&Gi(n,i,!0,!1)},nt&&(Nt(De,m,xa),Nt(Ee,m,pa),Nt(ke,m,e=>{wn(e),fa(!1)}),Nt(Ae,m,Ca),Nt(je,m,wa),yi.add(r),r.syncRect=fa);let Da=r.hooks=e.hooks||{};function Oa(e,t,n){oi?si.push([e,t,n]):e in Da&&Da[e].forEach(e=>{e.call(null,r,t,n)})}(e.plugins||[]).forEach(e=>{for(let t in e.hooks)Da[t]=(Da[t]||[]).concat(e.hooks[t])});let ka=(e,t,n)=>n,$=U({key:null,setSeries:!1,filters:{pub:It,sub:It},scales:[S,v[1]?v[1].scale:null],match:[Lt,Lt,ka],values:[null,null]},N.sync);$.match.length==2&&$.match.push(ka),N.sync=$;let Aa=$.key,ja=Br(Aa);function Ma(e,t,n,r,i,a,o){$.filters.pub(e,t,n,r,i,a,o)&&ja.pub(e,t,n,r,i,a,o)}ja.sub(r);function Na(e,t,n,r,i,a,o){$.filters.sub(e,t,n,r,i,a,o)&&Ea[e](null,t,n,r,i,a,o)}r.pub=Na;function Pa(){ja.unsub(r),yi.delete(r),Mt.clear(),$e(Fe,Re,Ta),l.remove(),rt?.remove(),Oa(`destroy`)}r.destroy=Pa;function Fa(){Oa(`init`,e,t),ir(t||e.data,!1),k[S]?fi(S,k[S]):or(),hn=Q.show&&(Q.width>0||Q.height>0),mn=gn=!0,_n(e.width,e.height)}return v.forEach(Fn),y.forEach(qn),n?n instanceof HTMLElement?(n.appendChild(l),Fa()):n(r,Fa):Fa(),r}J.assign=U,J.fmtNum=gt,J.rangeNum=ft,J.rangeLog=ot,J.rangeAsinh=st,J.orient=Ur,J.pxRatio=A,J.join=sn,J.fmtDate=bn,J.tzDate=Sn,J.sync=Br;{J.addGap=Jr,J.clipGaps=qr;let e=J.paths={points:ci};e.linear=fi,e.stepped=pi,e.bars=hi,e.spline=_i}var Ii=c(`<div class="trend-chart svelte-1tp75kj"></div>`);function Li(i,a){e(a,!0);let o=n(void 0),s=n(void 0);function c(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||`currentColor`}function l(e,t){let n={stroke:()=>c(`--text-muted`),grid:{stroke:()=>c(`--border`),width:1},ticks:{stroke:()=>c(`--border`),width:1}};return new J({width:t,height:120,scales:{x:{time:!0}},series:[{},{stroke:()=>c(`--accent`),width:2,spanGaps:!1,points:{show:!1}}],axes:[n,{...n,size:52}],legend:{show:!1},cursor:{show:!1}},[a.times,a.values],e)}t(()=>{let e=w(o);if(!e)return;r(s,l(e,e.clientWidth||280));let t=new ResizeObserver(()=>{w(s)&&e.clientWidth>0&&w(s).setSize({width:e.clientWidth,height:120})});return t.observe(e),()=>{t.disconnect(),w(s)?.destroy(),r(s,void 0)}}),t(()=>{w(s)?.setData([a.times,a.values])}),t(()=>{a.theme,w(s)?.redraw(!1,!0)});var u=Ii();f(u,``,{},{"min-block-size":`120px`}),v(u,e=>r(o,e),()=>w(o)),T(i,u),m()}var Y=c(`<p class="muted-note">No samples for this instrument yet.</p>`),X=c(`<section class="svelte-9vkdzs"><div class="head svelte-9vkdzs"><span class="caps-label"> </span> <span class="latest svelte-9vkdzs"><b class="num svelte-9vkdzs"> </b> </span></div> <!></section>`),Ri=c(`<div class="trend-charts svelte-9vkdzs"></div>`);function Z(t,n){e(n,!0);let r=i(()=>({depth:{convert:e=>n.mode===`imperial`?h(e):e,unit:y(n.mode),digits:1},wind:{convert:l,unit:`kn`,digits:1},pressure:{convert:e=>u(e,n.mode),unit:x(n.mode),digits:n.mode===`imperial`?2:0},sog:{convert:l,unit:`kn`,digits:1}}));function c(e,t){return e.values.map(e=>e==null?null:t.convert(e)??null)}let f=i(()=>b.map(e=>{let t=w(r)[e.key],i=n.history?.get(e.key)??n.sessionSeries(e.key),a=c(i,t);return{key:e.key,label:e.label,unit:t.unit,times:i.times,values:a,latest:_(a.findLast(e=>e!=null)??null,t.digits)}})),v=e=>e.values.some(e=>e!=null);var E=Ri();d(E,21,()=>w(f),e=>e.key,(e,t)=>{var r=X(),c=C(r),l=C(c),u=C(l,!0);p(l);var d=o(l,2),f=C(d),m=C(f,!0);p(f);var h=o(f);p(d),p(c);var _=o(c,2),y=e=>{Li(e,{get times(){return w(t).times},get values(){return w(t).values},get theme(){return n.theme}})},b=i(()=>v(w(t))),x=e=>{T(e,Y())};s(_,e=>{w(b)?e(y):e(x,-1)}),p(r),a(()=>{g(r,`aria-label`,`${w(t).label??``} trend`),S(u,w(t).label),S(m,w(t).latest),S(h,` ${w(t).unit??``}`)}),T(e,r)}),p(E),T(t,E),m()}export{Z as default};