ml-time-graph 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -19,6 +19,22 @@ release notes, and every change is in `git log` in full.
19
19
 
20
20
  ---
21
21
 
22
+ ## [1.14.0] - 2026-10-07
23
+
24
+ ### Added
25
+ - **`chart.plotRect`** (TS) / **`PlotRect()`** (Go) — the plot area the series are drawn into.
26
+ - **`autoMargin(options)`** (TS) / **`chart.AutoMargin()`** (Go) — margins that fit what the chart
27
+ draws (tick labels, axis titles, stacked axes, outside threshold labels). Measured on the draw
28
+ commands, no DOM, a few ms; same result in both ports.
29
+ - **`chart.pointsAt(x, y)`** (TS) / **`PointsAt()`** (Go) — the points under the pointer, as data
30
+ for your own tooltip: per visible series the one nearest in time; aggregated series give their
31
+ bucket. Same rules in both ports, checked against a shared fixture.
32
+
33
+ ### Fixed
34
+ - **`chart.layout` ignored an outside legend** (TypeScript). It returned the plot area before the
35
+ legend reserved its margin, while the scales used the shifted one — a brush zoom computed from it
36
+ picked a different time range than it showed.
37
+
22
38
  ## [1.13.0] - 2026-10-07
23
39
 
24
40
  ### Added
package/SKILLS.md CHANGED
@@ -433,6 +433,11 @@ chart.renderCommands();
433
433
  const timeMs = chart.invertTime(pixelX);
434
434
  const value = chart.invertValue(pixelY, yAxisIndex);
435
435
  const { x, y } = chart.project(timeMs, value, yAxisIndex);
436
+
437
+ // The plot area the scales map onto (an outside legend included):
438
+ const { x: px0, y: py0, width, height } = chart.plotRect;
439
+ // Data for your own tooltip — per visible series the point nearest in time:
440
+ const points = chart.pointsAt(pixelX, pixelY, { hidden: ['flow'] });
436
441
  ```
437
442
 
438
443
  ### Server-Side Rendering (Node.js)
@@ -522,7 +527,7 @@ scratch image.
522
527
  ## Traps (Read Before Coding)
523
528
 
524
529
  - **Timestamps are numbers, not Date objects:** `time` is always milliseconds since Unix epoch (`number`). Passing a `Date` object fails typechecking or evaluates to `NaN`.
525
- - **Labels are not measured (fixed margins):** The renderer has no DOM and cannot compute text bounding boxes. Margins default to `{ top: 20, right: 20, bottom: 40, left: 60 }`. If you add a right Y-axis or formatted units (e.g. `120.5 °C`), `right: 20` will clip the labels against the SVG edge. A clipped number is a wrong number, not an incomplete one (`120` clipped to `20`). Always set `margin.right` explicitly (e.g. 70–90 px) when using right axes.
530
+ - **Margins are fixed unless you measure them:** The chart draws into `margin` (default `{ top: 20, right: 20, bottom: 40, left: 60 }`). A right Y-axis or a formatted unit (`120.5 °C`) does not fit into `right: 20`, and a clipped number is a wrong number (`120` clipped to `20`). Use `margin: autoMargin(options)` — it measures the labels the chart actually draws (no DOM, a few ms) — or set the margins yourself.
526
531
  - **`resolveDash()` vs `getLineStyle()`:** `dashed` and `dotted` predate the scalable dash table and keep fixed SVG patterns (`"4,4"` and `"2,4"`) in the renderer for backwards compatibility. `getLineStyle()` returns the scalable table (`"6, 4"` for width 2). Anyone rendering custom legend swatches must call `resolveDash(variant, width)` so the swatch matches what is actually drawn.
527
532
  - **Markers do not inherit `line.width`:** `style.markers` carries its own pen — `strokeWidth`, `stroke`, `fill`. That is usually what you want (a 10 px line with 10 px marker outlines is a blob), but it means a marker stays hairline-thin when the line gets thick, and nothing tells you. Set `markers.strokeWidth` explicitly whenever `line.width` leaves the default.
528
533
  - **Marker suppression at threshold:** `style.markers.threshold` (and default `theme.pointThreshold = 100`) hides point markers when series sample count exceeds it to prevent visual crowding. Crucially, `chart.legendItems()` also omits the `marker` property when points are suppressed, because a symbol in the legend missing from the curve states something untrue.
package/USAGE.md CHANGED
@@ -480,6 +480,27 @@ widest stroke plus a little is a good rule of thumb. An explicit `domain` is lef
480
480
  alone, and padding that does not fit the chart height is ignored rather than
481
481
  producing an inverted scale.
482
482
 
483
+ ### Margins that fit — `autoMargin`
484
+
485
+ The chart draws into fixed margins. When they are too narrow, labels are cut, and a cut number
486
+ is a wrong number (`-80` becomes `-8`). `autoMargin(options)` returns margins that fit what the
487
+ chart actually draws — tick labels, axis titles, stacked axes, threshold labels `outside-*`:
488
+
489
+ ```ts
490
+ import { MLTimeGraph, autoMargin } from 'ml-time-graph';
491
+
492
+ const chart = new MLTimeGraph({ ...options, margin: autoMargin(options) });
493
+ ```
494
+
495
+ - **Measured, not estimated:** it renders the chart and measures the draw commands, with the
496
+ options' `textMetrics` (default `liberationMetrics`). No DOM.
497
+ - **A helper, not an option:** `margin` stays numbers. Call it once per change of the options —
498
+ a few milliseconds, independent of the amount of data (it draws only each series' extreme
499
+ points, which is what the axes are made of).
500
+ - A legend `outside-*` reserves its room on top, as before. `{ padding, minimum }` tune the air
501
+ (default 4 px) and the least any side gets (default 8 px).
502
+ - The Go port has the same function (`chart.AutoMargin`) and gives the same margins.
503
+
483
504
  ### Multi-Axis Layout (N Stacked Y-Axes)
484
505
 
485
506
  To support 3 or more vertical axes (or arbitrary left/right positioning), define `axes.y: YAxisConfig[]` and assign series using `yAxisIndex`:
@@ -890,10 +911,33 @@ Options: `format` (HTML; default = time header + `name: value` rows),
890
911
  the `.mlc-tooltip` CSS class — **don't set `transform`**; placement (incl. the
891
912
  flip) is computed in JS.
892
913
 
914
+ ### Points under the pointer — `pointsAt` (your own tooltip)
915
+
916
+ When the tooltip is your own component (a Svelte snippet, a React element) it needs
917
+ data, not HTML. `chart.pointsAt(x, y, options?)` returns it, in SVG pixels, after
918
+ `renderCommands()`:
919
+
920
+ ```ts
921
+ chart.renderCommands();
922
+ const points = chart.pointsAt(px, py, { radius: 20, hidden: ['flow'] });
923
+ // [{ seriesId, name, axisIndex, time, value, x, y, distance }, …]
924
+ ```
925
+
926
+ The rules, the same in the Go port (`PointsAt`):
927
+
928
+ - per visible series at most one point — the one nearest in **time**, within `radius`
929
+ pixels horizontally (default 20); on a tie the nearer one, then the earlier;
930
+ - gaps (`value: null`), `synthetic` points and series listed in `hidden` (by `id`,
931
+ or `name` when there is none) do not count;
932
+ - an aggregated series gives its bucket — `min`, `max`, `avg`, `count` — never a
933
+ made-up single value; its `distance` is measured to the min..max band;
934
+ - sorted by distance to the pointer; outside the plot area there is nothing.
935
+
893
936
  ### Zoom / pan
894
937
 
895
938
  Zoom, pan and minimap are **not** baked into the chart. Map pixels back to data
896
- with `chart.invertTime(px)` / `chart.invertValue(py, axisIndex)` and wire the
939
+ with `chart.invertTime(px)` / `chart.invertValue(py, axisIndex)` — the plot area
940
+ they map onto is `chart.plotRect` — and wire the
897
941
  interaction in your app, or pull the optional `Zoom` / `Minimap` helpers from the
898
942
  [`ml-time-graph/interaction`](#package-exports) subpath. See the demo gallery's
899
943
  "Fridge" (range slider) and "Interaction" pages.
package/dist/index.d.ts CHANGED
@@ -3,6 +3,43 @@ export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyl
3
3
  import { d as AnySeries, h as Annotation, a as DrawCommand, T as TimeScale, L as LinearScale, f as Gap, g as GapsConfig, e as Threshold, H as Highlight, i as AnnotationBandConfig, k as SeriesStyle, b as LineVariant, S as SmoothingType, F as FillSpec, l as TimeSeries, m as LineDashStyle, n as ThresholdFill, j 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 './scale-CDPJGYpZ.js';
4
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 GapConfig, O as GapLabel, Q as GapRegion, U as GapStyle, G as GridLayer, V as LineShape, W as LineStyle, X as MarkerStyle, Y as MovingAverageType, Z as SVGLineStyle, _ as SensorType, $ as SeriesOverlay, a0 as SeriesOverlayKind, a1 as SeriesType, a2 as ShadowStyle, a3 as SolidDashStyle, a4 as ThresholdLabelConfig, a5 as getLineStyle, a6 as resolveDash } from './scale-CDPJGYpZ.js';
5
5
 
6
+ /*!
7
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
8
+ * MIT with Attribution: free use incl. commercial requires visible credit to
9
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
10
+ */
11
+
12
+ /** One series' point under the pointer. */
13
+ interface PointAt {
14
+ /** The series' `id`, or its `name` when it has none -- the key for `hidden`. */
15
+ seriesId: string;
16
+ name: string;
17
+ axisIndex: number;
18
+ /** Time of the point (ms). */
19
+ time: number;
20
+ /** The measured value -- raw series only. */
21
+ value?: number;
22
+ /** The bucket of an aggregated series -- never a made-up single value. */
23
+ min?: number;
24
+ max?: number;
25
+ avg?: number;
26
+ count?: number;
27
+ /** Screen position in SVG pixels; for a bucket, `y` is its average. */
28
+ x: number;
29
+ y: number;
30
+ /** Distance to the pointer in pixels; for a bucket, to its min..max band. */
31
+ distance: number;
32
+ }
33
+ interface PointsAtOptions {
34
+ /**
35
+ * How far (horizontally, in pixels) a point may lie from the pointer.
36
+ * Default: the theme's `tooltipSnapRadius` (20).
37
+ */
38
+ radius?: number;
39
+ /** Series ids (see {@link PointAt.seriesId}) the user has hidden. */
40
+ hidden?: Iterable<string>;
41
+ }
42
+
6
43
  /*!
7
44
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
8
45
  * MIT with Attribution: free use incl. commercial requires visible credit to
@@ -65,6 +102,18 @@ declare class MLTimeGraph {
65
102
  enableAnnotation(id: string): void;
66
103
  private _axisIndexOf;
67
104
  private _timesOf;
105
+ /**
106
+ * Das Layout, mit dem tatsaechlich gezeichnet wird, samt der aufgeloesten
107
+ * Legende.
108
+ *
109
+ * Eine Legende ausserhalb der Zeichenflaeche verschiebt die Raender; die
110
+ * Skalen werden aus DIESEM Layout gebaut. Bis 07.10.2026 rechnete nur
111
+ * renderCommands es aus, und der Getter `layout` lieferte das aus dem
112
+ * Konstruktor -- wer daraus eine Mausposition in Zeit umrechnete
113
+ * (Brush-Zoom), lag um die Legendenbreite daneben (B-20261007-04). Eine
114
+ * Stelle fuer beide, damit sie nicht wieder auseinanderlaufen.
115
+ */
116
+ private _layoutMitLegende;
68
117
  /**
69
118
  * Compute the chart's renderer-agnostic draw commands.
70
119
  */
@@ -97,9 +146,37 @@ declare class MLTimeGraph {
97
146
  private _palettenFarbe;
98
147
  private _legendItems;
99
148
  get renderer(): Renderer | undefined;
149
+ /**
150
+ * The layout the chart is drawn with -- margins included that an outside
151
+ * legend reserves. Matches the scales, so `invertTime(layout.chartX)` is the
152
+ * start of the time domain.
153
+ */
100
154
  get layout(): LayoutResult;
155
+ /**
156
+ * The plot area in SVG pixels: where the series are drawn and what the
157
+ * scales map onto. Use it to turn a pointer position into time and value
158
+ * (with `invertTime` / `invertValue`) or to place an overlay.
159
+ */
160
+ get plotRect(): {
161
+ x: number;
162
+ y: number;
163
+ width: number;
164
+ height: number;
165
+ };
101
166
  get timeScale(): TimeScale | undefined;
102
167
  get valueScales(): Map<number, LinearScale>;
168
+ /**
169
+ * The points under the pointer at (x, y), in SVG pixels -- for a tooltip
170
+ * that gets data instead of HTML. Valid after `renderCommands()`, like
171
+ * `invertTime`.
172
+ *
173
+ * Per visible series at most one: the point nearest in TIME, within
174
+ * `radius` pixels horizontally. Gaps, synthetic points and hidden series do
175
+ * not count; an aggregated series gives its bucket (min/max/avg), not a
176
+ * made-up single value. Sorted by distance to the pointer. Outside the plot
177
+ * area there is nothing. Same rules in the Go port (`PointsAt`).
178
+ */
179
+ pointsAt(x: number, y: number, options?: PointsAtOptions): PointAt[];
103
180
  invertTime(x: number): number;
104
181
  invertValue(y: number, axisIndex?: number): number;
105
182
  project(time: number, value: number, axisIndex?: number): {
@@ -108,6 +185,34 @@ declare class MLTimeGraph {
108
185
  };
109
186
  }
110
187
 
188
+ /*!
189
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
190
+ * MIT with Attribution: free use incl. commercial requires visible credit to
191
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
192
+ */
193
+
194
+ interface AutoMarginOptions {
195
+ /** Air between the outermost element and the canvas edge, in px. Default (and 0): 4. */
196
+ padding?: number;
197
+ /** No side gets less than this, in px. Default (and 0): 8. */
198
+ minimum?: number;
199
+ }
200
+ /**
201
+ * Raender, die zu dem passen, was das Diagramm tatsaechlich zeichnet: Achsen-
202
+ * beschriftungen, Achsentitel, aussenliegende Grenzwert-Beschriftungen.
203
+ * Gemessen an den Zeichenbefehlen, mit den Textmetriken der Optionen (Vorgabe
204
+ * `liberationMetrics`) -- ohne DOM.
205
+ *
206
+ * Use the result as `margin`, once per change of the options:
207
+ *
208
+ * ```ts
209
+ * const chart = new MLTimeGraph({ ...options, margin: autoMargin(options) });
210
+ * ```
211
+ *
212
+ * A legend outside the plot reserves its own room on top, as before.
213
+ */
214
+ declare function autoMargin(options: MLTimeGraphOptions, opts?: AutoMarginOptions): Margin;
215
+
111
216
  /*!
112
217
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
113
218
  * MIT with Attribution: free use incl. commercial requires visible credit to
@@ -852,6 +957,6 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
852
957
  * Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
853
958
  * kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
854
959
  */
855
- declare const VERSION = "1.13.0";
960
+ declare const VERSION = "1.14.0";
856
961
 
857
- export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, AxesConfig, 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, PointStyleType, 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, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
962
+ export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, type AutoMarginOptions, AxesConfig, 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, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function U(n){return n===true?{major:{}}:n===false?{major:false}:n}var se=class n{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:r}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-r.left-r.right,chartHeight:t-r.top-r.bottom,chartX:r.left,chartY:r.top,margin:r}}static default(e=800,t=400){return new n({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function z(n){return n&&n.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var Zt=(()=>{let n=new Array(256);for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;n[e]=t>>>0;}return n})();function Fe(n){let e=new TextEncoder().encode(n),t=4294967295;for(let r of e)t=Zt[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function H(n,e){return e||"s-"+Fe(n??"").toString(16).padStart(8,"0")}var Ze=new Map;function Kt(n,e){return `${n}|${JSON.stringify(e??{})}`}function Ke(n,e){let t=Kt(n,e),r=Ze.get(t);return r||(r=new Intl.DateTimeFormat(n,e),Ze.set(t,r)),r}var Z=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[r,i]=this.#e,[o,s]=this.#t;return i===r?o:o+(t-r)/(i-r)*(s-o)}invert(e){let[t,r]=this.#e,[i,o]=this.#t;return o===i?t:t+(e-i)/(o-i)*(r-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}],J=class{#e;#t;#n;constructor(e){this.#e=new Z({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"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,r=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:W[0].ms};let a=s/e,m=W[0].ms;for(let u of W)if(u.ms>=a){m=u.ms;break}let l=m,h=Math.round(s/l);for(;h>r&&l<W[W.length-1].ms;){let u=W.findIndex(c=>c.ms===l);l=W[Math.min(u+1,W.length-1)].ms,h=Math.round(s/l);}for(;h<t&&l>W[0].ms;){let u=W.findIndex(c=>c.ms===l);l=W[Math.max(u-1,0)].ms,h=Math.round(s/l);}return {interval:l}}ticks(e){let t=e?.minTicks??5,r=e?.maxTicks??12,{interval:i}=this.tickInterval((t+r)/2,t,r),[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 r=this.#n?{...t,timeZone:this.#n}:t;return Ke(this.#t,r).format(new Date(e))}};var Ie={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 ue={...Ie};function qt(n){ue={...ue,...n};}function Q(){return ue}function Jt(){ue={...Ie};}function Qt(n){let e=n.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 r=e.slice(5,e.lastIndexOf(")")).split(",");if(r.length===4)return `rgb(${r[0].trim()}, ${r[1].trim()}, ${r[2].trim()})`}return e}function en(n){let e=n.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ce(n,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",r,i=2){let o=Qt(t),s=en(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ function K(n){return n===true?{major:{}}:n===false?{major:false}:n}function sn(n){return "avg"in n}function an(n,e,t,r,i,o){let s=e.map(n.time);if(s<r.x||s>r.x+r.width)return null;let a=Math.abs(s-i);if(sn(n)){if(n.min===null||n.max===null||n.avg===null)return null;let l=t.map(n.min),h=t.map(n.max),u=Math.min(l,h),c=Math.max(l,h),p=o<u?u-o:o>c?o-c:0;return {time:n.time,min:n.min,max:n.max,avg:n.avg,count:n.count,x:s,y:t.map(n.avg),distance:Math.hypot(a,p),dx:a}}if(n.value===null||n.synthetic)return null;let m=t.map(n.value);return {time:n.time,value:n.value,x:s,y:m,distance:Math.hypot(a,m-o),dx:a}}var Ge=1e-6;function ln(n,e){return n.dx<e.dx-Ge?true:n.dx>e.dx+Ge?false:n.distance<e.distance-Ge}function Qe(n,e,t,r,i,o,s,a){if(i<r.x||i>r.x+r.width||o<r.y||o>r.y+r.height)return [];let m=[];for(let l of n){let h=l.id??l.name;if(a.has(h))continue;let u=t(l);if(!u)continue;let c=null;for(let p of l.data){let d=an(p,e,u.skala,r,i,o);!d||d.dx>s||(!c||ln(d,c))&&(c=d);}if(c){let{dx:p,...d}=c;m.push({seriesId:h,name:l.name,axisIndex:u.achse,...d});}}return m.sort((l,h)=>l.distance-h.distance)}var se=class n{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:r}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-r.left-r.right,chartHeight:t-r.top-r.bottom,chartX:r.left,chartY:r.top,margin:r}}static default(e=800,t=400){return new n({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};function N(n){return n&&n.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var mn=(()=>{let n=new Array(256);for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;n[e]=t>>>0;}return n})();function Ee(n){let e=new TextEncoder().encode(n),t=4294967295;for(let r of e)t=mn[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function W(n,e){return e||"s-"+Ee(n??"").toString(16).padStart(8,"0")}var et=new Map;function hn(n,e){return `${n}|${JSON.stringify(e??{})}`}function tt(n,e){let t=hn(n,e),r=et.get(t);return r||(r=new Intl.DateTimeFormat(n,e),et.set(t,r)),r}function nt(){return typeof navigator<"u"?navigator.language:void 0}var U=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[r,i]=this.#e,[o,s]=this.#t;return i===r?o:o+(t-r)/(i-r)*(s-o)}invert(e){let[t,r]=this.#e,[i,o]=this.#t;return o===i?t:t+(e-i)/(o-i)*(r-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},G=[{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}],q=class{#e;#t;#n;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e.locale||(nt()??"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,r=12){let[i,o]=this.#e.domain(),s=o-i;if(s<=0)return {interval:G[0].ms};let a=s/e,m=G[0].ms;for(let u of G)if(u.ms>=a){m=u.ms;break}let l=m,h=Math.round(s/l);for(;h>r&&l<G[G.length-1].ms;){let u=G.findIndex(c=>c.ms===l);l=G[Math.min(u+1,G.length-1)].ms,h=Math.round(s/l);}for(;h<t&&l>G[0].ms;){let u=G.findIndex(c=>c.ms===l);l=G[Math.max(u-1,0)].ms,h=Math.round(s/l);}return {interval:l}}ticks(e){let t=e?.minTicks??5,r=e?.maxTicks??12,{interval:i}=this.tickInterval((t+r)/2,t,r),[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 r=this.#n?{...t,timeZone:this.#n}:t;return tt(this.#t,r).format(new Date(e))}};var We={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 ce={...We};function un(n){ce={...ce,...n};}function J(){return ce}function cn(){ce={...We};}function dn(n){let e=n.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 r=e.slice(5,e.lastIndexOf(")")).split(",");if(r.length===4)return `rgb(${r[0].trim()}, ${r[1].trim()}, ${r[2].trim()})`}return e}function pn(n){let e=n.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function de(n,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",r,i=2){let o=dn(t),s=pn(t)?"":' fill-opacity="0.3"';if(e==="none")return `
2
2
  <pattern id="${n}" width="10" height="10" patternUnits="userSpaceOnUse">
3
3
  <rect width="10" height="10" fill="${t}" />
4
4
  </pattern>
@@ -21,29 +21,29 @@ function U(n){return n===true?{major:{}}:n===false?{major:false}:n}var se=class
21
21
  ${u}
22
22
  ${h}
23
23
  </pattern>
24
- `.trim()}function Ge(n,e=2,t=false){return n==="dashed"||!n&&t?{strokeDasharray:"4,4"}:n==="dotted"?{strokeDasharray:"2,4"}:!n||n==="solid"?null:qe(n,e)}function qe(n,e=2){let t=e;switch(n){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 b=new Proxy({},{get:(n,e)=>Q()[e],has:(n,e)=>e in Q(),ownKeys:()=>Reflect.ownKeys(Q()),getOwnPropertyDescriptor:(n,e)=>Reflect.getOwnPropertyDescriptor(Q(),e)});function de(n,e){if(e<=0||n.length<2)return [];let t=[];for(let r=0;r<n.length-1;r++){let i=n[r],o=n[r+1];for(let s=1;s<=e;s++)t.push(i+(o-i)*s/(e+1));}return t}var ae={axisColor:b.axisColor,tickColor:b.tickColor,textColor:b.textColor,textSize:b.textSize},ee=class{#e;#t;constructor(e){this.#e=new J({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??ae).axisColor}get tickColor(){return (this.#t.colors??ae).tickColor}get textColor(){return (this.#t.colors??ae).textColor}get textSize(){return (this.#t.colors??ae).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,r=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((t+r)/2,t,r),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,r=[e[0]];for(let i=1;i<e.length;i++){let o=r[r.length-1].x;Math.abs(e[i].x-o)>=t&&r.push(e[i]);}return r}render(){let e=this.generateTicks(),t=this.#t.colors??ae,r=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:r,x2:s,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let a of this.generateMinorTicks())i.push({type:"line",x1:a,y1:r,x2:a,y2:r+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let a of e)i.push({type:"line",x1:a.x,y1:r,x2:a.x,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),i.push({type:"text",content:a.label,x:this.#n(a.x,a.label,t.textSize),y:r+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return i}generateMinorTicks(){return de(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,r)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function te(n){return "showAs"in n&&!!n.showAs}function Je(n){if(te(n)){let e=[];for(let t of n.data)t.min!==null&&e.push(t.min),t.max!==null&&e.push(t.max);return e}return n.data.map(e=>e.value).filter(e=>e!==null)}function pe(n){return {axisColor:n?.color??b.axisColor,tickColor:n?.color??b.tickColor,textColor:b.textColor,textSize:b.textSize,axisWidth:n?.width??1}}function Qe(n,e,t,r){if(r===void 0)return [n,e];let i=typeof r=="number"?r:r.top??0,o=typeof r=="number"?r:r.bottom??0;if(i<=0&&o<=0)return [n,e];let s=t-i-o,a=e-n;if(s<=0||a<=0)return [n,e];let m=a/s;return [n-o*m,e+i*m]}function fe(n,e){return n!==void 0?n:e!==void 0&&e!==false?1:0}var tn=[[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"]],Oe=.6,nn=(()=>{let n=new Map;for(let[e,,t]of tn){let r=t.split(",");for(let i=0;i<r.length;i++)n.set(e+i,Number(r[i])/1e3);}return n})();function et(n){return nn.get(n)??Oe}var V=(n,e)=>{let t=0;for(let r of n)t+=et(r.codePointAt(0)??0);return t*e},rn=(n,e)=>[...n].length*e*Oe;function tt(n,e,t){let r=0;for(let i of n)r=Math.max(r,t(i,e));return r}var ne={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function nt(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}M`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Number.isInteger(n)?String(n):n.toFixed(1)}function on(n){let e=new Array(n.length).fill(false),t=0;for(;t<n.length;){let r=t;for(;r+1<n.length&&n[r+1].label===n[t].label;)r++;for(let i=t+1;i<r;i++)e[i]=true;t=r+1;}return e}var ge=class{#e;#t;constructor(e){this.#e=new Z({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??ne).axisColor}get tickColor(){return (this.#t.colors??ne).tickColor}get textColor(){return (this.#t.colors??ne).textColor}get textSize(){return (this.#t.colors??ne).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let f=this.#t.format??nt;return e.map(g=>({value:g,position:this.#e.map(g),label:f(g)}))}let t=this.#t.format??nt,r=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/r,h=Math.pow(10,Math.floor(Math.log10(l))),u=l/h,c;if(u<=1.5?c=h:u<=3?c=2*h:u<=7?c=5*h:c=10*h,c<=0||!Number.isFinite(c))return [{value:i,position:this.#e.map(i),label:t(i)}];let p=[],d=Math.ceil(s/c)*c;for(let f=d;f<=a;f+=c)p.push({value:f,position:this.#e.map(f),label:t(f)});return p}generateMinorTicks(){return de(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??ne,r=this.#t.x??0,i=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,m=u=>s.some(c=>Math.abs(c-u)<=a),l=[];if(i==="vertical"){let[u,c]=this.#e.range();l.push({type:"line",x1:r,y1:u,x2:r,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let p=on(e);e.forEach((d,f)=>{let g=m(d.position),y=p[f]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:d.position,x2:r,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||l.push({type:"text",content:d.label,x:this.#n(r-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(l.push({type:"line",x1:r,y1:d.position,x2:r+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||l.push({type:"text",content:d.label,x:this.#n(r+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();l.push({type:"line",x1:u,y1:r,x2:c,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let p of e)l.push({type:"line",x1:p.position,y1:r,x2:p.position,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:p.label,x:p.position,y:r+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let h=(this.#t.orientation??"vertical")==="vertical";for(let u of this.generateMinorTicks())l.push(h?{type:"line",x1:o==="right"?r:r-2,y1:u,x2:o==="right"?r+2:r,y2:u,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:u,y1:r,x2:u,y2:r+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return l}#n(e,t,r){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??ne).textSize);return r==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function rt(n){let e=new Set,t={};for(let r of n){let i=r.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((r,i)=>r-i):void 0,name:r=>t[r]??String(r)}}function it(n){let{axes:e,indices:t,seriesByIndex:r,layout:i,thresholds:o,metrics:s}=n,{chartX:a,chartY:m,chartWidth:l,chartHeight:h}=i,u=[],c=new Map,p,d=[],f=[],g=(e?.y?.length??0)>0,y=0,x=0;for(let S of t){let k=r.get(S),_=1/0,$=-1/0,A=false;for(let j of k)for(let he of Je(j))he<_&&(_=he),he>$&&($=he),A=true;if(!A)continue;_===$&&(_-=1,$+=1);let C=S===0?e?.left:S===1?e?.right:void 0,B=e?.y&&e.y.length>S?e.y[S]:void 0,M=B&&C?{...C,...B}:B??C,F=M?.domain,D=F&&F!=="auto"?F:Qe(_,$,h,M?.padding),{werte:P,name:E}=rt(k);if(P){let j=P.length>1?(P[P.length-1]-P[0])/(P.length-1):1;D[0]=P[0]-j/2,D[1]=P[P.length-1]+j/2;}let G=new Z({domain:D,range:[m+h,m]});c.set(S,G);let O=M?.position??(S===0?"left":"right"),T=O==="right"?"outside-right":"outside-left",v=o.filter(j=>(j.axisIndex??0)===S&&typeof j.label=="object"&&j.label!==null&&j.label.position===T&&j.value>=Math.min(D[0],D[1])&&j.value<=Math.max(D[0],D[1])).map(j=>G.map(j.value)),L;if(O==="right"){let j=M?.offset??x*50;L=a+l+j,x++;}else {let j=M?.offset??y*50;L=a-j,y++;}let R=new ge({domain:D,range:[m+h,m],x:L,position:O,format:M?.format??(P?E:void 0),tickValues:P,ticks:M?.ticks?.major,minorTicks:fe(M?.ticks?.minor,U(M?.grid)?.minor),colors:pe(M?.axis),suppressLabelsNear:v.length?v:void 0,gesamtbreite:i.totalWidth,metrics:s}),q=8+tt(R.generateTicks().map(j=>j.label),11,s),oe=O==="right"?L+q:L-q;f.push({position:O,von:Math.min(L,oe),bis:Math.max(L,oe)}),g&&M?.label&&d.push({text:M.label,achseX:L,kante:oe,position:O,style:M.labels}),S===0&&(p=R),u.push({type:"group",cssClass:`value-axis ${O}`,sharedStyles:true,commands:R.render()});}return {commands:u,titel:d,baender:f,neueForm:g,primary:p,scales:c}}var I=class{static interpolateDataPoint(n,e,t){return {time:n.time+Math.round(t*(e.time-n.time)),value:(n.value??0)+t*((e.value??0)-(n.value??0)),synthetic:true}}static interpolateAggregatedPoint(n,e,t){let r=(i,o)=>i!==null&&o!==null?i+t*(o-i):null;return {time:n.time+t*(e.time-n.time),min:r(n.min,e.min),max:r(n.max,e.max),avg:r(n.avg,e.avg),count:Math.round(n.count+t*(e.count-n.count))}}static getRuns(n,e,t=0){let r=[...n].sort((a,m)=>a.time-m.time),i=[],o=[],s=null;for(let a of r){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(n,e,t,r){if(n.length===0)return [];if(e.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((l,h)=>l-h),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let h=0;for(let u=0;u<i.length&&l>=i[u];u++)h=u+1;return h},m=[n[0]];for(let l=1;l<n.length;l++){let h=n[l-1],u=n[l],c=t(h),p=t(u),d;p>c?d=i.filter(g=>g>c&&g<=p):p<c?d=i.filter(g=>g>=p&&g<c).reverse():d=[];let f=c;for(let g of d){let y=(g-c)/(p-c),x=r(h,u,y);m.push(x);let S=a((f+g)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[x],f=g;}(d.length===0||d[d.length-1]!==p)&&m.push(u);}if(m.length>1||n.length===1){let l=t(m[0]),h=t(m[m.length-1]),u=a((l+h)/2);o.push({data:m,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(n,e,t,r){let i=this.splitByBoundaries(n,[e],t,r),o={above:[],below:[]};for(let s of i)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function ot(n,e=6e4){if(n.length<2)return [];let t=[...n].sort((i,o)=>i.time-o.time),r=[];for(let i=1;i<t.length;i++)t[i].time-t[i-1].time>e&&r.push({startTime:t[i-1].time,endTime:t[i].time});return r}function sn(n,e=83144){let t=e/8.314,r=0,i=0;for(let s of n)s!==null&&(r+=Math.exp(-t/(s+273.15)),i++);if(i===0)return null;let o=r/i;return t/-Math.log(o)-273.15}function st(n,e,t=83144){let r=new Array(n.length),i=0;for(let o=0;o<n.length;o++){let s=n[o].time,a=s-e;for(;i<o&&n[i].time<a;)i++;let m=n.slice(i,o+1).map(h=>h.value),l=sn(m,t);r[o]={time:s,value:l,synthetic:true};}return r}function an(n){let e=0,t=0;for(let o of n)o!==null&&(e+=o,t++);if(t===0)return null;let r=e/t,i=0;for(let o of n){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/t)}function ln(n){let e=0,t=0;for(let o of n)o!==null&&(e+=o,t++);if(t<2)return null;let r=e/t,i=0;for(let o of n){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/(t-1))}function at(n,e,t=false){let r=new Array(n.length),i=0,o=t?ln:an;for(let s=0;s<n.length;s++){let a=n[s].time,m=a-e;for(;i<s&&n[i].time<m;)i++;let l=n.slice(i,s+1).map(u=>u.value),h=o(l);r[s]={time:a,value:h,synthetic:true};}return r}function We(n,e){let t=new Array(n.length),r=0;for(let i=0;i<n.length;i++){let o=n[i].time,s=o-e;for(;r<i&&n[r].time<s;)r++;let a=0,m=0;for(let l=r;l<=i;l++){let h=n[l].value;h!==null&&(a+=h,m++);}t[i]={time:o,value:m===0?null:a/m,synthetic:true};}return t}function lt(n,e){let t=new Array(n.length),r=null,i=0;for(let o=0;o<n.length;o++){let s=n[o].time,a=n[o].value;if(a===null){t[o]={time:s,value:r,synthetic:true};continue}if(r===null||e<=0)r=a;else {let m=1-Math.exp(-(s-i)/e);r=a*m+r*(1-m);}i=s,t[o]={time:s,value:r,synthetic:true};}return t}function N(n){let e=[];for(let t of n)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}var ye=class{};function mt(n,e,t,r){let i=xe(t);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<n.length;s++){let a=n[s],m=e.timeScale.map(a.time),l=e.valueScale.map(a.value),h=r(a),u=t.pointStroke??h,c=t.pointFill??h,p=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${s}`:void 0;be(o,d,i.markers.type,m,l,i.markers.size,u,c,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function be(n,e,t,r,i,o,s,a,m){let l=h=>e===void 0?void 0:`${e}-${h}`;switch(t){case "circle":n.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});break;case "square":n.push({type:"rect",x:r-o,y:i-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:m,id:e});break;case "cross":n.push({type:"line",x1:r-o,y1:i-o,x2:r+o,y2:i+o,stroke:s,strokeWidth:m,id:e},{type:"line",x1:r-o,y1:i+o,x2:r+o,y2:i-o,stroke:s,strokeWidth:m,id:l(2)});break;case "diamond":n.push({type:"path",points:[{x:r,y:i-o},{x:r+o,y:i},{x:r,y:i+o},{x:r-o,y:i}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "triangle":n.push({type:"path",points:[{x:r,y:i-o},{x:r+o,y:i+o},{x:r-o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "star":{let h=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,p=Math.PI/2*3+u*Math.PI/5;h.push({x:r+c*Math.cos(p),y:i+c*Math.sin(p)});}n.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "arrow":n.push({type:"path",points:[{x:r-o,y:i+o},{x:r,y:i-o},{x:r+o,y:i+o}],stroke:s,strokeWidth:m,fill:"none",id:e});break;case "plus":n.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e},{type:"line",x1:r,y1:i-o,x2:r,y2:i+o,stroke:s,strokeWidth:m,id:l(2)});break;case "triangle-down":n.push({type:"path",points:[{x:r,y:i+o},{x:r+o,y:i-o},{x:r-o,y:i-o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "hexagon":{let h=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);h.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}n.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "hourglass":n.push({type:"path",points:[{x:r-o,y:i-o},{x:r+o,y:i-o},{x:r-o,y:i+o},{x:r+o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "line-horizontal":n.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e});break;default:n.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});}}var Se=class n{#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 r=new n;return t(r),r.length===0?this:(this.#e.push({type:"group",...e,commands:r.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var mn="#ffffff",hn="#cccccc",un=6,cn=.85,X=12,ke=8,le=20,dn=11,we=18,Ee=(n,e)=>e(n,dn);function ht(n,e,t){let r=a=>X+ke+Ee(a.name,e);if(t===void 0){let a=n.reduce((m,l)=>m+r(l)+we,0)-we;return [{items:n,breite:Math.max(0,a)}]}let i=[],o=[],s=0;for(let a of n){let m=r(a),l=o.length===0?m:s+we+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 ut(n,e="vertical",t=V,r){if(e==="horizontal"){let o=ht(n,t,r);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*le}}let i=0;for(let o of n)i=Math.max(i,Ee(o.name,t));return {width:X+ke+i,height:n.length*le}}function pn(n){let{items:e,x:t,y:r,orientation:i="vertical",metrics:o=V,maxBreite:s,box:a,itemClass:m}=n,l=new Se;if(a&&e.length>0){let c=ut(e,i,o,s),d=((i==="horizontal"?c.height/le:e.length)-1)*le+X,f=a.padding??un,g=a.stroke??hn;l.rect({x:t-f,y:r-f,w:c.width+2*f,h:d+2*f,fill:a.fill??mn,...g==="none"?{}:{stroke:g,strokeWidth:a.strokeWidth??1},opacity:a.opacity??cn});}let h=i==="horizontal"?ht(e,o,s):e.map(c=>({items:[c],breite:0})),u=new Map;return h.forEach((c,p)=>{let d=t;for(let f of c.items)u.set(f,{x:d,y:r+p*le}),d+=X+ke+Ee(f.name,o)+we;}),e.forEach(c=>{let p=u.get(c)??{x:t,y:r},d=p.x,f=p.y,g=["legend-item"];c.id&&g.push(`legend-item--${c.id}`),m&&g.push(m),l.group({cssClass:g.join(" "),...c.id?{id:`legend-${c.id}`}:{}},y=>{y.rect({x:d,y:f,w:X,h:X,fill:c.color,stroke:b.legendStroke,strokeWidth:1}).text({content:c.name,x:d+X+ke,y:f+X-2,fontSize:b.legendFont,fill:b.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function ct(n){let{legend:e,items:t,gesamtbreite:r,metrics:i}=n,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"?r-16:void 0;return {items:t,show:o,position:s,orientation:a,maxBreite:m,size:o?ut(t,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function dt(n,e){let t=n.position==="outside-right"||n.position==="outside-left"||n.position==="above"||n.position==="below";if(!n.show||!t)return null;let r={...e},i=2*n.boxRand;return n.position==="outside-right"?r.right+=n.size.width+i+16:n.position==="outside-left"?r.left+=n.size.width+i+16:n.position==="above"?r.top+=n.size.height+i+10:r.bottom+=n.size.height+i+10,r}function pt(n){let{legende:e,layout:t,randBelegt:r,metrics:i}=n;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 h=r.filter(u=>u.position==="right").reduce((u,c)=>Math.max(u,c.bis),o+a);m=Math.min(Math.max(o+a+16,h+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 [pn({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function ft(n){let{xTicks:e,yTicks:t,xRange:r,yRange:i,stroke:o=b.gridStroke,strokeWidth:s=b.gridStrokeWidth,dashed:a=false,opacity:m=b.gridOpacity}=n,l=[];if(t)for(let h of t)l.push({type:"line",x1:r[0],y1:h,x2:r[1],y2:h,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let h of e)l.push({type:"line",x1:h,y1:i[0],x2:h,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function gt(n){let{axes:e,timeAxis:t,primaryValueAxis:r,xRange:i,yRange:o}=n,s=U(e?.x?.grid),a=U(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,h=a?.major,u=_=>_!==void 0&&_!==false;if(!u(l)&&!u(h))return {group:null,layer:m};let c=l!==false,p=h!==false&&!!r,d=c?t.generateTicks().map(_=>_.x):void 0,f=p?r.generateTicks().map(_=>_.position):void 0;if(!d&&!f)return {group:null,layer:m};let g=(l&&typeof l=="object"?l:void 0)??(h&&typeof h=="object"?h:void 0),y=s?.minor,x=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(x&&typeof x=="object"?x:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||x!==void 0?ft({xTicks:y!==false&&c?t.generateMinorTicks():void 0,yTicks:x!==false&&p?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(b.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...ft({xTicks:d,yTicks:f,xRange:i,yRange:o,stroke:g?.color,opacity:g?.opacity,dashed:g?.style==="dashed"})]},layer:m}}function fn(n){return n==="dotted"?{dash:"dotted"}:n==="dashed"?{dash:"dashed"}:{}}function gn(n){let{thresholds:e,valueScale:t,xRange:r}=n,[i,o]=r,[s,a]=t.range(),m=Math.min(s,a),l=Math.max(s,a),h=[],u=[];for(let c of e){let p=c.color??b.thresholdColor,d=t.map(c.value);c.fill==="above"?h.push({type:"rect",x:i,y:m,w:o-i,h:Math.max(0,d-m),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&h.push({type:"rect",x:i,y:d,w:o-i,h:Math.max(0,l-d),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let f=c.line??b.thresholdLine;if(f!=="none"){let S=fn(f),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),h.push(k);}let[g,y]=t.domain();if(c.value>=Math.min(g,y)&&c.value<=Math.max(g,y)&&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,_=S?.position??"right",$=bn(k,_,i,o,d,p,S);u.push({...$,y:yn($.y,Math.min(s,a),Math.max(s,a),b.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:h,labels:u}}function yn(n,e,t,r){return Math.max(e+r,Math.min(t-r/2,n))}function bn(n,e,t,r,i,o,s){let a=(t+r)/2,m={type:"text",content:n,fontSize:b.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:r+6,y:i+3,anchor:"start",textBaseline:l.textBaseline??"middle"};default:return {...m,...l,x:r-4,y:i-4,anchor:"end"}}}function yt(n){let{thresholds:e,valueScales:t,primaryScale:r,xRange:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,h=[];if(e.length===0)return h;let u=[],c=[];for(let p of e){let d=p.id??z(p.name),f=t.get(p.axisIndex??0)??r,g=gn({thresholds:[p],valueScale:f,xRange:i});g.inside.length&&u.push({type:"group",cssClass:`threshold threshold--${d}`,id:`threshold-${d}`,commands:g.inside}),g.labels.length&&c.push({type:"group",cssClass:`threshold-label threshold-label--${d}`,commands:g.labels});}return u.length&&h.push({type:"group",cssClass:"thresholds",commands:u,clipRect:{x:s,y:a,w:m,h:l}}),c.length&&h.push({type:"group",cssClass:"threshold-labels",commands:c}),h}function bt(n,e,t,r){switch(n){case "above":return e-5;case "below":return r!==void 0?r-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Te(n){let{ranges:e,timeScale:t,yRange:r,height:i,metrics:o=V}=n,[s,a]=r,m=[],[l,h]=t.range(),u=Math.min(l,h),c=Math.max(l,h),p=d=>Math.max(u,Math.min(c,d));for(let d of e){let f=p(t.map(d.startTime)),g=p(t.map(d.endTime));if(d.fill!==void 0&&m.push({type:"rect",x:f,y:s,w:g-f,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let y of [f,g])m.push({type:"line",x1:y,y1:s,x2:y,y2:a,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let y=d.labelPosition??"middle",x=d.rotate;if(x==="auto"){let S=y!=="above"&&y!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(g-f)-4?-90:void 0;}m.push({type:"text",content:d.label,x:(f+g)/2,y:bt(y,s,a,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return m}function He(n){let{gaps:e,timeScale:t,yRange:r,height:i,fill:o=b.gapFill,hatch:s,fillOpacity:a=b.gapFillOpacity??.15,stroke:m=b.gapStroke,strokeWidth:l=b.gapStrokeWidth,dashed:h=true,fontSize:u=b.gapFontSize,fontFill:c=b.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:f,band:g}=n,y=()=>{if(!g)return [];let x=g.height??6,[S,k]=r,_=Math.max(S,k);return e.map($=>{let A=t.map($.startTime),C=t.map($.endTime);return {type:"rect",x:Math.min(A,C),y:_-x+(g.offset??0),w:Math.abs(C-A),h:x,fill:g.fill??m,opacity:g.opacity??.75}})};return Te({timeScale:t,yRange:r,height:i,metrics:f,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",_=S==="dashed_border"&&h!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??s,opacity:x.fillOpacity??a},..._&&{edges:{stroke:m,strokeWidth:l}},label:x.label,labelPosition:x.labelBaseline??p,labelColor:c,fontSize:u,rotate:x.rotate??d}})}).concat(y())}function xt(n){let{gap:e,runs:t,timeScale:r,valueScale:i,metrics:o,lineColor:s}=n,a=[],m=e.bridge,l=[];for(let h=1;h<t.length;h++){let u=t[h-1][t[h-1].length-1],c=t[h][0];if(e.display==="bridge_line"){if(u.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(u.time),y1:i.map(u.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??b.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:u.time,endTime:c.time});}if(l.length>0){let h=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",u=e.fill,c=typeof u=="string"?u:u?.color,p=i.range();a.push(...He({gaps:l.map(d=>({...d,style:h})),timeScale:r,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 a}function St(n){let{markers:e,timeScale:t,valueScale:r,yRange:i=[0,300]}=n,[o,s]=i,a=[];for(let m of e){let l=t.map(m.time),h=m.color??b.markerColor,u=m.pointStyle??(m.value!==void 0?"circle":"none"),c=m.lineStyle??"full";if(m.value!==void 0){let p=r.map(m.value);if(c==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:p,stroke:h,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:p,stroke:h,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:h,strokeWidth:1}),u!=="none"&&be(a,void 0,u,l,p,b.markerSize,h,h,1.5),m.label){let d=c==="to-value"?p-10:o-6;a.push({type:"text",content:m.label,x:l,y:d,anchor:"middle",fontSize:b.markerFontSize,fill:h});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:h,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:b.markerFontSize,fill:h});}return a}function wt(n){let{highlights:e,timeScale:t,yRange:r,height:i}=n;return Te({metrics:n.metrics,timeScale:t,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??b.highlightColor,opacity:o.opacity??b.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??b.highlightLabelColor,fontSize:b.annotationFontSize,rotate:o.rotate}))})}function kt(n){let{annotations:e,timeScale:t,valueScales:r}=n,i=[],o=s=>{let a=r.get(s.axis??0)??r.values().next().value;return {x:t.map(s.time),y:a?a.map(s.value):0}};for(let s of e){let a=[],m=l=>a.push(l);switch(s.type){case "line":{let l=o(s.from),h=o(s.to);m({type:"line",x1:l.x,y1:l.y,x2:h.x,y2:h.y,stroke:s.color??b.annotationColor,strokeWidth:s.width??b.annotationWidth,dash:s.dash});break}case "arrow":{let l=o(s.from),h=o(s.to),u=s.color??b.annotationColor,c=s.headSize??b.annotationHead;m({type:"line",x1:l.x,y1:l.y,x2:h.x,y2:h.y,stroke:u,strokeWidth:s.width??b.annotationWidth});let p=Math.hypot(h.x-l.x,h.y-l.y)||1,d=(h.x-l.x)/p,f=(h.y-l.y)/p,g=h.x-d*c,y=h.y-f*c;m({type:"path",points:[{x:h.x,y:h.y},{x:g-f*c*.5,y:y+d*c*.5},{x:g+f*c*.5,y:y-d*c*.5}],fill:u,stroke:"none"});break}case "rect":{let l=o(s.from),h=o(s.to);m({type:"rect",x:Math.min(l.x,h.x),y:Math.min(l.y,h.y),w:Math.abs(h.x-l.x),h:Math.abs(h.y-l.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let l=o(s.at),h=s.color??"#334155",u=s.radius??b.annotationRadius,c=s.shape??"circle";c==="circle"?m({type:"circle",cx:l.x,cy:l.y,r:u,fill:h}):c==="square"?m({type:"rect",x:l.x-u,y:l.y-u,w:u*2,h:u*2,fill:h}):(m({type:"line",x1:l.x-u,y1:l.y-u,x2:l.x+u,y2:l.y+u,stroke:h,strokeWidth:1.5}),m({type:"line",x1:l.x-u,y1:l.y+u,x2:l.x+u,y2:l.y-u,stroke:h,strokeWidth:1.5}));break}case "label":{let l=o(s.at);m({type:"text",content:s.text,x:l.x+(s.dx??0),y:l.y+(s.dy??0),anchor:s.anchor??xn(l.x+(s.dx??0),s.text,n),fontSize:b.annotationFontSize,fill:s.color??b.annotationColor,rotate:s.rotate});break}}if(s.id&&a.length>0){let l=z(s.id);i.push({type:"group",cssClass:`annotation annotation--${l}`,commands:a});}else i.push(...a);}return i}function xn(n,e,t){let{metrics:r,timeScale:i}=t;if(!r)return "middle";let[o,s]=i.range(),a=r(e,b.annotationFontSize)/2;return n-a<o?"start":n+a>s?"end":"middle"}var re=class n{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++n.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var ve=class extends re{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let r of this.data)r.count>t&&(t=r.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??b.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??b.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),h=e.valueScale.map(m.max),u=e.valueScale.map(m.min),c=s,p=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:h,w:c,h:u-h,fill:t,hatch:r,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-c/2,y1:d,x2:l+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return a}};var Sn=1,_e=class{#e;constructor(e,t,r,i){this.#e={...e,xRange:t,y:r,height:i};}render(){let{items:e,timeScale:t,background:r,hatch:i,showAxis:o,xRange:s,y:a,height:m}=this.#e,l=[];r&&l.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h:m,fill:r,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let h of e){let u=t.map(h.startTime),c=t.map(h.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)),f=Math.max(d-p,Sn);p+f>s[1]&&(p=Math.max(s[0],s[1]-f));let g=p+f/2;if(l.push({type:"rect",x:p,y:a,w:f,h:m,hatch:h.hatch??i,fill:h.fill??"#6b728044",stroke:h.stroke,strokeWidth:h.strokeWidth??0,title:h.title}),h.label){let y=h.labelFontSize??10;l.push({type:"text",content:h.label,x:g,y:this.#t(h.labelBaseline,y),anchor:"middle",fontSize:y,fill:h.labelFill??"#333"});}}if(o){let h=new ee({domain:t.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:h.render()});}return l}#t(e,t){let{y:r,height:i}=this.#e;switch(e){case "top":return r+t*.9;case "bottom":return r+i-t*.25;default:return r+i/2+t*.35}}};function xe(n){return {id:n.id,line:{stroke:n.stroke??b.stroke,strokeWidth:n.strokeWidth??b.strokeWidth,smoothing:n.smoothing??false,smoothingType:n.smoothingType,dashed:n.dashed??false},fill:n.fill??b.areaFillAlpha,markers:{type:n.pointStyle??"none",size:n.pointSize??b.pointSize,stroke:n.stroke??b.stroke,fill:"#ffffff"},shadow:{color:n.shadowColor??"transparent",blur:n.shadowBlur??0,offsetX:n.shadowOffsetX??0,offsetY:n.shadowOffsetY??0}}}function Tt(n,e,t){let r=[],i=xe(t);for(let o=0;o<n.length;o++){let s=n[o];s.data.length>=2?r.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&&r.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 r}function vt(n,e,t,r){if(n.length<2)return [];let i=I.splitByBoundaries(n,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(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),h=a.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:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...h],fill:m,hatch:t.getHatch?.(a.zoneIndex),stroke:"none",...r?.smoothing?{smoothing:true,smoothingType:r.smoothingType,smoothCount:a.data.length,smoothTail:a.data.length}:{}});}return o}function _t(n,e,t,r,i,o,s){return vt(n,e,{boundaries:[],yLow:a=>a.avg,yHigh:t,getValue:a=>a.avg,interpolate:I.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var Ce=class extends re{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??b.minColor,r=e.maxColor??b.maxColor,i=e.avgColor??b.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??b.strokeWidth,l=I.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(l.length===0)return [];let h={timeScale:this.timeScale,valueScale:e.valueScale},u=[];l.forEach((d,f)=>{if(d.length<2)return;let g=y=>this.id?`${this.id}-${y}-${f}`:void 0;if(e.fillToMax){let y=_t(d,h,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:s,smoothingType:a});u.push(...y);}if(e.fillToMin){let y=_t(d,h,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:s,smoothingType:a});u.push(...y);}});let c=l.filter(d=>d.length>=2),p=(d,f,g,y=false)=>Tt(c.map(x=>({data:x.map(S=>({time:S.time,value:d(S)}))})),h,{stroke:f,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return u.push(...p(d=>d.max,r,"max"),...p(d=>d.min,t,"min"),...p(d=>d.avg,i,"avg",o)),u}};function Ct(n,e,t){let r=n.style?.line&&!Array.isArray(n.style.line)?n.style.line:void 0,i=typeof n.style?.fill=="string"?n.style.fill:void 0;return n.showAs==="minmaxavg"?new Ce({data:n.data,timeScale:e,valueScale:t,minColor:n.minColor,maxColor:n.maxColor,avgColor:n.avgColor,avgDashed:n.avgDashed,fillToMax:n.fillToMax,fillToMaxHatch:n.fillToMaxHatch,fillToMin:n.fillToMin,fillToMinHatch:n.fillToMinHatch,smoothing:r?.smoothing,smoothingType:r?.smoothingType,strokeWidth:r?.width,id:H(n.name,n.id)}).render():new ve({data:n.data,timeScale:e,valueScale:t,fill:i??r?.color,avgLine:n.avgLine,countOpacity:n.countOpacity,id:H(n.name,n.id)}).render()}function At(n,e,t){let r=n??[];return {grenzen:r.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 r){let h=e.get(l);!h||o<h.value||h.value<m||(m=h.value,a=h.color??a);}return a}}}function Lt(n){let{series:e,ctx:t,runs:r,totalPoints:i,style:o,styleLine:s,styleMarkers:a,stepShape:m,thresholds:l}=n,{timeScale:h,valueScale:u}=t,c=[],p=At(e.colorByThresholds,l,o.stroke),d=p.grenzen,f=new Map;for(let y of r){let k=function(A){return I.splitByBoundaries(A==="step"?N(y):y,d,C=>C.value,I.interpolateDataPoint)};if(y.length<1)continue;let x=H(e.name,e.id),S=new Map,_=A=>{let C=S.get(A);return C||(C=k(A),S.set(A,C)),C},$=(A,C,B)=>{let M=_(A);for(let F of M){let D=F,P=f.get(B)??0;if(f.set(B,P+1),D.data.length<1)continue;let E=D.zoneLow;if(D.data.length===1){let G=p.farbe(E,C.color);c.push({type:"circle",id:x?`${x}-dot-${P}${B}`:void 0,cx:h.map(D.data[0].time),cy:u.map(D.data[0].value),r:Math.max(o.pointSize??b.pointSize,C.width??o.strokeWidth??b.strokeWidth),fill:G,shadowColor:o.shadowColor,shadowBlur:o.shadowBlur});continue}c.push({type:"path",cssClass:"series-line",id:x?`${x}-line-${P}${B}`:void 0,points:D.data.map(G=>({x:h.map(G.time),y:u.map(G.value)})),stroke:p.farbe(E,C.color),strokeWidth:C.width??o.strokeWidth,smoothing:A==="step"?false:C.smoothing??o.smoothing,smoothingType:C.smoothingType??o.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:o.shadowColor,shadowBlur:o.shadowBlur,shadowOffsetX:o.shadowOffsetX,shadowOffsetY:o.shadowOffsetY});}};s===false||(Array.isArray(s)?s.forEach((A,C)=>{$(A.shape??(e.seriesType==="step"?"step":"line"),A,`-${C}`);}):$(m?"step":"line",s??{},"")),o.pointStyle&&o.pointStyle!=="none"&&i<=(a?.threshold??b.pointThreshold)&&c.push(...mt(y,t,o,A=>p.farbe(A.value)));}return c}function Mt(n,e,t){let i=new Array(n.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=n.map((l,h)=>({t:l,i:h})).filter(l=>l.t.position===s).sort((l,h)=>a?h.t.achseX-l.t.achseX:l.t.achseX-h.t.achseX);for(let{t:l,i:h}of m){let u=l.schrift/2,c=o.filter(f=>f.position===s),p=l.kante,d=a?p-1-u:p+1+u;for(let f=0;f<=c.length;f++){let g=d-u-1,y=d+u+1,x=c.find(S=>g<S.bis&&S.von<y);if(!x)break;p=a?x.von:x.bis,d=a?p-1-u:p+1+u;}if(a?d-u<2:d+u>t-2){let f=o.filter(g=>g.position===s&&g.titel);d=a?u+2:t-u-2;for(let g=0;g<=f.length;g++){let y=d-u-1,x=d+u+1,S=f.find(k=>y<k.bis&&k.von<x);if(!S)break;d=a?S.bis+1+u:S.von-1-u;}}o.push({position:s,von:d-u-1,bis:d+u+1,titel:true}),i[h]=d;}}return {xs:i,belegt:o}}function Dt(n){let{axes:e,neueForm:t,achsenTitel:r,titelSpuren:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,h=t?void 0:e?.left?.label,u=t?void 0:e?.right?.label,c=e?.x?.label;if(!h&&!u&&!c&&r.length===0)return [];let p=[],d=a+l/2,f=e?.left?.labels,g=e?.right?.labels,y=e?.x?.labels;return h&&p.push({type:"text",content:h,x:14,y:d,anchor:"middle",fontSize:f?.fontSize??b.axisLabelSize,fill:f?.color??b.axisLabelColor,rotate:-90}),u&&p.push({type:"text",content:u,x:o.totalWidth-14,y:d,anchor:"middle",fontSize:g?.fontSize??b.axisLabelSize,fill:g?.color??b.axisLabelColor,rotate:90}),r.forEach((x,S)=>{p.push({type:"text",content:x.text,x:i[S],y:d,anchor:"middle",fontSize:x.style?.fontSize??b.axisLabelSize,fill:x.style?.color??b.axisLabelColor,rotate:x.position==="right"?90:-90});}),c&&p.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6,anchor:"middle",fontSize:y?.fontSize??b.axisLabelSize,fill:y?.color??b.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}function ie(n){return n!==void 0&&typeof n=="object"&&"series"in n?n.series:null}function $t(n){let e=[...n].sort((r,i)=>r.time-i.time),t=0;return r=>{for(;t>0&&e[t].time>r;)t--;for(;t<e.length-1&&e[t+1].time<=r;)t++;let i=e[t];if(!i||r<i.time)return null;if(i.time===r)return i.value??null;let o=e[t+1];if(!o||r>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)*(r-i.time)/s}}function Pt(n,e,t){let r=n??e;if(r==="series")return null;if(r==="chartTop")return t.chartTop;if(r==="chartBottom")return t.chartBottom;if(typeof r=="object"&&"threshold"in r){let i=t.thresholds.get(r.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${r.threshold}'`);return t.valueScale.map(i.value)}return typeof r=="object"&&"value"in r?t.valueScale.map(r.value):null}function wn(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function Rt(n,e,t){let r=Pt(n.from,"chartBottom",e),i=Pt(n.to,"series",e),{color:o,hatch:s}=wn(n.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:h=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${h}`}:{}};return ie(n.from)!==null||ie(n.to)!==null?Tn(n,e,l):r!==null&&i!==null?vn(r,i,e,l):_n(n,e,r,i,l)}function kn(n,e,t){let r=e.shape==="step",i=(u,c)=>{let p=u??c,d=ie(p);if(d!==null){let y=e.fremdeSerie(d);if(!y)return null;let x=y.shape==="step";return {art:"fremd",laeufe:I.getRuns(y.data,k=>k.value===null,y.gapThreshold).map(k=>x?N(k):k),glatt:!x&&!!y.smoothing,verfahren:y.smoothingType}}if(p==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=Ae(p,e),g=e.valueScale.domain();return {art:"fest",wert:f??(p==="chartBottom"?g[0]:g[1]),glatt:false}},o=i(n.from,"chartBottom"),s=i(n.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(u.value)}),m=(u,c)=>u.art==="eigene"?[c]:u.art==="fremd"?u.laeufe.filter(p=>p.length>=2):[null],l=(u,c,p,d)=>c?c.map(a):[p,d].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(u.wert)})),h=[];for(let u of e.runs){if(u.length<2)continue;let c=r?N(u):u;for(let p of m(o,c))for(let d of m(s,c)){let f=Math.max(c[0].time,p?.[0].time??-1/0,d?.[0].time??-1/0),g=Math.min(c.at(-1).time,p?.at(-1).time??1/0,d?.at(-1).time??1/0);if(!(g>f))continue;let y={k:o,pts:l(o,p,f,g)},x={k:s,pts:l(s,d,f,g)};y.k.glatt||([y,x]=[x,y]);let S=_=>(_.art==="fest"?void 0:_.verfahren)??"catmull-rom",k=e.timeScale.map(f);h.push({type:"group",clipRect:{x:k,y:e.chartTop,w:e.timeScale.map(g)-k,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(h.length),points:[...y.pts,...[...x.pts].reverse()],smoothing:true,smoothingType:S(y.k),smoothCount:y.pts.length,...x.k.glatt?{smoothTail:x.pts.length,smoothTailType:S(x.k)}:{}}]});}}return h}function Tn(n,e,t){if(!e.fremdeSerie){let a=ie(n.from)??ie(n.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=kn(n,e,t);if(r)return r;let i=(a,m,l)=>{let h=a??m,u=ie(h);if(u!==null){let f=e.fremdeSerie(u);if(!f)throw new Error(`fillSpec region references unknown series '${u}'`);let g=f.shape==="step"?N(f.data):f.data;return {bei:$t(g),zeiten:g.map(y=>y.time)}}if(h==="series")return {bei:$t(l),zeiten:l.map(f=>f.time)};let c=Ae(h,e),p=e.valueScale.domain(),d=c??(h==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[]}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?N(a):a,l=i(n.from,"chartBottom",m),h=i(n.to,"series",m),u=m[0].time,c=m[m.length-1].time,p=[...new Set([...l.zeiten,...h.zeiten,...m.map(y=>y.time)])].filter(y=>y>=u&&y<=c).sort((y,x)=>y-x),d=[],f=[],g=()=>{if(d.length>=2){let y=[...f].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...y]});}d=[],f=[];};for(let y of p){let x=l.bei(y),S=h.bei(y);if(x===null||S===null){g();continue}let k=e.timeScale.map(y);d.push({x:k,y:e.valueScale.map(S)}),f.push({x:k,y:e.valueScale.map(x)});}g();}return s}function vn(n,e,t,r){let i=t.timeScale.range(),o=i[0],s=i[1],a=Math.min(n,e),m=Math.max(n,e);return [{...r.attrs,...r.teilId(0),points:[{x:o,y:a},{x:s,y:a},{x:s,y:m},{x:o,y:m}]}]}function _n(n,e,t,r,i){let o=t??r,s=[],a=Cn(n,e);if(a===null){let h=e.valueScale.domain();a=(t??r)===e.chartBottom?h[0]:h[1];}let m=Ae(n.outer,e),l=e.shape==="step";for(let h of e.runs){if(h.length<2)continue;let u=l?N(h):h,c=I.splitByThreshold(u,a,d=>d.value??a,I.interpolateDataPoint),p=n.side==="above"?c.above:n.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&n.side){let d=m,f=n.side==="above"?g=>Math.min(g,d):g=>Math.max(g,d);p=p.map(g=>g.map(y=>({...y,value:f(y.value??d)})));}for(let d of p){if(d.length<2)continue;let f=d.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),g=[];for(let y of [...f].reverse()){let x=g[g.length-1];l&&x&&x.x===y.x||g.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:f.length,points:[...f,...g]});}}return s}function Cn(n,e){let t=n.from==="series"?n.to:n.from;return Ae(t,e)}function Ae(n,e){return n===void 0||n==="series"||n==="chartTop"||n==="chartBottom"?null:typeof n=="object"&&"threshold"in n?e.thresholds.get(n.threshold)?.value??null:typeof n=="object"&&"value"in n?n.value:null}function jt(n,e){if(typeof n=="string"||!("regions"in n))return Rt({fill:n},e,0);let t=[];return n.regions.forEach((r,i)=>{t.push(...Rt(r,e,i));}),t}function Ft(n){let e=n.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??b.stroke,width:t?.width??b.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function Bt(n,e,t,r,i){let o=n.filter(l=>l.value!==null);if(o.length<2)return [];let s=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),a=Ft(t);return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:s,stroke:a.color,strokeWidth:a.width,smoothing:a.smoothing,smoothingType:a.smoothingType,dash:a.dash,fill:"none"}]}function It(n,e,t=0){switch(n.kind){case "movingAverage":{let r=n.type==="exponential"?lt(e.data,n.window):We(e.data,n.window);return Bt(r,e,n,"movingAvg",t)}case "movingMkt":{let r=st(e.data,n.window,n.activationEnergy);return Bt(r,e,n,"movingMkt",t)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=Ft(n),m=a.color,l=a.width,h=a.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return n.high!==void 0&&r.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(n.high),x2:s,y2:e.valueScale.map(n.high),stroke:m,strokeWidth:l,dash:h}),n.low!==void 0&&r.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(n.low),x2:s,y2:e.valueScale.map(n.low),stroke:m,strokeWidth:l,dash:h}),r}case "stdDevBand":{let r=n.multiplier??1,i=We(e.data,n.window),o=at(e.data,n.window),s=[],a=[];for(let g=0;g<i.length;g++){let y=i[g].value,x=o[g].value;if(y===null||x===null)continue;let S=e.timeScale.map(i[g].time);s.push({x:S,y:e.valueScale.map(y+r*x)}),a.push({x:S,y:e.valueScale.map(y-r*x)});}if(s.length<2)return [];let m=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,l=[],u=(typeof n.style?.fill=="string"||n.style?.fill&&!("regions"in n.style.fill)?n.style.fill:void 0)??"#94a3b833",{color:c,hatch:p}=An(u);l.push({type:"path",cssClass:"series-fill",id:`${m}stdDevBand`,points:[...s,...[...a].reverse()],fill:c,hatch:p,stroke:"none"});let d=n.style?.line,f=d&&!Array.isArray(d)?d:void 0;if(f){let g=i.filter(y=>y.value!==null).map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)}));g.length>=2&&l.push({type:"path",cssClass:"series-line",id:`${m}stdDevBand-mean`,points:g,stroke:f.color??b.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return l}}}function An(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function Ln(n){if(!n)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(n))return {gaps:n,autoDetect:false,minGapMs:6e4};let e=n.regions??[],t=n.style;return {gaps:e.map(i=>{let o={...t,...i.style},s=o.fill,a,m;return typeof s=="string"?a=s:s&&(a=s.color,m=s.hatch),{startTime:i.startTime,endTime:i.endTime,label:i.label,fill:a,hatch:m,fillOpacity:o.opacity,labelBaseline:o.label?.baseline,rotate:o.label?.rotate,style:o.display==="bridge_line"?void 0:o.display}}),autoDetect:n.autoDetect??false,minGapMs:n.minGapMs??6e4,band:t?.band}}function Gt(n,e){if(e)for(let t of n)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&Gt(t.commands,e);}var K=class{_layout;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_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._legend=e.legend,this._textMetrics=e.textMetrics??V,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=Ln(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,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 r=t.height??12,i=t.spacing??0;(t.showAxis??false)&&(e+=26+i),e+=r+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(r=>r.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)}renderCommands(){if(this._series.length===0)return [];let e=ct({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,r=dt(e,this._layout.margin);r&&(t=new se({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute());let{chartX:i,chartY:o,chartWidth:s,chartHeight:a}=t,m=[i,i+s],l=[o,o+a],h=[];for(let T of this._series)T.data.sort((v,L)=>v.time-L.time);let u=new Map,c=1/0,p=-1/0,d=false;for(let T of this._series){let v=this._axisIndexOf(T),L=u.get(v);L?L.push(T):u.set(v,[T]);for(let R of this._timesOf(T))R<c&&(c=R),R>p&&(p=R),d=true;}if(!d)return [];let f=this._axes?.x?.domain,g=f&&f!=="auto"?f:[c,p];this._timeScale=new J({domain:g,range:m,locale:this._locale,timeZone:this._timeZone});let y=new ee({domain:g,xRange:m,y:o+a,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:fe(this._axes?.x?.ticks?.minor,U(this._axes?.x?.grid)?.minor),colors:pe(this._axes?.x?.axis),gesamtbreite:t.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let x=Array.from(u.keys()).sort((T,v)=>T-v),S=it({axes:this._axes,indices:x,seriesByIndex:u,layout:t,thresholds:this._thresholds,metrics:this._textMetrics});h.push(...S.commands);let{titel:k,baender:_,neueForm:$}=S,A=S.primary;for(let[T,v]of S.scales)this._valueScales.set(T,v);let C=this._valueScales.get(0)??this._valueScales.get(x[0]);h.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:y.render()});let B=gt({axes:this._axes,timeAxis:y,primaryValueAxis:A,xRange:m,yRange:l}),M=B.group;M&&B.layer==="back"&&(h.push(M),M=null),this._highlights.length>0&&h.push({type:"group",cssClass:"highlights",commands:wt({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:l,height:t.totalHeight})}),C&&h.push(...yt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:C,xRange:m,layout:t}));let F=this._gaps;if(this._gapsAutoDetect){let T=[];for(let v of this._series){if(te(v))continue;let L=v.data.filter(R=>R.value!==null);T.push(...ot(L,this._gapsMinGapMs));}T.length>0&&(F=[...this._gaps,...T]);}F.length>0&&h.push({type:"group",cssClass:"gaps",commands:He({gaps:F,timeScale:this._timeScale,yRange:l,height:t.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let D=new Map(this._thresholds.map(T=>[T.id??T.name,T]));for(let[T,v]of this._series.entries()){if(v.data.length===0)continue;let L=this._valueScales.get(this._axisIndexOf(v));if(!L)continue;let R=z(v.id??v.name);h.push({type:"group",cssClass:`series series--${R}`,id:`series-${R}`,commands:this._renderSeries(v,L,D,T),...this._clipSeries?{clipRect:{x:i,y:o,w:s,h:a}}:{}});}M&&h.push(M);let P=this._markers.map(T=>({...T}));for(let T of P)if(T.value===void 0&&(T.lineStyle==="to-value"||T.lineStyle==="to-top")){let v=this._series[T.seriesIndex??0];v&&!te(v)&&v.data.length>=2&&(T.value=this._interpolateValue(T.time,v.data));}if(P.length>0&&C){let T=[];for(let v of P){let L=C,R=this._series[v.seriesIndex??0];R&&(L=this._valueScales.get(this._axisIndexOf(R))??C),T.push(...St({markers:[v],timeScale:this._timeScale,valueScale:L,yRange:l}));}h.push({type:"group",cssClass:"markers",commands:T});}let E=this._annotations.filter(T=>!T.id||!this._disabledAnnotations.has(T.id));if(E.length>0&&h.push({type:"group",cssClass:"annotations",commands:kt({annotations:E,timeScale:this._timeScale,valueScales:this._valueScales,metrics:this._textMetrics})}),this._annotationBands.length>0){let T=o+a+this._layout.margin.bottom,v=0;this._annotationBands.forEach(L=>{let R=L.height??12,q=L.spacing??0,oe=T+v;(L.showAxis??false)&&(v+=26+q),v+=R+q,h.push({type:"group",cssClass:"annotation-band",commands:new _e({name:L.name,showAxis:L.showAxis??false,items:L.items,timeScale:this._timeScale,background:L.background,hatch:L.hatch},[i,i+s],oe,R).render()});});}let{xs:G,belegt:O}=Mt(k.map(T=>({achseX:T.achseX,kante:T.kante,position:T.position,schrift:T.style?.fontSize??b.axisLabelSize})),_,t.totalWidth);return h.push(...pt({legende:e,layout:t,randBelegt:O,metrics:this._textMetrics})),h.push(...Dt({axes:this._axes,neueForm:$,achsenTitel:k,titelSpuren:G,layout:t})),Gt(h,this._fontFamily??b.fontFamily),h}_linienGrundlage(e){let t=e.style?.line,r=t&&!Array.isArray(t)?t:void 0,i=this._gapsAutoDetect?this._gapsMinGapMs:void 0,o=Array.isArray(t)?t[0]:r,s=(o?.shape??e.seriesType)==="step",a=o||void 0,m=a?.gapThreshold??i??b.gapThreshold;return {styleLine:t,lineDefaults:r,gapThreshold:m,grundLinie:a,stepShape:s}}_renderSeries(e,t,r,i=0){let o=this._timeScale,s={timeScale:o,valueScale:t};if(te(e))return Ct(e,o,t);let{lineDefaults:a,gapThreshold:m}=this._linienGrundlage(e),l=I.getRuns(e.data,k=>k.value===null,m),h=l.reduce((k,_)=>k+_.length,0);if(h===0)return [];let u=[],c=e.style?.markers,p=e.style?.shadow,d={stroke:a?.color??this._palettenFarbe(i),strokeWidth:a?.width??b.strokeWidth,smoothing:a?.smoothing,smoothingType:a?.smoothingType,dashed:a?.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:f,grundLinie:g,stepShape:y}=this._linienGrundlage(e),x=e.style?.fill;if(x!==void 0){let k=t.range(),_=Math.min(k[0],k[1]),$=Math.max(k[0],k[1]);u.push(...jt(x,{runs:l,timeScale:o,valueScale:t,thresholds:r,chartTop:_,chartBottom:$,smoothing:g?.smoothing,smoothingType:g?.smoothingType,shape:y?"step":"line",fremdeSerie:A=>{let C=this._series.find(D=>(D.id??D.name)===A||D.name===A);if(!C||!("data"in C))return;let B=C.data;if(B.length===0||!("value"in B[0]))return;let M=this._linienGrundlage(C),F=M.grundLinie;return {data:B,shape:M.stepShape?"step":"line",smoothing:F?.smoothing,smoothingType:F?.smoothingType,gapThreshold:M.gapThreshold}},idPrefix:H(e.name,e.id)}));}u.push(...Lt({series:e,ctx:s,runs:l,totalPoints:h,style:d,styleLine:f,styleMarkers:c,stepShape:y,thresholds:r}));let S=e.overlays;if(S&&S.length>0){let k=t.range(),_={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)};S.forEach(($,A)=>{u.push(...It($,_,A));});}return e.style?.gap&&l.length>1&&u.push(...xt({gap:e.style.gap,runs:l,timeScale:o,valueScale:t,metrics:this._textMetrics,lineColor:a?.color})),u}_interpolateValue(e,t){for(let r=1;r<t.length;r++){let i=t[r-1],o=t[r];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 this._legendItems()}_palettenFarbe(e){let t=b.palette;return t.length>0?t[e%t.length]:b.stroke}_legendItems(){return this._series.map((e,t)=>{let r=e.style?.line,i=Array.isArray(r)?r:r?[r]:[],o=e.style?.markers,s=o?.type&&o.type!=="none"&&(o.threshold===void 0||(e.data?.length??0)<=o.threshold),a=te(e)?e.avgColor??b.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,marker:s?o.type:void 0,id:z(e.id??e.name)}})}get renderer(){return this._renderer}get layout(){return this._layout}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let r=this._valueScales.get(t);return r?r.invert(e):0}project(e,t,r=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(r);return {x:i,y:o?o.map(t):0}}};function Ot(n){let e=[];for(let t=0;t<n.length-1;t++){let r=n[t+1].x-n[t].x;e.push(r===0?0:(n[t+1].y-n[t].y)/r);}return e}function Mn(n){let e=Ot(n),t=n.length,r=[...e];for(let i=1;i<t-1;i++)r[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;r[t-1]=e[t-2];for(let i=0;i<t-1;i++){if(e[i]===0){r[i]=0,r[i+1]=0;continue}let o=r[i]/e[i],s=r[i+1]/e[i],a=o*o+s*s;if(a>9){let m=3/Math.sqrt(a);r[i]=m*o*e[i],r[i+1]=m*s*e[i];}}return r}function Dn(n){let e=Ot(n),t=n.length;if(e.length<2)return n.map(()=>e[0]??0);let r=e[0],i=e[1],o=e[e.length-1],s=e[e.length-2],a=2*r-i,m=2*o-s,l=[2*a-r,a,...e,m,2*m-o],h=[];for(let u=0;u<t;u++){let c=Math.abs(l[u+3]-l[u+2]),p=Math.abs(l[u+1]-l[u]);h.push(c+p===0?(l[u+1]+l[u+2])/2:(c*l[u+1]+p*l[u+2])/(c+p));}return h}function $n(n,e){let t=[];for(let r=0;r<n.length-1;r++){let i=n[r],o=n[r+1],s=(o.x-i.x)/3;t.push({p0:i,c1:{x:i.x+s,y:i.y+e[r]*s},c2:{x:o.x-s,y:o.y-e[r+1]*s},p1:o});}return t}function Pn(n,e){if(n.length<2)return [];let t=e==="akima"?Dn(n):Mn(n);return $n(n,t)}function Rn(n){let e=[];for(let t=0;t<n.length-1;t++){let r=n[t-1]??n[t],i=n[t],o=n[t+1],s=n[t+2]??o,a=Math.min(i.x,o.x),m=Math.max(i.x,o.x),l=h=>h<a?a:h>m?m:h;e.push({p0:i,c1:{x:l(i.x+(o.x-r.x)/6),y:i.y+(o.y-r.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 ze(n,e){return e&&e!=="catmull-rom"?Pn(n,e):Rn(n)}var Ve=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],jn={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:Ve,rect:Ve,path:Ve},Bn={line:"stroke-opacity",text:"fill-opacity"},Fn=/ ([a-z-]+)="([^"]*)"/g;function In(n){let e=/^<(line|text|circle|rect|path) /.exec(n)?.[1];if(!e||n.includes(`
25
- `))return null;let t=e==="text"?n.indexOf(">")+1:n.length,r=n.slice(0,t),i=/ opacity="([^"]*)"/.exec(r),o=Bn[e];i&&i[1]==="1"?r=r.replace(i[0],""):i&&o&&!r.includes(` ${o}="`)&&(r=r.replace(i[0],` ${o}="${i[1]}"`));let s=new Map;for(let[,a,m]of r.matchAll(Fn))s.set(a,m);return {art:e,kopf:r,rest:n.slice(t),attrs:s}}function Wt(n){let e=[];for(let r of jn[n[0].art]){if(!n.every(a=>a.attrs.has(r)))continue;let i=new Map;for(let a of n){let m=a.attrs.get(r);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([r,o]);}let t=n.map(r=>{let i=r.kopf;for(let[o,s]of e)i=i.replace(` ${o}="${s}"`,"");return i+r.rest});return {attrs:e.map(([r,i])=>` ${r}="${i}"`).join(""),kinder:t}}function Et(n,e=" "){let t=[];for(let o of n){let s=In(o);if(!s)return null;t.push(s);}if(t.length===0)return null;let r=new Set(t.map(o=>o.art));if(r.size===1){let o=Wt(t);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
26
- `)}}if(r.size!==2||!r.has("line")||!r.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=Wt(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 Ne="1.13.0";var Gn=` <!-- MLTimeGraph ${Ne} -->`,Ht=1e3;function w(n){return String(Math.round(n*Ht)/Ht)}function Xe(n){return Fe(n).toString(16).padStart(8,"0")}function On(n){switch(n){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var Y=class extends ye{#e="100%";#t="100%";#n;#r=new Map;#i=new Map;#o=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);}setBackgroundColor(e){this.#n=e;}render(e){this.#r.clear(),this.#i.clear(),this.#o.clear();let t=e.map(l=>this._toSVG(l));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let r=t.join(`
24
+ `.trim()}function He(n,e=2,t=false){return n==="dashed"||!n&&t?{strokeDasharray:"4,4"}:n==="dotted"?{strokeDasharray:"2,4"}:!n||n==="solid"?null:rt(n,e)}function rt(n,e=2){let t=e;switch(n){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 b=new Proxy({},{get:(n,e)=>J()[e],has:(n,e)=>e in J(),ownKeys:()=>Reflect.ownKeys(J()),getOwnPropertyDescriptor:(n,e)=>Reflect.getOwnPropertyDescriptor(J(),e)});function pe(n,e){if(e<=0||n.length<2)return [];let t=[];for(let r=0;r<n.length-1;r++){let i=n[r],o=n[r+1];for(let s=1;s<=e;s++)t.push(i+(o-i)*s/(e+1));}return t}var ae={axisColor:b.axisColor,tickColor:b.tickColor,textColor:b.textColor,textSize:b.textSize},Q=class{#e;#t;constructor(e){this.#e=new q({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??ae).axisColor}get tickColor(){return (this.#t.colors??ae).tickColor}get textColor(){return (this.#t.colors??ae).textColor}get textSize(){return (this.#t.colors??ae).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,r=this.#t.maxTicks??12,{interval:i}=this.#e.tickInterval((t+r)/2,t,r),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,r=[e[0]];for(let i=1;i<e.length;i++){let o=r[r.length-1].x;Math.abs(e[i].x-o)>=t&&r.push(e[i]);}return r}render(){let e=this.generateTicks(),t=this.#t.colors??ae,r=this.#t.y??0,i=[],[o,s]=this.#e.range();i.push({type:"line",x1:o,y1:r,x2:s,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let a of this.generateMinorTicks())i.push({type:"line",x1:a,y1:r,x2:a,y2:r+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let a of e)i.push({type:"line",x1:a.x,y1:r,x2:a.x,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),i.push({type:"text",content:a.label,x:this.#n(a.x,a.label,t.textSize),y:r+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return i}generateMinorTicks(){return pe(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,r){let i=this.#t.gesamtbreite,o=this.#t.metrics;if(i===void 0||o===void 0)return e;let s=o(t,r)/2;return Math.max(s+2,Math.min(i-s-2,e))}};function ee(n){return "showAs"in n&&!!n.showAs}function it(n){if(ee(n)){let e=[];for(let t of n.data)t.min!==null&&e.push(t.min),t.max!==null&&e.push(t.max);return e}return n.data.map(e=>e.value).filter(e=>e!==null)}function fe(n){return {axisColor:n?.color??b.axisColor,tickColor:n?.color??b.tickColor,textColor:b.textColor,textSize:b.textSize,axisWidth:n?.width??1}}function ot(n,e,t,r){if(r===void 0)return [n,e];let i=typeof r=="number"?r:r.top??0,o=typeof r=="number"?r:r.bottom??0;if(i<=0&&o<=0)return [n,e];let s=t-i-o,a=e-n;if(s<=0||a<=0)return [n,e];let m=a/s;return [n-o*m,e+i*m]}function ge(n,e){return n!==void 0?n:e!==void 0&&e!==false?1:0}var fn=[[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"]],ze=.6,gn=(()=>{let n=new Map;for(let[e,,t]of fn){let r=t.split(",");for(let i=0;i<r.length;i++)n.set(e+i,Number(r[i])/1e3);}return n})();function st(n){return gn.get(n)??ze}var E=(n,e)=>{let t=0;for(let r of n)t+=st(r.codePointAt(0)??0);return t*e},yn=(n,e)=>[...n].length*e*ze;function at(n,e,t){let r=0;for(let i of n)r=Math.max(r,t(i,e));return r}var te={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function lt(n){return Math.abs(n)>=1e6?`${(n/1e6).toFixed(1)}M`:Math.abs(n)>=1e3?`${(n/1e3).toFixed(1)}k`:Number.isInteger(n)?String(n):n.toFixed(1)}function bn(n){let e=new Array(n.length).fill(false),t=0;for(;t<n.length;){let r=t;for(;r+1<n.length&&n[r+1].label===n[t].label;)r++;for(let i=t+1;i<r;i++)e[i]=true;t=r+1;}return e}var ye=class{#e;#t;constructor(e){this.#e=new U({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??te).axisColor}get tickColor(){return (this.#t.colors??te).tickColor}get textColor(){return (this.#t.colors??te).textColor}get textSize(){return (this.#t.colors??te).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let f=this.#t.format??lt;return e.map(g=>({value:g,position:this.#e.map(g),label:f(g)}))}let t=this.#t.format??lt,r=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/r,h=Math.pow(10,Math.floor(Math.log10(l))),u=l/h,c;if(u<=1.5?c=h:u<=3?c=2*h:u<=7?c=5*h:c=10*h,c<=0||!Number.isFinite(c))return [{value:i,position:this.#e.map(i),label:t(i)}];let p=[],d=Math.ceil(s/c)*c;for(let f=d;f<=a;f+=c)p.push({value:f,position:this.#e.map(f),label:t(f)});return p}generateMinorTicks(){return pe(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??te,r=this.#t.x??0,i=this.#t.orientation??"vertical",o=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],a=this.#t.suppressTolerancePx??8,m=u=>s.some(c=>Math.abs(c-u)<=a),l=[];if(i==="vertical"){let[u,c]=this.#e.range();l.push({type:"line",x1:r,y1:u,x2:r,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let p=bn(e);e.forEach((d,f)=>{let g=m(d.position),y=p[f]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:d.position,x2:r,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||l.push({type:"text",content:d.label,x:this.#n(r-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(l.push({type:"line",x1:r,y1:d.position,x2:r+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||l.push({type:"text",content:d.label,x:this.#n(r+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();l.push({type:"line",x1:u,y1:r,x2:c,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let p of e)l.push({type:"line",x1:p.position,y1:r,x2:p.position,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:p.label,x:p.position,y:r+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let h=(this.#t.orientation??"vertical")==="vertical";for(let u of this.generateMinorTicks())l.push(h?{type:"line",x1:o==="right"?r:r-2,y1:u,x2:o==="right"?r+2:r,y2:u,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:u,y1:r,x2:u,y2:r+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return l}#n(e,t,r){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??te).textSize);return r==="end"?Math.max(s+2,Math.min(i-2,e)):Math.min(i-s-2,Math.max(2,e))}};function mt(n){let e=new Set,t={};for(let r of n){let i=r.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((r,i)=>r-i):void 0,name:r=>t[r]??String(r)}}function ht(n){let{axes:e,indices:t,seriesByIndex:r,layout:i,thresholds:o,metrics:s}=n,{chartX:a,chartY:m,chartWidth:l,chartHeight:h}=i,u=[],c=new Map,p,d=[],f=[],g=(e?.y?.length??0)>0,y=0,x=0;for(let S of t){let k=r.get(S),T=1/0,D=-1/0,M=false;for(let B of k)for(let ue of it(B))ue<T&&(T=ue),ue>D&&(D=ue),M=true;if(!M)continue;T===D&&(T-=1,D+=1);let v=S===0?e?.left:S===1?e?.right:void 0,C=e?.y&&e.y.length>S?e.y[S]:void 0,$=C&&v?{...v,...C}:C??v,I=$?.domain,P=I&&I!=="auto"?I:ot(T,D,h,$?.padding),{werte:j,name:z}=mt(k);if(j){let B=j.length>1?(j[j.length-1]-j[0])/(j.length-1):1;P[0]=j[0]-B/2,P[1]=j[j.length-1]+B/2;}let O=new U({domain:P,range:[m+h,m]});c.set(S,O);let _=$?.position??(S===0?"left":"right"),A=_==="right"?"outside-right":"outside-left",L=o.filter(B=>(B.axisIndex??0)===S&&typeof B.label=="object"&&B.label!==null&&B.label.position===A&&B.value>=Math.min(P[0],P[1])&&B.value<=Math.max(P[0],P[1])).map(B=>O.map(B.value)),R;if(_==="right"){let B=$?.offset??x*50;R=a+l+B,x++;}else {let B=$?.offset??y*50;R=a-B,y++;}let V=new ye({domain:P,range:[m+h,m],x:R,position:_,format:$?.format??(j?z:void 0),tickValues:j,ticks:$?.ticks?.major,minorTicks:ge($?.ticks?.minor,K($?.grid)?.minor),colors:fe($?.axis),suppressLabelsNear:L.length?L:void 0,gesamtbreite:i.totalWidth,metrics:s}),oe=8+at(V.generateTicks().map(B=>B.label),11,s),Oe=_==="right"?R+oe:R-oe;f.push({position:_,von:Math.min(R,Oe),bis:Math.max(R,Oe)}),g&&$?.label&&d.push({text:$.label,achseX:R,kante:Oe,position:_,style:$.labels}),S===0&&(p=V),u.push({type:"group",cssClass:`value-axis ${_}`,sharedStyles:true,commands:V.render()});}return {commands:u,titel:d,baender:f,neueForm:g,primary:p,scales:c}}var F=class{static interpolateDataPoint(n,e,t){return {time:n.time+Math.round(t*(e.time-n.time)),value:(n.value??0)+t*((e.value??0)-(n.value??0)),synthetic:true}}static interpolateAggregatedPoint(n,e,t){let r=(i,o)=>i!==null&&o!==null?i+t*(o-i):null;return {time:n.time+t*(e.time-n.time),min:r(n.min,e.min),max:r(n.max,e.max),avg:r(n.avg,e.avg),count:Math.round(n.count+t*(e.count-n.count))}}static getRuns(n,e,t=0){let r=[...n].sort((a,m)=>a.time-m.time),i=[],o=[],s=null;for(let a of r){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(n,e,t,r){if(n.length===0)return [];if(e.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let i=[...e].sort((l,h)=>l-h),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let h=0;for(let u=0;u<i.length&&l>=i[u];u++)h=u+1;return h},m=[n[0]];for(let l=1;l<n.length;l++){let h=n[l-1],u=n[l],c=t(h),p=t(u),d;p>c?d=i.filter(g=>g>c&&g<=p):p<c?d=i.filter(g=>g>=p&&g<c).reverse():d=[];let f=c;for(let g of d){let y=(g-c)/(p-c),x=r(h,u,y);m.push(x);let S=a((f+g)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[x],f=g;}(d.length===0||d[d.length-1]!==p)&&m.push(u);}if(m.length>1||n.length===1){let l=t(m[0]),h=t(m[m.length-1]),u=a((l+h)/2);o.push({data:m,zoneIndex:u,zoneLow:s(u)});}return o}static splitByThreshold(n,e,t,r){let i=this.splitByBoundaries(n,[e],t,r),o={above:[],below:[]};for(let s of i)s.zoneIndex===0?o.below.push(s.data):o.above.push(s.data);return o}};function ut(n,e=6e4){if(n.length<2)return [];let t=[...n].sort((i,o)=>i.time-o.time),r=[];for(let i=1;i<t.length;i++)t[i].time-t[i-1].time>e&&r.push({startTime:t[i-1].time,endTime:t[i].time});return r}function xn(n,e=83144){let t=e/8.314,r=0,i=0;for(let s of n)s!==null&&(r+=Math.exp(-t/(s+273.15)),i++);if(i===0)return null;let o=r/i;return t/-Math.log(o)-273.15}function ct(n,e,t=83144){let r=new Array(n.length),i=0;for(let o=0;o<n.length;o++){let s=n[o].time,a=s-e;for(;i<o&&n[i].time<a;)i++;let m=n.slice(i,o+1).map(h=>h.value),l=xn(m,t);r[o]={time:s,value:l,synthetic:true};}return r}function Sn(n){let e=0,t=0;for(let o of n)o!==null&&(e+=o,t++);if(t===0)return null;let r=e/t,i=0;for(let o of n){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/t)}function wn(n){let e=0,t=0;for(let o of n)o!==null&&(e+=o,t++);if(t<2)return null;let r=e/t,i=0;for(let o of n){if(o===null)continue;let s=o-r;i+=s*s;}return Math.sqrt(i/(t-1))}function dt(n,e,t=false){let r=new Array(n.length),i=0,o=t?wn:Sn;for(let s=0;s<n.length;s++){let a=n[s].time,m=a-e;for(;i<s&&n[i].time<m;)i++;let l=n.slice(i,s+1).map(u=>u.value),h=o(l);r[s]={time:a,value:h,synthetic:true};}return r}function Ve(n,e){let t=new Array(n.length),r=0;for(let i=0;i<n.length;i++){let o=n[i].time,s=o-e;for(;r<i&&n[r].time<s;)r++;let a=0,m=0;for(let l=r;l<=i;l++){let h=n[l].value;h!==null&&(a+=h,m++);}t[i]={time:o,value:m===0?null:a/m,synthetic:true};}return t}function pt(n,e){let t=new Array(n.length),r=null,i=0;for(let o=0;o<n.length;o++){let s=n[o].time,a=n[o].value;if(a===null){t[o]={time:s,value:r,synthetic:true};continue}if(r===null||e<=0)r=a;else {let m=1-Math.exp(-(s-i)/e);r=a*m+r*(1-m);}i=s,t[o]={time:s,value:r,synthetic:true};}return t}function X(n){let e=[];for(let t of n)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}var be=class{};function ft(n,e,t,r){let i=Se(t);if(!i.markers.type||i.markers.type==="none")return [];let o=[];for(let s=0;s<n.length;s++){let a=n[s],m=e.timeScale.map(a.time),l=e.valueScale.map(a.value),h=r(a),u=t.pointStroke??h,c=t.pointFill??h,p=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${s}`:void 0;xe(o,d,i.markers.type,m,l,i.markers.size,u,c,p);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function xe(n,e,t,r,i,o,s,a,m){let l=h=>e===void 0?void 0:`${e}-${h}`;switch(t){case "circle":n.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});break;case "square":n.push({type:"rect",x:r-o,y:i-o,w:o*2,h:o*2,fill:a,stroke:s,strokeWidth:m,id:e});break;case "cross":n.push({type:"line",x1:r-o,y1:i-o,x2:r+o,y2:i+o,stroke:s,strokeWidth:m,id:e},{type:"line",x1:r-o,y1:i+o,x2:r+o,y2:i-o,stroke:s,strokeWidth:m,id:l(2)});break;case "diamond":n.push({type:"path",points:[{x:r,y:i-o},{x:r+o,y:i},{x:r,y:i+o},{x:r-o,y:i}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "triangle":n.push({type:"path",points:[{x:r,y:i-o},{x:r+o,y:i+o},{x:r-o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "star":{let h=[];for(let u=0;u<10;u++){let c=u%2===0?o:o*.5,p=Math.PI/2*3+u*Math.PI/5;h.push({x:r+c*Math.cos(p),y:i+c*Math.sin(p)});}n.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "arrow":n.push({type:"path",points:[{x:r-o,y:i+o},{x:r,y:i-o},{x:r+o,y:i+o}],stroke:s,strokeWidth:m,fill:"none",id:e});break;case "plus":n.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e},{type:"line",x1:r,y1:i-o,x2:r,y2:i+o,stroke:s,strokeWidth:m,id:l(2)});break;case "triangle-down":n.push({type:"path",points:[{x:r,y:i+o},{x:r+o,y:i-o},{x:r-o,y:i-o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "hexagon":{let h=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);h.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}n.push({type:"path",points:h,closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break}case "hourglass":n.push({type:"path",points:[{x:r-o,y:i-o},{x:r+o,y:i-o},{x:r-o,y:i+o},{x:r+o,y:i+o}],closed:true,fill:a,stroke:s,strokeWidth:m,id:e});break;case "line-horizontal":n.push({type:"line",x1:r-o,y1:i,x2:r+o,y2:i,stroke:s,strokeWidth:m,id:e});break;default:n.push({type:"circle",cx:r,cy:i,r:o,fill:a,stroke:s,strokeWidth:m,id:e});}}var we=class n{#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 r=new n;return t(r),r.length===0?this:(this.#e.push({type:"group",...e,commands:r.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var kn="#ffffff",Tn="#cccccc",vn=6,_n=.85,Y=12,Te=8,le=20,Cn=11,ke=18,Ne=(n,e)=>e(n,Cn);function gt(n,e,t){let r=a=>Y+Te+Ne(a.name,e);if(t===void 0){let a=n.reduce((m,l)=>m+r(l)+ke,0)-ke;return [{items:n,breite:Math.max(0,a)}]}let i=[],o=[],s=0;for(let a of n){let m=r(a),l=o.length===0?m:s+ke+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 yt(n,e="vertical",t=E,r){if(e==="horizontal"){let o=gt(n,t,r);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*le}}let i=0;for(let o of n)i=Math.max(i,Ne(o.name,t));return {width:Y+Te+i,height:n.length*le}}function Mn(n){let{items:e,x:t,y:r,orientation:i="vertical",metrics:o=E,maxBreite:s,box:a,itemClass:m}=n,l=new we;if(a&&e.length>0){let c=yt(e,i,o,s),d=((i==="horizontal"?c.height/le:e.length)-1)*le+Y,f=a.padding??vn,g=a.stroke??Tn;l.rect({x:t-f,y:r-f,w:c.width+2*f,h:d+2*f,fill:a.fill??kn,...g==="none"?{}:{stroke:g,strokeWidth:a.strokeWidth??1},opacity:a.opacity??_n});}let h=i==="horizontal"?gt(e,o,s):e.map(c=>({items:[c],breite:0})),u=new Map;return h.forEach((c,p)=>{let d=t;for(let f of c.items)u.set(f,{x:d,y:r+p*le}),d+=Y+Te+Ne(f.name,o)+ke;}),e.forEach(c=>{let p=u.get(c)??{x:t,y:r},d=p.x,f=p.y,g=["legend-item"];c.id&&g.push(`legend-item--${c.id}`),m&&g.push(m),l.group({cssClass:g.join(" "),...c.id?{id:`legend-${c.id}`}:{}},y=>{y.rect({x:d,y:f,w:Y,h:Y,fill:c.color,stroke:b.legendStroke,strokeWidth:1}).text({content:c.name,x:d+Y+Te,y:f+Y-2,fontSize:b.legendFont,fill:b.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function bt(n){let{legend:e,items:t,gesamtbreite:r,metrics:i}=n,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"?r-16:void 0;return {items:t,show:o,position:s,orientation:a,maxBreite:m,size:o?yt(t,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function xt(n,e){let t=n.position==="outside-right"||n.position==="outside-left"||n.position==="above"||n.position==="below";if(!n.show||!t)return null;let r={...e},i=2*n.boxRand;return n.position==="outside-right"?r.right+=n.size.width+i+16:n.position==="outside-left"?r.left+=n.size.width+i+16:n.position==="above"?r.top+=n.size.height+i+10:r.bottom+=n.size.height+i+10,r}function St(n){let{legende:e,layout:t,randBelegt:r,metrics:i}=n;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 h=r.filter(u=>u.position==="right").reduce((u,c)=>Math.max(u,c.bis),o+a);m=Math.min(Math.max(o+a+16,h+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 [Mn({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function wt(n){let{xTicks:e,yTicks:t,xRange:r,yRange:i,stroke:o=b.gridStroke,strokeWidth:s=b.gridStrokeWidth,dashed:a=false,opacity:m=b.gridOpacity}=n,l=[];if(t)for(let h of t)l.push({type:"line",x1:r[0],y1:h,x2:r[1],y2:h,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let h of e)l.push({type:"line",x1:h,y1:i[0],x2:h,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function kt(n){let{axes:e,timeAxis:t,primaryValueAxis:r,xRange:i,yRange:o}=n,s=K(e?.x?.grid),a=K(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,h=a?.major,u=T=>T!==void 0&&T!==false;if(!u(l)&&!u(h))return {group:null,layer:m};let c=l!==false,p=h!==false&&!!r,d=c?t.generateTicks().map(T=>T.x):void 0,f=p?r.generateTicks().map(T=>T.position):void 0;if(!d&&!f)return {group:null,layer:m};let g=(l&&typeof l=="object"?l:void 0)??(h&&typeof h=="object"?h:void 0),y=s?.minor,x=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(x&&typeof x=="object"?x:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||x!==void 0?wt({xTicks:y!==false&&c?t.generateMinorTicks():void 0,yTicks:x!==false&&p?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(b.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...wt({xTicks:d,yTicks:f,xRange:i,yRange:o,stroke:g?.color,opacity:g?.opacity,dashed:g?.style==="dashed"})]},layer:m}}function An(n){return n==="dotted"?{dash:"dotted"}:n==="dashed"?{dash:"dashed"}:{}}function Ln(n){let{thresholds:e,valueScale:t,xRange:r}=n,[i,o]=r,[s,a]=t.range(),m=Math.min(s,a),l=Math.max(s,a),h=[],u=[];for(let c of e){let p=c.color??b.thresholdColor,d=t.map(c.value);c.fill==="above"?h.push({type:"rect",x:i,y:m,w:o-i,h:Math.max(0,d-m),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&h.push({type:"rect",x:i,y:d,w:o-i,h:Math.max(0,l-d),fill:p,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let f=c.line??b.thresholdLine;if(f!=="none"){let S=An(f),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),h.push(k);}let[g,y]=t.domain();if(c.value>=Math.min(g,y)&&c.value<=Math.max(g,y)&&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,T=S?.position??"right",D=$n(k,T,i,o,d,p,S);u.push({...D,y:Dn(D.y,Math.min(s,a),Math.max(s,a),b.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:h,labels:u}}function Dn(n,e,t,r){return Math.max(e+r,Math.min(t-r/2,n))}function $n(n,e,t,r,i,o,s){let a=(t+r)/2,m={type:"text",content:n,fontSize:b.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:r+6,y:i+3,anchor:"start",textBaseline:l.textBaseline??"middle"};default:return {...m,...l,x:r-4,y:i-4,anchor:"end"}}}function Tt(n){let{thresholds:e,valueScales:t,primaryScale:r,xRange:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,h=[];if(e.length===0)return h;let u=[],c=[];for(let p of e){let d=p.id??N(p.name),f=t.get(p.axisIndex??0)??r,g=Ln({thresholds:[p],valueScale:f,xRange:i});g.inside.length&&u.push({type:"group",cssClass:`threshold threshold--${d}`,id:`threshold-${d}`,commands:g.inside}),g.labels.length&&c.push({type:"group",cssClass:`threshold-label threshold-label--${d}`,commands:g.labels});}return u.length&&h.push({type:"group",cssClass:"thresholds",commands:u,clipRect:{x:s,y:a,w:m,h:l}}),c.length&&h.push({type:"group",cssClass:"threshold-labels",commands:c}),h}function vt(n,e,t,r){switch(n){case "above":return e-5;case "below":return r!==void 0?r-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function ve(n){let{ranges:e,timeScale:t,yRange:r,height:i,metrics:o=E}=n,[s,a]=r,m=[],[l,h]=t.range(),u=Math.min(l,h),c=Math.max(l,h),p=d=>Math.max(u,Math.min(c,d));for(let d of e){let f=p(t.map(d.startTime)),g=p(t.map(d.endTime));if(d.fill!==void 0&&m.push({type:"rect",x:f,y:s,w:g-f,h:a-s,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let y of [f,g])m.push({type:"line",x1:y,y1:s,x2:y,y2:a,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let y=d.labelPosition??"middle",x=d.rotate;if(x==="auto"){let S=y!=="above"&&y!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(g-f)-4?-90:void 0;}m.push({type:"text",content:d.label,x:(f+g)/2,y:vt(y,s,a,i),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return m}function Xe(n){let{gaps:e,timeScale:t,yRange:r,height:i,fill:o=b.gapFill,hatch:s,fillOpacity:a=b.gapFillOpacity??.15,stroke:m=b.gapStroke,strokeWidth:l=b.gapStrokeWidth,dashed:h=true,fontSize:u=b.gapFontSize,fontFill:c=b.gapFontColor,labelBaseline:p="middle",labelRotate:d,metrics:f,band:g}=n,y=()=>{if(!g)return [];let x=g.height??6,[S,k]=r,T=Math.max(S,k);return e.map(D=>{let M=t.map(D.startTime),v=t.map(D.endTime);return {type:"rect",x:Math.min(M,v),y:T-x+(g.offset??0),w:Math.abs(v-M),h:x,fill:g.fill??m,opacity:g.opacity??.75}})};return ve({timeScale:t,yRange:r,height:i,metrics:f,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",T=S==="dashed_border"&&h!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??s,opacity:x.fillOpacity??a},...T&&{edges:{stroke:m,strokeWidth:l}},label:x.label,labelPosition:x.labelBaseline??p,labelColor:c,fontSize:u,rotate:x.rotate??d}})}).concat(y())}function _t(n){let{gap:e,runs:t,timeScale:r,valueScale:i,metrics:o,lineColor:s}=n,a=[],m=e.bridge,l=[];for(let h=1;h<t.length;h++){let u=t[h-1][t[h-1].length-1],c=t[h][0];if(e.display==="bridge_line"){if(u.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(u.time),y1:i.map(u.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??b.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:u.time,endTime:c.time});}if(l.length>0){let h=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",u=e.fill,c=typeof u=="string"?u:u?.color,p=i.range();a.push(...Xe({gaps:l.map(d=>({...d,style:h})),timeScale:r,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 a}function Ct(n){let{markers:e,timeScale:t,valueScale:r,yRange:i=[0,300]}=n,[o,s]=i,a=[];for(let m of e){let l=t.map(m.time),h=m.color??b.markerColor,u=m.pointStyle??(m.value!==void 0?"circle":"none"),c=m.lineStyle??"full";if(m.value!==void 0){let p=r.map(m.value);if(c==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:p,stroke:h,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:p,stroke:h,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:h,strokeWidth:1}),u!=="none"&&xe(a,void 0,u,l,p,b.markerSize,h,h,1.5),m.label){let d=c==="to-value"?p-10:o-6;a.push({type:"text",content:m.label,x:l,y:d,anchor:"middle",fontSize:b.markerFontSize,fill:h});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:h,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:b.markerFontSize,fill:h});}return a}function Mt(n){let{highlights:e,timeScale:t,yRange:r,height:i}=n;return ve({metrics:n.metrics,timeScale:t,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??b.highlightColor,opacity:o.opacity??b.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??b.highlightLabelColor,fontSize:b.annotationFontSize,rotate:o.rotate}))})}function At(n){let{annotations:e,timeScale:t,valueScales:r}=n,i=[],o=s=>{let a=r.get(s.axis??0)??r.values().next().value;return {x:t.map(s.time),y:a?a.map(s.value):0}};for(let s of e){let a=[],m=l=>a.push(l);switch(s.type){case "line":{let l=o(s.from),h=o(s.to);m({type:"line",x1:l.x,y1:l.y,x2:h.x,y2:h.y,stroke:s.color??b.annotationColor,strokeWidth:s.width??b.annotationWidth,dash:s.dash});break}case "arrow":{let l=o(s.from),h=o(s.to),u=s.color??b.annotationColor,c=s.headSize??b.annotationHead;m({type:"line",x1:l.x,y1:l.y,x2:h.x,y2:h.y,stroke:u,strokeWidth:s.width??b.annotationWidth});let p=Math.hypot(h.x-l.x,h.y-l.y)||1,d=(h.x-l.x)/p,f=(h.y-l.y)/p,g=h.x-d*c,y=h.y-f*c;m({type:"path",points:[{x:h.x,y:h.y},{x:g-f*c*.5,y:y+d*c*.5},{x:g+f*c*.5,y:y-d*c*.5}],fill:u,stroke:"none"});break}case "rect":{let l=o(s.from),h=o(s.to);m({type:"rect",x:Math.min(l.x,h.x),y:Math.min(l.y,h.y),w:Math.abs(h.x-l.x),h:Math.abs(h.y-l.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let l=o(s.at),h=s.color??"#334155",u=s.radius??b.annotationRadius,c=s.shape??"circle";c==="circle"?m({type:"circle",cx:l.x,cy:l.y,r:u,fill:h}):c==="square"?m({type:"rect",x:l.x-u,y:l.y-u,w:u*2,h:u*2,fill:h}):(m({type:"line",x1:l.x-u,y1:l.y-u,x2:l.x+u,y2:l.y+u,stroke:h,strokeWidth:1.5}),m({type:"line",x1:l.x-u,y1:l.y+u,x2:l.x+u,y2:l.y-u,stroke:h,strokeWidth:1.5}));break}case "label":{let l=o(s.at);m({type:"text",content:s.text,x:l.x+(s.dx??0),y:l.y+(s.dy??0),anchor:s.anchor??Pn(l.x+(s.dx??0),s.text,n),fontSize:b.annotationFontSize,fill:s.color??b.annotationColor,rotate:s.rotate});break}}if(s.id&&a.length>0){let l=N(s.id);i.push({type:"group",cssClass:`annotation annotation--${l}`,commands:a});}else i.push(...a);}return i}function Pn(n,e,t){let{metrics:r,timeScale:i}=t;if(!r)return "middle";let[o,s]=i.range(),a=r(e,b.annotationFontSize)/2;return n-a<o?"start":n+a>s?"end":"middle"}var ne=class n{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++n.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var _e=class extends ne{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let r of this.data)r.count>t&&(t=r.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??b.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??b.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),h=e.valueScale.map(m.max),u=e.valueScale.map(m.min),c=s,p=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:h,w:c,h:u-h,fill:t,hatch:r,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-c/2,y1:d,x2:l+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${p}`:void 0});}}return a}};var Rn=1,Ce=class{#e;constructor(e,t,r,i){this.#e={...e,xRange:t,y:r,height:i};}render(){let{items:e,timeScale:t,background:r,hatch:i,showAxis:o,xRange:s,y:a,height:m}=this.#e,l=[];r&&l.push({type:"rect",x:s[0],y:a,w:s[1]-s[0],h:m,fill:r,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let h of e){let u=t.map(h.startTime),c=t.map(h.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)),f=Math.max(d-p,Rn);p+f>s[1]&&(p=Math.max(s[0],s[1]-f));let g=p+f/2;if(l.push({type:"rect",x:p,y:a,w:f,h:m,hatch:h.hatch??i,fill:h.fill??"#6b728044",stroke:h.stroke,strokeWidth:h.strokeWidth??0,title:h.title}),h.label){let y=h.labelFontSize??10;l.push({type:"text",content:h.label,x:g,y:this.#t(h.labelBaseline,y),anchor:"middle",fontSize:y,fill:h.labelFill??"#333"});}}if(o){let h=new Q({domain:t.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:h.render()});}return l}#t(e,t){let{y:r,height:i}=this.#e;switch(e){case "top":return r+t*.9;case "bottom":return r+i-t*.25;default:return r+i/2+t*.35}}};function Se(n){return {id:n.id,line:{stroke:n.stroke??b.stroke,strokeWidth:n.strokeWidth??b.strokeWidth,smoothing:n.smoothing??false,smoothingType:n.smoothingType,dashed:n.dashed??false},fill:n.fill??b.areaFillAlpha,markers:{type:n.pointStyle??"none",size:n.pointSize??b.pointSize,stroke:n.stroke??b.stroke,fill:"#ffffff"},shadow:{color:n.shadowColor??"transparent",blur:n.shadowBlur??0,offsetX:n.shadowOffsetX??0,offsetY:n.shadowOffsetY??0}}}function Lt(n,e,t){let r=[],i=Se(t);for(let o=0;o<n.length;o++){let s=n[o];s.data.length>=2?r.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&&r.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 r}function Dt(n,e,t,r){if(n.length<2)return [];let i=F.splitByBoundaries(n,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(u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(t.yLow(u))})),h=a.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:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...h],fill:m,hatch:t.getHatch?.(a.zoneIndex),stroke:"none",...r?.smoothing?{smoothing:true,smoothingType:r.smoothingType,smoothCount:a.data.length,smoothTail:a.data.length}:{}});}return o}function $t(n,e,t,r,i,o,s){return Dt(n,e,{boundaries:[],yLow:a=>a.avg,yHigh:t,getValue:a=>a.avg,interpolate:F.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var Me=class extends ne{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??b.minColor,r=e.maxColor??b.maxColor,i=e.avgColor??b.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??b.strokeWidth,l=F.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(l.length===0)return [];let h={timeScale:this.timeScale,valueScale:e.valueScale},u=[];l.forEach((d,f)=>{if(d.length<2)return;let g=y=>this.id?`${this.id}-${y}-${f}`:void 0;if(e.fillToMax){let y=$t(d,h,x=>x.max,e.fillToMax,e.fillToMaxHatch,g("fillToMax"),{smoothing:s,smoothingType:a});u.push(...y);}if(e.fillToMin){let y=$t(d,h,x=>x.min,e.fillToMin,e.fillToMinHatch,g("fillToMin"),{smoothing:s,smoothingType:a});u.push(...y);}});let c=l.filter(d=>d.length>=2),p=(d,f,g,y=false)=>Lt(c.map(x=>({data:x.map(S=>({time:S.time,value:d(S)}))})),h,{stroke:f,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${g}`:void 0});return u.push(...p(d=>d.max,r,"max"),...p(d=>d.min,t,"min"),...p(d=>d.avg,i,"avg",o)),u}};function Pt(n,e,t){let r=n.style?.line&&!Array.isArray(n.style.line)?n.style.line:void 0,i=typeof n.style?.fill=="string"?n.style.fill:void 0;return n.showAs==="minmaxavg"?new Me({data:n.data,timeScale:e,valueScale:t,minColor:n.minColor,maxColor:n.maxColor,avgColor:n.avgColor,avgDashed:n.avgDashed,fillToMax:n.fillToMax,fillToMaxHatch:n.fillToMaxHatch,fillToMin:n.fillToMin,fillToMinHatch:n.fillToMinHatch,smoothing:r?.smoothing,smoothingType:r?.smoothingType,strokeWidth:r?.width,id:W(n.name,n.id)}).render():new _e({data:n.data,timeScale:e,valueScale:t,fill:i??r?.color,avgLine:n.avgLine,countOpacity:n.countOpacity,id:W(n.name,n.id)}).render()}function Rt(n,e,t){let r=n??[];return {grenzen:r.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 r){let h=e.get(l);!h||o<h.value||h.value<m||(m=h.value,a=h.color??a);}return a}}}function jt(n){let{series:e,ctx:t,runs:r,totalPoints:i,style:o,styleLine:s,styleMarkers:a,stepShape:m,thresholds:l}=n,{timeScale:h,valueScale:u}=t,c=[],p=Rt(e.colorByThresholds,l,o.stroke),d=p.grenzen,f=new Map;for(let y of r){let k=function(M){return F.splitByBoundaries(M==="step"?X(y):y,d,v=>v.value,F.interpolateDataPoint)};if(y.length<1)continue;let x=W(e.name,e.id),S=new Map,T=M=>{let v=S.get(M);return v||(v=k(M),S.set(M,v)),v},D=(M,v,C)=>{let $=T(M);for(let I of $){let P=I,j=f.get(C)??0;if(f.set(C,j+1),P.data.length<1)continue;let z=P.zoneLow;if(P.data.length===1){let O=p.farbe(z,v.color);c.push({type:"circle",id:x?`${x}-dot-${j}${C}`:void 0,cx:h.map(P.data[0].time),cy:u.map(P.data[0].value),r:Math.max(o.pointSize??b.pointSize,v.width??o.strokeWidth??b.strokeWidth),fill:O,shadowColor:o.shadowColor,shadowBlur:o.shadowBlur});continue}c.push({type:"path",cssClass:"series-line",id:x?`${x}-line-${j}${C}`:void 0,points:P.data.map(O=>({x:h.map(O.time),y:u.map(O.value)})),stroke:p.farbe(z,v.color),strokeWidth:v.width??o.strokeWidth,smoothing:M==="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((M,v)=>{D(M.shape??(e.seriesType==="step"?"step":"line"),M,`-${v}`);}):D(m?"step":"line",s??{},"")),o.pointStyle&&o.pointStyle!=="none"&&i<=(a?.threshold??b.pointThreshold)&&c.push(...ft(y,t,o,M=>p.farbe(M.value)));}return c}function Bt(n,e,t){let i=new Array(n.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=n.map((l,h)=>({t:l,i:h})).filter(l=>l.t.position===s).sort((l,h)=>a?h.t.achseX-l.t.achseX:l.t.achseX-h.t.achseX);for(let{t:l,i:h}of m){let u=l.schrift/2,c=o.filter(f=>f.position===s),p=l.kante,d=a?p-1-u:p+1+u;for(let f=0;f<=c.length;f++){let g=d-u-1,y=d+u+1,x=c.find(S=>g<S.bis&&S.von<y);if(!x)break;p=a?x.von:x.bis,d=a?p-1-u:p+1+u;}if(a?d-u<2:d+u>t-2){let f=o.filter(g=>g.position===s&&g.titel);d=a?u+2:t-u-2;for(let g=0;g<=f.length;g++){let y=d-u-1,x=d+u+1,S=f.find(k=>y<k.bis&&k.von<x);if(!S)break;d=a?S.bis+1+u:S.von-1-u;}}o.push({position:s,von:d-u-1,bis:d+u+1,titel:true}),i[h]=d;}}return {xs:i,belegt:o}}function Ft(n){let{axes:e,neueForm:t,achsenTitel:r,titelSpuren:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,h=t?void 0:e?.left?.label,u=t?void 0:e?.right?.label,c=e?.x?.label;if(!h&&!u&&!c&&r.length===0)return [];let p=[],d=a+l/2,f=e?.left?.labels,g=e?.right?.labels,y=e?.x?.labels;return h&&p.push({type:"text",content:h,x:14,y:d,anchor:"middle",fontSize:f?.fontSize??b.axisLabelSize,fill:f?.color??b.axisLabelColor,rotate:-90}),u&&p.push({type:"text",content:u,x:o.totalWidth-14,y:d,anchor:"middle",fontSize:g?.fontSize??b.axisLabelSize,fill:g?.color??b.axisLabelColor,rotate:90}),r.forEach((x,S)=>{p.push({type:"text",content:x.text,x:i[S],y:d,anchor:"middle",fontSize:x.style?.fontSize??b.axisLabelSize,fill:x.style?.color??b.axisLabelColor,rotate:x.position==="right"?90:-90});}),c&&p.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6,anchor:"middle",fontSize:y?.fontSize??b.axisLabelSize,fill:y?.color??b.axisLabelColor}),p.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:p}]}function re(n){return n!==void 0&&typeof n=="object"&&"series"in n?n.series:null}function It(n){let e=[...n].sort((r,i)=>r.time-i.time),t=0;return r=>{for(;t>0&&e[t].time>r;)t--;for(;t<e.length-1&&e[t+1].time<=r;)t++;let i=e[t];if(!i||r<i.time)return null;if(i.time===r)return i.value??null;let o=e[t+1];if(!o||r>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)*(r-i.time)/s}}function Ot(n,e,t){let r=n??e;if(r==="series")return null;if(r==="chartTop")return t.chartTop;if(r==="chartBottom")return t.chartBottom;if(typeof r=="object"&&"threshold"in r){let i=t.thresholds.get(r.threshold);if(!i)throw new Error(`fillSpec region references unknown threshold '${r.threshold}'`);return t.valueScale.map(i.value)}return typeof r=="object"&&"value"in r?t.valueScale.map(r.value):null}function jn(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function Gt(n,e,t){let r=Ot(n.from,"chartBottom",e),i=Ot(n.to,"series",e),{color:o,hatch:s}=jn(n.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:h=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${h}`}:{}};return re(n.from)!==null||re(n.to)!==null?Fn(n,e,l):r!==null&&i!==null?In(r,i,e,l):On(n,e,r,i,l)}function Bn(n,e,t){let r=e.shape==="step",i=(u,c)=>{let p=u??c,d=re(p);if(d!==null){let y=e.fremdeSerie(d);if(!y)return null;let x=y.shape==="step";return {art:"fremd",laeufe:F.getRuns(y.data,k=>k.value===null,y.gapThreshold).map(k=>x?X(k):k),glatt:!x&&!!y.smoothing,verfahren:y.smoothingType}}if(p==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=Ae(p,e),g=e.valueScale.domain();return {art:"fest",wert:f??(p==="chartBottom"?g[0]:g[1]),glatt:false}},o=i(n.from,"chartBottom"),s=i(n.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=u=>({x:e.timeScale.map(u.time),y:e.valueScale.map(u.value)}),m=(u,c)=>u.art==="eigene"?[c]:u.art==="fremd"?u.laeufe.filter(p=>p.length>=2):[null],l=(u,c,p,d)=>c?c.map(a):[p,d].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(u.wert)})),h=[];for(let u of e.runs){if(u.length<2)continue;let c=r?X(u):u;for(let p of m(o,c))for(let d of m(s,c)){let f=Math.max(c[0].time,p?.[0].time??-1/0,d?.[0].time??-1/0),g=Math.min(c.at(-1).time,p?.at(-1).time??1/0,d?.at(-1).time??1/0);if(!(g>f))continue;let y={k:o,pts:l(o,p,f,g)},x={k:s,pts:l(s,d,f,g)};y.k.glatt||([y,x]=[x,y]);let S=T=>(T.art==="fest"?void 0:T.verfahren)??"catmull-rom",k=e.timeScale.map(f);h.push({type:"group",clipRect:{x:k,y:e.chartTop,w:e.timeScale.map(g)-k,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(h.length),points:[...y.pts,...[...x.pts].reverse()],smoothing:true,smoothingType:S(y.k),smoothCount:y.pts.length,...x.k.glatt?{smoothTail:x.pts.length,smoothTailType:S(x.k)}:{}}]});}}return h}function Fn(n,e,t){if(!e.fremdeSerie){let a=re(n.from)??re(n.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=Bn(n,e,t);if(r)return r;let i=(a,m,l)=>{let h=a??m,u=re(h);if(u!==null){let f=e.fremdeSerie(u);if(!f)throw new Error(`fillSpec region references unknown series '${u}'`);let g=f.shape==="step"?X(f.data):f.data;return {bei:It(g),zeiten:g.map(y=>y.time)}}if(h==="series")return {bei:It(l),zeiten:l.map(f=>f.time)};let c=Ae(h,e),p=e.valueScale.domain(),d=c??(h==="chartBottom"?p[0]:p[1]);return {bei:()=>d,zeiten:[]}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?X(a):a,l=i(n.from,"chartBottom",m),h=i(n.to,"series",m),u=m[0].time,c=m[m.length-1].time,p=[...new Set([...l.zeiten,...h.zeiten,...m.map(y=>y.time)])].filter(y=>y>=u&&y<=c).sort((y,x)=>y-x),d=[],f=[],g=()=>{if(d.length>=2){let y=[...f].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:d.length,points:[...d,...y]});}d=[],f=[];};for(let y of p){let x=l.bei(y),S=h.bei(y);if(x===null||S===null){g();continue}let k=e.timeScale.map(y);d.push({x:k,y:e.valueScale.map(S)}),f.push({x:k,y:e.valueScale.map(x)});}g();}return s}function In(n,e,t,r){let i=t.timeScale.range(),o=i[0],s=i[1],a=Math.min(n,e),m=Math.max(n,e);return [{...r.attrs,...r.teilId(0),points:[{x:o,y:a},{x:s,y:a},{x:s,y:m},{x:o,y:m}]}]}function On(n,e,t,r,i){let o=t??r,s=[],a=Gn(n,e);if(a===null){let h=e.valueScale.domain();a=(t??r)===e.chartBottom?h[0]:h[1];}let m=Ae(n.outer,e),l=e.shape==="step";for(let h of e.runs){if(h.length<2)continue;let u=l?X(h):h,c=F.splitByThreshold(u,a,d=>d.value??a,F.interpolateDataPoint),p=n.side==="above"?c.above:n.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&n.side){let d=m,f=n.side==="above"?g=>Math.min(g,d):g=>Math.max(g,d);p=p.map(g=>g.map(y=>({...y,value:f(y.value??d)})));}for(let d of p){if(d.length<2)continue;let f=d.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),g=[];for(let y of [...f].reverse()){let x=g[g.length-1];l&&x&&x.x===y.x||g.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:f.length,points:[...f,...g]});}}return s}function Gn(n,e){let t=n.from==="series"?n.to:n.from;return Ae(t,e)}function Ae(n,e){return n===void 0||n==="series"||n==="chartTop"||n==="chartBottom"?null:typeof n=="object"&&"threshold"in n?e.thresholds.get(n.threshold)?.value??null:typeof n=="object"&&"value"in n?n.value:null}function Et(n,e){if(typeof n=="string"||!("regions"in n))return Gt({fill:n},e,0);let t=[];return n.regions.forEach((r,i)=>{t.push(...Gt(r,e,i));}),t}function Ht(n){let e=n.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??b.stroke,width:t?.width??b.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function Wt(n,e,t,r,i){let o=n.filter(l=>l.value!==null);if(o.length<2)return [];let s=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),a=Ht(t);return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:s,stroke:a.color,strokeWidth:a.width,smoothing:a.smoothing,smoothingType:a.smoothingType,dash:a.dash,fill:"none"}]}function zt(n,e,t=0){switch(n.kind){case "movingAverage":{let r=n.type==="exponential"?pt(e.data,n.window):Ve(e.data,n.window);return Wt(r,e,n,"movingAvg",t)}case "movingMkt":{let r=ct(e.data,n.window,n.activationEnergy);return Wt(r,e,n,"movingMkt",t)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=Ht(n),m=a.color,l=a.width,h=a.dash??"dashed",u=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return n.high!==void 0&&r.push({type:"line",id:`${u}limit-high`,x1:o,y1:e.valueScale.map(n.high),x2:s,y2:e.valueScale.map(n.high),stroke:m,strokeWidth:l,dash:h}),n.low!==void 0&&r.push({type:"line",id:`${u}limit-low`,x1:o,y1:e.valueScale.map(n.low),x2:s,y2:e.valueScale.map(n.low),stroke:m,strokeWidth:l,dash:h}),r}case "stdDevBand":{let r=n.multiplier??1,i=Ve(e.data,n.window),o=dt(e.data,n.window),s=[],a=[];for(let g=0;g<i.length;g++){let y=i[g].value,x=o[g].value;if(y===null||x===null)continue;let S=e.timeScale.map(i[g].time);s.push({x:S,y:e.valueScale.map(y+r*x)}),a.push({x:S,y:e.valueScale.map(y-r*x)});}if(s.length<2)return [];let m=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,l=[],u=(typeof n.style?.fill=="string"||n.style?.fill&&!("regions"in n.style.fill)?n.style.fill:void 0)??"#94a3b833",{color:c,hatch:p}=En(u);l.push({type:"path",cssClass:"series-fill",id:`${m}stdDevBand`,points:[...s,...[...a].reverse()],fill:c,hatch:p,stroke:"none"});let d=n.style?.line,f=d&&!Array.isArray(d)?d:void 0;if(f){let g=i.filter(y=>y.value!==null).map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)}));g.length>=2&&l.push({type:"path",cssClass:"series-line",id:`${m}stdDevBand-mean`,points:g,stroke:f.color??b.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return l}}}function En(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function Wn(n){if(!n)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(n))return {gaps:n,autoDetect:false,minGapMs:6e4};let e=n.regions??[],t=n.style;return {gaps:e.map(i=>{let o={...t,...i.style},s=o.fill,a,m;return typeof s=="string"?a=s:s&&(a=s.color,m=s.hatch),{startTime:i.startTime,endTime:i.endTime,label:i.label,fill:a,hatch:m,fillOpacity:o.opacity,labelBaseline:o.label?.baseline,rotate:o.label?.rotate,style:o.display==="bridge_line"?void 0:o.display}}),autoDetect:n.autoDetect??false,minGapMs:n.minGapMs??6e4,band:t?.band}}function Vt(n,e){if(e)for(let t of n)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&Vt(t.commands,e);}var H=class{_layout;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_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._legend=e.legend,this._textMetrics=e.textMetrics??E,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=Wn(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,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 r=t.height??12,i=t.spacing??0;(t.showAxis??false)&&(e+=26+i),e+=r+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(r=>r.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=bt({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,r=xt(e,this._layout.margin);return r&&(t=new se({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute()),{layout:t,legende:e}}renderCommands(){if(this._series.length===0)return [];let{layout:e,legende:t}=this._layoutMitLegende(),{chartX:r,chartY:i,chartWidth:o,chartHeight:s}=e,a=[r,r+o],m=[i,i+s],l=[];for(let _ of this._series)_.data.sort((A,L)=>A.time-L.time);let h=new Map,u=1/0,c=-1/0,p=false;for(let _ of this._series){let A=this._axisIndexOf(_),L=h.get(A);L?L.push(_):h.set(A,[_]);for(let R of this._timesOf(_))R<u&&(u=R),R>c&&(c=R),p=true;}if(!p)return [];let d=this._axes?.x?.domain,f=d&&d!=="auto"?d:[u,c];this._timeScale=new q({domain:f,range:a,locale:this._locale,timeZone:this._timeZone});let g=new Q({domain:f,xRange:a,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:ge(this._axes?.x?.ticks?.minor,K(this._axes?.x?.grid)?.minor),colors:fe(this._axes?.x?.axis),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let y=Array.from(h.keys()).sort((_,A)=>_-A),x=ht({axes:this._axes,indices:y,seriesByIndex:h,layout:e,thresholds:this._thresholds,metrics:this._textMetrics});l.push(...x.commands);let{titel:S,baender:k,neueForm:T}=x,D=x.primary;for(let[_,A]of x.scales)this._valueScales.set(_,A);let M=this._valueScales.get(0)??this._valueScales.get(y[0]);l.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:g.render()});let v=kt({axes:this._axes,timeAxis:g,primaryValueAxis:D,xRange:a,yRange:m}),C=v.group;C&&v.layer==="back"&&(l.push(C),C=null),this._highlights.length>0&&l.push({type:"group",cssClass:"highlights",commands:Mt({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:m,height:e.totalHeight})}),M&&l.push(...Tt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:M,xRange:a,layout:e}));let $=this._gaps;if(this._gapsAutoDetect){let _=[];for(let A of this._series){if(ee(A))continue;let L=A.data.filter(R=>R.value!==null);_.push(...ut(L,this._gapsMinGapMs));}_.length>0&&($=[...this._gaps,..._]);}$.length>0&&l.push({type:"group",cssClass:"gaps",commands:Xe({gaps:$,timeScale:this._timeScale,yRange:m,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let I=new Map(this._thresholds.map(_=>[_.id??_.name,_]));for(let[_,A]of this._series.entries()){if(A.data.length===0)continue;let L=this._valueScales.get(this._axisIndexOf(A));if(!L)continue;let R=N(A.id??A.name);l.push({type:"group",cssClass:`series series--${R}`,id:`series-${R}`,commands:this._renderSeries(A,L,I,_),...this._clipSeries?{clipRect:{x:r,y:i,w:o,h:s}}:{}});}C&&l.push(C);let P=this._markers.map(_=>({..._}));for(let _ of P)if(_.value===void 0&&(_.lineStyle==="to-value"||_.lineStyle==="to-top")){let A=this._series[_.seriesIndex??0];A&&!ee(A)&&A.data.length>=2&&(_.value=this._interpolateValue(_.time,A.data));}if(P.length>0&&M){let _=[];for(let A of P){let L=M,R=this._series[A.seriesIndex??0];R&&(L=this._valueScales.get(this._axisIndexOf(R))??M),_.push(...Ct({markers:[A],timeScale:this._timeScale,valueScale:L,yRange:m}));}l.push({type:"group",cssClass:"markers",commands:_});}let j=this._annotations.filter(_=>!_.id||!this._disabledAnnotations.has(_.id));if(j.length>0&&l.push({type:"group",cssClass:"annotations",commands:At({annotations:j,timeScale:this._timeScale,valueScales:this._valueScales,metrics:this._textMetrics})}),this._annotationBands.length>0){let _=i+s+this._layout.margin.bottom,A=0;this._annotationBands.forEach(L=>{let R=L.height??12,V=L.spacing??0,oe=_+A;(L.showAxis??false)&&(A+=26+V),A+=R+V,l.push({type:"group",cssClass:"annotation-band",commands:new Ce({name:L.name,showAxis:L.showAxis??false,items:L.items,timeScale:this._timeScale,background:L.background,hatch:L.hatch},[r,r+o],oe,R).render()});});}let{xs:z,belegt:O}=Bt(S.map(_=>({achseX:_.achseX,kante:_.kante,position:_.position,schrift:_.style?.fontSize??b.axisLabelSize})),k,e.totalWidth);return l.push(...St({legende:t,layout:e,randBelegt:O,metrics:this._textMetrics})),l.push(...Ft({axes:this._axes,neueForm:T,achsenTitel:S,titelSpuren:z,layout:e})),Vt(l,this._fontFamily??b.fontFamily),l}_linienGrundlage(e){let t=e.style?.line,r=t&&!Array.isArray(t)?t:void 0,i=this._gapsAutoDetect?this._gapsMinGapMs:void 0,o=Array.isArray(t)?t[0]:r,s=(o?.shape??e.seriesType)==="step",a=o||void 0,m=a?.gapThreshold??i??b.gapThreshold;return {styleLine:t,lineDefaults:r,gapThreshold:m,grundLinie:a,stepShape:s}}_renderSeries(e,t,r,i=0){let o=this._timeScale,s={timeScale:o,valueScale:t};if(ee(e))return Pt(e,o,t);let{lineDefaults:a,gapThreshold:m}=this._linienGrundlage(e),l=F.getRuns(e.data,k=>k.value===null,m),h=l.reduce((k,T)=>k+T.length,0);if(h===0)return [];let u=[],c=e.style?.markers,p=e.style?.shadow,d={stroke:a?.color??this._palettenFarbe(i),strokeWidth:a?.width??b.strokeWidth,smoothing:a?.smoothing,smoothingType:a?.smoothingType,dashed:a?.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:W(e.name,e.id)},{styleLine:f,grundLinie:g,stepShape:y}=this._linienGrundlage(e),x=e.style?.fill;if(x!==void 0){let k=t.range(),T=Math.min(k[0],k[1]),D=Math.max(k[0],k[1]);u.push(...Et(x,{runs:l,timeScale:o,valueScale:t,thresholds:r,chartTop:T,chartBottom:D,smoothing:g?.smoothing,smoothingType:g?.smoothingType,shape:y?"step":"line",fremdeSerie:M=>{let v=this._series.find(P=>(P.id??P.name)===M||P.name===M);if(!v||!("data"in v))return;let C=v.data;if(C.length===0||!("value"in C[0]))return;let $=this._linienGrundlage(v),I=$.grundLinie;return {data:C,shape:$.stepShape?"step":"line",smoothing:I?.smoothing,smoothingType:I?.smoothingType,gapThreshold:$.gapThreshold}},idPrefix:W(e.name,e.id)}));}u.push(...jt({series:e,ctx:s,runs:l,totalPoints:h,style:d,styleLine:f,styleMarkers:c,stepShape:y,thresholds:r}));let S=e.overlays;if(S&&S.length>0){let k=t.range(),T={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(k[0],k[1]),chartBottom:Math.max(k[0],k[1]),idPrefix:W(e.name,e.id)};S.forEach((D,M)=>{u.push(...zt(D,T,M));});}return e.style?.gap&&l.length>1&&u.push(..._t({gap:e.style.gap,runs:l,timeScale:o,valueScale:t,metrics:this._textMetrics,lineColor:a?.color})),u}_interpolateValue(e,t){for(let r=1;r<t.length;r++){let i=t[r-1],o=t[r];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 this._legendItems()}_palettenFarbe(e){let t=b.palette;return t.length>0?t[e%t.length]:b.stroke}_legendItems(){return this._series.map((e,t)=>{let r=e.style?.line,i=Array.isArray(r)?r:r?[r]:[],o=e.style?.markers,s=o?.type&&o.type!=="none"&&(o.threshold===void 0||(e.data?.length??0)<=o.threshold),a=ee(e)?e.avgColor??b.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,marker:s?o.type:void 0,id:N(e.id??e.name)}})}get renderer(){return this._renderer}get layout(){return this._layoutMitLegende().layout}get plotRect(){let{chartX:e,chartY:t,chartWidth:r,chartHeight:i}=this.layout;return {x:e,y:t,width:r,height:i}}get timeScale(){return this._timeScale}get valueScales(){return this._valueScales}pointsAt(e,t,r={}){return this._timeScale?Qe(this._series,this._timeScale,i=>{let o=this._axisIndexOf(i),s=this._valueScales.get(o);return s?{skala:s,achse:o}:void 0},this.plotRect,e,t,r.radius??b.tooltipSnapRadius,new Set(r.hidden??[])):[]}invertTime(e){return this._timeScale?this._timeScale.invert(e):0}invertValue(e,t=0){let r=this._valueScales.get(t);return r?r.invert(e):0}project(e,t,r=0){let i=this._timeScale?this._timeScale.map(e):0,o=this._valueScales.get(r);return {x:i,y:o?o.map(t):0}}};var zn=.2,me=4,ie=1e-6,Vn=6;function Nn(n){return n?.map(e=>{let t=e.data;if(t.length<=4)return e;let r=(l,h)=>"avg"in l?h?l.max:l.min:l.value,i=new Set,o=0,s=0,a=-1,m=-1;t.forEach((l,h)=>{l.time<t[o].time&&(o=h),l.time>t[s].time&&(s=h);let u=r(l,false),c=r(l,true);u!==null&&(a<0||u<r(t[a],false))&&(a=h),c!==null&&(m<0||c>r(t[m],true))&&(m=h);});for(let l of [o,s,a,m])l>=0&&i.add(l);return {...e,data:t.filter((l,h)=>i.has(h))}})}function Xn(n,e){if(!n.content)return null;let t=n.fontSize??11,r=e(n.content,t),i=n.anchor==="middle"?-r/2:n.anchor==="end"?-r:0,[o,s]=n.textBaseline==="middle"?[-t/2,t/2]:n.textBaseline==="top"?[0,t]:n.textBaseline==="bottom"?[-t,0]:[-0.8*t,zn*t],a=[[i,o],[i+r,o],[i,s],[i+r,s]],m=(n.rotate??0)*Math.PI/180,l=Math.cos(m),h=Math.sin(m),u=a.map(([p,d])=>n.x+p*l-d*h),c=a.map(([p,d])=>n.y+p*h+d*l);return {x0:Math.min(...u),y0:Math.min(...c),x1:Math.max(...u),y1:Math.max(...c)}}function he(n,e){return {x0:Math.min(...n),y0:Math.min(...e),x1:Math.max(...n),y1:Math.max(...e)}}function Nt(n,e,t=[]){for(let r of n)switch(r.type){case "group":{let i=r.cssClass??"";if(r.clipRect||r.plotClipId||i.startsWith("chart-legend")||i.startsWith("annotation-band"))break;Nt(r.commands,e,t);break}case "text":{let i=Xn(r,e);i&&t.push(i);break}case "line":t.push(he([r.x1,r.x2],[r.y1,r.y2]));break;case "rect":t.push(he([r.x,r.x+r.w],[r.y,r.y+r.h]));break;case "circle":t.push(he([r.cx-r.r,r.cx+r.r],[r.cy-r.r,r.cy+r.r]));break;case "path":r.points.length>0&&t.push(he(r.points.map(i=>i.x),r.points.map(i=>i.y)));break;case "gap":t.push(he([r.x1,r.x2],[r.y1,r.y2]));break}return t}function Yn(n,e={}){return Kn(n,e)}function Kn(n,e,t){let r=e.padding||4,i=Math.max(e.minimum||8,me),o=n.textMetrics??E,s=Nn(n.series),a=u=>{let c=new H({...n,series:s,margin:u}),p=c.renderCommands();return {kaesten:Nt(p,o),plot:c.plotRect,breite:c.layout.totalWidth,hoehe:c.layout.totalHeight}},m=n.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)},h;for(let u=0;u<Vn;u++){let c=a(l),p=a({...l,left:l.left+me,right:l.right-me}),d=a({...l,top:l.top+me,bottom:l.bottom-me}),f=p.kaesten.length===c.kaesten.length&&d.kaesten.length===c.kaesten.length,g=C=>f&&Math.abs(p.kaesten[C].x0-c.kaesten[C].x0)<ie,y=C=>f&&Math.abs(d.kaesten[C].y0-c.kaesten[C].y0)<ie,{plot:x}=c,S=x.x+x.width,k=x.y+x.height,T={left:0,right:0,top:0,bottom:0},D={left:0,right:0,top:0,bottom:0};c.kaesten.forEach((C,$)=>{g($)?(C.x0<x.x-ie&&(D.left=Math.max(D.left,C.x1)),C.x1>S+ie&&(D.right=Math.max(D.right,c.breite-C.x0))):(T.left=Math.max(T.left,x.x-C.x0),T.right=Math.max(T.right,C.x1-S)),y($)?(C.y0<x.y-ie&&(D.top=Math.max(D.top,C.y1)),C.y1>k+ie&&(D.bottom=Math.max(D.bottom,c.hoehe-C.y0))):(T.top=Math.max(T.top,x.y-C.y0),T.bottom=Math.max(T.bottom,C.y1-k));});let M=C=>D[C]>0?D[C]+r+T[C]:T[C]>0?T[C]+r:0,v={top:0,right:0,bottom:0,left:0};for(let C of ["top","right","bottom","left"])v[C]=Math.max(i,Math.ceil(M(C)-1e-9));if(v.top===l.top&&v.right===l.right&&v.bottom===l.bottom&&v.left===l.left)return v;if(h&&v.top===h.top&&v.right===h.right&&v.bottom===h.bottom&&v.left===h.left)return {top:Math.max(v.top,l.top),right:Math.max(v.right,l.right),bottom:Math.max(v.bottom,l.bottom),left:Math.max(v.left,l.left)};h=l,l=v;}return l}function Xt(n){let e=[];for(let t=0;t<n.length-1;t++){let r=n[t+1].x-n[t].x;e.push(r===0?0:(n[t+1].y-n[t].y)/r);}return e}function Un(n){let e=Xt(n),t=n.length,r=[...e];for(let i=1;i<t-1;i++)r[i]=e[i-1]*e[i]<=0?0:(e[i-1]+e[i])/2;r[t-1]=e[t-2];for(let i=0;i<t-1;i++){if(e[i]===0){r[i]=0,r[i+1]=0;continue}let o=r[i]/e[i],s=r[i+1]/e[i],a=o*o+s*s;if(a>9){let m=3/Math.sqrt(a);r[i]=m*o*e[i],r[i+1]=m*s*e[i];}}return r}function Zn(n){let e=Xt(n),t=n.length;if(e.length<2)return n.map(()=>e[0]??0);let r=e[0],i=e[1],o=e[e.length-1],s=e[e.length-2],a=2*r-i,m=2*o-s,l=[2*a-r,a,...e,m,2*m-o],h=[];for(let u=0;u<t;u++){let c=Math.abs(l[u+3]-l[u+2]),p=Math.abs(l[u+1]-l[u]);h.push(c+p===0?(l[u+1]+l[u+2])/2:(c*l[u+1]+p*l[u+2])/(c+p));}return h}function qn(n,e){let t=[];for(let r=0;r<n.length-1;r++){let i=n[r],o=n[r+1],s=(o.x-i.x)/3;t.push({p0:i,c1:{x:i.x+s,y:i.y+e[r]*s},c2:{x:o.x-s,y:o.y-e[r+1]*s},p1:o});}return t}function Jn(n,e){if(n.length<2)return [];let t=e==="akima"?Zn(n):Un(n);return qn(n,t)}function Qn(n){let e=[];for(let t=0;t<n.length-1;t++){let r=n[t-1]??n[t],i=n[t],o=n[t+1],s=n[t+2]??o,a=Math.min(i.x,o.x),m=Math.max(i.x,o.x),l=h=>h<a?a:h>m?m:h;e.push({p0:i,c1:{x:l(i.x+(o.x-r.x)/6),y:i.y+(o.y-r.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 Ye(n,e){return e&&e!=="catmull-rom"?Jn(n,e):Qn(n)}var Ke=["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:Ke,rect:Ke,path:Ke},tr={line:"stroke-opacity",text:"fill-opacity"},nr=/ ([a-z-]+)="([^"]*)"/g;function rr(n){let e=/^<(line|text|circle|rect|path) /.exec(n)?.[1];if(!e||n.includes(`
25
+ `))return null;let t=e==="text"?n.indexOf(">")+1:n.length,r=n.slice(0,t),i=/ opacity="([^"]*)"/.exec(r),o=tr[e];i&&i[1]==="1"?r=r.replace(i[0],""):i&&o&&!r.includes(` ${o}="`)&&(r=r.replace(i[0],` ${o}="${i[1]}"`));let s=new Map;for(let[,a,m]of r.matchAll(nr))s.set(a,m);return {art:e,kopf:r,rest:n.slice(t),attrs:s}}function Yt(n){let e=[];for(let r of er[n[0].art]){if(!n.every(a=>a.attrs.has(r)))continue;let i=new Map;for(let a of n){let m=a.attrs.get(r);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([r,o]);}let t=n.map(r=>{let i=r.kopf;for(let[o,s]of e)i=i.replace(` ${o}="${s}"`,"");return i+r.rest});return {attrs:e.map(([r,i])=>` ${r}="${i}"`).join(""),kinder:t}}function Kt(n,e=" "){let t=[];for(let o of n){let s=rr(o);if(!s)return null;t.push(s);}if(t.length===0)return null;let r=new Set(t.map(o=>o.art));if(r.size===1){let o=Yt(t);return {attrs:o.attrs,inhalt:o.kinder.map(s=>e+s).join(`
26
+ `)}}if(r.size!==2||!r.has("line")||!r.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=Yt(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 Ue="1.14.0";var ir=` <!-- MLTimeGraph ${Ue} -->`,Ut=1e3;function w(n){return String(Math.round(n*Ut)/Ut)}function Ze(n){return Ee(n).toString(16).padStart(8,"0")}function or(n){switch(n){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var Z=class extends be{#e="100%";#t="100%";#n;#r=new Map;#i=new Map;#o=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);}setBackgroundColor(e){this.#n=e;}render(e){this.#r.clear(),this.#i.clear(),this.#o.clear();let t=e.map(l=>this._toSVG(l));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let r=t.join(`
28
28
  `),i="",o=[];for(let[,l]of this.#r)o.push(l);for(let[,l]of this.#i)o.push(l);for(let[,l]of this.#o)o.push(l);o.length>0&&(i=` <defs>
29
29
  ${o.join(`
30
30
  `)}
31
31
  </defs>
32
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
- ${Gn}
33
+ ${ir}
34
34
  ${i} ${r}
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)}}#l(e,t){if(e.length===0)return "";if(!t.smoothing||e.length<3)return e.map((l,h)=>`${h===0?"M":"L"}${w(l.x)},${w(l.y)}`).join(" ");let r=t.smoothCount!=null&&t.smoothCount<e.length?Math.max(t.smoothCount,2):e.length,i=t.smoothTail??0,o=i>=3&&e.length-i>=r?e.length-i:e.length,s=l=>l.map(h=>` C${w(h.c1.x)},${w(h.c1.y)} ${w(h.c2.x)},${w(h.c2.y)} ${w(h.p1.x)},${w(h.p1.y)}`).join(""),a=`M${w(e[0].x)},${w(e[0].y)}`;a+=s(ze(e.slice(0,r),t.smoothingType));let m=o<e.length?o:e.length-1;for(let l=r;l<=m;l++)a+=` L${w(e[l].x)},${w(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),h=ze(l,t.smoothTailType??t.smoothingType).reverse().map(u=>({p0:u.p1,c1:u.c2,c2:u.c1,p1:u.p0}));a+=s(h);}return a}_hatchPattern(e,t){let r=`hatch-${e}-${Xe(t??"")}`;if(this.#o.has(r))return r;let i=ce(r,e,t??"rgba(200,220,255,0.3)");return this.#o.set(r,i),r}_path(e){let t=this.#l(e.points,e)+(e.closed?" Z":""),r=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);r.push(`fill="url(#${s})"`);}else r.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&r.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&r.push(`stroke-width="${w(e.strokeWidth)}"`);let i=this.#a(e.dash,e.dashed,e.strokeWidth);i&&(r.push(`stroke-dasharray="${i.strokeDasharray}"`),i.strokeLinecap&&r.push(`stroke-linecap="${i.strokeLinecap}"`)),e.opacity!==void 0&&r.push(`opacity="${w(e.opacity)}"`),e.cssClass&&r.push(`class="${this._esc(e.cssClass)}"`),e.id&&r.push(`id="${this._esc(e.id)}"`);let o=this.#s(e);return o&&r.push(`filter="url(#${o})"`),`<path d="${t}" ${r.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${w(e.strokeWidth)}"`);let r=this.#a(e.dash,e.dashed,e.strokeWidth);r&&(t.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&t.push(`stroke-linecap="${r.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${w(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let i=this.#s(e);return i&&t.push(`filter="url(#${i})"`),`<line x1="${w(e.x1)}" y1="${w(e.y1)}" x2="${w(e.x2)}" y2="${w(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="${w(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${w(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),e.title?`<rect x="${w(e.x)}" y="${w(e.y)}" width="${w(e.w)}" height="${w(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${w(e.x)}" y="${w(e.y)}" width="${w(e.w)}" height="${w(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="${w(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),`<circle cx="${w(e.cx)}" cy="${w(e.cy)}" r="${w(e.r)}" ${t.join(" ")} />`}#a(e,t,r){return Ge(e,r??2,t)}#s(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,r=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!t&&!r&&!i)return null;let o=`shadow-${Xe(`${e.shadowColor}|${w(t)}|${w(r)}|${w(i)}`)}`;if(this.#r.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
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)}}#l(e,t){if(e.length===0)return "";if(!t.smoothing||e.length<3)return e.map((l,h)=>`${h===0?"M":"L"}${w(l.x)},${w(l.y)}`).join(" ");let r=t.smoothCount!=null&&t.smoothCount<e.length?Math.max(t.smoothCount,2):e.length,i=t.smoothTail??0,o=i>=3&&e.length-i>=r?e.length-i:e.length,s=l=>l.map(h=>` C${w(h.c1.x)},${w(h.c1.y)} ${w(h.c2.x)},${w(h.c2.y)} ${w(h.p1.x)},${w(h.p1.y)}`).join(""),a=`M${w(e[0].x)},${w(e[0].y)}`;a+=s(Ye(e.slice(0,r),t.smoothingType));let m=o<e.length?o:e.length-1;for(let l=r;l<=m;l++)a+=` L${w(e[l].x)},${w(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),h=Ye(l,t.smoothTailType??t.smoothingType).reverse().map(u=>({p0:u.p1,c1:u.c2,c2:u.c1,p1:u.p0}));a+=s(h);}return a}_hatchPattern(e,t){let r=`hatch-${e}-${Ze(t??"")}`;if(this.#o.has(r))return r;let i=de(r,e,t??"rgba(200,220,255,0.3)");return this.#o.set(r,i),r}_path(e){let t=this.#l(e.points,e)+(e.closed?" Z":""),r=[];if(e.hatch){let s=this._hatchPattern(e.hatch,e.fill);r.push(`fill="url(#${s})"`);}else r.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);e.stroke&&r.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&r.push(`stroke-width="${w(e.strokeWidth)}"`);let i=this.#a(e.dash,e.dashed,e.strokeWidth);i&&(r.push(`stroke-dasharray="${i.strokeDasharray}"`),i.strokeLinecap&&r.push(`stroke-linecap="${i.strokeLinecap}"`)),e.opacity!==void 0&&r.push(`opacity="${w(e.opacity)}"`),e.cssClass&&r.push(`class="${this._esc(e.cssClass)}"`),e.id&&r.push(`id="${this._esc(e.id)}"`);let o=this.#s(e);return o&&r.push(`filter="url(#${o})"`),`<path d="${t}" ${r.join(" ")} />`}_line(e){let t=[];e.stroke&&t.push(`stroke="${this._esc(e.stroke)}"`),e.strokeWidth&&t.push(`stroke-width="${w(e.strokeWidth)}"`);let r=this.#a(e.dash,e.dashed,e.strokeWidth);r&&(t.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&t.push(`stroke-linecap="${r.strokeLinecap}"`)),e.opacity!==void 0&&t.push(`opacity="${w(e.opacity)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let i=this.#s(e);return i&&t.push(`filter="url(#${i})"`),`<line x1="${w(e.x1)}" y1="${w(e.y1)}" x2="${w(e.x2)}" y2="${w(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="${w(e.strokeWidth)}"`),e.opacity!==void 0&&t.push(`opacity="${w(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),e.title?`<rect x="${w(e.x)}" y="${w(e.y)}" width="${w(e.w)}" height="${w(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${w(e.x)}" y="${w(e.y)}" width="${w(e.w)}" height="${w(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="${w(e.strokeWidth)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`);let r=this.#s(e);return r&&t.push(`filter="url(#${r})"`),`<circle cx="${w(e.cx)}" cy="${w(e.cy)}" r="${w(e.r)}" ${t.join(" ")} />`}#a(e,t,r){return He(e,r??2,t)}#s(e){if(!e.shadowColor)return null;let t=e.shadowBlur??0,r=e.shadowOffsetX??0,i=e.shadowOffsetY??0;if(!t&&!r&&!i)return null;let o=`shadow-${Ze(`${e.shadowColor}|${w(t)}|${w(r)}|${w(i)}`)}`;if(this.#r.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
36
36
  <feDropShadow dx="${w(r)}" dy="${w(i)}" stdDeviation="${w(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
37
37
  </filter>`;return this.#r.set(o,s),o}#m(e,t,r,i,o){this.#i.has(e)||this.#i.set(e,`<clipPath id="${e}">
38
38
  <rect x="${w(t)}" y="${w(r)}" width="${w(i)}" height="${w(o)}" />
39
- </clipPath>`);}#h(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${w(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="${w(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${w(e.rotate)} ${w(e.x)} ${w(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${On(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${w(e.x)}" y="${w(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">
39
+ </clipPath>`);}#h(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${w(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="${w(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${w(e.rotate)} ${w(e.x)} ${w(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${or(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${w(e.x)}" y="${w(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
40
  <rect x="${w(e.x1)}" y="${w(e.y1)}" width="${w(e.x2-e.x1)}" height="${w(e.y2-e.y1)}" ${t.join(" ")} />
41
41
  <text x="${w(e.x1)}" y="${w(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
42
- </g>`:`<rect x="${w(e.x1)}" y="${w(e.y1)}" width="${w(e.x2-e.x1)}" height="${w(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:h,y:u,w:c,h:p}=e.clipRect;t=`clip-plot-${Xe(`${w(h)},${w(u)},${w(c)},${w(p)}`)}`,this.#m(t,h,u,c,p);}let r=e.commands.map(h=>this._toSVG(h)),i=e.sharedStyles?Et(r):null,o=i?.inhalt??r.map(h=>` ${h.replaceAll(/\n {3}/g,`
42
+ </g>`:`<rect x="${w(e.x1)}" y="${w(e.y1)}" width="${w(e.x2-e.x1)}" height="${w(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:h,y:u,w:c,h:p}=e.clipRect;t=`clip-plot-${Ze(`${w(h)},${w(u)},${w(c)},${w(p)}`)}`,this.#m(t,h,u,c,p);}let r=e.commands.map(h=>this._toSVG(h)),i=e.sharedStyles?Kt(r):null,o=i?.inhalt??r.map(h=>` ${h.replaceAll(/\n {3}/g,`
43
43
  `)}`).join(`
44
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 Wn(n){return typeof requestAnimationFrame=="function"?requestAnimationFrame(n):setTimeout(()=>n(0),16)}function En(n){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(n):clearTimeout(n);}function zt(){let n=0,e=false;return {schedule:t=>{e||(e=true,n=Wn(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,En(n));}}}var Vt="http://www.w3.org/2000/svg";function Hn(n){let e=n.style?.line;return e&&!Array.isArray(e)&&e.color?e.color:b.stroke}function Nt(n){return n.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function zn(n){if(n.length===0)return "";let e=new Date(n[0].time).toLocaleString(),t=n.map(r=>`<div><span class="mlc-tooltip__name">${Nt(r.series.name)}:</span> ${r.value.toFixed(2)}</div>`);return `<div class="mlc-tooltip__time">${Nt(e)}</div>${t.join("")}`}function Vn(n,e){if(n.length===0)return;let t=0,r=n.length-1;for(;t<r;){let s=t+r>>1;n[s].time<e?t=s+1:r=s;}let i=n[Math.max(0,t-1)],o=n[t];return Math.abs(i.time-e)<=Math.abs(o.time-e)?i:o}function Nn(n){return "value"in n?n.value:n.avg}function me(n,e,t={}){let r=n.querySelector("svg");if(!r)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=t.format??zn,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,m=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",h=document.createElement("div");h.className=s,h.style.position="absolute",h.style.pointerEvents="none",h.style.display="none",getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(h);let u=null;a&&(u=document.createElementNS(Vt,"g"),u.setAttribute("class",l),u.setAttribute("pointer-events","none"),r.appendChild(u));let c=()=>{u&&u.replaceChildren();},p=e.series.map((k,_)=>({data:k.data.map(A=>({time:A.time,value:Nn(A)})).filter(A=>A.value!==null).sort((A,C)=>A.time-C.time),series:k,index:_})),d=zt(),f=null,g=k=>{let _=r.getBoundingClientRect(),$=e.getWidth?.()??_.width,A=(k.clientX-_.left)*$/Math.max(1,_.width);e.getHeight?.()??_.height;let B=e.invertTime(A);if(!Number.isFinite(B)){h.style.display="none";return}let M=[];for(let T of p){let v=Vn(T.data,B);if(!v)continue;let L=e.project(v.time,v.value,T.series.yAxisIndex??0).x,R=e.project(v.time,v.value,T.series.yAxisIndex??0).y;Math.abs(L-A)>o||M.push({seriesIndex:T.index,series:T.series,time:v.time,value:v.value,x:L,y:R});}if(M.length===0){h.style.display="none",c();return}h.innerHTML=i(M);let F=n.getBoundingClientRect(),D=12,P=(k.clientX-_.left)/Math.max(1,_.width),E=(k.clientY-_.top)/Math.max(1,_.height),G=P<.5?`${D}px`:`calc(-100% - ${D}px)`,O=E<.5?`${D}px`:`calc(-100% - ${D}px)`;if(h.style.left=`${k.clientX-F.left}px`,h.style.top=`${k.clientY-F.top}px`,h.style.transform=`translate(${G}, ${O})`,h.style.display="",u){u.replaceChildren();for(let T of M){let v=document.createElementNS(Vt,"circle");v.setAttribute("cx",String(T.x)),v.setAttribute("cy",String(T.y)),v.setAttribute("r",String(m)),v.setAttribute("fill","#ffffff"),v.setAttribute("stroke",Hn(T.series)),v.setAttribute("stroke-width","2"),v.setAttribute("class",`${l}__dot`),u.appendChild(v);}}},y=k=>{f=k,d.schedule(()=>{f&&g(f);});},x=()=>{f=null,d.cancel(),h.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",x);let S=false;return ()=>{S||(S=true,f=null,d.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",x),h.remove(),u&&u.remove());}}function Xn(n,e={}){let t=typeof n=="string"?document.querySelector(n):n;if(!t)throw new Error(`mount: target ${typeof n=="string"?`'${n}'`:""} not found`);let{tooltip:r,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,a=new K({...i,width:o,height:s}),{content:m}=new Y().render(a.renderCommands());t.innerHTML=m;let l=t.querySelector("svg");return l&&(l.setAttribute("viewBox",`0 0 ${o} ${a.getHeight()}`),l.setAttribute("width","100%"),l.setAttribute("height",String(a.getHeight()))),r?.show&&me(t,a,r),a}var Le=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,r,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:r??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 r=[...this._opts.axes.y];for(;r.length<=e;)r.push({});return r[e]={...r[e],...t},this._opts.axes.y=r,this}setLegend(e,t,r){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:r},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 K(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new Y().render(e.renderCommands());return t}mount(e){let t=typeof e=="string"?document.querySelector(e):e;if(!t){let s=typeof e=="string"?`'${e}'`:"";throw new Error(`GraphBuilder.mount: target ${s} not found`)}this._opts.width||(this._opts.width=t.clientWidth||800);let r=this.build(),{content:i}=new Y().render(r.renderCommands());t.innerHTML=i;let o=t.querySelector("svg");if(o){let s=this._opts.width??800;o.setAttribute("viewBox",`0 0 ${s} ${r.getHeight()}`),o.setAttribute("width","100%"),o.setAttribute("height",String(r.getHeight()));}return this._tooltip?.show&&me(t,r,this._tooltip),r}};var Me=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 r=Math.min(e.length,t.length);for(let i=0;i<r;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,r){return this._series.style??={},this._series.style.line={color:e,width:t,style:r},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 De=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 $e=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 Pe=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 Re=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,r){return this._ann.from={time:e,value:t,axis:r},this}setTo(e,t,r){return this._ann.to={time:e,value:t,axis:r},this}setAt(e,t,r){return this._ann.at={time:e,value:t,axis:r},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 je=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}},Be=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,r,i){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),r!==void 0&&(this._item.labelFill=r),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function Yn(n){let{thresholds:e,colors:t,hatches:r}=n;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(r!==void 0&&r.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${r.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=r?.[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 Ye(n){if(!n||typeof n!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:r}=n;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:r&&typeof r=="string"?r:void 0}}function Un(n){if(Array.isArray(n))return n.map(Ye);if(n&&typeof n=="object"){let e=n,t=e.name,r=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(r))throw new Error("Series: data must be an array");let h=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:t,data:r.map(Ye),sensorType:i??"numeric",enumMap:o,seriesType:l,...h&&{style:{line:h}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function Zn(n){if(!n||typeof n!="object")throw new Error("parseAggregated: object expected");let e=n,t=e.name,r=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(r))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:Kn(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function Kn(n){let e=t=>typeof t=="number"?t:null;return n.map(t=>{let r=t;return {time:r.time??0,min:e(r.min),max:e(r.max),avg:e(r.avg),count:typeof r.count=="number"?r.count:0}})}function Ue(n,e,t){return typeof e=="function"?e(n):n[e??t]}function qn(n,e,t){if(n instanceof Date){let r=n.getTime();if(Number.isNaN(r))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return r}if(typeof n=="string"){let r=Date.parse(n);if(Number.isNaN(r))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${n}`);return r}if(typeof n=="number"&&Number.isFinite(n))return e==="s"||e==="auto"&&Math.abs(n)>=1e8&&Math.abs(n)<1e11?n*1e3:n;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(n)}`)}function Jn(n,e){if(n==null)return null;if(typeof n=="number")return Number.isNaN(n)?null:n;if(typeof n=="string"){let t=n.trim();if(t==="")return null;let r=Number(t);if(Number.isNaN(r))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${n}`);return r}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(n)}`)}function Xt(n,e={}){let t=e.timeUnit??"ms",r=[];for(let i=0;i<n.length;i++){let o=n[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]:Ue(o,e.time,"time"),m=s&&e.value===void 0?o[1]:Ue(o,e.value,"value"),l={time:qn(a,t,i),value:Jn(m,i)};if(e.annotation!==void 0){let h=Ue(o,e.annotation,"annotation");typeof h=="string"&&h!==""&&(l.annotation=h);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function Qn(n,e,t={}){return {name:n,data:Xt(e,t)}}function Yt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Ut(n,e){if(!Yt(n)||!Yt(e))return e;let t={...n};for(let[r,i]of Object.entries(e))t[r]=Ut(t[r],i);return t}function er(...n){let e;for(let t of n)t!==void 0&&(e=Ut(e,t));return e??{}}/*!
46
+ </g>`}_esc(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}};function sr(n){return typeof requestAnimationFrame=="function"?requestAnimationFrame(n):setTimeout(()=>n(0),16)}function ar(n){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(n):clearTimeout(n);}function Zt(){let n=0,e=false;return {schedule:t=>{e||(e=true,n=sr(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,ar(n));}}}var qt="http://www.w3.org/2000/svg";function lr(n){let e=n.style?.line;return e&&!Array.isArray(e)&&e.color?e.color:b.stroke}function Jt(n){return n.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function mr(n){if(n.length===0)return "";let e=new Date(n[0].time).toLocaleString(),t=n.map(r=>`<div><span class="mlc-tooltip__name">${Jt(r.series.name)}:</span> ${r.value.toFixed(2)}</div>`);return `<div class="mlc-tooltip__time">${Jt(e)}</div>${t.join("")}`}function hr(n,e){if(n.length===0)return;let t=0,r=n.length-1;for(;t<r;){let s=t+r>>1;n[s].time<e?t=s+1:r=s;}let i=n[Math.max(0,t-1)],o=n[t];return Math.abs(i.time-e)<=Math.abs(o.time-e)?i:o}function ur(n){return "value"in n?n.value:n.avg}function Le(n,e,t={}){let r=n.querySelector("svg");if(!r)throw new Error("attachTooltip: target has no <svg> child (did you mount the chart first?)");let i=t.format??mr,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,m=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",h=document.createElement("div");h.className=s,h.style.position="absolute",h.style.pointerEvents="none",h.style.display="none",getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(h);let u=null;a&&(u=document.createElementNS(qt,"g"),u.setAttribute("class",l),u.setAttribute("pointer-events","none"),r.appendChild(u));let c=()=>{u&&u.replaceChildren();},p=e.series.map((k,T)=>({data:k.data.map(M=>({time:M.time,value:ur(M)})).filter(M=>M.value!==null).sort((M,v)=>M.time-v.time),series:k,index:T})),d=Zt(),f=null,g=k=>{let T=r.getBoundingClientRect(),D=e.getWidth?.()??T.width,M=(k.clientX-T.left)*D/Math.max(1,T.width);e.getHeight?.()??T.height;let C=e.invertTime(M);if(!Number.isFinite(C)){h.style.display="none";return}let $=[];for(let A of p){let L=hr(A.data,C);if(!L)continue;let R=e.project(L.time,L.value,A.series.yAxisIndex??0).x,V=e.project(L.time,L.value,A.series.yAxisIndex??0).y;Math.abs(R-M)>o||$.push({seriesIndex:A.index,series:A.series,time:L.time,value:L.value,x:R,y:V});}if($.length===0){h.style.display="none",c();return}h.innerHTML=i($);let I=n.getBoundingClientRect(),P=12,j=(k.clientX-T.left)/Math.max(1,T.width),z=(k.clientY-T.top)/Math.max(1,T.height),O=j<.5?`${P}px`:`calc(-100% - ${P}px)`,_=z<.5?`${P}px`:`calc(-100% - ${P}px)`;if(h.style.left=`${k.clientX-I.left}px`,h.style.top=`${k.clientY-I.top}px`,h.style.transform=`translate(${O}, ${_})`,h.style.display="",u){u.replaceChildren();for(let A of $){let L=document.createElementNS(qt,"circle");L.setAttribute("cx",String(A.x)),L.setAttribute("cy",String(A.y)),L.setAttribute("r",String(m)),L.setAttribute("fill","#ffffff"),L.setAttribute("stroke",lr(A.series)),L.setAttribute("stroke-width","2"),L.setAttribute("class",`${l}__dot`),u.appendChild(L);}}},y=k=>{f=k,d.schedule(()=>{f&&g(f);});},x=()=>{f=null,d.cancel(),h.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",x);let S=false;return ()=>{S||(S=true,f=null,d.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",x),h.remove(),u&&u.remove());}}function cr(n,e={}){let t=en(n,"mount"),{tooltip:r,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,a=new H({...i,width:o,height:s});return tn(t,a,o),r?.show&&Le(t,a,r),a}function Qt(n,e,t){let r=en(n,"GraphBuilder.mount"),{chart:i,width:o}=e(r.clientWidth||800);return tn(r,i,o),t?.show&&Le(r,i,t),i}function en(n,e){let t=typeof n=="string"?document.querySelector(n):n;if(!t)throw new Error(`${e}: target ${typeof n=="string"?`'${n}'`:""} not found`);return t}function tn(n,e,t){let{content:r}=new Z().render(e.renderCommands());n.innerHTML=r;let i=n.querySelector("svg");i&&(i.setAttribute("viewBox",`0 0 ${t} ${e.getHeight()}`),i.setAttribute("width","100%"),i.setAttribute("height",String(e.getHeight())));}var De=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,r,i){return typeof e=="object"?this._opts.margin=e:this._opts.margin={top:e,right:t??0,bottom:r??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 r=[...this._opts.axes.y];for(;r.length<=e;)r.push({});return r[e]={...r[e],...t},this._opts.axes.y=r,this}setLegend(e,t,r){return typeof e=="object"?this._opts.legend=e:this._opts.legend={show:e,position:t,orientation:r},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 H(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new Z().render(e.renderCommands());return t}mount(e){return Qt(e,t=>(this._opts.width||(this._opts.width=t),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var $e=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 r=Math.min(e.length,t.length);for(let i=0;i<r;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,r){return this._series.style??={},this._series.style.line={color:e,width:t,style:r},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 Pe=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 Re=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 je=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 Be=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,r){return this._ann.from={time:e,value:t,axis:r},this}setTo(e,t,r){return this._ann.to={time:e,value:t,axis:r},this}setAt(e,t,r){return this._ann.at={time:e,value:t,axis:r},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 Fe=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}},Ie=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,r,i){return this._item.label=e,t!==void 0&&(this._item.labelFontSize=t),r!==void 0&&(this._item.labelFill=r),i!==void 0&&(this._item.labelBaseline=i),this}build(){return this._item}};function dr(n){let{thresholds:e,colors:t,hatches:r}=n;if(t.length!==e.length+1)throw new Error(`fillBetweenThresholds: expected ${e.length+1} colors for ${e.length} thresholds, got ${t.length}`);if(r!==void 0&&r.length!==t.length)throw new Error(`fillBetweenThresholds: hatches length (${r.length}) must equal colors length (${t.length})`);return {regions:t.map((o,s)=>{let a=r?.[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 qe(n){if(!n||typeof n!="object")throw new Error("DataPoint: object expected");let{time:e,value:t,annotation:r}=n;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:r&&typeof r=="string"?r:void 0}}function pr(n){if(Array.isArray(n))return n.map(qe);if(n&&typeof n=="object"){let e=n,t=e.name,r=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(r))throw new Error("Series: data must be an array");let h=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:t,data:r.map(qe),sensorType:i??"numeric",enumMap:o,seriesType:l,...h&&{style:{line:h}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function fr(n){if(!n||typeof n!="object")throw new Error("parseAggregated: object expected");let e=n,t=e.name,r=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(r))throw new Error("AggregatedSeries: data must be an array");return {name:t,data:gr(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function gr(n){let e=t=>typeof t=="number"?t:null;return n.map(t=>{let r=t;return {time:r.time??0,min:e(r.min),max:e(r.max),avg:e(r.avg),count:typeof r.count=="number"?r.count:0}})}function Je(n,e,t){return typeof e=="function"?e(n):n[e??t]}function yr(n,e,t){if(n instanceof Date){let r=n.getTime();if(Number.isNaN(r))throw new TypeError(`toDataPoints: invalid Date at row ${t}`);return r}if(typeof n=="string"){let r=Date.parse(n);if(Number.isNaN(r))throw new TypeError(`toDataPoints: unparsable time string at row ${t}: ${n}`);return r}if(typeof n=="number"&&Number.isFinite(n))return e==="s"||e==="auto"&&Math.abs(n)>=1e8&&Math.abs(n)<1e11?n*1e3:n;throw new TypeError(`toDataPoints: missing or invalid time at row ${t}: ${String(n)}`)}function br(n,e){if(n==null)return null;if(typeof n=="number")return Number.isNaN(n)?null:n;if(typeof n=="string"){let t=n.trim();if(t==="")return null;let r=Number(t);if(Number.isNaN(r))throw new TypeError(`toDataPoints: value is not a number at row ${e}: ${n}`);return r}throw new TypeError(`toDataPoints: invalid value at row ${e}: ${String(n)}`)}function nn(n,e={}){let t=e.timeUnit??"ms",r=[];for(let i=0;i<n.length;i++){let o=n[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]:Je(o,e.time,"time"),m=s&&e.value===void 0?o[1]:Je(o,e.value,"value"),l={time:yr(a,t,i),value:br(m,i)};if(e.annotation!==void 0){let h=Je(o,e.annotation,"annotation");typeof h=="string"&&h!==""&&(l.annotation=h);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function xr(n,e,t={}){return {name:n,data:nn(e,t)}}function rn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function on(n,e){if(!rn(n)||!rn(e))return e;let t={...n};for(let[r,i]of Object.entries(e))t[r]=on(t[r],i);return t}function Sr(...n){let e;for(let t of n)t!==void 0&&(e=on(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{je as AnnotationBandBuilder,Be as AnnotationBandItemBuilder,Re as AnnotationBuilder,Le as GraphBuilder,Pe as HighlightBuilder,K as MLTimeGraph,$e as MarkerBuilder,Y as SVGRenderer,De as ThresholdBuilder,Me as TimeSeriesBuilder,Ne as VERSION,me as attachTooltip,be as drawMarker,rn as estimateMetrics,Yn as fillBetweenThresholds,Q as getDefaultTheme,qe as getLineStyle,V as liberationMetrics,er as mergeOptions,Xn as mount,Zn as parseAggregated,Ye as parseDataPoint,Un as parseSeries,Jt as resetDefaultTheme,Ge as resolveDash,qt as setDefaultTheme,z as slugify,Xt as toDataPoints,Qn as toSeries};
65
+ */export{Fe as AnnotationBandBuilder,Ie as AnnotationBandItemBuilder,Be as AnnotationBuilder,De as GraphBuilder,je as HighlightBuilder,H as MLTimeGraph,Re as MarkerBuilder,Z as SVGRenderer,Pe as ThresholdBuilder,$e as TimeSeriesBuilder,Ue as VERSION,Le as attachTooltip,Yn as autoMargin,xe as drawMarker,yn as estimateMetrics,dr as fillBetweenThresholds,J as getDefaultTheme,rt as getLineStyle,E as liberationMetrics,Sr as mergeOptions,cr as mount,fr as parseAggregated,qe as parseDataPoint,pr as parseSeries,cn as resetDefaultTheme,He as resolveDash,un as setDefaultTheme,N as slugify,nn as toDataPoints,xr as toSeries};
@@ -1,4 +1,4 @@
1
- var C=class{_config;_state;constructor(t,n){this._config={enabled:n?.enabled??true,zoomSpeed:n?.zoomSpeed??.1,minDomainMs:n?.minDomainMs??0,maxDomainMs:n?.maxDomainMs??365*24*60*60*1e3},this._state={domain:[...t],originalDomain:[...t],scale:1,offset:0};}get state(){return {...this._state,domain:[...this._state.domain]}}applyZoom(t,n,o){if(!this._config.enabled)return;let i=1+Math.sign(n)*this._config.zoomSpeed;if(i<=0)return;let[r,a]=this._state.domain,d=a-r,s=t/o,e=d/i,l=this._config.minDomainMs??0,m=this._config.maxDomainMs??1/0;e<l&&(e=l),e>m&&(e=m);let p=r+d*s,u=p-e*s,c=p+e*(1-s),[b,f]=this._state.originalDomain;c-u>f-b?(u=b,c=f,e=f-b):(u<b&&(c=f-(f-b)*((c-u)/(f-b)),u=b),c>f&&(u=b+(f-b)*((u-b)/(f-b)),c=f)),this._state.domain=[u,c],this._state.scale=(a-r)/e;}applyPan(t,n){if(!this._config.enabled)return;let[o,i]=this._state.domain,r=i-o,[a,d]=this._state.originalDomain,s=-(t/n)*r,e=o+s,l=i+s;e<a&&(s-=e-a),l>d&&(s-=l-d),this._state.domain=[o+s,i+s];}reset(){this._state.domain=[...this._state.originalDomain],this._state.scale=1,this._state.offset=0;}get enabled(){return this._config.enabled??true}};var w=new Map;function F(h,t){return `${h}|${JSON.stringify(t??{})}`}function k(h,t){let n=F(h,t),o=w.get(n);return o||(o=new Intl.DateTimeFormat(h,t),w.set(n,o)),o}var y=class{#t;#e;constructor(t){this.#t=[...t.domain],this.#e=[...t.range];}map(t){let n=Number(t),[o,i]=this.#t,[r,a]=this.#e;return i===o?r:r+(n-o)/(i-o)*(a-r)}invert(t){let[n,o]=this.#t,[i,r]=this.#e;return r===i?n:n+(t-i)/(r-i)*(o-n)}domain(){return [...this.#t]}range(){return [...this.#e]}},g=[{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}],x=class{#t;#e;#n;constructor(t){this.#t=new y({domain:t.domain,range:t.range}),this.#e=t.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=t.timeZone;}map(t){return this.#t.map(Number(t))}invert(t){return this.#t.invert(t)}domain(){return this.#t.domain()}range(){return this.#t.range()}get timeZone(){return this.#n}get locale(){return this.#e}tickInterval(t,n=3,o=12){let[i,r]=this.#t.domain(),a=r-i;if(a<=0)return {interval:g[0].ms};let d=a/t,s=g[0].ms;for(let m of g)if(m.ms>=d){s=m.ms;break}let e=s,l=Math.round(a/e);for(;l>o&&e<g[g.length-1].ms;){let m=g.findIndex(p=>p.ms===e);e=g[Math.min(m+1,g.length-1)].ms,l=Math.round(a/e);}for(;l<n&&e>g[0].ms;){let m=g.findIndex(p=>p.ms===e);e=g[Math.max(m-1,0)].ms,l=Math.round(a/e);}return {interval:e}}ticks(t){let n=t?.minTicks??5,o=t?.maxTicks??12,{interval:i}=this.tickInterval((n+o)/2,n,o),[r,a]=this.#t.domain(),d=[],s=Math.ceil(r/i)*i;for(let e=s;e<=a;e+=i)d.push(e);return d}format(t,n){let o=this.#n?{...n,timeZone:this.#n}:n;return k(this.#e,o).format(new Date(t))}};function v(h){let t=1/0,n=-1/0;for(let o=0;o<h.length;o++){let i=h[o];i<t&&(t=i),i>n&&(n=i);}return [t,n]}var M={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 R={...M};function S(){return R}var _=new Proxy({},{get:(h,t)=>S()[t],has:(h,t)=>t in S(),ownKeys:()=>Reflect.ownKeys(S()),getOwnPropertyDescriptor:(h,t)=>Reflect.getOwnPropertyDescriptor(S(),t)});var D=class{_data;_width;_height;_x;_y;_zoom;_stroke;_bgColor;_brushColor;constructor(t){this._data=t.data,this._width=t.width,this._height=t.height,this._x=t.x,this._y=t.y,this._zoom=t.zoom,this._stroke=t.stroke??_.minimapStroke,this._bgColor=t.bgColor??_.minimapBg,this._brushColor=t.brushColor??_.minimapBrush;}render(){if(this._data.length===0)return [];let t=[],n=this._data.map(e=>e.time),o=this._data.map(e=>e.value).filter(e=>e!==null),i=v(n),r=v(o),a=new x({domain:i,range:[0,this._width]}),d=new y({domain:r,range:[this._height,0]});t.push({type:"rect",x:this._x,y:this._y,w:this._width,h:this._height,fill:this._bgColor});let s=this._data.map(e=>({x:this._x+a.map(e.time),y:this._y+d.map(e.value)}));if(t.push({type:"path",points:s,smoothing:false,stroke:this._stroke,strokeWidth:1}),this._zoom){let e=this._zoom.state,l=this._x+a.map(e.domain[0]),m=this._x+a.map(e.domain[1]),p=Math.max(2,m-l);t.push({type:"rect",x:l,y:this._y,w:p,h:this._height,fill:this._brushColor});}return t}navigateTo(t){let n=this._data.map(a=>a.time),o=v(n),i=new x({domain:o,range:[0,this._width]}),r=t-this._x;return i.invert(r)}};var T=class{_mouseX;_mouseY;_timeScale;_valueScale;_data;_xRange;_yRange;_snapRadius;_bgColor;_borderColor;_textColor;constructor(t){this._mouseX=t.mouseX,this._mouseY=t.mouseY,this._timeScale=t.timeScale,this._valueScale=t.valueScale,this._data=t.data,this._xRange=t.xRange,this._yRange=t.yRange,this._snapRadius=t.snapRadius??_.tooltipSnapRadius,this._bgColor=t.bgColor??_.tooltipBg,this._borderColor=t.borderColor??_.tooltipBorder,this._textColor=t.textColor??_.tooltipText;}compute(){let t=[...this._data].filter(u=>u.value!==null).sort((u,c)=>u.time-c.time),n,o=1/0;for(let u of t){let c=this._timeScale.map(u.time),b=Math.abs(this._mouseX-c);b<o&&(o=b,n=u);}if(!n||o>this._snapRadius)return {visible:false,commands:[]};let i=this._timeScale.map(n.time),r=this._valueScale.map(n.value),a=[];a.push({type:"line",x1:i,y1:this._yRange[0],x2:i,y2:this._yRange[1],stroke:"#94a3b8",strokeWidth:1},{type:"line",x1:this._xRange[0],y1:r,x2:this._xRange[1],y2:r,stroke:"#94a3b8",strokeWidth:1},{type:"circle",cx:i,cy:r,r:5,fill:"#3b82f6"});let d=new Date(n.time).toLocaleString(),s=n.value.toFixed(2),e=120,l=44,m=i+12,p=r-l-4;return m+e>this._xRange[1]&&(m=i-e-12),p<this._yRange[0]&&(p=r+12),a.push({type:"rect",x:m,y:p,w:e,h:l,fill:this._bgColor,stroke:this._borderColor,strokeWidth:1},{type:"text",content:d,x:m+8,y:p+16,fontSize:_.tooltipTimeFontSize,fill:this._textColor},{type:"text",content:`Value: ${s}`,x:m+8,y:p+32,fontSize:_.tooltipValueFontSize,fill:"#3b82f6"}),{visible:true,commands:a,dataPoint:n,snapX:i}}};/*!
1
+ var C=class{_config;_state;constructor(t,n){this._config={enabled:n?.enabled??true,zoomSpeed:n?.zoomSpeed??.1,minDomainMs:n?.minDomainMs??0,maxDomainMs:n?.maxDomainMs??365*24*60*60*1e3},this._state={domain:[...t],originalDomain:[...t],scale:1,offset:0};}get state(){return {...this._state,domain:[...this._state.domain]}}applyZoom(t,n,o){if(!this._config.enabled)return;let r=1+Math.sign(n)*this._config.zoomSpeed;if(r<=0)return;let[i,a]=this._state.domain,d=a-i,s=t/o,e=d/r,l=this._config.minDomainMs??0,m=this._config.maxDomainMs??1/0;e<l&&(e=l),e>m&&(e=m);let p=i+d*s,h=p-e*s,c=p+e*(1-s),[b,f]=this._state.originalDomain;c-h>f-b?(h=b,c=f,e=f-b):(h<b&&(c=f-(f-b)*((c-h)/(f-b)),h=b),c>f&&(h=b+(f-b)*((h-b)/(f-b)),c=f)),this._state.domain=[h,c],this._state.scale=(a-i)/e;}applyPan(t,n){if(!this._config.enabled)return;let[o,r]=this._state.domain,i=r-o,[a,d]=this._state.originalDomain,s=-(t/n)*i,e=o+s,l=r+s;e<a&&(s-=e-a),l>d&&(s-=l-d),this._state.domain=[o+s,r+s];}reset(){this._state.domain=[...this._state.originalDomain],this._state.scale=1,this._state.offset=0;}get enabled(){return this._config.enabled??true}};var w=new Map;function R(u,t){return `${u}|${JSON.stringify(t??{})}`}function k(u,t){let n=R(u,t),o=w.get(n);return o||(o=new Intl.DateTimeFormat(u,t),w.set(n,o)),o}function M(){return typeof navigator<"u"?navigator.language:void 0}var y=class{#t;#e;constructor(t){this.#t=[...t.domain],this.#e=[...t.range];}map(t){let n=Number(t),[o,r]=this.#t,[i,a]=this.#e;return r===o?i:i+(n-o)/(r-o)*(a-i)}invert(t){let[n,o]=this.#t,[r,i]=this.#e;return i===r?n:n+(t-r)/(i-r)*(o-n)}domain(){return [...this.#t]}range(){return [...this.#e]}},g=[{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}],x=class{#t;#e;#n;constructor(t){this.#t=new y({domain:t.domain,range:t.range}),this.#e=t.locale||(M()??"en-US"),this.#n=t.timeZone;}map(t){return this.#t.map(Number(t))}invert(t){return this.#t.invert(t)}domain(){return this.#t.domain()}range(){return this.#t.range()}get timeZone(){return this.#n}get locale(){return this.#e}tickInterval(t,n=3,o=12){let[r,i]=this.#t.domain(),a=i-r;if(a<=0)return {interval:g[0].ms};let d=a/t,s=g[0].ms;for(let m of g)if(m.ms>=d){s=m.ms;break}let e=s,l=Math.round(a/e);for(;l>o&&e<g[g.length-1].ms;){let m=g.findIndex(p=>p.ms===e);e=g[Math.min(m+1,g.length-1)].ms,l=Math.round(a/e);}for(;l<n&&e>g[0].ms;){let m=g.findIndex(p=>p.ms===e);e=g[Math.max(m-1,0)].ms,l=Math.round(a/e);}return {interval:e}}ticks(t){let n=t?.minTicks??5,o=t?.maxTicks??12,{interval:r}=this.tickInterval((n+o)/2,n,o),[i,a]=this.#t.domain(),d=[],s=Math.ceil(i/r)*r;for(let e=s;e<=a;e+=r)d.push(e);return d}format(t,n){let o=this.#n?{...n,timeZone:this.#n}:n;return k(this.#e,o).format(new Date(t))}};function v(u){let t=1/0,n=-1/0;for(let o=0;o<u.length;o++){let r=u[o];r<t&&(t=r),r>n&&(n=r);}return [t,n]}var F={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 z={...F};function S(){return z}var _=new Proxy({},{get:(u,t)=>S()[t],has:(u,t)=>t in S(),ownKeys:()=>Reflect.ownKeys(S()),getOwnPropertyDescriptor:(u,t)=>Reflect.getOwnPropertyDescriptor(S(),t)});var D=class{_data;_width;_height;_x;_y;_zoom;_stroke;_bgColor;_brushColor;constructor(t){this._data=t.data,this._width=t.width,this._height=t.height,this._x=t.x,this._y=t.y,this._zoom=t.zoom,this._stroke=t.stroke??_.minimapStroke,this._bgColor=t.bgColor??_.minimapBg,this._brushColor=t.brushColor??_.minimapBrush;}render(){if(this._data.length===0)return [];let t=[],n=this._data.map(e=>e.time),o=this._data.map(e=>e.value).filter(e=>e!==null),r=v(n),i=v(o),a=new x({domain:r,range:[0,this._width]}),d=new y({domain:i,range:[this._height,0]});t.push({type:"rect",x:this._x,y:this._y,w:this._width,h:this._height,fill:this._bgColor});let s=this._data.map(e=>({x:this._x+a.map(e.time),y:this._y+d.map(e.value)}));if(t.push({type:"path",points:s,smoothing:false,stroke:this._stroke,strokeWidth:1}),this._zoom){let e=this._zoom.state,l=this._x+a.map(e.domain[0]),m=this._x+a.map(e.domain[1]),p=Math.max(2,m-l);t.push({type:"rect",x:l,y:this._y,w:p,h:this._height,fill:this._brushColor});}return t}navigateTo(t){let n=this._data.map(a=>a.time),o=v(n),r=new x({domain:o,range:[0,this._width]}),i=t-this._x;return r.invert(i)}};var T=class{_mouseX;_mouseY;_timeScale;_valueScale;_data;_xRange;_yRange;_snapRadius;_bgColor;_borderColor;_textColor;constructor(t){this._mouseX=t.mouseX,this._mouseY=t.mouseY,this._timeScale=t.timeScale,this._valueScale=t.valueScale,this._data=t.data,this._xRange=t.xRange,this._yRange=t.yRange,this._snapRadius=t.snapRadius??_.tooltipSnapRadius,this._bgColor=t.bgColor??_.tooltipBg,this._borderColor=t.borderColor??_.tooltipBorder,this._textColor=t.textColor??_.tooltipText;}compute(){let t=[...this._data].filter(h=>h.value!==null).sort((h,c)=>h.time-c.time),n,o=1/0;for(let h of t){let c=this._timeScale.map(h.time),b=Math.abs(this._mouseX-c);b<o&&(o=b,n=h);}if(!n||o>this._snapRadius)return {visible:false,commands:[]};let r=this._timeScale.map(n.time),i=this._valueScale.map(n.value),a=[];a.push({type:"line",x1:r,y1:this._yRange[0],x2:r,y2:this._yRange[1],stroke:"#94a3b8",strokeWidth:1},{type:"line",x1:this._xRange[0],y1:i,x2:this._xRange[1],y2:i,stroke:"#94a3b8",strokeWidth:1},{type:"circle",cx:r,cy:i,r:5,fill:"#3b82f6"});let d=new Date(n.time).toLocaleString(),s=n.value.toFixed(2),e=120,l=44,m=r+12,p=i-l-4;return m+e>this._xRange[1]&&(m=r-e-12),p<this._yRange[0]&&(p=i+12),a.push({type:"rect",x:m,y:p,w:e,h:l,fill:this._bgColor,stroke:this._borderColor,strokeWidth:1},{type:"text",content:d,x:m+8,y:p+16,fontSize:_.tooltipTimeFontSize,fill:this._textColor},{type:"text",content:`Value: ${s}`,x:m+8,y:p+32,fontSize:_.tooltipValueFontSize,fill:"#3b82f6"}),{visible:true,commands:a,dataPoint:n,snapX:r}}};/*!
2
2
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
3
3
  * MIT with Attribution: free use incl. commercial requires visible credit to
4
4
  * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
package/dist/internals.js CHANGED
@@ -1,4 +1,4 @@
1
- var U=class{};var w=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 ge=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 Z(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 Re(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 D(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 $e(i,e,t,n){let r=w.splitByThreshold(i,e,a=>a.value,w.interpolateDataPoint),o=[];return n.below&&o.push(...C(r.below.map(a=>({data:a})),t,n.below)),n.above&&o.push(...C(r.above.map(a=>({data:a})),t,n.above)),o}function C(i,e,t){let n=[],r=D(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=D(t);for(let o=0;o<i.length;o++){let a=i[o];if(a.data.length<2)continue;let s=Z(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 Fe(i,e,t,n,r){let o=[],a=D(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 K(i,e,t,n){if(i.length<2)return [];let r=w.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 J(i,e,t,n){let r=D(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;Q(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 Q(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 We=[[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"]],ye=.6,je=(()=>{let i=new Map;for(let[e,,t]of We){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function be(i){return je.get(i)??ye}var j=(i,e)=>{let t=0;for(let n of i)t+=be(n.codePointAt(0)??0);return t*e};var xe={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 Oe={...xe};function M(){return Oe}function Ie(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 Be(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function Se(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ie(t),a=Be(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ var Z=class{};var w=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 ye=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 q(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 D(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=w.splitByThreshold(i,e,a=>a.value,w.interpolateDataPoint),o=[];return n.below&&o.push(...C(r.below.map(a=>({data:a})),t,n.below)),n.above&&o.push(...C(r.above.map(a=>({data:a})),t,n.above)),o}function C(i,e,t){let n=[],r=D(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 K(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];if(a.data.length<2)continue;let s=q(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=D(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=w.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=D(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"]],be=.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 xe(i){return Oe.get(i)??be}var j=(i,e)=>{let t=0;for(let n of i)t+=xe(n.codePointAt(0)??0);return t*e};var Se={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={...Se};function M(){return Ie}function Be(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 Ee(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ke(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Be(t),a=Ee(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>
@@ -21,10 +21,10 @@ var U=class{};var w=class{static interpolateDataPoint(i,e,t){return {time:i.time
21
21
  ${h}
22
22
  ${u}
23
23
  </pattern>
24
- `.trim()}var p=new Proxy({},{get:(i,e)=>M()[e],has:(i,e)=>e in M(),ownKeys:()=>Reflect.ownKeys(M()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(M(),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 Ee="#ffffff",He="#cccccc",ze=6,Ge=.85,L=12,N=8,I=20,Ve=11,V=18,ee=(i,e)=>e(i,Ve);function ke(i,e,t){let n=s=>L+N+ee(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 we(i,e="vertical",t=j,n){if(e==="horizontal"){let o=ke(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,ee(o.name,t));return {width:L+N+r,height:i.length*I}}function Ne(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=we(e,r,o,a),d=((r==="horizontal"?c.height/I:e.length)-1)*I+L,g=s.padding??ze,y=s.stroke??He;m.rect({x:t-g,y:n-g,w:c.width+2*g,h:d+2*g,fill:s.fill??Ee,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ge});}let u=r==="horizontal"?ke(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+=L+N+ee(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:L,h:L,fill:c.color,stroke:p.legendStroke,strokeWidth:1}).text({content:c.name,x:d+L+N,y:g+L-2,fontSize:p.legendFont,fill:p.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Xe(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 Te=new Map;function Ye(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ye(i,e),n=Te.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Te.set(t,n)),n}var _=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]}},T=[{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 _({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"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:T[0].ms};let s=a/e,l=T[0].ms;for(let h of T)if(h.ms>=s){l=h.ms;break}let m=l,u=Math.round(a/m);for(;u>n&&m<T[T.length-1].ms;){let h=T.findIndex(c=>c.ms===m);m=T[Math.min(h+1,T.length-1)].ms,u=Math.round(a/m);}for(;u<t&&m>T[0].ms;){let h=T.findIndex(c=>c.ms===m);m=T[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 te(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ue(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Ze(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=Ue(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,F=S?.position??"right",W=Je(k,F,r,o,d,f,S);h.push({...W,y:Ke(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 qe(i){let e=Ze(i);return [...e.inside,...e.labels]}function Ke(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function Je(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 ve(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 X(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;if(x==="auto"){let S=b!=="above"&&b!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(y-g)-4?-90:void 0;}l.push({type:"text",content:d.label,x:(g+y)/2,y:ve(b,a,s,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return l}function Qe(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,F=Math.max(S,k);return e.map(W=>{let pe=t.map(W.startTime),fe=t.map(W.endTime);return {type:"rect",x:Math.min(pe,fe),y:F-x+(y.offset??0),w:Math.abs(fe-pe),h:x,fill:y.fill??l,opacity:y.opacity??.75}})};return X({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",F=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},...F&&{edges:{stroke:l,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??f,labelColor:c,fontSize:h,rotate:x.rotate??d}})}).concat(b())}function et(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"&&Q(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 tt(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return X({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 nt(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??rt(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=te(a.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:s});}else r.push(...s);}return r}function rt(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 ne=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 re=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 p=new Proxy({},{get:(i,e)=>M()[e],has:(i,e)=>e in M(),ownKeys:()=>Reflect.ownKeys(M()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(M(),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 He="#ffffff",ze="#cccccc",Ge=6,Ve=.85,L=12,N=8,I=20,Ne=11,V=18,te=(i,e)=>e(i,Ne);function we(i,e,t){let n=s=>L+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 Te(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:L+N+r,height:i.length*I}}function Xe(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=Te(e,r,o,a),d=((r==="horizontal"?c.height/I:e.length)-1)*I+L,g=s.padding??Ge,y=s.stroke??ze;m.rect({x:t-g,y:n-g,w:c.width+2*g,h:d+2*g,fill:s.fill??He,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ve});}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+=L+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:L,h:L,fill:c.color,stroke:p.legendStroke,strokeWidth:1}).text({content:c.name,x:d+L+N,y:g+L-2,fontSize:p.legendFont,fill:p.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ye(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 ve=new Map;function Ue(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ue(i,e),n=ve.get(t);return n||(n=new Intl.DateTimeFormat(i,e),ve.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var _=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]}},T=[{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 _({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:T[0].ms};let s=a/e,l=T[0].ms;for(let h of T)if(h.ms>=s){l=h.ms;break}let m=l,u=Math.round(a/m);for(;u>n&&m<T[T.length-1].ms;){let h=T.findIndex(c=>c.ms===m);m=T[Math.min(h+1,T.length-1)].ms,u=Math.round(a/m);}for(;u<t&&m>T[0].ms;){let h=T.findIndex(c=>c.ms===m);m=T[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 Ze(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=Ze(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,F=S?.position??"right",W=Qe(k,F,r,o,d,f,S);h.push({...W,y:Je(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 Ke(i){let e=qe(i);return [...e.inside,...e.labels]}function Je(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function Qe(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 Ce(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;if(x==="auto"){let S=b!=="above"&&b!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(y-g)-4?-90:void 0;}l.push({type:"text",content:d.label,x:(g+y)/2,y:Ce(b,a,s,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return l}function et(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,F=Math.max(S,k);return e.map(W=>{let fe=t.map(W.startTime),ge=t.map(W.endTime);return {type:"rect",x:Math.min(fe,ge),y:F-x+(y.offset??0),w:Math.abs(ge-fe),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",F=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},...F&&{edges:{stroke:l,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??f,labelColor:c,fontSize:h,rotate:x.rotate??d}})}).concat(b())}function tt(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 nt(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 rt(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??ot(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 ot(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(`
25
25
  `);return `<clipPath id="${e}">
26
26
  ${t}
27
- </clipPath>`}get regions(){return [...this.#e]}};function Y(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 Y(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 Ce(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function ot(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 oe=class{#e;#t;constructor(e){this.#e=new _({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??Ce;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??Ce,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)}];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 Y(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=ot(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 ie=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 ae=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 se=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=w.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=[];if(u.push(...C(m,l,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n)for(let h of a)u.push(...J(h,l,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var le=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=w.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 me=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 Me(i,e,t,n,r,o,a){return K(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:w.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...a})}var ue=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=w.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=Me(d,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:a,smoothingType:s});h.push(...b);}if(e.fillToMin){let b=Me(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)=>C(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 it=1,ce=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,it);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 he=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=ge.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 A=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"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 R=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 $=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 at={time:new A,value:new R,enum:new $};function de(i,e){let t=M();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 Le(i){let e=i.style?.line;return e===false?[]:e===void 0?[de({},i)]:Array.isArray(e)?e.map(t=>de(t,i)):[de(e,i)]}function De(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=M(),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 _e(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 Ae(i){return i.style?.fill}function st(i){return {lines:Le(i),fill:Ae(i),markers:De(i),shadow:_e(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 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 Me(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function it(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 ie=class{#e;#t;constructor(e){this.#e=new _({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??Me;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??Me,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)}];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=it(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 ae=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 se=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 le=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=w.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=[];if(u.push(...C(m,l,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n)for(let h of a)u.push(...Q(h,l,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var me=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=w.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 K(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ue=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:w.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...a})}var ce=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=w.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)=>C(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 at=1,he=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,at);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 de=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=ye.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 A=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 R=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 $=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 st={time:new A,value:new R,enum:new $};function pe(i,e){let t=M();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?[pe({},i)]:Array.isArray(e)?e.map(t=>pe(t,i)):[pe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=M(),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 Pe(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 Ae(i){return i.style?.gap}function Re(i){return i.style?.fill}function lt(i){return {lines:De(i),fill:Re(i),markers:_e(i),shadow:Pe(i),gap:Ae(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 U=class{};var w=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{ce as AnnotationBandSeries,H as BandScale,me as BandSeries,re as Clip,O as CommandBuilder,ae as EnumAxis,$ as EnumFormatter,at as Formatters,ne as Layout,se as LineSeries,_ as LinearScale,ue as MinMaxAvgSeries,ie as MovingAvg,U as Renderer,he as StatsOverlay,le as StepSeries,T as TIME_INTERVALS,G as TimeAxis,A as TimeFormatter,E as TimeScale,oe as ValueAxis,R as ValueFormatter,Se as getHatch,we as measureLegend,nt as renderAnnotations,Fe as renderArea,Qe as renderGaps,Xe as renderGrid,tt as renderHighlights,Ne as renderLegend,C as renderLine,et as renderMarkers,J as renderSeriesMarkers,$e as renderSplitLine,q as renderStep,qe as renderThresholds,K as renderZonedArea,Ae as resolveFill,Pe as resolveGap,Le as resolveLines,De as resolveMarkers,st as resolveSeriesStyle,_e as resolveShadow,te as slugify,p as theme,Re as toStepData,Z as toStepPoints};
46
+ */export{he as AnnotationBandSeries,H as BandScale,ue as BandSeries,oe as Clip,O as CommandBuilder,se as EnumAxis,$ as EnumFormatter,st as Formatters,re as Layout,le as LineSeries,_ as LinearScale,ce as MinMaxAvgSeries,ae as MovingAvg,Z as Renderer,de as StatsOverlay,me as StepSeries,T as TIME_INTERVALS,G as TimeAxis,A as TimeFormatter,E as TimeScale,ie as ValueAxis,R as ValueFormatter,ke as getHatch,Te as measureLegend,rt as renderAnnotations,We as renderArea,et as renderGaps,Ye as renderGrid,nt as renderHighlights,Xe as renderLegend,C as renderLine,tt as renderMarkers,Q as renderSeriesMarkers,Fe as renderSplitLine,K as renderStep,Ke as renderThresholds,J as renderZonedArea,Re as resolveFill,Ae as resolveGap,De as resolveLines,_e as resolveMarkers,lt as resolveSeriesStyle,Pe as resolveShadow,ne as slugify,p as theme,$e as toStepData,q as toStepPoints};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ml-time-graph",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
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",