ml-time-graph 1.17.0 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -19,6 +19,35 @@ release notes, and every change is in `git log` in full.
19
19
 
20
20
  ---
21
21
 
22
+ ## [1.17.1] - 2026-10-07
23
+
24
+ ### Deprecated
25
+ - **`series.sensorType`** (TS and Go) — has no effect on the chart; use `enumMap` for state
26
+ series. Removed before 2.0.
27
+ - **Gap style `"label"`** in the flat form (`gaps: [{ style: "label" }]`) — use `"empty"` with
28
+ `label`. `warnings()` / `Warnings()` report it. Removed before 2.0.
29
+
30
+ ### Fixed
31
+ - **Markings outside the visible range were drawn into the margin** (TS and Go) — zoomed in,
32
+ an arrow starting before the window ran through the axis labels, and a marker or label just
33
+ after it stood half cut off in the margin. Markers, labels and points with a time outside
34
+ the time axis (or a value outside its value axis) are no longer drawn; lines, arrows and
35
+ rectangles reaching beyond the axes are clipped to the plot. In `annotations_demo` a
36
+ rectangle no longer covers a time label.
37
+ - **`autoMargin` blew up on such a marking** — it counted as needing room, the plot shrank,
38
+ the element moved further out: margins of 10⁹ px and an empty chart. It now measures only
39
+ what is drawn, and no side gets more than 40 % of width or height. Also fixes
40
+ `ml-time-graph-svelte`, which uses `autoMargin`.
41
+ - **`ml-time-graph-svelte` with `applyZoom={false}` kept a stale zoom** — after the app reset
42
+ the window itself, double-click and Esc reported `null` again and `followEnd` shifted the old
43
+ window. The held zoom now follows the app's `axes.x.domain`.
44
+ - **`ml-time-graph-svelte`: `valuePadding` added a right axis the app never configured** — it
45
+ now pads only axes that exist (with `axes.y`, only that list).
46
+ - **`ml-time-graph-svelte`: the value table dropped the unit** — tooltip and announcement used
47
+ the axis `format` ("7.2 °C"), the table wrote a bare number. All three now share one rule,
48
+ for every value (min/max, both ends of a band). `formatValue` gets the axis-formatted text
49
+ as `label` and the `axisIndex`, so it can rewrite the number and keep the unit.
50
+
22
51
  ## [1.17.0] - 2026-10-07
23
52
 
24
53
  ### Added
@@ -145,7 +145,7 @@ A series is either a `TimeSeries` (individual samples) or an `AggregatedSeries`
145
145
  | `id` | `string` | Stable identifier (used by selection/highlight logic) |
146
146
  | `name` | `string` | Display name (legend, tooltips) |
147
147
  | `data` | `DataPoint[]` | Samples, sorted by time |
148
- | `sensorType` | `string` | Optional semantic type tag |
148
+ | `sensorType` | `string` | **Deprecated** — has no effect on the chart; use `enumMap` for state series. Will be removed before 2.0. |
149
149
  | `enumMap` | `Record<string \| number, string>` | Maps raw codes to labels, e.g. `{ "1": "running", "2": "stopped" }` |
150
150
  | `style` | `SeriesStyle` | Visual appearance (section 5) |
151
151
  | `overlays` | `SeriesOverlay[]` | Derived curves such as moving averages (section 6) |
@@ -429,7 +429,7 @@ Two equivalent forms; prefer `GapsConfig`.
429
429
  | `fillOpacity` | `number` | Background opacity |
430
430
  | `labelBaseline` | `'above' \| 'middle' \| 'below'` | Vertical label alignment — **note the value set differs from `AnnotationBandItem.labelBaseline`** |
431
431
  | `rotate` | `number` | Label rotation |
432
- | `style` | `'dashed_border' \| 'empty' \| 'label'` | Rendering mode |
432
+ | `style` | `'dashed_border' \| 'empty' \| 'label'` | Rendering mode. `'label'` is **deprecated** and will be removed before 2.0 — use `'empty'` with `label`. |
433
433
 
434
434
  ### 10b. Preferred config form (`gaps: GapsConfig`)
435
435
 
@@ -541,7 +541,7 @@ Available only through `GraphBuilder.setTooltip()` — not part of `MLTimeGraphO
541
541
 
542
542
  **GapStyle.display** (4): `empty`, `dashed_border`, `filled`, `bridge_line`
543
543
 
544
- **DrawGapType_t** (3) — legacy `Gap.style`: `dashed_border`, `empty`, `label`
544
+ **DrawGapType_t** (3) — legacy `Gap.style`: `dashed_border`, `empty`, `label` (deprecated, removed before 2.0)
545
545
 
546
546
  **FillSide:** `above`, `below`
547
547
 
package/SKILLS.md CHANGED
@@ -538,6 +538,6 @@ scratch image.
538
538
  still ships no click handler — you write one, and one on the chart is enough. `'separate'` remains
539
539
  the way when the legend belongs in HTML, or needs to do more than toggle.
540
540
  - **An annotation's `dash` takes a variant, not a pattern:** the type is `'dashed' | 'dotted'`. A raw SVG pattern like `'5,5'` is not rejected — it draws a solid line, in both libraries.
541
- - **One option is still accepted and does nothing:** `series.sensorType` is in the types and the parser reads it, but no renderer acts on it — in either library. Setting it to `'enum'` does not label the axis; that is `series.enumMap`, which 1.10.0 wired up. Until 1.10.0 this list also held `ticks.minor`, `grid.minor` and `enumMap` itself: three fields the types promised and both renderers swallowed. Nothing warns you; the picture just stays as it was.
541
+ - **One option is still accepted and does nothing:** `series.sensorType` is in the types and the parser reads it, but no renderer acts on it — in either library. Setting it to `'enum'` does not label the axis; that is `series.enumMap`, which 1.10.0 wired up. Since 1.17.1 it is marked **deprecated** and will be removed before 2.0; so is the flat gap style `'label'` (use `'empty'` with a `label`), which `warnings()` reports. Until 1.10.0 this list also held `ticks.minor`, `grid.minor` and `enumMap` itself: three fields the types promised and both renderers swallowed. Nothing warns you about `sensorType`; the picture just stays as it was.
542
542
  - **CSS classes are not namespaced:** the chart uses plain names like `.series` and `.time-axis`. Inline the SVG into a page whose stylesheet has a `.series` rule and that rule applies to the chart. Scope your own selectors, and suspect the host page when an embedded chart looks wrong but the standalone file does not.
543
543
  - **Hatch lines adapt to fill colour:** Hatch patterns inherit the opaque colour of the area they belong to (`opaqueColor(fill)`), while the backdrop stays translucent. An earlier default drew fixed blue lines (`#4D88FF`), which falsely signaled an extra state on incident charts where colour is semantic.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { M as MLTimeGraphOptions, L as LegendItem, R as Renderer, a as LayoutResult, b as Margin, Y as YAxisConfig, A as AxesConfig, X as XAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-BsiVseet.js';
2
- export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-BsiVseet.js';
3
- import { e as AnySeries, i as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './types-DdltSMkw.js';
4
- export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as FillWhere, O as GapConfig, Q as GapLabel, U as GapRegion, V as GapStyle, W as GapsAtEnd, G as GridLayer, X as LineShape, Y as LineStyle, Z as MarkerStyle, _ as MovingAverageType, $ as SVGLineStyle, a0 as SensorType, a1 as SeriesGaps, a2 as SeriesOverlay, a3 as SeriesOverlayKind, a4 as SeriesType, a5 as ShadowStyle, a6 as SolidDashStyle, a7 as ThresholdLabelConfig, a8 as getLineStyle, a9 as resolveDash } from './types-DdltSMkw.js';
1
+ import { M as MLTimeGraphOptions, L as LegendItem, R as Renderer, a as LayoutResult, b as Margin, Y as YAxisConfig, A as AxesConfig, X as XAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-VcAK5as0.js';
2
+ export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-VcAK5as0.js';
3
+ import { e as AnySeries, i as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './types-D7tmWwH9.js';
4
+ export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as FillWhere, O as GapConfig, Q as GapLabel, U as GapRegion, V as GapStyle, W as GapsAtEnd, G as GridLayer, X as LineShape, Y as LineStyle, Z as MarkerStyle, _ as MovingAverageType, $ as SVGLineStyle, a0 as SensorType, a1 as SeriesGaps, a2 as SeriesOverlay, a3 as SeriesOverlayKind, a4 as SeriesType, a5 as ShadowStyle, a6 as SolidDashStyle, a7 as ThresholdLabelConfig, a8 as getLineStyle, a9 as resolveDash } from './types-D7tmWwH9.js';
5
5
 
6
6
  /*!
7
7
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -1145,6 +1145,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
1145
1145
  * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
1146
1146
  * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
1147
1147
  */
1148
- declare const VERSION = "1.17.0";
1148
+ declare const VERSION = "1.17.1";
1149
1149
 
1150
1150
  export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AutoMarginOptions, AxesConfig, type AxisGroupInput, type AxisGroups, DataPoint, DrawCommand, type FieldAccessor, type FillBetweenThresholdsInput, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, type LimitStatsPoint, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, type MktPoint, type OptionsLayer, type PointAt, PointStyleType, type PointsAtOptions, RangeLabelPosition, SVGRenderer, SeriesStyle, SmoothingType, type StatsAggregatedPoint, type StdDevPoint, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, type TimeInput, TimeSeries, TimeSeriesBuilder, type ToDataPointsSpec, type TooltipOptions, type TooltipSample, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, axisGroups, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };
package/dist/index.js CHANGED
@@ -1,49 +1,49 @@
1
- function U(r){return r===true?{major:{}}:r===false?{major:false}:r}function ze(r){return "avg"in r}function it(r){return ze(r)?r.min===null||r.max===null||r.avg===null:r.value===null}function ot(r){return !ze(r)&&!!r.synthetic}function st(r,e,t,n,i,o){if(ze(r)){let l=n.map(r.min),h=n.map(r.max),a=Math.min(l,h),m=Math.max(l,h),u=i<a?a-i:i>m?i-m:0;return {time:r.time,min:r.min,max:r.max,avg:r.avg,count:r.count,...o?{held:o}:{},x:e,y:n.map(r.avg),distance:Math.hypot(t,u),dx:t}}let s=n.map(r.value);return {time:r.time,value:r.value,...o?{held:o}:{},x:e,y:s,distance:Math.hypot(t,s-i),dx:t}}function An(r,e){return r.dx<e.dx-1e-6?true:r.dx>e.dx+1e-6?false:r.distance<e.distance-1e-6}function Mn(r,e,t,n,i,o,s){let l=null;for(let h of r){if(it(h)||ot(h))continue;let a=e.map(h.time);if(a<n.x||a>n.x+n.width)continue;let m=Math.abs(a-i);if(m>s)continue;let u=st(h,a,m,t,o,false);(!l||An(u,l))&&(l=u);}return l}function Ln(r,e,t){let n=-1;for(let i=0;i<r.length&&e.map(r[i].time)<=t+1e-6;i++)n=i;for(;n>=0;n--){if(it(r[n]))return -1;if(!ot(r[n]))return n}return -1}function Dn(r,e,t,n,i,o){let s=Ln(r,t,n);if(s<0)return null;let l=r[s],h=r[s+1];if(e.gapThreshold>0&&h&&h.time-l.time>e.gapThreshold)return null;let a=t.invert(n);if(o!==void 0&&a-l.time>o)return null;let m=t.map(l.time),u=m<n-1e-6;return st(l,u?n:m,u?0:Math.abs(m-n),e.skala,i,u)}function $n(r){return r.punkte.map(e=>r.kind==="stdDevBand"?{time:e.time,min:e.low,max:e.high,avg:e.value,count:0}:{time:e.time,value:e.value})}function Pn(r,e,t){let n={overlayOf:t,overlayIndex:e.index,overlayKind:e.kind};if(e.kind!=="stdDevBand")return {...r,...n};let{min:i,max:o,avg:s,count:l,...h}=r;return {...h,value:s,low:i,high:o,...n}}function at(r,e,t,n,i,o,s){if(i<n.x||i>n.x+n.width||o<n.y||o>n.y+n.height)return [];let l=new Set(s.hidden??[]),h=[];return r.forEach((a,m)=>{let u=a.id??a.name;if(l.has(u))return;let c=t(a,m);if(!c)return;let p=s.modes?.[u]??s.mode??(c.stufe?"hold":"nearest"),d=(b,y)=>p==="hold"?Dn(b,y,e,i,o,s.maxAgeMs):Mn(b,e,y.skala,n,i,o,s.radius),g=(b,y,S)=>{let{dx:k,...w}=b,A=w.value??w.avg;return {seriesId:u,name:a.name,axisIndex:c.achse,...w,color:y,...S?{line:S}:{},...c.format&&A!==void 0?{label:c.format(A)}:{}}},f=d(a.data,c);if(f&&h.push(g(f,c.farbe,c.linie)),!!s.overlays)for(let b of c.overlays??[]){let y=d($n(b),{...c,gapThreshold:0});y&&h.push(Pn(g(y,b.farbe,b.linie),b,u));}}),h}var se=class r{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new r({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function K(r){return r&&r.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var Rn=(()=>{let r=new Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;r[e]=t>>>0;}return r})();function He(r){let e=new TextEncoder().encode(r),t=4294967295;for(let n of e)t=Rn[(t^n)&255]^t>>>8;return (t^4294967295)>>>0}function H(r,e){return e||"s-"+He(r??"").toString(16).padStart(8,"0")}var lt=new Map;function Bn(r,e){return `${r}|${JSON.stringify(e??{})}`}function mt(r,e){let t=Bn(r,e),n=lt.get(t);return n||(n=new Intl.DateTimeFormat(r,e),lt.set(t,n)),n}function ht(){return typeof navigator<"u"?navigator.language:void 0}var q=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,i]=this.#e,[o,s]=this.#t;return i===n?o:o+(t-n)/(i-n)*(s-o)}invert(e){let[t,n]=this.#e,[i,o]=this.#t;return o===i?t:t+(e-i)/(o-i)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},O=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],ee=class{#e;#t;#n;constructor(e){this.#e=new q({domain:e.domain,range:e.range}),this.#t=e.locale||(ht()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:O[0].ms};let l=s/e,h=O[0].ms;for(let u of O)if(u.ms>=l){h=u.ms;break}let a=h,m=Math.round(s/a);for(;m>n&&a<O[O.length-1].ms;){let u=O.findIndex(c=>c.ms===a);a=O[Math.min(u+1,O.length-1)].ms,m=Math.round(s/a);}for(;m<t&&a>O[0].ms;){let u=O.findIndex(c=>c.ms===a);a=O[Math.max(u-1,0)].ms,m=Math.round(s/a);}return {interval:a}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:i}=this.tickInterval((t+n)/2,t,n),[o,s]=this.#e.domain(),l=[],h=Math.ceil(o/i)*i;for(let a=h;a<=s;a+=i)l.push(a);return l}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return mt(this.#t,n).format(new Date(e))}};var Ve={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var te={...Ve};function jn(r){te={...te,...r};}var pe=null;function ae(){return pe??te}function le(r,e){if(!r)return e();let t=pe;pe={...te,...r};try{return e()}finally{pe=t;}}function Fn(){return te}function En(){te={...Ve};}function Gn(r){let e=r.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function In(r){let e=r.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function fe(r,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,i=2){let o=Gn(t),s=In(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ function U(r){return r===true?{major:{}}:r===false?{major:false}:r}function ze(r){return "avg"in r}function ot(r){return ze(r)?r.min===null||r.max===null||r.avg===null:r.value===null}function st(r){return !ze(r)&&!!r.synthetic}function at(r,e,t,n,i,o){if(ze(r)){let a=n.map(r.min),m=n.map(r.max),l=Math.min(a,m),u=Math.max(a,m),c=i<l?l-i:i>u?i-u:0;return {time:r.time,min:r.min,max:r.max,avg:r.avg,count:r.count,...o?{held:o}:{},x:e,y:n.map(r.avg),distance:Math.hypot(t,c),dx:t}}let s=n.map(r.value);return {time:r.time,value:r.value,...o?{held:o}:{},x:e,y:s,distance:Math.hypot(t,s-i),dx:t}}function Mn(r,e){return r.dx<e.dx-1e-6?true:r.dx>e.dx+1e-6?false:r.distance<e.distance-1e-6}function Ln(r,e,t,n,i,o,s){let a=null;for(let m of r){if(ot(m)||st(m))continue;let l=e.map(m.time);if(l<n.x||l>n.x+n.width)continue;let u=Math.abs(l-i);if(u>s)continue;let c=at(m,l,u,t,o,false);(!a||Mn(c,a))&&(a=c);}return a}function Dn(r,e,t){let n=-1;for(let i=0;i<r.length&&e.map(r[i].time)<=t+1e-6;i++)n=i;for(;n>=0;n--){if(ot(r[n]))return -1;if(!st(r[n]))return n}return -1}function $n(r,e,t,n,i,o){let s=Dn(r,t,n);if(s<0)return null;let a=r[s],m=r[s+1];if(e.gapThreshold>0&&m&&m.time-a.time>e.gapThreshold)return null;let l=t.invert(n);if(o!==void 0&&l-a.time>o)return null;let u=t.map(a.time),c=u<n-1e-6;return at(a,c?n:u,c?0:Math.abs(u-n),e.skala,i,c)}function Pn(r){return r.punkte.map(e=>r.kind==="stdDevBand"?{time:e.time,min:e.low,max:e.high,avg:e.value,count:0}:{time:e.time,value:e.value})}function Rn(r,e,t){let n={overlayOf:t,overlayIndex:e.index,overlayKind:e.kind};if(e.kind!=="stdDevBand")return {...r,...n};let{min:i,max:o,avg:s,count:a,...m}=r;return {...m,value:s,low:i,high:o,...n}}function lt(r,e,t,n,i,o,s){if(i<n.x||i>n.x+n.width||o<n.y||o>n.y+n.height)return [];let a=new Set(s.hidden??[]),m=[];return r.forEach((l,u)=>{let c=l.id??l.name;if(a.has(c))return;let h=t(l,u);if(!h)return;let p=s.modes?.[c]??s.mode??(h.stufe?"hold":"nearest"),d=(b,y)=>p==="hold"?$n(b,y,e,i,o,s.maxAgeMs):Ln(b,e,y.skala,n,i,o,s.radius),g=(b,y,S)=>{let{dx:w,...k}=b,A=k.value??k.avg;return {seriesId:c,name:l.name,axisIndex:h.achse,...k,color:y,...S?{line:S}:{},...h.format&&A!==void 0?{label:h.format(A)}:{}}},f=d(l.data,h);if(f&&m.push(g(f,h.farbe,h.linie)),!!s.overlays)for(let b of h.overlays??[]){let y=d(Pn(b),{...h,gapThreshold:0});y&&m.push(Rn(g(y,b.farbe,b.linie),b,c));}}),m}var se=class r{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new r({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function K(r){return r&&r.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var Bn=(()=>{let r=new Array(256);for(let e=0;e<256;e++){let t=e;for(let n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;r[e]=t>>>0;}return r})();function He(r){let e=new TextEncoder().encode(r),t=4294967295;for(let n of e)t=Bn[(t^n)&255]^t>>>8;return (t^4294967295)>>>0}function H(r,e){return e||"s-"+He(r??"").toString(16).padStart(8,"0")}var mt=new Map;function Fn(r,e){return `${r}|${JSON.stringify(e??{})}`}function ut(r,e){let t=Fn(r,e),n=mt.get(t);return n||(n=new Intl.DateTimeFormat(r,e),mt.set(t,n)),n}function ht(){return typeof navigator<"u"?navigator.language:void 0}var q=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,i]=this.#e,[o,s]=this.#t;return i===n?o:o+(t-n)/(i-n)*(s-o)}invert(e){let[t,n]=this.#e,[i,o]=this.#t;return o===i?t:t+(e-i)/(o-i)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},O=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],ee=class{#e;#t;#n;constructor(e){this.#e=new q({domain:e.domain,range:e.range}),this.#t=e.locale||(ht()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:O[0].ms};let a=s/e,m=O[0].ms;for(let c of O)if(c.ms>=a){m=c.ms;break}let l=m,u=Math.round(s/l);for(;u>n&&l<O[O.length-1].ms;){let c=O.findIndex(h=>h.ms===l);l=O[Math.min(c+1,O.length-1)].ms,u=Math.round(s/l);}for(;u<t&&l>O[0].ms;){let c=O.findIndex(h=>h.ms===l);l=O[Math.max(c-1,0)].ms,u=Math.round(s/l);}return {interval:l}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:i}=this.tickInterval((t+n)/2,t,n),[o,s]=this.#e.domain(),a=[],m=Math.ceil(o/i)*i;for(let l=m;l<=s;l+=i)a.push(l);return a}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return ut(this.#t,n).format(new Date(e))}};var Ve={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var te={...Ve};function jn(r){te={...te,...r};}var pe=null;function ae(){return pe??te}function le(r,e){if(!r)return e();let t=pe;pe={...te,...r};try{return e()}finally{pe=t;}}function En(){return te}function Gn(){te={...Ve};}function In(r){let e=r.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function On(r){let e=r.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function fe(r,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,i=2){let o=In(t),s=On(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${r}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
5
- `.trim();let l=12,h=12,a="rotate(0)",m="";switch(e){case "classic-diagonal":a="rotate(45)",m=`<line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />`;break;case "dense-steep":l=6,h=6,a="rotate(30)",m=`<line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />`;break;case "crosshatch":l=14,h=14,a="rotate(45)",m=`
6
- <line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
7
- <line x1="0" y1="0" x2="${l}" y2="0" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
8
- `;break;case "dots":m=`<circle cx="${l/2}" cy="${h/2}" r="${i*1.2}" fill="${o}" />`;break;case "waves":l=16,h=16,m=`
9
- <path d="M 0 ${h/2} Q ${l/4} 0, ${l/2} ${h/2} T ${l} ${h/2}" fill="none" stroke="${o}" stroke-width="${i}" stroke-linecap="round" />
10
- `;break;case "dashed":a="rotate(45)",m=`<line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${i}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,h=16,m=`
11
- <path d="M 0 0 L ${l/2} ${h/2} L 0 ${h} M ${l} 0 L ${l/2} ${h/2} L ${l} ${h}" fill="none" stroke="${o}" stroke-width="${i}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":l=20,h=20,m=`
13
- <path d="M 0 ${h/2} L ${l} ${h/2} M 0 ${h} L ${l} ${h} M ${l/2} 0 L ${l/2} ${h/2} M 0 ${h/2} L 0 ${h}" fill="none" stroke="${o}" stroke-width="${i}" />
14
- `;break;case "double-stripe":l=16,h=16,a="rotate(45)",m=`
15
- <line x1="0" y1="0" x2="0" y2="${h}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
16
- <line x1="${l/2}" y1="0" x2="${l/2}" y2="${h}" stroke="${o}" stroke-width="${i/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":l=18,h=32,m=`
18
- <path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${o}" stroke-width="${i}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let u=`<rect width="${l}" height="${h}" fill="${t}"${s} />`;return `
20
- <pattern id="${r}" width="${l}" height="${h}" patternTransform="${a}" patternUnits="userSpaceOnUse">
5
+ `.trim();let a=12,m=12,l="rotate(0)",u="";switch(e){case "classic-diagonal":l="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />`;break;case "dense-steep":a=6,m=6,l="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />`;break;case "crosshatch":a=14,m=14,l="rotate(45)",u=`
6
+ <line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
7
+ <line x1="0" y1="0" x2="${a}" y2="0" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
8
+ `;break;case "dots":u=`<circle cx="${a/2}" cy="${m/2}" r="${i*1.2}" fill="${o}" />`;break;case "waves":a=16,m=16,u=`
9
+ <path d="M 0 ${m/2} Q ${a/4} 0, ${a/2} ${m/2} T ${a} ${m/2}" fill="none" stroke="${o}" stroke-width="${i}" stroke-linecap="round" />
10
+ `;break;case "dashed":l="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-dasharray="3,3" />`;break;case "herringbone":a=16,m=16,u=`
11
+ <path d="M 0 0 L ${a/2} ${m/2} L 0 ${m} M ${a} 0 L ${a/2} ${m/2} L ${a} ${m}" fill="none" stroke="${o}" stroke-width="${i}" stroke-linejoin="round" stroke-linecap="round" />
12
+ `;break;case "brick":a=20,m=20,u=`
13
+ <path d="M 0 ${m/2} L ${a} ${m/2} M 0 ${m} L ${a} ${m} M ${a/2} 0 L ${a/2} ${m/2} M 0 ${m/2} L 0 ${m}" fill="none" stroke="${o}" stroke-width="${i}" />
14
+ `;break;case "double-stripe":a=16,m=16,l="rotate(45)",u=`
15
+ <line x1="0" y1="0" x2="0" y2="${m}" stroke="${o}" stroke-width="${i}" stroke-linecap="square" />
16
+ <line x1="${a/2}" y1="0" x2="${a/2}" y2="${m}" stroke="${o}" stroke-width="${i/2}" stroke-linecap="square" />
17
+ `;break;case "honeycomb":a=18,m=32,u=`
18
+ <path d="M 0 0 L ${a/2} 5 L ${a} 0 M 0 16 L ${a/2} 11 L ${a} 16 M 0 16 L 0 32 M ${a/2} 5 L ${a/2} 11 M ${a} 16 L ${a} 32 M 0 32 L ${a/2} 27 L ${a} 32 M ${a/2} 27 L ${a/2} 32" fill="none" stroke="${o}" stroke-width="${i}" stroke-linejoin="round" stroke-linecap="round" />
19
+ `;break}let c=`<rect width="${a}" height="${m}" fill="${t}"${s} />`;return `
20
+ <pattern id="${r}" width="${a}" height="${m}" patternTransform="${l}" patternUnits="userSpaceOnUse">
21
+ ${c}
21
22
  ${u}
22
- ${m}
23
23
  </pattern>
24
- `.trim()}function Ne(r,e=2,t=false){return r==="dashed"||!r&&t?{strokeDasharray:"4,4"}:r==="dotted"?{strokeDasharray:"2,4"}:!r||r==="solid"?null:ut(r,e)}function ut(r,e=2){let t=e;switch(r){case "dotted":return {strokeDasharray:`0, ${t*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${t*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${t*3}, ${t*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${t*6}, ${t*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${t*1.5}, ${t*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${t*4}, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${t*5}, ${t*2}, 0, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${t*3}, ${t*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var x=new Proxy({},{get:(r,e)=>ae()[e],has:(r,e)=>e in ae(),ownKeys:()=>Reflect.ownKeys(ae()),getOwnPropertyDescriptor:(r,e)=>Reflect.getOwnPropertyDescriptor(ae(),e)});function ge(r,e){if(e<=0||r.length<2)return [];let t=[];for(let n=0;n<r.length-1;n++){let i=r[n],o=r[n+1];for(let s=1;s<=e;s++)t.push(i+(o-i)*s/(e+1));}return t}var me={axisColor:x.axisColor,tickColor:x.tickColor,textColor:x.textColor,textSize:x.textSize},ne=class{#e;#t;constructor(e){this.#e=new ee({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??me).axisColor}get tickColor(){return (this.#t.colors??me).tickColor}get textColor(){return (this.#t.colors??me).textColor}get textSize(){return (this.#t.colors??me).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,i=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(i)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((t+n)/2,t,n),o={};return i<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):i<36e5||i<864e5?(o.hour="2-digit",o.minute="2-digit"):i<31536e6?(o.day="numeric",o.month="short",i>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",i<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let i=1;i<e.length;i++){let o=n[n.length-1].x;Math.abs(e[i].x-o)>=t&&n.push(e[i]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??me,n=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of this.generateMinorTicks())i.push({type:"line",x1:l,y1:n,x2:l,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let l of e)i.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),i.push({type:"text",content:l.label,x:this.#n(l.x,l.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return i}generateMinorTicks(){return ge(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,n)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function V(r){return "showAs"in r&&!!r.showAs}function ct(r){if(V(r)){let e=[];for(let t of r.data)t.min!==null&&e.push(t.min),t.max!==null&&e.push(t.max);return e}return r.data.map(e=>e.value).filter(e=>e!==null)}function ye(r){return {axisColor:r?.color??x.axisColor,tickColor:r?.color??x.tickColor,textColor:x.textColor,textSize:x.textSize,axisWidth:r?.width??1}}function dt(r,e,t,n){if(n===void 0)return [r,e];let i=typeof n=="number"?n:n.top??0,o=typeof n=="number"?n:n.bottom??0;if(i<=0&&o<=0)return [r,e];let s=t-i-o,l=e-r;if(s<=0||l<=0)return [r,e];let h=l/s;return [r-o*h,e+i*h]}function be(r,e){return r!==void 0?r:e!==void 0&&e!==false?1:0}var On=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],Ke=.6,Wn=(()=>{let r=new Map;for(let[e,,t]of On){let n=t.split(",");for(let i=0;i<n.length;i++)r.set(e+i,Number(n[i])/1e3);}return r})();function pt(r){return Wn.get(r)??Ke}var W=(r,e)=>{let t=0;for(let n of r)t+=pt(n.codePointAt(0)??0);return t*e},zn=(r,e)=>[...r].length*e*Ke;function ft(r,e,t){let n=0;for(let i of r)n=Math.max(n,t(i,e));return n}var re={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Ye(r,e){let t=n=>e===void 0||e>=n;return Math.abs(r)>=1e6&&t(1e5)?`${(r/1e6).toFixed(1)}M`:Math.abs(r)>=1e3&&t(100)?`${(r/1e3).toFixed(1)}k`:Number.isInteger(r)?String(r):r.toFixed(1)}function Hn(r){let e=new Array(r.length).fill(false),t=0;for(;t<r.length;){let n=t;for(;n+1<r.length&&r[n+1].label===r[t].label;)n++;for(let i=t+1;i<n;i++)e[i]=true;t=n+1;}return e}var xe=class{#e;#t;constructor(e){this.#e=new q({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??re).axisColor}get tickColor(){return (this.#t.colors??re).tickColor}get textColor(){return (this.#t.colors??re).textColor}get textSize(){return (this.#t.colors??re).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??Ye;return e.map(f=>({value:f,position:this.#e.map(f),label:g(f)}))}let t=this.#t.format??Ye,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[i,o]=this.#e.domain(),s=Math.min(i,o),l=Math.max(i,o),h=l-s;if(h===0)return [{value:i,position:this.#e.map(i),label:t(i)}];let a=h/n,m=Math.pow(10,Math.floor(Math.log10(a))),u=a/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:i,position:this.#e.map(i),label:t(i)}];this.#t.format||(t=g=>Ye(g,c));let p=[],d=Math.ceil(s/c)*c;for(let g=d;g<=l;g+=c)p.push({value:g,position:this.#e.map(g),label:t(g)});return p}generateMinorTicks(){return ge(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??re,n=this.#t.x??0,i=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,h=u=>s.some(c=>Math.abs(c-u)<=l),a=[];if(i==="vertical"){let[u,c]=this.#e.range();a.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let p=Hn(e);e.forEach((d,g)=>{let f=h(d.position),b=p[g]?{opacity:0}:{};o==="left"?(a.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||a.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(a.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||a.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[u,c]=this.#e.range();a.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let p of e)a.push({type:"line",x1:p.position,y1:n,x2:p.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),a.push({type:"text",content:p.label,x:p.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let m=(this.#t.orientation??"vertical")==="vertical";for(let u of this.generateMinorTicks())a.push(m?{type:"line",x1:o==="right"?n:n-2,y1:u,x2:o==="right"?n+2:n,y2:u,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:u,y1:n,x2:u,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return a}#n(e,t,n){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,(this.#t.colors??re).textSize);return n==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function gt(r){let e=new Set,t={};for(let n of r){let i=n.enumMap;if(i)for(let[o,s]of Object.entries(i)){let l=Number(o);e.add(l),l in t||(t[l]=s);}}return {werte:e.size>0?[...e].sort((n,i)=>n-i):void 0,name:n=>t[n]??String(n)}}function yt(r){let{axes:e,indices:t,seriesByIndex:n,layout:i,thresholds:o,metrics:s}=r,{chartX:l,chartY:h,chartWidth:a,chartHeight:m}=i,u=[],c=new Map,p,d=[],g=[],f=(e?.y?.length??0)>0,b=0,y=0;for(let S of t){let k=n.get(S),w=1/0,A=-1/0,D=false;for(let L of k)for(let Z of ct(L))Z<w&&(w=Z),Z>A&&(A=Z),D=true;if(!D)continue;if(Se(e,S)?.includeThresholds)for(let L of o)(L.axisIndex??0)!==S||L.line==="none"||(w=Math.min(w,L.value),A=Math.max(A,L.value));w===A&&(w-=1,A+=1);let C=Se(e,S),T=C?.domain,$=T&&T!=="auto"?T:dt(w,A,m,C?.padding),{werte:R,name:F}=gt(k);if(R){let L=R.length>1?(R[R.length-1]-R[0])/(R.length-1):1;$[0]=R[0]-L/2,$[1]=R[R.length-1]+L/2;}let j=new q({domain:$,range:[h+m,h]});c.set(S,j);let B=C?.position??(S===0?"left":"right"),z=B==="right"?"outside-right":"outside-left",I=o.filter(L=>(L.axisIndex??0)===S&&typeof L.label=="object"&&L.label!==null&&L.label.position===z&&L.value>=Math.min($[0],$[1])&&L.value<=Math.max($[0],$[1])).map(L=>j.map(L.value)),G;if(B==="right"){let L=C?.offset??y*50;G=l+a+L,y++;}else {let L=C?.offset??b*50;G=l-L,b++;}let _=new xe({domain:$,range:[h+m,h],x:G,position:B,format:C?.format??(R?F:void 0),tickValues:R,ticks:C?.ticks?.major,minorTicks:be(C?.ticks?.minor,U(C?.grid)?.minor),colors:ye(C?.axis),suppressLabelsNear:I.length?I:void 0,gesamtbreite:i.totalWidth,metrics:s}),M=8+ft(_.generateTicks().map(L=>L.label),11,s),P=B==="right"?G+M:G-M;g.push({position:B,von:Math.min(G,P),bis:Math.max(G,P)}),f&&C?.label&&d.push({text:C.label,achseX:G,kante:P,position:B,style:C.labels}),S===0&&(p=_),u.push({type:"group",cssClass:`value-axis ${B}`,sharedStyles:true,commands:_.render()});}return {commands:u,titel:d,baender:g,neueForm:f,primary:p,scales:c}}function Se(r,e){let t=e===0?r?.left:e===1?r?.right:void 0,n=r?.y&&r.y.length>e?r.y[e]:void 0;return n&&t?{...t,...n}:n??t}var E=class{static interpolateDataPoint(r,e,t){return {time:r.time+Math.round(t*(e.time-r.time)),value:(r.value??0)+t*((e.value??0)-(r.value??0)),synthetic:true}}static interpolateAggregatedPoint(r,e,t){let n=(i,o)=>i!==null&&o!==null?i+t*(o-i):null;return {time:r.time+t*(e.time-r.time),min:n(r.min,e.min),max:n(r.max,e.max),avg:n(r.avg,e.avg),count:Math.round(r.count+t*(e.count-r.count))}}static getRuns(r,e,t=0){let n=[...r].sort((l,h)=>l.time-h.time),i=[],o=[],s=null;for(let l of n){let h=e(l),a=t>0&&s&&l.time-s.time>t;(h||a)&&o.length&&(i.push(o),o=[]),h||o.push(l),s=l;}return o.length&&i.push(o),i}static splitByBoundaries(r,e,t,n){if(r.length===0)return [];if(e.length===0)return [{data:r,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((a,m)=>a-m),o=[],s=a=>a<=0?Number.NEGATIVE_INFINITY:i[a-1],l=a=>{let m=0;for(let u=0;u<i.length&&a>=i[u];u++)m=u+1;return m},h=[r[0]];for(let a=1;a<r.length;a++){let m=r[a-1],u=r[a],c=t(m),p=t(u),d;p>c?d=i.filter(f=>f>c&&f<=p):p<c?d=i.filter(f=>f>=p&&f<c).reverse():d=[];let g=c;for(let f of d){let b=(f-c)/(p-c),y=n(m,u,b);h.push(y);let S=l((g+f)/2);o.push({data:h,zoneIndex:S,zoneLow:s(S)}),h=[y],g=f;}(d.length===0||d[d.length-1]!==p)&&h.push(u);}if(h.length>1||r.length===1){let a=t(h[0]),m=t(h[h.length-1]),u=l((a+m)/2);o.push({data:h,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(r,e,t,n){let i=this.splitByBoundaries(r,[e],t,n),o={above:[],below:[]};for(let s of i)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function bt(r,e=6e4){if(r.length<2)return [];let t=[...r].sort((i,o)=>i.time-o.time),n=[];for(let i=1;i<t.length;i++)t[i].time-t[i-1].time>e&&n.push({startTime:t[i-1].time,endTime:t[i].time});return n}function Vn(r,e=83144){let t=e/8.314,n=0,i=0;for(let s of r)s!==null&&(n+=Math.exp(-t/(s+273.15)),i++);if(i===0)return null;let o=n/i;return t/-Math.log(o)-273.15}function xt(r,e,t=83144){let n=new Array(r.length),i=0;for(let o=0;o<r.length;o++){let s=r[o].time,l=s-e;for(;i<o&&r[i].time<l;)i++;let h=r.slice(i,o+1).map(m=>m.value),a=Vn(h,t);n[o]={time:s,value:a,synthetic:true};}return n}function Nn(r){let e=0,t=0;for(let o of r)o!==null&&(e+=o,t++);if(t===0)return null;let n=e/t,i=0;for(let o of r){if(o===null)continue;let s=o-n;i+=s*s;}return Math.sqrt(i/t)}function Kn(r){let e=0,t=0;for(let o of r)o!==null&&(e+=o,t++);if(t<2)return null;let n=e/t,i=0;for(let o of r){if(o===null)continue;let s=o-n;i+=s*s;}return Math.sqrt(i/(t-1))}function St(r,e,t=false){let n=new Array(r.length),i=0,o=t?Kn:Nn;for(let s=0;s<r.length;s++){let l=r[s].time,h=l-e;for(;i<s&&r[i].time<h;)i++;let a=r.slice(i,s+1).map(u=>u.value),m=o(a);n[s]={time:l,value:m,synthetic:true};}return n}function Xe(r,e){let t=new Array(r.length),n=0;for(let i=0;i<r.length;i++){let o=r[i].time,s=o-e;for(;n<i&&r[n].time<s;)n++;let l=0,h=0;for(let a=n;a<=i;a++){let m=r[a].value;m!==null&&(l+=m,h++);}t[i]={time:o,value:h===0?null:l/h,synthetic:true};}return t}function kt(r,e){let t=new Array(r.length),n=null,i=0;for(let o=0;o<r.length;o++){let s=r[o].time,l=r[o].value;if(l===null){t[o]={time:s,value:n,synthetic:true};continue}if(n===null||e<=0)n=l;else {let h=1-Math.exp(-(s-i)/e);n=l*h+n*(1-h);}i=s,t[o]={time:s,value:n,synthetic:true};}return t}function Y(r){let e=[];for(let t of r)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}var ke=class{};function wt(r,e,t,n){let i=ve(t);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<r.length;s++){let l=r[s],h=e.timeScale.map(l.time),a=e.valueScale.map(l.value),m=n(l),u=t.pointStroke??m,c=t.pointFill??m,p=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${s}`:void 0;we(o,d,i.markers.type,h,a,i.markers.size,u,c,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function we(r,e,t,n,i,o,s,l,h){let a=m=>e===void 0?void 0:`${e}-${m}`;switch(t){case "circle":r.push({type:"circle",cx:n,cy:i,r:o,fill:l,stroke:s,strokeWidth:h,id:e});break;case "square":r.push({type:"rect",x:n-o,y:i-o,w:o*2,h:o*2,fill:l,stroke:s,strokeWidth:h,id:e});break;case "cross":r.push({type:"line",x1:n-o,y1:i-o,x2:n+o,y2:i+o,stroke:s,strokeWidth:h,id:e},{type:"line",x1:n-o,y1:i+o,x2:n+o,y2:i-o,stroke:s,strokeWidth:h,id:a(2)});break;case "diamond":r.push({type:"path",points:[{x:n,y:i-o},{x:n+o,y:i},{x:n,y:i+o},{x:n-o,y:i}],closed:true,fill:l,stroke:s,strokeWidth:h,id:e});break;case "triangle":r.push({type:"path",points:[{x:n,y:i-o},{x:n+o,y:i+o},{x:n-o,y:i+o}],closed:true,fill:l,stroke:s,strokeWidth:h,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,p=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(p),y:i+c*Math.sin(p)});}r.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:h,id:e});break}case "arrow":r.push({type:"path",points:[{x:n-o,y:i+o},{x:n,y:i-o},{x:n+o,y:i+o}],stroke:s,strokeWidth:h,fill:"none",id:e});break;case "plus":r.push({type:"line",x1:n-o,y1:i,x2:n+o,y2:i,stroke:s,strokeWidth:h,id:e},{type:"line",x1:n,y1:i-o,x2:n,y2:i+o,stroke:s,strokeWidth:h,id:a(2)});break;case "triangle-down":r.push({type:"path",points:[{x:n,y:i+o},{x:n+o,y:i-o},{x:n-o,y:i-o}],closed:true,fill:l,stroke:s,strokeWidth:h,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+o*Math.cos(c),y:i+o*Math.sin(c)});}r.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:h,id:e});break}case "hourglass":r.push({type:"path",points:[{x:n-o,y:i-o},{x:n+o,y:i-o},{x:n-o,y:i+o},{x:n+o,y:i+o}],closed:true,fill:l,stroke:s,strokeWidth:h,id:e});break;case "line-horizontal":r.push({type:"line",x1:n-o,y1:i,x2:n+o,y2:i,stroke:s,strokeWidth:h,id:e});break;default:r.push({type:"circle",cx:n,cy:i,r:o,fill:l,stroke:s,strokeWidth:h,id:e});}}var Te=class r{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new r;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var Yn="#ffffff",Xn="#cccccc",Zn=6,Un=.85,X=12,Ce=8,he=20,qn=11,_e=18,Ze=(r,e)=>e(r,qn);function vt(r,e,t){let n=l=>X+Ce+Ze(l.name,e);if(t===void 0){let l=r.reduce((h,a)=>h+n(a)+_e,0)-_e;return [{items:r,breite:Math.max(0,l)}]}let i=[],o=[],s=0;for(let l of r){let h=n(l),a=o.length===0?h:s+_e+h;o.length>0&&a>t?(i.push({items:o,breite:s}),o=[l],s=h):(o=[...o,l],s=a);}return o.length>0&&i.push({items:o,breite:s}),i}function Tt(r,e="vertical",t=W,n){if(e==="horizontal"){let o=vt(r,t,n);return {width:o.reduce((s,l)=>Math.max(s,l.breite),0),height:o.length*he}}let i=0;for(let o of r)i=Math.max(i,Ze(o.name,t));return {width:X+Ce+i,height:r.length*he}}function Jn(r){let{items:e,x:t,y:n,orientation:i="vertical",metrics:o=W,maxBreite:s,box:l,itemClass:h}=r,a=new Te;if(l&&e.length>0){let c=Tt(e,i,o,s),d=((i==="horizontal"?c.height/he:e.length)-1)*he+X,g=l.padding??Zn,f=l.stroke??Xn;a.rect({x:t-g,y:n-g,w:c.width+2*g,h:d+2*g,fill:l.fill??Yn,...f==="none"?{}:{stroke:f,strokeWidth:l.strokeWidth??1},opacity:l.opacity??Un});}let m=i==="horizontal"?vt(e,o,s):e.map(c=>({items:[c],breite:0})),u=new Map;return m.forEach((c,p)=>{let d=t;for(let g of c.items)u.set(g,{x:d,y:n+p*he}),d+=X+Ce+Ze(g.name,o)+_e;}),e.forEach(c=>{let p=u.get(c)??{x:t,y:n},d=p.x,g=p.y,f=["legend-item"];c.id&&f.push(`legend-item--${c.id}`),h&&f.push(h),a.group({cssClass:f.join(" "),...c.id?{id:`legend-${c.id}`}:{}},b=>{b.rect({x:d,y:g,w:X,h:X,fill:c.color,stroke:x.legendStroke,strokeWidth:1}).text({content:c.name,x:d+X+Ce,y:g+X-2,fontSize:x.legendFont,fill:x.legendText});});}),a.toGroup({cssClass:"chart-legend"})}function _t(r){let{legend:e,items:t,gesamtbreite:n,metrics:i}=r,o=(e?.show??false)&&t.length>0,s=e?.position??"inside-right",l=e?.orientation??(s==="above"||s==="below"?"horizontal":"vertical"),h=s==="above"||s==="below"?n-16:void 0;return {items:t,show:o,position:s,orientation:l,maxBreite:h,size:o?Tt(t,l,i,h):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function Ct(r,e){let t=r.position==="outside-right"||r.position==="outside-left"||r.position==="above"||r.position==="below";if(!r.show||!t)return null;let n={...e},i=2*r.boxRand;return r.position==="outside-right"?n.right+=r.size.width+i+16:r.position==="outside-left"?n.left+=r.size.width+i+16:r.position==="above"?n.top+=r.size.height+i+10:n.bottom+=r.size.height+i+10,n}function At(r){let{legende:e,layout:t,randBelegt:n,metrics:i}=r;if(!e.show||e.position==="separate")return [];let{chartX:o,chartY:s,chartWidth:l}=t,h,a;if(e.position==="inside-right")h=o+l-e.size.width-8-e.boxRand,a=s+8+e.boxRand;else if(e.position==="inside-left")h=o+8+e.boxRand,a=s+8+e.boxRand;else if(e.position==="outside-right"){let m=n.filter(u=>u.position==="right").reduce((u,c)=>Math.max(u,c.bis),o+l);h=Math.min(Math.max(o+l+16,m+12),t.totalWidth-e.size.width-2),a=s;}else e.position==="above"||e.position==="below"?(h=Math.max(8,Math.min(t.totalWidth-e.size.width-8,o+(l-e.size.width)/2)),a=e.position==="above"?Math.max(4,s-e.size.height-10):t.totalHeight-e.size.height-4):(h=8,a=s);return [Jn({items:e.items,x:h,y:a,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function Mt(r){let{xTicks:e,yTicks:t,xRange:n,yRange:i,stroke:o=x.gridStroke,strokeWidth:s=x.gridStrokeWidth,dashed:l=false,opacity:h=x.gridOpacity}=r,a=[];if(t)for(let m of t)a.push({type:"line",x1:n[0],y1:m,x2:n[1],y2:m,stroke:o,strokeWidth:s,dashed:l,opacity:h});if(e)for(let m of e)a.push({type:"line",x1:m,y1:i[0],x2:m,y2:i[1],stroke:o,strokeWidth:s,dashed:l,opacity:h});return a}function Lt(r){let{axes:e,timeAxis:t,primaryValueAxis:n,xRange:i,yRange:o}=r,s=U(e?.x?.grid),l=U(e?.left?.grid),h=s?.layer??l?.layer??"front",a=s?.major,m=l?.major,u=w=>w!==void 0&&w!==false;if(!u(a)&&!u(m))return {group:null,layer:h};let c=a!==false,p=m!==false&&!!n,d=c?t.generateTicks().map(w=>w.x):void 0,g=p?n.generateTicks().map(w=>w.position):void 0;if(!d&&!g)return {group:null,layer:h};let f=(a&&typeof a=="object"?a:void 0)??(m&&typeof m=="object"?m:void 0),b=s?.minor,y=l?.minor,S=(b&&typeof b=="object"?b:void 0)??(y&&typeof y=="object"?y:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...b!==void 0||y!==void 0?Mt({xTicks:b!==false&&c?t.generateMinorTicks():void 0,yTicks:y!==false&&p?n.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(x.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...Mt({xTicks:d,yTicks:g,xRange:i,yRange:o,stroke:f?.color,opacity:f?.opacity,dashed:f?.style==="dashed"})]},layer:h}}function Dt(r){let e=[],t=n=>{n.type==="group"?n.commands.forEach(t):n.type==="line"&&n.y1===n.y2&&n.x1!==n.x2&&e.push(n.y1);};return r.forEach(t),e}function $t(r,e){if(e.length===0||r.type!=="group")return r;let t=n=>n.type==="line"&&n.y1===n.y2&&n.x1!==n.x2&&e.some(i=>Math.abs(i-n.y1)<.5);return {...r,commands:r.commands.filter(n=>!t(n))}}function Qn(r){return r==="dotted"?{dash:"dotted"}:r==="dashed"?{dash:"dashed"}:{}}function er(r){let{thresholds:e,valueScale:t,xRange:n}=r,[i,o]=n,[s,l]=t.range(),h=Math.min(s,l),a=Math.max(s,l),m=[],u=[];for(let c of e){let p=c.color??x.thresholdColor,d=t.map(c.value);c.fill==="above"?m.push({type:"rect",x:i,y:h,w:o-i,h:Math.max(0,d-h),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&m.push({type:"rect",x:i,y:d,w:o-i,h:Math.max(0,a-d),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let g=c.line??x.thresholdLine;if(g!=="none"){let S=Qn(g),k={type:"line",x1:i,y1:d,x2:o,y2:d,stroke:p,strokeWidth:1,...S,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(k.shadowColor=c.shadowColor,k.shadowBlur=c.shadowBlur??4,k.shadowOffsetX=c.shadowOffsetX??0,k.shadowOffsetY=c.shadowOffsetY??2),m.push(k);}let[f,b]=t.domain();if(c.value>=Math.min(f,b)&&c.value<=Math.max(f,b)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,k=typeof c.label=="string"?c.label:S?.text??c.name,w=S?.position??"right",A=nr(k,w,i,o,d,p,S);u.push({...A,y:tr(A.y,Math.min(s,l),Math.max(s,l),x.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:m,labels:u}}function tr(r,e,t,n){return Math.max(e+n,Math.min(t-n/2,r))}function nr(r,e,t,n,i,o,s){let l=(t+n)/2,h={type:"text",content:r,fontSize:x.thresholdFontSize,fill:o},a=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...h,...a,x:t+4,y:i-4,anchor:"start"};case "above":return {...h,...a,x:l,y:i-6,anchor:"middle"};case "below":return {...h,...a,x:l,y:i+14,anchor:"middle"};case "center":return {...h,...a,x:l,y:i-4,anchor:"middle"};case "outside-left":return {...h,...a,x:t-6,y:i+3,anchor:"end",textBaseline:a.textBaseline??"middle"};case "outside-right":return {...h,...a,x:n+6,y:i+3,anchor:"start",textBaseline:a.textBaseline??"middle"};default:return {...h,...a,x:n-4,y:i-4,anchor:"end"}}}function Pt(r){let{thresholds:e,valueScales:t,primaryScale:n,xRange:i,layout:o}=r,{chartX:s,chartY:l,chartWidth:h,chartHeight:a}=o,m=[];if(e.length===0)return m;let u=[],c=[];for(let p of e){let d=p.id??K(p.name),g=t.get(p.axisIndex??0)??n,f=er({thresholds:[p],valueScale:g,xRange:i});f.inside.length&&u.push({type:"group",cssClass:`threshold threshold--${d}`,id:`threshold-${d}`,commands:f.inside}),f.labels.length&&c.push({type:"group",cssClass:`threshold-label threshold-label--${d}`,commands:f.labels});}return u.length&&m.push({type:"group",cssClass:"thresholds",commands:u,clipRect:{x:s,y:l,w:h,h:a}}),c.length&&m.push({type:"group",cssClass:"threshold-labels",commands:c}),m}function Rt(r,e,t,n){switch(r){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Ae(r){let{ranges:e,timeScale:t,yRange:n,height:i,metrics:o=W}=r,[s,l]=n,h=[],[a,m]=t.range(),u=Math.min(a,m),c=Math.max(a,m),p=d=>Math.max(u,Math.min(c,d));for(let d of e){let g=p(t.map(d.startTime)),f=p(t.map(d.endTime));if(d.fill!==void 0&&h.push({type:"rect",x:g,y:s,w:f-g,h:l-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let b of [g,f])h.push({type:"line",x1:b,y1:s,x2:b,y2:l,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let b=d.labelPosition??"middle",y=d.rotate,S=true;if(y==="auto"){let k=b!=="above"&&b!=="below",w=o(d.label,d.fontSize??11);y=k&&w>Math.abs(f-g)-4?-90:void 0,S=y===void 0||w<=Math.abs(l-s)-4;}S&&h.push({type:"text",content:d.label,x:(g+f)/2,y:Rt(b,s,l,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:y});}}return h}function Ue(r){let{gaps:e,timeScale:t,yRange:n,height:i,fill:o=x.gapFill,hatch:s,fillOpacity:l=x.gapFillOpacity??.15,stroke:h=x.gapStroke,strokeWidth:a=x.gapStrokeWidth,dashed:m=true,fontSize:u=x.gapFontSize,fontFill:c=x.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:g,band:f}=r,b=()=>{if(!f)return [];let y=f.height??6,[S,k]=n,w=Math.max(S,k);return e.map(A=>{let D=t.map(A.startTime),C=t.map(A.endTime);return {type:"rect",x:Math.min(D,C),y:w-y+(f.offset??0),w:Math.abs(C-D),h:y,fill:f.fill??h,opacity:f.opacity??.75}})};return Ae({timeScale:t,yRange:n,height:i,metrics:g,ranges:e.map(y=>{let S=y.style??"dashed_border",k=S==="filled"||S==="dashed_border",w=S==="dashed_border"&&m!==false;return {startTime:y.startTime,endTime:y.endTime,...k&&{fill:y.fill??o,hatch:y.hatch??s,opacity:y.fillOpacity??l},...w&&{edges:{stroke:h,strokeWidth:a}},label:y.label,labelPosition:y.labelBaseline??p,labelColor:c,fontSize:u,rotate:y.rotate??d}})}).concat(b())}function Bt(r){let{gap:e,runs:t,timeScale:n,valueScale:i,metrics:o,lineColor:s}=r,l=[],h=e.bridge,a=[];for(let m=1;m<t.length;m++){let u=t[m-1][t[m-1].length-1],c=t[m][0];if(e.display==="bridge_line"){if(u.value===null||c.value===null)continue;l.push({type:"line",x1:n.map(u.time),y1:i.map(u.value),x2:n.map(c.time),y2:i.map(c.value),stroke:h?.color??s??x.stroke,strokeWidth:h?.width??1.5,dash:h?.style??"dotted"});}else a.push({startTime:u.time,endTime:c.time});}if(a.length>0){let m=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",u=e.fill,c=typeof u=="string"?u:u?.color,p=i.range();l.push(...Ue({gaps:a.map(d=>({...d,style:m})),timeScale:n,yRange:[Math.min(p[0],p[1]),Math.max(p[0],p[1])],fill:c,hatch:typeof u=="object"?u.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return l}function jt(r){let{markers:e,timeScale:t,valueScale:n,yRange:i=[0,300]}=r,[o,s]=i,l=[];for(let h of e){let a=t.map(h.time),m=h.color??x.markerColor,u=h.pointStyle??(h.value!==void 0?"circle":"none"),c=h.lineStyle??"full";if(h.value!==void 0){let p=n.map(h.value);if(c==="to-value"?l.push({type:"line",x1:a,y1:s,x2:a,y2:p,stroke:m,strokeWidth:1,dashed:true}):c==="to-top"?l.push({type:"line",x1:a,y1:o,x2:a,y2:p,stroke:m,strokeWidth:1,dashed:true}):c==="full"&&l.push({type:"line",x1:a,y1:o,x2:a,y2:s,stroke:m,strokeWidth:1}),u!=="none"&&we(l,void 0,u,a,p,x.markerSize,m,m,1.5),h.label){let d=c==="to-value"?p-10:o-6;l.push({type:"text",content:h.label,x:a,y:d,anchor:"middle",fontSize:x.markerFontSize,fill:m});}}else c!=="none"&&l.push({type:"line",x1:a,y1:o,x2:a,y2:s,stroke:m,strokeWidth:1}),h.label&&l.push({type:"text",content:h.label,x:a,y:o-6,anchor:"middle",fontSize:x.markerFontSize,fill:m});}return l}function Ft(r){let{highlights:e,timeScale:t,yRange:n,height:i}=r;return Ae({metrics:r.metrics,timeScale:t,yRange:n,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??x.highlightColor,opacity:o.opacity??x.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??x.highlightLabelColor,fontSize:x.annotationFontSize,rotate:o.rotate}))})}function Et(r){let{annotations:e,timeScale:t,valueScales:n}=r,i=[],o=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],h=a=>l.push(a);switch(s.type){case "line":{let a=o(s.from),m=o(s.to);h({type:"line",x1:a.x,y1:a.y,x2:m.x,y2:m.y,stroke:s.color??x.annotationColor,strokeWidth:s.width??x.annotationWidth,dash:s.dash});break}case "arrow":{let a=o(s.from),m=o(s.to),u=s.color??x.annotationColor,c=s.headSize??x.annotationHead;h({type:"line",x1:a.x,y1:a.y,x2:m.x,y2:m.y,stroke:u,strokeWidth:s.width??x.annotationWidth});let p=Math.hypot(m.x-a.x,m.y-a.y)||1,d=(m.x-a.x)/p,g=(m.y-a.y)/p,f=m.x-d*c,b=m.y-g*c;h({type:"path",points:[{x:m.x,y:m.y},{x:f-g*c*.5,y:b+d*c*.5},{x:f+g*c*.5,y:b-d*c*.5}],fill:u,stroke:"none"});break}case "rect":{let a=o(s.from),m=o(s.to);h({type:"rect",x:Math.min(a.x,m.x),y:Math.min(a.y,m.y),w:Math.abs(m.x-a.x),h:Math.abs(m.y-a.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let a=o(s.at),m=s.color??"#334155",u=s.radius??x.annotationRadius,c=s.shape??"circle";c==="circle"?h({type:"circle",cx:a.x,cy:a.y,r:u,fill:m}):c==="square"?h({type:"rect",x:a.x-u,y:a.y-u,w:u*2,h:u*2,fill:m}):(h({type:"line",x1:a.x-u,y1:a.y-u,x2:a.x+u,y2:a.y+u,stroke:m,strokeWidth:1.5}),h({type:"line",x1:a.x-u,y1:a.y+u,x2:a.x+u,y2:a.y-u,stroke:m,strokeWidth:1.5}));break}case "label":{let a=o(s.at);h({type:"text",content:s.text,x:a.x+(s.dx??0),y:a.y+(s.dy??0),anchor:s.anchor??rr(a.x+(s.dx??0),s.text,r),fontSize:x.annotationFontSize,fill:s.color??x.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let a=K(s.id);i.push({type:"group",cssClass:`annotation annotation--${a}`,commands:l});}else i.push(...l);}return i}function rr(r,e,t){let{metrics:n,timeScale:i}=t;if(!n)return "middle";let[o,s]=i.range(),l=n(e,x.annotationFontSize)/2;return r-l<o?"start":r+l>s?"end":"middle"}var ie=class r{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++r.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var Me=class extends ie{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??x.bandFill,n=e.hatch,i=e.avgLine??false,o=e.avgLineColor??x.bandAvgLine,s=e.bandWidth??10,l=[];for(let h of this.data){if(h.min===null||h.max===null)continue;let a=this.timeScale.map(h.time),m=e.valueScale.map(h.max),u=e.valueScale.map(h.min),c=s,p=this.data.indexOf(h);if(l.push({type:"rect",x:a-c/2,y:m,w:c,h:u-m,fill:t,hatch:n,opacity:this.opacity(h.count),id:this.id?`${this.id}-slot-${p}`:void 0}),i&&h.avg!==null){let d=e.valueScale.map(h.avg);l.push({type:"line",x1:a-c/2,y1:d,x2:a+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return l}};var ir=1,Le=class{#e;constructor(e,t,n,i){this.#e={...e,xRange:t,y:n,height:i};}render(){let{items:e,timeScale:t,background:n,hatch:i,showAxis:o,xRange:s,y:l,height:h}=this.#e,a=[];n&&a.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let m of e){let u=t.map(m.startTime),c=t.map(m.endTime);if(c<s[0]||u>s[1])continue;let p=Math.max(s[0],Math.min(s[1],u)),d=Math.max(s[0],Math.min(s[1],c)),g=Math.max(d-p,ir);p+g>s[1]&&(p=Math.max(s[0],s[1]-g));let f=p+g/2;if(a.push({type:"rect",x:p,y:l,w:g,h,hatch:m.hatch??i,fill:m.fill??"#6b728044",stroke:m.stroke,strokeWidth:m.strokeWidth??0,title:m.title}),m.label){let b=m.labelFontSize??10;a.push({type:"text",content:m.label,x:f,y:this.#t(m.labelBaseline,b),anchor:"middle",fontSize:b,fill:m.labelFill??"#333"});}}if(o){let m=new ne({domain:t.domain(),xRange:s,y:l+h+4});a.push({type:"group",cssClass:"annotation-band-axis",commands:m.render()});}return a}#t(e,t){let{y:n,height:i}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+i-t*.25;default:return n+i/2+t*.35}}};function ve(r){return {id:r.id,line:{stroke:r.stroke??x.stroke,strokeWidth:r.strokeWidth??x.strokeWidth,smoothing:r.smoothing??false,smoothingType:r.smoothingType,dashed:r.dashed??false},fill:r.fill??x.areaFillAlpha,markers:{type:r.pointStyle??"none",size:r.pointSize??x.pointSize,stroke:r.stroke??x.stroke,fill:"#ffffff"},shadow:{color:r.shadowColor??"transparent",blur:r.shadowBlur??0,offsetX:r.shadowOffsetX??0,offsetY:r.shadowOffsetY??0}}}function Gt(r,e,t){let n=[],i=ve(t);for(let o=0;o<r.length;o++){let s=r[o];s.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s.data.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),stroke:s.color??i.line.stroke,strokeWidth:i.line.strokeWidth,smoothing:i.line.smoothing,smoothingType:i.line.smoothingType,dashed:i.line.dashed,shadowColor:i.shadow.color,shadowBlur:i.shadow.blur,shadowOffsetX:i.shadow.offsetX,shadowOffsetY:i.shadow.offsetY,fill:"none"}):s.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(s.data[0].time),cy:e.valueScale.map(s.data[0].value),r:Math.max(i.markers.size,i.line.strokeWidth),fill:s.color??i.line.stroke,shadowColor:i.shadow.color,shadowBlur:i.shadow.blur});}return n}function It(r,e,t,n){if(r.length<2)return [];let i=E.splitByBoundaries(r,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<i.length;s++){let l=i[s];if(l.data.length<2)continue;let h=t.getColor(l.zoneIndex);if(!h)continue;let a=l.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),m=l.data.map(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yHigh(u))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...a,...m],fill:h,hatch:t.getHatch?.(l.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:l.data.length,smoothTail:l.data.length}:{}});}return o}function Ot(r,e,t,n,i,o,s){return It(r,e,{boundaries:[],yLow:l=>l.avg,yHigh:t,getValue:l=>l.avg,interpolate:E.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>i},{id:o,...s})}var De=class extends ie{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??x.minColor,n=e.maxColor??x.maxColor,i=e.avgColor??x.avgColor,o=e.avgDashed??true,s=e.smoothing??false,l=e.smoothingType,h=e.strokeWidth??x.strokeWidth,a=E.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(a.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];a.forEach((d,g)=>{if(d.length<2)return;let f=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Ot(d,m,y=>y.max,e.fillToMax,e.fillToMaxHatch,f("fillToMax"),{smoothing:s,smoothingType:l});u.push(...b);}if(e.fillToMin){let b=Ot(d,m,y=>y.min,e.fillToMin,e.fillToMinHatch,f("fillToMin"),{smoothing:s,smoothingType:l});u.push(...b);}});let c=a.filter(d=>d.length>=2),p=(d,g,f,b=false)=>Gt(c.map(y=>({data:y.map(S=>({time:S.time,value:d(S)}))})),m,{stroke:g,strokeWidth:h,smoothing:s,smoothingType:l,dashed:b,id:this.id?`${this.id}-${f}`:void 0});return u.push(...p(d=>d.max,n,"max"),...p(d=>d.min,t,"min"),...p(d=>d.avg,i,"avg",o)),u}};function Wt(r,e,t){let n=r.style?.line&&!Array.isArray(r.style.line)?r.style.line:void 0,i=typeof r.style?.fill=="string"?r.style.fill:void 0;return r.showAs==="minmaxavg"?new De({data:r.data,timeScale:e,valueScale:t,minColor:r.minColor,maxColor:r.maxColor,avgColor:r.avgColor,avgDashed:r.avgDashed,fillToMax:r.fillToMax,fillToMaxHatch:r.fillToMaxHatch,fillToMin:r.fillToMin,fillToMinHatch:r.fillToMinHatch,smoothing:n?.smoothing,smoothingType:n?.smoothingType,strokeWidth:n?.width,id:H(r.name,r.id)}).render():new Me({data:r.data,timeScale:e,valueScale:t,fill:i??n?.color,avgLine:r.avgLine,countOpacity:r.countOpacity,id:H(r.name,r.id)}).render()}function zt(r,e,t){let n=r??[];return {grenzen:n.map(o=>e.get(o)).filter(o=>!!o).map(o=>o.value).sort((o,s)=>o-s),farbe(o,s){let l=s??t,h=Number.NEGATIVE_INFINITY;for(let a of n){let m=e.get(a);!m||o<m.value||m.value<h||(h=m.value,l=m.color??l);}return l}}}function Ht(r){let{series:e,ctx:t,runs:n,totalPoints:i,style:o,styleLine:s,styleMarkers:l,stepShape:h,thresholds:a}=r,{timeScale:m,valueScale:u}=t,c=[],p=zt(e.colorByThresholds,a,o.stroke),d=p.grenzen,g=new Map,f=[];for(let y of n){let w=function(C){return E.splitByBoundaries(C==="step"?Y(y):y,d,T=>T.value,E.interpolateDataPoint)};if(y.length<1)continue;let S=H(e.name,e.id),k=new Map,A=C=>{let T=k.get(C);return T||(T=w(C),k.set(C,T)),T},D=(C,T,$)=>{let R=A(C);for(let F of R){let j=F,B=g.get($)??0;if(g.set($,B+1),j.data.length<1)continue;let z=j.zoneLow;if(j.data.length===1){let I=p.farbe(z,T.color);c.push({type:"circle",id:S?`${S}-dot-${B}${$}`:void 0,cx:m.map(j.data[0].time),cy:u.map(j.data[0].value),r:Math.max(o.pointSize??x.pointSize,T.width??o.strokeWidth??x.strokeWidth),fill:I,shadowColor:o.shadowColor,shadowBlur:o.shadowBlur});continue}c.push({type:"path",cssClass:"series-line",id:S?`${S}-line-${B}${$}`:void 0,points:j.data.map(I=>({x:m.map(I.time),y:u.map(I.value)})),stroke:p.farbe(z,T.color),strokeWidth:T.width??o.strokeWidth,smoothing:C==="step"?false:T.smoothing??o.smoothing,smoothingType:T.smoothingType??o.smoothingType,dash:T.style,opacity:T.opacity,fill:"none",shadowColor:o.shadowColor,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY});}};s===false||(Array.isArray(s)?s.forEach((C,T)=>{D(C.shape??(e.seriesType==="step"?"step":"line"),C,`-${T}`);}):D(h?"step":"line",s??{},"")),f.push(...y);}return o.pointStyle&&o.pointStyle!=="none"&&i<=(l?.threshold??x.pointThreshold)&&c.push(...wt(f,t,o,y=>p.farbe(y.value))),c}var Vt={display:"dashed_border",fill:{color:"#94a3b8",hatch:"classic-diagonal"},opacity:.5,label:{rotate:"auto"}},Nt=6e4,or=60*Nt,sr=24*or;function ar(r){let e=Math.floor(r/Nt);if(e<60)return `${e} min`;if(r<sr){let i=Math.floor(e/60),o=e%60;return o===0?`${i} h`:`${i} h ${o} min`}let t=Math.floor(e/1440),n=Math.floor(e%1440/60);return n===0?`${t} d`:`${t} d ${n} h`}function lr(r,e,t){let n=r.format(e,{hour:"2-digit",minute:"2-digit"}),i=o=>r.format(o,{year:"numeric",month:"2-digit",day:"2-digit"});return i(e)===i(t)?n:`${r.format(e,{day:"numeric",month:"short"})} ${n}`}function mr(r,e,t){let n=null;for(let i of r)i.value===null||i.time<e||i.time>t||(n===null||i.time>n)&&(n=i.time);return n}function Kt(r){let{atEnd:e,series:t,timeScale:n}=r,[i,o]=n.domain(),s=e.now??o,l=new Set;for(let a of t){if(!("data"in a)||a.data.length===0||!("value"in a.data[0]))continue;let m="gaps"in a?a.gaps?.atEnd:void 0;if(m===false)continue;let u=m?.afterMs??e.afterMs,c=mr(a.data,i,s);c!==null&&s-c>u&&l.add(c);}let h={...Vt,...e.style,label:{...Vt.label,...e.style?.label}};return [...l].sort((a,m)=>a-m).map(a=>{let m=s-a,u=e.label,c=typeof u=="function"?u(a,m):u?.replaceAll("{since}",lr(n,a,s)).replaceAll("{duration}",ar(m));return {startTime:a,endTime:s,label:c,style:h}})}function Yt(r,e,t){let i=new Array(r.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));for(let s of ["left","right"]){let l=s==="left",h=r.map((a,m)=>({t:a,i:m})).filter(a=>a.t.position===s).sort((a,m)=>l?m.t.achseX-a.t.achseX:a.t.achseX-m.t.achseX);for(let{t:a,i:m}of h){let u=a.schrift/2,c=o.filter(g=>g.position===s),p=a.kante,d=l?p-1-u:p+1+u;for(let g=0;g<=c.length;g++){let f=d-u-1,b=d+u+1,y=c.find(S=>f<S.bis&&S.von<b);if(!y)break;p=l?y.von:y.bis,d=l?p-1-u:p+1+u;}if(l?d-u<2:d+u>t-2){let g=o.filter(f=>f.position===s&&f.titel);d=l?u+2:t-u-2;for(let f=0;f<=g.length;f++){let b=d-u-1,y=d+u+1,S=g.find(k=>b<k.bis&&k.von<y);if(!S)break;d=l?S.bis+1+u:S.von-1-u;}}o.push({position:s,von:d-u-1,bis:d+u+1,titel:true}),i[m]=d;}}return {xs:i,belegt:o}}function Xt(r){let{axes:e,neueForm:t,achsenTitel:n,titelSpuren:i,layout:o}=r,{chartX:s,chartY:l,chartWidth:h,chartHeight:a}=o,m=t?void 0:e?.left?.label,u=t?void 0:e?.right?.label,c=e?.x?.label;if(!m&&!u&&!c&&n.length===0)return [];let p=[],d=l+a/2,g=e?.left?.labels,f=e?.right?.labels,b=e?.x?.labels;return m&&p.push({type:"text",content:m,x:14,y:d,anchor:"middle",fontSize:g?.fontSize??x.axisLabelSize,fill:g?.color??x.axisLabelColor,rotate:-90}),u&&p.push({type:"text",content:u,x:o.totalWidth-14,y:d,anchor:"middle",fontSize:f?.fontSize??x.axisLabelSize,fill:f?.color??x.axisLabelColor,rotate:90}),n.forEach((y,S)=>{p.push({type:"text",content:y.text,x:i[S],y:d,anchor:"middle",fontSize:y.style?.fontSize??x.axisLabelSize,fill:y.style?.color??x.axisLabelColor,rotate:y.position==="right"?90:-90});}),c&&p.push({type:"text",content:c,x:s+h/2,y:o.totalHeight-6-(r.untenBelegt??0),anchor:"middle",fontSize:b?.fontSize??x.axisLabelSize,fill:b?.color??x.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}function Ut(r,e){for(let t of r){if(t.length===0||e<t[0].time||e>t[t.length-1].time)continue;let n=0;for(;n<t.length-1&&t[n+1].time<=e;)n++;return {lauf:t,i:n}}return null}function $e(r,e,t){if(r.art==="fest")return r.wert;let n=Ut(r.laeufe,e);if(!n)return null;let{lauf:i,i:o}=n,s=i[o];if(r.stufe)return t&&s.time===e&&o>0?i[o-1].value:s.value;if(s.time===e||o===i.length-1)return s.value;let l=i[o+1];return s.value+(l.value-s.value)*(e-s.time)/(l.time-s.time)}function Zt(r,e,t){if(r.art==="fest")return true;let n=Ut(r.laeufe,e);return n?t===void 0||e-n.lauf[n.i].time<=t:false}function qt(r,e,t){let n=t.exceeds,i=t.side??"both",o=new Set;for(let a of [r,e])if(a.art==="laeufe")for(let m of a.laeufe)for(let u of m)o.add(u.time),t.maxAgeMs!==void 0&&o.add(u.time+t.maxAgeMs);let s=[...o].sort((a,m)=>a-m),l=[];for(let a=0;a+1<s.length;a++){let[m,u]=[s[a],s[a+1]],c=(m+u)/2;if(!Zt(r,c,t.maxAgeMs)||!Zt(e,c,t.maxAgeMs))continue;let p=$e(e,m,false)-$e(r,m,false),d=$e(e,u,true)-$e(r,u,true),g=(f,b)=>{if(f<=0&&b<=0)return null;if(f>0&&b>0)return [m,u];let y=m+(0-f)/(b-f)*(u-m);return f>0?[m,y]:[y,u]};if(i!=="below"){let f=g(p-n,d-n);f&&f[1]>f[0]&&l.push(f);}if(i!=="above"){let f=g(-p-n,-d-n);f&&f[1]>f[0]&&l.push(f);}}l.sort((a,m)=>a[0]-m[0]);let h=[];for(let a of l){let m=h[h.length-1];m&&a[0]<=m[1]?m[1]=Math.max(m[1],a[1]):h.push([a[0],a[1]]);}return h}function Jt(r,e,t,n,i,o){let s=0,l=h=>h.type==="group"?{...h,commands:h.commands.map(l)}:"id"in h&&h.id!==void 0?{...h,...o(s++)}:h;return e.map(([h,a])=>{let m=t.map(h);return {type:"group",clipRect:{x:m,y:n,w:t.map(a)-m,h:i-n},commands:r.map(l)}})}function J(r){return r!==void 0&&typeof r=="object"&&"series"in r?r.series:null}function Qt(r){let e=[...r].sort((n,i)=>n.time-i.time),t=0;return n=>{for(;t>0&&e[t].time>n;)t--;for(;t<e.length-1&&e[t+1].time<=n;)t++;let i=e[t];if(!i||n<i.time)return null;if(i.time===n)return i.value??null;let o=e[t+1];if(!o||n>o.time||i.value===null||o.value===null)return null;let s=o.time-i.time;return s===0?i.value:i.value+(o.value-i.value)*(n-i.time)/s}}function en(r){let e=[...r].sort((n,i)=>n.time-i.time),t=new Map;for(let n=1;n<e.length;n++){let[i,o]=[e[n-1],e[n]];i.time===o.time&&i.value!==null&&!t.has(i.time)&&t.set(i.time,i.value);}return t}function tn(r,e,t){let n=r??e;if(n==="series")return null;if(n==="chartTop")return t.chartTop;if(n==="chartBottom")return t.chartBottom;if(typeof n=="object"&&"threshold"in n){let i=t.thresholds.get(n.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${n.threshold}'`);return t.valueScale.map(i.value)}return typeof n=="object"&&"value"in n?t.valueScale.map(n.value):null}function hr(r){return typeof r=="string"?{color:r}:{color:r.color,hatch:r.hatch}}function nn(r,e){let t=J(r);if(t!==null){let i=e.fremdeSerie?.(t);return i?{art:"laeufe",laeufe:E.getRuns(i.data,o=>o.value===null,i.gapThreshold),stufe:i.shape==="step"}:null}if(r==="series")return {art:"laeufe",laeufe:e.runs,stufe:e.shape==="step"};let n=e.valueScale.domain();return {art:"fest",wert:ue(r,e)??(r==="chartBottom"?n[0]:n[1])}}function rn(r,e,t){let n=ur(r,e,t);if(!r.where||n.length===0)return n;let i=nn(r.from??"chartBottom",e),o=nn(r.to??"series",e);return !i||!o?n:Jt(n,qt(i,o,r.where),e.timeScale,e.chartTop,e.chartBottom,s=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${s}`}:{})}function ur(r,e,t){let n=tn(r.from,"chartBottom",e),i=tn(r.to,"series",e),{color:o,hatch:s}=hr(r.fill),a={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:m=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${m}`}:{}};return J(r.from)!==null||J(r.to)!==null?dr(r,e,a):n!==null&&i!==null?pr(n,i,e,a):fr(r,e,n,i,a)}function cr(r,e,t){let n=e.shape==="step",i=(c,p)=>{let d=c??p,g=J(d);if(g!==null){let y=e.fremdeSerie(g);if(!y)return null;let S=y.shape==="step",k=E.getRuns(y.data,w=>w.value===null,y.gapThreshold).map(w=>S?Y(w):w);return {art:"fremd",skala:y.valueScale??e.valueScale,laeufe:k,glatt:!S&&!!y.smoothing,verfahren:y.smoothingType}}if(d==="series")return {art:"eigene",glatt:!n&&!!e.smoothing,verfahren:e.smoothingType};let f=ue(d,e),b=e.valueScale.domain();return {art:"fest",wert:f??(d==="chartBottom"?b[0]:b[1]),glatt:false}},o=i(r.from,"chartBottom"),s=i(r.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let l=c=>c.art==="fremd"?c.skala:e.valueScale,h=c=>p=>({x:e.timeScale.map(p.time),y:c.map(p.value)}),a=(c,p)=>c.art==="eigene"?[p]:c.art==="fremd"?c.laeufe.filter(d=>d.length>=2):[null],m=(c,p,d,g)=>p?p.map(h(l(c))):[d,g].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(c.wert)})),u=[];for(let c of e.runs){if(c.length<2)continue;let p=n?Y(c):c;for(let d of a(o,p))for(let g of a(s,p)){let f=Math.max(p[0].time,d?.[0].time??-1/0,g?.[0].time??-1/0),b=Math.min(p.at(-1).time,d?.at(-1).time??1/0,g?.at(-1).time??1/0);if(!(b>f))continue;let y={k:o,pts:m(o,d,f,b)},S={k:s,pts:m(s,g,f,b)};y.k.glatt||([y,S]=[S,y]);let k=A=>(A.art==="fest"?void 0:A.verfahren)??"catmull-rom",w=e.timeScale.map(f);u.push({type:"group",clipRect:{x:w,y:e.chartTop,w:e.timeScale.map(b)-w,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(u.length),points:[...y.pts,...[...S.pts].reverse()],smoothing:true,smoothingType:k(y.k),smoothCount:y.pts.length,...S.k.glatt?{smoothTail:S.pts.length,smoothTailType:k(S.k)}:{}}]});}}return u}function dr(r,e,t){if(!e.fremdeSerie){let l=J(r.from)??J(r.to);throw new Error(`fillSpec region references series '${l}', but no series lookup was provided`)}let n=cr(r,e,t);if(n)return n;let i=(l,h,a)=>{let m=l??h,u=J(m);if(u!==null){let g=e.fremdeSerie(u);if(!g)throw new Error(`fillSpec region references unknown series '${u}'`);let f=g.shape==="step"?Y(g.data):g.data;return {bei:Qt(f),davor:en(f),zeiten:f.map(b=>b.time),skala:g.valueScale??e.valueScale}}if(m==="series")return {bei:Qt(a),davor:en(a),zeiten:a.map(g=>g.time),skala:e.valueScale};let c=ue(m,e),p=e.valueScale.domain(),d=c??(m==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[],skala:e.valueScale}},o=e.shape==="step",s=[];for(let l of e.runs){if(l.length<2)continue;let h=o?Y(l):l,a=i(r.from,"chartBottom",h),m=i(r.to,"series",h),u=h[0].time,c=h[h.length-1].time,p=[...new Set([...a.zeiten,...m.zeiten,...h.map(b=>b.time)])].filter(b=>b>=u&&b<=c).sort((b,y)=>b-y),d=[],g=[],f=()=>{if(d.length>=2){let b=[...g].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...b]});}d=[],g=[];};for(let b of p){let y=a.bei(b),S=m.bei(b);if(y===null||S===null){f();continue}let k=e.timeScale.map(b),w=a.davor?.get(b)??y,A=m.davor?.get(b)??S;(w!==y||A!==S)&&(d.push({x:k,y:m.skala.map(A)}),g.push({x:k,y:a.skala.map(w)})),d.push({x:k,y:m.skala.map(S)}),g.push({x:k,y:a.skala.map(y)});}f();}return s}function pr(r,e,t,n){let i=t.timeScale.range(),o=i[0],s=i[1],l=Math.min(r,e),h=Math.max(r,e);return [{...n.attrs,...n.teilId(0),points:[{x:o,y:l},{x:s,y:l},{x:s,y:h},{x:o,y:h}]}]}function fr(r,e,t,n,i){let o=t??n,s=[],l=gr(r,e);if(l===null){let m=e.valueScale.domain();l=(t??n)===e.chartBottom?m[0]:m[1];}let h=ue(r.outer,e),a=e.shape==="step";for(let m of e.runs){if(m.length<2)continue;let u=a?Y(m):m,c=E.splitByThreshold(u,l,d=>d.value??l,E.interpolateDataPoint),p=r.side==="above"?c.above:r.side==="below"?c.below:[...c.above,...c.below];if(h!==null&&r.side){let d=h,g=r.side==="above"?f=>Math.min(f,d):f=>Math.max(f,d);p=p.map(f=>f.map(b=>({...b,value:g(b.value??d)})));}for(let d of p){if(d.length<2)continue;let g=d.map(b=>({x:e.timeScale.map(b.time),y:e.valueScale.map(b.value)})),f=[];for(let b of [...g].reverse()){let y=f[f.length-1];a&&y&&y.x===b.x||f.push({x:b.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:a?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:g.length,points:[...g,...f]});}}return s}function gr(r,e){let t=r.from==="series"?r.to:r.from;return ue(t,e)}function ue(r,e){return r===void 0||r==="series"||r==="chartTop"||r==="chartBottom"?null:typeof r=="object"&&"threshold"in r?e.thresholds.get(r.threshold)?.value??null:typeof r=="object"&&"value"in r?r.value:null}function on(r,e){if(typeof r=="string"||!("regions"in r))return rn({fill:r},e,0);let t=[];return r.regions.forEach((n,i)=>{t.push(...rn(n,e,i));}),t}function an(r){let e=r.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??x.stroke,width:t?.width??x.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function sn(r,e,t,n,i){let o=r.filter(a=>a.value!==null);if(o.length<2)return [];let s=an(t);e.merke?.({index:i,kind:t.kind,punkte:o.map(a=>({time:a.time,value:a.value})),farbe:s.color,...s.dash?{linie:s.dash}:{}});let l=o.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)}));return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${n}`:`overlay-${i}-${n}`,points:l,stroke:s.color,strokeWidth:s.width,smoothing:s.smoothing,smoothingType:s.smoothingType,dash:s.dash,fill:"none"}]}function ln(r,e,t=0){switch(r.kind){case "movingAverage":{let n=r.type==="exponential"?kt(e.data,r.window):Xe(e.data,r.window);return sn(n,e,r,"movingAvg",t)}case "movingMkt":{let n=xt(e.data,r.window,r.activationEnergy);return sn(n,e,r,"movingMkt",t)}case "limits":{let n=[],i=e.timeScale.range(),o=i[0],s=i[1],l=an(r),h=l.color,a=l.width,m=l.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return r.high!==void 0&&n.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(r.high),x2:s,y2:e.valueScale.map(r.high),stroke:h,strokeWidth:a,dash:m}),r.low!==void 0&&n.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(r.low),x2:s,y2:e.valueScale.map(r.low),stroke:h,strokeWidth:a,dash:m}),n}case "stdDevBand":{let n=r.multiplier??1,i=Xe(e.data,r.window),o=St(e.data,r.window),s=[],l=[],h=[];for(let b=0;b<i.length;b++){let y=i[b].value,S=o[b].value;if(y===null||S===null)continue;let k=e.timeScale.map(i[b].time);s.push({x:k,y:e.valueScale.map(y+n*S)}),l.push({x:k,y:e.valueScale.map(y-n*S)}),h.push({time:i[b].time,value:y,low:y-n*S,high:y+n*S});}if(s.length<2)return [];let a=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,m=[],c=(typeof r.style?.fill=="string"||r.style?.fill&&!("regions"in r.style.fill)?r.style.fill:void 0)??"#94a3b833",{color:p,hatch:d}=yr(c);m.push({type:"path",cssClass:"series-fill",id:`${a}stdDevBand`,points:[...s,...[...l].reverse()],fill:p,hatch:d,stroke:"none"});let g=r.style?.line,f=g&&!Array.isArray(g)?g:void 0;if(e.merke?.({index:t,kind:"stdDevBand",punkte:h,farbe:f?f.color??x.stroke:p,...f?.style?{linie:f.style}:{}}),f){let b=i.filter(y=>y.value!==null).map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)}));b.length>=2&&m.push({type:"path",cssClass:"series-line",id:`${a}stdDevBand-mean`,points:b,stroke:f.color??x.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return m}}}function yr(r){return typeof r=="string"?{color:r}:{color:r.color,hatch:r.hatch}}function mn(r,e){let t={...e,...r.style},n=t.fill,i,o;return typeof n=="string"?i=n:n&&(i=n.color,o=n.hatch),{startTime:r.startTime,endTime:r.endTime,label:r.label,fill:i,hatch:o,fillOpacity:t.opacity,labelBaseline:t.label?.baseline,rotate:t.label?.rotate,style:t.display==="bridge_line"?void 0:t.display}}function br(r){if(!r)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(r))return {gaps:r,autoDetect:false,minGapMs:6e4};let e=r.style;return {gaps:(r.regions??[]).map(n=>mn(n,e)),autoDetect:r.autoDetect??false,minGapMs:r.minGapMs??6e4,band:e?.band,atEnd:r.atEnd}}function hn(r,e){if(e)for(let t of r)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&hn(t.commands,e);}function un(r,e){if(e)for(let t of r)"id"in t&&t.id&&(t.id=`${e}-${t.id}`),t.type==="group"&&Array.isArray(t.commands)&&un(t.commands,e);}var N=class{_layout;_idPraefix;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_theme;_overlayWerte=new Map;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_gapsAtEnd;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;readonly_annotationBandHeight=0;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new se({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._idPraefix=e.idPrefix,this._legend=e.legend,this._textMetrics=e.textMetrics??W,this._theme=e.theme,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=br(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,this._gapsAtEnd=t.atEnd,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let n=t.height??12,i=t.spacing??0;(t.showAxis??false)&&(e+=26+i),e+=n+i;}return e}setData(e){this._series=e.filter(t=>Array.isArray(t.data));}addAnnotation(e){let t=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:t}),t}removeAnnotation(e){let t=this._annotations.length;return this._annotations=this._annotations.filter(n=>n.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<t}setAnnotations(e){this._annotations=[...e],this._disabledAnnotations.clear();}clearAnnotations(){this._annotations=[],this._disabledAnnotations.clear();}getAnnotations(){return this._annotations}disableAnnotation(e){this._disabledAnnotations.add(e);}enableAnnotation(e){this._disabledAnnotations.delete(e);}_axisIndexOf(e){return e.yAxisIndex??0}_timesOf(e){return e.data.map(t=>t.time)}_layoutMitLegende(){let e=_t({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,n=Ct(e,this._layout.margin);return n&&(t=new se({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:n}).compute()),{layout:t,legende:e}}renderCommands(){return le(this._theme,()=>this._zeichne())}_zeichne(){if(this._overlayWerte.clear(),this._series.length===0)return [];let{layout:e,legende:t}=this._layoutMitLegende(),{chartX:n,chartY:i,chartWidth:o,chartHeight:s}=e,l=[n,n+o],h=[i,i+s],a=[];for(let _ of this._series)_.data.sort((M,P)=>M.time-P.time);let m=new Map,u=1/0,c=-1/0,p=false;for(let _ of this._series){let M=this._axisIndexOf(_),P=m.get(M);P?P.push(_):m.set(M,[_]);for(let L of this._timesOf(_))L<u&&(u=L),L>c&&(c=L),p=true;}if(!p)return [];let d=this._axes?.x?.domain,g=d&&d!=="auto"?d:[u,c];this._timeScale=new ee({domain:g,range:l,locale:this._locale,timeZone:this._timeZone});let f=new ne({domain:g,xRange:l,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:be(this._axes?.x?.ticks?.minor,U(this._axes?.x?.grid)?.minor),colors:ye(this._axes?.x?.axis),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let b=Array.from(m.keys()).sort((_,M)=>_-M),y=yt({axes:this._axes,indices:b,seriesByIndex:m,layout:e,thresholds:this._thresholds,metrics:this._textMetrics});a.push(...y.commands);let{titel:S,baender:k,neueForm:w}=y,A=y.primary;for(let[_,M]of y.scales)this._valueScales.set(_,M);let D=this._valueScales.get(0)??this._valueScales.get(b[0]);a.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:f.render()});let C=Lt({axes:this._axes,timeAxis:f,primaryValueAxis:A,xRange:l,yRange:h}),T=C.group;T&&C.layer==="back"&&(a.push(T),T=null),this._highlights.length>0&&a.push({type:"group",cssClass:"highlights",commands:Ft({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:h,height:e.totalHeight})});let $=D?Pt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:D,xRange:l,layout:e}):[];a.push(...$);let R=this._gapsAtEnd?Kt({atEnd:this._gapsAtEnd,series:this._series,timeScale:this._timeScale}).map(_=>mn(_,void 0)):[],F=[...this._gaps,...R];if(this._gapsAutoDetect){let _=[];for(let M of this._series){if(V(M))continue;let P=M.data.filter(L=>L.value!==null);_.push(...bt(P,this._gapsMinGapMs));}_.length>0&&(F=[...F,..._]);}F.length>0&&a.push({type:"group",cssClass:"gaps",commands:Ue({gaps:F,timeScale:this._timeScale,yRange:h,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let j=new Map(this._thresholds.map(_=>[_.id??_.name,_]));for(let[_,M]of this._series.entries()){if(M.data.length===0)continue;let P=this._valueScales.get(this._axisIndexOf(M));if(!P)continue;let L=K(M.id??M.name);a.push({type:"group",cssClass:`series series--${L}`,id:`series-${L}`,commands:this._renderSeries(M,P,j,_),...this._clipSeries?{clipRect:{x:n,y:i,w:o,h:s}}:{}});}T&&a.push($t(T,Dt($)));let B=this._markers.map(_=>({..._}));for(let _ of B)if(_.value===void 0&&(_.lineStyle==="to-value"||_.lineStyle==="to-top")){let M=this._series[_.seriesIndex??0];M&&!V(M)&&M.data.length>=2&&(_.value=this._interpolateValue(_.time,M.data));}if(B.length>0&&D){let _=[];for(let M of B){let P=D,L=this._series[M.seriesIndex??0];L&&(P=this._valueScales.get(this._axisIndexOf(L))??D),_.push(...jt({markers:[M],timeScale:this._timeScale,valueScale:P,yRange:h}));}a.push({type:"group",cssClass:"markers",commands:_});}let z=this._annotations.filter(_=>!_.id||!this._disabledAnnotations.has(_.id));if(z.length>0&&a.push({type:"group",cssClass:"annotations",commands:Et({annotations:z,timeScale:this._timeScale,valueScales:this._valueScales,metrics:this._textMetrics})}),this._annotationBands.length>0){let _=i+s+this._layout.margin.bottom,M=0;this._annotationBands.forEach(P=>{let L=P.height??12,Z=P.spacing??0,Cn=_+M;(P.showAxis??false)&&(M+=26+Z),M+=L+Z,a.push({type:"group",cssClass:"annotation-band",commands:new Le({name:P.name,showAxis:P.showAxis??false,items:P.items,timeScale:this._timeScale,background:P.background,hatch:P.hatch},[n,n+o],Cn,L).render()});});}let{xs:I,belegt:G}=Yt(S.map(_=>({achseX:_.achseX,kante:_.kante,position:_.position,schrift:_.style?.fontSize??x.axisLabelSize})),k,e.totalWidth);return a.push(...At({legende:t,layout:e,randBelegt:G,metrics:this._textMetrics})),a.push(...Xt({axes:this._axes,neueForm:w,achsenTitel:S,titelSpuren:I,layout:e,untenBelegt:e.margin.bottom-this._layout.margin.bottom})),hn(a,this._fontFamily??x.fontFamily),un(a,this._idPraefix),a}_linienGrundlage(e){let t=e.style?.line,n=t&&!Array.isArray(t)?t:void 0,i=this._gapsAutoDetect?this._gapsMinGapMs:void 0,o=Array.isArray(t)?t[0]:n,s=(o?.shape??e.seriesType)==="step",l=o||void 0,h=l?.gapThreshold??i??x.gapThreshold;return {styleLine:t,lineDefaults:n,gapThreshold:h,grundLinie:l,stepShape:s}}_renderSeries(e,t,n,i=0){let o=this._timeScale,s={timeScale:o,valueScale:t};if(V(e))return Wt(e,o,t);let{lineDefaults:l,gapThreshold:h}=this._linienGrundlage(e),a=E.getRuns(e.data,k=>k.value===null,h),m=a.reduce((k,w)=>k+w.length,0);if(m===0)return [];let u=[],c=e.style?.markers,p=e.style?.shadow,d={stroke:l?.color??this._palettenFarbe(i),strokeWidth:l?.width??x.strokeWidth,smoothing:l?.smoothing,smoothingType:l?.smoothingType,dashed:l?.style==="dashed",pointStyle:c?.type,pointSize:c?.size,pointStroke:c?.stroke,pointFill:c?.fill,pointStrokeWidth:c?.strokeWidth,shadowColor:p?.color,shadowBlur:p?.blur,shadowOffsetX:p?.offsetX,shadowOffsetY:p?.offsetY,id:H(e.name,e.id)},{styleLine:g,grundLinie:f,stepShape:b}=this._linienGrundlage(e),y=e.style?.fill;if(y!==void 0){let k=t.range(),w=Math.min(k[0],k[1]),A=Math.max(k[0],k[1]);u.push(...on(y,{runs:a,timeScale:o,valueScale:t,thresholds:n,chartTop:w,chartBottom:A,smoothing:f?.smoothing,smoothingType:f?.smoothingType,shape:b?"step":"line",fremdeSerie:D=>{let C=this._series.find(F=>(F.id??F.name)===D||F.name===D);if(!C||!("data"in C))return;let T=C.data;if(T.length===0||!("value"in T[0]))return;let $=this._linienGrundlage(C),R=$.grundLinie;return {data:T,shape:$.stepShape?"step":"line",smoothing:R?.smoothing,smoothingType:R?.smoothingType,gapThreshold:$.gapThreshold,valueScale:this._valueScales.get(this._axisIndexOf(C))}},idPrefix:H(e.name,e.id)}));}u.push(...Ht({series:e,ctx:s,runs:a,totalPoints:m,style:d,styleLine:g,styleMarkers:c,stepShape:b,thresholds:n}));let S=e.overlays;if(S&&S.length>0){let k=t.range(),w={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(k[0],k[1]),chartBottom:Math.max(k[0],k[1]),idPrefix:H(e.name,e.id),merke:A=>{let D=this._overlayWerte.get(i)??[];D.push(A),this._overlayWerte.set(i,D);}};S.forEach((A,D)=>{u.push(...ln(A,w,D));});}return e.style?.gap&&a.length>1&&u.push(...Bt({gap:e.style.gap,runs:a,timeScale:o,valueScale:t,metrics:this._textMetrics,lineColor:l?.color})),u}_interpolateValue(e,t){for(let n=1;n<t.length;n++){let i=t[n-1],o=t[n];if(!(i.value===null||o.value===null)&&e>=i.time&&e<=o.time){if(o.time===i.time)return i.value;let s=(e-i.time)/(o.time-i.time);return i.value+s*(o.value-i.value)}}}legendItems(){return le(this._theme,()=>this._legendeneintraege())}_legendeneintraege(){return this._legendItems()}_palettenFarbe(e){let t=x.palette;return t.length>0?t[e%t.length]:x.stroke}_legendItems(){return this._series.map((e,t)=>{let n=e.style?.line,i=Array.isArray(n)?n:n?[n]:[],o=e.style?.markers,s=o?.type&&o.type!=="none"&&(o.threshold===void 0||(e.data?.length??0)<=o.threshold),l=V(e)?e.avgColor??x.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??l,line:i.length===1?i[0].style:void 0,width:i.length<=1?i[0]?.width??x.strokeWidth:void 0,marker:s?o.type:void 0,id:K(e.id??e.name),seriesId:e.id??e.name}})}get renderer(){return this._renderer}get layout(){return le(this._theme,()=>this._layoutMitLegende().layout)}get plotRect(){let{chartX:e,chartY:t,chartWidth:n,chartHeight:i}=this.layout;return {x:e,y:t,width:n,height:i}}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}warnings(){return [...xr(this._series.map(e=>e.id??e.name)),...this._ueberschwinger()]}_ueberschwinger(){let e=[],t=n=>this._series.find(i=>(i.id??i.name)===n||i.name===n);return this._series.forEach((n,i)=>{if(V(n))return;let o=n.style?.fill,s=o&&typeof o=="object"&&"regions"in o?o.regions:[],l=new Set;for(let h of s)if(h.where)for(let a of [h.from??"chartBottom",h.to??"series"]){let m=a==="series"?n:typeof a=="object"&&"series"in a?t(a.series):void 0;if(!m||V(m))continue;let{grundLinie:u,stepShape:c}=this._linienGrundlage(m),p=u?.smoothingType??"catmull-rom";c||!u?.smoothing||p==="monotone"||l.has(m.name)||(l.add(m.name),e.push(`series ${i}: fill where decides on the readings, but "${m.name}" is smoothed with ${p}, which can overshoot them -- the area may miss the line at its edges; smoothingType 'monotone' does not overshoot`));}}),e}pointsAt(e,t,n={}){return le(this._theme,()=>this._punkteAm(e,t,n))}_punkteAm(e,t,n={}){if(!this._timeScale)return [];let i=this._legendItems();return at(this._series,this._timeScale,(o,s)=>{let l=this._axisIndexOf(o),h=this._valueScales.get(l);if(!h)return;let a=V(o)?void 0:this._linienGrundlage(o);return {skala:h,achse:l,stufe:a?.stepShape??false,gapThreshold:a?.gapThreshold??0,farbe:i[s].color,linie:i[s].line,format:Sr(o)??Se(this._axes,l)?.format,overlays:this._overlayWerte.get(s)}},this.plotRect,e,t,{...n,radius:n.radius??x.tooltipSnapRadius})}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let n=this._valueScales.get(t);return n?n.invert(e):0}project(e,t,n=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(n);return {x:i,y:o?o.map(t):0}}};function xr(r){let e=new Map;return r.forEach((t,n)=>e.set(t,[...e.get(t)??[],n])),[...e].filter(([,t])=>t.length>1).map(([t,n])=>`series ${n.join(", ")} share the id "${t}" -- hidden and pointsAt cannot tell them apart; give each a unique id`)}function Sr(r){let e=r.enumMap;return e?t=>e[t]??String(t):void 0}var wr=.2,ce=4,oe=1e-6,vr=6;function Tr(r){return r?.map(e=>{let t=e.data;if(t.length<=4)return e;let n=(a,m)=>"avg"in a?m?a.max:a.min:a.value,i=new Set,o=0,s=0,l=-1,h=-1;t.forEach((a,m)=>{a.time<t[o].time&&(o=m),a.time>t[s].time&&(s=m);let u=n(a,false),c=n(a,true);u!==null&&(l<0||u<n(t[l],false))&&(l=m),c!==null&&(h<0||c>n(t[h],true))&&(h=m);});for(let a of [o,s,l,h])a>=0&&i.add(a);return {...e,data:t.filter((a,m)=>i.has(m))}})}function _r(r,e){if(!r.content)return null;let t=r.fontSize??11,n=e(r.content,t),i=r.anchor==="middle"?-n/2:r.anchor==="end"?-n:0,[o,s]=r.textBaseline==="middle"?[-t/2,t/2]:r.textBaseline==="top"?[0,t]:r.textBaseline==="bottom"?[-t,0]:[-0.8*t,wr*t],l=[[i,o],[i+n,o],[i,s],[i+n,s]],h=(r.rotate??0)*Math.PI/180,a=Math.cos(h),m=Math.sin(h),u=l.map(([p,d])=>r.x+p*a-d*m),c=l.map(([p,d])=>r.y+p*m+d*a);return {x0:Math.min(...u),y0:Math.min(...c),x1:Math.max(...u),y1:Math.max(...c)}}function de(r,e){return {x0:Math.min(...r),y0:Math.min(...e),x1:Math.max(...r),y1:Math.max(...e)}}function cn(r,e,t=[]){for(let n of r)switch(n.type){case "group":{let i=n.cssClass??"";if(n.clipRect||n.plotClipId||i.startsWith("chart-legend")||i.startsWith("annotation-band"))break;cn(n.commands,e,t);break}case "text":{let i=_r(n,e);i&&t.push(i);break}case "line":t.push(de([n.x1,n.x2],[n.y1,n.y2]));break;case "rect":t.push(de([n.x,n.x+n.w],[n.y,n.y+n.h]));break;case "circle":t.push(de([n.cx-n.r,n.cx+n.r],[n.cy-n.r,n.cy+n.r]));break;case "path":n.points.length>0&&t.push(de(n.points.map(i=>i.x),n.points.map(i=>i.y)));break;case "gap":t.push(de([n.x1,n.x2],[n.y1,n.y2]));break}return t}function Cr(r,e={}){return Ar(r,e)}function Ar(r,e,t){let n=e.padding||4,i=Math.max(e.minimum||8,ce),o=r.textMetrics??W,s=Tr(r.series),l=u=>{let c=new N({...r,series:s,margin:u}),p=c.renderCommands();return {kaesten:cn(p,o),plot:c.plotRect,breite:c.layout.totalWidth,hoehe:c.layout.totalHeight}},h=r.margin,a={top:Math.max(i,h?.top??20),right:Math.max(i,h?.right??20),bottom:Math.max(i,h?.bottom??40),left:Math.max(i,h?.left??60)},m;for(let u=0;u<vr;u++){let c=l(a),p=l({...a,left:a.left+ce,right:a.right-ce}),d=l({...a,top:a.top+ce,bottom:a.bottom-ce}),g=p.kaesten.length===c.kaesten.length&&d.kaesten.length===c.kaesten.length,f=T=>g&&Math.abs(p.kaesten[T].x0-c.kaesten[T].x0)<oe,b=T=>g&&Math.abs(d.kaesten[T].y0-c.kaesten[T].y0)<oe,{plot:y}=c,S=y.x+y.width,k=y.y+y.height,w={left:0,right:0,top:0,bottom:0},A={left:0,right:0,top:0,bottom:0};c.kaesten.forEach((T,$)=>{f($)?(T.x0<y.x-oe&&(A.left=Math.max(A.left,T.x1)),T.x1>S+oe&&(A.right=Math.max(A.right,c.breite-T.x0))):(w.left=Math.max(w.left,y.x-T.x0),w.right=Math.max(w.right,T.x1-S)),b($)?(T.y0<y.y-oe&&(A.top=Math.max(A.top,T.y1)),T.y1>k+oe&&(A.bottom=Math.max(A.bottom,c.hoehe-T.y0))):(w.top=Math.max(w.top,y.y-T.y0),w.bottom=Math.max(w.bottom,T.y1-k));});let D=T=>A[T]>0?A[T]+n+w[T]:w[T]>0?w[T]+n:0,C={top:0,right:0,bottom:0,left:0};for(let T of ["top","right","bottom","left"])C[T]=Math.max(i,Math.ceil(D(T)-1e-9));if(C.top===a.top&&C.right===a.right&&C.bottom===a.bottom&&C.left===a.left)return C;if(m&&C.top===m.top&&C.right===m.right&&C.bottom===m.bottom&&C.left===m.left)return {top:Math.max(C.top,a.top),right:Math.max(C.right,a.right),bottom:Math.max(C.bottom,a.bottom),left:Math.max(C.left,a.left)};m=a,a=C;}return a}function Mr(r){if(r.min!==void 0&&r.max!==void 0)return {unit:r.unit,min:r.min,max:r.max};let e=1/0,t=-1/0;for(let n of r.data??[])n.value===null||n.value===void 0||(n.value<e&&(e=n.value),n.value>t&&(t=n.value));return {unit:r.unit,min:e,max:t}}var dn=r=>Math.abs(r.max-r.min);function Lr(r,e){return r.max>=e.min&&e.max>=r.min?0:r.max<e.min?e.min-r.max:r.min-e.max}function Dr(r,e){if(r.unit!==e.unit)return false;let t=Math.max(Math.abs(r.min),Math.abs(r.max),Math.abs(e.min),Math.abs(e.max)),n=Math.max(dn(r),dn(e),t*.05);return Lr(r,e)<=n}function $r(r){let e=[],t=r.map(i=>{let o=Mr(i);if(!Number.isFinite(o.min)||!Number.isFinite(o.max)){let l=e.findIndex(h=>h.unit===o.unit);return l>=0?l:(e.push({unit:o.unit,min:0,max:0}),e.length-1)}let s=e.findIndex(l=>Dr(l,o));return s>=0?(e[s]={unit:e[s].unit,min:Math.min(e[s].min,o.min),max:Math.max(e[s].max,o.max)},s):(e.push({...o}),e.length-1)}),n=e.map((i,o)=>({position:o===0?"left":"right",...i.unit?{label:i.unit}:{}}));return {indices:t,axes:n}}function pn(r){let e=[];for(let t=0;t<r.length-1;t++){let n=r[t+1].x-r[t].x;e.push(n===0?0:(r[t+1].y-r[t].y)/n);}return e}function Pr(r){let e=pn(r),t=r.length,n=[...e];for(let i=1;i<t-1;i++)n[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;n[t-1]=e[t-2];for(let i=0;i<t-1;i++){if(e[i]===0){n[i]=0,n[i+1]=0;continue}let o=n[i]/e[i],s=n[i+1]/e[i],l=o*o+s*s;if(l>9){let h=3/Math.sqrt(l);n[i]=h*o*e[i],n[i+1]=h*s*e[i];}}return n}function Rr(r){let e=pn(r),t=r.length;if(e.length<2)return r.map(()=>e[0]??0);let n=e[0],i=e[1],o=e[e.length-1],s=e[e.length-2],l=2*n-i,h=2*o-s,a=[2*l-n,l,...e,h,2*h-o],m=[];for(let u=0;u<t;u++){let c=Math.abs(a[u+3]-a[u+2]),p=Math.abs(a[u+1]-a[u]);m.push(c+p===0?(a[u+1]+a[u+2])/2:(c*a[u+1]+p*a[u+2])/(c+p));}return m}function Br(r,e){let t=[];for(let n=0;n<r.length-1;n++){let i=r[n],o=r[n+1],s=(o.x-i.x)/3;t.push({p0:i,c1:{x:i.x+s,y:i.y+e[n]*s},c2:{x:o.x-s,y:o.y-e[n+1]*s},p1:o});}return t}function jr(r,e){if(r.length<2)return [];let t=e==="akima"?Rr(r):Pr(r);return Br(r,t)}function Fr(r){let e=[];for(let t=0;t<r.length-1;t++){let n=r[t-1]??r[t],i=r[t],o=r[t+1],s=r[t+2]??o,l=Math.min(i.x,o.x),h=Math.max(i.x,o.x),a=m=>m<l?l:m>h?h:m;e.push({p0:i,c1:{x:a(i.x+(o.x-n.x)/6),y:i.y+(o.y-n.y)/6},c2:{x:a(o.x-(s.x-i.x)/6),y:o.y-(s.y-i.y)/6},p1:o});}return e}function qe(r,e){return e&&e!=="catmull-rom"?jr(r,e):Fr(r)}var Je=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],Er={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:Je,rect:Je,path:Je},Gr={line:"stroke-opacity",text:"fill-opacity"},Ir=/ ([a-z-]+)="([^"]*)"/g;function Or(r){let e=/^<(line|text|circle|rect|path) /.exec(r)?.[1];if(!e||r.includes(`
25
- `))return null;let t=e==="text"?r.indexOf(">")+1:r.length,n=r.slice(0,t),i=/ opacity="([^"]*)"/.exec(n),o=Gr[e];i&&i[1]==="1"?n=n.replace(i[0],""):i&&o&&!n.includes(` ${o}="`)&&(n=n.replace(i[0],` ${o}="${i[1]}"`));let s=new Map;for(let[,l,h]of n.matchAll(Ir))s.set(l,h);return {art:e,kopf:n,rest:r.slice(t),attrs:s}}function fn(r){let e=[];for(let n of Er[r[0].art]){if(!r.every(l=>l.attrs.has(n)))continue;let i=new Map;for(let l of r){let h=l.attrs.get(n);i.set(h,(i.get(h)??0)+1);}let o="",s=0;for(let[l,h]of i)h>s&&([o,s]=[l,h]);e.push([n,o]);}let t=r.map(n=>{let i=n.kopf;for(let[o,s]of e)i=i.replace(` ${o}="${s}"`,"");return i+n.rest});return {attrs:e.map(([n,i])=>` ${n}="${i}"`).join(""),kinder:t}}function gn(r,e=" "){let t=[];for(let o of r){let s=Or(o);if(!s)return null;t.push(s);}if(t.length===0)return null;let n=new Set(t.map(o=>o.art));if(n.size===1){let o=fn(t);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
26
- `)}}if(n.size!==2||!n.has("line")||!n.has("text"))return null;let i=[];for(let o of ["line","text"]){let s=t.filter(h=>h.art===o);if(s.length===1){i.push(e+s[0].kopf+s[0].rest);continue}let l=fn(s);i.push(`${e}<g${l.attrs}>`);for(let h of l.kinder)i.push(e+e+h);i.push(`${e}</g>`);}return {attrs:"",inhalt:i.join(`
27
- `)}}var Qe="1.17.0";var Wr=` <!-- MLTimeGraph ${Qe} -->`,yn=1e3;function v(r){return String(Math.round(r*yn)/yn)}function et(r){return He(r).toString(16).padStart(8,"0")}function zr(r){switch(r){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var Q=class extends ke{#e="100%";#t="100%";#n;#r="";#i=new Map;#o=new Map;#s=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background),e?.idPrefix&&(this.#r=`${e.idPrefix}-`);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#o.clear(),this.#s.clear();let t=e.map(a=>this._toSVG(a));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let n=t.join(`
28
- `),i="",o=[];for(let[,a]of this.#i)o.push(a);for(let[,a]of this.#o)o.push(a);for(let[,a]of this.#s)o.push(a);o.length>0&&(i=` <defs>
24
+ `.trim()}function Ne(r,e=2,t=false){return r==="dashed"||!r&&t?{strokeDasharray:"4,4"}:r==="dotted"?{strokeDasharray:"2,4"}:!r||r==="solid"?null:ct(r,e)}function ct(r,e=2){let t=e;switch(r){case "dotted":return {strokeDasharray:`0, ${t*2}`,strokeLinecap:"round"};case "sparse-dots":return {strokeDasharray:`0, ${t*4}`,strokeLinecap:"round"};case "dashed":return {strokeDasharray:`${t*3}, ${t*2}`,strokeLinecap:"butt"};case "long-dash":return {strokeDasharray:`${t*6}, ${t*3}`,strokeLinecap:"butt"};case "dense-dash":return {strokeDasharray:`${t*1.5}, ${t*1.5}`,strokeLinecap:"butt"};case "dash-dot":return {strokeDasharray:`${t*4}, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "dash-dot-dot":return {strokeDasharray:`${t*5}, ${t*2}, 0, ${t*2}, 0, ${t*2}`,strokeLinecap:"round"};case "loose-dash":return {strokeDasharray:`${t*3}, ${t*4}`,strokeLinecap:"butt"};default:return {strokeDasharray:"none",strokeLinecap:"butt"}}}var x=new Proxy({},{get:(r,e)=>ae()[e],has:(r,e)=>e in ae(),ownKeys:()=>Reflect.ownKeys(ae()),getOwnPropertyDescriptor:(r,e)=>Reflect.getOwnPropertyDescriptor(ae(),e)});function ge(r,e){if(e<=0||r.length<2)return [];let t=[];for(let n=0;n<r.length-1;n++){let i=r[n],o=r[n+1];for(let s=1;s<=e;s++)t.push(i+(o-i)*s/(e+1));}return t}var me={axisColor:x.axisColor,tickColor:x.tickColor,textColor:x.textColor,textSize:x.textSize},ne=class{#e;#t;constructor(e){this.#e=new ee({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??me).axisColor}get tickColor(){return (this.#t.colors??me).tickColor}get textColor(){return (this.#t.colors??me).textColor}get textSize(){return (this.#t.colors??me).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,i=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(i)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((t+n)/2,t,n),o={};return i<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):i<36e5||i<864e5?(o.hour="2-digit",o.minute="2-digit"):i<31536e6?(o.day="numeric",o.month="short",i>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",i<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let i=1;i<e.length;i++){let o=n[n.length-1].x;Math.abs(e[i].x-o)>=t&&n.push(e[i]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??me,n=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let a of this.generateMinorTicks())i.push({type:"line",x1:a,y1:n,x2:a,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let a of e)i.push({type:"line",x1:a.x,y1:n,x2:a.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),i.push({type:"text",content:a.label,x:this.#n(a.x,a.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return i}generateMinorTicks(){return ge(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,n)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function V(r){return "showAs"in r&&!!r.showAs}function dt(r){if(V(r)){let e=[];for(let t of r.data)t.min!==null&&e.push(t.min),t.max!==null&&e.push(t.max);return e}return r.data.map(e=>e.value).filter(e=>e!==null)}function ye(r){return {axisColor:r?.color??x.axisColor,tickColor:r?.color??x.tickColor,textColor:x.textColor,textSize:x.textSize,axisWidth:r?.width??1}}function pt(r,e,t,n){if(n===void 0)return [r,e];let i=typeof n=="number"?n:n.top??0,o=typeof n=="number"?n:n.bottom??0;if(i<=0&&o<=0)return [r,e];let s=t-i-o,a=e-r;if(s<=0||a<=0)return [r,e];let m=a/s;return [r-o*m,e+i*m]}function be(r,e){return r!==void 0?r:e!==void 0&&e!==false?1:0}var Wn=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],Ke=.6,zn=(()=>{let r=new Map;for(let[e,,t]of Wn){let n=t.split(",");for(let i=0;i<n.length;i++)r.set(e+i,Number(n[i])/1e3);}return r})();function ft(r){return zn.get(r)??Ke}var W=(r,e)=>{let t=0;for(let n of r)t+=ft(n.codePointAt(0)??0);return t*e},Hn=(r,e)=>[...r].length*e*Ke;function gt(r,e,t){let n=0;for(let i of r)n=Math.max(n,t(i,e));return n}var re={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Ye(r,e){let t=n=>e===void 0||e>=n;return Math.abs(r)>=1e6&&t(1e5)?`${(r/1e6).toFixed(1)}M`:Math.abs(r)>=1e3&&t(100)?`${(r/1e3).toFixed(1)}k`:Number.isInteger(r)?String(r):r.toFixed(1)}function Vn(r){let e=new Array(r.length).fill(false),t=0;for(;t<r.length;){let n=t;for(;n+1<r.length&&r[n+1].label===r[t].label;)n++;for(let i=t+1;i<n;i++)e[i]=true;t=n+1;}return e}var xe=class{#e;#t;constructor(e){this.#e=new q({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??re).axisColor}get tickColor(){return (this.#t.colors??re).tickColor}get textColor(){return (this.#t.colors??re).textColor}get textSize(){return (this.#t.colors??re).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??Ye;return e.map(f=>({value:f,position:this.#e.map(f),label:g(f)}))}let t=this.#t.format??Ye,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[i,o]=this.#e.domain(),s=Math.min(i,o),a=Math.max(i,o),m=a-s;if(m===0)return [{value:i,position:this.#e.map(i),label:t(i)}];let l=m/n,u=Math.pow(10,Math.floor(Math.log10(l))),c=l/u,h;if(c<=1.5?h=u:c<=3?h=2*u:c<=7?h=5*u:h=10*u,h<=0||!Number.isFinite(h))return [{value:i,position:this.#e.map(i),label:t(i)}];this.#t.format||(t=g=>Ye(g,h));let p=[],d=Math.ceil(s/h)*h;for(let g=d;g<=a;g+=h)p.push({value:g,position:this.#e.map(g),label:t(g)});return p}generateMinorTicks(){return ge(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??re,n=this.#t.x??0,i=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,m=c=>s.some(h=>Math.abs(h-c)<=a),l=[];if(i==="vertical"){let[c,h]=this.#e.range();l.push({type:"line",x1:n,y1:c,x2:n,y2:h,stroke:t.axisColor,strokeWidth:t.axisWidth});let p=Vn(e);e.forEach((d,g)=>{let f=m(d.position),b=p[g]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||l.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(l.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||l.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[c,h]=this.#e.range();l.push({type:"line",x1:c,y1:n,x2:h,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let p of e)l.push({type:"line",x1:p.position,y1:n,x2:p.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:p.label,x:p.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let c of this.generateMinorTicks())l.push(u?{type:"line",x1:o==="right"?n:n-2,y1:c,x2:o==="right"?n+2:n,y2:c,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:c,y1:n,x2:c,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return l}#n(e,t,n){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,(this.#t.colors??re).textSize);return n==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function yt(r){let e=new Set,t={};for(let n of r){let i=n.enumMap;if(i)for(let[o,s]of Object.entries(i)){let a=Number(o);e.add(a),a in t||(t[a]=s);}}return {werte:e.size>0?[...e].sort((n,i)=>n-i):void 0,name:n=>t[n]??String(n)}}function bt(r){let{axes:e,indices:t,seriesByIndex:n,layout:i,thresholds:o,metrics:s}=r,{chartX:a,chartY:m,chartWidth:l,chartHeight:u}=i,c=[],h=new Map,p,d=[],g=[],f=(e?.y?.length??0)>0,b=0,y=0;for(let S of t){let w=n.get(S),k=1/0,A=-1/0,D=false;for(let L of w)for(let Z of dt(L))Z<k&&(k=Z),Z>A&&(A=Z),D=true;if(!D)continue;if(Se(e,S)?.includeThresholds)for(let L of o)(L.axisIndex??0)!==S||L.line==="none"||(k=Math.min(k,L.value),A=Math.max(A,L.value));k===A&&(k-=1,A+=1);let C=Se(e,S),v=C?.domain,$=v&&v!=="auto"?v:pt(k,A,u,C?.padding),{werte:R,name:j}=yt(w);if(R){let L=R.length>1?(R[R.length-1]-R[0])/(R.length-1):1;$[0]=R[0]-L/2,$[1]=R[R.length-1]+L/2;}let F=new q({domain:$,range:[m+u,m]});h.set(S,F);let B=C?.position??(S===0?"left":"right"),z=B==="right"?"outside-right":"outside-left",I=o.filter(L=>(L.axisIndex??0)===S&&typeof L.label=="object"&&L.label!==null&&L.label.position===z&&L.value>=Math.min($[0],$[1])&&L.value<=Math.max($[0],$[1])).map(L=>F.map(L.value)),G;if(B==="right"){let L=C?.offset??y*50;G=a+l+L,y++;}else {let L=C?.offset??b*50;G=a-L,b++;}let T=new xe({domain:$,range:[m+u,m],x:G,position:B,format:C?.format??(R?j:void 0),tickValues:R,ticks:C?.ticks?.major,minorTicks:be(C?.ticks?.minor,U(C?.grid)?.minor),colors:ye(C?.axis),suppressLabelsNear:I.length?I:void 0,gesamtbreite:i.totalWidth,metrics:s}),M=8+gt(T.generateTicks().map(L=>L.label),11,s),P=B==="right"?G+M:G-M;g.push({position:B,von:Math.min(G,P),bis:Math.max(G,P)}),f&&C?.label&&d.push({text:C.label,achseX:G,kante:P,position:B,style:C.labels}),S===0&&(p=T),c.push({type:"group",cssClass:`value-axis ${B}`,sharedStyles:true,commands:T.render()});}return {commands:c,titel:d,baender:g,neueForm:f,primary:p,scales:h}}function Se(r,e){let t=e===0?r?.left:e===1?r?.right:void 0,n=r?.y&&r.y.length>e?r.y[e]:void 0;return n&&t?{...t,...n}:n??t}var E=class{static interpolateDataPoint(r,e,t){return {time:r.time+Math.round(t*(e.time-r.time)),value:(r.value??0)+t*((e.value??0)-(r.value??0)),synthetic:true}}static interpolateAggregatedPoint(r,e,t){let n=(i,o)=>i!==null&&o!==null?i+t*(o-i):null;return {time:r.time+t*(e.time-r.time),min:n(r.min,e.min),max:n(r.max,e.max),avg:n(r.avg,e.avg),count:Math.round(r.count+t*(e.count-r.count))}}static getRuns(r,e,t=0){let n=[...r].sort((a,m)=>a.time-m.time),i=[],o=[],s=null;for(let a of n){let m=e(a),l=t>0&&s&&a.time-s.time>t;(m||l)&&o.length&&(i.push(o),o=[]),m||o.push(a),s=a;}return o.length&&i.push(o),i}static splitByBoundaries(r,e,t,n){if(r.length===0)return [];if(e.length===0)return [{data:r,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((l,u)=>l-u),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let u=0;for(let c=0;c<i.length&&l>=i[c];c++)u=c+1;return u},m=[r[0]];for(let l=1;l<r.length;l++){let u=r[l-1],c=r[l],h=t(u),p=t(c),d;p>h?d=i.filter(f=>f>h&&f<=p):p<h?d=i.filter(f=>f>=p&&f<h).reverse():d=[];let g=h;for(let f of d){let b=(f-h)/(p-h),y=n(u,c,b);m.push(y);let S=a((g+f)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[y],g=f;}(d.length===0||d[d.length-1]!==p)&&m.push(c);}if(m.length>1||r.length===1){let l=t(m[0]),u=t(m[m.length-1]),c=a((l+u)/2);o.push({data:m,zoneIndex:c,zoneLow:s(c)});}return o}static splitByThreshold(r,e,t,n){let i=this.splitByBoundaries(r,[e],t,n),o={above:[],below:[]};for(let s of i)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function xt(r,e=6e4){if(r.length<2)return [];let t=[...r].sort((i,o)=>i.time-o.time),n=[];for(let i=1;i<t.length;i++)t[i].time-t[i-1].time>e&&n.push({startTime:t[i-1].time,endTime:t[i].time});return n}function Nn(r,e=83144){let t=e/8.314,n=0,i=0;for(let s of r)s!==null&&(n+=Math.exp(-t/(s+273.15)),i++);if(i===0)return null;let o=n/i;return t/-Math.log(o)-273.15}function St(r,e,t=83144){let n=new Array(r.length),i=0;for(let o=0;o<r.length;o++){let s=r[o].time,a=s-e;for(;i<o&&r[i].time<a;)i++;let m=r.slice(i,o+1).map(u=>u.value),l=Nn(m,t);n[o]={time:s,value:l,synthetic:true};}return n}function Kn(r){let e=0,t=0;for(let o of r)o!==null&&(e+=o,t++);if(t===0)return null;let n=e/t,i=0;for(let o of r){if(o===null)continue;let s=o-n;i+=s*s;}return Math.sqrt(i/t)}function Yn(r){let e=0,t=0;for(let o of r)o!==null&&(e+=o,t++);if(t<2)return null;let n=e/t,i=0;for(let o of r){if(o===null)continue;let s=o-n;i+=s*s;}return Math.sqrt(i/(t-1))}function wt(r,e,t=false){let n=new Array(r.length),i=0,o=t?Yn:Kn;for(let s=0;s<r.length;s++){let a=r[s].time,m=a-e;for(;i<s&&r[i].time<m;)i++;let l=r.slice(i,s+1).map(c=>c.value),u=o(l);n[s]={time:a,value:u,synthetic:true};}return n}function Xe(r,e){let t=new Array(r.length),n=0;for(let i=0;i<r.length;i++){let o=r[i].time,s=o-e;for(;n<i&&r[n].time<s;)n++;let a=0,m=0;for(let l=n;l<=i;l++){let u=r[l].value;u!==null&&(a+=u,m++);}t[i]={time:o,value:m===0?null:a/m,synthetic:true};}return t}function kt(r,e){let t=new Array(r.length),n=null,i=0;for(let o=0;o<r.length;o++){let s=r[o].time,a=r[o].value;if(a===null){t[o]={time:s,value:n,synthetic:true};continue}if(n===null||e<=0)n=a;else {let m=1-Math.exp(-(s-i)/e);n=a*m+n*(1-m);}i=s,t[o]={time:s,value:n,synthetic:true};}return t}function Y(r){let e=[];for(let t of r)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}var we=class{};function vt(r,e,t,n){let i=ve(t);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<r.length;s++){let a=r[s],m=e.timeScale.map(a.time),l=e.valueScale.map(a.value),u=n(a),c=t.pointStroke??u,h=t.pointFill??u,p=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${s}`:void 0;ke(o,d,i.markers.type,m,l,i.markers.size,c,h,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ke(r,e,t,n,i,o,s,a,m){let l=u=>e===void 0?void 0:`${e}-${u}`;switch(t){case "circle":r.push({type:"circle",cx:n,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});break;case "square":r.push({type:"rect",x:n-o,y:i-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:m,id:e});break;case "cross":r.push({type:"line",x1:n-o,y1:i-o,x2:n+o,y2:i+o,stroke:s,strokeWidth:m,id:e},{type:"line",x1:n-o,y1:i+o,x2:n+o,y2:i-o,stroke:s,strokeWidth:m,id:l(2)});break;case "diamond":r.push({type:"path",points:[{x:n,y:i-o},{x:n+o,y:i},{x:n,y:i+o},{x:n-o,y:i}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "triangle":r.push({type:"path",points:[{x:n,y:i-o},{x:n+o,y:i+o},{x:n-o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "star":{let u=[];for(let c=0;c<10;c++){let h=c%2===0?o:o*.5,p=Math.PI/2*3+c*Math.PI/5;u.push({x:n+h*Math.cos(p),y:i+h*Math.sin(p)});}r.push({type:"path",points:u,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "arrow":r.push({type:"path",points:[{x:n-o,y:i+o},{x:n,y:i-o},{x:n+o,y:i+o}],stroke:s,strokeWidth:m,fill:"none",id:e});break;case "plus":r.push({type:"line",x1:n-o,y1:i,x2:n+o,y2:i,stroke:s,strokeWidth:m,id:e},{type:"line",x1:n,y1:i-o,x2:n,y2:i+o,stroke:s,strokeWidth:m,id:l(2)});break;case "triangle-down":r.push({type:"path",points:[{x:n,y:i+o},{x:n+o,y:i-o},{x:n-o,y:i-o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "hexagon":{let u=[];for(let c=0;c<6;c++){let h=c*(Math.PI/3);u.push({x:n+o*Math.cos(h),y:i+o*Math.sin(h)});}r.push({type:"path",points:u,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "hourglass":r.push({type:"path",points:[{x:n-o,y:i-o},{x:n+o,y:i-o},{x:n-o,y:i+o},{x:n+o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "line-horizontal":r.push({type:"line",x1:n-o,y1:i,x2:n+o,y2:i,stroke:s,strokeWidth:m,id:e});break;default:r.push({type:"circle",cx:n,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});}}var Te=class r{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new r;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var Xn="#ffffff",Zn="#cccccc",Un=6,qn=.85,X=12,Ce=8,ue=20,Jn=11,_e=18,Ze=(r,e)=>e(r,Jn);function Tt(r,e,t){let n=a=>X+Ce+Ze(a.name,e);if(t===void 0){let a=r.reduce((m,l)=>m+n(l)+_e,0)-_e;return [{items:r,breite:Math.max(0,a)}]}let i=[],o=[],s=0;for(let a of r){let m=n(a),l=o.length===0?m:s+_e+m;o.length>0&&l>t?(i.push({items:o,breite:s}),o=[a],s=m):(o=[...o,a],s=l);}return o.length>0&&i.push({items:o,breite:s}),i}function _t(r,e="vertical",t=W,n){if(e==="horizontal"){let o=Tt(r,t,n);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*ue}}let i=0;for(let o of r)i=Math.max(i,Ze(o.name,t));return {width:X+Ce+i,height:r.length*ue}}function Qn(r){let{items:e,x:t,y:n,orientation:i="vertical",metrics:o=W,maxBreite:s,box:a,itemClass:m}=r,l=new Te;if(a&&e.length>0){let h=_t(e,i,o,s),d=((i==="horizontal"?h.height/ue:e.length)-1)*ue+X,g=a.padding??Un,f=a.stroke??Zn;l.rect({x:t-g,y:n-g,w:h.width+2*g,h:d+2*g,fill:a.fill??Xn,...f==="none"?{}:{stroke:f,strokeWidth:a.strokeWidth??1},opacity:a.opacity??qn});}let u=i==="horizontal"?Tt(e,o,s):e.map(h=>({items:[h],breite:0})),c=new Map;return u.forEach((h,p)=>{let d=t;for(let g of h.items)c.set(g,{x:d,y:n+p*ue}),d+=X+Ce+Ze(g.name,o)+_e;}),e.forEach(h=>{let p=c.get(h)??{x:t,y:n},d=p.x,g=p.y,f=["legend-item"];h.id&&f.push(`legend-item--${h.id}`),m&&f.push(m),l.group({cssClass:f.join(" "),...h.id?{id:`legend-${h.id}`}:{}},b=>{b.rect({x:d,y:g,w:X,h:X,fill:h.color,stroke:x.legendStroke,strokeWidth:1}).text({content:h.name,x:d+X+Ce,y:g+X-2,fontSize:x.legendFont,fill:x.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function Ct(r){let{legend:e,items:t,gesamtbreite:n,metrics:i}=r,o=(e?.show??false)&&t.length>0,s=e?.position??"inside-right",a=e?.orientation??(s==="above"||s==="below"?"horizontal":"vertical"),m=s==="above"||s==="below"?n-16:void 0;return {items:t,show:o,position:s,orientation:a,maxBreite:m,size:o?_t(t,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function At(r,e){let t=r.position==="outside-right"||r.position==="outside-left"||r.position==="above"||r.position==="below";if(!r.show||!t)return null;let n={...e},i=2*r.boxRand;return r.position==="outside-right"?n.right+=r.size.width+i+16:r.position==="outside-left"?n.left+=r.size.width+i+16:r.position==="above"?n.top+=r.size.height+i+10:n.bottom+=r.size.height+i+10,n}function Mt(r){let{legende:e,layout:t,randBelegt:n,metrics:i}=r;if(!e.show||e.position==="separate")return [];let{chartX:o,chartY:s,chartWidth:a}=t,m,l;if(e.position==="inside-right")m=o+a-e.size.width-8-e.boxRand,l=s+8+e.boxRand;else if(e.position==="inside-left")m=o+8+e.boxRand,l=s+8+e.boxRand;else if(e.position==="outside-right"){let u=n.filter(c=>c.position==="right").reduce((c,h)=>Math.max(c,h.bis),o+a);m=Math.min(Math.max(o+a+16,u+12),t.totalWidth-e.size.width-2),l=s;}else e.position==="above"||e.position==="below"?(m=Math.max(8,Math.min(t.totalWidth-e.size.width-8,o+(a-e.size.width)/2)),l=e.position==="above"?Math.max(4,s-e.size.height-10):t.totalHeight-e.size.height-4):(m=8,l=s);return [Qn({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function Lt(r){let{xTicks:e,yTicks:t,xRange:n,yRange:i,stroke:o=x.gridStroke,strokeWidth:s=x.gridStrokeWidth,dashed:a=false,opacity:m=x.gridOpacity}=r,l=[];if(t)for(let u of t)l.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let u of e)l.push({type:"line",x1:u,y1:i[0],x2:u,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function Dt(r){let{axes:e,timeAxis:t,primaryValueAxis:n,xRange:i,yRange:o}=r,s=U(e?.x?.grid),a=U(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,u=a?.major,c=k=>k!==void 0&&k!==false;if(!c(l)&&!c(u))return {group:null,layer:m};let h=l!==false,p=u!==false&&!!n,d=h?t.generateTicks().map(k=>k.x):void 0,g=p?n.generateTicks().map(k=>k.position):void 0;if(!d&&!g)return {group:null,layer:m};let f=(l&&typeof l=="object"?l:void 0)??(u&&typeof u=="object"?u:void 0),b=s?.minor,y=a?.minor,S=(b&&typeof b=="object"?b:void 0)??(y&&typeof y=="object"?y:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...b!==void 0||y!==void 0?Lt({xTicks:b!==false&&h?t.generateMinorTicks():void 0,yTicks:y!==false&&p?n.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(x.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...Lt({xTicks:d,yTicks:g,xRange:i,yRange:o,stroke:f?.color,opacity:f?.opacity,dashed:f?.style==="dashed"})]},layer:m}}function $t(r){let e=[],t=n=>{n.type==="group"?n.commands.forEach(t):n.type==="line"&&n.y1===n.y2&&n.x1!==n.x2&&e.push(n.y1);};return r.forEach(t),e}function Pt(r,e){if(e.length===0||r.type!=="group")return r;let t=n=>n.type==="line"&&n.y1===n.y2&&n.x1!==n.x2&&e.some(i=>Math.abs(i-n.y1)<.5);return {...r,commands:r.commands.filter(n=>!t(n))}}function er(r){return r==="dotted"?{dash:"dotted"}:r==="dashed"?{dash:"dashed"}:{}}function tr(r){let{thresholds:e,valueScale:t,xRange:n}=r,[i,o]=n,[s,a]=t.range(),m=Math.min(s,a),l=Math.max(s,a),u=[],c=[];for(let h of e){let p=h.color??x.thresholdColor,d=t.map(h.value);h.fill==="above"?u.push({type:"rect",x:i,y:m,w:o-i,h:Math.max(0,d-m),fill:p,hatch:h.fillHatch,opacity:h.fillOpacity??.12,id:h.id?`${h.id}-fill`:void 0}):h.fill==="below"&&u.push({type:"rect",x:i,y:d,w:o-i,h:Math.max(0,l-d),fill:p,hatch:h.fillHatch,opacity:h.fillOpacity??.12,id:h.id?`${h.id}-fill`:void 0});let g=h.line??x.thresholdLine;if(g!=="none"){let S=er(g),w={type:"line",x1:i,y1:d,x2:o,y2:d,stroke:p,strokeWidth:1,...S,id:h.id?`${h.id}-line`:void 0};h.shadowColor&&(w.shadowColor=h.shadowColor,w.shadowBlur=h.shadowBlur??4,w.shadowOffsetX=h.shadowOffsetX??0,w.shadowOffsetY=h.shadowOffsetY??2),u.push(w);}let[f,b]=t.domain();if(h.value>=Math.min(f,b)&&h.value<=Math.max(f,b)&&h.label!==void 0&&h.label!==null&&h.label!==false){let S=typeof h.label=="object"?h.label:void 0,w=typeof h.label=="string"?h.label:S?.text??h.name,k=S?.position??"right",A=rr(w,k,i,o,d,p,S);c.push({...A,y:nr(A.y,Math.min(s,a),Math.max(s,a),x.thresholdFontSize),id:h.id?`${h.id}-label`:void 0});}}return {inside:u,labels:c}}function nr(r,e,t,n){return Math.max(e+n,Math.min(t-n/2,r))}function rr(r,e,t,n,i,o,s){let a=(t+n)/2,m={type:"text",content:r,fontSize:x.thresholdFontSize,fill:o},l=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...m,...l,x:t+4,y:i-4,anchor:"start"};case "above":return {...m,...l,x:a,y:i-6,anchor:"middle"};case "below":return {...m,...l,x:a,y:i+14,anchor:"middle"};case "center":return {...m,...l,x:a,y:i-4,anchor:"middle"};case "outside-left":return {...m,...l,x:t-6,y:i+3,anchor:"end",textBaseline:l.textBaseline??"middle"};case "outside-right":return {...m,...l,x:n+6,y:i+3,anchor:"start",textBaseline:l.textBaseline??"middle"};default:return {...m,...l,x:n-4,y:i-4,anchor:"end"}}}function Rt(r){let{thresholds:e,valueScales:t,primaryScale:n,xRange:i,layout:o}=r,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=[];if(e.length===0)return u;let c=[],h=[];for(let p of e){let d=p.id??K(p.name),g=t.get(p.axisIndex??0)??n,f=tr({thresholds:[p],valueScale:g,xRange:i});f.inside.length&&c.push({type:"group",cssClass:`threshold threshold--${d}`,id:`threshold-${d}`,commands:f.inside}),f.labels.length&&h.push({type:"group",cssClass:`threshold-label threshold-label--${d}`,commands:f.labels});}return c.length&&u.push({type:"group",cssClass:"thresholds",commands:c,clipRect:{x:s,y:a,w:m,h:l}}),h.length&&u.push({type:"group",cssClass:"threshold-labels",commands:h}),u}function Bt(r,e,t,n){switch(r){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Ae(r){let{ranges:e,timeScale:t,yRange:n,height:i,metrics:o=W}=r,[s,a]=n,m=[],[l,u]=t.range(),c=Math.min(l,u),h=Math.max(l,u),p=d=>Math.max(c,Math.min(h,d));for(let d of e){let g=p(t.map(d.startTime)),f=p(t.map(d.endTime));if(d.fill!==void 0&&m.push({type:"rect",x:g,y:s,w:f-g,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let b of [g,f])m.push({type:"line",x1:b,y1:s,x2:b,y2:a,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let b=d.labelPosition??"middle",y=d.rotate,S=true;if(y==="auto"){let w=b!=="above"&&b!=="below",k=o(d.label,d.fontSize??11);y=w&&k>Math.abs(f-g)-4?-90:void 0,S=y===void 0||k<=Math.abs(a-s)-4;}S&&m.push({type:"text",content:d.label,x:(g+f)/2,y:Bt(b,s,a,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:y});}}return m}function Ue(r){let{gaps:e,timeScale:t,yRange:n,height:i,fill:o=x.gapFill,hatch:s,fillOpacity:a=x.gapFillOpacity??.15,stroke:m=x.gapStroke,strokeWidth:l=x.gapStrokeWidth,dashed:u=true,fontSize:c=x.gapFontSize,fontFill:h=x.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:g,band:f}=r,b=()=>{if(!f)return [];let y=f.height??6,[S,w]=n,k=Math.max(S,w);return e.map(A=>{let D=t.map(A.startTime),C=t.map(A.endTime);return {type:"rect",x:Math.min(D,C),y:k-y+(f.offset??0),w:Math.abs(C-D),h:y,fill:f.fill??m,opacity:f.opacity??.75}})};return Ae({timeScale:t,yRange:n,height:i,metrics:g,ranges:e.map(y=>{let S=y.style??"dashed_border",w=S==="filled"||S==="dashed_border",k=S==="dashed_border"&&u!==false;return {startTime:y.startTime,endTime:y.endTime,...w&&{fill:y.fill??o,hatch:y.hatch??s,opacity:y.fillOpacity??a},...k&&{edges:{stroke:m,strokeWidth:l}},label:y.label,labelPosition:y.labelBaseline??p,labelColor:h,fontSize:c,rotate:y.rotate??d}})}).concat(b())}function Ft(r){let{gap:e,runs:t,timeScale:n,valueScale:i,metrics:o,lineColor:s}=r,a=[],m=e.bridge,l=[];for(let u=1;u<t.length;u++){let c=t[u-1][t[u-1].length-1],h=t[u][0];if(e.display==="bridge_line"){if(c.value===null||h.value===null)continue;a.push({type:"line",x1:n.map(c.time),y1:i.map(c.value),x2:n.map(h.time),y2:i.map(h.value),stroke:m?.color??s??x.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:c.time,endTime:h.time});}if(l.length>0){let u=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",c=e.fill,h=typeof c=="string"?c:c?.color,p=i.range();a.push(...Ue({gaps:l.map(d=>({...d,style:u})),timeScale:n,yRange:[Math.min(p[0],p[1]),Math.max(p[0],p[1])],fill:h,hatch:typeof c=="object"?c.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return a}function jt(r){let{markers:e,timeScale:t,valueScale:n,yRange:i=[0,300]}=r,[o,s]=i,a=[];for(let m of e){let l=t.map(m.time),u=m.color??x.markerColor,c=m.pointStyle??(m.value!==void 0?"circle":"none"),h=m.lineStyle??"full";if(m.value!==void 0){let p=n.map(m.value);if(h==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:p,stroke:u,strokeWidth:1,dashed:true}):h==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:p,stroke:u,strokeWidth:1,dashed:true}):h==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&ke(a,void 0,c,l,p,x.markerSize,u,u,1.5),m.label){let d=h==="to-value"?p-10:o-6;a.push({type:"text",content:m.label,x:l,y:d,anchor:"middle",fontSize:x.markerFontSize,fill:u});}}else h!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:x.markerFontSize,fill:u});}return a}function Et(r){let{highlights:e,timeScale:t,yRange:n,height:i}=r;return Ae({metrics:r.metrics,timeScale:t,yRange:n,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??x.highlightColor,opacity:o.opacity??x.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??x.highlightLabelColor,fontSize:x.annotationFontSize,rotate:o.rotate}))})}function qe(r,e,t){let n=(o,[s,a])=>o>=Math.min(s,a)&&o<=Math.max(s,a);if(!n(r.time,e.domain()))return false;if(r.value===void 0||!t)return true;let i=t.get(r.axis??0)??t.values().next().value;return !i||n(r.value,i.domain())}function Gt(r){let{annotations:e,timeScale:t,valueScales:n,plot:i}=r,o=[],s=m=>!i||qe(m,t,n),a=m=>{let l=n.get(m.axis??0)??n.values().next().value;return {x:t.map(m.time),y:l?l.map(m.value):0}};for(let m of e){let l=[],u=p=>l.push(p);if((m.type==="point"||m.type==="label")&&!s(m.at))continue;let c=i!==void 0&&(m.type==="line"||m.type==="arrow"||m.type==="rect")&&!(s(m.from)&&s(m.to)),h=c?{clipRect:i}:{};switch(m.type){case "line":{let p=a(m.from),d=a(m.to);u({type:"line",x1:p.x,y1:p.y,x2:d.x,y2:d.y,stroke:m.color??x.annotationColor,strokeWidth:m.width??x.annotationWidth,dash:m.dash});break}case "arrow":{let p=a(m.from),d=a(m.to),g=m.color??x.annotationColor,f=m.headSize??x.annotationHead;u({type:"line",x1:p.x,y1:p.y,x2:d.x,y2:d.y,stroke:g,strokeWidth:m.width??x.annotationWidth});let b=Math.hypot(d.x-p.x,d.y-p.y)||1,y=(d.x-p.x)/b,S=(d.y-p.y)/b,w=d.x-y*f,k=d.y-S*f;u({type:"path",points:[{x:d.x,y:d.y},{x:w-S*f*.5,y:k+y*f*.5},{x:w+S*f*.5,y:k-y*f*.5}],fill:g,stroke:"none"});break}case "rect":{let p=a(m.from),d=a(m.to);u({type:"rect",x:Math.min(p.x,d.x),y:Math.min(p.y,d.y),w:Math.abs(d.x-p.x),h:Math.abs(d.y-p.y),fill:m.fill??"none",hatch:m.hatch,stroke:m.stroke,opacity:m.opacity});break}case "point":{let p=a(m.at),d=m.color??"#334155",g=m.radius??x.annotationRadius,f=m.shape??"circle";f==="circle"?u({type:"circle",cx:p.x,cy:p.y,r:g,fill:d}):f==="square"?u({type:"rect",x:p.x-g,y:p.y-g,w:g*2,h:g*2,fill:d}):(u({type:"line",x1:p.x-g,y1:p.y-g,x2:p.x+g,y2:p.y+g,stroke:d,strokeWidth:1.5}),u({type:"line",x1:p.x-g,y1:p.y+g,x2:p.x+g,y2:p.y-g,stroke:d,strokeWidth:1.5}));break}case "label":{let p=a(m.at);u({type:"text",content:m.text,x:p.x+(m.dx??0),y:p.y+(m.dy??0),anchor:m.anchor??ir(p.x+(m.dx??0),m.text,r),fontSize:x.annotationFontSize,fill:m.color??x.annotationColor,rotate:m.rotate});break}}if(m.id&&l.length>0){let p=K(m.id);o.push({type:"group",cssClass:`annotation annotation--${p}`,...h,commands:l});}else c&&l.length>0?o.push({type:"group",cssClass:"annotation",...h,commands:l}):o.push(...l);}return o}function ir(r,e,t){let{metrics:n,timeScale:i}=t;if(!n)return "middle";let[o,s]=i.range(),a=n(e,x.annotationFontSize)/2;return r-a<o?"start":r+a>s?"end":"middle"}var ie=class r{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++r.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var Me=class extends ie{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??x.bandFill,n=e.hatch,i=e.avgLine??false,o=e.avgLineColor??x.bandAvgLine,s=e.bandWidth??10,a=[];for(let m of this.data){if(m.min===null||m.max===null)continue;let l=this.timeScale.map(m.time),u=e.valueScale.map(m.max),c=e.valueScale.map(m.min),h=s,p=this.data.indexOf(m);if(a.push({type:"rect",x:l-h/2,y:u,w:h,h:c-u,fill:t,hatch:n,opacity:this.opacity(m.count),id:this.id?`${this.id}-slot-${p}`:void 0}),i&&m.avg!==null){let d=e.valueScale.map(m.avg);a.push({type:"line",x1:l-h/2,y1:d,x2:l+h/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return a}};var or=1,Le=class{#e;constructor(e,t,n,i){this.#e={...e,xRange:t,y:n,height:i};}render(){let{items:e,timeScale:t,background:n,hatch:i,showAxis:o,xRange:s,y:a,height:m}=this.#e,l=[];n&&l.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h:m,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),h=t.map(u.endTime);if(h<s[0]||c>s[1])continue;let p=Math.max(s[0],Math.min(s[1],c)),d=Math.max(s[0],Math.min(s[1],h)),g=Math.max(d-p,or);p+g>s[1]&&(p=Math.max(s[0],s[1]-g));let f=p+g/2;if(l.push({type:"rect",x:p,y:a,w:g,h:m,hatch:u.hatch??i,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;l.push({type:"text",content:u.label,x:f,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new ne({domain:t.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return l}#t(e,t){let{y:n,height:i}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+i-t*.25;default:return n+i/2+t*.35}}};function ve(r){return {id:r.id,line:{stroke:r.stroke??x.stroke,strokeWidth:r.strokeWidth??x.strokeWidth,smoothing:r.smoothing??false,smoothingType:r.smoothingType,dashed:r.dashed??false},fill:r.fill??x.areaFillAlpha,markers:{type:r.pointStyle??"none",size:r.pointSize??x.pointSize,stroke:r.stroke??x.stroke,fill:"#ffffff"},shadow:{color:r.shadowColor??"transparent",blur:r.shadowBlur??0,offsetX:r.shadowOffsetX??0,offsetY:r.shadowOffsetY??0}}}function It(r,e,t){let n=[],i=ve(t);for(let o=0;o<r.length;o++){let s=r[o];s.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})),stroke:s.color??i.line.stroke,strokeWidth:i.line.strokeWidth,smoothing:i.line.smoothing,smoothingType:i.line.smoothingType,dashed:i.line.dashed,shadowColor:i.shadow.color,shadowBlur:i.shadow.blur,shadowOffsetX:i.shadow.offsetX,shadowOffsetY:i.shadow.offsetY,fill:"none"}):s.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(s.data[0].time),cy:e.valueScale.map(s.data[0].value),r:Math.max(i.markers.size,i.line.strokeWidth),fill:s.color??i.line.stroke,shadowColor:i.shadow.color,shadowBlur:i.shadow.blur});}return n}function Ot(r,e,t,n){if(r.length<2)return [];let i=E.splitByBoundaries(r,t.boundaries,t.getValue,t.interpolate),o=[];for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=t.getColor(a.zoneIndex);if(!m)continue;let l=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...l,...u],fill:m,hatch:t.getHatch?.(a.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:a.data.length,smoothTail:a.data.length}:{}});}return o}function Wt(r,e,t,n,i,o,s){return Ot(r,e,{boundaries:[],yLow:a=>a.avg,yHigh:t,getValue:a=>a.avg,interpolate:E.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>i},{id:o,...s})}var De=class extends ie{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??x.minColor,n=e.maxColor??x.maxColor,i=e.avgColor??x.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??x.strokeWidth,l=E.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(l.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},c=[];l.forEach((d,g)=>{if(d.length<2)return;let f=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Wt(d,u,y=>y.max,e.fillToMax,e.fillToMaxHatch,f("fillToMax"),{smoothing:s,smoothingType:a});c.push(...b);}if(e.fillToMin){let b=Wt(d,u,y=>y.min,e.fillToMin,e.fillToMinHatch,f("fillToMin"),{smoothing:s,smoothingType:a});c.push(...b);}});let h=l.filter(d=>d.length>=2),p=(d,g,f,b=false)=>It(h.map(y=>({data:y.map(S=>({time:S.time,value:d(S)}))})),u,{stroke:g,strokeWidth:m,smoothing:s,smoothingType:a,dashed:b,id:this.id?`${this.id}-${f}`:void 0});return c.push(...p(d=>d.max,n,"max"),...p(d=>d.min,t,"min"),...p(d=>d.avg,i,"avg",o)),c}};function zt(r,e,t){let n=r.style?.line&&!Array.isArray(r.style.line)?r.style.line:void 0,i=typeof r.style?.fill=="string"?r.style.fill:void 0;return r.showAs==="minmaxavg"?new De({data:r.data,timeScale:e,valueScale:t,minColor:r.minColor,maxColor:r.maxColor,avgColor:r.avgColor,avgDashed:r.avgDashed,fillToMax:r.fillToMax,fillToMaxHatch:r.fillToMaxHatch,fillToMin:r.fillToMin,fillToMinHatch:r.fillToMinHatch,smoothing:n?.smoothing,smoothingType:n?.smoothingType,strokeWidth:n?.width,id:H(r.name,r.id)}).render():new Me({data:r.data,timeScale:e,valueScale:t,fill:i??n?.color,avgLine:r.avgLine,countOpacity:r.countOpacity,id:H(r.name,r.id)}).render()}function Ht(r,e,t){let n=r??[];return {grenzen:n.map(o=>e.get(o)).filter(o=>!!o).map(o=>o.value).sort((o,s)=>o-s),farbe(o,s){let a=s??t,m=Number.NEGATIVE_INFINITY;for(let l of n){let u=e.get(l);!u||o<u.value||u.value<m||(m=u.value,a=u.color??a);}return a}}}function Vt(r){let{series:e,ctx:t,runs:n,totalPoints:i,style:o,styleLine:s,styleMarkers:a,stepShape:m,thresholds:l}=r,{timeScale:u,valueScale:c}=t,h=[],p=Ht(e.colorByThresholds,l,o.stroke),d=p.grenzen,g=new Map,f=[];for(let y of n){let k=function(C){return E.splitByBoundaries(C==="step"?Y(y):y,d,v=>v.value,E.interpolateDataPoint)};if(y.length<1)continue;let S=H(e.name,e.id),w=new Map,A=C=>{let v=w.get(C);return v||(v=k(C),w.set(C,v)),v},D=(C,v,$)=>{let R=A(C);for(let j of R){let F=j,B=g.get($)??0;if(g.set($,B+1),F.data.length<1)continue;let z=F.zoneLow;if(F.data.length===1){let I=p.farbe(z,v.color);h.push({type:"circle",id:S?`${S}-dot-${B}${$}`:void 0,cx:u.map(F.data[0].time),cy:c.map(F.data[0].value),r:Math.max(o.pointSize??x.pointSize,v.width??o.strokeWidth??x.strokeWidth),fill:I,shadowColor:o.shadowColor,shadowBlur:o.shadowBlur});continue}h.push({type:"path",cssClass:"series-line",id:S?`${S}-line-${B}${$}`:void 0,points:F.data.map(I=>({x:u.map(I.time),y:c.map(I.value)})),stroke:p.farbe(z,v.color),strokeWidth:v.width??o.strokeWidth,smoothing:C==="step"?false:v.smoothing??o.smoothing,smoothingType:v.smoothingType??o.smoothingType,dash:v.style,opacity:v.opacity,fill:"none",shadowColor:o.shadowColor,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY});}};s===false||(Array.isArray(s)?s.forEach((C,v)=>{D(C.shape??(e.seriesType==="step"?"step":"line"),C,`-${v}`);}):D(m?"step":"line",s??{},"")),f.push(...y);}return o.pointStyle&&o.pointStyle!=="none"&&i<=(a?.threshold??x.pointThreshold)&&h.push(...vt(f,t,o,y=>p.farbe(y.value))),h}var Nt={display:"dashed_border",fill:{color:"#94a3b8",hatch:"classic-diagonal"},opacity:.5,label:{rotate:"auto"}},Kt=6e4,sr=60*Kt,ar=24*sr;function lr(r){let e=Math.floor(r/Kt);if(e<60)return `${e} min`;if(r<ar){let i=Math.floor(e/60),o=e%60;return o===0?`${i} h`:`${i} h ${o} min`}let t=Math.floor(e/1440),n=Math.floor(e%1440/60);return n===0?`${t} d`:`${t} d ${n} h`}function mr(r,e,t){let n=r.format(e,{hour:"2-digit",minute:"2-digit"}),i=o=>r.format(o,{year:"numeric",month:"2-digit",day:"2-digit"});return i(e)===i(t)?n:`${r.format(e,{day:"numeric",month:"short"})} ${n}`}function ur(r,e,t){let n=null;for(let i of r)i.value===null||i.time<e||i.time>t||(n===null||i.time>n)&&(n=i.time);return n}function Yt(r){let{atEnd:e,series:t,timeScale:n}=r,[i,o]=n.domain(),s=e.now??o,a=new Set;for(let l of t){if(!("data"in l)||l.data.length===0||!("value"in l.data[0]))continue;let u="gaps"in l?l.gaps?.atEnd:void 0;if(u===false)continue;let c=u?.afterMs??e.afterMs,h=ur(l.data,i,s);h!==null&&s-h>c&&a.add(h);}let m={...Nt,...e.style,label:{...Nt.label,...e.style?.label}};return [...a].sort((l,u)=>l-u).map(l=>{let u=s-l,c=e.label,h=typeof c=="function"?c(l,u):c?.replaceAll("{since}",mr(n,l,s)).replaceAll("{duration}",lr(u));return {startTime:l,endTime:s,label:h,style:m}})}function Xt(r,e,t){let i=new Array(r.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));for(let s of ["left","right"]){let a=s==="left",m=r.map((l,u)=>({t:l,i:u})).filter(l=>l.t.position===s).sort((l,u)=>a?u.t.achseX-l.t.achseX:l.t.achseX-u.t.achseX);for(let{t:l,i:u}of m){let c=l.schrift/2,h=o.filter(g=>g.position===s),p=l.kante,d=a?p-1-c:p+1+c;for(let g=0;g<=h.length;g++){let f=d-c-1,b=d+c+1,y=h.find(S=>f<S.bis&&S.von<b);if(!y)break;p=a?y.von:y.bis,d=a?p-1-c:p+1+c;}if(a?d-c<2:d+c>t-2){let g=o.filter(f=>f.position===s&&f.titel);d=a?c+2:t-c-2;for(let f=0;f<=g.length;f++){let b=d-c-1,y=d+c+1,S=g.find(w=>b<w.bis&&w.von<y);if(!S)break;d=a?S.bis+1+c:S.von-1-c;}}o.push({position:s,von:d-c-1,bis:d+c+1,titel:true}),i[u]=d;}}return {xs:i,belegt:o}}function Zt(r){let{axes:e,neueForm:t,achsenTitel:n,titelSpuren:i,layout:o}=r,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=t?void 0:e?.left?.label,c=t?void 0:e?.right?.label,h=e?.x?.label;if(!u&&!c&&!h&&n.length===0)return [];let p=[],d=a+l/2,g=e?.left?.labels,f=e?.right?.labels,b=e?.x?.labels;return u&&p.push({type:"text",content:u,x:14,y:d,anchor:"middle",fontSize:g?.fontSize??x.axisLabelSize,fill:g?.color??x.axisLabelColor,rotate:-90}),c&&p.push({type:"text",content:c,x:o.totalWidth-14,y:d,anchor:"middle",fontSize:f?.fontSize??x.axisLabelSize,fill:f?.color??x.axisLabelColor,rotate:90}),n.forEach((y,S)=>{p.push({type:"text",content:y.text,x:i[S],y:d,anchor:"middle",fontSize:y.style?.fontSize??x.axisLabelSize,fill:y.style?.color??x.axisLabelColor,rotate:y.position==="right"?90:-90});}),h&&p.push({type:"text",content:h,x:s+m/2,y:o.totalHeight-6-(r.untenBelegt??0),anchor:"middle",fontSize:b?.fontSize??x.axisLabelSize,fill:b?.color??x.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}function qt(r,e){for(let t of r){if(t.length===0||e<t[0].time||e>t[t.length-1].time)continue;let n=0;for(;n<t.length-1&&t[n+1].time<=e;)n++;return {lauf:t,i:n}}return null}function $e(r,e,t){if(r.art==="fest")return r.wert;let n=qt(r.laeufe,e);if(!n)return null;let{lauf:i,i:o}=n,s=i[o];if(r.stufe)return t&&s.time===e&&o>0?i[o-1].value:s.value;if(s.time===e||o===i.length-1)return s.value;let a=i[o+1];return s.value+(a.value-s.value)*(e-s.time)/(a.time-s.time)}function Ut(r,e,t){if(r.art==="fest")return true;let n=qt(r.laeufe,e);return n?t===void 0||e-n.lauf[n.i].time<=t:false}function Jt(r,e,t){let n=t.exceeds,i=t.side??"both",o=new Set;for(let l of [r,e])if(l.art==="laeufe")for(let u of l.laeufe)for(let c of u)o.add(c.time),t.maxAgeMs!==void 0&&o.add(c.time+t.maxAgeMs);let s=[...o].sort((l,u)=>l-u),a=[];for(let l=0;l+1<s.length;l++){let[u,c]=[s[l],s[l+1]],h=(u+c)/2;if(!Ut(r,h,t.maxAgeMs)||!Ut(e,h,t.maxAgeMs))continue;let p=$e(e,u,false)-$e(r,u,false),d=$e(e,c,true)-$e(r,c,true),g=(f,b)=>{if(f<=0&&b<=0)return null;if(f>0&&b>0)return [u,c];let y=u+(0-f)/(b-f)*(c-u);return f>0?[u,y]:[y,c]};if(i!=="below"){let f=g(p-n,d-n);f&&f[1]>f[0]&&a.push(f);}if(i!=="above"){let f=g(-p-n,-d-n);f&&f[1]>f[0]&&a.push(f);}}a.sort((l,u)=>l[0]-u[0]);let m=[];for(let l of a){let u=m[m.length-1];u&&l[0]<=u[1]?u[1]=Math.max(u[1],l[1]):m.push([l[0],l[1]]);}return m}function Qt(r,e,t,n,i,o){let s=0,a=m=>m.type==="group"?{...m,commands:m.commands.map(a)}:"id"in m&&m.id!==void 0?{...m,...o(s++)}:m;return e.map(([m,l])=>{let u=t.map(m);return {type:"group",clipRect:{x:u,y:n,w:t.map(l)-u,h:i-n},commands:r.map(a)}})}function J(r){return r!==void 0&&typeof r=="object"&&"series"in r?r.series:null}function en(r){let e=[...r].sort((n,i)=>n.time-i.time),t=0;return n=>{for(;t>0&&e[t].time>n;)t--;for(;t<e.length-1&&e[t+1].time<=n;)t++;let i=e[t];if(!i||n<i.time)return null;if(i.time===n)return i.value??null;let o=e[t+1];if(!o||n>o.time||i.value===null||o.value===null)return null;let s=o.time-i.time;return s===0?i.value:i.value+(o.value-i.value)*(n-i.time)/s}}function tn(r){let e=[...r].sort((n,i)=>n.time-i.time),t=new Map;for(let n=1;n<e.length;n++){let[i,o]=[e[n-1],e[n]];i.time===o.time&&i.value!==null&&!t.has(i.time)&&t.set(i.time,i.value);}return t}function nn(r,e,t){let n=r??e;if(n==="series")return null;if(n==="chartTop")return t.chartTop;if(n==="chartBottom")return t.chartBottom;if(typeof n=="object"&&"threshold"in n){let i=t.thresholds.get(n.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${n.threshold}'`);return t.valueScale.map(i.value)}return typeof n=="object"&&"value"in n?t.valueScale.map(n.value):null}function hr(r){return typeof r=="string"?{color:r}:{color:r.color,hatch:r.hatch}}function rn(r,e){let t=J(r);if(t!==null){let i=e.fremdeSerie?.(t);return i?{art:"laeufe",laeufe:E.getRuns(i.data,o=>o.value===null,i.gapThreshold),stufe:i.shape==="step"}:null}if(r==="series")return {art:"laeufe",laeufe:e.runs,stufe:e.shape==="step"};let n=e.valueScale.domain();return {art:"fest",wert:he(r,e)??(r==="chartBottom"?n[0]:n[1])}}function on(r,e,t){let n=cr(r,e,t);if(!r.where||n.length===0)return n;let i=rn(r.from??"chartBottom",e),o=rn(r.to??"series",e);return !i||!o?n:Qt(n,Jt(i,o,r.where),e.timeScale,e.chartTop,e.chartBottom,s=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${s}`}:{})}function cr(r,e,t){let n=nn(r.from,"chartBottom",e),i=nn(r.to,"series",e),{color:o,hatch:s}=hr(r.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:u=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${u}`}:{}};return J(r.from)!==null||J(r.to)!==null?pr(r,e,l):n!==null&&i!==null?fr(n,i,e,l):gr(r,e,n,i,l)}function dr(r,e,t){let n=e.shape==="step",i=(h,p)=>{let d=h??p,g=J(d);if(g!==null){let y=e.fremdeSerie(g);if(!y)return null;let S=y.shape==="step",w=E.getRuns(y.data,k=>k.value===null,y.gapThreshold).map(k=>S?Y(k):k);return {art:"fremd",skala:y.valueScale??e.valueScale,laeufe:w,glatt:!S&&!!y.smoothing,verfahren:y.smoothingType}}if(d==="series")return {art:"eigene",glatt:!n&&!!e.smoothing,verfahren:e.smoothingType};let f=he(d,e),b=e.valueScale.domain();return {art:"fest",wert:f??(d==="chartBottom"?b[0]:b[1]),glatt:false}},o=i(r.from,"chartBottom"),s=i(r.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=h=>h.art==="fremd"?h.skala:e.valueScale,m=h=>p=>({x:e.timeScale.map(p.time),y:h.map(p.value)}),l=(h,p)=>h.art==="eigene"?[p]:h.art==="fremd"?h.laeufe.filter(d=>d.length>=2):[null],u=(h,p,d,g)=>p?p.map(m(a(h))):[d,g].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(h.wert)})),c=[];for(let h of e.runs){if(h.length<2)continue;let p=n?Y(h):h;for(let d of l(o,p))for(let g of l(s,p)){let f=Math.max(p[0].time,d?.[0].time??-1/0,g?.[0].time??-1/0),b=Math.min(p.at(-1).time,d?.at(-1).time??1/0,g?.at(-1).time??1/0);if(!(b>f))continue;let y={k:o,pts:u(o,d,f,b)},S={k:s,pts:u(s,g,f,b)};y.k.glatt||([y,S]=[S,y]);let w=A=>(A.art==="fest"?void 0:A.verfahren)??"catmull-rom",k=e.timeScale.map(f);c.push({type:"group",clipRect:{x:k,y:e.chartTop,w:e.timeScale.map(b)-k,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(c.length),points:[...y.pts,...[...S.pts].reverse()],smoothing:true,smoothingType:w(y.k),smoothCount:y.pts.length,...S.k.glatt?{smoothTail:S.pts.length,smoothTailType:w(S.k)}:{}}]});}}return c}function pr(r,e,t){if(!e.fremdeSerie){let a=J(r.from)??J(r.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let n=dr(r,e,t);if(n)return n;let i=(a,m,l)=>{let u=a??m,c=J(u);if(c!==null){let g=e.fremdeSerie(c);if(!g)throw new Error(`fillSpec region references unknown series '${c}'`);let f=g.shape==="step"?Y(g.data):g.data;return {bei:en(f),davor:tn(f),zeiten:f.map(b=>b.time),skala:g.valueScale??e.valueScale}}if(u==="series")return {bei:en(l),davor:tn(l),zeiten:l.map(g=>g.time),skala:e.valueScale};let h=he(u,e),p=e.valueScale.domain(),d=h??(u==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[],skala:e.valueScale}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?Y(a):a,l=i(r.from,"chartBottom",m),u=i(r.to,"series",m),c=m[0].time,h=m[m.length-1].time,p=[...new Set([...l.zeiten,...u.zeiten,...m.map(b=>b.time)])].filter(b=>b>=c&&b<=h).sort((b,y)=>b-y),d=[],g=[],f=()=>{if(d.length>=2){let b=[...g].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...b]});}d=[],g=[];};for(let b of p){let y=l.bei(b),S=u.bei(b);if(y===null||S===null){f();continue}let w=e.timeScale.map(b),k=l.davor?.get(b)??y,A=u.davor?.get(b)??S;(k!==y||A!==S)&&(d.push({x:w,y:u.skala.map(A)}),g.push({x:w,y:l.skala.map(k)})),d.push({x:w,y:u.skala.map(S)}),g.push({x:w,y:l.skala.map(y)});}f();}return s}function fr(r,e,t,n){let i=t.timeScale.range(),o=i[0],s=i[1],a=Math.min(r,e),m=Math.max(r,e);return [{...n.attrs,...n.teilId(0),points:[{x:o,y:a},{x:s,y:a},{x:s,y:m},{x:o,y:m}]}]}function gr(r,e,t,n,i){let o=t??n,s=[],a=yr(r,e);if(a===null){let u=e.valueScale.domain();a=(t??n)===e.chartBottom?u[0]:u[1];}let m=he(r.outer,e),l=e.shape==="step";for(let u of e.runs){if(u.length<2)continue;let c=l?Y(u):u,h=E.splitByThreshold(c,a,d=>d.value??a,E.interpolateDataPoint),p=r.side==="above"?h.above:r.side==="below"?h.below:[...h.above,...h.below];if(m!==null&&r.side){let d=m,g=r.side==="above"?f=>Math.min(f,d):f=>Math.max(f,d);p=p.map(f=>f.map(b=>({...b,value:g(b.value??d)})));}for(let d of p){if(d.length<2)continue;let g=d.map(b=>({x:e.timeScale.map(b.time),y:e.valueScale.map(b.value)})),f=[];for(let b of [...g].reverse()){let y=f[f.length-1];l&&y&&y.x===b.x||f.push({x:b.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:g.length,points:[...g,...f]});}}return s}function yr(r,e){let t=r.from==="series"?r.to:r.from;return he(t,e)}function he(r,e){return r===void 0||r==="series"||r==="chartTop"||r==="chartBottom"?null:typeof r=="object"&&"threshold"in r?e.thresholds.get(r.threshold)?.value??null:typeof r=="object"&&"value"in r?r.value:null}function sn(r,e){if(typeof r=="string"||!("regions"in r))return on({fill:r},e,0);let t=[];return r.regions.forEach((n,i)=>{t.push(...on(n,e,i));}),t}function ln(r){let e=r.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??x.stroke,width:t?.width??x.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function an(r,e,t,n,i){let o=r.filter(l=>l.value!==null);if(o.length<2)return [];let s=ln(t);e.merke?.({index:i,kind:t.kind,punkte:o.map(l=>({time:l.time,value:l.value})),farbe:s.color,...s.dash?{linie:s.dash}:{}});let a=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)}));return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${n}`:`overlay-${i}-${n}`,points:a,stroke:s.color,strokeWidth:s.width,smoothing:s.smoothing,smoothingType:s.smoothingType,dash:s.dash,fill:"none"}]}function mn(r,e,t=0){switch(r.kind){case "movingAverage":{let n=r.type==="exponential"?kt(e.data,r.window):Xe(e.data,r.window);return an(n,e,r,"movingAvg",t)}case "movingMkt":{let n=St(e.data,r.window,r.activationEnergy);return an(n,e,r,"movingMkt",t)}case "limits":{let n=[],i=e.timeScale.range(),o=i[0],s=i[1],a=ln(r),m=a.color,l=a.width,u=a.dash??"dashed",c=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return r.high!==void 0&&n.push({type:"line",id:`${c}limit-high`,x1:o,y1:e.valueScale.map(r.high),x2:s,y2:e.valueScale.map(r.high),stroke:m,strokeWidth:l,dash:u}),r.low!==void 0&&n.push({type:"line",id:`${c}limit-low`,x1:o,y1:e.valueScale.map(r.low),x2:s,y2:e.valueScale.map(r.low),stroke:m,strokeWidth:l,dash:u}),n}case "stdDevBand":{let n=r.multiplier??1,i=Xe(e.data,r.window),o=wt(e.data,r.window),s=[],a=[],m=[];for(let b=0;b<i.length;b++){let y=i[b].value,S=o[b].value;if(y===null||S===null)continue;let w=e.timeScale.map(i[b].time);s.push({x:w,y:e.valueScale.map(y+n*S)}),a.push({x:w,y:e.valueScale.map(y-n*S)}),m.push({time:i[b].time,value:y,low:y-n*S,high:y+n*S});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,u=[],h=(typeof r.style?.fill=="string"||r.style?.fill&&!("regions"in r.style.fill)?r.style.fill:void 0)??"#94a3b833",{color:p,hatch:d}=br(h);u.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:p,hatch:d,stroke:"none"});let g=r.style?.line,f=g&&!Array.isArray(g)?g:void 0;if(e.merke?.({index:t,kind:"stdDevBand",punkte:m,farbe:f?f.color??x.stroke:p,...f?.style?{linie:f.style}:{}}),f){let b=i.filter(y=>y.value!==null).map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)}));b.length>=2&&u.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:b,stroke:f.color??x.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return u}}}function br(r){return typeof r=="string"?{color:r}:{color:r.color,hatch:r.hatch}}function un(r,e){let t={...e,...r.style},n=t.fill,i,o;return typeof n=="string"?i=n:n&&(i=n.color,o=n.hatch),{startTime:r.startTime,endTime:r.endTime,label:r.label,fill:i,hatch:o,fillOpacity:t.opacity,labelBaseline:t.label?.baseline,rotate:t.label?.rotate,style:t.display==="bridge_line"?void 0:t.display}}function xr(r){if(!r)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(r))return {gaps:r,autoDetect:false,minGapMs:6e4};let e=r.style;return {gaps:(r.regions??[]).map(n=>un(n,e)),autoDetect:r.autoDetect??false,minGapMs:r.minGapMs??6e4,band:e?.band,atEnd:r.atEnd}}function hn(r,e){if(e)for(let t of r)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&hn(t.commands,e);}function cn(r,e){if(e)for(let t of r)"id"in t&&t.id&&(t.id=`${e}-${t.id}`),t.type==="group"&&Array.isArray(t.commands)&&cn(t.commands,e);}var N=class{_layout;_idPraefix;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_theme;_overlayWerte=new Map;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_gapsAtEnd;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;readonly_annotationBandHeight=0;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new se({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._idPraefix=e.idPrefix,this._legend=e.legend,this._textMetrics=e.textMetrics??W,this._theme=e.theme,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=xr(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,this._gapsAtEnd=t.atEnd,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let n=t.height??12,i=t.spacing??0;(t.showAxis??false)&&(e+=26+i),e+=n+i;}return e}setData(e){this._series=e.filter(t=>Array.isArray(t.data));}addAnnotation(e){let t=e.id??`anno-${++this._annotationSeq}`;return this._annotations.push({...e,id:t}),t}removeAnnotation(e){let t=this._annotations.length;return this._annotations=this._annotations.filter(n=>n.id!==e),this._disabledAnnotations.delete(e),this._annotations.length<t}setAnnotations(e){this._annotations=[...e],this._disabledAnnotations.clear();}clearAnnotations(){this._annotations=[],this._disabledAnnotations.clear();}getAnnotations(){return this._annotations}disableAnnotation(e){this._disabledAnnotations.add(e);}enableAnnotation(e){this._disabledAnnotations.delete(e);}_axisIndexOf(e){return e.yAxisIndex??0}_timesOf(e){return e.data.map(t=>t.time)}_layoutMitLegende(){let e=Ct({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,n=At(e,this._layout.margin);return n&&(t=new se({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:n}).compute()),{layout:t,legende:e}}renderCommands(){return le(this._theme,()=>this._zeichne())}_zeichne(){if(this._overlayWerte.clear(),this._series.length===0)return [];let{layout:e,legende:t}=this._layoutMitLegende(),{chartX:n,chartY:i,chartWidth:o,chartHeight:s}=e,a=[n,n+o],m=[i,i+s],l=[];for(let T of this._series)T.data.sort((M,P)=>M.time-P.time);let u=new Map,c=1/0,h=-1/0,p=false;for(let T of this._series){let M=this._axisIndexOf(T),P=u.get(M);P?P.push(T):u.set(M,[T]);for(let L of this._timesOf(T))L<c&&(c=L),L>h&&(h=L),p=true;}if(!p)return [];let d=this._axes?.x?.domain,g=d&&d!=="auto"?d:[c,h];this._timeScale=new ee({domain:g,range:a,locale:this._locale,timeZone:this._timeZone});let f=new ne({domain:g,xRange:a,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:be(this._axes?.x?.ticks?.minor,U(this._axes?.x?.grid)?.minor),colors:ye(this._axes?.x?.axis),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let b=Array.from(u.keys()).sort((T,M)=>T-M),y=bt({axes:this._axes,indices:b,seriesByIndex:u,layout:e,thresholds:this._thresholds,metrics:this._textMetrics});l.push(...y.commands);let{titel:S,baender:w,neueForm:k}=y,A=y.primary;for(let[T,M]of y.scales)this._valueScales.set(T,M);let D=this._valueScales.get(0)??this._valueScales.get(b[0]);l.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:f.render()});let C=Dt({axes:this._axes,timeAxis:f,primaryValueAxis:A,xRange:a,yRange:m}),v=C.group;v&&C.layer==="back"&&(l.push(v),v=null),this._highlights.length>0&&l.push({type:"group",cssClass:"highlights",commands:Et({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:m,height:e.totalHeight})});let $=D?Rt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:D,xRange:a,layout:e}):[];l.push(...$);let R=this._gapsAtEnd?Yt({atEnd:this._gapsAtEnd,series:this._series,timeScale:this._timeScale}).map(T=>un(T,void 0)):[],j=[...this._gaps,...R];if(this._gapsAutoDetect){let T=[];for(let M of this._series){if(V(M))continue;let P=M.data.filter(L=>L.value!==null);T.push(...xt(P,this._gapsMinGapMs));}T.length>0&&(j=[...j,...T]);}j.length>0&&l.push({type:"group",cssClass:"gaps",commands:Ue({gaps:j,timeScale:this._timeScale,yRange:m,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let F=new Map(this._thresholds.map(T=>[T.id??T.name,T]));for(let[T,M]of this._series.entries()){if(M.data.length===0)continue;let P=this._valueScales.get(this._axisIndexOf(M));if(!P)continue;let L=K(M.id??M.name);l.push({type:"group",cssClass:`series series--${L}`,id:`series-${L}`,commands:this._renderSeries(M,P,F,T),...this._clipSeries?{clipRect:{x:n,y:i,w:o,h:s}}:{}});}v&&l.push(Pt(v,$t($)));let B=this._markers.filter(T=>qe({time:T.time},this._timeScale)).map(T=>({...T}));for(let T of B)if(T.value===void 0&&(T.lineStyle==="to-value"||T.lineStyle==="to-top")){let M=this._series[T.seriesIndex??0];M&&!V(M)&&M.data.length>=2&&(T.value=this._interpolateValue(T.time,M.data));}if(B.length>0&&D){let T=[];for(let M of B){let P=D,L=this._series[M.seriesIndex??0];L&&(P=this._valueScales.get(this._axisIndexOf(L))??D),T.push(...jt({markers:[M],timeScale:this._timeScale,valueScale:P,yRange:m}));}l.push({type:"group",cssClass:"markers",commands:T});}let z=this._annotations.filter(T=>!T.id||!this._disabledAnnotations.has(T.id));if(z.length>0&&l.push({type:"group",cssClass:"annotations",commands:Gt({annotations:z,timeScale:this._timeScale,valueScales:this._valueScales,metrics:this._textMetrics,plot:{x:n,y:i,w:o,h:s}})}),this._annotationBands.length>0){let T=i+s+this._layout.margin.bottom,M=0;this._annotationBands.forEach(P=>{let L=P.height??12,Z=P.spacing??0,An=T+M;(P.showAxis??false)&&(M+=26+Z),M+=L+Z,l.push({type:"group",cssClass:"annotation-band",commands:new Le({name:P.name,showAxis:P.showAxis??false,items:P.items,timeScale:this._timeScale,background:P.background,hatch:P.hatch},[n,n+o],An,L).render()});});}let{xs:I,belegt:G}=Xt(S.map(T=>({achseX:T.achseX,kante:T.kante,position:T.position,schrift:T.style?.fontSize??x.axisLabelSize})),w,e.totalWidth);return l.push(...Mt({legende:t,layout:e,randBelegt:G,metrics:this._textMetrics})),l.push(...Zt({axes:this._axes,neueForm:k,achsenTitel:S,titelSpuren:I,layout:e,untenBelegt:e.margin.bottom-this._layout.margin.bottom})),hn(l,this._fontFamily??x.fontFamily),cn(l,this._idPraefix),l}_linienGrundlage(e){let t=e.style?.line,n=t&&!Array.isArray(t)?t:void 0,i=this._gapsAutoDetect?this._gapsMinGapMs:void 0,o=Array.isArray(t)?t[0]:n,s=(o?.shape??e.seriesType)==="step",a=o||void 0,m=a?.gapThreshold??i??x.gapThreshold;return {styleLine:t,lineDefaults:n,gapThreshold:m,grundLinie:a,stepShape:s}}_renderSeries(e,t,n,i=0){let o=this._timeScale,s={timeScale:o,valueScale:t};if(V(e))return zt(e,o,t);let{lineDefaults:a,gapThreshold:m}=this._linienGrundlage(e),l=E.getRuns(e.data,w=>w.value===null,m),u=l.reduce((w,k)=>w+k.length,0);if(u===0)return [];let c=[],h=e.style?.markers,p=e.style?.shadow,d={stroke:a?.color??this._palettenFarbe(i),strokeWidth:a?.width??x.strokeWidth,smoothing:a?.smoothing,smoothingType:a?.smoothingType,dashed:a?.style==="dashed",pointStyle:h?.type,pointSize:h?.size,pointStroke:h?.stroke,pointFill:h?.fill,pointStrokeWidth:h?.strokeWidth,shadowColor:p?.color,shadowBlur:p?.blur,shadowOffsetX:p?.offsetX,shadowOffsetY:p?.offsetY,id:H(e.name,e.id)},{styleLine:g,grundLinie:f,stepShape:b}=this._linienGrundlage(e),y=e.style?.fill;if(y!==void 0){let w=t.range(),k=Math.min(w[0],w[1]),A=Math.max(w[0],w[1]);c.push(...sn(y,{runs:l,timeScale:o,valueScale:t,thresholds:n,chartTop:k,chartBottom:A,smoothing:f?.smoothing,smoothingType:f?.smoothingType,shape:b?"step":"line",fremdeSerie:D=>{let C=this._series.find(j=>(j.id??j.name)===D||j.name===D);if(!C||!("data"in C))return;let v=C.data;if(v.length===0||!("value"in v[0]))return;let $=this._linienGrundlage(C),R=$.grundLinie;return {data:v,shape:$.stepShape?"step":"line",smoothing:R?.smoothing,smoothingType:R?.smoothingType,gapThreshold:$.gapThreshold,valueScale:this._valueScales.get(this._axisIndexOf(C))}},idPrefix:H(e.name,e.id)}));}c.push(...Vt({series:e,ctx:s,runs:l,totalPoints:u,style:d,styleLine:g,styleMarkers:h,stepShape:b,thresholds:n}));let S=e.overlays;if(S&&S.length>0){let w=t.range(),k={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(w[0],w[1]),chartBottom:Math.max(w[0],w[1]),idPrefix:H(e.name,e.id),merke:A=>{let D=this._overlayWerte.get(i)??[];D.push(A),this._overlayWerte.set(i,D);}};S.forEach((A,D)=>{c.push(...mn(A,k,D));});}return e.style?.gap&&l.length>1&&c.push(...Ft({gap:e.style.gap,runs:l,timeScale:o,valueScale:t,metrics:this._textMetrics,lineColor:a?.color})),c}_interpolateValue(e,t){for(let n=1;n<t.length;n++){let i=t[n-1],o=t[n];if(!(i.value===null||o.value===null)&&e>=i.time&&e<=o.time){if(o.time===i.time)return i.value;let s=(e-i.time)/(o.time-i.time);return i.value+s*(o.value-i.value)}}}legendItems(){return le(this._theme,()=>this._legendeneintraege())}_legendeneintraege(){return this._legendItems()}_palettenFarbe(e){let t=x.palette;return t.length>0?t[e%t.length]:x.stroke}_legendItems(){return this._series.map((e,t)=>{let n=e.style?.line,i=Array.isArray(n)?n:n?[n]:[],o=e.style?.markers,s=o?.type&&o.type!=="none"&&(o.threshold===void 0||(e.data?.length??0)<=o.threshold),a=V(e)?e.avgColor??x.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,width:i.length<=1?i[0]?.width??x.strokeWidth:void 0,marker:s?o.type:void 0,id:K(e.id??e.name),seriesId:e.id??e.name}})}get renderer(){return this._renderer}get layout(){return le(this._theme,()=>this._layoutMitLegende().layout)}get plotRect(){let{chartX:e,chartY:t,chartWidth:n,chartHeight:i}=this.layout;return {x:e,y:t,width:n,height:i}}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}warnings(){return [...wr(this._series.map(e=>e.id??e.name)),...this._ueberschwinger(),...Sr(this._gaps.map(e=>e.style))]}_ueberschwinger(){let e=[],t=n=>this._series.find(i=>(i.id??i.name)===n||i.name===n);return this._series.forEach((n,i)=>{if(V(n))return;let o=n.style?.fill,s=o&&typeof o=="object"&&"regions"in o?o.regions:[],a=new Set;for(let m of s)if(m.where)for(let l of [m.from??"chartBottom",m.to??"series"]){let u=l==="series"?n:typeof l=="object"&&"series"in l?t(l.series):void 0;if(!u||V(u))continue;let{grundLinie:c,stepShape:h}=this._linienGrundlage(u),p=c?.smoothingType??"catmull-rom";h||!c?.smoothing||p==="monotone"||a.has(u.name)||(a.add(u.name),e.push(`series ${i}: fill where decides on the readings, but "${u.name}" is smoothed with ${p}, which can overshoot them -- the area may miss the line at its edges; smoothingType 'monotone' does not overshoot`));}}),e}pointsAt(e,t,n={}){return le(this._theme,()=>this._punkteAm(e,t,n))}_punkteAm(e,t,n={}){if(!this._timeScale)return [];let i=this._legendItems();return lt(this._series,this._timeScale,(o,s)=>{let a=this._axisIndexOf(o),m=this._valueScales.get(a);if(!m)return;let l=V(o)?void 0:this._linienGrundlage(o);return {skala:m,achse:a,stufe:l?.stepShape??false,gapThreshold:l?.gapThreshold??0,farbe:i[s].color,linie:i[s].line,format:kr(o)??Se(this._axes,a)?.format,overlays:this._overlayWerte.get(s)}},this.plotRect,e,t,{...n,radius:n.radius??x.tooltipSnapRadius})}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let n=this._valueScales.get(t);return n?n.invert(e):0}project(e,t,n=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(n);return {x:i,y:o?o.map(t):0}}};function Sr(r){let e=r.flatMap((t,n)=>t==="label"?[String(n)]:[]);return e.length?[`gap ${e.join(", ")} uses style "label" -- deprecated, removed before 2.0; use style "empty" with a label`]:[]}function wr(r){let e=new Map;return r.forEach((t,n)=>e.set(t,[...e.get(t)??[],n])),[...e].filter(([,t])=>t.length>1).map(([t,n])=>`series ${n.join(", ")} share the id "${t}" -- hidden and pointsAt cannot tell them apart; give each a unique id`)}function kr(r){let e=r.enumMap;return e?t=>e[t]??String(t):void 0}var Tr=.2,ce=4,oe=1e-6,_r=6,Cr=.4;function Ar(r){return r?.map(e=>{let t=e.data;if(t.length<=4)return e;let n=(l,u)=>"avg"in l?u?l.max:l.min:l.value,i=new Set,o=0,s=0,a=-1,m=-1;t.forEach((l,u)=>{l.time<t[o].time&&(o=u),l.time>t[s].time&&(s=u);let c=n(l,false),h=n(l,true);c!==null&&(a<0||c<n(t[a],false))&&(a=u),h!==null&&(m<0||h>n(t[m],true))&&(m=u);});for(let l of [o,s,a,m])l>=0&&i.add(l);return {...e,data:t.filter((l,u)=>i.has(u))}})}function Mr(r,e){if(!r.content)return null;let t=r.fontSize??11,n=e(r.content,t),i=r.anchor==="middle"?-n/2:r.anchor==="end"?-n:0,[o,s]=r.textBaseline==="middle"?[-t/2,t/2]:r.textBaseline==="top"?[0,t]:r.textBaseline==="bottom"?[-t,0]:[-0.8*t,Tr*t],a=[[i,o],[i+n,o],[i,s],[i+n,s]],m=(r.rotate??0)*Math.PI/180,l=Math.cos(m),u=Math.sin(m),c=a.map(([p,d])=>r.x+p*l-d*u),h=a.map(([p,d])=>r.y+p*u+d*l);return {x0:Math.min(...c),y0:Math.min(...h),x1:Math.max(...c),y1:Math.max(...h)}}function de(r,e){return {x0:Math.min(...r),y0:Math.min(...e),x1:Math.max(...r),y1:Math.max(...e)}}function dn(r,e,t=[]){for(let n of r)switch(n.type){case "group":{let i=n.cssClass??"";if(n.clipRect||n.plotClipId||i.startsWith("chart-legend")||i.startsWith("annotation-band"))break;dn(n.commands,e,t);break}case "text":{let i=Mr(n,e);i&&t.push(i);break}case "line":t.push(de([n.x1,n.x2],[n.y1,n.y2]));break;case "rect":t.push(de([n.x,n.x+n.w],[n.y,n.y+n.h]));break;case "circle":t.push(de([n.cx-n.r,n.cx+n.r],[n.cy-n.r,n.cy+n.r]));break;case "path":n.points.length>0&&t.push(de(n.points.map(i=>i.x),n.points.map(i=>i.y)));break;case "gap":t.push(de([n.x1,n.x2],[n.y1,n.y2]));break}return t}function Lr(r,e={}){return Dr(r,e)}function Dr(r,e,t){let n=e.padding||4,i=Math.max(e.minimum||8,ce),o=r.textMetrics??W,s=Ar(r.series),a=c=>{let h=new N({...r,series:s,margin:c}),p=h.renderCommands();return {kaesten:dn(p,o),plot:h.plotRect,breite:h.layout.totalWidth,hoehe:h.layout.totalHeight}},m=r.margin,l={top:Math.max(i,m?.top??20),right:Math.max(i,m?.right??20),bottom:Math.max(i,m?.bottom??40),left:Math.max(i,m?.left??60)},u;for(let c=0;c<_r;c++){let h=a(l),p=a({...l,left:l.left+ce,right:l.right-ce}),d=a({...l,top:l.top+ce,bottom:l.bottom-ce}),g=p.kaesten.length===h.kaesten.length&&d.kaesten.length===h.kaesten.length,f=v=>g&&Math.abs(p.kaesten[v].x0-h.kaesten[v].x0)<oe,b=v=>g&&Math.abs(d.kaesten[v].y0-h.kaesten[v].y0)<oe,{plot:y}=h,S=y.x+y.width,w=y.y+y.height,k={left:0,right:0,top:0,bottom:0},A={left:0,right:0,top:0,bottom:0};h.kaesten.forEach((v,$)=>{f($)?(v.x0<y.x-oe&&(A.left=Math.max(A.left,v.x1)),v.x1>S+oe&&(A.right=Math.max(A.right,h.breite-v.x0))):(k.left=Math.max(k.left,y.x-v.x0),k.right=Math.max(k.right,v.x1-S)),b($)?(v.y0<y.y-oe&&(A.top=Math.max(A.top,v.y1)),v.y1>w+oe&&(A.bottom=Math.max(A.bottom,h.hoehe-v.y0))):(k.top=Math.max(k.top,y.y-v.y0),k.bottom=Math.max(k.bottom,v.y1-w));});let D=v=>A[v]>0?A[v]+n+k[v]:k[v]>0?k[v]+n:0,C={top:0,right:0,bottom:0,left:0};for(let v of ["top","right","bottom","left"]){let $=v==="top"||v==="bottom"?h.hoehe:h.breite,R=Math.max(i,Math.floor($*Cr));C[v]=Math.min(Math.max(i,Math.ceil(D(v)-1e-9)),R);}if(C.top===l.top&&C.right===l.right&&C.bottom===l.bottom&&C.left===l.left)return C;if(u&&C.top===u.top&&C.right===u.right&&C.bottom===u.bottom&&C.left===u.left)return {top:Math.max(C.top,l.top),right:Math.max(C.right,l.right),bottom:Math.max(C.bottom,l.bottom),left:Math.max(C.left,l.left)};u=l,l=C;}return l}function $r(r){if(r.min!==void 0&&r.max!==void 0)return {unit:r.unit,min:r.min,max:r.max};let e=1/0,t=-1/0;for(let n of r.data??[])n.value===null||n.value===void 0||(n.value<e&&(e=n.value),n.value>t&&(t=n.value));return {unit:r.unit,min:e,max:t}}var pn=r=>Math.abs(r.max-r.min);function Pr(r,e){return r.max>=e.min&&e.max>=r.min?0:r.max<e.min?e.min-r.max:r.min-e.max}function Rr(r,e){if(r.unit!==e.unit)return false;let t=Math.max(Math.abs(r.min),Math.abs(r.max),Math.abs(e.min),Math.abs(e.max)),n=Math.max(pn(r),pn(e),t*.05);return Pr(r,e)<=n}function Br(r){let e=[],t=r.map(i=>{let o=$r(i);if(!Number.isFinite(o.min)||!Number.isFinite(o.max)){let a=e.findIndex(m=>m.unit===o.unit);return a>=0?a:(e.push({unit:o.unit,min:0,max:0}),e.length-1)}let s=e.findIndex(a=>Rr(a,o));return s>=0?(e[s]={unit:e[s].unit,min:Math.min(e[s].min,o.min),max:Math.max(e[s].max,o.max)},s):(e.push({...o}),e.length-1)}),n=e.map((i,o)=>({position:o===0?"left":"right",...i.unit?{label:i.unit}:{}}));return {indices:t,axes:n}}function fn(r){let e=[];for(let t=0;t<r.length-1;t++){let n=r[t+1].x-r[t].x;e.push(n===0?0:(r[t+1].y-r[t].y)/n);}return e}function Fr(r){let e=fn(r),t=r.length,n=[...e];for(let i=1;i<t-1;i++)n[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;n[t-1]=e[t-2];for(let i=0;i<t-1;i++){if(e[i]===0){n[i]=0,n[i+1]=0;continue}let o=n[i]/e[i],s=n[i+1]/e[i],a=o*o+s*s;if(a>9){let m=3/Math.sqrt(a);n[i]=m*o*e[i],n[i+1]=m*s*e[i];}}return n}function jr(r){let e=fn(r),t=r.length;if(e.length<2)return r.map(()=>e[0]??0);let n=e[0],i=e[1],o=e[e.length-1],s=e[e.length-2],a=2*n-i,m=2*o-s,l=[2*a-n,a,...e,m,2*m-o],u=[];for(let c=0;c<t;c++){let h=Math.abs(l[c+3]-l[c+2]),p=Math.abs(l[c+1]-l[c]);u.push(h+p===0?(l[c+1]+l[c+2])/2:(h*l[c+1]+p*l[c+2])/(h+p));}return u}function Er(r,e){let t=[];for(let n=0;n<r.length-1;n++){let i=r[n],o=r[n+1],s=(o.x-i.x)/3;t.push({p0:i,c1:{x:i.x+s,y:i.y+e[n]*s},c2:{x:o.x-s,y:o.y-e[n+1]*s},p1:o});}return t}function Gr(r,e){if(r.length<2)return [];let t=e==="akima"?jr(r):Fr(r);return Er(r,t)}function Ir(r){let e=[];for(let t=0;t<r.length-1;t++){let n=r[t-1]??r[t],i=r[t],o=r[t+1],s=r[t+2]??o,a=Math.min(i.x,o.x),m=Math.max(i.x,o.x),l=u=>u<a?a:u>m?m:u;e.push({p0:i,c1:{x:l(i.x+(o.x-n.x)/6),y:i.y+(o.y-n.y)/6},c2:{x:l(o.x-(s.x-i.x)/6),y:o.y-(s.y-i.y)/6},p1:o});}return e}function Je(r,e){return e&&e!=="catmull-rom"?Gr(r,e):Ir(r)}var Qe=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],Or={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:Qe,rect:Qe,path:Qe},Wr={line:"stroke-opacity",text:"fill-opacity"},zr=/ ([a-z-]+)="([^"]*)"/g;function Hr(r){let e=/^<(line|text|circle|rect|path) /.exec(r)?.[1];if(!e||r.includes(`
25
+ `))return null;let t=e==="text"?r.indexOf(">")+1:r.length,n=r.slice(0,t),i=/ opacity="([^"]*)"/.exec(n),o=Wr[e];i&&i[1]==="1"?n=n.replace(i[0],""):i&&o&&!n.includes(` ${o}="`)&&(n=n.replace(i[0],` ${o}="${i[1]}"`));let s=new Map;for(let[,a,m]of n.matchAll(zr))s.set(a,m);return {art:e,kopf:n,rest:r.slice(t),attrs:s}}function gn(r){let e=[];for(let n of Or[r[0].art]){if(!r.every(a=>a.attrs.has(n)))continue;let i=new Map;for(let a of r){let m=a.attrs.get(n);i.set(m,(i.get(m)??0)+1);}let o="",s=0;for(let[a,m]of i)m>s&&([o,s]=[a,m]);e.push([n,o]);}let t=r.map(n=>{let i=n.kopf;for(let[o,s]of e)i=i.replace(` ${o}="${s}"`,"");return i+n.rest});return {attrs:e.map(([n,i])=>` ${n}="${i}"`).join(""),kinder:t}}function yn(r,e=" "){let t=[];for(let o of r){let s=Hr(o);if(!s)return null;t.push(s);}if(t.length===0)return null;let n=new Set(t.map(o=>o.art));if(n.size===1){let o=gn(t);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
26
+ `)}}if(n.size!==2||!n.has("line")||!n.has("text"))return null;let i=[];for(let o of ["line","text"]){let s=t.filter(m=>m.art===o);if(s.length===1){i.push(e+s[0].kopf+s[0].rest);continue}let a=gn(s);i.push(`${e}<g${a.attrs}>`);for(let m of a.kinder)i.push(e+e+m);i.push(`${e}</g>`);}return {attrs:"",inhalt:i.join(`
27
+ `)}}var et="1.17.1";var Vr=` <!-- MLTimeGraph ${et} -->`,bn=1e3;function _(r){return String(Math.round(r*bn)/bn)}function tt(r){return He(r).toString(16).padStart(8,"0")}function Nr(r){switch(r){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var Q=class extends we{#e="100%";#t="100%";#n;#r="";#i=new Map;#o=new Map;#s=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background),e?.idPrefix&&(this.#r=`${e.idPrefix}-`);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#o.clear(),this.#s.clear();let t=e.map(l=>this._toSVG(l));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let n=t.join(`
28
+ `),i="",o=[];for(let[,l]of this.#i)o.push(l);for(let[,l]of this.#o)o.push(l);for(let[,l]of this.#s)o.push(l);o.length>0&&(i=` <defs>
29
29
  ${o.join(`
30
30
  `)}
31
31
  </defs>
32
- `);let s=typeof this.#e=="number"?`${this.#e}`:this.#e,l=typeof this.#t=="number"?`${this.#t}`:this.#t,h=typeof this.#e=="number"&&typeof this.#t=="number"?` viewBox="0 0 ${this.#e} ${this.#t}"`:"";return {type:"svg",content:`<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${l}"${h}>
33
- ${Wr}
32
+ `);let s=typeof this.#e=="number"?`${this.#e}`:this.#e,a=typeof this.#t=="number"?`${this.#t}`:this.#t,m=typeof this.#e=="number"&&typeof this.#t=="number"?` viewBox="0 0 ${this.#e} ${this.#t}"`:"";return {type:"svg",content:`<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${a}"${m}>
33
+ ${Vr}
34
34
  ${i} ${n}
35
- </svg>`}}_toSVG(e){switch(e.type){case "path":return this._path(e);case "line":return this._line(e);case "rect":return this._rect(e);case "circle":return this._circle(e);case "text":return this.#u(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#m(e,t){if(e.length===0)return "";if(!t.smoothing||e.length<3)return e.map((a,m)=>`${m===0?"M":"L"}${v(a.x)},${v(a.y)}`).join(" ");let n=t.smoothCount!=null&&t.smoothCount<e.length?Math.max(t.smoothCount,2):e.length,i=t.smoothTail??0,o=i>=3&&e.length-i>=n?e.length-i:e.length,s=a=>a.map(m=>` C${v(m.c1.x)},${v(m.c1.y)} ${v(m.c2.x)},${v(m.c2.y)} ${v(m.p1.x)},${v(m.p1.y)}`).join(""),l=`M${v(e[0].x)},${v(e[0].y)}`;l+=s(qe(e.slice(0,n),t.smoothingType));let h=o<e.length?o:e.length-1;for(let a=n;a<=h;a++)l+=` L${v(e[a].x)},${v(e[a].y)}`;if(o<e.length){let a=e.slice(o).reverse(),m=qe(a,t.smoothTailType??t.smoothingType).reverse().map(u=>({p0:u.p1,c1:u.c2,c2:u.c1,p1:u.p0}));l+=s(m);}return l}_hatchPattern(e,t){let n=`${this.#r}hatch-${e}-${et(t??"")}`;if(this.#s.has(n))return n;let i=fe(n,e,t??"rgba(200,220,255,0.3)");return this.#s.set(n,i),n}_path(e){let t=this.#m(e.points,e)+(e.closed?" Z":""),n=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${s})"`);}else n.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&n.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&n.push(`stroke-width="${v(e.strokeWidth)}"`);let i=this.#l(e.dash,e.dashed,e.strokeWidth);i&&(n.push(`stroke-dasharray="${i.strokeDasharray}"`),i.strokeLinecap&&n.push(`stroke-linecap="${i.strokeLinecap}"`)),e.opacity!==void 0&&n.push(`opacity="${v(e.opacity)}"`),e.cssClass&&n.push(`class="${this._esc(e.cssClass)}"`),e.id&&n.push(`id="${this._esc(e.id)}"`);let o=this.#a(e);return o&&n.push(`filter="url(#${o})"`),`<path d="${t}" ${n.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${v(e.strokeWidth)}"`);let n=this.#l(e.dash,e.dashed,e.strokeWidth);n&&(t.push(`stroke-dasharray="${n.strokeDasharray}"`),n.strokeLinecap&&t.push(`stroke-linecap="${n.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${v(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let i=this.#a(e);return i&&t.push(`filter="url(#${i})"`),`<line x1="${v(e.x1)}" y1="${v(e.y1)}" x2="${v(e.x2)}" y2="${v(e.y2)}" ${t.join(" ")} />`}_rect(e){let t=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${i})"`);}else e.fill!==void 0&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${v(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${v(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#a(e);return n&&t.push(`filter="url(#${n})"`),e.title?`<rect x="${v(e.x)}" y="${v(e.y)}" width="${v(e.w)}" height="${v(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${v(e.x)}" y="${v(e.y)}" width="${v(e.w)}" height="${v(e.h)}" ${t.join(" ")} />`}_circle(e){let t=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${i})"`);}else e.fill&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${v(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#a(e);return n&&t.push(`filter="url(#${n})"`),`<circle cx="${v(e.cx)}" cy="${v(e.cy)}" r="${v(e.r)}" ${t.join(" ")} />`}#l(e,t,n){return Ne(e,n??2,t)}#a(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,n=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!t&&!n&&!i)return null;let o=`${this.#r}shadow-${et(`${e.shadowColor}|${v(t)}|${v(n)}|${v(i)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
36
- <feDropShadow dx="${v(n)}" dy="${v(i)}" stdDeviation="${v(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
37
- </filter>`;return this.#i.set(o,s),o}#h(e,t,n,i,o){this.#o.has(e)||this.#o.set(e,`<clipPath id="${e}">
38
- <rect x="${v(t)}" y="${v(n)}" width="${v(i)}" height="${v(o)}" />
39
- </clipPath>`);}#u(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${v(e.fontSize)}"`),e.fontFamily&&t.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&t.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&t.push(`opacity="${v(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${v(e.rotate)} ${v(e.x)} ${v(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${zr(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${v(e.x)}" y="${v(e.y)}" ${t.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let t=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.style==="label"&&e.label?`<g class="gap">
40
- <rect x="${v(e.x1)}" y="${v(e.y1)}" width="${v(e.x2-e.x1)}" height="${v(e.y2-e.y1)}" ${t.join(" ")} />
41
- <text x="${v(e.x1)}" y="${v(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
42
- </g>`:`<rect x="${v(e.x1)}" y="${v(e.y1)}" width="${v(e.x2-e.x1)}" height="${v(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:m,y:u,w:c,h:p}=e.clipRect;t=`${this.#r}clip-plot-${et(`${v(m)},${v(u)},${v(c)},${v(p)}`)}`,this.#h(t,m,u,c,p);}let n=e.commands.map(m=>this._toSVG(m)),i=e.sharedStyles?gn(n):null,o=i?.inhalt??n.map(m=>` ${m.replaceAll(/\n {3}/g,`
35
+ </svg>`}}_toSVG(e){switch(e.type){case "path":return this._path(e);case "line":return this._line(e);case "rect":return this._rect(e);case "circle":return this._circle(e);case "text":return this.#h(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#m(e,t){if(e.length===0)return "";if(!t.smoothing||e.length<3)return e.map((l,u)=>`${u===0?"M":"L"}${_(l.x)},${_(l.y)}`).join(" ");let n=t.smoothCount!=null&&t.smoothCount<e.length?Math.max(t.smoothCount,2):e.length,i=t.smoothTail??0,o=i>=3&&e.length-i>=n?e.length-i:e.length,s=l=>l.map(u=>` C${_(u.c1.x)},${_(u.c1.y)} ${_(u.c2.x)},${_(u.c2.y)} ${_(u.p1.x)},${_(u.p1.y)}`).join(""),a=`M${_(e[0].x)},${_(e[0].y)}`;a+=s(Je(e.slice(0,n),t.smoothingType));let m=o<e.length?o:e.length-1;for(let l=n;l<=m;l++)a+=` L${_(e[l].x)},${_(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),u=Je(l,t.smoothTailType??t.smoothingType).reverse().map(c=>({p0:c.p1,c1:c.c2,c2:c.c1,p1:c.p0}));a+=s(u);}return a}_hatchPattern(e,t){let n=`${this.#r}hatch-${e}-${tt(t??"")}`;if(this.#s.has(n))return n;let i=fe(n,e,t??"rgba(200,220,255,0.3)");return this.#s.set(n,i),n}_path(e){let t=this.#m(e.points,e)+(e.closed?" Z":""),n=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);n.push(`fill="url(#${s})"`);}else n.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&n.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&n.push(`stroke-width="${_(e.strokeWidth)}"`);let i=this.#l(e.dash,e.dashed,e.strokeWidth);i&&(n.push(`stroke-dasharray="${i.strokeDasharray}"`),i.strokeLinecap&&n.push(`stroke-linecap="${i.strokeLinecap}"`)),e.opacity!==void 0&&n.push(`opacity="${_(e.opacity)}"`),e.cssClass&&n.push(`class="${this._esc(e.cssClass)}"`),e.id&&n.push(`id="${this._esc(e.id)}"`);let o=this.#a(e);return o&&n.push(`filter="url(#${o})"`),`<path d="${t}" ${n.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${_(e.strokeWidth)}"`);let n=this.#l(e.dash,e.dashed,e.strokeWidth);n&&(t.push(`stroke-dasharray="${n.strokeDasharray}"`),n.strokeLinecap&&t.push(`stroke-linecap="${n.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${_(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let i=this.#a(e);return i&&t.push(`filter="url(#${i})"`),`<line x1="${_(e.x1)}" y1="${_(e.y1)}" x2="${_(e.x2)}" y2="${_(e.y2)}" ${t.join(" ")} />`}_rect(e){let t=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${i})"`);}else e.fill!==void 0&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${_(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${_(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#a(e);return n&&t.push(`filter="url(#${n})"`),e.title?`<rect x="${_(e.x)}" y="${_(e.y)}" width="${_(e.w)}" height="${_(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${_(e.x)}" y="${_(e.y)}" width="${_(e.w)}" height="${_(e.h)}" ${t.join(" ")} />`}_circle(e){let t=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${i})"`);}else e.fill&&t.push(`fill="${this._esc(e.fill)}"`);e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${_(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let n=this.#a(e);return n&&t.push(`filter="url(#${n})"`),`<circle cx="${_(e.cx)}" cy="${_(e.cy)}" r="${_(e.r)}" ${t.join(" ")} />`}#l(e,t,n){return Ne(e,n??2,t)}#a(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,n=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!t&&!n&&!i)return null;let o=`${this.#r}shadow-${tt(`${e.shadowColor}|${_(t)}|${_(n)}|${_(i)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
36
+ <feDropShadow dx="${_(n)}" dy="${_(i)}" stdDeviation="${_(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
37
+ </filter>`;return this.#i.set(o,s),o}#u(e,t,n,i,o){this.#o.has(e)||this.#o.set(e,`<clipPath id="${e}">
38
+ <rect x="${_(t)}" y="${_(n)}" width="${_(i)}" height="${_(o)}" />
39
+ </clipPath>`);}#h(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${_(e.fontSize)}"`),e.fontFamily&&t.push(`font-family="${this._esc(e.fontFamily)}"`),e.fill&&t.push(`fill="${this._esc(e.fill)}"`),e.opacity!=null&&t.push(`opacity="${_(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${_(e.rotate)} ${_(e.x)} ${_(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${Nr(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${_(e.x)}" y="${_(e.y)}" ${t.join(" ")}>${this._esc(e.content)}</text>`}_gap(e){if(e.style==="empty")return "";let t=[`stroke="${this._esc("#999")}"`,'stroke-dasharray="4,4"','fill="none"'];return e.style==="label"&&e.label?`<g class="gap">
40
+ <rect x="${_(e.x1)}" y="${_(e.y1)}" width="${_(e.x2-e.x1)}" height="${_(e.y2-e.y1)}" ${t.join(" ")} />
41
+ <text x="${_(e.x1)}" y="${_(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
42
+ </g>`:`<rect x="${_(e.x1)}" y="${_(e.y1)}" width="${_(e.x2-e.x1)}" height="${_(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:u,y:c,w:h,h:p}=e.clipRect;t=`${this.#r}clip-plot-${tt(`${_(u)},${_(c)},${_(h)},${_(p)}`)}`,this.#u(t,u,c,h,p);}let n=e.commands.map(u=>this._toSVG(u)),i=e.sharedStyles?yn(n):null,o=i?.inhalt??n.map(u=>` ${u.replaceAll(/\n {3}/g,`
43
43
  `)}`).join(`
44
- `),s=e.cssClass?` class="${this._esc(e.cssClass)}"`:"",l=e.id?` id="${this._esc(e.id)}"`:"",h=e.plotClipId||t,a=h?` clip-path="url(#${this._esc(h)})"`:"";return `<g${s}${l}${a}${i?.attrs??""}>
44
+ `),s=e.cssClass?` class="${this._esc(e.cssClass)}"`:"",a=e.id?` id="${this._esc(e.id)}"`:"",m=e.plotClipId||t,l=m?` clip-path="url(#${this._esc(m)})"`:"";return `<g${s}${a}${l}${i?.attrs??""}>
45
45
  ${o}
46
- </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function Hr(r){return typeof requestAnimationFrame=="function"?requestAnimationFrame(r):setTimeout(()=>r(0),16)}function Vr(r){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(r):clearTimeout(r);}function bn(){let r=0,e=false;return {schedule:t=>{e||(e=true,r=Hr(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,Vr(r));}}}function tt(r,e,t){let n=r.getScreenCTM?.();if(n){let s=n.inverse();return {x:s.a*e+s.c*t+s.e,y:s.b*e+s.d*t+s.f}}let i=r.getBoundingClientRect(),o=r.viewBox?.baseVal;return o&&o.width>0&&o.height>0&&i.width>0&&i.height>0?{x:o.x+(e-i.left)*o.width/i.width,y:o.y+(t-i.top)*o.height/i.height}:{x:e-i.left,y:t-i.top}}var xn="http://www.w3.org/2000/svg";function Pe(r){return r.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function Nr(r,e){if(r.length===0)return "";let t=r.map(i=>{let o=Pe(i.point.overlayKind?`${i.series.name} (${i.point.overlayKind})`:i.series.name),s=Pe(i.label??i.value.toFixed(2)),l=i.held?` (${Pe(new Date(i.time).toLocaleTimeString())})`:"";return `<div><span class="mlc-tooltip__name">${o}:</span> ${s}${l}</div>`});return `<div class="mlc-tooltip__time">${Pe(new Date(e.time).toLocaleString())}</div>${t.join("")}`}function Re(r,e,t={}){let n=r.querySelector("svg");if(!n)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=t.format??Nr,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",l=t.showPicks??true,h=t.pickRadius??5,a=t.picksClassName??"mlc-tooltip-picks",m=document.createElement("div");m.className=s,m.style.position="absolute",m.style.pointerEvents="none",m.style.display="none",getComputedStyle(r).position==="static"&&(r.style.position="relative"),r.appendChild(m);let u=null;l&&(u=document.createElementNS(xn,"g"),u.setAttribute("class",a),u.setAttribute("pointer-events","none"),n.appendChild(u));let c=()=>{u&&u.replaceChildren();},p=new Map;e.series.forEach((k,w)=>{let A=k.id??k.name;p.has(A)||p.set(A,w);});let d=bn(),g=null,f=k=>{let w=n.getBoundingClientRect(),A=tt(n,k.clientX,k.clientY),D=A.x,C=e.invertTime(D);if(!Number.isFinite(C)){m.style.display="none";return}let T=e.plotRect,$=Math.min(T.y+T.height,Math.max(T.y,A.y)),R=e.pointsAt(D,$,{...t.points,radius:o}).map(_=>{let M=p.get(_.seriesId)??0;return {seriesIndex:M,series:e.series[M],time:_.time,value:_.value??_.avg??0,x:_.x,y:_.y,..._.held?{held:true}:{},..._.label!==void 0?{label:_.label}:{},point:_}});if(R.length===0){m.style.display="none",c();return}m.innerHTML=i(R,{time:C});let F=r.getBoundingClientRect(),j=12,B=(k.clientX-w.left)/Math.max(1,w.width),z=(k.clientY-w.top)/Math.max(1,w.height),I=B<.5?`${j}px`:`calc(-100% - ${j}px)`,G=z<.5?`${j}px`:`calc(-100% - ${j}px)`;if(m.style.left=`${k.clientX-F.left}px`,m.style.top=`${k.clientY-F.top}px`,m.style.transform=`translate(${I}, ${G})`,m.style.display="",u){u.replaceChildren();for(let _ of R){let M=document.createElementNS(xn,"circle");M.setAttribute("cx",String(_.x)),M.setAttribute("cy",String(_.y)),M.setAttribute("r",String(h)),M.setAttribute("fill","#ffffff"),M.setAttribute("stroke",_.point.color),M.setAttribute("stroke-width","2"),M.setAttribute("class",`${a}__dot`),u.appendChild(M);}}},b=k=>{g=k,d.schedule(()=>{g&&f(g);});},y=()=>{g=null,d.cancel(),m.style.display="none",c();};n.addEventListener("mousemove",b),n.addEventListener("mouseleave",y);let S=false;return ()=>{S||(S=true,g=null,d.cancel(),n.removeEventListener("mousemove",b),n.removeEventListener("mouseleave",y),m.remove(),u&&u.remove());}}function Kr(r,e={}){let t=kn(r,"mount"),{tooltip:n,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,l=new N({...i,width:o,height:s});return wn(t,l,o),n?.show&&Re(t,l,n),l}function Sn(r,e,t){let n=kn(r,"GraphBuilder.mount"),{chart:i,width:o}=e(n.clientWidth||800);return wn(n,i,o),t?.show&&Re(n,i,t),i}function kn(r,e){let t=typeof r=="string"?document.querySelector(r):r;if(!t)throw new Error(`${e}: target ${typeof r=="string"?`'${r}'`:""} not found`);return t}function wn(r,e,t){let{content:n}=new Q().render(e.renderCommands());r.innerHTML=n;let i=r.querySelector("svg");i&&(i.setAttribute("viewBox",`0 0 ${t} ${e.getHeight()}`),i.setAttribute("width","100%"),i.setAttribute("height",String(e.getHeight())));}var Be=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,n,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:n??0,left:i??0},this}setLocale(e){return this._opts.locale=e,this}setAxes(e){return this._opts.axes=e,this}setXAxis(e){return this._opts.axes={...this._opts.axes,x:{...this._opts.axes?.x,...e}},this}setLeftAxis(e){return this._opts.axes={...this._opts.axes,left:{...this._opts.axes?.left,...e}},this}setRightAxis(e){return this._opts.axes={...this._opts.axes,right:{...this._opts.axes?.right,...e}},this}setYAxis(e,t){this._opts.axes??={},this._opts.axes.y??=[];let n=[...this._opts.axes.y];for(;n.length<=e;)n.push({});return n[e]={...n[e],...t},this._opts.axes.y=n,this}setLegend(e,t,n){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:n},this}setGaps(e){return this._opts.gaps=e,this}setTooltip(e){return this._tooltip={show:true,...e},this}addSeries(e){return this._series.push(e),this}addSeriesAll(e){return this._series.push(...e),this}addThreshold(e){return this._thresholds.push(e),this}addThresholds(e){return this._thresholds.push(...e),this}addAnnotation(e){return this._annotations.push(e),this}addAnnotations(e){return this._annotations.push(...e),this}addHighlight(e){return this._highlights.push(e),this}addMarker(e){return this._markers.push(e),this}addAnnotationBand(e){return this._bands.push(e),this}clear(e){return (!e||e==="series")&&(this._series=[]),(!e||e==="thresholds")&&(this._thresholds=[]),(!e||e==="annotations")&&(this._annotations=[]),(!e||e==="highlights")&&(this._highlights=[]),(!e||e==="markers")&&(this._markers=[]),(!e||e==="bands")&&(this._bands=[]),this}toOptions(){return {...this._opts,series:this._series.length?this._series:this._opts.series,thresholds:this._thresholds.length?this._thresholds:this._opts.thresholds,annotations:this._annotations.length?this._annotations:this._opts.annotations,highlights:this._highlights.length?this._highlights:this._opts.highlights,markers:this._markers.length?this._markers:this._opts.markers,annotationBands:this._bands.length?this._bands:this._opts.annotationBands}}build(){return new N(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new Q().render(e.renderCommands());return t}mount(e){return Sn(e,t=>(this._opts.width||(this._opts.width=t),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var je=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let n=Math.min(e.length,t.length);for(let i=0;i<n;i++)this._series.data.push({time:e[i],value:t[i]});return this}addNullPoint(e){return this._series.data.push({time:e,value:null}),this}setYAxisIndex(e){return this._series.yAxisIndex=e,this}setColor(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={color:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{color:e}]:this._series.style.line[0].color=e:this._series.style.line.color=e,this}setStyle(e){return this._series.style=e,this}setLineStyle(e,t,n){return this._series.style??={},this._series.style.line={color:e,width:t,style:n},this}setSmoothing(e,t){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e,smoothingType:t}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e,smoothingType:t}]:(this._series.style.line[0].smoothing=e,this._series.style.line[0].smoothingType=t):(this._series.style.line.smoothing=e,this._series.style.line.smoothingType=t),this}setFill(e){return this._series.style??={},this._series.style.fill=e,this}setID(e){return this._series.id=e,this}setColorByThresholds(e){return this._series.colorByThresholds=e,this}build(){return this._series}};var Fe=class{_threshold;constructor(e,t){this._threshold={name:e,value:t};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,t){return this._threshold.fill=e,this._threshold.fillOpacity=t,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,t){return this._threshold.label={text:e,position:t},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Ee=class{_marker;constructor(e){this._marker={time:e};}setValue(e){return this._marker.value=e,this}setLabel(e){return this._marker.label=e,this}setColor(e){return this._marker.color=e,this}setPointStyle(e){return this._marker.pointStyle=e,this}setLineStyle(e){return e==="none"?delete this._marker.lineStyle:this._marker.lineStyle=e,this}setSeriesIndex(e){return this._marker.seriesIndex=e,this}build(){return this._marker}};var Ge=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var Ie=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,n){return this._ann.from={time:e,value:t,axis:n},this}setTo(e,t,n){return this._ann.to={time:e,value:t,axis:n},this}setAt(e,t,n){return this._ann.at={time:e,value:t,axis:n},this}setColor(e){return this._ann.color=e,this}setWidth(e){return this._ann.width=e,this}setDash(e){return this._ann.dash=e,this}setHeadSize(e){return this._ann.headSize=e,this}setFill(e){return this._ann.fill=e,this}setHatch(e){return this._ann.hatch=e,this}setStroke(e){return this._ann.stroke=e,this}setOpacity(e){return this._ann.opacity=e,this}setRadius(e){return this._ann.radius=e,this}setShape(e){return this._ann.shape=e,this}setText(e){return this._ann.text=e,this}setAnchor(e){return this._ann.anchor=e,this}setDx(e){return this._ann.dx=e,this}setDy(e){return this._ann.dy=e,this}setRotate(e){return this._ann.rotate=e,this}build(){return this._ann}};var Oe=class{_band;constructor(e){this._band={name:e,items:[]};}setHeight(e){return this._band.height=e,this}setSpacing(e){return this._band.spacing=e,this}setHatch(e){return this._band.hatch=e,this}setShowAxis(e){return this._band.showAxis=e,this}setShowInLegend(e){return this._band.showInLegend=e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},We=class{_item;constructor(e,t){this._item={startTime:e,endTime:t};}setFill(e){return this._item.fill=e,this}setHatch(e){return this._item.hatch=e,this}setStroke(e){return this._item.stroke=e,this}setStrokeWidth(e){return this._item.strokeWidth=e,this}setLabel(e,t,n,i){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),n!==void 0&&(this._item.labelFill=n),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function Yr(r){let{thresholds:e,colors:t,hatches:n}=r;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(n!==void 0&&n.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${n.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let l=n?.[s],h=l?{color:o,hatch:l}:o;return s===0?{to:{threshold:e[0]},fill:h}:s===t.length-1?{from:{threshold:e[e.length-1]},fill:h}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:h}})}}function nt(r){if(!r||typeof r!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:n}=r;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(t!==null&&(typeof t!="number"||Number.isNaN(t)))throw t===void 0?new Error("DataPoint: missing value"):typeof t=="object"&&"value"in t?new Error("DataPoint: nested value object"):new Error(`DataPoint: invalid value=${t}`);return {time:e,value:t,annotation:n&&typeof n=="string"?n:void 0}}function Xr(r){if(Array.isArray(r))return r.map(nt);if(r&&typeof r=="object"){let e=r,t=e.name,n=e.data,i=e.sensorType,o=e.enumMap,s=e.color,l=e.lineWidth,h=e.smoothing,a=e.seriesType;if(!t?.length)throw new Error("Series: name required");if(!Array.isArray(n))throw new Error("Series: data must be an array");let m=s!==void 0||l!==void 0||h!==void 0?{color:s,width:l,smoothing:h}:void 0;return {name:t,data:n.map(nt),sensorType:i??"numeric",enumMap:o,seriesType:a,...m&&{style:{line:m}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function Zr(r){if(!r||typeof r!="object")throw new Error("parseAggregated: object expected");let e=r,t=e.name,n=e.data,i=e.showAs,o=e.avgLine,s=e.countOpacity,l=e.color;if(!t?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(n))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:Ur(n),showAs:i,avgLine:o,countOpacity:s,...l!==void 0&&{style:{line:{color:l},fill:l}}}}function Ur(r){let e=t=>typeof t=="number"?t:null;return r.map(t=>{let n=t;return {time:n.time??0,min:e(n.min),max:e(n.max),avg:e(n.avg),count:typeof n.count=="number"?n.count:0}})}function rt(r,e,t){return typeof e=="function"?e(r):r[e??t]}function qr(r,e,t){if(r instanceof Date){let n=r.getTime();if(Number.isNaN(n))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return n}if(typeof r=="string"){let n=Date.parse(r);if(Number.isNaN(n))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${r}`);return n}if(typeof r=="number"&&Number.isFinite(r))return e==="s"||e==="auto"&&Math.abs(r)>=1e8&&Math.abs(r)<1e11?r*1e3:r;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(r)}`)}function Jr(r,e){if(r==null)return null;if(typeof r=="number")return Number.isNaN(r)?null:r;if(typeof r=="string"){let t=r.trim();if(t==="")return null;let n=Number(t);if(Number.isNaN(n))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${r}`);return n}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(r)}`)}function vn(r,e={}){let t=e.timeUnit??"ms",n=[];for(let i=0;i<r.length;i++){let o=r[i];if(o==null)throw new TypeError(`toDataPoints: empty row at ${i}`);let s=Array.isArray(o),l=s&&e.time===void 0?o[0]:rt(o,e.time,"time"),h=s&&e.value===void 0?o[1]:rt(o,e.value,"value"),a={time:qr(l,t,i),value:Jr(h,i)};if(e.annotation!==void 0){let m=rt(o,e.annotation,"annotation");typeof m=="string"&&m!==""&&(a.annotation=m);}n.push(a);}return (e.sort??true)&&n.sort((i,o)=>i.time-o.time),n}function Qr(r,e,t={}){return {name:r,data:vn(e,t)}}function Tn(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function _n(r,e){if(!Tn(r)||!Tn(e))return e;let t={...r};for(let[n,i]of Object.entries(e))t[n]=_n(t[n],i);return t}function ei(...r){let e;for(let t of r)t!==void 0&&(e=_n(e,t));return e??{}}/*!
46
+ </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function Kr(r){return typeof requestAnimationFrame=="function"?requestAnimationFrame(r):setTimeout(()=>r(0),16)}function Yr(r){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(r):clearTimeout(r);}function xn(){let r=0,e=false;return {schedule:t=>{e||(e=true,r=Kr(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,Yr(r));}}}function nt(r,e,t){let n=r.getScreenCTM?.();if(n){let s=n.inverse();return {x:s.a*e+s.c*t+s.e,y:s.b*e+s.d*t+s.f}}let i=r.getBoundingClientRect(),o=r.viewBox?.baseVal;return o&&o.width>0&&o.height>0&&i.width>0&&i.height>0?{x:o.x+(e-i.left)*o.width/i.width,y:o.y+(t-i.top)*o.height/i.height}:{x:e-i.left,y:t-i.top}}var Sn="http://www.w3.org/2000/svg";function Pe(r){return r.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function Xr(r,e){if(r.length===0)return "";let t=r.map(i=>{let o=Pe(i.point.overlayKind?`${i.series.name} (${i.point.overlayKind})`:i.series.name),s=Pe(i.label??i.value.toFixed(2)),a=i.held?` (${Pe(new Date(i.time).toLocaleTimeString())})`:"";return `<div><span class="mlc-tooltip__name">${o}:</span> ${s}${a}</div>`});return `<div class="mlc-tooltip__time">${Pe(new Date(e.time).toLocaleString())}</div>${t.join("")}`}function Re(r,e,t={}){let n=r.querySelector("svg");if(!n)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=t.format??Xr,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,m=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",u=document.createElement("div");u.className=s,u.style.position="absolute",u.style.pointerEvents="none",u.style.display="none",getComputedStyle(r).position==="static"&&(r.style.position="relative"),r.appendChild(u);let c=null;a&&(c=document.createElementNS(Sn,"g"),c.setAttribute("class",l),c.setAttribute("pointer-events","none"),n.appendChild(c));let h=()=>{c&&c.replaceChildren();},p=new Map;e.series.forEach((w,k)=>{let A=w.id??w.name;p.has(A)||p.set(A,k);});let d=xn(),g=null,f=w=>{let k=n.getBoundingClientRect(),A=nt(n,w.clientX,w.clientY),D=A.x,C=e.invertTime(D);if(!Number.isFinite(C)){u.style.display="none";return}let v=e.plotRect,$=Math.min(v.y+v.height,Math.max(v.y,A.y)),R=e.pointsAt(D,$,{...t.points,radius:o}).map(T=>{let M=p.get(T.seriesId)??0;return {seriesIndex:M,series:e.series[M],time:T.time,value:T.value??T.avg??0,x:T.x,y:T.y,...T.held?{held:true}:{},...T.label!==void 0?{label:T.label}:{},point:T}});if(R.length===0){u.style.display="none",h();return}u.innerHTML=i(R,{time:C});let j=r.getBoundingClientRect(),F=12,B=(w.clientX-k.left)/Math.max(1,k.width),z=(w.clientY-k.top)/Math.max(1,k.height),I=B<.5?`${F}px`:`calc(-100% - ${F}px)`,G=z<.5?`${F}px`:`calc(-100% - ${F}px)`;if(u.style.left=`${w.clientX-j.left}px`,u.style.top=`${w.clientY-j.top}px`,u.style.transform=`translate(${I}, ${G})`,u.style.display="",c){c.replaceChildren();for(let T of R){let M=document.createElementNS(Sn,"circle");M.setAttribute("cx",String(T.x)),M.setAttribute("cy",String(T.y)),M.setAttribute("r",String(m)),M.setAttribute("fill","#ffffff"),M.setAttribute("stroke",T.point.color),M.setAttribute("stroke-width","2"),M.setAttribute("class",`${l}__dot`),c.appendChild(M);}}},b=w=>{g=w,d.schedule(()=>{g&&f(g);});},y=()=>{g=null,d.cancel(),u.style.display="none",h();};n.addEventListener("mousemove",b),n.addEventListener("mouseleave",y);let S=false;return ()=>{S||(S=true,g=null,d.cancel(),n.removeEventListener("mousemove",b),n.removeEventListener("mouseleave",y),u.remove(),c&&c.remove());}}function Zr(r,e={}){let t=kn(r,"mount"),{tooltip:n,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,a=new N({...i,width:o,height:s});return vn(t,a,o),n?.show&&Re(t,a,n),a}function wn(r,e,t){let n=kn(r,"GraphBuilder.mount"),{chart:i,width:o}=e(n.clientWidth||800);return vn(n,i,o),t?.show&&Re(n,i,t),i}function kn(r,e){let t=typeof r=="string"?document.querySelector(r):r;if(!t)throw new Error(`${e}: target ${typeof r=="string"?`'${r}'`:""} not found`);return t}function vn(r,e,t){let{content:n}=new Q().render(e.renderCommands());r.innerHTML=n;let i=r.querySelector("svg");i&&(i.setAttribute("viewBox",`0 0 ${t} ${e.getHeight()}`),i.setAttribute("width","100%"),i.setAttribute("height",String(e.getHeight())));}var Be=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,n,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:n??0,left:i??0},this}setLocale(e){return this._opts.locale=e,this}setAxes(e){return this._opts.axes=e,this}setXAxis(e){return this._opts.axes={...this._opts.axes,x:{...this._opts.axes?.x,...e}},this}setLeftAxis(e){return this._opts.axes={...this._opts.axes,left:{...this._opts.axes?.left,...e}},this}setRightAxis(e){return this._opts.axes={...this._opts.axes,right:{...this._opts.axes?.right,...e}},this}setYAxis(e,t){this._opts.axes??={},this._opts.axes.y??=[];let n=[...this._opts.axes.y];for(;n.length<=e;)n.push({});return n[e]={...n[e],...t},this._opts.axes.y=n,this}setLegend(e,t,n){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:n},this}setGaps(e){return this._opts.gaps=e,this}setTooltip(e){return this._tooltip={show:true,...e},this}addSeries(e){return this._series.push(e),this}addSeriesAll(e){return this._series.push(...e),this}addThreshold(e){return this._thresholds.push(e),this}addThresholds(e){return this._thresholds.push(...e),this}addAnnotation(e){return this._annotations.push(e),this}addAnnotations(e){return this._annotations.push(...e),this}addHighlight(e){return this._highlights.push(e),this}addMarker(e){return this._markers.push(e),this}addAnnotationBand(e){return this._bands.push(e),this}clear(e){return (!e||e==="series")&&(this._series=[]),(!e||e==="thresholds")&&(this._thresholds=[]),(!e||e==="annotations")&&(this._annotations=[]),(!e||e==="highlights")&&(this._highlights=[]),(!e||e==="markers")&&(this._markers=[]),(!e||e==="bands")&&(this._bands=[]),this}toOptions(){return {...this._opts,series:this._series.length?this._series:this._opts.series,thresholds:this._thresholds.length?this._thresholds:this._opts.thresholds,annotations:this._annotations.length?this._annotations:this._opts.annotations,highlights:this._highlights.length?this._highlights:this._opts.highlights,markers:this._markers.length?this._markers:this._opts.markers,annotationBands:this._bands.length?this._bands:this._opts.annotationBands}}build(){return new N(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new Q().render(e.renderCommands());return t}mount(e){return wn(e,t=>(this._opts.width||(this._opts.width=t),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var Fe=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let n=Math.min(e.length,t.length);for(let i=0;i<n;i++)this._series.data.push({time:e[i],value:t[i]});return this}addNullPoint(e){return this._series.data.push({time:e,value:null}),this}setYAxisIndex(e){return this._series.yAxisIndex=e,this}setColor(e){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={color:e}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{color:e}]:this._series.style.line[0].color=e:this._series.style.line.color=e,this}setStyle(e){return this._series.style=e,this}setLineStyle(e,t,n){return this._series.style??={},this._series.style.line={color:e,width:t,style:n},this}setSmoothing(e,t){return this._series.style??={},!this._series.style.line||typeof this._series.style.line=="boolean"?this._series.style.line={smoothing:e,smoothingType:t}:Array.isArray(this._series.style.line)?this._series.style.line.length===0?this._series.style.line=[{smoothing:e,smoothingType:t}]:(this._series.style.line[0].smoothing=e,this._series.style.line[0].smoothingType=t):(this._series.style.line.smoothing=e,this._series.style.line.smoothingType=t),this}setFill(e){return this._series.style??={},this._series.style.fill=e,this}setID(e){return this._series.id=e,this}setColorByThresholds(e){return this._series.colorByThresholds=e,this}build(){return this._series}};var je=class{_threshold;constructor(e,t){this._threshold={name:e,value:t};}setColor(e){return this._threshold.color=e,this}setLine(e){return this._threshold.line=e,this}setFill(e,t){return this._threshold.fill=e,this._threshold.fillOpacity=t,this}setFillHatch(e){return this._threshold.fillHatch=e,this}setLabel(e,t){return this._threshold.label={text:e,position:t},this}setID(e){return this._threshold.id=e,this}build(){return this._threshold}};var Ee=class{_marker;constructor(e){this._marker={time:e};}setValue(e){return this._marker.value=e,this}setLabel(e){return this._marker.label=e,this}setColor(e){return this._marker.color=e,this}setPointStyle(e){return this._marker.pointStyle=e,this}setLineStyle(e){return e==="none"?delete this._marker.lineStyle:this._marker.lineStyle=e,this}setSeriesIndex(e){return this._marker.seriesIndex=e,this}build(){return this._marker}};var Ge=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var Ie=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,n){return this._ann.from={time:e,value:t,axis:n},this}setTo(e,t,n){return this._ann.to={time:e,value:t,axis:n},this}setAt(e,t,n){return this._ann.at={time:e,value:t,axis:n},this}setColor(e){return this._ann.color=e,this}setWidth(e){return this._ann.width=e,this}setDash(e){return this._ann.dash=e,this}setHeadSize(e){return this._ann.headSize=e,this}setFill(e){return this._ann.fill=e,this}setHatch(e){return this._ann.hatch=e,this}setStroke(e){return this._ann.stroke=e,this}setOpacity(e){return this._ann.opacity=e,this}setRadius(e){return this._ann.radius=e,this}setShape(e){return this._ann.shape=e,this}setText(e){return this._ann.text=e,this}setAnchor(e){return this._ann.anchor=e,this}setDx(e){return this._ann.dx=e,this}setDy(e){return this._ann.dy=e,this}setRotate(e){return this._ann.rotate=e,this}build(){return this._ann}};var Oe=class{_band;constructor(e){this._band={name:e,items:[]};}setHeight(e){return this._band.height=e,this}setSpacing(e){return this._band.spacing=e,this}setHatch(e){return this._band.hatch=e,this}setShowAxis(e){return this._band.showAxis=e,this}setShowInLegend(e){return this._band.showInLegend=e,this}setBackground(e){return this._band.background=e,this}addItem(e){return this._band.items.push(e),this}build(){return this._band}},We=class{_item;constructor(e,t){this._item={startTime:e,endTime:t};}setFill(e){return this._item.fill=e,this}setHatch(e){return this._item.hatch=e,this}setStroke(e){return this._item.stroke=e,this}setStrokeWidth(e){return this._item.strokeWidth=e,this}setLabel(e,t,n,i){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),n!==void 0&&(this._item.labelFill=n),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function Ur(r){let{thresholds:e,colors:t,hatches:n}=r;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(n!==void 0&&n.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${n.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=n?.[s],m=a?{color:o,hatch:a}:o;return s===0?{to:{threshold:e[0]},fill:m}:s===t.length-1?{from:{threshold:e[e.length-1]},fill:m}:{from:{threshold:e[s-1]},to:{threshold:e[s]},fill:m}})}}function rt(r){if(!r||typeof r!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:n}=r;if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`DataPoint: invalid time=${e}`);if(t!==null&&(typeof t!="number"||Number.isNaN(t)))throw t===void 0?new Error("DataPoint: missing value"):typeof t=="object"&&"value"in t?new Error("DataPoint: nested value object"):new Error(`DataPoint: invalid value=${t}`);return {time:e,value:t,annotation:n&&typeof n=="string"?n:void 0}}function qr(r){if(Array.isArray(r))return r.map(rt);if(r&&typeof r=="object"){let e=r,t=e.name,n=e.data,i=e.sensorType,o=e.enumMap,s=e.color,a=e.lineWidth,m=e.smoothing,l=e.seriesType;if(!t?.length)throw new Error("Series: name required");if(!Array.isArray(n))throw new Error("Series: data must be an array");let u=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:t,data:n.map(rt),sensorType:i??"numeric",enumMap:o,seriesType:l,...u&&{style:{line:u}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function Jr(r){if(!r||typeof r!="object")throw new Error("parseAggregated: object expected");let e=r,t=e.name,n=e.data,i=e.showAs,o=e.avgLine,s=e.countOpacity,a=e.color;if(!t?.length)throw new Error("AggregatedSeries: name required");if(!Array.isArray(n))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:Qr(n),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function Qr(r){let e=t=>typeof t=="number"?t:null;return r.map(t=>{let n=t;return {time:n.time??0,min:e(n.min),max:e(n.max),avg:e(n.avg),count:typeof n.count=="number"?n.count:0}})}function it(r,e,t){return typeof e=="function"?e(r):r[e??t]}function ei(r,e,t){if(r instanceof Date){let n=r.getTime();if(Number.isNaN(n))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return n}if(typeof r=="string"){let n=Date.parse(r);if(Number.isNaN(n))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${r}`);return n}if(typeof r=="number"&&Number.isFinite(r))return e==="s"||e==="auto"&&Math.abs(r)>=1e8&&Math.abs(r)<1e11?r*1e3:r;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(r)}`)}function ti(r,e){if(r==null)return null;if(typeof r=="number")return Number.isNaN(r)?null:r;if(typeof r=="string"){let t=r.trim();if(t==="")return null;let n=Number(t);if(Number.isNaN(n))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${r}`);return n}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(r)}`)}function Tn(r,e={}){let t=e.timeUnit??"ms",n=[];for(let i=0;i<r.length;i++){let o=r[i];if(o==null)throw new TypeError(`toDataPoints: empty row at ${i}`);let s=Array.isArray(o),a=s&&e.time===void 0?o[0]:it(o,e.time,"time"),m=s&&e.value===void 0?o[1]:it(o,e.value,"value"),l={time:ei(a,t,i),value:ti(m,i)};if(e.annotation!==void 0){let u=it(o,e.annotation,"annotation");typeof u=="string"&&u!==""&&(l.annotation=u);}n.push(l);}return (e.sort??true)&&n.sort((i,o)=>i.time-o.time),n}function ni(r,e,t={}){return {name:r,data:Tn(e,t)}}function _n(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Cn(r,e){if(!_n(r)||!_n(e))return e;let t={...r};for(let[n,i]of Object.entries(e))t[n]=Cn(t[n],i);return t}function ri(...r){let e;for(let t of r)t!==void 0&&(e=Cn(e,t));return e??{}}/*!
47
47
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
48
48
  * MIT with Attribution: free use incl. commercial requires visible credit to
49
49
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -62,4 +62,4 @@ ${o}
62
62
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
63
63
  * MIT with Attribution: free use incl. commercial must have visible credit to
64
64
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
65
- */export{Oe as AnnotationBandBuilder,We as AnnotationBandItemBuilder,Ie as AnnotationBuilder,Be as GraphBuilder,Ge as HighlightBuilder,N as MLTimeGraph,Ee as MarkerBuilder,Q as SVGRenderer,Fe as ThresholdBuilder,je as TimeSeriesBuilder,Qe as VERSION,Re as attachTooltip,Cr as autoMargin,$r as axisGroups,we as drawMarker,zn as estimateMetrics,Yr as fillBetweenThresholds,Fn as getDefaultTheme,ut as getLineStyle,W as liberationMetrics,ei as mergeOptions,Kr as mount,Zr as parseAggregated,nt as parseDataPoint,Xr as parseSeries,En as resetDefaultTheme,Ne as resolveDash,jn as setDefaultTheme,K as slugify,vn as toDataPoints,Qr as toSeries,tt as zeigerImSvg};
65
+ */export{Oe as AnnotationBandBuilder,We as AnnotationBandItemBuilder,Ie as AnnotationBuilder,Be as GraphBuilder,Ge as HighlightBuilder,N as MLTimeGraph,Ee as MarkerBuilder,Q as SVGRenderer,je as ThresholdBuilder,Fe as TimeSeriesBuilder,et as VERSION,Re as attachTooltip,Lr as autoMargin,Br as axisGroups,ke as drawMarker,Hn as estimateMetrics,Ur as fillBetweenThresholds,En as getDefaultTheme,ct as getLineStyle,W as liberationMetrics,ri as mergeOptions,Zr as mount,Jr as parseAggregated,rt as parseDataPoint,qr as parseSeries,Gn as resetDefaultTheme,Ne as resolveDash,jn as setDefaultTheme,K as slugify,Tn as toDataPoints,ni as toSeries,nt as zeigerImSvg};
@@ -1,4 +1,4 @@
1
- import { D as DataPoint, a as DrawCommand, T as TimeScale, L as LinearScale } from '../types-DdltSMkw.js';
1
+ import { D as DataPoint, a as DrawCommand, T as TimeScale, L as LinearScale } from '../types-D7tmWwH9.js';
2
2
 
3
3
  /*!
4
4
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -1,7 +1,7 @@
1
- import { k as Theme, t as RenderingContext, F as FlatSeriesStyle, T as TextMetrics, f as Marker } from './marker_renderer-BsiVseet.js';
2
- export { u as Layout, v as LayoutConfig, a as LayoutResult, w as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, x as measureLegend, y as renderLegend, z as renderSeriesMarkers, q as slugify } from './marker_renderer-BsiVseet.js';
3
- import { D as DataPoint, a as DrawCommand, t as AggregatedPoint, k as HatchVariant, f as Threshold, L as LinearScale, g as Gap, T as TimeScale, R as RangeLabelPosition, aa as GapBand, H as Highlight, i as Annotation, ab as LineParams, ac as PathParams, ad as RectParams, ae as CircleParams, af as TextParams, ag as GapParams, d as DrawGroup, z as AxisOrientation, A as AxisPosition, _ as MovingAverageType, ah as Point, E as EnumMap, ai as BandScale, S as SmoothingType, P as PointStyleType, r as AnnotationBandItem, c as LineVariant, X as LineShape, F as FillSpec, V as GapStyle, m as TimeSeries } from './types-DdltSMkw.js';
4
- export { aj as BandScaleConfig, ak as Dashstyle_t, al as DomainScaleConfig, am as DrawCircle, an as DrawGap, ao as DrawGapType_t, ap as DrawLine, aq as DrawPath, ar as DrawRect, as as DrawText, q as LabelAnchor, at as LinearScaleConfig, au as Scale, av as ScaleConfig, aw as TIME_INTERVALS, ax as TimeScaleConfig, ay as getHatch } from './types-DdltSMkw.js';
1
+ import { k as Theme, t as RenderingContext, F as FlatSeriesStyle, T as TextMetrics, f as Marker } from './marker_renderer-VcAK5as0.js';
2
+ export { u as Layout, v as LayoutConfig, a as LayoutResult, w as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, x as measureLegend, y as renderLegend, z as renderSeriesMarkers, q as slugify } from './marker_renderer-VcAK5as0.js';
3
+ import { D as DataPoint, a as DrawCommand, t as AggregatedPoint, k as HatchVariant, f as Threshold, L as LinearScale, g as Gap, T as TimeScale, R as RangeLabelPosition, aa as GapBand, H as Highlight, i as Annotation, ab as LineParams, ac as PathParams, ad as RectParams, ae as CircleParams, af as TextParams, ag as GapParams, d as DrawGroup, z as AxisOrientation, A as AxisPosition, _ as MovingAverageType, ah as Point, E as EnumMap, ai as BandScale, S as SmoothingType, P as PointStyleType, r as AnnotationBandItem, c as LineVariant, X as LineShape, F as FillSpec, V as GapStyle, m as TimeSeries } from './types-D7tmWwH9.js';
4
+ export { aj as BandScaleConfig, ak as Dashstyle_t, al as DomainScaleConfig, am as DrawCircle, an as DrawGap, ao as DrawGapType_t, ap as DrawLine, aq as DrawPath, ar as DrawRect, as as DrawText, q as LabelAnchor, at as LinearScaleConfig, au as Scale, av as ScaleConfig, aw as TIME_INTERVALS, ax as TimeScaleConfig, ay as getHatch } from './types-D7tmWwH9.js';
5
5
  import { DataPoint as DataPoint$1 } from './analyze/index.js';
6
6
 
7
7
  /*!
@@ -249,6 +249,18 @@ interface AnnotationRenderConfig {
249
249
  * nach innen kippen -- ohne sie bleibt es bei `middle`.
250
250
  */
251
251
  metrics?: TextMetrics;
252
+ /**
253
+ * Die Zeichenflaeche. Gesetzt (wie im Diagramm), gilt: Was ausserhalb der
254
+ * Achsen liegt, landet nicht im Rand -- Beschriftungen und Punkte werden
255
+ * weggelassen, Linien, Pfeile und Rechtecke auf die Flaeche beschnitten
256
+ * (B-20261007-06). Ohne: wie bisher alles, unbeschnitten.
257
+ */
258
+ plot?: {
259
+ x: number;
260
+ y: number;
261
+ w: number;
262
+ h: number;
263
+ };
252
264
  }
253
265
  /**
254
266
  * Render free-form annotations (arrow, line, rect, point, label) given in
package/dist/internals.js CHANGED
@@ -1,30 +1,30 @@
1
- var Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((s,l)=>s.time-l.time),r=[],o=[],a=null;for(let s of n){let l=e(s),m=t>0&&a&&s.time-a.time>t;(l||m)&&o.length&&(r.push(o),o=[]),l||o.push(s),a=s;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((m,u)=>m-u),o=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let u=0;for(let h=0;h<r.length&&m>=r[h];h++)u=h+1;return u},l=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],h=i[m],c=t(u),f=t(h),d;f>c?d=r.filter(y=>y>c&&y<=f):f<c?d=r.filter(y=>y>=f&&y<c).reverse():d=[];let g=c;for(let y of d){let b=(y-c)/(f-c),x=n(u,h,b);l.push(x);let S=s((g+y)/2);o.push({data:l,zoneIndex:S,zoneLow:a(S)}),l=[x],g=y;}(d.length===0||d[d.length-1]!==f)&&l.push(h);}if(l.length>1||i.length===1){let m=t(l[0]),u=t(l[l.length-1]),h=s((m+u)/2);o.push({data:l,zoneIndex:h,zoneLow:a(h)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let a of r)a.zoneIndex===0?o.below.push(a.data):o.above.push(a.data);return o}};var be=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,l)=>s-l);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,l)=>s+l,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,l)=>s+Math.pow(l-n,2),0)/t,a=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:a,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function K(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function $e(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function _(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function Fe(i,e,t,n){let r=T.splitByThreshold(i,e,a=>a.value,T.interpolateDataPoint),o=[];return n.below&&o.push(...M(r.below.map(a=>({data:a})),t,n.below)),n.above&&o.push(...M(r.above.map(a=>({data:a})),t,n.above)),o}function M(i,e,t){let n=[],r=_(t);for(let o=0;o<i.length;o++){let a=i[o];a.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:a.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):a.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(a.data[0].time),cy:e.valueScale.map(a.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:a.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=_(t);for(let o=0;o<i.length;o++){let a=i[o];if(a.data.length<2)continue;let s=K(a.data.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function We(i,e,t,n,r){let o=[],a=_(t);for(let s=0;s<i.length;s++){let l=i[s];if(l.data.length<2)continue;let m=l.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n(h))})),u=l.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(r(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...u],fill:l.color??a.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=T.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let a=0;a<r.length;a++){let s=r[a];if(s.data.length<2)continue;let l=t.getColor(s.zoneIndex);if(!l)continue;let m=s.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yLow(h))})),u=s.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yHigh(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${a}`:void 0,points:[...m,...u],fill:l,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return o}function Q(i,e,t,n){let r=_(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let a=0;a<i.length;a++){let s=i[a],l=e.timeScale.map(s.time),m=e.valueScale.map(s.value),u=n(s),h=t.pointStroke??u,c=t.pointFill??u,f=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${a}`:void 0;ee(o,d,r.markers.type,l,m,r.markers.size,h,c,f);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,a,s,l){let m=u=>e===void 0?void 0:`${e}-${u}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:a,strokeWidth:l,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:a,strokeWidth:l,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:a,strokeWidth:l,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:a,strokeWidth:l,id:m(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "star":{let u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,f=Math.PI/2*3+h*Math.PI/5;u.push({x:n+c*Math.cos(f),y:r+c*Math.sin(f)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:a,strokeWidth:l,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:l,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:a,strokeWidth:l,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "hexagon":{let u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:n+o*Math.cos(c),y:r+o*Math.sin(c)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:l,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:a,strokeWidth:l,id:e});}}var je=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],xe=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of je){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function Se(i){return Oe.get(i)??xe}var j=(i,e)=>{let t=0;for(let n of i)t+=Se(n.codePointAt(0)??0);return t*e};var ke={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var Ie={...ke};function L(){return Ie}function Ee(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function He(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Te(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ee(t),a=He(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ var Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((s,a)=>s.time-a.time),r=[],o=[],l=null;for(let s of n){let a=e(s),m=t>0&&l&&s.time-l.time>t;(a||m)&&o.length&&(r.push(o),o=[]),a||o.push(s),l=s;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((m,u)=>m-u),o=[],l=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let u=0;for(let d=0;d<r.length&&m>=r[d];d++)u=d+1;return u},a=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],d=i[m],h=t(u),p=t(d),c;p>h?c=r.filter(y=>y>h&&y<=p):p<h?c=r.filter(y=>y>=p&&y<h).reverse():c=[];let g=h;for(let y of c){let b=(y-h)/(p-h),x=n(u,d,b);a.push(x);let S=s((g+y)/2);o.push({data:a,zoneIndex:S,zoneLow:l(S)}),a=[x],g=y;}(c.length===0||c[c.length-1]!==p)&&a.push(d);}if(a.length>1||i.length===1){let m=t(a[0]),u=t(a[a.length-1]),d=s((m+u)/2);o.push({data:a,zoneIndex:d,zoneLow:l(d)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let l of r)l.zoneIndex===0?o.below.push(l.data):o.above.push(l.data);return o}};var be=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,a)=>s-a);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,a)=>s+a,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,a)=>s+Math.pow(a-n,2),0)/t,l=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:l,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function K(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function $e(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function _(i){return {id:i.id,line:{stroke:i.stroke??f.stroke,strokeWidth:i.strokeWidth??f.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??f.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??f.pointSize,stroke:i.stroke??f.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function Fe(i,e,t,n){let r=T.splitByThreshold(i,e,l=>l.value,T.interpolateDataPoint),o=[];return n.below&&o.push(...M(r.below.map(l=>({data:l})),t,n.below)),n.above&&o.push(...M(r.above.map(l=>({data:l})),t,n.above)),o}function M(i,e,t){let n=[],r=_(t);for(let o=0;o<i.length;o++){let l=i[o];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:l.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(l.data[0].time),cy:e.valueScale.map(l.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:l.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=_(t);for(let o=0;o<i.length;o++){let l=i[o];if(l.data.length<2)continue;let s=K(l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function We(i,e,t,n,r){let o=[],l=_(t);for(let s=0;s<i.length;s++){let a=i[s];if(a.data.length<2)continue;let m=a.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(n(d))})),u=a.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(r(d))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...u],fill:a.color??l.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=T.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let l=0;l<r.length;l++){let s=r[l];if(s.data.length<2)continue;let a=t.getColor(s.zoneIndex);if(!a)continue;let m=s.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(t.yLow(d))})),u=s.data.map(d=>({x:e.timeScale.map(d.time),y:e.valueScale.map(t.yHigh(d))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${l}`:void 0,points:[...m,...u],fill:a,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return o}function Q(i,e,t,n){let r=_(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let l=0;l<i.length;l++){let s=i[l],a=e.timeScale.map(s.time),m=e.valueScale.map(s.value),u=n(s),d=t.pointStroke??u,h=t.pointFill??u,p=t.pointStrokeWidth??1.5,c=t.id?`${t.id}-marker-${l}`:void 0;ee(o,c,r.markers.type,a,m,r.markers.size,d,h,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,l,s,a){let m=u=>e===void 0?void 0:`${e}-${u}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:l,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:l,strokeWidth:a,id:m(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "star":{let u=[];for(let d=0;d<10;d++){let h=d%2===0?o:o*.5,p=Math.PI/2*3+d*Math.PI/5;u.push({x:n+h*Math.cos(p),y:r+h*Math.sin(p)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:l,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:l,strokeWidth:a,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "hexagon":{let u=[];for(let d=0;d<6;d++){let h=d*(Math.PI/3);u.push({x:n+o*Math.cos(h),y:r+o*Math.sin(h)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:s,stroke:l,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:l,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:l,strokeWidth:a,id:e});}}var je=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],xe=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of je){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function Se(i){return Oe.get(i)??xe}var j=(i,e)=>{let t=0;for(let n of i)t+=Se(n.codePointAt(0)??0);return t*e};var ke={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var Ie={...ke};function L(){return Ie}function Ee(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function He(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Te(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ee(t),l=He(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${i}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
5
- `.trim();let s=12,l=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":s=6,l=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":s=14,l=14,m="rotate(45)",u=`
6
- <line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
5
+ `.trim();let s=12,a=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":s=6,a=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":s=14,a=14,m="rotate(45)",u=`
6
+ <line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
7
7
  <line x1="0" y1="0" x2="${s}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
8
- `;break;case "dots":u=`<circle cx="${s/2}" cy="${l/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":s=16,l=16,u=`
9
- <path d="M 0 ${l/2} Q ${s/4} 0, ${s/2} ${l/2} T ${s} ${l/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
- `;break;case "dashed":m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":s=16,l=16,u=`
11
- <path d="M 0 0 L ${s/2} ${l/2} L 0 ${l} M ${s} 0 L ${s/2} ${l/2} L ${s} ${l}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":s=20,l=20,u=`
13
- <path d="M 0 ${l/2} L ${s} ${l/2} M 0 ${l} L ${s} ${l} M ${s/2} 0 L ${s/2} ${l/2} M 0 ${l/2} L 0 ${l}" fill="none" stroke="${o}" stroke-width="${r}" />
14
- `;break;case "double-stripe":s=16,l=16,m="rotate(45)",u=`
15
- <line x1="0" y1="0" x2="0" y2="${l}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
- <line x1="${s/2}" y1="0" x2="${s/2}" y2="${l}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":s=18,l=32,u=`
8
+ `;break;case "dots":u=`<circle cx="${s/2}" cy="${a/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":s=16,a=16,u=`
9
+ <path d="M 0 ${a/2} Q ${s/4} 0, ${s/2} ${a/2} T ${s} ${a/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
+ `;break;case "dashed":m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":s=16,a=16,u=`
11
+ <path d="M 0 0 L ${s/2} ${a/2} L 0 ${a} M ${s} 0 L ${s/2} ${a/2} L ${s} ${a}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
+ `;break;case "brick":s=20,a=20,u=`
13
+ <path d="M 0 ${a/2} L ${s} ${a/2} M 0 ${a} L ${s} ${a} M ${s/2} 0 L ${s/2} ${a/2} M 0 ${a/2} L 0 ${a}" fill="none" stroke="${o}" stroke-width="${r}" />
14
+ `;break;case "double-stripe":s=16,a=16,m="rotate(45)",u=`
15
+ <line x1="0" y1="0" x2="0" y2="${a}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
+ <line x1="${s/2}" y1="0" x2="${s/2}" y2="${a}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
+ `;break;case "honeycomb":s=18,a=32,u=`
18
18
  <path d="M 0 0 L ${s/2} 5 L ${s} 0 M 0 16 L ${s/2} 11 L ${s} 16 M 0 16 L 0 32 M ${s/2} 5 L ${s/2} 11 M ${s} 16 L ${s} 32 M 0 32 L ${s/2} 27 L ${s} 32 M ${s/2} 27 L ${s/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let h=`<rect width="${s}" height="${l}" fill="${t}"${a} />`;return `
20
- <pattern id="${i}" width="${s}" height="${l}" patternTransform="${m}" patternUnits="userSpaceOnUse">
21
- ${h}
19
+ `;break}let d=`<rect width="${s}" height="${a}" fill="${t}"${l} />`;return `
20
+ <pattern id="${i}" width="${s}" height="${a}" patternTransform="${m}" patternUnits="userSpaceOnUse">
21
+ ${d}
22
22
  ${u}
23
23
  </pattern>
24
- `.trim()}var p=new Proxy({},{get:(i,e)=>L()[e],has:(i,e)=>e in L(),ownKeys:()=>Reflect.ownKeys(L()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(L(),e)});var O=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var ze="#ffffff",Ge="#cccccc",Ve=6,Ne=.85,D=12,N=8,I=20,Xe=11,V=18,te=(i,e)=>e(i,Xe);function we(i,e,t){let n=s=>D+N+te(s.name,e);if(t===void 0){let s=i.reduce((l,m)=>l+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],a=0;for(let s of i){let l=n(s),m=o.length===0?l:a+V+l;o.length>0&&m>t?(r.push({items:o,breite:a}),o=[s],a=l):(o=[...o,s],a=m);}return o.length>0&&r.push({items:o,breite:a}),r}function ve(i,e="vertical",t=j,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((a,s)=>Math.max(a,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:D+N+r,height:i.length*I}}function Ye(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=j,maxBreite:a,box:s,itemClass:l}=i,m=new O;if(s&&e.length>0){let c=ve(e,r,o,a),d=((r==="horizontal"?c.height/I:e.length)-1)*I+D,g=s.padding??Ve,y=s.stroke??Ge;m.rect({x:t-g,y:n-g,w:c.width+2*g,h:d+2*g,fill:s.fill??ze,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ne});}let u=r==="horizontal"?we(e,o,a):e.map(c=>({items:[c],breite:0})),h=new Map;return u.forEach((c,f)=>{let d=t;for(let g of c.items)h.set(g,{x:d,y:n+f*I}),d+=D+N+te(g.name,o)+V;}),e.forEach(c=>{let f=h.get(c)??{x:t,y:n},d=f.x,g=f.y,y=["legend-item"];c.id&&y.push(`legend-item--${c.id}`),l&&y.push(l),m.group({cssClass:y.join(" "),...c.id?{id:`legend-${c.id}`}:{}},b=>{b.rect({x:d,y:g,w:D,h:D,fill:c.color,stroke:p.legendStroke,strokeWidth:1}).text({content:c.name,x:d+D+N,y:g+D-2,fontSize:p.legendFont,fill:p.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ue(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=p.gridStroke,strokeWidth:a=p.gridStrokeWidth,dashed:s=false,opacity:l=p.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:a,dashed:s,opacity:l});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:a,dashed:s,opacity:l});return m}var Ce=new Map;function Ze(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ze(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var A=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,a]=this.#t;return r===n?o:o+(t-n)/(r-n)*(a-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},w=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],E=class{#e;#t;#n;constructor(e){this.#e=new A({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),a=o-r;if(a<=0)return {interval:w[0].ms};let s=a/e,l=w[0].ms;for(let h of w)if(h.ms>=s){l=h.ms;break}let m=l,u=Math.round(a/m);for(;u>n&&m<w[w.length-1].ms;){let h=w.findIndex(c=>c.ms===m);m=w[Math.min(h+1,w.length-1)].ms,u=Math.round(a/m);}for(;u<t&&m>w[0].ms;){let h=w.findIndex(c=>c.ms===m);m=w[Math.max(h-1,0)].ms,u=Math.round(a/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,a]=this.#e.domain(),s=[],l=Math.ceil(o/r)*r;for(let m=l;m<=a;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},H=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(h=>String(h)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let a=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-a,l=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*l+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),a=Math.abs(e-o);a<n&&(n=a,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ke(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function qe(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[a,s]=t.range(),l=Math.min(a,s),m=Math.max(a,s),u=[],h=[];for(let c of e){let f=c.color??p.thresholdColor,d=t.map(c.value);c.fill==="above"?u.push({type:"rect",x:r,y:l,w:o-r,h:Math.max(0,d-l),fill:f,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&u.push({type:"rect",x:r,y:d,w:o-r,h:Math.max(0,m-d),fill:f,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let g=c.line??p.thresholdLine;if(g!=="none"){let S=Ke(g),k={type:"line",x1:r,y1:d,x2:o,y2:d,stroke:f,strokeWidth:1,...S,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(k.shadowColor=c.shadowColor,k.shadowBlur=c.shadowBlur??4,k.shadowOffsetX=c.shadowOffsetX??0,k.shadowOffsetY=c.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(c.value>=Math.min(y,b)&&c.value<=Math.max(y,b)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,k=typeof c.label=="string"?c.label:S?.text??c.name,C=S?.position??"right",W=et(k,C,r,o,d,f,S);h.push({...W,y:Qe(W.y,Math.min(a,s),Math.max(a,s),p.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function Je(i){let e=qe(i);return [...e.inside,...e.labels]}function Qe(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function et(i,e,t,n,r,o,a){let s=(t+n)/2,l={type:"text",content:i,fontSize:p.thresholdFontSize,fill:o},m=a?{...a.rotate!==void 0&&{rotate:a.rotate},...a.textBaseline!==void 0&&{textBaseline:a.textBaseline}}:{};switch(e){case "left":return {...l,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...l,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...l,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...l,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...l,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...l,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...l,...m,x:n-4,y:r-4,anchor:"end"}}}function Me(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=j}=i,[a,s]=n,l=[],[m,u]=t.range(),h=Math.min(m,u),c=Math.max(m,u),f=d=>Math.max(h,Math.min(c,d));for(let d of e){let g=f(t.map(d.startTime)),y=f(t.map(d.endTime));if(d.fill!==void 0&&l.push({type:"rect",x:g,y:a,w:y-g,h:s-a,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let b of [g,y])l.push({type:"line",x1:b,y1:a,x2:b,y2:s,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let b=d.labelPosition??"middle",x=d.rotate,S=true;if(x==="auto"){let k=b!=="above"&&b!=="below",C=o(d.label,d.fontSize??11);x=k&&C>Math.abs(y-g)-4?-90:void 0,S=x===void 0||C<=Math.abs(s-a)-4;}S&&l.push({type:"text",content:d.label,x:(g+y)/2,y:Me(b,a,s,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return l}function tt(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=p.gapFill,hatch:a,fillOpacity:s=p.gapFillOpacity??.15,stroke:l=p.gapStroke,strokeWidth:m=p.gapStrokeWidth,dashed:u=true,fontSize:h=p.gapFontSize,fontFill:c=p.gapFontColor,labelBaseline:f="middle",labelRotate:d,metrics:g,band:y}=i,b=()=>{if(!y)return [];let x=y.height??6,[S,k]=n,C=Math.max(S,k);return e.map(W=>{let ge=t.map(W.startTime),ye=t.map(W.endTime);return {type:"rect",x:Math.min(ge,ye),y:C-x+(y.offset??0),w:Math.abs(ye-ge),h:x,fill:y.fill??l,opacity:y.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",C=S==="dashed_border"&&u!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??a,opacity:x.fillOpacity??s},...C&&{edges:{stroke:l,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??f,labelColor:c,fontSize:h,rotate:x.rotate??d}})}).concat(b())}function nt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,a]=r,s=[];for(let l of e){let m=t.map(l.time),u=l.color??p.markerColor,h=l.pointStyle??(l.value!==void 0?"circle":"none"),c=l.lineStyle??"full";if(l.value!==void 0){let f=n.map(l.value);if(c==="to-value"?s.push({type:"line",x1:m,y1:a,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):c==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),h!=="none"&&ee(s,void 0,h,m,f,p.markerSize,u,u,1.5),l.label){let d=c==="to-value"?f-10:o-6;s.push({type:"text",content:l.label,x:m,y:d,anchor:"middle",fontSize:p.markerFontSize,fill:u});}}else c!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),l.label&&s.push({type:"text",content:l.label,x:m,y:o-6,anchor:"middle",fontSize:p.markerFontSize,fill:u});}return s}function rt(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??p.highlightColor,opacity:o.opacity??p.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:o.rotate}))})}function ot(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=a=>{let s=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:s?s.map(a.value):0}};for(let a of e){let s=[],l=m=>s.push(m);switch(a.type){case "line":{let m=o(a.from),u=o(a.to);l({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:a.color??p.annotationColor,strokeWidth:a.width??p.annotationWidth,dash:a.dash});break}case "arrow":{let m=o(a.from),u=o(a.to),h=a.color??p.annotationColor,c=a.headSize??p.annotationHead;l({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:h,strokeWidth:a.width??p.annotationWidth});let f=Math.hypot(u.x-m.x,u.y-m.y)||1,d=(u.x-m.x)/f,g=(u.y-m.y)/f,y=u.x-d*c,b=u.y-g*c;l({type:"path",points:[{x:u.x,y:u.y},{x:y-g*c*.5,y:b+d*c*.5},{x:y+g*c*.5,y:b-d*c*.5}],fill:h,stroke:"none"});break}case "rect":{let m=o(a.from),u=o(a.to);l({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let m=o(a.at),u=a.color??"#334155",h=a.radius??p.annotationRadius,c=a.shape??"circle";c==="circle"?l({type:"circle",cx:m.x,cy:m.y,r:h,fill:u}):c==="square"?l({type:"rect",x:m.x-h,y:m.y-h,w:h*2,h:h*2,fill:u}):(l({type:"line",x1:m.x-h,y1:m.y-h,x2:m.x+h,y2:m.y+h,stroke:u,strokeWidth:1.5}),l({type:"line",x1:m.x-h,y1:m.y+h,x2:m.x+h,y2:m.y-h,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(a.at);l({type:"text",content:a.text,x:m.x+(a.dx??0),y:m.y+(a.dy??0),anchor:a.anchor??it(m.x+(a.dx??0),a.text,i),fontSize:p.annotationFontSize,fill:a.color??p.annotationColor,rotate:a.rotate});break}}if(a.id&&s.length>0){let m=ne(a.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:s});}else r.push(...s);}return r}function it(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,a]=r.range(),s=n(e,p.annotationFontSize)/2;return i-s<o?"start":i+s>a?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
24
+ `.trim()}var f=new Proxy({},{get:(i,e)=>L()[e],has:(i,e)=>e in L(),ownKeys:()=>Reflect.ownKeys(L()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(L(),e)});var O=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var ze="#ffffff",Ge="#cccccc",Ve=6,Ne=.85,D=12,N=8,I=20,Xe=11,V=18,te=(i,e)=>e(i,Xe);function we(i,e,t){let n=s=>D+N+te(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=j,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:D+N+r,height:i.length*I}}function Ye(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=j,maxBreite:l,box:s,itemClass:a}=i,m=new O;if(s&&e.length>0){let h=ve(e,r,o,l),c=((r==="horizontal"?h.height/I:e.length)-1)*I+D,g=s.padding??Ve,y=s.stroke??Ge;m.rect({x:t-g,y:n-g,w:h.width+2*g,h:c+2*g,fill:s.fill??ze,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ne});}let u=r==="horizontal"?we(e,o,l):e.map(h=>({items:[h],breite:0})),d=new Map;return u.forEach((h,p)=>{let c=t;for(let g of h.items)d.set(g,{x:c,y:n+p*I}),c+=D+N+te(g.name,o)+V;}),e.forEach(h=>{let p=d.get(h)??{x:t,y:n},c=p.x,g=p.y,y=["legend-item"];h.id&&y.push(`legend-item--${h.id}`),a&&y.push(a),m.group({cssClass:y.join(" "),...h.id?{id:`legend-${h.id}`}:{}},b=>{b.rect({x:c,y:g,w:D,h:D,fill:h.color,stroke:f.legendStroke,strokeWidth:1}).text({content:h.name,x:c+D+N,y:g+D-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ue(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function Ze(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ze(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var A=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},w=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],E=class{#e;#t;#n;constructor(e){this.#e=new A({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:w[0].ms};let s=l/e,a=w[0].ms;for(let d of w)if(d.ms>=s){a=d.ms;break}let m=a,u=Math.round(l/m);for(;u>n&&m<w[w.length-1].ms;){let d=w.findIndex(h=>h.ms===m);m=w[Math.min(d+1,w.length-1)].ms,u=Math.round(l/m);}for(;u<t&&m>w[0].ms;){let d=w.findIndex(h=>h.ms===m);m=w[Math.max(d-1,0)].ms,u=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},H=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(d=>String(d)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ke(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function qe(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),u=[],d=[];for(let h of e){let p=h.color??f.thresholdColor,c=t.map(h.value);h.fill==="above"?u.push({type:"rect",x:r,y:a,w:o-r,h:Math.max(0,c-a),fill:p,hatch:h.fillHatch,opacity:h.fillOpacity??.12,id:h.id?`${h.id}-fill`:void 0}):h.fill==="below"&&u.push({type:"rect",x:r,y:c,w:o-r,h:Math.max(0,m-c),fill:p,hatch:h.fillHatch,opacity:h.fillOpacity??.12,id:h.id?`${h.id}-fill`:void 0});let g=h.line??f.thresholdLine;if(g!=="none"){let S=Ke(g),k={type:"line",x1:r,y1:c,x2:o,y2:c,stroke:p,strokeWidth:1,...S,id:h.id?`${h.id}-line`:void 0};h.shadowColor&&(k.shadowColor=h.shadowColor,k.shadowBlur=h.shadowBlur??4,k.shadowOffsetX=h.shadowOffsetX??0,k.shadowOffsetY=h.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(h.value>=Math.min(y,b)&&h.value<=Math.max(y,b)&&h.label!==void 0&&h.label!==null&&h.label!==false){let S=typeof h.label=="object"?h.label:void 0,k=typeof h.label=="string"?h.label:S?.text??h.name,v=S?.position??"right",W=et(k,v,r,o,c,p,S);d.push({...W,y:Qe(W.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:h.id?`${h.id}-label`:void 0});}}return {inside:u,labels:d}}function Je(i){let e=qe(i);return [...e.inside,...e.labels]}function Qe(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function et(i,e,t,n,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-4,anchor:"end"}}}function Me(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=j}=i,[l,s]=n,a=[],[m,u]=t.range(),d=Math.min(m,u),h=Math.max(m,u),p=c=>Math.max(d,Math.min(h,c));for(let c of e){let g=p(t.map(c.startTime)),y=p(t.map(c.endTime));if(c.fill!==void 0&&a.push({type:"rect",x:g,y:l,w:y-g,h:s-l,fill:c.fill,hatch:c.hatch,opacity:c.opacity}),c.edges)for(let b of [g,y])a.push({type:"line",x1:b,y1:l,x2:b,y2:s,stroke:c.edges.stroke,strokeWidth:c.edges.strokeWidth,dash:"dashed"});if(c.label){let b=c.labelPosition??"middle",x=c.rotate,S=true;if(x==="auto"){let k=b!=="above"&&b!=="below",v=o(c.label,c.fontSize??11);x=k&&v>Math.abs(y-g)-4?-90:void 0,S=x===void 0||v<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:c.label,x:(g+y)/2,y:Me(b,l,s,r),anchor:"middle",fontSize:c.fontSize,fill:c.labelColor,rotate:x});}}return a}function tt(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:u=true,fontSize:d=f.gapFontSize,fontFill:h=f.gapFontColor,labelBaseline:p="middle",labelRotate:c,metrics:g,band:y}=i,b=()=>{if(!y)return [];let x=y.height??6,[S,k]=n,v=Math.max(S,k);return e.map(W=>{let ge=t.map(W.startTime),ye=t.map(W.endTime);return {type:"rect",x:Math.min(ge,ye),y:v-x+(y.offset??0),w:Math.abs(ye-ge),h:x,fill:y.fill??a,opacity:y.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",v=S==="dashed_border"&&u!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??l,opacity:x.fillOpacity??s},...v&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??p,labelColor:h,fontSize:d,rotate:x.rotate??c}})}).concat(b())}function nt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,l]=r,s=[];for(let a of e){let m=t.map(a.time),u=a.color??f.markerColor,d=a.pointStyle??(a.value!==void 0?"circle":"none"),h=a.lineStyle??"full";if(a.value!==void 0){let p=n.map(a.value);if(h==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):h==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:p,stroke:u,strokeWidth:1,dashed:true}):h==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),d!=="none"&&ee(s,void 0,d,m,p,f.markerSize,u,u,1.5),a.label){let c=h==="to-value"?p-10:o-6;s.push({type:"text",content:a.label,x:m,y:c,anchor:"middle",fontSize:f.markerFontSize,fill:u});}}else h!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:u});}return s}function rt(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function ot(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function it(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||ot(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],u=p=>m.push(p);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let d=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),h=d?{clipRect:r}:{};switch(a.type){case "line":{let p=s(a.from),c=s(a.to);u({type:"line",x1:p.x,y1:p.y,x2:c.x,y2:c.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let p=s(a.from),c=s(a.to),g=a.color??f.annotationColor,y=a.headSize??f.annotationHead;u({type:"line",x1:p.x,y1:p.y,x2:c.x,y2:c.y,stroke:g,strokeWidth:a.width??f.annotationWidth});let b=Math.hypot(c.x-p.x,c.y-p.y)||1,x=(c.x-p.x)/b,S=(c.y-p.y)/b,k=c.x-x*y,v=c.y-S*y;u({type:"path",points:[{x:c.x,y:c.y},{x:k-S*y*.5,y:v+x*y*.5},{x:k+S*y*.5,y:v-x*y*.5}],fill:g,stroke:"none"});break}case "rect":{let p=s(a.from),c=s(a.to);u({type:"rect",x:Math.min(p.x,c.x),y:Math.min(p.y,c.y),w:Math.abs(c.x-p.x),h:Math.abs(c.y-p.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let p=s(a.at),c=a.color??"#334155",g=a.radius??f.annotationRadius,y=a.shape??"circle";y==="circle"?u({type:"circle",cx:p.x,cy:p.y,r:g,fill:c}):y==="square"?u({type:"rect",x:p.x-g,y:p.y-g,w:g*2,h:g*2,fill:c}):(u({type:"line",x1:p.x-g,y1:p.y-g,x2:p.x+g,y2:p.y+g,stroke:c,strokeWidth:1.5}),u({type:"line",x1:p.x-g,y1:p.y+g,x2:p.x+g,y2:p.y-g,stroke:c,strokeWidth:1.5}));break}case "label":{let p=s(a.at);u({type:"text",content:a.text,x:p.x+(a.dx??0),y:p.y+(a.dy??0),anchor:a.anchor??at(p.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let p=ne(a.id);o.push({type:"group",cssClass:`annotation annotation--${p}`,...h,commands:m});}else d&&m.length>0?o.push({type:"group",cssClass:"annotation",...h,commands:m}):o.push(...m);}return o}function at(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"start":i+s>l?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
25
25
  `);return `<clipPath id="${e}">
26
26
  ${t}
27
- </clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let a=1;a<=e;a++)t.push(r+(o-r)*a/(e+1));}return t}var z={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},G=class{#e;#t;constructor(e){this.#e=new E({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??z).axisColor}get tickColor(){return (this.#t.colors??z).tickColor}get textColor(){return (this.#t.colors??z).textColor}get textSize(){return (this.#t.colors??z).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??z,n=this.#t.y??0,r=[],[o,a]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:a,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let a=o(t,n)/2;return Math.max(a+2,Math.min(r-a-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function at(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ae=class{#e;#t;constructor(e){this.#e=new A({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??ie;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),a=Math.min(r,o),s=Math.max(r,o),l=s-a;if(l===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=l/n,u=Math.pow(10,Math.floor(Math.log10(m))),h=m/u,c;if(h<=1.5?c=u:h<=3?c=2*u:h<=7?c=5*u:c=10*u,c<=0||!Number.isFinite(c))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=g=>ie(g,c));let f=[],d=Math.ceil(a/c)*c;for(let g=d;g<=s;g+=c)f.push({value:g,position:this.#e.map(g),label:t(g)});return f}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",a=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,l=h=>a.some(c=>Math.abs(c-h)<=s),m=[];if(r==="vertical"){let[h,c]=this.#e.range();m.push({type:"line",x1:n,y1:h,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let f=at(e);e.forEach((d,g)=>{let y=l(d.position),b=f[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[h,c]=this.#e.range();m.push({type:"line",x1:h,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let f of e)m.push({type:"line",x1:f.position,y1:n,x2:f.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:f.label,x:f.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())m.push(u?{type:"line",x1:o==="right"?n:n-2,y1:h,x2:o==="right"?n+2:n,y2:h,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:h,y1:n,x2:h,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let a=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(a+2,Math.min(r-2,e)):Math.min(r-a-2,Math.max(2,e))}};var se=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,a)=>o.time-a.time),r=[];for(let o=0;o<n.length;o++){let a=Math.max(0,o-t+1),s=n.slice(a,o+1),l=s.reduce((m,u)=>m+u.value,0)/s.length;r.push({time:n[o].time,value:l});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,l)=>s.time-l.time);if(n.length===0)return [];let r=2/(t+1),o=[],a=n[0].value;o.push({time:n[0].time,value:a});for(let s=1;s<n.length;s++)a=n[s].value*r+a*(1-r),o.push({time:n[s].time,value:a});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var le=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new H({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((a,s)=>{let l=Number(a),m=t?e[l]??String(l):String(l),u=this.#e.map(l),h=n?p.palette[s%p.palette.length]:void 0;return {value:l,label:m,y:u,color:h,isGap:o.has(l)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return p.palette[t%p.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:p.textSize,fill:r.color??p.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var v=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var me=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??p.stroke,strokeWidth:e.strokeWidth??p.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??p.pointThreshold,r=e.gapThreshold??p.gapThreshold,o=e.id,a=T.getRuns(this.data,h=>h.value===null,r),s=a.reduce((h,c)=>h+c.length,0);if(s===0)return [];let l={timeScale:this.timeScale,valueScale:e.valueScale},m=a.map(h=>({data:h})),u=[];return u.push(...M(m,l,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&u.push(...Q(a.flat(),l,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),u}};var ue=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),a=e.map(t[r].value);r===0?n.push({x:o,y:a}):n.push({x:o,y:n[n.length-1].y},{x:o,y:a});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??p.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??p.bandAvgLine,a=e.bandWidth??10,s=[];for(let l of this.data){if(l.min===null||l.max===null)continue;let m=this.timeScale.map(l.time),u=e.valueScale.map(l.max),h=e.valueScale.map(l.min),c=a,f=this.data.indexOf(l);if(s.push({type:"rect",x:m-c/2,y:u,w:c,h:h-u,fill:t,hatch:n,opacity:this.opacity(l.count),id:this.id?`${this.id}-slot-${f}`:void 0}),r&&l.avg!==null){let d=e.valueScale.map(l.avg);s.push({type:"line",x1:m-c/2,y1:d,x2:m+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${f}`:void 0});}}return s}};function Le(i,e,t,n,r,o,a){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...a})}var he=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,r=e.avgColor??p.avgColor,o=e.avgDashed??true,a=e.smoothing??false,s=e.smoothingType,l=e.strokeWidth??p.strokeWidth,m=T.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];m.forEach((d,g)=>{if(d.length<2)return;let y=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Le(d,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:a,smoothingType:s});h.push(...b);}if(e.fillToMin){let b=Le(d,u,x=>x.min,e.fillToMin,e.fillToMinHatch,y("fillToMin"),{smoothing:a,smoothingType:s});h.push(...b);}});let c=m.filter(d=>d.length>=2),f=(d,g,y,b=false)=>M(c.map(x=>({data:x.map(S=>({time:S.time,value:d(S)}))})),u,{stroke:g,strokeWidth:l,smoothing:a,smoothingType:s,dashed:b,id:this.id?`${this.id}-${y}`:void 0});return h.push(...f(d=>d.max,n,"max"),...f(d=>d.min,t,"min"),...f(d=>d.avg,r,"avg",o)),h}};var st=1,de=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:a,y:s,height:l}=this.#e,m=[];n&&m.push({type:"rect",x:a[0],y:s,w:a[1]-a[0],h:l,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let h=t.map(u.startTime),c=t.map(u.endTime);if(c<a[0]||h>a[1])continue;let f=Math.max(a[0],Math.min(a[1],h)),d=Math.max(a[0],Math.min(a[1],c)),g=Math.max(d-f,st);f+g>a[1]&&(f=Math.max(a[0],a[1]-g));let y=f+g/2;if(m.push({type:"rect",x:f,y:s,w:g,h:l,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new G({domain:t.domain(),xRange:a,y:s+l+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:a=true,showMedian:s=false,labelPosition:l="end",lineColor:m=p.statsLineColor,labelColor:u=p.statsLabelColor}=this.#e,h=be.compute(e),c=[{name:"min",value:h.min,enabled:r},{name:"max",value:h.max,enabled:o},{name:"avg",value:h.avg,enabled:a},{name:"median",value:h.median,enabled:s}],f=[],[d,g]=n;for(let y of c.filter(b=>b.enabled)){let b=t.map(y.value);f.push({type:"line",x1:d,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let x=`${y.name}: ${y.value.toFixed(1)}`;(l==="start"||l==="both")&&f.push({type:"text",content:x,x:d+4,y:b-4,anchor:"start",fontSize:p.statFontSize,fill:u}),(l==="end"||l==="both")&&f.push({type:"text",content:x,x:g-4,y:b-4,anchor:"end",fontSize:p.statFontSize,fill:u}),l==="center"&&f.push({type:"text",content:x,x:(d+g)/2,y:b-4,anchor:"middle",fontSize:p.statFontSize,fill:u});}return f}};var R=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return B(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return B(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,a=36e5,s=6e4,l={};return r<s?(l.second="2-digit",l.minute="2-digit",l.hour="2-digit"):r<a?(l.minute="2-digit",l.hour="2-digit"):r<o?(l.hour="2-digit",l.minute="2-digit"):r<7*o?(l.weekday="short",l.day="numeric"):r<365*o?(l.month="short",l.day="numeric"):(l.month="short",l.year="numeric"),{...n,...l}}};var $=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var F=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var lt={time:new R,value:new $,enum:new F};function fe(i,e){let t=L();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function De(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=L(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Ae(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function Pe(i){return i.style?.gap}function Re(i){return i.style?.fill}function mt(i){return {lines:De(i),fill:Re(i),markers:_e(i),shadow:Ae(i),gap:Pe(i),id:i.style?.id??i.id}}/*!
27
+ </clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let l=1;l<=e;l++)t.push(r+(o-r)*l/(e+1));}return t}var z={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},G=class{#e;#t;constructor(e){this.#e=new E({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??z).axisColor}get tickColor(){return (this.#t.colors??z).tickColor}get textColor(){return (this.#t.colors??z).textColor}get textSize(){return (this.#t.colors??z).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??z,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,n)/2;return Math.max(l+2,Math.min(r-l-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function st(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ae=class{#e;#t;constructor(e){this.#e=new A({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??ie;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=a/n,u=Math.pow(10,Math.floor(Math.log10(m))),d=m/u,h;if(d<=1.5?h=u:d<=3?h=2*u:d<=7?h=5*u:h=10*u,h<=0||!Number.isFinite(h))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=g=>ie(g,h));let p=[],c=Math.ceil(l/h)*h;for(let g=c;g<=s;g+=h)p.push({value:g,position:this.#e.map(g),label:t(g)});return p}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=d=>l.some(h=>Math.abs(h-d)<=s),m=[];if(r==="vertical"){let[d,h]=this.#e.range();m.push({type:"line",x1:n,y1:d,x2:n,y2:h,stroke:t.axisColor,strokeWidth:t.axisWidth});let p=st(e);e.forEach((c,g)=>{let y=a(c.position),b=p[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:c.position,x2:n,y2:c.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:c.label,x:this.#n(n-8,c.label,"end"),y:c.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:c.position,x2:n+4,y2:c.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:c.label,x:this.#n(n+8,c.label,"start"),y:c.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[d,h]=this.#e.range();m.push({type:"line",x1:d,y1:n,x2:h,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let p of e)m.push({type:"line",x1:p.position,y1:n,x2:p.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:p.label,x:p.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let d of this.generateMinorTicks())m.push(u?{type:"line",x1:o==="right"?n:n-2,y1:d,x2:o==="right"?n+2:n,y2:d,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:d,y1:n,x2:d,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-l-2,Math.max(2,e))}};var se=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,u)=>m+u.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var le=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new H({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),u=this.#e.map(a),d=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:u,color:d,isGap:o.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var C=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var me=class extends C{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,r=e.gapThreshold??f.gapThreshold,o=e.id,l=T.getRuns(this.data,d=>d.value===null,r),s=l.reduce((d,h)=>d+h.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(d=>({data:d})),u=[];return u.push(...M(m,a,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&u.push(...Q(l.flat(),a,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),u}};var ue=class extends C{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends C{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??f.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),u=e.valueScale.map(a.max),d=e.valueScale.map(a.min),h=l,p=this.data.indexOf(a);if(s.push({type:"rect",x:m-h/2,y:u,w:h,h:d-u,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${p}`:void 0}),r&&a.avg!==null){let c=e.valueScale.map(a.avg);s.push({type:"line",x1:m-h/2,y1:c,x2:m+h/2,y2:c,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...l})}var he=class extends C{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,r=e.avgColor??f.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=T.getRuns(this.data,c=>c.min===null||c.max===null||c.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},d=[];m.forEach((c,g)=>{if(c.length<2)return;let y=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Le(c,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:l,smoothingType:s});d.push(...b);}if(e.fillToMin){let b=Le(c,u,x=>x.min,e.fillToMin,e.fillToMinHatch,y("fillToMin"),{smoothing:l,smoothingType:s});d.push(...b);}});let h=m.filter(c=>c.length>=2),p=(c,g,y,b=false)=>M(h.map(x=>({data:x.map(S=>({time:S.time,value:c(S)}))})),u,{stroke:g,strokeWidth:a,smoothing:l,smoothingType:s,dashed:b,id:this.id?`${this.id}-${y}`:void 0});return d.push(...p(c=>c.max,n,"max"),...p(c=>c.min,t,"min"),...p(c=>c.avg,r,"avg",o)),d}};var lt=1,de=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let d=t.map(u.startTime),h=t.map(u.endTime);if(h<l[0]||d>l[1])continue;let p=Math.max(l[0],Math.min(l[1],d)),c=Math.max(l[0],Math.min(l[1],h)),g=Math.max(c-p,lt);p+g>l[1]&&(p=Math.max(l[0],l[1]-g));let y=p+g/2;if(m.push({type:"rect",x:p,y:s,w:g,h:a,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new G({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:u=f.statsLabelColor}=this.#e,d=be.compute(e),h=[{name:"min",value:d.min,enabled:r},{name:"max",value:d.max,enabled:o},{name:"avg",value:d.avg,enabled:l},{name:"median",value:d.median,enabled:s}],p=[],[c,g]=n;for(let y of h.filter(b=>b.enabled)){let b=t.map(y.value);p.push({type:"line",x1:c,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let x=`${y.name}: ${y.value.toFixed(1)}`;(a==="start"||a==="both")&&p.push({type:"text",content:x,x:c+4,y:b-4,anchor:"start",fontSize:f.statFontSize,fill:u}),(a==="end"||a==="both")&&p.push({type:"text",content:x,x:g-4,y:b-4,anchor:"end",fontSize:f.statFontSize,fill:u}),a==="center"&&p.push({type:"text",content:x,x:(c+g)/2,y:b-4,anchor:"middle",fontSize:f.statFontSize,fill:u});}return p}};var R=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return B(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return B(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var $=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var F=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var mt={time:new R,value:new $,enum:new F};function fe(i,e){let t=L();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function De(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=L(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Ae(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function Pe(i){return i.style?.gap}function Re(i){return i.style?.fill}function ut(i){return {lines:De(i),fill:Re(i),markers:_e(i),shadow:Ae(i),gap:Pe(i),id:i.style?.id??i.id}}/*!
28
28
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
29
29
  * MIT with Attribution: free use incl. commercial requires visible credit to
30
30
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
@@ -43,4 +43,4 @@ var Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time
43
43
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
44
44
  * MIT with Attribution: free use incl. commercial must have visible credit to
45
45
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
46
- */export{de as AnnotationBandSeries,H as BandScale,ce as BandSeries,oe as Clip,O as CommandBuilder,le as EnumAxis,F as EnumFormatter,lt as Formatters,re as Layout,me as LineSeries,A as LinearScale,he as MinMaxAvgSeries,se as MovingAvg,Z as Renderer,pe as StatsOverlay,ue as StepSeries,w as TIME_INTERVALS,G as TimeAxis,R as TimeFormatter,E as TimeScale,ae as ValueAxis,$ as ValueFormatter,Te as getHatch,ve as measureLegend,ot as renderAnnotations,We as renderArea,tt as renderGaps,Ue as renderGrid,rt as renderHighlights,Ye as renderLegend,M as renderLine,nt as renderMarkers,Q as renderSeriesMarkers,Fe as renderSplitLine,q as renderStep,Je as renderThresholds,J as renderZonedArea,Re as resolveFill,Pe as resolveGap,De as resolveLines,_e as resolveMarkers,mt as resolveSeriesStyle,Ae as resolveShadow,ne as slugify,p as theme,$e as toStepData,K as toStepPoints};
46
+ */export{de as AnnotationBandSeries,H as BandScale,ce as BandSeries,oe as Clip,O as CommandBuilder,le as EnumAxis,F as EnumFormatter,mt as Formatters,re as Layout,me as LineSeries,A as LinearScale,he as MinMaxAvgSeries,se as MovingAvg,Z as Renderer,pe as StatsOverlay,ue as StepSeries,w as TIME_INTERVALS,G as TimeAxis,R as TimeFormatter,E as TimeScale,ae as ValueAxis,$ as ValueFormatter,Te as getHatch,ve as measureLegend,it as renderAnnotations,We as renderArea,tt as renderGaps,Ue as renderGrid,rt as renderHighlights,Ye as renderLegend,M as renderLine,nt as renderMarkers,Q as renderSeriesMarkers,Fe as renderSplitLine,q as renderStep,Je as renderThresholds,J as renderZonedArea,Re as resolveFill,Pe as resolveGap,De as resolveLines,_e as resolveMarkers,ut as resolveSeriesStyle,Ae as resolveShadow,ne as slugify,f as theme,$e as toStepData,K as toStepPoints};
@@ -1,4 +1,4 @@
1
- import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, T as TimeScale, L as LinearScale, S as SmoothingType, k as HatchVariant, D as DataPoint } from './types-DdltSMkw.js';
1
+ import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, T as TimeScale, L as LinearScale, S as SmoothingType, k as HatchVariant, D as DataPoint } from './types-D7tmWwH9.js';
2
2
 
3
3
  /** Output format type for the renderer (SVG string, Canvas, or nothing). */
4
4
  type RenderType = "svg" | "canvas" | "none";
@@ -922,6 +922,10 @@ interface TimeSeries {
922
922
  * Art der Messgroesse. Der Daten-Adapter (`parseJSON`) liest sie und legt
923
923
  * sie ab; auf das BILD wirkt sie nicht -- die Darstellung bestimmen `style`
924
924
  * und `showAs`. Vorgabe: 'numeric'.
925
+ *
926
+ * @deprecated Has no effect on the chart (B-20260922-04). For a state
927
+ * series use `enumMap` -- it labels the axis with the state names. Will be
928
+ * removed before 2.0.
925
929
  */
926
930
  sensorType?: SensorType;
927
931
  enumMap?: EnumMap;
@@ -995,6 +999,12 @@ interface Gap {
995
999
  labelBaseline?: RangeLabelPosition;
996
1000
  /** Drehung in Grad, oder "auto": drehen, wenn der Text nicht hineinpasst. */
997
1001
  rotate?: number | "auto";
1002
+ /**
1003
+ * How the gap is drawn. `"label"` is deprecated (B-20261006-01) and will
1004
+ * be removed before 2.0: it is not a look of its own but the absence of
1005
+ * one -- use `"empty"` with `label`. The structured form
1006
+ * (`gaps: { regions, style: { display } }`) never had it.
1007
+ */
998
1008
  style?: DrawGapType_t;
999
1009
  }
1000
1010
  /** Configuration for gap rendering (manual or auto-detected) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-time-graph",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "TypeScript library for time-series charts with rich contextual annotation — telemetry, sensors, metrics, logs, finance. DOM-free SVG output, identical in the browser and on the server.",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",