ml-time-graph 1.18.0 → 1.19.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 +26 -0
- package/dist/analyze/index.d.ts +2 -1
- package/dist/analyze/index.js +2 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.js +16 -16
- package/dist/interaction/index.d.ts +4 -2
- package/dist/internals.d.ts +8 -5
- package/dist/internals.js +3 -3
- package/dist/{marker_renderer-BZMcTbHC.d.ts → marker_renderer-BKOhqPkn.d.ts} +3 -2
- package/dist/{types-CNIUKrmy.d.ts → types-pKdGBqvc.d.ts} +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,32 @@ release notes, and every change is in `git log` in full.
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## [1.19.0] - 2026-10-19
|
|
23
|
+
|
|
24
|
+
### Security
|
|
25
|
+
- **go-time-graph now requires Go 1.26** (was 1.25) and builds with Go 1.26.9. This closes 10
|
|
26
|
+
standard-library vulnerabilities reachable from `graph-server` (govulncheck) and updates
|
|
27
|
+
`golang.org/x/{crypto,net,text,sys,mod}`, whose fixes need Go 1.26. Go 1.25 is no longer
|
|
28
|
+
maintained since Go 1.27. No change to the output.
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **Type exports** (TS) — `RenderOutput` and `GapBand` from `ml-time-graph`; `Point`,
|
|
32
|
+
`FlatSeriesStyle` and `RenderingContext` from `ml-time-graph/internals`. They already appeared
|
|
33
|
+
in public signatures (`render()`, `gaps.band`, the series renderers) but could not be named, so
|
|
34
|
+
a project emitting declarations could hit TS2742.
|
|
35
|
+
- **Gallery card "Line styles"** — every `style.line.style` variant, drawn from the same fixture
|
|
36
|
+
(`line_variants.json`) that the Go golden and the TS/Go parity test check.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- **Unknown `dash` variant** (TS) — a line style name the table does not know (e.g. `"dots"`
|
|
40
|
+
from JSON) now draws a plain solid line with no dash attributes, as `"solid"` does and as
|
|
41
|
+
the Go port always did. Before, TS wrote `stroke-dasharray="none" stroke-linecap="butt"`;
|
|
42
|
+
`resolveDash()` returned that pair instead of `null`. Looks the same; the SVG differs.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Internal clean-up in both ports (Go `zeichne` split into steps, shared SVG attribute and
|
|
46
|
+
rolling-window helpers). No change to the output: every fixture renders byte-identical.
|
|
47
|
+
|
|
22
48
|
## [1.18.0] - 2026-10-07
|
|
23
49
|
|
|
24
50
|
### Added
|
package/dist/analyze/index.d.ts
CHANGED
|
@@ -680,4 +680,5 @@ interface F0Opts {
|
|
|
680
680
|
*/
|
|
681
681
|
declare function f0Sterilization(data: DataPoint[], opts?: F0Opts): number;
|
|
682
682
|
|
|
683
|
-
export {
|
|
683
|
+
export { DEFAULT_ACTIVATION_ENERGY, PRODUCT_PROFILES, SeriesProcessor, StatsAggregator, aggregateBySlot, aggregateWithStats, analyzeLongTermTrends, computeLimitExcursions, createAggr, currentTrend, detectGaps, divergenceExcursions, downsample, f0Sterilization, holdAlign, hotColdSpots, linearFit, mkt, predictTimeToThreshold, rollingEma, rollingMean, rollingMkt, rollingStdDev, rollingTrend, sampleStdDev, spatialDelta, stdDev, varianceCoefficient };
|
|
684
|
+
export type { AggregatedPoint, AggregationConfig, AggregationMode, AggregationThresholds, ComputeLimitsOpts, DataPoint, DivergenceEpisode, DivergenceOptions, F0Opts, HotColdSpotsResult, LimitExcursion, LimitStats, LimitStatsPoint, LongTermInsight, MktPoint, NamedSeries, PredictOpts, PredictResult, ProductConfig, ProductType, SensorStat, SpatialPoint, StatsAggregatedPoint, StatsResult, StdDevPoint, TrendFit, TrendPoint };
|
package/dist/analyze/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var I=class{static interpolateDataPoint(l,i,n){return {time:l.time+Math.round(n*(i.time-l.time)),value:(l.value??0)+n*((i.value??0)-(l.value??0)),synthetic:true}}static interpolateAggregatedPoint(l,i,n){let u=(e,t)=>e!==null&&t!==null?e+n*(t-e):null;return {time:l.time+n*(i.time-l.time),min:u(l.min,i.min),max:u(l.max,i.max),avg:u(l.avg,i.avg),count:Math.round(l.count+n*(i.count-l.count))}}static getRuns(l,i,n=0){let u=[...l].sort((r,o)=>r.time-o.time),e=[],t=[],a=null;for(let r of u){let o=i(r),m=n>0&&a&&r.time-a.time>n;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(r),a=r;}return t.length&&e.push(t),e}static splitByBoundaries(l,i,n,u){if(l.length===0)return [];if(i.length===0)return [{data:l,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...i].sort((m,s)=>m-s),t=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],r=m=>{let s=0;for(let h=0;h<e.length&&m>=e[h];h++)s=h+1;return s},o=[l[0]];for(let m=1;m<l.length;m++){let s=l[m-1],h=l[m],g=n(s),d=n(h),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let x=g;for(let v of p){let b=(v-g)/(d-g),f=u(s,h,b);o.push(f);let c=r((x+v)/2);t.push({data:o,zoneIndex:c,zoneLow:a(c)}),o=[f],x=v;}(p.length===0||p[p.length-1]!==d)&&o.push(h);}if(o.length>1||l.length===1){let m=n(o[0]),s=n(o[o.length-1]),h=r((m+s)/2);t.push({data:o,zoneIndex:h,zoneLow:a(h)});}return t}static splitByThreshold(l,i,n,u){let e=this.splitByBoundaries(l,[i],n,u),t={above:[],below:[]};for(let a of e)a.zoneIndex===0?t.below.push(a.data):t.above.push(a.data);return t}},H={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},D=8.314462618,N=273.15;function T(l,i,n,u=1){let e=i.filter(f=>f.value!==null&&f.value!==void 0&&!Number.isNaN(f.value)).map(f=>f.value);if(!e.length)return {time:l,min:null,max:null,avg:null,mkt:null,deltaMkt:null,stdDev:null,minutesAboveHigh:n?0:null,minutesBelowLow:n?0:null,count:0};let t=1/0,a=-1/0,r=0;for(let f of e)f<t&&(t=f),f>a&&(a=f),r+=f;let o=r/e.length,m=n?0:null,s=n?0:null;if(n)for(let f=0;f<i.length;f++){let c=i[f];if(c.value!==null&&c.value!==void 0){let M=i[f+1],w=(M?M.time-c.time:0)/(1e3*60);c.value>n.limitHigh&&(m+=w),c.value<n.limitLow&&(s+=w);}}let h=0,g=0,d=(n?.activationEnergy??83144)/D;for(let f of e){h+=Math.pow(f-o,2);let c=f+N;g+=Math.exp(-d/c);}let p=h/e.length,x=Math.sqrt(p),v=null,b=null;if(e.length>=u){let f=g/e.length,c=d/-Math.log(f);v=Number((c-N).toFixed(2)),b=Number((v-o).toFixed(2));}return {time:l,min:Number(t.toFixed(2)),max:Number(a.toFixed(2)),avg:Number(o.toFixed(2)),mkt:v,deltaMkt:b,stdDev:Number(x.toFixed(2)),minutesAboveHigh:m!==null?Number(m.toFixed(1)):null,minutesBelowLow:s!==null?Number(s.toFixed(1)):null,count:e.length}}function S(l,i="hourly",n,u,e=1){if(!l.length)return [];let t=i==="hourly"?36e5:i==="daily"?864e5:n??3600*1e3,a=[...l].sort((s,h)=>s.time-h.time),r=[],o=a[0].time,m=[];for(let s of a){for(;s.time-o>=t;)r.push(T(o,m,u,e)),o+=t,m=[];m.push(s);}return r.push(T(o,m,u,e)),r}function z(l,i){let n=1/0,u=-1/0,e=0;for(let a of i)a<n&&(n=a),a>u&&(u=a),e+=a;let t=e/i.length;return {time:l,min:n,max:u,avg:t,count:i.length}}function B(l,i=6e4){if(l.length<2)return [];let n=[...l].sort((e,t)=>e.time-t.time),u=[];for(let e=1;e<n.length;e++)n[e].time-n[e-1].time>i&&u.push({startTime:n[e-1].time,endTime:n[e].time});return u}function _(l){let i=[],n=0,u=0,e=0,t=0;for(let a of l)a.count>0&&(e++,a.minutesAboveHigh&&(n+=a.minutesAboveHigh),a.stdDev&&a.stdDev>u&&(u=a.stdDev),a.deltaMkt&&a.deltaMkt>2&&t++);return e===0?[]:(n>120&&i.push({type:"critical",message:`Kritische Gesamtbelastung: Das Produkt war im gesamten Zeitraum insgesamt ${Math.round(n)} Minuten zu warm.`,metric:"Total Excursion Time"}),t>e*.15&&i.push({type:"warning",message:"Frequent thermal shocks detected. The kinetic temperature deviates strongly from the average (possible regular door openings).",metric:"Delta MKT Instability"}),u>4&&i.push({type:"warning",message:`High instability measured. Maximum standard deviation was ${u}\xB0C. The cooling system controls imprecisely.`,metric:"Standard Deviation Peak"}),i)}function C(l,i){if(l.length<=i)return l;let n=[],u=Math.ceil(l.length/i);n.push(l[0]);for(let e=1;e<l.length;e+=u)n.push(l[Math.min(e,l.length-1)]);return n}function P(l,i="hourly",n){let u={limitLow:n.low,limitHigh:n.high,activationEnergy:n.activationEnergy};return S(l,i,n.interval,u,n.minCountForMkt??1)}var q=class{static compute(l){let i=l.map(r=>r.value).filter(r=>r!==null).sort((r,o)=>r-o);if(i.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let n=i.length,u=i.reduce((r,o)=>r+o,0)/n,e=n%2===1?i[Math.floor(n/2)]:(i[n/2-1]+i[n/2])/2,t=i.reduce((r,o)=>r+Math.pow(o-u,2),0)/n,a=Math.sqrt(t);return {min:i[0],max:i[n-1],avg:u,mean:u,median:e,stdDev:a,count:n}}static computeInRange(l,i,n){let u=l.filter(e=>e.time>=i&&e.time<=n);return this.compute(u)}};function G(l,i){let n=typeof l=="number"?l:l.mean,u=typeof l=="number"?i??NaN:l.stdDev;return !Number.isFinite(n)||!Number.isFinite(u)||n===0?null:Math.abs(u/n)*100}var R=83144;function k(l,i=83144){let n=i/8.314,u=0,e=0;for(let a of l)a!==null&&(u+=Math.exp(-n/(a+273.15)),e++);if(e===0)return null;let t=u/e;return n/-Math.log(t)-273.15}function V(l,i,n=83144){let u=new Array(l.length),e=0;for(let t=0;t<l.length;t++){let a=l[t].time,r=a-i;for(;e<t&&l[e].time<r;)e++;let o=l.slice(e,t+1).map(s=>s.value),m=k(o,n);u[t]={time:a,value:m,synthetic:true};}return u}function A(l){let i=0,n=0;for(let t of l)t!==null&&(i+=t,n++);if(n===0)return null;let u=i/n,e=0;for(let t of l){if(t===null)continue;let a=t-u;e+=a*a;}return Math.sqrt(e/n)}function E(l){let i=0,n=0;for(let t of l)t!==null&&(i+=t,n++);if(n<2)return null;let u=i/n,e=0;for(let t of l){if(t===null)continue;let a=t-u;e+=a*a;}return Math.sqrt(e/(n-1))}function K(l,i,n=false){let u=new Array(l.length),e=0,t=n?E:A;for(let a=0;a<l.length;a++){let r=l[a].time,o=r-i;for(;e<a&&l[e].time<o;)e++;let m=l.slice(e,a+1).map(h=>h.value),s=t(m);u[a]={time:r,value:s,synthetic:true};}return u}function O(l,i){let n=new Array(l.length),u=0;for(let e=0;e<l.length;e++){let t=l[e].time,a=t-i;for(;u<e&&l[u].time<a;)u++;let r=0,o=0;for(let m=u;m<=e;m++){let s=l[m].value;s!==null&&(r+=s,o++);}n[e]={time:t,value:o===0?null:r/o,synthetic:true};}return n}function U(l,i){let n=new Array(l.length),u=null,e=0;for(let t=0;t<l.length;t++){let a=l[t].time,r=l[t].value;if(r===null){n[t]={time:a,value:u,synthetic:true};continue}if(u===null||i<=0)u=r;else {let o=1-Math.exp(-(a-e)/i);u=r*o+u*(1-o);}e=a,n[t]={time:a,value:u,synthetic:true};}return n}function Y(l,i){let{high:n,low:u}=i,e={msAboveHigh:0,msBelowLow:0,globalMax:null,globalMin:null,excursions:[]},t=null;for(let a=0;a<l.length;a++){let r=l[a];if(r.value===null){t&&(e.excursions.push(t),t=null);continue}(e.globalMax===null||r.value>e.globalMax)&&(e.globalMax=r.value),(e.globalMin===null||r.value<e.globalMin)&&(e.globalMin=r.value);let o=n!==void 0&&r.value>n,m=u!==void 0&&r.value<u,s=o?"above":m?"below":null,h=l[a-1];if(h&&h.value!==null&&s!==null){let g=r.time-h.time;s==="above"?e.msAboveHigh+=g:e.msBelowLow+=g;}if(s===null){t&&(e.excursions.push(t),t=null);continue}t&&t.side===s?(t.endTime=r.time,t.durationMs=t.endTime-t.startTime,(s==="above"&&r.value>t.extremum||s==="below"&&r.value<t.extremum)&&(t.extremum=r.value)):(t&&e.excursions.push(t),t={startTime:r.time,endTime:r.time,side:s,extremum:r.value,durationMs:0});}return t&&e.excursions.push(t),e}function L(l){if(l.length===0)return [];let i=new Map;for(let u of l)for(let e of u.data){if(e.value===null)continue;let t=i.get(e.time);t||(t=[],i.set(e.time,t)),t.push({name:u.name,value:e.value});}let n=[];for(let u of [...i.keys()].sort((e,t)=>e-t)){let e=i.get(u);if(e.length===0){n.push({time:u,min:null,max:null,delta:null,minSensor:null,maxSensor:null});continue}let t=e[0],a=e[0];for(let r=1;r<e.length;r++)e[r].value<t.value&&(t=e[r]),e[r].value>a.value&&(a=e[r]);n.push({time:u,min:t.value,max:a.value,delta:e.length<2?null:a.value-t.value,minSensor:t.name,maxSensor:a.name});}return n}function $(l){let i=[];for(let e of l){let t=0,a=0,r=1/0,o=-1/0;for(let m of e.data)m.value!==null&&(t+=m.value,a++,m.value<r&&(r=m.value),m.value>o&&(o=m.value));a!==0&&i.push({name:e.name,mean:t/a,min:r,max:o,count:a});}if(i.length===0)return {sensors:[],hottest:null,coldest:null,meanDelta:null};let n=i[0],u=i[0];for(let e=1;e<i.length;e++)i[e].mean>n.mean&&(n=i[e]),i[e].mean<u.mean&&(u=i[e]);return {sensors:i,hottest:n,coldest:u,meanDelta:n.mean-u.mean}}function W(l,i){let{maxDelta:n,minDurationMs:u=0}=i,e=[],t=null,a=()=>{t&&t.durationMs>=u&&e.push(t),t=null;};for(let r of L(l)){if(r.delta===null||r.delta<=n){a();continue}t?(t.endTime=r.time,t.durationMs=t.endTime-t.startTime,r.delta>t.peakDelta&&(t.peakDelta=r.delta,t.peakTime=r.time,t.maxSensor=r.maxSensor,t.minSensor=r.minSensor)):t={startTime:r.time,endTime:r.time,durationMs:0,peakDelta:r.delta,peakTime:r.time,maxSensor:r.maxSensor,minSensor:r.minSensor};}return a(),e}function Z(l,i){let n=i>0?i:0,u=new Set,e=l.map(a=>{let r=[...a.data].sort((o,m)=>o.time-m.time);for(let o of r)u.add(o.time);return r}),t=[...u].sort((a,r)=>a-r);return l.map((a,r)=>{let o=e[r],m=-1,s=t.map(h=>{for(;m+1<o.length&&o[m+1].time<=h;)m++;let g=m>=0?o[m]:void 0,d=g&&g.value!==null&&h-g.time<=n?g.value:null;return {time:h,value:d}});return {name:a.name,data:s}})}function y(l){let i=0,n=0,u=0,e=0,t=0;for(let m of l)m.value!==null&&(i++,n+=m.time,u+=m.value,e+=m.time*m.value,t+=m.time*m.time);if(i<2)return null;let a=i*t-n*n;if(a===0)return null;let r=(i*e-n*u)/a,o=(u-r*n)/i;return {slope:r,intercept:o,n:i}}function F(l,i){if(l.length===0)return null;let n=l[l.length-1].time,u=n-i,e=l.filter(t=>t.time>=u&&t.time<=n);return y(e)}function j(l,i){let n=[],u=0;for(let e=0;e<l.length;e++){let t=l[e].time,a=t-i;for(;u<l.length&&l[u].time<a;)u++;let r=y(l.slice(u,e+1));n.push({time:t,fit:r});}return n}function J(l,i,n={}){let u=n.lookbackMs??9e5,e=n.side??"either";if(l.length===0)return null;let t=l[l.length-1];if(t.value===null)return null;let a=F(l,u);if(!a||a.slope===0)return null;let r=a.slope>0&&t.value<i,o=a.slope<0&&t.value>i;if(e==="above"&&!r||e==="below"&&!o||e==="either"&&!r&&!o)return null;let m=(i-a.intercept)/a.slope,s=m-t.time;return s<=0?null:{msUntil:s,eta:m,fit:a,currentValue:t.value}}function Q(l,i={}){let n=i.refTempCelsius??121.11,u=i.zValueKelvin??10,e=0;for(let t=0;t<l.length-1;t++){let a=l[t],r=l[t+1];if(a.value===null||r.value===null)continue;let o=(r.time-a.time)/6e4;if(o<=0)continue;let m=Math.pow(10,(a.value-n)/u),s=Math.pow(10,(r.value-n)/u);e+=(m+s)/2*o;}return e}/*!
|
|
1
|
+
var _=class{static interpolateDataPoint(n,i,l){return {time:n.time+Math.round(l*(i.time-n.time)),value:(n.value??0)+l*((i.value??0)-(n.value??0)),synthetic:true}}static interpolateAggregatedPoint(n,i,l){let u=(e,t)=>e!==null&&t!==null?e+l*(t-e):null;return {time:n.time+l*(i.time-n.time),min:u(n.min,i.min),max:u(n.max,i.max),avg:u(n.avg,i.avg),count:Math.round(n.count+l*(i.count-n.count))}}static getRuns(n,i,l=0){let u=[...n].sort((a,o)=>a.time-o.time),e=[],t=[],r=null;for(let a of u){let o=i(a),m=l>0&&r&&a.time-r.time>l;(o||m)&&t.length&&(e.push(t),t=[]),o||t.push(a),r=a;}return t.length&&e.push(t),e}static splitByBoundaries(n,i,l,u){if(n.length===0)return [];if(i.length===0)return [{data:n,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let e=[...i].sort((m,s)=>m-s),t=[],r=m=>m<=0?Number.NEGATIVE_INFINITY:e[m-1],a=m=>{let s=0;for(let h=0;h<e.length&&m>=e[h];h++)s=h+1;return s},o=[n[0]];for(let m=1;m<n.length;m++){let s=n[m-1],h=n[m],g=l(s),d=l(h),p;d>g?p=e.filter(v=>v>g&&v<=d):d<g?p=e.filter(v=>v>=d&&v<g).reverse():p=[];let x=g;for(let v of p){let b=(v-g)/(d-g),f=u(s,h,b);o.push(f);let c=a((x+v)/2);t.push({data:o,zoneIndex:c,zoneLow:r(c)}),o=[f],x=v;}(p.length===0||p[p.length-1]!==d)&&o.push(h);}if(o.length>1||n.length===1){let m=l(o[0]),s=l(o[o.length-1]),h=a((m+s)/2);t.push({data:o,zoneIndex:h,zoneLow:r(h)});}return t}static splitByThreshold(n,i,l,u){let e=this.splitByBoundaries(n,[i],l,u),t={above:[],below:[]};for(let r of e)r.zoneIndex===0?t.below.push(r.data):t.above.push(r.data);return t}},C={pharma_cold:{limitLow:2,limitHigh:8,activationEnergy:83144},pharma_ambient:{limitLow:15,limitHigh:25,activationEnergy:83144},blood:{limitLow:2,limitHigh:6,activationEnergy:83144},food_chilled:{limitLow:0,limitHigh:4},frozen:{limitLow:-40,limitHigh:-18}},A=8.314462618,N=273.15;function T(n,i,l,u=1){let e=i.filter(f=>f.value!==null&&f.value!==void 0&&!Number.isNaN(f.value)).map(f=>f.value);if(!e.length)return {time:n,min:null,max:null,avg:null,mkt:null,deltaMkt:null,stdDev:null,minutesAboveHigh:l?0:null,minutesBelowLow:l?0:null,count:0};let t=1/0,r=-1/0,a=0;for(let f of e)f<t&&(t=f),f>r&&(r=f),a+=f;let o=a/e.length,m=l?0:null,s=l?0:null;if(l)for(let f=0;f<i.length;f++){let c=i[f];if(c.value!==null&&c.value!==void 0){let M=i[f+1],w=(M?M.time-c.time:0)/(1e3*60);c.value>l.limitHigh&&(m+=w),c.value<l.limitLow&&(s+=w);}}let h=0,g=0,d=(l?.activationEnergy??83144)/A;for(let f of e){h+=Math.pow(f-o,2);let c=f+N;g+=Math.exp(-d/c);}let p=h/e.length,x=Math.sqrt(p),v=null,b=null;if(e.length>=u){let f=g/e.length,c=d/-Math.log(f);v=Number((c-N).toFixed(2)),b=Number((v-o).toFixed(2));}return {time:n,min:Number(t.toFixed(2)),max:Number(r.toFixed(2)),avg:Number(o.toFixed(2)),mkt:v,deltaMkt:b,stdDev:Number(x.toFixed(2)),minutesAboveHigh:m!==null?Number(m.toFixed(1)):null,minutesBelowLow:s!==null?Number(s.toFixed(1)):null,count:e.length}}function E(n,i="hourly",l,u,e=1){if(!n.length)return [];let t=i==="hourly"?36e5:i==="daily"?864e5:l??3600*1e3,r=[...n].sort((s,h)=>s.time-h.time),a=[],o=r[0].time,m=[];for(let s of r){for(;s.time-o>=t;)a.push(T(o,m,u,e)),o+=t,m=[];m.push(s);}return a.push(T(o,m,u,e)),a}function P(n,i){let l=1/0,u=-1/0,e=0;for(let r of i)r<l&&(l=r),r>u&&(u=r),e+=r;let t=e/i.length;return {time:n,min:l,max:u,avg:t,count:i.length}}function q(n,i=6e4){if(n.length<2)return [];let l=[...n].sort((e,t)=>e.time-t.time),u=[];for(let e=1;e<l.length;e++)l[e].time-l[e-1].time>i&&u.push({startTime:l[e-1].time,endTime:l[e].time});return u}function G(n){let i=[],l=0,u=0,e=0,t=0;for(let r of n)r.count>0&&(e++,r.minutesAboveHigh&&(l+=r.minutesAboveHigh),r.stdDev&&r.stdDev>u&&(u=r.stdDev),r.deltaMkt&&r.deltaMkt>2&&t++);return e===0?[]:(l>120&&i.push({type:"critical",message:`Kritische Gesamtbelastung: Das Produkt war im gesamten Zeitraum insgesamt ${Math.round(l)} Minuten zu warm.`,metric:"Total Excursion Time"}),t>e*.15&&i.push({type:"warning",message:"Frequent thermal shocks detected. The kinetic temperature deviates strongly from the average (possible regular door openings).",metric:"Delta MKT Instability"}),u>4&&i.push({type:"warning",message:`High instability measured. Maximum standard deviation was ${u}\xB0C. The cooling system controls imprecisely.`,metric:"Standard Deviation Peak"}),i)}function R(n,i){if(n.length<=i)return n;let l=[],u=Math.ceil(n.length/i);l.push(n[0]);for(let e=1;e<n.length;e+=u)l.push(n[Math.min(e,n.length-1)]);return l}function V(n,i="hourly",l){let u={limitLow:l.low,limitHigh:l.high,activationEnergy:l.activationEnergy};return E(n,i,l.interval,u,l.minCountForMkt??1)}var K=class{static compute(n){let i=n.map(a=>a.value).filter(a=>a!==null).sort((a,o)=>a-o);if(i.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let l=i.length,u=i.reduce((a,o)=>a+o,0)/l,e=l%2===1?i[Math.floor(l/2)]:(i[l/2-1]+i[l/2])/2,t=i.reduce((a,o)=>a+Math.pow(o-u,2),0)/l,r=Math.sqrt(t);return {min:i[0],max:i[l-1],avg:u,mean:u,median:e,stdDev:r,count:l}}static computeInRange(n,i,l){let u=n.filter(e=>e.time>=i&&e.time<=l);return this.compute(u)}};function O(n,i){let l=typeof n=="number"?n:n.mean,u=typeof n=="number"?i??NaN:n.stdDev;return !Number.isFinite(l)||!Number.isFinite(u)||l===0?null:Math.abs(u/l)*100}function D(n,i,l){let u=new Array(n.length),e=0;for(let t=0;t<n.length;t++){let r=n[t].time,a=r-i;for(;e<t&&n[e].time<a;)e++;let o=n.slice(e,t+1).map(m=>m.value);u[t]={time:r,value:l(o),synthetic:true};}return u}var L=8.314,y=273.15,S=83144;function F(n,i=S){let l=i/L,u=0,e=0;for(let r of n)r!==null&&(u+=Math.exp(-l/(r+y)),e++);if(e===0)return null;let t=u/e;return l/-Math.log(t)-y}function U(n,i,l=S){return D(n,i,u=>F(u,l))}function I(n){let i=0,l=0;for(let t of n)t!==null&&(i+=t,l++);if(l===0)return null;let u=i/l,e=0;for(let t of n){if(t===null)continue;let r=t-u;e+=r*r;}return Math.sqrt(e/l)}function H(n){let i=0,l=0;for(let t of n)t!==null&&(i+=t,l++);if(l<2)return null;let u=i/l,e=0;for(let t of n){if(t===null)continue;let r=t-u;e+=r*r;}return Math.sqrt(e/(l-1))}function Y(n,i,l=false){return D(n,i,l?H:I)}function $(n,i){let l=new Array(n.length),u=0;for(let e=0;e<n.length;e++){let t=n[e].time,r=t-i;for(;u<e&&n[u].time<r;)u++;let a=0,o=0;for(let m=u;m<=e;m++){let s=n[m].value;s!==null&&(a+=s,o++);}l[e]={time:t,value:o===0?null:a/o,synthetic:true};}return l}function W(n,i){let l=new Array(n.length),u=null,e=0;for(let t=0;t<n.length;t++){let r=n[t].time,a=n[t].value;if(a===null){l[t]={time:r,value:u,synthetic:true};continue}if(u===null||i<=0)u=a;else {let o=1-Math.exp(-(r-e)/i);u=a*o+u*(1-o);}e=r,l[t]={time:r,value:u,synthetic:true};}return l}function Z(n,i){let{high:l,low:u}=i,e={msAboveHigh:0,msBelowLow:0,globalMax:null,globalMin:null,excursions:[]},t=null;for(let r=0;r<n.length;r++){let a=n[r];if(a.value===null){t&&(e.excursions.push(t),t=null);continue}(e.globalMax===null||a.value>e.globalMax)&&(e.globalMax=a.value),(e.globalMin===null||a.value<e.globalMin)&&(e.globalMin=a.value);let o=l!==void 0&&a.value>l,m=u!==void 0&&a.value<u,s=o?"above":m?"below":null,h=n[r-1];if(h&&h.value!==null&&s!==null){let g=a.time-h.time;s==="above"?e.msAboveHigh+=g:e.msBelowLow+=g;}if(s===null){t&&(e.excursions.push(t),t=null);continue}t&&t.side===s?(t.endTime=a.time,t.durationMs=t.endTime-t.startTime,(s==="above"&&a.value>t.extremum||s==="below"&&a.value<t.extremum)&&(t.extremum=a.value)):(t&&e.excursions.push(t),t={startTime:a.time,endTime:a.time,side:s,extremum:a.value,durationMs:0});}return t&&e.excursions.push(t),e}function z(n){if(n.length===0)return [];let i=new Map;for(let u of n)for(let e of u.data){if(e.value===null)continue;let t=i.get(e.time);t||(t=[],i.set(e.time,t)),t.push({name:u.name,value:e.value});}let l=[];for(let u of [...i.keys()].sort((e,t)=>e-t)){let e=i.get(u);if(e.length===0){l.push({time:u,min:null,max:null,delta:null,minSensor:null,maxSensor:null});continue}let t=e[0],r=e[0];for(let a=1;a<e.length;a++)e[a].value<t.value&&(t=e[a]),e[a].value>r.value&&(r=e[a]);l.push({time:u,min:t.value,max:r.value,delta:e.length<2?null:r.value-t.value,minSensor:t.name,maxSensor:r.name});}return l}function j(n){let i=[];for(let e of n){let t=0,r=0,a=1/0,o=-1/0;for(let m of e.data)m.value!==null&&(t+=m.value,r++,m.value<a&&(a=m.value),m.value>o&&(o=m.value));r!==0&&i.push({name:e.name,mean:t/r,min:a,max:o,count:r});}if(i.length===0)return {sensors:[],hottest:null,coldest:null,meanDelta:null};let l=i[0],u=i[0];for(let e=1;e<i.length;e++)i[e].mean>l.mean&&(l=i[e]),i[e].mean<u.mean&&(u=i[e]);return {sensors:i,hottest:l,coldest:u,meanDelta:l.mean-u.mean}}function J(n,i){let{maxDelta:l,minDurationMs:u=0}=i,e=[],t=null,r=()=>{t&&t.durationMs>=u&&e.push(t),t=null;};for(let a of z(n)){if(a.delta===null||a.delta<=l){r();continue}t?(t.endTime=a.time,t.durationMs=t.endTime-t.startTime,a.delta>t.peakDelta&&(t.peakDelta=a.delta,t.peakTime=a.time,t.maxSensor=a.maxSensor,t.minSensor=a.minSensor)):t={startTime:a.time,endTime:a.time,durationMs:0,peakDelta:a.delta,peakTime:a.time,maxSensor:a.maxSensor,minSensor:a.minSensor};}return r(),e}function Q(n,i){let l=i>0?i:0,u=new Set,e=n.map(r=>{let a=[...r.data].sort((o,m)=>o.time-m.time);for(let o of a)u.add(o.time);return a}),t=[...u].sort((r,a)=>r-a);return n.map((r,a)=>{let o=e[a],m=-1,s=t.map(h=>{for(;m+1<o.length&&o[m+1].time<=h;)m++;let g=m>=0?o[m]:void 0,d=g&&g.value!==null&&h-g.time<=l?g.value:null;return {time:h,value:d}});return {name:r.name,data:s}})}function k(n){let i=0,l=0,u=0,e=0,t=0;for(let m of n)m.value!==null&&(i++,l+=m.time,u+=m.value,e+=m.time*m.value,t+=m.time*m.time);if(i<2)return null;let r=i*t-l*l;if(r===0)return null;let a=(i*e-l*u)/r,o=(u-a*l)/i;return {slope:a,intercept:o,n:i}}function B(n,i){if(n.length===0)return null;let l=n[n.length-1].time,u=l-i,e=n.filter(t=>t.time>=u&&t.time<=l);return k(e)}function X(n,i){let l=[],u=0;for(let e=0;e<n.length;e++){let t=n[e].time,r=t-i;for(;u<n.length&&n[u].time<r;)u++;let a=k(n.slice(u,e+1));l.push({time:t,fit:a});}return l}function ee(n,i,l={}){let u=l.lookbackMs??9e5,e=l.side??"either";if(n.length===0)return null;let t=n[n.length-1];if(t.value===null)return null;let r=B(n,u);if(!r||r.slope===0)return null;let a=r.slope>0&&t.value<i,o=r.slope<0&&t.value>i;if(e==="above"&&!a||e==="below"&&!o||e==="either"&&!a&&!o)return null;let m=(i-r.intercept)/r.slope,s=m-t.time;return s<=0?null:{msUntil:s,eta:m,fit:r,currentValue:t.value}}function te(n,i={}){let l=i.refTempCelsius??121.11,u=i.zValueKelvin??10,e=0;for(let t=0;t<n.length-1;t++){let r=n[t],a=n[t+1];if(r.value===null||a.value===null)continue;let o=(a.time-r.time)/6e4;if(o<=0)continue;let m=Math.pow(10,(r.value-l)/u),s=Math.pow(10,(a.value-l)/u);e+=(m+s)/2*o;}return e}/*!
|
|
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.
|
|
@@ -12,4 +12,4 @@ var I=class{static interpolateDataPoint(l,i,n){return {time:l.time+Math.round(n*
|
|
|
12
12
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
13
13
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
14
14
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
15
|
-
*/export{
|
|
15
|
+
*/export{S as DEFAULT_ACTIVATION_ENERGY,C as PRODUCT_PROFILES,_ as SeriesProcessor,K as StatsAggregator,E as aggregateBySlot,V as aggregateWithStats,G as analyzeLongTermTrends,Z as computeLimitExcursions,P as createAggr,B as currentTrend,q as detectGaps,J as divergenceExcursions,R as downsample,te as f0Sterilization,Q as holdAlign,j as hotColdSpots,k as linearFit,F as mkt,ee as predictTimeToThreshold,W as rollingEma,$ as rollingMean,U as rollingMkt,Y as rollingStdDev,X as rollingTrend,H as sampleStdDev,z as spatialDelta,I as stdDev,O as varianceCoefficient};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { M as MLTimeGraphOptions, L as LegendItem,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { M as MLTimeGraphOptions, L as LegendItem, b as Margin, Y as YAxisConfig, A as AxesConfig, X as XAxisConfig, c as LegendOptions, d as LegendPosition, e as LegendOrientation, f as Marker, g as RenderOutput } from './marker_renderer-BKOhqPkn.js';
|
|
2
|
+
import { Renderer, LayoutResult } from './internals.js';
|
|
3
|
+
export { h as AxisLabelsStyle, i as AxisStyle, G as GridLineStyle, j as GridStyle, T as TextMetrics, k as Theme, l as TickConfig, m as drawMarker, n as estimateMetrics, o as getDefaultTheme, p as liberationMetrics, r as resetDefaultTheme, s as setDefaultTheme, q as slugify } from './marker_renderer-BKOhqPkn.js';
|
|
4
|
+
import { e as AnySeries, i as Annotation, a as DrawCommand, g as Gap, h as GapsConfig, f as Threshold, H as Highlight, j as AnnotationBandConfig, l as SeriesStyle, c as LineVariant, S as SmoothingType, F as FillSpec, m as TimeSeries, b as LineDashStyle, n as ThresholdFill, k as HatchVariant, o as ThresholdLabelPosition, P as PointStyleType, M as MarkerLineStyle, R as RangeLabelPosition, p as AnnotationPointShape, q as LabelAnchor, r as AnnotationBandItem, s as TextBaseline, t as AggregatedPoint, u as AggregatedSeries, D as DataPoint } from './types-pKdGBqvc.js';
|
|
5
|
+
import { TimeScale, LinearScale } from './internals.js';
|
|
6
|
+
export { v as AggregatedShowAs, w as AggregationConfig, x as AggregationMode, y as AnnotationKind, z as AxisOrientation, A as AxisPosition, B as DataPointRef, E as EnumMap, C as FillBound, I as FillRegion, J as FillSide, K as FillStyle, N as FillWhere, O as GapBand, Q as GapConfig, U as GapLabel, V as GapRegion, W as GapStyle, X as GapsAtEnd, G as GridLayer, Y as LineShape, Z as LineStyle, _ as MarkerStyle, $ as MovingAverageType, a0 as SVGLineStyle, a1 as SensorType, a2 as SeriesGapStyle, a3 as SeriesGaps, a4 as SeriesOverlay, a5 as SeriesOverlayKind, a6 as SeriesType, a7 as ShadowStyle, a8 as SolidDashStyle, a9 as ThresholdLabelConfig, aa as getLineStyle, ab as resolveDash } from './types-pKdGBqvc.js';
|
|
5
7
|
|
|
6
8
|
/*!
|
|
7
9
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -1150,6 +1152,7 @@ declare function mergeOptions(...layers: (OptionsLayer | undefined)[]): MLTimeGr
|
|
|
1150
1152
|
* Monate spaeter eine Datei aus einem Stapel von Berichten in der Hand haelt,
|
|
1151
1153
|
* kann sonst nicht feststellen, welcher Stand sie gezeichnet hat.
|
|
1152
1154
|
*/
|
|
1153
|
-
declare const VERSION = "1.
|
|
1155
|
+
declare const VERSION = "1.19.0";
|
|
1154
1156
|
|
|
1155
|
-
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries,
|
|
1157
|
+
export { AggregatedPoint, AggregatedSeries, Annotation, AnnotationBandBuilder, AnnotationBandConfig, AnnotationBandItem, AnnotationBandItemBuilder, AnnotationBuilder, AnnotationPointShape, AnySeries, AxesConfig, DataPoint, DrawCommand, FillSpec, Gap, GapsConfig, GraphBuilder, HatchVariant, Highlight, HighlightBuilder, LabelAnchor, LegendItem, LegendOptions, LegendOrientation, LegendPosition, LineDashStyle, LineVariant, MLTimeGraph, MLTimeGraphOptions, Margin, Marker, MarkerBuilder, MarkerLineStyle, PointStyleType, RangeLabelPosition, RenderOutput, SVGRenderer, SeriesStyle, SmoothingType, TextBaseline, Threshold, ThresholdBuilder, ThresholdFill, ThresholdLabelPosition, TimeSeries, TimeSeriesBuilder, VERSION, XAxisConfig, YAxisConfig, attachTooltip, autoMargin, axisGroups, fillBetweenThresholds, mergeOptions, mount, parseAggregated, parseDataPoint, parseSeries, toDataPoints, toSeries, zeigerImSvg };
|
|
1158
|
+
export type { AutoMarginOptions, AxisGroupInput, AxisGroups, FieldAccessor, FillBetweenThresholdsInput, LimitStatsPoint, MktPoint, OptionsLayer, PointAt, PointsAtOptions, StatsAggregatedPoint, StdDevPoint, TimeInput, ToDataPointsSpec, TooltipOptions, TooltipSample };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function X(n){return n===true?{major:{}}:n===false?{major:false}:n}function He(n){return "avg"in n}function mt(n){return He(n)?n.min===null||n.max===null||n.avg===null:n.value===null}function ut(n){return !He(n)&&!!n.synthetic}function ht(n,e,t,r,i,o){if(He(n)){let a=r.map(n.min),m=r.map(n.max),l=Math.min(a,m),u=Math.max(a,m),h=i<l?l-i:i>u?i-u:0;return {time:n.time,min:n.min,max:n.max,avg:n.avg,count:n.count,...o?{held:o}:{},x:e,y:r.map(n.avg),distance:Math.hypot(t,h),dx:t}}let s=r.map(n.value);return {time:n.time,value:n.value,...o?{held:o}:{},x:e,y:s,distance:Math.hypot(t,s-i),dx:t}}function
|
|
1
|
+
function X(n){return n===true?{major:{}}:n===false?{major:false}:n}function He(n){return "avg"in n}function mt(n){return He(n)?n.min===null||n.max===null||n.avg===null:n.value===null}function ut(n){return !He(n)&&!!n.synthetic}function ht(n,e,t,r,i,o){if(He(n)){let a=r.map(n.min),m=r.map(n.max),l=Math.min(a,m),u=Math.max(a,m),h=i<l?l-i:i>u?i-u:0;return {time:n.time,min:n.min,max:n.max,avg:n.avg,count:n.count,...o?{held:o}:{},x:e,y:r.map(n.avg),distance:Math.hypot(t,h),dx:t}}let s=r.map(n.value);return {time:n.time,value:n.value,...o?{held:o}:{},x:e,y:s,distance:Math.hypot(t,s-i),dx:t}}function In(n,e){return n.dx<e.dx-1e-6?true:n.dx>e.dx+1e-6?false:n.distance<e.distance-1e-6}function Wn(n,e,t,r,i,o,s){let a=null;for(let m of n){if(mt(m)||ut(m))continue;let l=e.map(m.time);if(l<r.x||l>r.x+r.width)continue;let u=Math.abs(l-i);if(u>s)continue;let h=ht(m,l,u,t,o,false);(!a||In(h,a))&&(a=h);}return a}function zn(n,e,t){let r=-1;for(let i=0;i<n.length&&e.map(n[i].time)<=t+1e-6;i++)r=i;for(;r>=0;r--){if(mt(n[r]))return -1;if(!ut(n[r]))return r}return -1}function Hn(n,e,t,r,i,o){let s=zn(n,t,r);if(s<0)return null;let a=n[s],m=n[s+1];if(e.gapThreshold>0&&m&&m.time-a.time>e.gapThreshold)return null;let l=t.invert(r);if(o!==void 0&&l-a.time>o)return null;let u=t.map(a.time),h=u<r-1e-6;return ht(a,h?r:u,h?0:Math.abs(u-r),e.skala,i,h)}function Vn(n){return n.punkte.map(e=>n.kind==="stdDevBand"?{time:e.time,min:e.low,max:e.high,avg:e.value,count:0}:{time:e.time,value:e.value})}function Nn(n,e,t){let r={overlayOf:t,overlayIndex:e.index,overlayKind:e.kind};if(e.kind!=="stdDevBand")return {...n,...r};let{min:i,max:o,avg:s,count:a,...m}=n;return {...m,value:s,low:i,high:o,...r}}function ct(n,e,t,r,i,o,s){if(i<r.x||i>r.x+r.width||o<r.y||o>r.y+r.height)return [];let a=new Set(s.hidden??[]),m=[];return n.forEach((l,u)=>{let h=l.id??l.name;if(a.has(h))return;let c=t(l,u);if(!c)return;let d=s.modes?.[h]??s.mode??(c.stufe?"hold":"nearest"),p=(y,b)=>d==="hold"?Hn(y,b,e,i,o,s.maxAgeMs):Wn(y,e,b.skala,r,i,o,s.radius),g=(y,b,S)=>{let{dx:v,...w}=y,_=w.value??w.avg;return {seriesId:h,name:l.name,axisIndex:c.achse,...w,color:b,...S?{line:S}:{},...c.format&&_!==void 0?{label:c.format(_)}:{}}},f=p(l.data,c);if(f&&m.push(g(f,c.farbe,c.linie)),!!s.overlays)for(let y of c.overlays??[]){let b=p(Vn(y),{...c,gapThreshold:0});b&&m.push(Nn(g(b,y.farbe,y.linie),y,h));}}),m}var oe=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 Ve(n,e){if(e)for(let t of n)t.type==="text"?t.fontFamily||(t.fontFamily=e):t.type==="group"&&Array.isArray(t.commands)&&Ve(t.commands,e);}function Ne(n,e){if(e)for(let t of n)"id"in t&&t.id&&(t.id=`${e}-${t.id}`),t.type==="group"&&Array.isArray(t.commands)&&Ne(t.commands,e);}function Ke(n,e){let t={...e,...n.style},r=t.fill,i,o;return typeof r=="string"?i=r:r&&(i=r.color,o=r.hatch),{startTime:n.startTime,endTime:n.endTime,label:n.label,fill:i,hatch:o,fillOpacity:t.opacity,labelBaseline:t.label?.baseline,rotate:t.label?.rotate,style:t.display==="bridge_line"?void 0:t.display}}function dt(n){if(!n)return {gaps:[],autoDetect:false,minGapMs:6e4};if(Array.isArray(n))return {gaps:n,autoDetect:false,minGapMs:6e4};let e=n.style;return {gaps:(n.regions??[]).map(r=>Ke(r,e)),autoDetect:n.autoDetect??false,minGapMs:n.minGapMs??6e4,band:e?.band,atEnd:n.atEnd}}function K(n){return n&&n.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}var pt=new Map;function Kn(n,e){return `${n}|${JSON.stringify(e??{})}`}function ft(n,e){let t=Kn(n,e),r=pt.get(t);return r||(r=new Intl.DateTimeFormat(n,e),pt.set(t,r)),r}function gt(){return typeof navigator<"u"?navigator.language:void 0}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]}},I=[{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 Z({domain:e.domain,range:e.range}),this.#t=e.locale||(gt()??"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:I[0].ms};let a=s/e,m=I[0].ms;for(let h of I)if(h.ms>=a){m=h.ms;break}let l=m,u=Math.round(s/l);for(;u>r&&l<I[I.length-1].ms;){let h=I.findIndex(c=>c.ms===l);l=I[Math.min(h+1,I.length-1)].ms,u=Math.round(s/l);}for(;u<t&&l>I[0].ms;){let h=I.findIndex(c=>c.ms===l);l=I[Math.max(h-1,0)].ms,u=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 ft(this.#t,r).format(new Date(e))}};var Ye={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 ee={...Ye};function Yn(n){ee={...ee,...n};}var pe=null;function se(){return pe??ee}function ae(n,e){if(!n)return e();let t=pe;pe={...ee,...n};try{return e()}finally{pe=t;}}function Xn(){return ee}function Zn(){ee={...Ye};}function Un(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 qn(n){let e=n.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function fe(n,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",r,i=2){let o=Un(t),s=qn(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 X(n){return n===true?{major:{}}:n===false?{major:false}:n}function He(n
|
|
|
21
21
|
${h}
|
|
22
22
|
${u}
|
|
23
23
|
</pattern>
|
|
24
|
-
`.trim()}function Xe(n,e=2,t=false){return n==="dashed"||!n&&t?{strokeDasharray:"4,4"}:n==="dotted"?{strokeDasharray:"2,4"}:!n||n==="solid"?null:yt(n,e)}function yt(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 x=new Proxy({},{get:(n,e)=>se()[e],has:(n,e)=>e in se(),ownKeys:()=>Reflect.ownKeys(se()),getOwnPropertyDescriptor:(n,e)=>Reflect.getOwnPropertyDescriptor(se(),e)});function ge(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 le={axisColor:x.axisColor,tickColor:x.tickColor,textColor:x.textColor,textSize:x.textSize},te=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??le).axisColor}get tickColor(){return (this.#t.colors??le).tickColor}get textColor(){return (this.#t.colors??le).textColor}get textSize(){return (this.#t.colors??le).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??le,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 ge(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 O(n){return "showAs"in n&&!!n.showAs}function bt(n){if(O(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 ye(n,e){return {axisColor:n?.color??x.axisColor,tickColor:n?.color??x.tickColor,textColor:e?.color??x.textColor,textSize:e?.fontSize??x.textSize,axisWidth:n?.width??1}}function xt(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 be(n,e){return n!==void 0?n:e!==void 0&&e!==false?1:0}var Zn=[[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,Un=(()=>{let n=new Map;for(let[e,,t]of Zn){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 Un.get(n)??Ze}var z=(n,e)=>{let t=0;for(let r of n)t+=St(r.codePointAt(0)??0);return t*e},qn=(n,e)=>[...n].length*e*Ze;function wt(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 Ue(n,e){let t=r=>e===void 0||e>=r;return Math.abs(n)>=1e6&&t(1e5)?`${(n/1e6).toFixed(1)}M`:Math.abs(n)>=1e3&&t(100)?`${(n/1e3).toFixed(1)}k`:Number.isInteger(n)?String(n):n.toFixed(1)}function Jn(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 xe=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 g=this.#t.format??Ue;return e.map(f=>({value:f,position:this.#e.map(f),label:g(f)}))}let t=this.#t.format??Ue,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,u=Math.pow(10,Math.floor(Math.log10(l))),h=l/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:i,position:this.#e.map(i),label:t(i)}];this.#t.format||(t=g=>Ue(g,c));let d=[],p=Math.ceil(s/c)*c;for(let g=p;g<=a;g+=c)d.push({value:g,position:this.#e.map(g),label:t(g)});return d}generateMinorTicks(){return ge(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=h=>s.some(c=>Math.abs(c-h)<=a),l=[];if(i==="vertical"){let[h,c]=this.#e.range();l.push({type:"line",x1:r,y1:h,x2:r,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Jn(e);e.forEach((p,g)=>{let f=m(p.position),y=d[g]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:p.position,x2:r,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||l.push({type:"text",content:p.label,x:this.#n(r-8,p.label,"end"),y:p.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(l.push({type:"line",x1:r,y1:p.position,x2:r+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||l.push({type:"text",content:p.label,x:this.#n(r+8,p.label,"start"),y:p.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[h,c]=this.#e.range();l.push({type:"line",x1:h,y1:r,x2:c,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)l.push({type:"line",x1:d.position,y1:r,x2:d.position,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:d.label,x:d.position,y:r+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())l.push(u?{type:"line",x1:o==="right"?r:r-2,y1:h,x2:o==="right"?r+2:r,y2:h,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:h,y1:r,x2:h,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 kt(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 vt(n){let{axes:e,indices:t,seriesByIndex:r,layout:i,thresholds:o,metrics:s}=n,{chartX:a,chartY:m,chartWidth:l,chartHeight:u}=i,h=[],c=new Map,d,p=[],g=[],f=(e?.y?.length??0)>0,y=0,b=0;for(let S of t){let k=r.get(S),w=1/0,_=-1/0,j=false;for(let R of k)for(let de of bt(R))de<w&&(w=de),de>_&&(_=de),j=true;if(!j)continue;if(Se(e,S)?.includeThresholds)for(let R of o)(R.axisIndex??0)!==S||R.line==="none"||(w=Math.min(w,R.value),_=Math.max(_,R.value));w===_&&(w-=1,_+=1);let A=Se(e,S),T=A?.domain,C=T&&T!=="auto"?T:xt(w,_,u,A?.padding),{werte:$,name:F}=kt(k);if($){let R=$.length>1?($[$.length-1]-$[0])/($.length-1):1;C[0]=$[0]-R/2,C[1]=$[$.length-1]+R/2;}let G=new Z({domain:C,range:[m+u,m]});c.set(S,G);let B=A?.position??(S===0?"left":"right"),H=B==="right"?"outside-right":"outside-left",M=o.filter(R=>(R.axisIndex??0)===S&&typeof R.label=="object"&&R.label!==null&&R.label.position===H&&R.value>=Math.min(C[0],C[1])&&R.value<=Math.max(C[0],C[1])).map(R=>G.map(R.value)),L;if(B==="right"){let R=A?.offset??b*50;L=a+l+R,b++;}else {let R=A?.offset??y*50;L=a-R,y++;}let D=new xe({domain:C,range:[m+u,m],x:L,position:B,format:A?.format??($?F:void 0),tickValues:$,ticks:A?.ticks?.major,minorTicks:be(A?.ticks?.minor,X(A?.grid)?.minor),colors:ye(A?.axis,A?.labels),suppressLabelsNear:M.length?M:void 0,gesamtbreite:i.totalWidth,metrics:s}),P=8+wt(D.generateTicks().map(R=>R.label),11,s),J=B==="right"?L+P:L-P;g.push({position:B,von:Math.min(L,J),bis:Math.max(L,J)}),f&&A?.label&&p.push({text:A.label,achseX:L,kante:J,position:B,style:A.labels,fest:A.labelOffset}),S===0&&(d=D),h.push({type:"group",cssClass:`value-axis ${B}`,sharedStyles:true,commands:D.render()});}return {commands:h,titel:p,baender:g,neueForm:f,primary:d,scales:c}}function Se(n,e){let t=e===0?n?.left:e===1?n?.right:void 0,r=n?.y&&n.y.length>e?n.y[e]:void 0;return r&&t?{...t,...r}:r??t}function Qn(n){return n==="dotted"?{dash:"dotted"}:n==="dashed"?{dash:"dashed"}:{}}function er(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),u=[],h=[];for(let c of e){let d=c.color??x.thresholdColor,p=t.map(c.value);c.fill==="above"?u.push({type:"rect",x:i,y:m,w:o-i,h:Math.max(0,p-m),fill:d,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&u.push({type:"rect",x:i,y:p,w:o-i,h:Math.max(0,l-p),fill:d,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let g=c.line??x.thresholdLine;if(g!=="none"){let S=Qn(g),k={type:"line",x1:i,y1:p,x2:o,y2:p,stroke:d,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[f,y]=t.domain();if(c.value>=Math.min(f,y)&&c.value<=Math.max(f,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,w=S?.position??"right",_=nr(k,w,i,o,p,d,S);h.push({..._,y:tr(_.y,Math.min(s,a),Math.max(s,a),x.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function tr(n,e,t,r){return Math.max(e+r,Math.min(t-r/2,n))}function nr(n,e,t,r,i,o,s){let a=(t+r)/2,m={type:"text",content:n,fontSize:x.thresholdFontSize,fill:o},l=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...m,...l,x:t+4,y:i-4,anchor:"start"};case "above":return {...m,...l,x:a,y:i-6,anchor:"middle"};case "below":return {...m,...l,x:a,y:i+14,anchor:"middle"};case "center":return {...m,...l,x:a,y:i-4,anchor:"middle"};case "outside-left":return {...m,...l,x:t-6,y:i+3,anchor:"end",textBaseline:l.textBaseline??"middle"};case "outside-right":return {...m,...l,x: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,u=[];if(e.length===0)return u;let h=[],c=[];for(let d of e){let p=d.id??K(d.name),g=t.get(d.axisIndex??0)??r,f=er({thresholds:[d],valueScale:g,xRange:i});f.inside.length&&h.push({type:"group",cssClass:`threshold threshold--${p}`,id:`threshold-${p}`,commands:f.inside}),f.labels.length&&c.push({type:"group",cssClass:`threshold-label threshold-label--${p}`,commands:f.labels});}return h.length&&u.push({type:"group",cssClass:"thresholds",commands:h,clipRect:{x:s,y:a,w:m,h:l}}),c.length&&u.push({type:"group",cssClass:"threshold-labels",commands:c}),u}function _t(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 we(n){let{ranges:e,timeScale:t,yRange:r,height:i,metrics:o=z}=n,[s,a]=r,m=[],[l,u]=t.range(),h=Math.min(l,u),c=Math.max(l,u),d=p=>Math.max(h,Math.min(c,p));for(let p of e){let g=d(t.map(p.startTime)),f=d(t.map(p.endTime));if(p.fill!==void 0&&m.push({type:"rect",x:g,y:s,w:f-g,h:a-s,fill:p.fill,hatch:p.hatch,opacity:p.opacity}),p.edges)for(let y of [g,f])m.push({type:"line",x1:y,y1:s,x2:y,y2:a,stroke:p.edges.stroke,strokeWidth:p.edges.strokeWidth,dash:"dashed"});if(p.label){let y=p.labelPosition??"middle",b=p.rotate,S=true;if(b==="auto"){let k=y!=="above"&&y!=="below",w=o(p.label,p.fontSize??11);b=k&&w>Math.abs(f-g)-4?-90:void 0,S=b===void 0||w<=Math.abs(a-s)-4;}S&&m.push({type:"text",content:p.label,x:(g+f)/2,y:_t(y,s,a,i),anchor:"middle",fontSize:p.fontSize,fill:p.labelColor,rotate:b});}}return m}function qe(n){let{gaps:e,timeScale:t,yRange:r,height:i,fill:o=x.gapFill,hatch:s,fillOpacity:a=x.gapFillOpacity??.15,stroke:m=x.gapStroke,strokeWidth:l=x.gapStrokeWidth,dashed:u=true,fontSize:h=x.gapFontSize,fontFill:c=x.gapFontColor,labelBaseline:d="middle",labelRotate:p,metrics:g,band:f}=n,y=()=>{if(!f)return [];let b=f.height??6,[S,k]=r,w=Math.max(S,k);return e.map(_=>{let j=t.map(_.startTime),A=t.map(_.endTime);return {type:"rect",x:Math.min(j,A),y:w-b+(f.offset??0),w:Math.abs(A-j),h:b,fill:f.fill??m,opacity:f.opacity??.75}})};return we({timeScale:t,yRange:r,height:i,metrics:g,ranges:e.map(b=>{let S=b.style??"dashed_border",k=S==="filled"||S==="dashed_border",w=S==="dashed_border"&&u!==false;return {startTime:b.startTime,endTime:b.endTime,...k&&{fill:b.fill??o,hatch:b.hatch??s,opacity:b.fillOpacity??a},...w&&{edges:{stroke:m,strokeWidth:l}},label:b.label,labelPosition:b.labelBaseline??d,labelColor:c,fontSize:h,rotate:b.rotate??p}})}).concat(y())}function At(n){let{gap:e,runs:t,timeScale:r,valueScale:i,metrics:o,lineColor:s}=n,a=[],m=e.bridge,l=[];for(let u=1;u<t.length;u++){let h=t[u-1][t[u-1].length-1],c=t[u][0];if(e.display==="bridge_line"){if(h.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(h.time),y1:i.map(h.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??x.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:h.time,endTime:c.time});}if(l.length>0){let u=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",h=e.fill,c=typeof h=="string"?h:h?.color,d=i.range();a.push(...qe({gaps:l.map(p=>({...p,style:u})),timeScale:r,yRange:[Math.min(d[0],d[1]),Math.max(d[0],d[1])],fill:c,hatch:typeof h=="object"?h.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return a}var Ct={display:"dashed_border",fill:{color:"#94a3b8",hatch:"classic-diagonal"},opacity:.5,label:{rotate:"auto"}},Mt=6e4,rr=60*Mt,ir=24*rr;function or(n){let e=Math.floor(n/Mt);if(e<60)return `${e} min`;if(n<ir){let i=Math.floor(e/60),o=e%60;return o===0?`${i} h`:`${i} h ${o} min`}let t=Math.floor(e/1440),r=Math.floor(e%1440/60);return r===0?`${t} d`:`${t} d ${r} h`}function sr(n,e,t){let r=n.format(e,{hour:"2-digit",minute:"2-digit"}),i=o=>n.format(o,{year:"numeric",month:"2-digit",day:"2-digit"});return i(e)===i(t)?r:`${n.format(e,{day:"numeric",month:"short"})} ${r}`}function ar(n,e,t){let r=null;for(let i of n)i.value===null||i.time<e||i.time>t||(r===null||i.time>r)&&(r=i.time);return r}function Lt(n){let{atEnd:e,series:t,timeScale:r}=n,[i,o]=r.domain(),s=e.now??o,a=new Set;for(let l of t){if(!("data"in l)||l.data.length===0||!("value"in l.data[0]))continue;let u="gaps"in l?l.gaps?.atEnd:void 0;if(u===false||"holdToEnd"in l&&l.holdToEnd)continue;let h=u?.afterMs??e.afterMs,c=ar(l.data,i,s);c!==null&&s-c>h&&a.add(c);}let m={...Ct,...e.style,label:{...Ct.label,...e.style?.label}};return [...a].sort((l,u)=>l-u).map(l=>{let u=s-l,h=e.label,c=typeof h=="function"?h(l,u):h?.replaceAll("{since}",sr(r,l,s)).replaceAll("{duration}",or(u));return {startTime:l,endTime:s,label:c,style:m}})}var lr=1,ke=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 u of e){let h=t.map(u.startTime),c=t.map(u.endTime);if(c<s[0]||h>s[1])continue;let d=Math.max(s[0],Math.min(s[1],h)),p=Math.max(s[0],Math.min(s[1],c)),g=Math.max(p-d,lr);d+g>s[1]&&(d=Math.max(s[0],s[1]-g));let f=d+g/2;if(l.push({type:"rect",x:d,y:a,w:g,h:m,hatch:u.hatch??i,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let y=u.labelFontSize??10;l.push({type:"text",content:u.label,x:f,y:this.#t(u.labelBaseline,y),anchor:"middle",fontSize:y,fill:u.labelFill??"#333"});}}if(o){let u=new te({domain:t.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return l}#t(e,t){let{y: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 Dt(n){let{highlights:e,timeScale:t,yRange:r,height:i}=n;return we({metrics:n.metrics,timeScale:t,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??x.highlightColor,opacity:o.opacity??x.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??x.highlightLabelColor,fontSize:x.annotationFontSize,rotate:o.rotate}))})}var $t=n=>n==="chartTop"||n==="chartBottom"||typeof n=="object"&&("threshold"in n||"value"in n);function Pt(n,e){let t=new Set(e.map(o=>o.id??o.name)),r=o=>n.some(s=>(s.id??s.name)===o||s.name===o),i=[];return n.forEach((o,s)=>{let a="colorByThresholds"in o?o.colorByThresholds:void 0;for(let u of a??[])t.has(u)||i.push(`series ${s} colorByThresholds names unknown threshold "${u}"`);let m=o.style?.fill;(m&&typeof m=="object"&&"regions"in m?m.regions??[]:[]).forEach((u,h)=>{let c=`series ${s} fill region ${h}`;for(let f of [u.from,u.to,u.outer])f&&typeof f=="object"&&"threshold"in f&&!t.has(f.threshold)&&i.push(`${c} references unknown threshold "${f.threshold}"`),f&&typeof f=="object"&&"series"in f&&!r(f.series)&&i.push(`${c} references unknown series "${f.series}"`);let d=u.from??"chartBottom",p=u.to??"series",g=d==="series"&&$t(p)||p==="series"&&$t(d);u.side&&!g&&i.push(`${c} sets side, which only applies between the line and a fixed bound`),u.outer&&!u.side&&i.push(`${c} sets outer without side -- outer has no effect`);});}),i}function Rt(n){return [...cr(n.series.map(e=>e.id??e.name)),...mr(n.series,n.linienGrundlage),...ur(n.gaps.map(e=>e.style)),...hr(n.series.map(e=>!O(e)&&!!e.style?.gap?.label)),...dr(n.series.map(e=>"sensorType"in e?e.sensorType:void 0)),...Pt(n.series,n.thresholds)]}function mr(n,e){let t=[],r=i=>n.find(o=>(o.id??o.name)===i||o.name===i);return n.forEach((i,o)=>{if(O(i))return;let s=i.style?.fill,a=s&&typeof s=="object"&&"regions"in s?s.regions:[],m=new Set;for(let l of a)if(l.where)for(let u of [l.from??"chartBottom",l.to??"series"]){let h=u==="series"?i:typeof u=="object"&&"series"in u?r(u.series):void 0;if(!h||O(h))continue;let{grundLinie:c,stepShape:d}=e(h),p=c?.smoothingType??"catmull-rom";d||!c?.smoothing||p==="monotone"||m.has(h.name)||(m.add(h.name),t.push(`series ${o}: fill where decides on the readings, but "${h.name}" is smoothed with ${p}, which can overshoot them -- the area may miss the line at its edges; smoothingType 'monotone' does not overshoot`));}}),t}function ur(n){let e=n.flatMap((t,r)=>t==="label"?[String(r)]:[]);return e.length?[`gap ${e.join(", ")} uses style "label" -- deprecated, removed before 2.0; use style "empty" with a label`]:[]}function hr(n){let e=n.flatMap((t,r)=>t?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set style.gap.label -- deprecated, removed before 2.0; set the label style on gaps.style.label`]:[]}function cr(n){let e=new Map;return n.forEach((t,r)=>{e.set(t,[...e.get(t)??[],r]);}),[...e].filter(([,t])=>t.length>1).map(([t,r])=>`series ${r.join(", ")} share the id "${t}" -- hidden and pointsAt cannot tell them apart; give each a unique id`)}function dr(n){let e=n.flatMap((t,r)=>t&&t!=="numeric"?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set sensorType -- deprecated, removed before 2.0; it has no effect on the chart, use enumMap for state series`]:[]}var ve=class{};var E=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,u)=>l-u),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let u=0;for(let h=0;h<i.length&&l>=i[h];h++)u=h+1;return u},m=[n[0]];for(let l=1;l<n.length;l++){let u=n[l-1],h=n[l],c=t(u),d=t(h),p;d>c?p=i.filter(f=>f>c&&f<=d):d<c?p=i.filter(f=>f>=d&&f<c).reverse():p=[];let g=c;for(let f of p){let y=(f-c)/(d-c),b=r(u,h,y);m.push(b);let S=a((g+f)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[b],g=f;}(p.length===0||p[p.length-1]!==d)&&m.push(h);}if(m.length>1||n.length===1){let l=t(m[0]),u=t(m[m.length-1]),h=a((l+u)/2);o.push({data:m,zoneIndex:h,zoneLow:s(h)});}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 jt(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 pr(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 Bt(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(u=>u.value),l=pr(m,t);r[o]={time:s,value:l,synthetic:true};}return r}function fr(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 gr(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 Ft(n,e,t=false){let r=new Array(n.length),i=0,o=t?gr:fr;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(h=>h.value),u=o(l);r[s]={time:a,value:u,synthetic:true};}return r}function Je(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 u=n[l].value;u!==null&&(a+=u,m++);}t[i]={time:o,value:m===0?null:a/m,synthetic:true};}return t}function Et(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 Y(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}function Gt(n,e,t){let r=[],i=Te(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 Ot(n,e,t,r){if(n.length<2)return [];let i=E.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(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yLow(h))})),u=a.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:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...u],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}var _e=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 yr="#ffffff",br="#cccccc",xr=6,Sr=.85,W=12,Ce=8,me=20,wr=11,Ae=18,Qe=(n,e)=>e(n,wr);function It(n,e,t){let r=a=>W+Ce+Qe(a.name,e);if(t===void 0){let a=n.reduce((m,l)=>m+r(l)+Ae,0)-Ae;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+Ae+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 Wt(n,e="vertical",t=z,r){if(e==="horizontal"){let o=It(n,t,r);return {width:o.reduce((s,a)=>Math.max(s,a.breite),0),height:o.length*me}}let i=0;for(let o of n)i=Math.max(i,Qe(o.name,t));return {width:W+Ce+i,height:n.length*me}}function kr(n){let{items:e,x:t,y:r,orientation:i="vertical",metrics:o=z,maxBreite:s,box:a,itemClass:m}=n,l=new _e;if(a&&e.length>0){let d=Wt(e,i,o,s),g=((i==="horizontal"?d.height/me:e.length)-1)*me+W,f=a.padding??xr,y=a.stroke??br;l.rect({x:t-f,y:r-f,w:d.width+2*f,h:g+2*f,fill:a.fill??yr,...y==="none"?{}:{stroke:y,strokeWidth:a.strokeWidth??1},opacity:a.opacity??Sr});}let u=i==="horizontal"?It(e,o,s):e.map(d=>({items:[d],breite:0})),h=new Map;u.forEach((d,p)=>{let g=t;for(let f of d.items)h.set(f,{x:g,y:r+p*me}),g+=W+Ce+Qe(f.name,o)+Ae;});let c=e.some(d=>d.line!==void 0&&d.line!=="solid");return e.forEach(d=>{let p=h.get(d)??{x:t,y:r},g=p.x,f=p.y,y=["legend-item"];d.id&&y.push(`legend-item--${d.id}`),m&&y.push(m),l.group({cssClass:y.join(" "),...d.id?{id:`legend-${d.id}`}:{}},b=>{c?b.line({x1:g,y1:f+W/2,x2:g+W,y2:f+W/2,stroke:d.color,strokeWidth:vr(d.width),...d.line&&d.line!=="solid"?{dash:d.line}:{}}):b.rect({x:g,y:f,w:W,h:W,fill:d.color,stroke:x.legendStroke,strokeWidth:1}),b.text({content:d.name,x:g+W+Ce,y:f+W-2,fontSize:x.legendFont,fill:x.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function zt(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?Wt(t,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function Ht(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 Vt(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 u=r.filter(h=>h.position==="right").reduce((h,c)=>Math.max(h,c.bis),o+a);m=Math.min(Math.max(o+a+16,u+12),t.totalWidth-e.size.width-2),l=s;}else e.position==="above"||e.position==="below"?(m=Math.max(8,Math.min(t.totalWidth-e.size.width-8,o+(a-e.size.width)/2)),l=e.position==="above"?Math.max(4,s-e.size.height-10):t.totalHeight-e.size.height-4):(m=8,l=s);return [kr({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function vr(n){return Math.min(Math.max(n??2,1.5),3)}function Nt(n){let{xTicks:e,yTicks:t,xRange:r,yRange:i,stroke:o=x.gridStroke,strokeWidth:s=x.gridStrokeWidth,dashed:a=false,opacity:m=x.gridOpacity}=n,l=[];if(t)for(let u of t)l.push({type:"line",x1:r[0],y1:u,x2:r[1],y2:u,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let u of e)l.push({type:"line",x1:u,y1:i[0],x2:u,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function Kt(n){let{axes:e,timeAxis:t,primaryValueAxis:r,xRange:i,yRange:o}=n,s=X(e?.x?.grid),a=X(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,u=a?.major,h=w=>w!==void 0&&w!==false;if(!h(l)&&!h(u))return {group:null,layer:m};let c=l!==false,d=u!==false&&!!r,p=c?t.generateTicks().map(w=>w.x):void 0,g=d?r.generateTicks().map(w=>w.position):void 0;if(!p&&!g)return {group:null,layer:m};let f=(l&&typeof l=="object"?l:void 0)??(u&&typeof u=="object"?u:void 0),y=s?.minor,b=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(b&&typeof b=="object"?b:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||b!==void 0?Nt({xTicks:y!==false&&c?t.generateMinorTicks():void 0,yTicks:b!==false&&d?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(x.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...Nt({xTicks:p,yTicks:g,xRange:i,yRange:o,stroke:f?.color,opacity:f?.opacity,dashed:f?.style==="dashed"})]},layer:m}}function Yt(n){let e=[],t=r=>{r.type==="group"?r.commands.forEach(t):r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.push(r.y1);};return n.forEach(t),e}function Xt(n,e){if(e.length===0||n.type!=="group")return n;let t=r=>r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.some(i=>Math.abs(i-r.y1)<.5);return {...n,commands:n.commands.filter(r=>!t(r))}}function et(n,e,t){let r=(o,[s,a])=>o>=Math.min(s,a)&&o<=Math.max(s,a);if(!r(n.time,e.domain()))return false;if(n.value===void 0||!t)return true;let i=t.get(n.axis??0)??t.values().next().value;return !i||r(n.value,i.domain())}function Zt(n){let{annotations:e,timeScale:t,valueScales:r,plot:i}=n,o=[],s=m=>!i||et(m,t,r),a=m=>{let l=r.get(m.axis??0)??r.values().next().value;return {x:t.map(m.time),y:l?l.map(m.value):0}};for(let m of e){let l=[],u=d=>l.push(d);if((m.type==="point"||m.type==="label")&&!s(m.at))continue;let h=i!==void 0&&(m.type==="line"||m.type==="arrow"||m.type==="rect")&&!(s(m.from)&&s(m.to)),c=h?{clipRect:i}:{};switch(m.type){case "line":{let d=a(m.from),p=a(m.to);u({type:"line",x1:d.x,y1:d.y,x2:p.x,y2:p.y,stroke:m.color??x.annotationColor,strokeWidth:m.width??x.annotationWidth,dash:m.dash});break}case "arrow":{let d=a(m.from),p=a(m.to),g=m.color??x.annotationColor,f=m.headSize??x.annotationHead;u({type:"line",x1:d.x,y1:d.y,x2:p.x,y2:p.y,stroke:g,strokeWidth:m.width??x.annotationWidth});let y=Math.hypot(p.x-d.x,p.y-d.y)||1,b=(p.x-d.x)/y,S=(p.y-d.y)/y,k=p.x-b*f,w=p.y-S*f;u({type:"path",points:[{x:p.x,y:p.y},{x:k-S*f*.5,y:w+b*f*.5},{x:k+S*f*.5,y:w-b*f*.5}],fill:g,stroke:"none"});break}case "rect":{let d=a(m.from),p=a(m.to);u({type:"rect",x:Math.min(d.x,p.x),y:Math.min(d.y,p.y),w:Math.abs(p.x-d.x),h:Math.abs(p.y-d.y),fill:m.fill??"none",hatch:m.hatch,stroke:m.stroke,opacity:m.opacity});break}case "point":{let d=a(m.at),p=m.color??"#334155",g=m.radius??x.annotationRadius,f=m.shape??"circle";f==="circle"?u({type:"circle",cx:d.x,cy:d.y,r:g,fill:p}):f==="square"?u({type:"rect",x:d.x-g,y:d.y-g,w:g*2,h:g*2,fill:p}):(u({type:"line",x1:d.x-g,y1:d.y-g,x2:d.x+g,y2:d.y+g,stroke:p,strokeWidth:1.5}),u({type:"line",x1:d.x-g,y1:d.y+g,x2:d.x+g,y2:d.y-g,stroke:p,strokeWidth:1.5}));break}case "label":{let d=a(m.at);u({type:"text",content:m.text,x:d.x+(m.dx??0),y:d.y+(m.dy??0),anchor:m.anchor??Tr(d.x+(m.dx??0),m.text,n),fontSize:x.annotationFontSize,fill:m.color??x.annotationColor,rotate:m.rotate});break}}if(m.id&&l.length>0){let d=K(m.id);o.push({type:"group",cssClass:`annotation annotation--${d}`,...c,commands:l});}else h&&l.length>0?o.push({type:"group",cssClass:"annotation",...c,commands:l}):o.push(...l);}return o}function Tr(n,e,t){let{metrics:r,timeScale:i}=t;if(!r)return "middle";let[o,s]=i.range(),a=r(e,x.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 Me=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??x.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??x.bandAvgLine,s=e.bandWidth??10,a=[];for(let m of this.data){if(m.min===null||m.max===null)continue;let l=this.timeScale.map(m.time),u=e.valueScale.map(m.max),h=e.valueScale.map(m.min),c=s,d=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:u,w:c,h:h-u,fill:t,hatch:r,opacity:this.opacity(m.count),id:this.id?`${this.id}-slot-${d}`:void 0}),i&&m.avg!==null){let p=e.valueScale.map(m.avg);a.push({type:"line",x1:l-c/2,y1:p,x2:l+c/2,y2:p,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${d}`:void 0});}}return a}};function Ut(n,e,t,r,i,o,s){return Ot(n,e,{boundaries:[],yLow:a=>a.avg,yHigh:t,getValue:a=>a.avg,interpolate:E.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var Le=class extends re{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??x.minColor,r=e.maxColor??x.maxColor,i=e.avgColor??x.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??x.strokeWidth,l=E.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(l.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];l.forEach((p,g)=>{if(p.length<2)return;let f=y=>this.id?`${this.id}-${y}-${g}`:void 0;if(e.fillToMax){let y=Ut(p,u,b=>b.max,e.fillToMax,e.fillToMaxHatch,f("fillToMax"),{smoothing:s,smoothingType:a});h.push(...y);}if(e.fillToMin){let y=Ut(p,u,b=>b.min,e.fillToMin,e.fillToMinHatch,f("fillToMin"),{smoothing:s,smoothingType:a});h.push(...y);}});let c=l.filter(p=>p.length>=2),d=(p,g,f,y=false)=>Gt(c.map(b=>({data:b.map(S=>({time:S.time,value:p(S)}))})),u,{stroke:g,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${f}`:void 0});return h.push(...d(p=>p.max,r,"max"),...d(p=>p.min,t,"min"),...d(p=>p.avg,i,"avg",o)),h}};function Te(n){return {id:n.id,line:{stroke:n.stroke??x.stroke,strokeWidth:n.strokeWidth??x.strokeWidth,smoothing:n.smoothing??false,smoothingType:n.smoothingType,dashed:n.dashed??false},fill:n.fill??x.areaFillAlpha,markers:{type:n.pointStyle??"none",size:n.pointSize??x.pointSize,stroke:n.stroke??x.stroke,fill:"#ffffff"},shadow:{color:n.shadowColor??"transparent",blur:n.shadowBlur??0,offsetX:n.shadowOffsetX??0,offsetY:n.shadowOffsetY??0}}}function qt(n,e,t,r){let i=Te(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),u=r(a),h=t.pointStroke??u,c=t.pointFill??u,d=t.pointStrokeWidth??1.5,p=t.id?`${t.id}-marker-${s}`:void 0;De(o,p,i.markers.type,m,l,i.markers.size,h,c,d);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function De(n,e,t,r,i,o,s,a,m){let l=u=>e===void 0?void 0:`${e}-${u}`;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 u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,d=Math.PI/2*3+h*Math.PI/5;u.push({x:r+c*Math.cos(d),y:i+c*Math.sin(d)});}n.push({type:"path",points:u,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 u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}n.push({type:"path",points:u,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});}}function Jt(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),u=m.color??x.markerColor,h=m.pointStyle??(m.value!==void 0?"circle":"none"),c=m.lineStyle??"full";if(m.value!==void 0){let d=r.map(m.value);if(c==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:d,stroke:u,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:d,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),h!=="none"&&De(a,void 0,h,l,d,x.markerSize,u,u,1.5),m.label){let p=c==="to-value"?d-10:o-6;a.push({type:"text",content:m.label,x:l,y:p,anchor:"middle",fontSize:x.markerFontSize,fill:u});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:x.markerFontSize,fill:u});}return a}function Qt(n){let e=[],t=n.markers.filter(i=>et({time:i.time},n.timeScale)).map(i=>({...i}));for(let i of t)if(i.value===void 0&&(i.lineStyle==="to-value"||i.lineStyle==="to-top")){let o=n.series[i.seriesIndex??0];o&&!O(o)&&o.data.length>=2&&(i.value=_r(i.time,o.data));}if(t.length>0&&n.primaryScale){let i=[];for(let o of t){let s=n.primaryScale,a=n.series[o.seriesIndex??0];a&&(s=n.valueScales.get(n.achseVon(a))??n.primaryScale),i.push(...Jt({markers:[o],timeScale:n.timeScale,valueScale:s,yRange:n.yRange}));}e.push({type:"group",cssClass:"markers",commands:i});}let r=n.annotations;return r.length>0&&e.push({type:"group",cssClass:"annotations",commands:Zt({annotations:r,timeScale:n.timeScale,valueScales:n.valueScales,metrics:n.metrics,plot:n.plot})}),e}function _r(n,e){for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t];if(!(r.value===null||i.value===null)&&n>=r.time&&n<=i.time){if(i.time===r.time)return r.value;let o=(n-r.time)/(i.time-r.time);return r.value+o*(i.value-r.value)}}}var Ar=(()=>{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 tt(n){let e=new TextEncoder().encode(n),t=4294967295;for(let r of e)t=Ar[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function V(n,e){return e||"s-"+tt(n??"").toString(16).padStart(8,"0")}function en(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 Le({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:V(n.name,n.id)}).render():new Me({data:n.data,timeScale:e,valueScale:t,fill:i??r?.color,avgLine:n.avgLine,countOpacity:n.countOpacity,id:V(n.name,n.id)}).render()}function tn(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 u=e.get(l);!u||o<u.value||u.value<m||(m=u.value,a=u.color??a);}return a}}}function nn(n,e,t){if(!n.holdToEnd)return;let r=n.data.at(-1);if(!r||r.value===null)return;let i=t??e.domain()[1],o=typeof n.holdToEnd=="object"?n.holdToEnd.maxAgeMs:void 0;return o!==void 0&&(i=Math.min(i,r.time+o)),i>r.time?i:void 0}function $e(n,e){if(e===void 0||n.length===0)return n;let t=n[n.length-1],r=t[t.length-1];return [...n.slice(0,-1),[...t,{time:e,value:r.value}]]}function rn(n){let{series:e,ctx:t,runs:r,haltBis:i,totalPoints:o,style:s,styleLine:a,styleMarkers:m,stepShape:l,thresholds:u}=n,{timeScale:h,valueScale:c}=t,d=[],p=tn(e.colorByThresholds,u,s.stroke),g=p.grenzen,f=new Map,y=[];for(let S of r){let _=function(T){let C=S===r[r.length-1]?$e([S],i)[0]:S;return E.splitByBoundaries(T==="step"?Y(C):C,g,$=>$.value,E.interpolateDataPoint)};if(S.length<1)continue;let k=V(e.name,e.id),w=new Map,j=T=>{let C=w.get(T);return C||(C=_(T),w.set(T,C)),C},A=(T,C,$)=>{let F=j(T);for(let G of F){let B=G,H=f.get($)??0;if(f.set($,H+1),B.data.length<1)continue;let M=B.zoneLow;if(B.data.length===1){let L=p.farbe(M,C.color);d.push({type:"circle",id:k?`${k}-dot-${H}${$}`:void 0,cx:h.map(B.data[0].time),cy:c.map(B.data[0].value),r:Math.max(s.pointSize??x.pointSize,C.width??s.strokeWidth??x.strokeWidth),fill:L,shadowColor:s.shadowColor,shadowBlur:s.shadowBlur});continue}d.push({type:"path",cssClass:"series-line",id:k?`${k}-line-${H}${$}`:void 0,points:B.data.map(L=>({x:h.map(L.time),y:c.map(L.value)})),stroke:p.farbe(M,C.color),strokeWidth:C.width??s.strokeWidth,smoothing:T==="step"?false:C.smoothing??s.smoothing,smoothingType:C.smoothingType??s.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:s.shadowColor,shadowBlur:s.shadowBlur,shadowOffsetX:s.shadowOffsetX,shadowOffsetY:s.shadowOffsetY});}};a===false||(Array.isArray(a)?a.forEach((T,C)=>{A(T.shape??(e.seriesType==="step"?"step":"line"),T,`-${C}`);}):A(l?"step":"line",a??{},"")),y.push(...S);}return s.pointStyle&&s.pointStyle!=="none"&&o<=(m?.threshold??x.pointThreshold)&&d.push(...qt(y,t,s,S=>p.farbe(S.value))),d}function sn(n,e){for(let t of n){if(t.length===0||e<t[0].time||e>t[t.length-1].time)continue;let r=0;for(;r<t.length-1&&t[r+1].time<=e;)r++;return {lauf:t,i:r}}return null}function Pe(n,e,t){if(n.art==="fest")return n.wert;let r=sn(n.laeufe,e);if(!r)return null;let{lauf:i,i:o}=r,s=i[o];if(n.stufe)return t&&s.time===e&&o>0?i[o-1].value:s.value;if(s.time===e||o===i.length-1)return s.value;let a=i[o+1];return s.value+(a.value-s.value)*(e-s.time)/(a.time-s.time)}function on(n,e,t){if(n.art==="fest")return true;let r=sn(n.laeufe,e);return r?t===void 0||e-r.lauf[r.i].time<=t:false}function an(n,e,t){let r=t.exceeds,i=t.side??"both",o=new Set;for(let l of [n,e])if(l.art==="laeufe")for(let u of l.laeufe)for(let h of u)o.add(h.time),t.maxAgeMs!==void 0&&o.add(h.time+t.maxAgeMs);let s=[...o].sort((l,u)=>l-u),a=[];for(let l=0;l+1<s.length;l++){let[u,h]=[s[l],s[l+1]],c=(u+h)/2;if(!on(n,c,t.maxAgeMs)||!on(e,c,t.maxAgeMs))continue;let d=Pe(e,u,false)-Pe(n,u,false),p=Pe(e,h,true)-Pe(n,h,true),g=(f,y)=>{if(f<=0&&y<=0)return null;if(f>0&&y>0)return [u,h];let b=u+(0-f)/(y-f)*(h-u);return f>0?[u,b]:[b,h]};if(i!=="below"){let f=g(d-r,p-r);f&&f[1]>f[0]&&a.push(f);}if(i!=="above"){let f=g(-d-r,-p-r);f&&f[1]>f[0]&&a.push(f);}}a.sort((l,u)=>l[0]-u[0]);let m=[];for(let l of a){let u=m[m.length-1];u&&l[0]<=u[1]?u[1]=Math.max(u[1],l[1]):m.push([l[0],l[1]]);}return m}function ln(n,e,t,r,i,o){let s=0,a=m=>m.type==="group"?{...m,commands:m.commands.map(a)}:"id"in m&&m.id!==void 0?{...m,...o(s++)}:m;return e.map(([m,l])=>{let u=t.map(m);return {type:"group",clipRect:{x:u,y:r,w:t.map(l)-u,h:i-r},commands:n.map(a)}})}function U(n){return n!==void 0&&typeof n=="object"&&"series"in n?n.series:null}function mn(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 un(n){let e=[...n].sort((r,i)=>r.time-i.time),t=new Map;for(let r=1;r<e.length;r++){let[i,o]=[e[r-1],e[r]];i.time===o.time&&i.value!==null&&!t.has(i.time)&&t.set(i.time,i.value);}return t}function hn(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 Cr(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function cn(n,e){let t=U(n);if(t!==null){let i=e.fremdeSerie?.(t);return i?{art:"laeufe",laeufe:E.getRuns(i.data,o=>o.value===null,i.gapThreshold),stufe:i.shape==="step"}:null}if(n==="series")return {art:"laeufe",laeufe:e.runs,stufe:e.shape==="step"};let r=e.valueScale.domain();return {art:"fest",wert:ue(n,e)??(n==="chartBottom"?r[0]:r[1])}}function dn(n,e,t){let r=Mr(n,e,t);if(!n.where||r.length===0)return r;let i=cn(n.from??"chartBottom",e),o=cn(n.to??"series",e);return !i||!o?r:ln(r,an(i,o,n.where),e.timeScale,e.chartTop,e.chartBottom,s=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${s}`}:{})}function Mr(n,e,t){let r=hn(n.from,"chartBottom",e),i=hn(n.to,"series",e),{color:o,hatch:s}=Cr(n.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:u=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${u}`}:{}};return U(n.from)!==null||U(n.to)!==null?Dr(n,e,l):r!==null&&i!==null?$r(r,i,e,l):Pr(n,e,r,i,l)}function Lr(n,e,t){let r=e.shape==="step",i=(c,d)=>{let p=c??d,g=U(p);if(g!==null){let b=e.fremdeSerie(g);if(!b)return null;let S=b.shape==="step",k=E.getRuns(b.data,w=>w.value===null,b.gapThreshold).map(w=>S?Y(w):w);return {art:"fremd",skala:b.valueScale??e.valueScale,laeufe:k,glatt:!S&&!!b.smoothing,verfahren:b.smoothingType}}if(p==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=ue(p,e),y=e.valueScale.domain();return {art:"fest",wert:f??(p==="chartBottom"?y[0]:y[1]),glatt:false}},o=i(n.from,"chartBottom"),s=i(n.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=c=>c.art==="fremd"?c.skala:e.valueScale,m=c=>d=>({x:e.timeScale.map(d.time),y:c.map(d.value)}),l=(c,d)=>c.art==="eigene"?[d]:c.art==="fremd"?c.laeufe.filter(p=>p.length>=2):[null],u=(c,d,p,g)=>d?d.map(m(a(c))):[p,g].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(c.wert)})),h=[];for(let c of e.runs){if(c.length<2)continue;let d=r?Y(c):c;for(let p of l(o,d))for(let g of l(s,d)){let f=Math.max(d[0].time,p?.[0].time??-1/0,g?.[0].time??-1/0),y=Math.min(d.at(-1).time,p?.at(-1)?.time??1/0,g?.at(-1)?.time??1/0);if(!(y>f))continue;let b={k:o,pts:u(o,p,f,y)},S={k:s,pts:u(s,g,f,y)};b.k.glatt||([b,S]=[S,b]);let k=_=>(_.art==="fest"?void 0:_.verfahren)??"catmull-rom",w=e.timeScale.map(f);h.push({type:"group",clipRect:{x:w,y:e.chartTop,w:e.timeScale.map(y)-w,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(h.length),points:[...b.pts,...[...S.pts].reverse()],smoothing:true,smoothingType:k(b.k),smoothCount:b.pts.length,...S.k.glatt?{smoothTail:S.pts.length,smoothTailType:k(S.k)}:{}}]});}}return h}function Dr(n,e,t){if(!e.fremdeSerie){let a=U(n.from)??U(n.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=Lr(n,e,t);if(r)return r;let i=(a,m,l)=>{let u=a??m,h=U(u);if(h!==null){let g=e.fremdeSerie(h);if(!g)throw new Error(`fillSpec region references unknown series '${h}'`);let f=g.shape==="step"?Y(g.data):g.data;return {bei:mn(f),davor:un(f),zeiten:f.map(y=>y.time),skala:g.valueScale??e.valueScale}}if(u==="series")return {bei:mn(l),davor:un(l),zeiten:l.map(g=>g.time),skala:e.valueScale};let c=ue(u,e),d=e.valueScale.domain(),p=c??(u==="chartBottom"?d[0]:d[1]);return {bei:()=>p,zeiten:[],skala:e.valueScale}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?Y(a):a,l=i(n.from,"chartBottom",m),u=i(n.to,"series",m),h=m[0].time,c=m[m.length-1].time,d=[...new Set([...l.zeiten,...u.zeiten,...m.map(y=>y.time)])].filter(y=>y>=h&&y<=c).sort((y,b)=>y-b),p=[],g=[],f=()=>{if(p.length>=2){let y=[...g].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:p.length,points:[...p,...y]});}p=[],g=[];};for(let y of d){let b=l.bei(y),S=u.bei(y);if(b===null||S===null){f();continue}let k=e.timeScale.map(y),w=l.davor?.get(y)??b,_=u.davor?.get(y)??S;(w!==b||_!==S)&&(p.push({x:k,y:u.skala.map(_)}),g.push({x:k,y:l.skala.map(w)})),p.push({x:k,y:u.skala.map(S)}),g.push({x:k,y:l.skala.map(b)});}f();}return s}function $r(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 Pr(n,e,t,r,i){let o=t??r,s=[],a=Rr(n,e);if(a===null){let u=e.valueScale.domain();a=(t??r)===e.chartBottom?u[0]:u[1];}let m=ue(n.outer,e),l=e.shape==="step";for(let u of e.runs){if(u.length<2)continue;let h=l?Y(u):u,c=E.splitByThreshold(h,a,p=>p.value??a,E.interpolateDataPoint),d=n.side==="above"?c.above:n.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&n.side){let p=m,g=n.side==="above"?f=>Math.min(f,p):f=>Math.max(f,p);d=d.map(f=>f.map(y=>({...y,value:g(y.value??p)})));}for(let p of d){if(p.length<2)continue;let g=p.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),f=[];for(let y of [...g].reverse()){let b=f[f.length-1];l&&b&&b.x===y.x||f.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:g.length,points:[...g,...f]});}}return s}function Rr(n,e){let t=n.from==="series"?n.to:n.from;return ue(t,e)}function ue(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 pn(n,e){if(typeof n=="string"||!("regions"in n))return dn({fill:n},e,0);let t=[];return n.regions.forEach((r,i)=>{t.push(...dn(r,e,i));}),t}function gn(n){let e=n.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??x.stroke,width:t?.width??x.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function fn(n,e,t,r,i){let o=n.filter(l=>l.value!==null);if(o.length<2)return [];let s=gn(t);e.merke?.({index:i,kind:t.kind,punkte:o.map(l=>({time:l.time,value:l.value})),farbe:s.color,...s.dash?{linie:s.dash}:{}});let a=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)}));return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:a,stroke:s.color,strokeWidth:s.width,smoothing:s.smoothing,smoothingType:s.smoothingType,dash:s.dash,fill:"none"}]}function yn(n,e,t=0){switch(n.kind){case "movingAverage":{let r=n.type==="exponential"?Et(e.data,n.window):Je(e.data,n.window);return fn(r,e,n,"movingAvg",t)}case "movingMkt":{let r=Bt(e.data,n.window,n.activationEnergy);return fn(r,e,n,"movingMkt",t)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=gn(n),m=a.color,l=a.width,u=a.dash??"dashed",h=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return n.high!==void 0&&r.push({type:"line",id:`${h}limit-high`,x1:o,y1:e.valueScale.map(n.high),x2:s,y2:e.valueScale.map(n.high),stroke:m,strokeWidth:l,dash:u}),n.low!==void 0&&r.push({type:"line",id:`${h}limit-low`,x1:o,y1:e.valueScale.map(n.low),x2:s,y2:e.valueScale.map(n.low),stroke:m,strokeWidth:l,dash:u}),r}case "stdDevBand":{let r=n.multiplier??1,i=Je(e.data,n.window),o=Ft(e.data,n.window),s=[],a=[],m=[];for(let y=0;y<i.length;y++){let b=i[y].value,S=o[y].value;if(b===null||S===null)continue;let k=e.timeScale.map(i[y].time);s.push({x:k,y:e.valueScale.map(b+r*S)}),a.push({x:k,y:e.valueScale.map(b-r*S)}),m.push({time:i[y].time,value:b,low:b-r*S,high:b+r*S});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,u=[],c=(typeof n.style?.fill=="string"||n.style?.fill&&!("regions"in n.style.fill)?n.style.fill:void 0)??"#94a3b833",{color:d,hatch:p}=jr(c);u.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:d,hatch:p,stroke:"none"});let g=n.style?.line,f=g&&!Array.isArray(g)?g:void 0;if(e.merke?.({index:t,kind:"stdDevBand",punkte:m,farbe:f?f.color??x.stroke:d,...f?.style?{linie:f.style}:{}}),f){let y=i.filter(b=>b.value!==null).map(b=>({x:e.timeScale.map(b.time),y:e.valueScale.map(b.value)}));y.length>=2&&u.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:y,stroke:f.color??x.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return u}}}function jr(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function bn(n,e){let t=n.style?.line,r=t&&!Array.isArray(t)?t:void 0,i=Array.isArray(t)?t[0]:r,o=(i?.shape??n.seriesType)==="step",s=i||void 0,a=s?.gapThreshold??e??x.gapThreshold;return {styleLine:t,lineDefaults:r,gapThreshold:a,grundLinie:s,stepShape:o}}function xn(n,e,t,r,i=0){let o=n.timeScale,s={timeScale:o,valueScale:t};if(O(e))return en(e,o,t);let{lineDefaults:a,gapThreshold:m}=n.linienGrundlage(e),l=E.getRuns(e.data,_=>_.value===null,m),u=l.reduce((_,j)=>_+j.length,0);if(u===0)return [];let h=[],c=e.style?.markers,d=e.style?.shadow,p={stroke:a?.color??n.palettenFarbe(i),strokeWidth:a?.width??x.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:d?.color,shadowBlur:d?.blur,shadowOffsetX:d?.offsetX,shadowOffsetY:d?.offsetY,id:V(e.name,e.id)},{styleLine:g,grundLinie:f,stepShape:y}=n.linienGrundlage(e),b=nn(e,o,n.jetzt),S=$e(l,b),k=e.style?.fill;if(k!==void 0){let _=t.range(),j=Math.min(_[0],_[1]),A=Math.max(_[0],_[1]);h.push(...pn(k,{runs:S,timeScale:o,valueScale:t,thresholds:r,chartTop:j,chartBottom:A,smoothing:f?.smoothing,smoothingType:f?.smoothingType,shape:y?"step":"line",fremdeSerie:T=>{let C=n.alleReihen.find(B=>(B.id??B.name)===T||B.name===T);if(!C||!("data"in C))return;let $=C.data;if($.length===0||!("value"in $[0]))return;let F=n.linienGrundlage(C),G=F.grundLinie;return {data:$,shape:F.stepShape?"step":"line",smoothing:G?.smoothing,smoothingType:G?.smoothingType,gapThreshold:F.gapThreshold,valueScale:n.valueScales.get(n.achseVon(C))}},idPrefix:V(e.name,e.id)}));}h.push(...rn({series:e,ctx:s,runs:l,haltBis:b,totalPoints:u,style:p,styleLine:g,styleMarkers:c,stepShape:y,thresholds:r}));let w=e.overlays;if(w&&w.length>0){let _=t.range(),j={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(_[0],_[1]),chartBottom:Math.max(_[0],_[1]),idPrefix:V(e.name,e.id),merke:A=>{n.merkeOverlay(i,A);}};w.forEach((A,T)=>{h.push(...yn(A,j,T));});}return e.style?.gap&&l.length>1&&h.push(...At({gap:e.style.gap,runs:l,timeScale:o,valueScale:t,metrics:n.textMetrics,lineColor:a?.color})),h}function Sn(n,e,t){if(!e)return n;let r=`${e}-`,i=s=>s.split(/\s+/).filter(Boolean).map(a=>t.has(a)?a:r+a).join(" "),o=s=>{let a={...s};return a.cssClass&&(a.cssClass=i(a.cssClass)),a.type==="group"&&(a.commands=a.commands.map(o)),a};return n.map(o)}function wn(n,e,t){let i=new Array(n.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));n.forEach((s,a)=>{if(s.fest===void 0)return;let m=s.position==="left"?s.achseX-s.fest:s.achseX+s.fest,l=s.schrift/2;o.push({position:s.position,von:m-l-1,bis:m+l+1,titel:true}),i[a]=m;});for(let s of ["left","right"]){let a=s==="left",m=n.map((l,u)=>({t:l,i:u})).filter(l=>l.t.position===s&&l.t.fest===void 0).sort((l,u)=>a?u.t.achseX-l.t.achseX:l.t.achseX-u.t.achseX);for(let{t:l,i:u}of m){let h=l.schrift/2,c=o.filter(g=>g.position===s),d=l.kante,p=a?d-1-h:d+1+h;for(let g=0;g<=c.length;g++){let f=p-h-1,y=p+h+1,b=c.find(S=>f<S.bis&&S.von<y);if(!b)break;d=a?b.von:b.bis,p=a?d-1-h:d+1+h;}if(a?p-h<2:p+h>t-2){let g=o.filter(f=>f.position===s&&f.titel);p=a?h+2:t-h-2;for(let f=0;f<=g.length;f++){let y=p-h-1,b=p+h+1,S=g.find(k=>y<k.bis&&k.von<b);if(!S)break;p=a?S.bis+1+h:S.von-1-h;}}o.push({position:s,von:p-h-1,bis:p+h+1,titel:true}),i[u]=p;}}return {xs:i,belegt:o}}function kn(n){let{axes:e,neueForm:t,achsenTitel:r,titelSpuren:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=t?void 0:e?.left?.label,h=t?void 0:e?.right?.label,c=e?.x?.label;if(!u&&!h&&!c&&r.length===0)return [];let d=[],p=a+l/2,g=e?.left?.labels,f=e?.right?.labels,y=e?.x?.labels,b=e?.left?.labelOffset,S=e?.right?.labelOffset;return u&&d.push({type:"text",content:u,x:b===void 0?14:s-(e?.left?.offset??0)-b,y:p,anchor:"middle",fontSize:g?.fontSize??x.axisLabelSize,fill:g?.color??x.axisLabelColor,rotate:-90}),h&&d.push({type:"text",content:h,x:S===void 0?o.totalWidth-14:s+m+(e?.right?.offset??0)+S,y:p,anchor:"middle",fontSize:f?.fontSize??x.axisLabelSize,fill:f?.color??x.axisLabelColor,rotate:90}),r.forEach((k,w)=>{d.push({type:"text",content:k.text,x:i[w],y:p,anchor:"middle",fontSize:k.style?.fontSize??x.axisLabelSize,fill:k.style?.color??x.axisLabelColor,rotate:k.position==="right"?90:-90});}),c&&d.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6-(n.untenBelegt??0),anchor:"middle",fontSize:y?.fontSize??x.axisLabelSize,fill:y?.color??x.axisLabelColor}),d.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:d}]}var N=class{_layout;_idPraefix;_klassenPraefix;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_theme;_overlayWerte=new Map;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_gapsAtEnd;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new oe({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._idPraefix=e.idPrefix,this._klassenPraefix=e.classPrefix,this._legend=e.legend,this._textMetrics=e.textMetrics??z,this._theme=e.theme,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=dt(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,this._gapsAtEnd=t.atEnd,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let 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=zt({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,r=Ht(e,this._layout.margin);return r&&(t=new oe({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute()),{layout:t,legende:e}}renderCommands(){let e=this._klassenPraefix,t=new Set((this._legend?.itemClass??"").split(/\s+/).filter(Boolean));return ae(this._theme,()=>Sn(this._zeichne(),e,t))}_zeichne(){if(this._overlayWerte.clear(),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 M of this._series)M.data.sort((L,D)=>L.time-D.time);let u=new Map,h=1/0,c=-1/0,d=false;for(let M of this._series){let L=this._axisIndexOf(M),D=u.get(L);D?D.push(M):u.set(L,[M]);for(let P of this._timesOf(M))P<h&&(h=P),P>c&&(c=P),d=true;}if(!d)return [];let p=this._axes?.x?.domain,g=p&&p!=="auto"?p:[h,c];this._timeScale=new Q({domain:g,range:a,locale:this._locale,timeZone:this._timeZone});let f=new te({domain:g,xRange:a,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:be(this._axes?.x?.ticks?.minor,X(this._axes?.x?.grid)?.minor),colors:ye(this._axes?.x?.axis,this._axes?.x?.labels),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let y=Array.from(u.keys()).sort((M,L)=>M-L),b=vt({axes:this._axes,indices:y,seriesByIndex:u,layout:e,thresholds:this._thresholds,metrics:this._textMetrics});l.push(...b.commands);let{titel:S,baender:k,neueForm:w}=b,_=b.primary;for(let[M,L]of b.scales)this._valueScales.set(M,L);let j=this._valueScales.get(0)??this._valueScales.get(y[0]);l.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:f.render()});let A=Kt({axes:this._axes,timeAxis:f,primaryValueAxis:_,xRange:a,yRange:m}),T=A.group;T&&A.layer==="back"&&(l.push(T),T=null),this._highlights.length>0&&l.push({type:"group",cssClass:"highlights",commands:Dt({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:m,height:e.totalHeight})});let C=j?Tt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:j,xRange:a,layout:e}):[];l.push(...C);let $=this._gapsAtEnd?Lt({atEnd:this._gapsAtEnd,series:this._series,timeScale:this._timeScale}).map(M=>Ke(M,void 0)):[],F=[...this._gaps,...$];if(this._gapsAutoDetect){let M=[];for(let L of this._series){if(O(L))continue;let D=L.data.filter(P=>P.value!==null);M.push(...jt(D,this._gapsMinGapMs));}M.length>0&&(F=[...F,...M]);}F.length>0&&l.push({type:"group",cssClass:"gaps",commands:qe({gaps:F,timeScale:this._timeScale,yRange:m,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let G=new Map(this._thresholds.map(M=>[M.id??M.name,M]));for(let[M,L]of this._series.entries()){if(L.data.length===0)continue;let D=this._valueScales.get(this._axisIndexOf(L));if(!D)continue;let P=K(L.id??L.name);l.push({type:"group",cssClass:`series series--${P}`,id:`series-${P}`,commands:xn(this._reihenKontext(),L,D,G,M),...this._clipSeries?{clipRect:{x:r,y:i,w:o,h:s}}:{}});}if(T&&l.push(Xt(T,Yt(C))),l.push(...Qt({markers:this._markers,annotations:this._annotations.filter(M=>!M.id||!this._disabledAnnotations.has(M.id)),series:this._series,timeScale:this._timeScale,valueScales:this._valueScales,achseVon:M=>this._axisIndexOf(M),primaryScale:j,yRange:m,metrics:this._textMetrics,plot:{x:r,y:i,w:o,h:s}})),this._annotationBands.length>0){let M=i+s+this._layout.margin.bottom,L=0;this._annotationBands.forEach(D=>{let P=D.height??12,J=D.spacing??0,R=M+L;(D.showAxis??false)&&(L+=26+J),L+=P+J,l.push({type:"group",cssClass:"annotation-band",commands:new ke({name:D.name,showAxis:D.showAxis??false,items:D.items,timeScale:this._timeScale,background:D.background,hatch:D.hatch},[r,r+o],R,P).render()});});}let{xs:B,belegt:H}=wn(S.map(M=>({achseX:M.achseX,kante:M.kante,position:M.position,schrift:M.style?.fontSize??x.axisLabelSize,fest:M.fest})),k,e.totalWidth);return l.push(...Vt({legende:t,layout:e,randBelegt:H,metrics:this._textMetrics})),l.push(...kn({axes:this._axes,neueForm:w,achsenTitel:S,titelSpuren:B,layout:e,untenBelegt:e.margin.bottom-this._layout.margin.bottom})),Ve(l,this._fontFamily??x.fontFamily),Ne(l,this._idPraefix),l}_linienGrundlage(e){return bn(e,this._gapsAutoDetect?this._gapsMinGapMs:void 0)}_reihenKontext(){return {timeScale:this._timeScale,alleReihen:this._series,valueScales:this._valueScales,achseVon:e=>this._axisIndexOf(e),linienGrundlage:e=>this._linienGrundlage(e),palettenFarbe:e=>this._palettenFarbe(e),jetzt:this._gapsAtEnd?.now,textMetrics:this._textMetrics,merkeOverlay:(e,t)=>{let r=this._overlayWerte.get(e)??[];r.push(t),this._overlayWerte.set(e,r);}}}legendItems(){return ae(this._theme,()=>this._legendeneintraege())}_legendeneintraege(){return this._legendItems()}_palettenFarbe(e){let t=x.palette;return t.length>0?t[e%t.length]:x.stroke}_legendItems(){return this._series.map((e,t)=>{let 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=O(e)?e.avgColor??x.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,width:i.length<=1?i[0]?.width??x.strokeWidth:void 0,marker:s?o.type:void 0,id:K(e.id??e.name),seriesId:e.id??e.name}})}get renderer(){return this._renderer}get layout(){return ae(this._theme,()=>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}warnings(){return Rt({series:this._series,gaps:this._gaps,thresholds:this._thresholds,linienGrundlage:e=>this._linienGrundlage(e)})}pointsAt(e,t,r={}){return ae(this._theme,()=>this._punkteAm(e,t,r))}_punkteAm(e,t,r={}){if(!this._timeScale)return [];let i=this._legendItems();return ct(this._series,this._timeScale,(o,s)=>{let a=this._axisIndexOf(o),m=this._valueScales.get(a);if(!m)return;let l=O(o)?void 0:this._linienGrundlage(o);return {skala:m,achse:a,stufe:l?.stepShape??false,gapThreshold:l?.gapThreshold??0,farbe:i[s].color,linie:i[s].line,format:Br(o)??Se(this._axes,a)?.format,overlays:this._overlayWerte.get(s)}},this.plotRect,e,t,{...r,radius:r.radius??x.tooltipSnapRadius})}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 Br(n){let e=n.enumMap;return e?t=>e[t]??String(t):void 0}var Er=.2,he=4,ie=1e-6,Gr=6,Or=.4;function Ir(n){return n?.map(e=>{let t=e.data;if(t.length<=4)return e;let r=(l,u)=>"avg"in l?u?l.max:l.min:l.value,i=new Set,o=0,s=0,a=-1,m=-1;t.forEach((l,u)=>{l.time<t[o].time&&(o=u),l.time>t[s].time&&(s=u);let h=r(l,false),c=r(l,true);h!==null&&(a<0||h<r(t[a],false))&&(a=u),c!==null&&(m<0||c>r(t[m],true))&&(m=u);});for(let l of [o,s,a,m])l>=0&&i.add(l);return {...e,data:t.filter((l,u)=>i.has(u))}})}function Wr(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,Er*t],a=[[i,o],[i+r,o],[i,s],[i+r,s]],m=(n.rotate??0)*Math.PI/180,l=Math.cos(m),u=Math.sin(m),h=a.map(([d,p])=>n.x+d*l-p*u),c=a.map(([d,p])=>n.y+d*u+p*l);return {x0:Math.min(...h),y0:Math.min(...c),x1:Math.max(...h),y1:Math.max(...c)}}function ce(n,e){return {x0:Math.min(...n),y0:Math.min(...e),x1:Math.max(...n),y1:Math.max(...e)}}function vn(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;vn(r.commands,e,t);break}case "text":{let i=Wr(r,e);i&&t.push(i);break}case "line":t.push(ce([r.x1,r.x2],[r.y1,r.y2]));break;case "rect":t.push(ce([r.x,r.x+r.w],[r.y,r.y+r.h]));break;case "circle":t.push(ce([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(ce(r.points.map(i=>i.x),r.points.map(i=>i.y)));break;case "gap":t.push(ce([r.x1,r.x2],[r.y1,r.y2]));break}return t}function zr(n,e={}){return Hr(n,e)}function Hr(n,e,t){let r=e.padding||4,i=Math.max(e.minimum||8,he),o=n.textMetrics??z,s=Ir(n.series),a=h=>{let c=new N({...n,series:s,margin:h}),d=c.renderCommands();return {kaesten:vn(d,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)},u;for(let h=0;h<Gr;h++){let c=a(l),d=a({...l,left:l.left+he,right:l.right-he}),p=a({...l,top:l.top+he,bottom:l.bottom-he}),g=d.kaesten.length===c.kaesten.length&&p.kaesten.length===c.kaesten.length,f=T=>g&&Math.abs(d.kaesten[T].x0-c.kaesten[T].x0)<ie,y=T=>g&&Math.abs(p.kaesten[T].y0-c.kaesten[T].y0)<ie,{plot:b}=c,S=b.x+b.width,k=b.y+b.height,w={left:0,right:0,top:0,bottom:0},_={left:0,right:0,top:0,bottom:0};c.kaesten.forEach((T,C)=>{f(C)?(T.x0<b.x-ie&&(_.left=Math.max(_.left,T.x1)),T.x1>S+ie&&(_.right=Math.max(_.right,c.breite-T.x0))):(w.left=Math.max(w.left,b.x-T.x0),w.right=Math.max(w.right,T.x1-S)),y(C)?(T.y0<b.y-ie&&(_.top=Math.max(_.top,T.y1)),T.y1>k+ie&&(_.bottom=Math.max(_.bottom,c.hoehe-T.y0))):(w.top=Math.max(w.top,b.y-T.y0),w.bottom=Math.max(w.bottom,T.y1-k));});let j=T=>_[T]>0?_[T]+r+w[T]:w[T]>0?w[T]+r:0,A={top:0,right:0,bottom:0,left:0};for(let T of ["top","right","bottom","left"]){let C=T==="top"||T==="bottom"?c.hoehe:c.breite,$=Math.max(i,Math.floor(C*Or));A[T]=Math.min(Math.max(i,Math.ceil(j(T)-1e-9)),$);}if(A.top===l.top&&A.right===l.right&&A.bottom===l.bottom&&A.left===l.left)return A;if(u&&A.top===u.top&&A.right===u.right&&A.bottom===u.bottom&&A.left===u.left)return {top:Math.max(A.top,l.top),right:Math.max(A.right,l.right),bottom:Math.max(A.bottom,l.bottom),left:Math.max(A.left,l.left)};u=l,l=A;}return l}function Vr(n){if(n.min!==void 0&&n.max!==void 0)return {unit:n.unit,min:n.min,max:n.max};let e=1/0,t=-1/0;for(let r of n.data??[])r.value===null||r.value===void 0||(r.value<e&&(e=r.value),r.value>t&&(t=r.value));return {unit:n.unit,min:e,max:t}}var Tn=n=>Math.abs(n.max-n.min);function Nr(n,e){return n.max>=e.min&&e.max>=n.min?0:n.max<e.min?e.min-n.max:n.min-e.max}function Kr(n,e){if(n.unit!==e.unit)return false;let t=Math.max(Math.abs(n.min),Math.abs(n.max),Math.abs(e.min),Math.abs(e.max)),r=Math.max(Tn(n),Tn(e),t*.05);return Nr(n,e)<=r}function Yr(n){let e=[],t=n.map(i=>{let o=Vr(i);if(!Number.isFinite(o.min)||!Number.isFinite(o.max)){let a=e.findIndex(m=>m.unit===o.unit);return a>=0?a:(e.push({unit:o.unit,min:0,max:0}),e.length-1)}let s=e.findIndex(a=>Kr(a,o));return s>=0?(e[s]={unit:e[s].unit,min:Math.min(e[s].min,o.min),max:Math.max(e[s].max,o.max)},s):(e.push({...o}),e.length-1)}),r=e.map((i,o)=>({position:o===0?"left":"right",...i.unit?{label:i.unit}:{}}));return {indices:t,axes:r}}function _n(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 Xr(n){let e=_n(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 Zr(n){let e=_n(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],u=[];for(let h=0;h<t;h++){let c=Math.abs(l[h+3]-l[h+2]),d=Math.abs(l[h+1]-l[h]);u.push(c+d===0?(l[h+1]+l[h+2])/2:(c*l[h+1]+d*l[h+2])/(c+d));}return u}function Ur(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 qr(n,e){if(n.length<2)return [];let t=e==="akima"?Zr(n):Xr(n);return Ur(n,t)}function Jr(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=u=>u<a?a:u>m?m:u;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 nt(n,e){return e&&e!=="catmull-rom"?qr(n,e):Jr(n)}var rt=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],Qr={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:rt,rect:rt,path:rt},ei={line:"stroke-opacity",text:"fill-opacity"},ti=/ ([a-z-]+)="([^"]*)"/g;function ni(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=
|
|
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=
|
|
27
|
-
`)}}var it="1.
|
|
24
|
+
`.trim()}function Xe(n,e=2,t=false){if(n==="dashed"||!n&&t)return {strokeDasharray:"4,4"};if(n==="dotted")return {strokeDasharray:"2,4"};if(!n||n==="solid")return null;let r=yt(n,e);return r.strokeDasharray==="none"?null:r}function yt(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 x=new Proxy({},{get:(n,e)=>se()[e],has:(n,e)=>e in se(),ownKeys:()=>Reflect.ownKeys(se()),getOwnPropertyDescriptor:(n,e)=>Reflect.getOwnPropertyDescriptor(se(),e)});function ge(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 le={axisColor:x.axisColor,tickColor:x.tickColor,textColor:x.textColor,textSize:x.textSize},te=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??le).axisColor}get tickColor(){return (this.#t.colors??le).tickColor}get textColor(){return (this.#t.colors??le).textColor}get textSize(){return (this.#t.colors??le).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??le,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 ge(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 O(n){return "showAs"in n&&!!n.showAs}function bt(n){if(O(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 ye(n,e){return {axisColor:n?.color??x.axisColor,tickColor:n?.color??x.tickColor,textColor:e?.color??x.textColor,textSize:e?.fontSize??x.textSize,axisWidth:n?.width??1}}function xt(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 be(n,e){return n!==void 0?n:e!==void 0&&e!==false?1:0}var Jn=[[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,Qn=(()=>{let n=new Map;for(let[e,,t]of Jn){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 Qn.get(n)??Ze}var z=(n,e)=>{let t=0;for(let r of n)t+=St(r.codePointAt(0)??0);return t*e},er=(n,e)=>[...n].length*e*Ze;function wt(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 Ue(n,e){let t=r=>e===void 0||e>=r;return Math.abs(n)>=1e6&&t(1e5)?`${(n/1e6).toFixed(1)}M`:Math.abs(n)>=1e3&&t(100)?`${(n/1e3).toFixed(1)}k`:Number.isInteger(n)?String(n):n.toFixed(1)}function tr(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 xe=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 g=this.#t.format??Ue;return e.map(f=>({value:f,position:this.#e.map(f),label:g(f)}))}let t=this.#t.format??Ue,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,u=Math.pow(10,Math.floor(Math.log10(l))),h=l/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:i,position:this.#e.map(i),label:t(i)}];this.#t.format||(t=g=>Ue(g,c));let d=[],p=Math.ceil(s/c)*c;for(let g=p;g<=a;g+=c)d.push({value:g,position:this.#e.map(g),label:t(g)});return d}generateMinorTicks(){return ge(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=h=>s.some(c=>Math.abs(c-h)<=a),l=[];if(i==="vertical"){let[h,c]=this.#e.range();l.push({type:"line",x1:r,y1:h,x2:r,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=tr(e);e.forEach((p,g)=>{let f=m(p.position),y=d[g]?{opacity:0}:{};o==="left"?(l.push({type:"line",x1:r-4,y1:p.position,x2:r,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||l.push({type:"text",content:p.label,x:this.#n(r-8,p.label,"end"),y:p.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...y})):(l.push({type:"line",x1:r,y1:p.position,x2:r+4,y2:p.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),f||l.push({type:"text",content:p.label,x:this.#n(r+8,p.label,"start"),y:p.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...y}));});}else {let[h,c]=this.#e.range();l.push({type:"line",x1:h,y1:r,x2:c,y2:r,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)l.push({type:"line",x1:d.position,y1:r,x2:d.position,y2:r+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),l.push({type:"text",content:d.label,x:d.position,y:r+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())l.push(u?{type:"line",x1:o==="right"?r:r-2,y1:h,x2:o==="right"?r+2:r,y2:h,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:h,y1:r,x2:h,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 vt(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 Tt(n){let{axes:e,indices:t,seriesByIndex:r,layout:i,thresholds:o,metrics:s}=n,{chartX:a,chartY:m,chartWidth:l,chartHeight:u}=i,h=[],c=new Map,d,p=[],g=[],f=(e?.y?.length??0)>0,y=0,b=0;for(let S of t){let v=r.get(S),w=1/0,_=-1/0,j=false;for(let R of v)for(let de of bt(R))de<w&&(w=de),de>_&&(_=de),j=true;if(!j)continue;if(Se(e,S)?.includeThresholds)for(let R of o)(R.axisIndex??0)!==S||R.line==="none"||(w=Math.min(w,R.value),_=Math.max(_,R.value));w===_&&(w-=1,_+=1);let A=Se(e,S),k=A?.domain,C=k&&k!=="auto"?k:xt(w,_,u,A?.padding),{werte:$,name:F}=vt(v);if($){let R=$.length>1?($[$.length-1]-$[0])/($.length-1):1;C[0]=$[0]-R/2,C[1]=$[$.length-1]+R/2;}let G=new Z({domain:C,range:[m+u,m]});c.set(S,G);let B=A?.position??(S===0?"left":"right"),H=B==="right"?"outside-right":"outside-left",M=o.filter(R=>(R.axisIndex??0)===S&&typeof R.label=="object"&&R.label!==null&&R.label.position===H&&R.value>=Math.min(C[0],C[1])&&R.value<=Math.max(C[0],C[1])).map(R=>G.map(R.value)),L;if(B==="right"){let R=A?.offset??b*50;L=a+l+R,b++;}else {let R=A?.offset??y*50;L=a-R,y++;}let D=new xe({domain:C,range:[m+u,m],x:L,position:B,format:A?.format??($?F:void 0),tickValues:$,ticks:A?.ticks?.major,minorTicks:be(A?.ticks?.minor,X(A?.grid)?.minor),colors:ye(A?.axis,A?.labels),suppressLabelsNear:M.length?M:void 0,gesamtbreite:i.totalWidth,metrics:s}),P=8+wt(D.generateTicks().map(R=>R.label),11,s),J=B==="right"?L+P:L-P;g.push({position:B,von:Math.min(L,J),bis:Math.max(L,J)}),f&&A?.label&&p.push({text:A.label,achseX:L,kante:J,position:B,style:A.labels,fest:A.labelOffset}),S===0&&(d=D),h.push({type:"group",cssClass:`value-axis ${B}`,sharedStyles:true,commands:D.render()});}return {commands:h,titel:p,baender:g,neueForm:f,primary:d,scales:c}}function Se(n,e){let t=e===0?n?.left:e===1?n?.right:void 0,r=n?.y&&n.y.length>e?n.y[e]:void 0;return r&&t?{...t,...r}:r??t}function nr(n){return n==="dotted"?{dash:"dotted"}:n==="dashed"?{dash:"dashed"}:{}}function rr(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),u=[],h=[];for(let c of e){let d=c.color??x.thresholdColor,p=t.map(c.value);c.fill==="above"?u.push({type:"rect",x:i,y:m,w:o-i,h:Math.max(0,p-m),fill:d,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&u.push({type:"rect",x:i,y:p,w:o-i,h:Math.max(0,l-p),fill:d,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let g=c.line??x.thresholdLine;if(g!=="none"){let S=nr(g),v={type:"line",x1:i,y1:p,x2:o,y2:p,stroke:d,strokeWidth:1,...S,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(v.shadowColor=c.shadowColor,v.shadowBlur=c.shadowBlur??4,v.shadowOffsetX=c.shadowOffsetX??0,v.shadowOffsetY=c.shadowOffsetY??2),u.push(v);}let[f,y]=t.domain();if(c.value>=Math.min(f,y)&&c.value<=Math.max(f,y)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,v=typeof c.label=="string"?c.label:S?.text??c.name,w=S?.position??"right",_=or(v,w,i,o,p,d,S);h.push({..._,y:ir(_.y,Math.min(s,a),Math.max(s,a),x.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function ir(n,e,t,r){return Math.max(e+r,Math.min(t-r/2,n))}function or(n,e,t,r,i,o,s){let a=(t+r)/2,m={type:"text",content:n,fontSize:x.thresholdFontSize,fill:o},l=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...m,...l,x:t+4,y:i-4,anchor:"start"};case "above":return {...m,...l,x:a,y:i-6,anchor:"middle"};case "below":return {...m,...l,x:a,y:i+14,anchor:"middle"};case "center":return {...m,...l,x:a,y:i-4,anchor:"middle"};case "outside-left":return {...m,...l,x:t-6,y:i+3,anchor:"end",textBaseline:l.textBaseline??"middle"};case "outside-right":return {...m,...l,x:r+6,y:i+3,anchor:"start",textBaseline:l.textBaseline??"middle"};default:return {...m,...l,x:r-4,y:i-4,anchor:"end"}}}function kt(n){let{thresholds:e,valueScales:t,primaryScale:r,xRange:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=[];if(e.length===0)return u;let h=[],c=[];for(let d of e){let p=d.id??K(d.name),g=t.get(d.axisIndex??0)??r,f=rr({thresholds:[d],valueScale:g,xRange:i});f.inside.length&&h.push({type:"group",cssClass:`threshold threshold--${p}`,id:`threshold-${p}`,commands:f.inside}),f.labels.length&&c.push({type:"group",cssClass:`threshold-label threshold-label--${p}`,commands:f.labels});}return h.length&&u.push({type:"group",cssClass:"thresholds",commands:h,clipRect:{x:s,y:a,w:m,h:l}}),c.length&&u.push({type:"group",cssClass:"threshold-labels",commands:c}),u}function _t(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 we(n){let{ranges:e,timeScale:t,yRange:r,height:i,metrics:o=z}=n,[s,a]=r,m=[],[l,u]=t.range(),h=Math.min(l,u),c=Math.max(l,u),d=p=>Math.max(h,Math.min(c,p));for(let p of e){let g=d(t.map(p.startTime)),f=d(t.map(p.endTime));if(p.fill!==void 0&&m.push({type:"rect",x:g,y:s,w:f-g,h:a-s,fill:p.fill,hatch:p.hatch,opacity:p.opacity}),p.edges)for(let y of [g,f])m.push({type:"line",x1:y,y1:s,x2:y,y2:a,stroke:p.edges.stroke,strokeWidth:p.edges.strokeWidth,dash:"dashed"});if(p.label){let y=p.labelPosition??"middle",b=p.rotate,S=true;if(b==="auto"){let v=y!=="above"&&y!=="below",w=o(p.label,p.fontSize??11);b=v&&w>Math.abs(f-g)-4?-90:void 0,S=b===void 0||w<=Math.abs(a-s)-4;}S&&m.push({type:"text",content:p.label,x:(g+f)/2,y:_t(y,s,a,i),anchor:"middle",fontSize:p.fontSize,fill:p.labelColor,rotate:b});}}return m}function qe(n){let{gaps:e,timeScale:t,yRange:r,height:i,fill:o=x.gapFill,hatch:s,fillOpacity:a=x.gapFillOpacity??.15,stroke:m=x.gapStroke,strokeWidth:l=x.gapStrokeWidth,dashed:u=true,fontSize:h=x.gapFontSize,fontFill:c=x.gapFontColor,labelBaseline:d="middle",labelRotate:p,metrics:g,band:f}=n,y=()=>{if(!f)return [];let b=f.height??6,[S,v]=r,w=Math.max(S,v);return e.map(_=>{let j=t.map(_.startTime),A=t.map(_.endTime);return {type:"rect",x:Math.min(j,A),y:w-b+(f.offset??0),w:Math.abs(A-j),h:b,fill:f.fill??m,opacity:f.opacity??.75}})};return we({timeScale:t,yRange:r,height:i,metrics:g,ranges:e.map(b=>{let S=b.style??"dashed_border",v=S==="filled"||S==="dashed_border",w=S==="dashed_border"&&u!==false;return {startTime:b.startTime,endTime:b.endTime,...v&&{fill:b.fill??o,hatch:b.hatch??s,opacity:b.fillOpacity??a},...w&&{edges:{stroke:m,strokeWidth:l}},label:b.label,labelPosition:b.labelBaseline??d,labelColor:c,fontSize:h,rotate:b.rotate??p}})}).concat(y())}function At(n){let{gap:e,runs:t,timeScale:r,valueScale:i,metrics:o,lineColor:s}=n,a=[],m=e.bridge,l=[];for(let u=1;u<t.length;u++){let h=t[u-1][t[u-1].length-1],c=t[u][0];if(e.display==="bridge_line"){if(h.value===null||c.value===null)continue;a.push({type:"line",x1:r.map(h.time),y1:i.map(h.value),x2:r.map(c.time),y2:i.map(c.value),stroke:m?.color??s??x.stroke,strokeWidth:m?.width??1.5,dash:m?.style??"dotted"});}else l.push({startTime:h.time,endTime:c.time});}if(l.length>0){let u=e.display&&e.display!=="bridge_line"?e.display:"dashed_border",h=e.fill,c=typeof h=="string"?h:h?.color,d=i.range();a.push(...qe({gaps:l.map(p=>({...p,style:u})),timeScale:r,yRange:[Math.min(d[0],d[1]),Math.max(d[0],d[1])],fill:c,hatch:typeof h=="object"?h.hatch:void 0,fillOpacity:e.opacity??.15,labelBaseline:e.label?.baseline,labelRotate:e.label?.rotate,metrics:o,band:e.band}));}return a}var Ct={display:"dashed_border",fill:{color:"#94a3b8",hatch:"classic-diagonal"},opacity:.5,label:{rotate:"auto"}},Mt=6e4,sr=60*Mt,ar=24*sr;function lr(n){let e=Math.floor(n/Mt);if(e<60)return `${e} min`;if(n<ar){let i=Math.floor(e/60),o=e%60;return o===0?`${i} h`:`${i} h ${o} min`}let t=Math.floor(e/1440),r=Math.floor(e%1440/60);return r===0?`${t} d`:`${t} d ${r} h`}function mr(n,e,t){let r=n.format(e,{hour:"2-digit",minute:"2-digit"}),i=o=>n.format(o,{year:"numeric",month:"2-digit",day:"2-digit"});return i(e)===i(t)?r:`${n.format(e,{day:"numeric",month:"short"})} ${r}`}function ur(n,e,t){let r=null;for(let i of n)i.value===null||i.time<e||i.time>t||(r===null||i.time>r)&&(r=i.time);return r}function Lt(n){let{atEnd:e,series:t,timeScale:r}=n,[i,o]=r.domain(),s=e.now??o,a=new Set;for(let l of t){if(!("data"in l)||l.data.length===0||!("value"in l.data[0]))continue;let u="gaps"in l?l.gaps?.atEnd:void 0;if(u===false||"holdToEnd"in l&&l.holdToEnd)continue;let h=u?.afterMs??e.afterMs,c=ur(l.data,i,s);c!==null&&s-c>h&&a.add(c);}let m={...Ct,...e.style,label:{...Ct.label,...e.style?.label}};return [...a].sort((l,u)=>l-u).map(l=>{let u=s-l,h=e.label,c=typeof h=="function"?h(l,u):h?.replaceAll("{since}",mr(r,l,s)).replaceAll("{duration}",lr(u));return {startTime:l,endTime:s,label:c,style:m}})}var hr=1,ve=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 u of e){let h=t.map(u.startTime),c=t.map(u.endTime);if(c<s[0]||h>s[1])continue;let d=Math.max(s[0],Math.min(s[1],h)),p=Math.max(s[0],Math.min(s[1],c)),g=Math.max(p-d,hr);d+g>s[1]&&(d=Math.max(s[0],s[1]-g));let f=d+g/2;if(l.push({type:"rect",x:d,y:a,w:g,h:m,hatch:u.hatch??i,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let y=u.labelFontSize??10;l.push({type:"text",content:u.label,x:f,y:this.#t(u.labelBaseline,y),anchor:"middle",fontSize:y,fill:u.labelFill??"#333"});}}if(o){let u=new te({domain:t.domain(),xRange:s,y:a+m+4});l.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return l}#t(e,t){let{y: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 Dt(n){let{highlights:e,timeScale:t,yRange:r,height:i}=n;return we({metrics:n.metrics,timeScale:t,yRange:r,height:i,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??x.highlightColor,opacity:o.opacity??x.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??x.highlightLabelColor,fontSize:x.annotationFontSize,rotate:o.rotate}))})}var $t=n=>n==="chartTop"||n==="chartBottom"||typeof n=="object"&&("threshold"in n||"value"in n);function Pt(n,e){let t=new Set(e.map(o=>o.id??o.name)),r=o=>n.some(s=>(s.id??s.name)===o||s.name===o),i=[];return n.forEach((o,s)=>{let a="colorByThresholds"in o?o.colorByThresholds:void 0;for(let u of a??[])t.has(u)||i.push(`series ${s} colorByThresholds names unknown threshold "${u}"`);let m=o.style?.fill;(m&&typeof m=="object"&&"regions"in m?m.regions??[]:[]).forEach((u,h)=>{let c=`series ${s} fill region ${h}`;for(let f of [u.from,u.to,u.outer])f&&typeof f=="object"&&"threshold"in f&&!t.has(f.threshold)&&i.push(`${c} references unknown threshold "${f.threshold}"`),f&&typeof f=="object"&&"series"in f&&!r(f.series)&&i.push(`${c} references unknown series "${f.series}"`);let d=u.from??"chartBottom",p=u.to??"series",g=d==="series"&&$t(p)||p==="series"&&$t(d);u.side&&!g&&i.push(`${c} sets side, which only applies between the line and a fixed bound`),u.outer&&!u.side&&i.push(`${c} sets outer without side -- outer has no effect`);});}),i}function Rt(n){return [...fr(n.series.map(e=>e.id??e.name)),...cr(n.series,n.linienGrundlage),...dr(n.gaps.map(e=>e.style)),...pr(n.series.map(e=>!O(e)&&!!e.style?.gap?.label)),...gr(n.series.map(e=>"sensorType"in e?e.sensorType:void 0)),...Pt(n.series,n.thresholds)]}function cr(n,e){let t=[],r=i=>n.find(o=>(o.id??o.name)===i||o.name===i);return n.forEach((i,o)=>{if(O(i))return;let s=i.style?.fill,a=s&&typeof s=="object"&&"regions"in s?s.regions:[],m=new Set;for(let l of a)if(l.where)for(let u of [l.from??"chartBottom",l.to??"series"]){let h=u==="series"?i:typeof u=="object"&&"series"in u?r(u.series):void 0;if(!h||O(h))continue;let{grundLinie:c,stepShape:d}=e(h),p=c?.smoothingType??"catmull-rom";d||!c?.smoothing||p==="monotone"||m.has(h.name)||(m.add(h.name),t.push(`series ${o}: fill where decides on the readings, but "${h.name}" is smoothed with ${p}, which can overshoot them -- the area may miss the line at its edges; smoothingType 'monotone' does not overshoot`));}}),t}function dr(n){let e=n.flatMap((t,r)=>t==="label"?[String(r)]:[]);return e.length?[`gap ${e.join(", ")} uses style "label" -- deprecated, removed before 2.0; use style "empty" with a label`]:[]}function pr(n){let e=n.flatMap((t,r)=>t?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set style.gap.label -- deprecated, removed before 2.0; set the label style on gaps.style.label`]:[]}function fr(n){let e=new Map;return n.forEach((t,r)=>{e.set(t,[...e.get(t)??[],r]);}),[...e].filter(([,t])=>t.length>1).map(([t,r])=>`series ${r.join(", ")} share the id "${t}" -- hidden and pointsAt cannot tell them apart; give each a unique id`)}function gr(n){let e=n.flatMap((t,r)=>t&&t!=="numeric"?[String(r)]:[]);return e.length?[`series ${e.join(", ")} set sensorType -- deprecated, removed before 2.0; it has no effect on the chart, use enumMap for state series`]:[]}var Te=class{};var E=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,u)=>l-u),o=[],s=l=>l<=0?Number.NEGATIVE_INFINITY:i[l-1],a=l=>{let u=0;for(let h=0;h<i.length&&l>=i[h];h++)u=h+1;return u},m=[n[0]];for(let l=1;l<n.length;l++){let u=n[l-1],h=n[l],c=t(u),d=t(h),p;d>c?p=i.filter(f=>f>c&&f<=d):d<c?p=i.filter(f=>f>=d&&f<c).reverse():p=[];let g=c;for(let f of p){let y=(f-c)/(d-c),b=r(u,h,y);m.push(b);let S=a((g+f)/2);o.push({data:m,zoneIndex:S,zoneLow:s(S)}),m=[b],g=f;}(p.length===0||p[p.length-1]!==d)&&m.push(h);}if(m.length>1||n.length===1){let l=t(m[0]),u=t(m[m.length-1]),h=a((l+u)/2);o.push({data:m,zoneIndex:h,zoneLow:s(h)});}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 Bt(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 Ft(n,e,t){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(l=>l.value);r[o]={time:s,value:t(m),synthetic:true};}return r}var yr=8.314,jt=273.15,Et=83144;function br(n,e=Et){let t=e/yr,r=0,i=0;for(let s of n)s!==null&&(r+=Math.exp(-t/(s+jt)),i++);if(i===0)return null;let o=r/i;return t/-Math.log(o)-jt}function Gt(n,e,t=Et){return Ft(n,e,r=>br(r,t))}function xr(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 Sr(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 Ot(n,e,t=false){return Ft(n,e,t?Sr:xr)}function Je(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 u=n[l].value;u!==null&&(a+=u,m++);}t[i]={time:o,value:m===0?null:a/m,synthetic:true};}return t}function It(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 Y(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}function Wt(n,e,t){let r=[],i=ke(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 zt(n,e,t,r){if(n.length<2)return [];let i=E.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(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yLow(h))})),u=a.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:r?.id?`${r.id}-fill-${s}`:void 0,points:[...l,...u],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}var _e=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 wr="#ffffff",vr="#cccccc",Tr=6,kr=.85,W=12,Ce=8,me=20,_r=11,Ae=18,Qe=(n,e)=>e(n,_r);function Ht(n,e,t){let r=a=>W+Ce+Qe(a.name,e);if(t===void 0){let a=n.reduce((m,l)=>m+r(l)+Ae,0)-Ae;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+Ae+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 Vt(n,e="vertical",t=z,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*me}}let i=0;for(let o of n)i=Math.max(i,Qe(o.name,t));return {width:W+Ce+i,height:n.length*me}}function Ar(n){let{items:e,x:t,y:r,orientation:i="vertical",metrics:o=z,maxBreite:s,box:a,itemClass:m}=n,l=new _e;if(a&&e.length>0){let d=Vt(e,i,o,s),g=((i==="horizontal"?d.height/me:e.length)-1)*me+W,f=a.padding??Tr,y=a.stroke??vr;l.rect({x:t-f,y:r-f,w:d.width+2*f,h:g+2*f,fill:a.fill??wr,...y==="none"?{}:{stroke:y,strokeWidth:a.strokeWidth??1},opacity:a.opacity??kr});}let u=i==="horizontal"?Ht(e,o,s):e.map(d=>({items:[d],breite:0})),h=new Map;u.forEach((d,p)=>{let g=t;for(let f of d.items)h.set(f,{x:g,y:r+p*me}),g+=W+Ce+Qe(f.name,o)+Ae;});let c=e.some(d=>d.line!==void 0&&d.line!=="solid");return e.forEach(d=>{let p=h.get(d)??{x:t,y:r},g=p.x,f=p.y,y=["legend-item"];d.id&&y.push(`legend-item--${d.id}`),m&&y.push(m),l.group({cssClass:y.join(" "),...d.id?{id:`legend-${d.id}`}:{}},b=>{c?b.line({x1:g,y1:f+W/2,x2:g+W,y2:f+W/2,stroke:d.color,strokeWidth:Cr(d.width),...d.line&&d.line!=="solid"?{dash:d.line}:{}}):b.rect({x:g,y:f,w:W,h:W,fill:d.color,stroke:x.legendStroke,strokeWidth:1}),b.text({content:d.name,x:g+W+Ce,y:f+W-2,fontSize:x.legendFont,fill:x.legendText});});}),l.toGroup({cssClass:"chart-legend"})}function Nt(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?Vt(t,a,i,m):{width:0,height:0},boxRand:o&&e?.box?e.box.padding??6:0,box:e?.box,itemClass:e?.itemClass}}function Kt(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 Yt(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 u=r.filter(h=>h.position==="right").reduce((h,c)=>Math.max(h,c.bis),o+a);m=Math.min(Math.max(o+a+16,u+12),t.totalWidth-e.size.width-2),l=s;}else e.position==="above"||e.position==="below"?(m=Math.max(8,Math.min(t.totalWidth-e.size.width-8,o+(a-e.size.width)/2)),l=e.position==="above"?Math.max(4,s-e.size.height-10):t.totalHeight-e.size.height-4):(m=8,l=s);return [Ar({items:e.items,x:m,y:l,orientation:e.orientation,metrics:i,maxBreite:e.maxBreite,box:e.box,itemClass:e.itemClass})]}function Cr(n){return Math.min(Math.max(n??2,1.5),3)}function Xt(n){let{xTicks:e,yTicks:t,xRange:r,yRange:i,stroke:o=x.gridStroke,strokeWidth:s=x.gridStrokeWidth,dashed:a=false,opacity:m=x.gridOpacity}=n,l=[];if(t)for(let u of t)l.push({type:"line",x1:r[0],y1:u,x2:r[1],y2:u,stroke:o,strokeWidth:s,dashed:a,opacity:m});if(e)for(let u of e)l.push({type:"line",x1:u,y1:i[0],x2:u,y2:i[1],stroke:o,strokeWidth:s,dashed:a,opacity:m});return l}function Zt(n){let{axes:e,timeAxis:t,primaryValueAxis:r,xRange:i,yRange:o}=n,s=X(e?.x?.grid),a=X(e?.left?.grid),m=s?.layer??a?.layer??"front",l=s?.major,u=a?.major,h=w=>w!==void 0&&w!==false;if(!h(l)&&!h(u))return {group:null,layer:m};let c=l!==false,d=u!==false&&!!r,p=c?t.generateTicks().map(w=>w.x):void 0,g=d?r.generateTicks().map(w=>w.position):void 0;if(!p&&!g)return {group:null,layer:m};let f=(l&&typeof l=="object"?l:void 0)??(u&&typeof u=="object"?u:void 0),y=s?.minor,b=a?.minor,S=(y&&typeof y=="object"?y:void 0)??(b&&typeof b=="object"?b:void 0);return {group:{type:"group",cssClass:"chart-grid",sharedStyles:true,commands:[...y!==void 0||b!==void 0?Xt({xTicks:y!==false&&c?t.generateMinorTicks():void 0,yTicks:b!==false&&d?r.generateMinorTicks():void 0,xRange:i,yRange:o,stroke:S?.color,opacity:S?.opacity??(x.gridOpacity??1)*.5,dashed:S?.style==="dashed"}):[],...Xt({xTicks:p,yTicks:g,xRange:i,yRange:o,stroke:f?.color,opacity:f?.opacity,dashed:f?.style==="dashed"})]},layer:m}}function Ut(n){let e=[],t=r=>{r.type==="group"?r.commands.forEach(t):r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.push(r.y1);};return n.forEach(t),e}function qt(n,e){if(e.length===0||n.type!=="group")return n;let t=r=>r.type==="line"&&r.y1===r.y2&&r.x1!==r.x2&&e.some(i=>Math.abs(i-r.y1)<.5);return {...n,commands:n.commands.filter(r=>!t(r))}}function et(n,e,t){let r=(o,[s,a])=>o>=Math.min(s,a)&&o<=Math.max(s,a);if(!r(n.time,e.domain()))return false;if(n.value===void 0||!t)return true;let i=t.get(n.axis??0)??t.values().next().value;return !i||r(n.value,i.domain())}function Jt(n){let{annotations:e,timeScale:t,valueScales:r,plot:i}=n,o=[],s=m=>!i||et(m,t,r),a=m=>{let l=r.get(m.axis??0)??r.values().next().value;return {x:t.map(m.time),y:l?l.map(m.value):0}};for(let m of e){let l=[],u=d=>l.push(d);if((m.type==="point"||m.type==="label")&&!s(m.at))continue;let h=i!==void 0&&(m.type==="line"||m.type==="arrow"||m.type==="rect")&&!(s(m.from)&&s(m.to)),c=h?{clipRect:i}:{};switch(m.type){case "line":{let d=a(m.from),p=a(m.to);u({type:"line",x1:d.x,y1:d.y,x2:p.x,y2:p.y,stroke:m.color??x.annotationColor,strokeWidth:m.width??x.annotationWidth,dash:m.dash});break}case "arrow":{let d=a(m.from),p=a(m.to),g=m.color??x.annotationColor,f=m.headSize??x.annotationHead;u({type:"line",x1:d.x,y1:d.y,x2:p.x,y2:p.y,stroke:g,strokeWidth:m.width??x.annotationWidth});let y=Math.hypot(p.x-d.x,p.y-d.y)||1,b=(p.x-d.x)/y,S=(p.y-d.y)/y,v=p.x-b*f,w=p.y-S*f;u({type:"path",points:[{x:p.x,y:p.y},{x:v-S*f*.5,y:w+b*f*.5},{x:v+S*f*.5,y:w-b*f*.5}],fill:g,stroke:"none"});break}case "rect":{let d=a(m.from),p=a(m.to);u({type:"rect",x:Math.min(d.x,p.x),y:Math.min(d.y,p.y),w:Math.abs(p.x-d.x),h:Math.abs(p.y-d.y),fill:m.fill??"none",hatch:m.hatch,stroke:m.stroke,opacity:m.opacity});break}case "point":{let d=a(m.at),p=m.color??"#334155",g=m.radius??x.annotationRadius,f=m.shape??"circle";f==="circle"?u({type:"circle",cx:d.x,cy:d.y,r:g,fill:p}):f==="square"?u({type:"rect",x:d.x-g,y:d.y-g,w:g*2,h:g*2,fill:p}):(u({type:"line",x1:d.x-g,y1:d.y-g,x2:d.x+g,y2:d.y+g,stroke:p,strokeWidth:1.5}),u({type:"line",x1:d.x-g,y1:d.y+g,x2:d.x+g,y2:d.y-g,stroke:p,strokeWidth:1.5}));break}case "label":{let d=a(m.at);u({type:"text",content:m.text,x:d.x+(m.dx??0),y:d.y+(m.dy??0),anchor:m.anchor??Mr(d.x+(m.dx??0),m.text,n),fontSize:x.annotationFontSize,fill:m.color??x.annotationColor,rotate:m.rotate});break}}if(m.id&&l.length>0){let d=K(m.id);o.push({type:"group",cssClass:`annotation annotation--${d}`,...c,commands:l});}else h&&l.length>0?o.push({type:"group",cssClass:"annotation",...c,commands:l}):o.push(...l);}return o}function Mr(n,e,t){let{metrics:r,timeScale:i}=t;if(!r)return "middle";let[o,s]=i.range(),a=r(e,x.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 Me=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??x.bandFill,r=e.hatch,i=e.avgLine??false,o=e.avgLineColor??x.bandAvgLine,s=e.bandWidth??10,a=[];for(let m of this.data){if(m.min===null||m.max===null)continue;let l=this.timeScale.map(m.time),u=e.valueScale.map(m.max),h=e.valueScale.map(m.min),c=s,d=this.data.indexOf(m);if(a.push({type:"rect",x:l-c/2,y:u,w:c,h:h-u,fill:t,hatch:r,opacity:this.opacity(m.count),id:this.id?`${this.id}-slot-${d}`:void 0}),i&&m.avg!==null){let p=e.valueScale.map(m.avg);a.push({type:"line",x1:l-c/2,y1:p,x2:l+c/2,y2:p,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${d}`:void 0});}}return a}};function Qt(n,e,t,r,i,o,s){return zt(n,e,{boundaries:[],yLow:a=>a.avg,yHigh:t,getValue:a=>a.avg,interpolate:E.interpolateAggregatedPoint,getColor:()=>r,getHatch:()=>i},{id:o,...s})}var Le=class extends re{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??x.minColor,r=e.maxColor??x.maxColor,i=e.avgColor??x.avgColor,o=e.avgDashed??true,s=e.smoothing??false,a=e.smoothingType,m=e.strokeWidth??x.strokeWidth,l=E.getRuns(this.data,p=>p.min===null||p.max===null||p.avg===null);if(l.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];l.forEach((p,g)=>{if(p.length<2)return;let f=y=>this.id?`${this.id}-${y}-${g}`:void 0;if(e.fillToMax){let y=Qt(p,u,b=>b.max,e.fillToMax,e.fillToMaxHatch,f("fillToMax"),{smoothing:s,smoothingType:a});h.push(...y);}if(e.fillToMin){let y=Qt(p,u,b=>b.min,e.fillToMin,e.fillToMinHatch,f("fillToMin"),{smoothing:s,smoothingType:a});h.push(...y);}});let c=l.filter(p=>p.length>=2),d=(p,g,f,y=false)=>Wt(c.map(b=>({data:b.map(S=>({time:S.time,value:p(S)}))})),u,{stroke:g,strokeWidth:m,smoothing:s,smoothingType:a,dashed:y,id:this.id?`${this.id}-${f}`:void 0});return h.push(...d(p=>p.max,r,"max"),...d(p=>p.min,t,"min"),...d(p=>p.avg,i,"avg",o)),h}};function ke(n){return {id:n.id,line:{stroke:n.stroke??x.stroke,strokeWidth:n.strokeWidth??x.strokeWidth,smoothing:n.smoothing??false,smoothingType:n.smoothingType,dashed:n.dashed??false},fill:n.fill??x.areaFillAlpha,markers:{type:n.pointStyle??"none",size:n.pointSize??x.pointSize,stroke:n.stroke??x.stroke,fill:"#ffffff"},shadow:{color:n.shadowColor??"transparent",blur:n.shadowBlur??0,offsetX:n.shadowOffsetX??0,offsetY:n.shadowOffsetY??0}}}function en(n,e,t,r){let i=ke(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),u=r(a),h=t.pointStroke??u,c=t.pointFill??u,d=t.pointStrokeWidth??1.5,p=t.id?`${t.id}-marker-${s}`:void 0;De(o,p,i.markers.type,m,l,i.markers.size,h,c,d);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function De(n,e,t,r,i,o,s,a,m){let l=u=>e===void 0?void 0:`${e}-${u}`;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 u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,d=Math.PI/2*3+h*Math.PI/5;u.push({x:r+c*Math.cos(d),y:i+c*Math.sin(d)});}n.push({type:"path",points:u,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 u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:r+o*Math.cos(c),y:i+o*Math.sin(c)});}n.push({type:"path",points:u,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});}}function tn(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),u=m.color??x.markerColor,h=m.pointStyle??(m.value!==void 0?"circle":"none"),c=m.lineStyle??"full";if(m.value!==void 0){let d=r.map(m.value);if(c==="to-value"?a.push({type:"line",x1:l,y1:s,x2:l,y2:d,stroke:u,strokeWidth:1,dashed:true}):c==="to-top"?a.push({type:"line",x1:l,y1:o,x2:l,y2:d,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),h!=="none"&&De(a,void 0,h,l,d,x.markerSize,u,u,1.5),m.label){let p=c==="to-value"?d-10:o-6;a.push({type:"text",content:m.label,x:l,y:p,anchor:"middle",fontSize:x.markerFontSize,fill:u});}}else c!=="none"&&a.push({type:"line",x1:l,y1:o,x2:l,y2:s,stroke:u,strokeWidth:1}),m.label&&a.push({type:"text",content:m.label,x:l,y:o-6,anchor:"middle",fontSize:x.markerFontSize,fill:u});}return a}function nn(n){let e=[],t=n.markers.filter(i=>et({time:i.time},n.timeScale)).map(i=>({...i}));for(let i of t)if(i.value===void 0&&(i.lineStyle==="to-value"||i.lineStyle==="to-top")){let o=n.series[i.seriesIndex??0];o&&!O(o)&&o.data.length>=2&&(i.value=Lr(i.time,o.data));}if(t.length>0&&n.primaryScale){let i=[];for(let o of t){let s=n.primaryScale,a=n.series[o.seriesIndex??0];a&&(s=n.valueScales.get(n.achseVon(a))??n.primaryScale),i.push(...tn({markers:[o],timeScale:n.timeScale,valueScale:s,yRange:n.yRange}));}e.push({type:"group",cssClass:"markers",commands:i});}let r=n.annotations;return r.length>0&&e.push({type:"group",cssClass:"annotations",commands:Jt({annotations:r,timeScale:n.timeScale,valueScales:n.valueScales,metrics:n.metrics,plot:n.plot})}),e}function Lr(n,e){for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t];if(!(r.value===null||i.value===null)&&n>=r.time&&n<=i.time){if(i.time===r.time)return r.value;let o=(n-r.time)/(i.time-r.time);return r.value+o*(i.value-r.value)}}}var Dr=(()=>{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 tt(n){let e=new TextEncoder().encode(n),t=4294967295;for(let r of e)t=Dr[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function V(n,e){return e||"s-"+tt(n??"").toString(16).padStart(8,"0")}function rn(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 Le({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:V(n.name,n.id)}).render():new Me({data:n.data,timeScale:e,valueScale:t,fill:i??r?.color,avgLine:n.avgLine,countOpacity:n.countOpacity,id:V(n.name,n.id)}).render()}function on(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 u=e.get(l);!u||o<u.value||u.value<m||(m=u.value,a=u.color??a);}return a}}}function sn(n,e,t){if(!n.holdToEnd)return;let r=n.data.at(-1);if(!r||r.value===null)return;let i=t??e.domain()[1],o=typeof n.holdToEnd=="object"?n.holdToEnd.maxAgeMs:void 0;return o!==void 0&&(i=Math.min(i,r.time+o)),i>r.time?i:void 0}function $e(n,e){if(e===void 0||n.length===0)return n;let t=n[n.length-1],r=t[t.length-1];return [...n.slice(0,-1),[...t,{time:e,value:r.value}]]}function an(n){let{series:e,ctx:t,runs:r,haltBis:i,totalPoints:o,style:s,styleLine:a,styleMarkers:m,stepShape:l,thresholds:u}=n,{timeScale:h,valueScale:c}=t,d=[],p=on(e.colorByThresholds,u,s.stroke),g=p.grenzen,f=new Map,y=[];for(let S of r){let _=function(k){let C=S===r[r.length-1]?$e([S],i)[0]:S;return E.splitByBoundaries(k==="step"?Y(C):C,g,$=>$.value,E.interpolateDataPoint)};if(S.length<1)continue;let v=V(e.name,e.id),w=new Map,j=k=>{let C=w.get(k);return C||(C=_(k),w.set(k,C)),C},A=(k,C,$)=>{let F=j(k);for(let G of F){let B=G,H=f.get($)??0;if(f.set($,H+1),B.data.length<1)continue;let M=B.zoneLow;if(B.data.length===1){let L=p.farbe(M,C.color);d.push({type:"circle",id:v?`${v}-dot-${H}${$}`:void 0,cx:h.map(B.data[0].time),cy:c.map(B.data[0].value),r:Math.max(s.pointSize??x.pointSize,C.width??s.strokeWidth??x.strokeWidth),fill:L,shadowColor:s.shadowColor,shadowBlur:s.shadowBlur});continue}d.push({type:"path",cssClass:"series-line",id:v?`${v}-line-${H}${$}`:void 0,points:B.data.map(L=>({x:h.map(L.time),y:c.map(L.value)})),stroke:p.farbe(M,C.color),strokeWidth:C.width??s.strokeWidth,smoothing:k==="step"?false:C.smoothing??s.smoothing,smoothingType:C.smoothingType??s.smoothingType,dash:C.style,opacity:C.opacity,fill:"none",shadowColor:s.shadowColor,shadowBlur:s.shadowBlur,shadowOffsetX:s.shadowOffsetX,shadowOffsetY:s.shadowOffsetY});}};a===false||(Array.isArray(a)?a.forEach((k,C)=>{A(k.shape??(e.seriesType==="step"?"step":"line"),k,`-${C}`);}):A(l?"step":"line",a??{},"")),y.push(...S);}return s.pointStyle&&s.pointStyle!=="none"&&o<=(m?.threshold??x.pointThreshold)&&d.push(...en(y,t,s,S=>p.farbe(S.value))),d}function mn(n,e){for(let t of n){if(t.length===0||e<t[0].time||e>t[t.length-1].time)continue;let r=0;for(;r<t.length-1&&t[r+1].time<=e;)r++;return {lauf:t,i:r}}return null}function Pe(n,e,t){if(n.art==="fest")return n.wert;let r=mn(n.laeufe,e);if(!r)return null;let{lauf:i,i:o}=r,s=i[o];if(n.stufe)return t&&s.time===e&&o>0?i[o-1].value:s.value;if(s.time===e||o===i.length-1)return s.value;let a=i[o+1];return s.value+(a.value-s.value)*(e-s.time)/(a.time-s.time)}function ln(n,e,t){if(n.art==="fest")return true;let r=mn(n.laeufe,e);return r?t===void 0||e-r.lauf[r.i].time<=t:false}function un(n,e,t){let r=t.exceeds,i=t.side??"both",o=new Set;for(let l of [n,e])if(l.art==="laeufe")for(let u of l.laeufe)for(let h of u)o.add(h.time),t.maxAgeMs!==void 0&&o.add(h.time+t.maxAgeMs);let s=[...o].sort((l,u)=>l-u),a=[];for(let l=0;l+1<s.length;l++){let[u,h]=[s[l],s[l+1]],c=(u+h)/2;if(!ln(n,c,t.maxAgeMs)||!ln(e,c,t.maxAgeMs))continue;let d=Pe(e,u,false)-Pe(n,u,false),p=Pe(e,h,true)-Pe(n,h,true),g=(f,y)=>{if(f<=0&&y<=0)return null;if(f>0&&y>0)return [u,h];let b=u+(0-f)/(y-f)*(h-u);return f>0?[u,b]:[b,h]};if(i!=="below"){let f=g(d-r,p-r);f&&f[1]>f[0]&&a.push(f);}if(i!=="above"){let f=g(-d-r,-p-r);f&&f[1]>f[0]&&a.push(f);}}a.sort((l,u)=>l[0]-u[0]);let m=[];for(let l of a){let u=m[m.length-1];u&&l[0]<=u[1]?u[1]=Math.max(u[1],l[1]):m.push([l[0],l[1]]);}return m}function hn(n,e,t,r,i,o){let s=0,a=m=>m.type==="group"?{...m,commands:m.commands.map(a)}:"id"in m&&m.id!==void 0?{...m,...o(s++)}:m;return e.map(([m,l])=>{let u=t.map(m);return {type:"group",clipRect:{x:u,y:r,w:t.map(l)-u,h:i-r},commands:n.map(a)}})}function U(n){return n!==void 0&&typeof n=="object"&&"series"in n?n.series:null}function cn(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 dn(n){let e=[...n].sort((r,i)=>r.time-i.time),t=new Map;for(let r=1;r<e.length;r++){let[i,o]=[e[r-1],e[r]];i.time===o.time&&i.value!==null&&!t.has(i.time)&&t.set(i.time,i.value);}return t}function pn(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 $r(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function fn(n,e){let t=U(n);if(t!==null){let i=e.fremdeSerie?.(t);return i?{art:"laeufe",laeufe:E.getRuns(i.data,o=>o.value===null,i.gapThreshold),stufe:i.shape==="step"}:null}if(n==="series")return {art:"laeufe",laeufe:e.runs,stufe:e.shape==="step"};let r=e.valueScale.domain();return {art:"fest",wert:ue(n,e)??(n==="chartBottom"?r[0]:r[1])}}function gn(n,e,t){let r=Pr(n,e,t);if(!n.where||r.length===0)return r;let i=fn(n.from??"chartBottom",e),o=fn(n.to??"series",e);return !i||!o?r:hn(r,un(i,o,n.where),e.timeScale,e.chartTop,e.chartBottom,s=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${s}`}:{})}function Pr(n,e,t){let r=pn(n.from,"chartBottom",e),i=pn(n.to,"series",e),{color:o,hatch:s}=$r(n.fill),l={attrs:{type:"path",fill:o,hatch:s,stroke:"none",cssClass:"series-fill"},teilId:u=>e.idPrefix?{id:`${e.idPrefix}-fill-r${t}-${u}`}:{}};return U(n.from)!==null||U(n.to)!==null?jr(n,e,l):r!==null&&i!==null?Br(r,i,e,l):Fr(n,e,r,i,l)}function Rr(n,e,t){let r=e.shape==="step",i=(c,d)=>{let p=c??d,g=U(p);if(g!==null){let b=e.fremdeSerie(g);if(!b)return null;let S=b.shape==="step",v=E.getRuns(b.data,w=>w.value===null,b.gapThreshold).map(w=>S?Y(w):w);return {art:"fremd",skala:b.valueScale??e.valueScale,laeufe:v,glatt:!S&&!!b.smoothing,verfahren:b.smoothingType}}if(p==="series")return {art:"eigene",glatt:!r&&!!e.smoothing,verfahren:e.smoothingType};let f=ue(p,e),y=e.valueScale.domain();return {art:"fest",wert:f??(p==="chartBottom"?y[0]:y[1]),glatt:false}},o=i(n.from,"chartBottom"),s=i(n.to,"series");if(!o||!s||!o.glatt&&!s.glatt)return null;let a=c=>c.art==="fremd"?c.skala:e.valueScale,m=c=>d=>({x:e.timeScale.map(d.time),y:c.map(d.value)}),l=(c,d)=>c.art==="eigene"?[d]:c.art==="fremd"?c.laeufe.filter(p=>p.length>=2):[null],u=(c,d,p,g)=>d?d.map(m(a(c))):[p,g].map(f=>({x:e.timeScale.map(f),y:e.valueScale.map(c.wert)})),h=[];for(let c of e.runs){if(c.length<2)continue;let d=r?Y(c):c;for(let p of l(o,d))for(let g of l(s,d)){let f=Math.max(d[0].time,p?.[0].time??-1/0,g?.[0].time??-1/0),y=Math.min(d.at(-1).time,p?.at(-1)?.time??1/0,g?.at(-1)?.time??1/0);if(!(y>f))continue;let b={k:o,pts:u(o,p,f,y)},S={k:s,pts:u(s,g,f,y)};b.k.glatt||([b,S]=[S,b]);let v=_=>(_.art==="fest"?void 0:_.verfahren)??"catmull-rom",w=e.timeScale.map(f);h.push({type:"group",clipRect:{x:w,y:e.chartTop,w:e.timeScale.map(y)-w,h:e.chartBottom-e.chartTop},commands:[{...t.attrs,...t.teilId(h.length),points:[...b.pts,...[...S.pts].reverse()],smoothing:true,smoothingType:v(b.k),smoothCount:b.pts.length,...S.k.glatt?{smoothTail:S.pts.length,smoothTailType:v(S.k)}:{}}]});}}return h}function jr(n,e,t){if(!e.fremdeSerie){let a=U(n.from)??U(n.to);throw new Error(`fillSpec region references series '${a}', but no series lookup was provided`)}let r=Rr(n,e,t);if(r)return r;let i=(a,m,l)=>{let u=a??m,h=U(u);if(h!==null){let g=e.fremdeSerie(h);if(!g)throw new Error(`fillSpec region references unknown series '${h}'`);let f=g.shape==="step"?Y(g.data):g.data;return {bei:cn(f),davor:dn(f),zeiten:f.map(y=>y.time),skala:g.valueScale??e.valueScale}}if(u==="series")return {bei:cn(l),davor:dn(l),zeiten:l.map(g=>g.time),skala:e.valueScale};let c=ue(u,e),d=e.valueScale.domain(),p=c??(u==="chartBottom"?d[0]:d[1]);return {bei:()=>p,zeiten:[],skala:e.valueScale}},o=e.shape==="step",s=[];for(let a of e.runs){if(a.length<2)continue;let m=o?Y(a):a,l=i(n.from,"chartBottom",m),u=i(n.to,"series",m),h=m[0].time,c=m[m.length-1].time,d=[...new Set([...l.zeiten,...u.zeiten,...m.map(y=>y.time)])].filter(y=>y>=h&&y<=c).sort((y,b)=>y-b),p=[],g=[],f=()=>{if(p.length>=2){let y=[...g].reverse();s.push({...t.attrs,...t.teilId(s.length),smoothing:o?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:p.length,points:[...p,...y]});}p=[],g=[];};for(let y of d){let b=l.bei(y),S=u.bei(y);if(b===null||S===null){f();continue}let v=e.timeScale.map(y),w=l.davor?.get(y)??b,_=u.davor?.get(y)??S;(w!==b||_!==S)&&(p.push({x:v,y:u.skala.map(_)}),g.push({x:v,y:l.skala.map(w)})),p.push({x:v,y:u.skala.map(S)}),g.push({x:v,y:l.skala.map(b)});}f();}return s}function Br(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 Fr(n,e,t,r,i){let o=t??r,s=[],a=Er(n,e);if(a===null){let u=e.valueScale.domain();a=(t??r)===e.chartBottom?u[0]:u[1];}let m=ue(n.outer,e),l=e.shape==="step";for(let u of e.runs){if(u.length<2)continue;let h=l?Y(u):u,c=E.splitByThreshold(h,a,p=>p.value??a,E.interpolateDataPoint),d=n.side==="above"?c.above:n.side==="below"?c.below:[...c.above,...c.below];if(m!==null&&n.side){let p=m,g=n.side==="above"?f=>Math.min(f,p):f=>Math.max(f,p);d=d.map(f=>f.map(y=>({...y,value:g(y.value??p)})));}for(let p of d){if(p.length<2)continue;let g=p.map(y=>({x:e.timeScale.map(y.time),y:e.valueScale.map(y.value)})),f=[];for(let y of [...g].reverse()){let b=f[f.length-1];l&&b&&b.x===y.x||f.push({x:y.x,y:o});}s.push({...i.attrs,...i.teilId(s.length),smoothing:l?false:e.smoothing,smoothingType:e.smoothingType,smoothCount:g.length,points:[...g,...f]});}}return s}function Er(n,e){let t=n.from==="series"?n.to:n.from;return ue(t,e)}function ue(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 yn(n,e){if(typeof n=="string"||!("regions"in n))return gn({fill:n},e,0);let t=[];return n.regions.forEach((r,i)=>{t.push(...gn(r,e,i));}),t}function xn(n){let e=n.style?.line,t=e&&!Array.isArray(e)?e:void 0;return {color:t?.color??x.stroke,width:t?.width??x.strokeWidth,dash:t?.style,smoothing:t?.smoothing??false,smoothingType:t?.smoothingType}}function bn(n,e,t,r,i){let o=n.filter(l=>l.value!==null);if(o.length<2)return [];let s=xn(t);e.merke?.({index:i,kind:t.kind,punkte:o.map(l=>({time:l.time,value:l.value})),farbe:s.color,...s.dash?{linie:s.dash}:{}});let a=o.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)}));return [{type:"path",cssClass:"series-line",id:e.idPrefix?`${e.idPrefix}-overlay-${i}-${r}`:`overlay-${i}-${r}`,points:a,stroke:s.color,strokeWidth:s.width,smoothing:s.smoothing,smoothingType:s.smoothingType,dash:s.dash,fill:"none"}]}function Sn(n,e,t=0){switch(n.kind){case "movingAverage":{let r=n.type==="exponential"?It(e.data,n.window):Je(e.data,n.window);return bn(r,e,n,"movingAvg",t)}case "movingMkt":{let r=Gt(e.data,n.window,n.activationEnergy);return bn(r,e,n,"movingMkt",t)}case "limits":{let r=[],i=e.timeScale.range(),o=i[0],s=i[1],a=xn(n),m=a.color,l=a.width,u=a.dash??"dashed",h=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`;return n.high!==void 0&&r.push({type:"line",id:`${h}limit-high`,x1:o,y1:e.valueScale.map(n.high),x2:s,y2:e.valueScale.map(n.high),stroke:m,strokeWidth:l,dash:u}),n.low!==void 0&&r.push({type:"line",id:`${h}limit-low`,x1:o,y1:e.valueScale.map(n.low),x2:s,y2:e.valueScale.map(n.low),stroke:m,strokeWidth:l,dash:u}),r}case "stdDevBand":{let r=n.multiplier??1,i=Je(e.data,n.window),o=Ot(e.data,n.window),s=[],a=[],m=[];for(let y=0;y<i.length;y++){let b=i[y].value,S=o[y].value;if(b===null||S===null)continue;let v=e.timeScale.map(i[y].time);s.push({x:v,y:e.valueScale.map(b+r*S)}),a.push({x:v,y:e.valueScale.map(b-r*S)}),m.push({time:i[y].time,value:b,low:b-r*S,high:b+r*S});}if(s.length<2)return [];let l=e.idPrefix?`${e.idPrefix}-overlay-${t}-`:`overlay-${t}-`,u=[],c=(typeof n.style?.fill=="string"||n.style?.fill&&!("regions"in n.style.fill)?n.style.fill:void 0)??"#94a3b833",{color:d,hatch:p}=Gr(c);u.push({type:"path",cssClass:"series-fill",id:`${l}stdDevBand`,points:[...s,...[...a].reverse()],fill:d,hatch:p,stroke:"none"});let g=n.style?.line,f=g&&!Array.isArray(g)?g:void 0;if(e.merke?.({index:t,kind:"stdDevBand",punkte:m,farbe:f?f.color??x.stroke:d,...f?.style?{linie:f.style}:{}}),f){let y=i.filter(b=>b.value!==null).map(b=>({x:e.timeScale.map(b.time),y:e.valueScale.map(b.value)}));y.length>=2&&u.push({type:"path",cssClass:"series-line",id:`${l}stdDevBand-mean`,points:y,stroke:f.color??x.stroke,strokeWidth:f.width??1.5,smoothing:f.smoothing,smoothingType:f.smoothingType,dash:f.style,fill:"none"});}return u}}}function Gr(n){return typeof n=="string"?{color:n}:{color:n.color,hatch:n.hatch}}function wn(n,e){let t=n.style?.line,r=t&&!Array.isArray(t)?t:void 0,i=Array.isArray(t)?t[0]:r,o=(i?.shape??n.seriesType)==="step",s=i||void 0,a=s?.gapThreshold??e??x.gapThreshold;return {styleLine:t,lineDefaults:r,gapThreshold:a,grundLinie:s,stepShape:o}}function vn(n,e,t,r,i=0){let o=n.timeScale,s={timeScale:o,valueScale:t};if(O(e))return rn(e,o,t);let{lineDefaults:a,gapThreshold:m}=n.linienGrundlage(e),l=E.getRuns(e.data,_=>_.value===null,m),u=l.reduce((_,j)=>_+j.length,0);if(u===0)return [];let h=[],c=e.style?.markers,d=e.style?.shadow,p={stroke:a?.color??n.palettenFarbe(i),strokeWidth:a?.width??x.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:d?.color,shadowBlur:d?.blur,shadowOffsetX:d?.offsetX,shadowOffsetY:d?.offsetY,id:V(e.name,e.id)},{styleLine:g,grundLinie:f,stepShape:y}=n.linienGrundlage(e),b=sn(e,o,n.jetzt),S=$e(l,b),v=e.style?.fill;if(v!==void 0){let _=t.range(),j=Math.min(_[0],_[1]),A=Math.max(_[0],_[1]);h.push(...yn(v,{runs:S,timeScale:o,valueScale:t,thresholds:r,chartTop:j,chartBottom:A,smoothing:f?.smoothing,smoothingType:f?.smoothingType,shape:y?"step":"line",fremdeSerie:k=>{let C=n.alleReihen.find(B=>(B.id??B.name)===k||B.name===k);if(!C||!("data"in C))return;let $=C.data;if($.length===0||!("value"in $[0]))return;let F=n.linienGrundlage(C),G=F.grundLinie;return {data:$,shape:F.stepShape?"step":"line",smoothing:G?.smoothing,smoothingType:G?.smoothingType,gapThreshold:F.gapThreshold,valueScale:n.valueScales.get(n.achseVon(C))}},idPrefix:V(e.name,e.id)}));}h.push(...an({series:e,ctx:s,runs:l,haltBis:b,totalPoints:u,style:p,styleLine:g,styleMarkers:c,stepShape:y,thresholds:r}));let w=e.overlays;if(w&&w.length>0){let _=t.range(),j={data:e.data,timeScale:o,valueScale:t,chartTop:Math.min(_[0],_[1]),chartBottom:Math.max(_[0],_[1]),idPrefix:V(e.name,e.id),merke:A=>{n.merkeOverlay(i,A);}};w.forEach((A,k)=>{h.push(...Sn(A,j,k));});}return e.style?.gap&&l.length>1&&h.push(...At({gap:e.style.gap,runs:l,timeScale:o,valueScale:t,metrics:n.textMetrics,lineColor:a?.color})),h}function Tn(n,e,t){if(!e)return n;let r=`${e}-`,i=s=>s.split(/\s+/).filter(Boolean).map(a=>t.has(a)?a:r+a).join(" "),o=s=>{let a={...s};return a.cssClass&&(a.cssClass=i(a.cssClass)),a.type==="group"&&(a.commands=a.commands.map(o)),a};return n.map(o)}function kn(n,e,t){let i=new Array(n.length),o=e.map(s=>({position:s.position,von:s.von,bis:s.bis}));n.forEach((s,a)=>{if(s.fest===void 0)return;let m=s.position==="left"?s.achseX-s.fest:s.achseX+s.fest,l=s.schrift/2;o.push({position:s.position,von:m-l-1,bis:m+l+1,titel:true}),i[a]=m;});for(let s of ["left","right"]){let a=s==="left",m=n.map((l,u)=>({t:l,i:u})).filter(l=>l.t.position===s&&l.t.fest===void 0).sort((l,u)=>a?u.t.achseX-l.t.achseX:l.t.achseX-u.t.achseX);for(let{t:l,i:u}of m){let h=l.schrift/2,c=o.filter(g=>g.position===s),d=l.kante,p=a?d-1-h:d+1+h;for(let g=0;g<=c.length;g++){let f=p-h-1,y=p+h+1,b=c.find(S=>f<S.bis&&S.von<y);if(!b)break;d=a?b.von:b.bis,p=a?d-1-h:d+1+h;}if(a?p-h<2:p+h>t-2){let g=o.filter(f=>f.position===s&&f.titel);p=a?h+2:t-h-2;for(let f=0;f<=g.length;f++){let y=p-h-1,b=p+h+1,S=g.find(v=>y<v.bis&&v.von<b);if(!S)break;p=a?S.bis+1+h:S.von-1-h;}}o.push({position:s,von:p-h-1,bis:p+h+1,titel:true}),i[u]=p;}}return {xs:i,belegt:o}}function _n(n){let{axes:e,neueForm:t,achsenTitel:r,titelSpuren:i,layout:o}=n,{chartX:s,chartY:a,chartWidth:m,chartHeight:l}=o,u=t?void 0:e?.left?.label,h=t?void 0:e?.right?.label,c=e?.x?.label;if(!u&&!h&&!c&&r.length===0)return [];let d=[],p=a+l/2,g=e?.left?.labels,f=e?.right?.labels,y=e?.x?.labels,b=e?.left?.labelOffset,S=e?.right?.labelOffset;return u&&d.push({type:"text",content:u,x:b===void 0?14:s-(e?.left?.offset??0)-b,y:p,anchor:"middle",fontSize:g?.fontSize??x.axisLabelSize,fill:g?.color??x.axisLabelColor,rotate:-90}),h&&d.push({type:"text",content:h,x:S===void 0?o.totalWidth-14:s+m+(e?.right?.offset??0)+S,y:p,anchor:"middle",fontSize:f?.fontSize??x.axisLabelSize,fill:f?.color??x.axisLabelColor,rotate:90}),r.forEach((v,w)=>{d.push({type:"text",content:v.text,x:i[w],y:p,anchor:"middle",fontSize:v.style?.fontSize??x.axisLabelSize,fill:v.style?.color??x.axisLabelColor,rotate:v.position==="right"?90:-90});}),c&&d.push({type:"text",content:c,x:s+m/2,y:o.totalHeight-6-(n.untenBelegt??0),anchor:"middle",fontSize:y?.fontSize??x.axisLabelSize,fill:y?.color??x.axisLabelColor}),d.length===0?[]:[{type:"group",cssClass:"axis-labels",commands:d}]}var N=class{_layout;_idPraefix;_klassenPraefix;_renderer;_locale;_timeZone;_fontFamily;_legend;_textMetrics;_theme;_overlayWerte=new Map;_clipSeries;_markers;_thresholds;_highlights;_gaps;_gapsBand;_gapsAutoDetect;_gapsMinGapMs;_gapsAtEnd;_annotations;_annotationBands;_disabledAnnotations=new Set;_annotationSeq=0;_axes;_series;_timeScale;_valueScales=new Map;constructor(e={}){this._layout=new oe({width:e.width??800,height:e.height??400,margin:e.margin??{top:20,right:20,bottom:40,left:60}}).compute(),this._renderer=e.renderer,this._locale=e.locale,this._timeZone=e.timeZone,this._fontFamily=e.fontFamily,this._idPraefix=e.idPrefix,this._klassenPraefix=e.classPrefix,this._legend=e.legend,this._textMetrics=e.textMetrics??z,this._theme=e.theme,this._clipSeries=e.clipSeries??true,this._markers=e.markers??[],this._thresholds=e.thresholds??[],this._highlights=e.highlights??[];let t=dt(e.gaps);this._gaps=t.gaps,this._gapsAutoDetect=t.autoDetect,this._gapsMinGapMs=t.minGapMs,this._gapsBand=t.band,this._gapsAtEnd=t.atEnd,this._annotations=e.annotations??[],this._annotationBands=e.annotationBands??[],this._axes=e.axes,this._series=[],e.series&&this.setData(e.series);}getWidth(){return this._layout.totalWidth}getHeight(){return this._layout.totalHeight+this._annotationBandTotalHeight()}get series(){return this._series}_annotationBandTotalHeight(){let e=0;for(let t of this._annotationBands){let 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=Nt({legend:this._legend,items:this._legendItems(),gesamtbreite:this._layout.totalWidth,metrics:this._textMetrics}),t=this._layout,r=Kt(e,this._layout.margin);return r&&(t=new oe({width:this._layout.totalWidth,height:this._layout.totalHeight,margin:r}).compute()),{layout:t,legende:e}}renderCommands(){let e=this._klassenPraefix,t=new Set((this._legend?.itemClass??"").split(/\s+/).filter(Boolean));return ae(this._theme,()=>Tn(this._zeichne(),e,t))}_zeichne(){if(this._overlayWerte.clear(),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 M of this._series)M.data.sort((L,D)=>L.time-D.time);let u=new Map,h=1/0,c=-1/0,d=false;for(let M of this._series){let L=this._axisIndexOf(M),D=u.get(L);D?D.push(M):u.set(L,[M]);for(let P of this._timesOf(M))P<h&&(h=P),P>c&&(c=P),d=true;}if(!d)return [];let p=this._axes?.x?.domain,g=p&&p!=="auto"?p:[h,c];this._timeScale=new Q({domain:g,range:a,locale:this._locale,timeZone:this._timeZone});let f=new te({domain:g,xRange:a,y:i+s,locale:this._locale,timeZone:this._timeZone,format:this._axes?.x?.format,maxTicks:this._axes?.x?.ticks?.major,minorTicks:be(this._axes?.x?.ticks?.minor,X(this._axes?.x?.grid)?.minor),colors:ye(this._axes?.x?.axis,this._axes?.x?.labels),gesamtbreite:e.totalWidth,metrics:this._textMetrics});this._valueScales.clear();let y=Array.from(u.keys()).sort((M,L)=>M-L),b=Tt({axes:this._axes,indices:y,seriesByIndex:u,layout:e,thresholds:this._thresholds,metrics:this._textMetrics});l.push(...b.commands);let{titel:S,baender:v,neueForm:w}=b,_=b.primary;for(let[M,L]of b.scales)this._valueScales.set(M,L);let j=this._valueScales.get(0)??this._valueScales.get(y[0]);l.push({type:"group",cssClass:"time-axis",sharedStyles:true,commands:f.render()});let A=Zt({axes:this._axes,timeAxis:f,primaryValueAxis:_,xRange:a,yRange:m}),k=A.group;k&&A.layer==="back"&&(l.push(k),k=null),this._highlights.length>0&&l.push({type:"group",cssClass:"highlights",commands:Dt({metrics:this._textMetrics,highlights:this._highlights,timeScale:this._timeScale,yRange:m,height:e.totalHeight})});let C=j?kt({thresholds:this._thresholds,valueScales:this._valueScales,primaryScale:j,xRange:a,layout:e}):[];l.push(...C);let $=this._gapsAtEnd?Lt({atEnd:this._gapsAtEnd,series:this._series,timeScale:this._timeScale}).map(M=>Ke(M,void 0)):[],F=[...this._gaps,...$];if(this._gapsAutoDetect){let M=[];for(let L of this._series){if(O(L))continue;let D=L.data.filter(P=>P.value!==null);M.push(...Bt(D,this._gapsMinGapMs));}M.length>0&&(F=[...F,...M]);}F.length>0&&l.push({type:"group",cssClass:"gaps",commands:qe({gaps:F,timeScale:this._timeScale,yRange:m,height:e.totalHeight,metrics:this._textMetrics,band:this._gapsBand})});let G=new Map(this._thresholds.map(M=>[M.id??M.name,M]));for(let[M,L]of this._series.entries()){if(L.data.length===0)continue;let D=this._valueScales.get(this._axisIndexOf(L));if(!D)continue;let P=K(L.id??L.name);l.push({type:"group",cssClass:`series series--${P}`,id:`series-${P}`,commands:vn(this._reihenKontext(),L,D,G,M),...this._clipSeries?{clipRect:{x:r,y:i,w:o,h:s}}:{}});}if(k&&l.push(qt(k,Ut(C))),l.push(...nn({markers:this._markers,annotations:this._annotations.filter(M=>!M.id||!this._disabledAnnotations.has(M.id)),series:this._series,timeScale:this._timeScale,valueScales:this._valueScales,achseVon:M=>this._axisIndexOf(M),primaryScale:j,yRange:m,metrics:this._textMetrics,plot:{x:r,y:i,w:o,h:s}})),this._annotationBands.length>0){let M=i+s+this._layout.margin.bottom,L=0;this._annotationBands.forEach(D=>{let P=D.height??12,J=D.spacing??0,R=M+L;(D.showAxis??false)&&(L+=26+J),L+=P+J,l.push({type:"group",cssClass:"annotation-band",commands:new ve({name:D.name,showAxis:D.showAxis??false,items:D.items,timeScale:this._timeScale,background:D.background,hatch:D.hatch},[r,r+o],R,P).render()});});}let{xs:B,belegt:H}=kn(S.map(M=>({achseX:M.achseX,kante:M.kante,position:M.position,schrift:M.style?.fontSize??x.axisLabelSize,fest:M.fest})),v,e.totalWidth);return l.push(...Yt({legende:t,layout:e,randBelegt:H,metrics:this._textMetrics})),l.push(..._n({axes:this._axes,neueForm:w,achsenTitel:S,titelSpuren:B,layout:e,untenBelegt:e.margin.bottom-this._layout.margin.bottom})),Ve(l,this._fontFamily??x.fontFamily),Ne(l,this._idPraefix),l}_linienGrundlage(e){return wn(e,this._gapsAutoDetect?this._gapsMinGapMs:void 0)}_reihenKontext(){return {timeScale:this._timeScale,alleReihen:this._series,valueScales:this._valueScales,achseVon:e=>this._axisIndexOf(e),linienGrundlage:e=>this._linienGrundlage(e),palettenFarbe:e=>this._palettenFarbe(e),jetzt:this._gapsAtEnd?.now,textMetrics:this._textMetrics,merkeOverlay:(e,t)=>{let r=this._overlayWerte.get(e)??[];r.push(t),this._overlayWerte.set(e,r);}}}legendItems(){return ae(this._theme,()=>this._legendeneintraege())}_legendeneintraege(){return this._legendItems()}_palettenFarbe(e){let t=x.palette;return t.length>0?t[e%t.length]:x.stroke}_legendItems(){return this._series.map((e,t)=>{let 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=O(e)?e.avgColor??x.avgColor:this._palettenFarbe(t);return {name:e.name,color:i[0]?.color??a,line:i.length===1?i[0].style:void 0,width:i.length<=1?i[0]?.width??x.strokeWidth:void 0,marker:s?o.type:void 0,id:K(e.id??e.name),seriesId:e.id??e.name}})}get renderer(){return this._renderer}get layout(){return ae(this._theme,()=>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}warnings(){return Rt({series:this._series,gaps:this._gaps,thresholds:this._thresholds,linienGrundlage:e=>this._linienGrundlage(e)})}pointsAt(e,t,r={}){return ae(this._theme,()=>this._punkteAm(e,t,r))}_punkteAm(e,t,r={}){if(!this._timeScale)return [];let i=this._legendItems();return ct(this._series,this._timeScale,(o,s)=>{let a=this._axisIndexOf(o),m=this._valueScales.get(a);if(!m)return;let l=O(o)?void 0:this._linienGrundlage(o);return {skala:m,achse:a,stufe:l?.stepShape??false,gapThreshold:l?.gapThreshold??0,farbe:i[s].color,linie:i[s].line,format:Or(o)??Se(this._axes,a)?.format,overlays:this._overlayWerte.get(s)}},this.plotRect,e,t,{...r,radius:r.radius??x.tooltipSnapRadius})}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 Or(n){let e=n.enumMap;return e?t=>e[t]??String(t):void 0}var Wr=.2,he=4,ie=1e-6,zr=6,Hr=.4;function Vr(n){return n?.map(e=>{let t=e.data;if(t.length<=4)return e;let r=(l,u)=>"avg"in l?u?l.max:l.min:l.value,i=new Set,o=0,s=0,a=-1,m=-1;t.forEach((l,u)=>{l.time<t[o].time&&(o=u),l.time>t[s].time&&(s=u);let h=r(l,false),c=r(l,true);h!==null&&(a<0||h<r(t[a],false))&&(a=u),c!==null&&(m<0||c>r(t[m],true))&&(m=u);});for(let l of [o,s,a,m])l>=0&&i.add(l);return {...e,data:t.filter((l,u)=>i.has(u))}})}function Nr(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,Wr*t],a=[[i,o],[i+r,o],[i,s],[i+r,s]],m=(n.rotate??0)*Math.PI/180,l=Math.cos(m),u=Math.sin(m),h=a.map(([d,p])=>n.x+d*l-p*u),c=a.map(([d,p])=>n.y+d*u+p*l);return {x0:Math.min(...h),y0:Math.min(...c),x1:Math.max(...h),y1:Math.max(...c)}}function ce(n,e){return {x0:Math.min(...n),y0:Math.min(...e),x1:Math.max(...n),y1:Math.max(...e)}}function An(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;An(r.commands,e,t);break}case "text":{let i=Nr(r,e);i&&t.push(i);break}case "line":t.push(ce([r.x1,r.x2],[r.y1,r.y2]));break;case "rect":t.push(ce([r.x,r.x+r.w],[r.y,r.y+r.h]));break;case "circle":t.push(ce([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(ce(r.points.map(i=>i.x),r.points.map(i=>i.y)));break;case "gap":t.push(ce([r.x1,r.x2],[r.y1,r.y2]));break}return t}function Kr(n,e={}){return Yr(n,e)}function Yr(n,e,t){let r=e.padding||4,i=Math.max(e.minimum||8,he),o=n.textMetrics??z,s=Vr(n.series),a=h=>{let c=new N({...n,series:s,margin:h}),d=c.renderCommands();return {kaesten:An(d,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)},u;for(let h=0;h<zr;h++){let c=a(l),d=a({...l,left:l.left+he,right:l.right-he}),p=a({...l,top:l.top+he,bottom:l.bottom-he}),g=d.kaesten.length===c.kaesten.length&&p.kaesten.length===c.kaesten.length,f=k=>g&&Math.abs(d.kaesten[k].x0-c.kaesten[k].x0)<ie,y=k=>g&&Math.abs(p.kaesten[k].y0-c.kaesten[k].y0)<ie,{plot:b}=c,S=b.x+b.width,v=b.y+b.height,w={left:0,right:0,top:0,bottom:0},_={left:0,right:0,top:0,bottom:0};c.kaesten.forEach((k,C)=>{f(C)?(k.x0<b.x-ie&&(_.left=Math.max(_.left,k.x1)),k.x1>S+ie&&(_.right=Math.max(_.right,c.breite-k.x0))):(w.left=Math.max(w.left,b.x-k.x0),w.right=Math.max(w.right,k.x1-S)),y(C)?(k.y0<b.y-ie&&(_.top=Math.max(_.top,k.y1)),k.y1>v+ie&&(_.bottom=Math.max(_.bottom,c.hoehe-k.y0))):(w.top=Math.max(w.top,b.y-k.y0),w.bottom=Math.max(w.bottom,k.y1-v));});let j=k=>_[k]>0?_[k]+r+w[k]:w[k]>0?w[k]+r:0,A={top:0,right:0,bottom:0,left:0};for(let k of ["top","right","bottom","left"]){let C=k==="top"||k==="bottom"?c.hoehe:c.breite,$=Math.max(i,Math.floor(C*Hr));A[k]=Math.min(Math.max(i,Math.ceil(j(k)-1e-9)),$);}if(A.top===l.top&&A.right===l.right&&A.bottom===l.bottom&&A.left===l.left)return A;if(u&&A.top===u.top&&A.right===u.right&&A.bottom===u.bottom&&A.left===u.left)return {top:Math.max(A.top,l.top),right:Math.max(A.right,l.right),bottom:Math.max(A.bottom,l.bottom),left:Math.max(A.left,l.left)};u=l,l=A;}return l}function Xr(n){if(n.min!==void 0&&n.max!==void 0)return {unit:n.unit,min:n.min,max:n.max};let e=1/0,t=-1/0;for(let r of n.data??[])r.value===null||r.value===void 0||(r.value<e&&(e=r.value),r.value>t&&(t=r.value));return {unit:n.unit,min:e,max:t}}var Cn=n=>Math.abs(n.max-n.min);function Zr(n,e){return n.max>=e.min&&e.max>=n.min?0:n.max<e.min?e.min-n.max:n.min-e.max}function Ur(n,e){if(n.unit!==e.unit)return false;let t=Math.max(Math.abs(n.min),Math.abs(n.max),Math.abs(e.min),Math.abs(e.max)),r=Math.max(Cn(n),Cn(e),t*.05);return Zr(n,e)<=r}function qr(n){let e=[],t=n.map(i=>{let o=Xr(i);if(!Number.isFinite(o.min)||!Number.isFinite(o.max)){let a=e.findIndex(m=>m.unit===o.unit);return a>=0?a:(e.push({unit:o.unit,min:0,max:0}),e.length-1)}let s=e.findIndex(a=>Ur(a,o));return s>=0?(e[s]={unit:e[s].unit,min:Math.min(e[s].min,o.min),max:Math.max(e[s].max,o.max)},s):(e.push({...o}),e.length-1)}),r=e.map((i,o)=>({position:o===0?"left":"right",...i.unit?{label:i.unit}:{}}));return {indices:t,axes:r}}function Mn(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 Jr(n){let e=Mn(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 Qr(n){let e=Mn(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],u=[];for(let h=0;h<t;h++){let c=Math.abs(l[h+3]-l[h+2]),d=Math.abs(l[h+1]-l[h]);u.push(c+d===0?(l[h+1]+l[h+2])/2:(c*l[h+1]+d*l[h+2])/(c+d));}return u}function ei(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 ti(n,e){if(n.length<2)return [];let t=e==="akima"?Qr(n):Jr(n);return ei(n,t)}function ni(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=u=>u<a?a:u>m?m:u;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 nt(n,e){return e&&e!=="catmull-rom"?ti(n,e):ni(n)}var rt=["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","fill-opacity","stroke-opacity"],ri={line:["stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-opacity"],text:["text-anchor","font-size","font-family","fill","fill-opacity"],circle:rt,rect:rt,path:rt},ii={line:"stroke-opacity",text:"fill-opacity"},oi=/ ([a-z-]+)="([^"]*)"/g;function si(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=ii[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(oi))s.set(a,m);return {art:e,kopf:r,rest:n.slice(t),attrs:s}}function Ln(n){let e=[];for(let r of ri[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 Dn(n,e=" "){let t=[];for(let o of n){let s=si(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=Ln(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=Ln(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 it="1.19.0";var ai=` <!-- MLTimeGraph ${it} -->`,$n=1e3;function T(n){return String(Math.round(n*$n)/$n)}function ot(n){return tt(n).toString(16).padStart(8,"0")}function li(n){switch(n){case "top":return "text-top";case "bottom":return "text-bottom";default:return "middle"}}var q=class extends Te{#e="100%";#t="100%";#n;#r="";#m="";#i=new Map;#o=new Map;#s=new Map;constructor(e){super(),e?.width!==void 0&&(this.#e=e.width),e?.height!==void 0&&(this.#t=e.height),e?.background!==void 0&&(this.#n=e.background),e?.idPrefix&&(this.#r=`${e.idPrefix}-`),e?.classPrefix&&(this.#m=`${e.classPrefix}-`);}setBackgroundColor(e){this.#n=e;}render(e){this.#i.clear(),this.#o.clear(),this.#s.clear();let t=e.map(l=>this._toSVG(l));this.#n&&t.unshift(`<rect width="100%" height="100%" fill="${this._esc(this.#n)}" />`);let r=t.join(`
|
|
28
28
|
`),i="",o=[];for(let[,l]of this.#i)o.push(l);for(let[,l]of this.#o)o.push(l);for(let[,l]of this.#s)o.push(l);o.length>0&&(i=` <defs>
|
|
29
29
|
${o.join(`
|
|
30
30
|
`)}
|
|
31
31
|
</defs>
|
|
32
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
|
-
${
|
|
33
|
+
${ai}
|
|
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.#
|
|
36
|
-
<feDropShadow dx="${
|
|
37
|
-
</filter>`;return this.#i.set(o,s),o}#
|
|
38
|
-
<rect x="${
|
|
39
|
-
</clipPath>`);}#
|
|
40
|
-
<rect x="${
|
|
41
|
-
<text x="${
|
|
42
|
-
</g>`:`<rect x="${
|
|
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.#f(e);case "gap":return this._gap(e);case "group":return this._group(e)}}#h(e,t){if(e.length===0)return "";if(!t.smoothing||e.length<3)return e.map((l,u)=>`${u===0?"M":"L"}${T(l.x)},${T(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(u=>` C${T(u.c1.x)},${T(u.c1.y)} ${T(u.c2.x)},${T(u.c2.y)} ${T(u.p1.x)},${T(u.p1.y)}`).join(""),a=`M${T(e[0].x)},${T(e[0].y)}`;a+=s(nt(e.slice(0,r),t.smoothingType));let m=o<e.length?o:e.length-1;for(let l=r;l<=m;l++)a+=` L${T(e[l].x)},${T(e[l].y)}`;if(o<e.length){let l=e.slice(o).reverse(),u=nt(l,t.smoothTailType??t.smoothingType).reverse().map(h=>({p0:h.p1,c1:h.c2,c2:h.c1,p1:h.p0}));a+=s(u);}return a}_hatchPattern(e,t){let r=`${this.#r}hatch-${e}-${ot(t??"")}`;if(this.#s.has(r))return r;let i=fe(r,e,t??"rgba(200,220,255,0.3)");return this.#s.set(r,i),r}#l(e,t){t.stroke&&e.push(`stroke="${this._esc(t.stroke)}"`),t.strokeWidth&&e.push(`stroke-width="${T(t.strokeWidth)}"`);}#u(e,t){this.#l(e,t);let r=this.#c(t.dash,t.dashed,t.strokeWidth);r&&(e.push(`stroke-dasharray="${r.strokeDasharray}"`),r.strokeLinecap&&e.push(`stroke-linecap="${r.strokeLinecap}"`)),t.opacity!==void 0&&e.push(`opacity="${T(t.opacity)}"`);}#a(e,t){t.id&&e.push(`id="${this._esc(t.id)}"`);let r=this.#d(t);r&&e.push(`filter="url(#${r})"`);}_path(e){let t=this.#h(e.points,e)+(e.closed?" Z":""),r=[];if(e.hatch){let i=this._hatchPattern(e.hatch,e.fill);r.push(`fill="url(#${i})"`);}else r.push(`fill="${e.fill?this._esc(e.fill):"none"}"`);return this.#u(r,e),e.cssClass&&r.push(`class="${this._esc(e.cssClass)}"`),this.#a(r,e),`<path d="${t}" ${r.join(" ")} />`}_line(e){let t=[];return this.#u(t,e),this.#a(t,e),`<line x1="${T(e.x1)}" y1="${T(e.y1)}" x2="${T(e.x2)}" y2="${T(e.y2)}" ${t.join(" ")} />`}_rect(e){let t=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${r})"`);}else e.fill!==void 0&&t.push(`fill="${this._esc(e.fill)}"`);return this.#l(t,e),e.opacity!==void 0&&t.push(`opacity="${T(e.opacity)}"`),e.dashed&&t.push('stroke-dasharray="4,4"'),this.#a(t,e),e.title?`<rect x="${T(e.x)}" y="${T(e.y)}" width="${T(e.w)}" height="${T(e.h)}" ${t.join(" ")}><title>${this._esc(e.title)}</title></rect>`:`<rect x="${T(e.x)}" y="${T(e.y)}" width="${T(e.w)}" height="${T(e.h)}" ${t.join(" ")} />`}_circle(e){let t=[];if(e.hatch){let r=this._hatchPattern(e.hatch,e.fill);t.push(`fill="url(#${r})"`);}else e.fill&&t.push(`fill="${this._esc(e.fill)}"`);return this.#l(t,e),this.#a(t,e),`<circle cx="${T(e.cx)}" cy="${T(e.cy)}" r="${T(e.r)}" ${t.join(" ")} />`}#c(e,t,r){return Xe(e,r??2,t)}#d(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=`${this.#r}shadow-${ot(`${e.shadowColor}|${T(t)}|${T(r)}|${T(i)}`)}`;if(this.#i.has(o))return o;let s=`<filter id="${o}" x="-50%" y="-50%" width="200%" height="200%">
|
|
36
|
+
<feDropShadow dx="${T(r)}" dy="${T(i)}" stdDeviation="${T(t/2)}" flood-color="${this._esc(e.shadowColor)}" />
|
|
37
|
+
</filter>`;return this.#i.set(o,s),o}#p(e,t,r,i,o){this.#o.has(e)||this.#o.set(e,`<clipPath id="${e}">
|
|
38
|
+
<rect x="${T(t)}" y="${T(r)}" width="${T(i)}" height="${T(o)}" />
|
|
39
|
+
</clipPath>`);}#f(e){let t=[];return e.anchor&&t.push(`text-anchor="${e.anchor}"`),e.fontSize&&t.push(`font-size="${T(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="${T(e.opacity)}"`),e.rotate&&t.push(`transform="rotate(${T(e.rotate)} ${T(e.x)} ${T(e.y)})"`),e.textBaseline&&t.push(`dominant-baseline="${li(e.textBaseline)}"`),e.id&&t.push(`id="${this._esc(e.id)}"`),`<text x="${T(e.x)}" y="${T(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="${this.#m}gap">
|
|
40
|
+
<rect x="${T(e.x1)}" y="${T(e.y1)}" width="${T(e.x2-e.x1)}" height="${T(e.y2-e.y1)}" ${t.join(" ")} />
|
|
41
|
+
<text x="${T(e.x1)}" y="${T(e.y1-4)}" fill="#999" font-size="10">${this._esc(e.label)}</text>
|
|
42
|
+
</g>`:`<rect x="${T(e.x1)}" y="${T(e.y1)}" width="${T(e.x2-e.x1)}" height="${T(e.y2-e.y1)}" ${t.join(" ")} />`}_group(e){let t=null;if(e.clipRect){let{x:u,y:h,w:c,h:d}=e.clipRect;t=`${this.#r}clip-plot-${ot(`${T(u)},${T(h)},${T(c)},${T(d)}`)}`,this.#p(t,u,h,c,d);}let r=e.commands.map(u=>this._toSVG(u)),i=e.sharedStyles?Dn(r):null,o=i?.inhalt??r.map(u=>` ${u.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("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}};function oi(n){return typeof requestAnimationFrame=="function"?requestAnimationFrame(n):setTimeout(()=>n(0),16)}function si(n){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(n):clearTimeout(n);}function Ln(){let n=0,e=false;return {schedule:t=>{e||(e=true,n=oi(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,si(n));}}}function st(n,e,t){let r=n.getScreenCTM?.();if(r){let s=r.inverse();return {x:s.a*e+s.c*t+s.e,y:s.b*e+s.d*t+s.f}}let i=n.getBoundingClientRect(),o=n.viewBox?.baseVal;return o&&o.width>0&&o.height>0&&i.width>0&&i.height>0?{x:o.x+(e-i.left)*o.width/i.width,y:o.y+(t-i.top)*o.height/i.height}:{x:e-i.left,y:t-i.top}}var Dn="http://www.w3.org/2000/svg";function Re(n){return n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function ai(n,e){if(n.length===0)return "";let t=n.map(i=>{let o=Re(i.point.overlayKind?`${i.series.name} (${i.point.overlayKind})`:i.series.name),s=Re(i.label??i.value.toFixed(2)),a=i.held?` (${Re(new Date(i.time).toLocaleTimeString())})`:"";return `<div><span class="mlc-tooltip__name">${o}:</span> ${s}${a}</div>`});return `<div class="mlc-tooltip__time">${Re(new Date(e.time).toLocaleString())}</div>${t.join("")}`}function je(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??ai,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,m=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",u=document.createElement("div");u.className=s,u.style.position="absolute",u.style.pointerEvents="none",u.style.display="none",getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(u);let h=null;a&&(h=document.createElementNS(Dn,"g"),h.setAttribute("class",l),h.setAttribute("pointer-events","none"),r.appendChild(h));let c=()=>{h&&h.replaceChildren();},d=new Map;e.series.forEach((k,w)=>{let _=k.id??k.name;d.has(_)||d.set(_,w);});let p=Ln(),g=null,f=k=>{let w=r.getBoundingClientRect(),_=st(r,k.clientX,k.clientY),j=_.x,A=e.invertTime(j);if(!Number.isFinite(A)){u.style.display="none";return}let T=e.plotRect,C=Math.min(T.y+T.height,Math.max(T.y,_.y)),$=e.pointsAt(j,C,{...t.points,radius:o}).map(D=>{let P=d.get(D.seriesId)??0;return {seriesIndex:P,series:e.series[P],time:D.time,value:D.value??D.avg??0,x:D.x,y:D.y,...D.held?{held:true}:{},...D.label!==void 0?{label:D.label}:{},point:D}});if($.length===0){u.style.display="none",c();return}u.innerHTML=i($,{time:A});let F=n.getBoundingClientRect(),G=12,B=(k.clientX-w.left)/Math.max(1,w.width),H=(k.clientY-w.top)/Math.max(1,w.height),M=B<.5?`${G}px`:`calc(-100% - ${G}px)`,L=H<.5?`${G}px`:`calc(-100% - ${G}px)`;if(u.style.left=`${k.clientX-F.left}px`,u.style.top=`${k.clientY-F.top}px`,u.style.transform=`translate(${M}, ${L})`,u.style.display="",h){h.replaceChildren();for(let D of $){let P=document.createElementNS(Dn,"circle");P.setAttribute("cx",String(D.x)),P.setAttribute("cy",String(D.y)),P.setAttribute("r",String(m)),P.setAttribute("fill","#ffffff"),P.setAttribute("stroke",D.point.color),P.setAttribute("stroke-width","2"),P.setAttribute("class",`${l}__dot`),h.appendChild(P);}}},y=k=>{g=k,p.schedule(()=>{g&&f(g);});},b=()=>{g=null,p.cancel(),u.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",b);let S=false;return ()=>{S||(S=true,g=null,p.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",b),u.remove(),h&&h.remove());}}function li(n,e={}){let t=Pn(n,"mount"),{tooltip:r,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,a=new N({...i,width:o,height:s});return Rn(t,a,o),r?.show&&je(t,a,r),a}function $n(n,e,t){let r=Pn(n,"GraphBuilder.mount"),{chart:i,width:o}=e(r.clientWidth||800);return Rn(r,i,o),t?.show&&je(r,i,t),i}function Pn(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 Rn(n,e,t){let{content:r}=new q().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 Be=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,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 N(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new q().render(e.renderCommands());return t}mount(e){return $n(e,t=>(this._opts.width||(this._opts.width=t),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var Fe=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let 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 Ee=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 Ge=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 Oe=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var Ie=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,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 We=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}},ze=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 mi(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 at(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 ui(n){if(Array.isArray(n))return n.map(at);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 u=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:t,data:r.map(at),sensorType:i??"numeric",enumMap:o,seriesType:l,...u&&{style:{line:u}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function hi(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:ci(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function ci(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 lt(n,e,t){return typeof e=="function"?e(n):n[e??t]}function di(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 pi(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 jn(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]:lt(o,e.time,"time"),m=s&&e.value===void 0?o[1]:lt(o,e.value,"value"),l={time:di(a,t,i),value:pi(m,i)};if(e.annotation!==void 0){let u=lt(o,e.annotation,"annotation");typeof u=="string"&&u!==""&&(l.annotation=u);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function fi(n,e,t={}){return {name:n,data:jn(e,t)}}function Bn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function Fn(n,e){if(!Bn(n)||!Bn(e))return e;let t={...n};for(let[r,i]of Object.entries(e))t[r]=Fn(t[r],i);return t}function gi(...n){let e;for(let t of n)t!==void 0&&(e=Fn(e,t));return e??{}}/*!
|
|
46
|
+
</g>`}_esc(e){return e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""")}};function mi(n){return typeof requestAnimationFrame=="function"?requestAnimationFrame(n):setTimeout(()=>n(0),16)}function ui(n){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(n):clearTimeout(n);}function Pn(){let n=0,e=false;return {schedule:t=>{e||(e=true,n=mi(()=>{e=false,t();}));},cancel:()=>{e&&(e=false,ui(n));}}}function st(n,e,t){let r=n.getScreenCTM?.();if(r){let s=r.inverse();return {x:s.a*e+s.c*t+s.e,y:s.b*e+s.d*t+s.f}}let i=n.getBoundingClientRect(),o=n.viewBox?.baseVal;return o&&o.width>0&&o.height>0&&i.width>0&&i.height>0?{x:o.x+(e-i.left)*o.width/i.width,y:o.y+(t-i.top)*o.height/i.height}:{x:e-i.left,y:t-i.top}}var Rn="http://www.w3.org/2000/svg";function Re(n){return n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function hi(n,e){if(n.length===0)return "";let t=n.map(i=>{let o=Re(i.point.overlayKind?`${i.series.name} (${i.point.overlayKind})`:i.series.name),s=Re(i.label??i.value.toFixed(2)),a=i.held?` (${Re(new Date(i.time).toLocaleTimeString())})`:"";return `<div><span class="mlc-tooltip__name">${o}:</span> ${s}${a}</div>`});return `<div class="mlc-tooltip__time">${Re(new Date(e.time).toLocaleString())}</div>${t.join("")}`}function je(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??hi,o=t.snapRadius??1/0,s=t.className??"mlc-tooltip",a=t.showPicks??true,m=t.pickRadius??5,l=t.picksClassName??"mlc-tooltip-picks",u=document.createElement("div");u.className=s,u.style.position="absolute",u.style.pointerEvents="none",u.style.display="none",getComputedStyle(n).position==="static"&&(n.style.position="relative"),n.appendChild(u);let h=null;a&&(h=document.createElementNS(Rn,"g"),h.setAttribute("class",l),h.setAttribute("pointer-events","none"),r.appendChild(h));let c=()=>{h&&h.replaceChildren();},d=new Map;e.series.forEach((v,w)=>{let _=v.id??v.name;d.has(_)||d.set(_,w);});let p=Pn(),g=null,f=v=>{let w=r.getBoundingClientRect(),_=st(r,v.clientX,v.clientY),j=_.x,A=e.invertTime(j);if(!Number.isFinite(A)){u.style.display="none";return}let k=e.plotRect,C=Math.min(k.y+k.height,Math.max(k.y,_.y)),$=e.pointsAt(j,C,{...t.points,radius:o}).map(D=>{let P=d.get(D.seriesId)??0;return {seriesIndex:P,series:e.series[P],time:D.time,value:D.value??D.avg??0,x:D.x,y:D.y,...D.held?{held:true}:{},...D.label!==void 0?{label:D.label}:{},point:D}});if($.length===0){u.style.display="none",c();return}u.innerHTML=i($,{time:A});let F=n.getBoundingClientRect(),G=12,B=(v.clientX-w.left)/Math.max(1,w.width),H=(v.clientY-w.top)/Math.max(1,w.height),M=B<.5?`${G}px`:`calc(-100% - ${G}px)`,L=H<.5?`${G}px`:`calc(-100% - ${G}px)`;if(u.style.left=`${v.clientX-F.left}px`,u.style.top=`${v.clientY-F.top}px`,u.style.transform=`translate(${M}, ${L})`,u.style.display="",h){h.replaceChildren();for(let D of $){let P=document.createElementNS(Rn,"circle");P.setAttribute("cx",String(D.x)),P.setAttribute("cy",String(D.y)),P.setAttribute("r",String(m)),P.setAttribute("fill","#ffffff"),P.setAttribute("stroke",D.point.color),P.setAttribute("stroke-width","2"),P.setAttribute("class",`${l}__dot`),h.appendChild(P);}}},y=v=>{g=v,p.schedule(()=>{g&&f(g);});},b=()=>{g=null,p.cancel(),u.style.display="none",c();};r.addEventListener("mousemove",y),r.addEventListener("mouseleave",b);let S=false;return ()=>{S||(S=true,g=null,p.cancel(),r.removeEventListener("mousemove",y),r.removeEventListener("mouseleave",b),u.remove(),h&&h.remove());}}function ci(n,e={}){let t=Bn(n,"mount"),{tooltip:r,...i}=e,o=i.width??t.clientWidth??800,s=i.height??350,a=new N({...i,width:o,height:s});return Fn(t,a,o),r?.show&&je(t,a,r),a}function jn(n,e,t){let r=Bn(n,"GraphBuilder.mount"),{chart:i,width:o}=e(r.clientWidth||800);return Fn(r,i,o),t?.show&&je(r,i,t),i}function Bn(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 Fn(n,e,t){let{content:r}=new q().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 Be=class{_opts;_series=[];_thresholds=[];_annotations=[];_highlights=[];_markers=[];_bands=[];_tooltip;constructor(e,t){this._opts={},e!==void 0&&(this._opts.width=e),t!==void 0&&(this._opts.height=t);}setWidth(e){return this._opts.width=e,this}setHeight(e){return this._opts.height=e,this}setSize(e,t){return this._opts.width=e,this._opts.height=t,this}setMargin(e,t,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 N(this.toOptions())}getSvg(){let e=this.build(),{content:t}=new q().render(e.renderCommands());return t}mount(e){return jn(e,t=>(this._opts.width||(this._opts.width=t),{chart:this.build(),width:this._opts.width??800}),this._tooltip)}};var Fe=class{_series;constructor(e){this._series={name:e,data:[]};}addPoint(e,t){return this._series.data.push({time:e,value:t}),this}setData(e){return this._series.data=[...e],this}addPoints(e){return this._series.data.push(...e),this}addFloats(e,t){let 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 Ee=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 Ge=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 Oe=class{_highlight;constructor(e,t){this._highlight={startTime:e,endTime:t};}setLabel(e){return this._highlight.label=e,this}setColor(e){return this._highlight.color=e,this}setOpacity(e){return this._highlight.opacity=e,this}setLabelPosition(e){return this._highlight.labelPosition=e,this}setRotate(e){return this._highlight.rotate=e,this}build(){return this._highlight}};var Ie=class{_ann;constructor(e){this._ann={type:e};}setID(e){return this._ann.id=e,this}setTitle(e){return this._ann.title=e,this}setFrom(e,t,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 We=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}},ze=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 di(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 at(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 pi(n){if(Array.isArray(n))return n.map(at);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 u=s!==void 0||a!==void 0||m!==void 0?{color:s,width:a,smoothing:m}:void 0;return {name:t,data:r.map(at),sensorType:i??"numeric",enumMap:o,seriesType:l,...u&&{style:{line:u}}}}throw new Error("parseSeries: object or DataPoint[] expected")}function fi(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:gi(r),showAs:i,avgLine:o,countOpacity:s,...a!==void 0&&{style:{line:{color:a},fill:a}}}}function gi(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 lt(n,e,t){return typeof e=="function"?e(n):n[e??t]}function yi(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 bi(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 En(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]:lt(o,e.time,"time"),m=s&&e.value===void 0?o[1]:lt(o,e.value,"value"),l={time:yi(a,t,i),value:bi(m,i)};if(e.annotation!==void 0){let u=lt(o,e.annotation,"annotation");typeof u=="string"&&u!==""&&(l.annotation=u);}r.push(l);}return (e.sort??true)&&r.sort((i,o)=>i.time-o.time),r}function xi(n,e,t={}){return {name:n,data:En(e,t)}}function Gn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function On(n,e){if(!Gn(n)||!Gn(e))return e;let t={...n};for(let[r,i]of Object.entries(e))t[r]=On(t[r],i);return t}function Si(...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
|
* ml-time-analyze — Copyright (c) 2026 Michael Lechner
|
|
63
63
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
64
64
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
65
|
-
*/export{We as AnnotationBandBuilder,ze as AnnotationBandItemBuilder,Ie as AnnotationBuilder,Be as GraphBuilder,Oe as HighlightBuilder,N as MLTimeGraph,Ge as MarkerBuilder,q as SVGRenderer,Ee as ThresholdBuilder,Fe as TimeSeriesBuilder,it as VERSION,je as attachTooltip,
|
|
65
|
+
*/export{We as AnnotationBandBuilder,ze as AnnotationBandItemBuilder,Ie as AnnotationBuilder,Be as GraphBuilder,Oe as HighlightBuilder,N as MLTimeGraph,Ge as MarkerBuilder,q as SVGRenderer,Ee as ThresholdBuilder,Fe as TimeSeriesBuilder,it as VERSION,je as attachTooltip,Kr as autoMargin,qr as axisGroups,De as drawMarker,er as estimateMetrics,di as fillBetweenThresholds,Xn as getDefaultTheme,yt as getLineStyle,z as liberationMetrics,Si as mergeOptions,ci as mount,fi as parseAggregated,at as parseDataPoint,pi as parseSeries,Zn as resetDefaultTheme,Xe as resolveDash,Yn as setDefaultTheme,K as slugify,En as toDataPoints,xi as toSeries,st as zeigerImSvg};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataPoint, DrawCommand } from '../index.js';
|
|
2
|
+
import { TimeScale, LinearScale } from '../internals.js';
|
|
2
3
|
|
|
3
4
|
/*!
|
|
4
5
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -137,4 +138,5 @@ declare class Tooltip {
|
|
|
137
138
|
compute(): TooltipResult;
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
export { Minimap,
|
|
141
|
+
export { Minimap, Tooltip, Zoom };
|
|
142
|
+
export type { MinimapConfig, TooltipConfig, TooltipResult, ZoomConfig, ZoomState };
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { t as RenderingContext, F as FlatSeriesStyle } from './marker_renderer-BKOhqPkn.js';
|
|
2
|
+
import { Theme, TextMetrics, Marker } from './index.js';
|
|
3
|
+
export { u as Layout, v as LayoutConfig, a as LayoutResult, w as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, x as measureLegend, y as renderLegend, z as renderSeriesMarkers, q as slugify } from './marker_renderer-BKOhqPkn.js';
|
|
4
|
+
import { a as DrawCommand, L as LinearScale, T as TimeScale, ac as LineParams, ad as PathParams, ae as RectParams, af as CircleParams, ag as TextParams, ah as GapParams, d as DrawGroup, z as AxisOrientation, A as AxisPosition, ai as Point, aj as BandScale } from './types-pKdGBqvc.js';
|
|
5
|
+
import { DataPoint, AggregatedPoint, HatchVariant, Threshold, Gap, RangeLabelPosition, GapBand, Highlight, Annotation, MovingAverageType, EnumMap, SmoothingType, PointStyleType, AnnotationBandItem, LineVariant, LineShape, FillSpec, GapStyle, TimeSeries } from './index.js';
|
|
6
|
+
export { ak as BandScaleConfig, al as Dashstyle_t, am as DomainScaleConfig, an as DrawCircle, ao as DrawGap, ap as DrawGapType_t, aq as DrawLine, ar as DrawPath, as as DrawRect, at as DrawText, q as LabelAnchor, au as LinearScaleConfig, av as Scale, aw as ScaleConfig, ax as TIME_INTERVALS, ay as TimeScaleConfig, az as getHatch } from './types-pKdGBqvc.js';
|
|
5
7
|
import { DataPoint as DataPoint$1 } from './analyze/index.js';
|
|
6
8
|
|
|
7
9
|
/*!
|
|
@@ -1013,4 +1015,5 @@ declare function resolveFill(series: TimeSeries): FillSpec | undefined;
|
|
|
1013
1015
|
*/
|
|
1014
1016
|
declare function resolveSeriesStyle(series: TimeSeries): ResolvedSeriesStyle;
|
|
1015
1017
|
|
|
1016
|
-
export { AnnotationBandSeries,
|
|
1018
|
+
export { AnnotationBandSeries, AxisOrientation, AxisPosition, BandScale, BandSeries, CircleParams, Clip, CommandBuilder, DrawCommand, DrawGroup, EnumAxis, EnumFormatter, FlatSeriesStyle, Formatters, GapParams, LineParams, LineSeries, LinearScale, MinMaxAvgSeries, MovingAvg, PathParams, Point, RectParams, RenderingContext, StatsOverlay, StepSeries, TextParams, TimeAxis, TimeFormatter, TimeScale, ValueAxis, ValueFormatter, renderAnnotations, renderArea, renderGaps, renderGrid, renderHighlights, renderLine, renderMarkers, renderSplitLine, renderStep, renderThresholds, renderZonedArea, resolveFill, resolveGap, resolveLines, resolveMarkers, resolveSeriesStyle, resolveShadow, theme, toStepData, toStepPoints };
|
|
1019
|
+
export type { AnnotationRenderConfig, BandSeriesConfig, ClipRegion, EnumAxisConfig, EnumFormatterOptions, EnumTickInfo, GapRenderConfig, GridConfig, GroupParams, HighlightRenderConfig, LineSeriesConfig, MarkerRenderConfig, MinMaxAvgConfig, MovingAvgConfig, MovingAvgType, ResolvedLine, ResolvedMarker, ResolvedSeriesStyle, ResolvedShadow, StatLabelPosition, StatsOverlayConfig, StepSeriesConfig, ThresholdRenderConfig, TickInfo, TimeAxisConfig, TimeFormatOptions, ValueAxisConfig, ValueFormatOptions, ValueTickInfo };
|
package/dist/internals.js
CHANGED
|
@@ -21,10 +21,10 @@ var Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time
|
|
|
21
21
|
${d}
|
|
22
22
|
${u}
|
|
23
23
|
</pattern>
|
|
24
|
-
`.trim()}var f=new Proxy({},{get:(i,e)=>D()[e],has:(i,e)=>e in D(),ownKeys:()=>Reflect.ownKeys(D()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(D(),e)});var O=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var ze="#ffffff",Ge="#cccccc",Ve=6,Ne=.85,C=12,N=8,I=20,Xe=11,V=18,te=(i,e)=>e(i,Xe);function we(i,e,t){let n=s=>C+N+te(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=j,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:C+N+r,height:i.length*I}}function Ye(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=j,maxBreite:l,box:s,itemClass:a}=i,m=new O;if(s&&e.length>0){let c=ve(e,r,o,l),g=((r==="horizontal"?c.height/I:e.length)-1)*I+C,y=s.padding??Ve,b=s.stroke??Ge;m.rect({x:t-y,y:n-y,w:c.width+2*y,h:g+2*y,fill:s.fill??ze,...b==="none"?{}:{stroke:b,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ne});}let u=r==="horizontal"?we(e,o,l):e.map(c=>({items:[c],breite:0})),d=new Map;u.forEach((c,h)=>{let g=t;for(let y of c.items)d.set(y,{x:g,y:n+h*I}),g+=C+N+te(y.name,o)+V;});let p=e.some(c=>c.line!==void 0&&c.line!=="solid");return e.forEach(c=>{let h=d.get(c)??{x:t,y:n},g=h.x,y=h.y,b=["legend-item"];c.id&&b.push(`legend-item--${c.id}`),a&&b.push(a),m.group({cssClass:b.join(" "),...c.id?{id:`legend-${c.id}`}:{}},x=>{p?x.line({x1:g,y1:y+C/2,x2:g+C,y2:y+C/2,stroke:c.color,strokeWidth:Ue(c.width),...c.line&&c.line!=="solid"?{dash:c.line}:{}}):x.rect({x:g,y,w:C,h:C,fill:c.color,stroke:f.legendStroke,strokeWidth:1}),x.text({content:c.name,x:g+C+N,y:y+C-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ue(i){return Math.min(Math.max(i??2,1.5),3)}function Ze(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function Ke(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ke(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var A=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},w=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],E=class{#e;#t;#n;constructor(e){this.#e=new A({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:w[0].ms};let s=l/e,a=w[0].ms;for(let d of w)if(d.ms>=s){a=d.ms;break}let m=a,u=Math.round(l/m);for(;u>n&&m<w[w.length-1].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.min(d+1,w.length-1)].ms,u=Math.round(l/m);}for(;u<t&&m>w[0].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.max(d-1,0)].ms,u=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},H=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(d=>String(d)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function qe(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Je(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),u=[],d=[];for(let p of e){let c=p.color??f.thresholdColor,h=t.map(p.value);p.fill==="above"?u.push({type:"rect",x:r,y:a,w:o-r,h:Math.max(0,h-a),fill:c,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&u.push({type:"rect",x:r,y:h,w:o-r,h:Math.max(0,m-h),fill:c,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let g=p.line??f.thresholdLine;if(g!=="none"){let S=qe(g),k={type:"line",x1:r,y1:h,x2:o,y2:h,stroke:c,strokeWidth:1,...S,id:p.id?`${p.id}-line`:void 0};p.shadowColor&&(k.shadowColor=p.shadowColor,k.shadowBlur=p.shadowBlur??4,k.shadowOffsetX=p.shadowOffsetX??0,k.shadowOffsetY=p.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(p.value>=Math.min(y,b)&&p.value<=Math.max(y,b)&&p.label!==void 0&&p.label!==null&&p.label!==false){let S=typeof p.label=="object"?p.label:void 0,k=typeof p.label=="string"?p.label:S?.text??p.name,v=S?.position??"right",W=tt(k,v,r,o,h,c,S);d.push({...W,y:et(W.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:u,labels:d}}function Qe(i){let e=Je(i);return [...e.inside,...e.labels]}function et(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function tt(i,e,t,n,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-4,anchor:"end"}}}function Me(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=j}=i,[l,s]=n,a=[],[m,u]=t.range(),d=Math.min(m,u),p=Math.max(m,u),c=h=>Math.max(d,Math.min(p,h));for(let h of e){let g=c(t.map(h.startTime)),y=c(t.map(h.endTime));if(h.fill!==void 0&&a.push({type:"rect",x:g,y:l,w:y-g,h:s-l,fill:h.fill,hatch:h.hatch,opacity:h.opacity}),h.edges)for(let b of [g,y])a.push({type:"line",x1:b,y1:l,x2:b,y2:s,stroke:h.edges.stroke,strokeWidth:h.edges.strokeWidth,dash:"dashed"});if(h.label){let b=h.labelPosition??"middle",x=h.rotate,S=true;if(x==="auto"){let k=b!=="above"&&b!=="below",v=o(h.label,h.fontSize??11);x=k&&v>Math.abs(y-g)-4?-90:void 0,S=x===void 0||v<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:h.label,x:(g+y)/2,y:Me(b,l,s,r),anchor:"middle",fontSize:h.fontSize,fill:h.labelColor,rotate:x});}}return a}function nt(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:u=true,fontSize:d=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:c="middle",labelRotate:h,metrics:g,band:y}=i,b=()=>{if(!y)return [];let x=y.height??6,[S,k]=n,v=Math.max(S,k);return e.map(W=>{let ge=t.map(W.startTime),ye=t.map(W.endTime);return {type:"rect",x:Math.min(ge,ye),y:v-x+(y.offset??0),w:Math.abs(ye-ge),h:x,fill:y.fill??a,opacity:y.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",v=S==="dashed_border"&&u!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??l,opacity:x.fillOpacity??s},...v&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??c,labelColor:p,fontSize:d,rotate:x.rotate??h}})}).concat(b())}function rt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,l]=r,s=[];for(let a of e){let m=t.map(a.time),u=a.color??f.markerColor,d=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let c=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:c,stroke:u,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:c,stroke:u,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),d!=="none"&&ee(s,void 0,d,m,c,f.markerSize,u,u,1.5),a.label){let h=p==="to-value"?c-10:o-6;s.push({type:"text",content:a.label,x:m,y:h,anchor:"middle",fontSize:f.markerFontSize,fill:u});}}else p!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:u});}return s}function ot(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function it(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function at(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||it(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],u=c=>m.push(c);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let d=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=d?{clipRect:r}:{};switch(a.type){case "line":{let c=s(a.from),h=s(a.to);u({type:"line",x1:c.x,y1:c.y,x2:h.x,y2:h.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let c=s(a.from),h=s(a.to),g=a.color??f.annotationColor,y=a.headSize??f.annotationHead;u({type:"line",x1:c.x,y1:c.y,x2:h.x,y2:h.y,stroke:g,strokeWidth:a.width??f.annotationWidth});let b=Math.hypot(h.x-c.x,h.y-c.y)||1,x=(h.x-c.x)/b,S=(h.y-c.y)/b,k=h.x-x*y,v=h.y-S*y;u({type:"path",points:[{x:h.x,y:h.y},{x:k-S*y*.5,y:v+x*y*.5},{x:k+S*y*.5,y:v-x*y*.5}],fill:g,stroke:"none"});break}case "rect":{let c=s(a.from),h=s(a.to);u({type:"rect",x:Math.min(c.x,h.x),y:Math.min(c.y,h.y),w:Math.abs(h.x-c.x),h:Math.abs(h.y-c.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let c=s(a.at),h=a.color??"#334155",g=a.radius??f.annotationRadius,y=a.shape??"circle";y==="circle"?u({type:"circle",cx:c.x,cy:c.y,r:g,fill:h}):y==="square"?u({type:"rect",x:c.x-g,y:c.y-g,w:g*2,h:g*2,fill:h}):(u({type:"line",x1:c.x-g,y1:c.y-g,x2:c.x+g,y2:c.y+g,stroke:h,strokeWidth:1.5}),u({type:"line",x1:c.x-g,y1:c.y+g,x2:c.x+g,y2:c.y-g,stroke:h,strokeWidth:1.5}));break}case "label":{let c=s(a.at);u({type:"text",content:a.text,x:c.x+(a.dx??0),y:c.y+(a.dy??0),anchor:a.anchor??st(c.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let c=ne(a.id);o.push({type:"group",cssClass:`annotation annotation--${c}`,...p,commands:m});}else d&&m.length>0?o.push({type:"group",cssClass:"annotation",...p,commands:m}):o.push(...m);}return o}function st(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"start":i+s>l?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
|
|
24
|
+
`.trim()}var f=new Proxy({},{get:(i,e)=>D()[e],has:(i,e)=>e in D(),ownKeys:()=>Reflect.ownKeys(D()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(D(),e)});var O=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var ze="#ffffff",Ge="#cccccc",Ve=6,Ne=.85,C=12,N=8,I=20,Xe=11,V=18,te=(i,e)=>e(i,Xe);function we(i,e,t){let n=s=>C+N+te(s.name,e);if(t===void 0){let s=i.reduce((a,m)=>a+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],l=0;for(let s of i){let a=n(s),m=o.length===0?a:l+V+a;o.length>0&&m>t?(r.push({items:o,breite:l}),o=[s],l=a):(o=[...o,s],l=m);}return o.length>0&&r.push({items:o,breite:l}),r}function ve(i,e="vertical",t=j,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((l,s)=>Math.max(l,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:C+N+r,height:i.length*I}}function Ye(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=j,maxBreite:l,box:s,itemClass:a}=i,m=new O;if(s&&e.length>0){let c=ve(e,r,o,l),g=((r==="horizontal"?c.height/I:e.length)-1)*I+C,y=s.padding??Ve,b=s.stroke??Ge;m.rect({x:t-y,y:n-y,w:c.width+2*y,h:g+2*y,fill:s.fill??ze,...b==="none"?{}:{stroke:b,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ne});}let u=r==="horizontal"?we(e,o,l):e.map(c=>({items:[c],breite:0})),d=new Map;u.forEach((c,h)=>{let g=t;for(let y of c.items)d.set(y,{x:g,y:n+h*I}),g+=C+N+te(y.name,o)+V;});let p=e.some(c=>c.line!==void 0&&c.line!=="solid");return e.forEach(c=>{let h=d.get(c)??{x:t,y:n},g=h.x,y=h.y,b=["legend-item"];c.id&&b.push(`legend-item--${c.id}`),a&&b.push(a),m.group({cssClass:b.join(" "),...c.id?{id:`legend-${c.id}`}:{}},x=>{p?x.line({x1:g,y1:y+C/2,x2:g+C,y2:y+C/2,stroke:c.color,strokeWidth:Ue(c.width),...c.line&&c.line!=="solid"?{dash:c.line}:{}}):x.rect({x:g,y,w:C,h:C,fill:c.color,stroke:f.legendStroke,strokeWidth:1}),x.text({content:c.name,x:g+C+N,y:y+C-2,fontSize:f.legendFont,fill:f.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ue(i){return Math.min(Math.max(i??2,1.5),3)}function Ze(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=f.gridStroke,strokeWidth:l=f.gridStrokeWidth,dashed:s=false,opacity:a=f.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:l,dashed:s,opacity:a});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:l,dashed:s,opacity:a});return m}var Ce=new Map;function Ke(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ke(i,e),n=Ce.get(t);return n||(n=new Intl.DateTimeFormat(i,e),Ce.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var P=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,l]=this.#t;return r===n?o:o+(t-n)/(r-n)*(l-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},w=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],E=class{#e;#t;#n;constructor(e){this.#e=new P({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),l=o-r;if(l<=0)return {interval:w[0].ms};let s=l/e,a=w[0].ms;for(let d of w)if(d.ms>=s){a=d.ms;break}let m=a,u=Math.round(l/m);for(;u>n&&m<w[w.length-1].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.min(d+1,w.length-1)].ms,u=Math.round(l/m);}for(;u<t&&m>w[0].ms;){let d=w.findIndex(p=>p.ms===m);m=w[Math.max(d-1,0)].ms,u=Math.round(l/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,l]=this.#e.domain(),s=[],a=Math.ceil(o/r)*r;for(let m=a;m<=l;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},H=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(d=>String(d)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let l=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-l,a=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*a+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),l=Math.abs(e-o);l<n&&(n=l,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function qe(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Je(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[l,s]=t.range(),a=Math.min(l,s),m=Math.max(l,s),u=[],d=[];for(let p of e){let c=p.color??f.thresholdColor,h=t.map(p.value);p.fill==="above"?u.push({type:"rect",x:r,y:a,w:o-r,h:Math.max(0,h-a),fill:c,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0}):p.fill==="below"&&u.push({type:"rect",x:r,y:h,w:o-r,h:Math.max(0,m-h),fill:c,hatch:p.fillHatch,opacity:p.fillOpacity??.12,id:p.id?`${p.id}-fill`:void 0});let g=p.line??f.thresholdLine;if(g!=="none"){let S=qe(g),k={type:"line",x1:r,y1:h,x2:o,y2:h,stroke:c,strokeWidth:1,...S,id:p.id?`${p.id}-line`:void 0};p.shadowColor&&(k.shadowColor=p.shadowColor,k.shadowBlur=p.shadowBlur??4,k.shadowOffsetX=p.shadowOffsetX??0,k.shadowOffsetY=p.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(p.value>=Math.min(y,b)&&p.value<=Math.max(y,b)&&p.label!==void 0&&p.label!==null&&p.label!==false){let S=typeof p.label=="object"?p.label:void 0,k=typeof p.label=="string"?p.label:S?.text??p.name,v=S?.position??"right",W=tt(k,v,r,o,h,c,S);d.push({...W,y:et(W.y,Math.min(l,s),Math.max(l,s),f.thresholdFontSize),id:p.id?`${p.id}-label`:void 0});}}return {inside:u,labels:d}}function Qe(i){let e=Je(i);return [...e.inside,...e.labels]}function et(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function tt(i,e,t,n,r,o,l){let s=(t+n)/2,a={type:"text",content:i,fontSize:f.thresholdFontSize,fill:o},m=l?{...l.rotate!==void 0&&{rotate:l.rotate},...l.textBaseline!==void 0&&{textBaseline:l.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...a,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...a,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...a,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:r-4,anchor:"end"}}}function Me(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=j}=i,[l,s]=n,a=[],[m,u]=t.range(),d=Math.min(m,u),p=Math.max(m,u),c=h=>Math.max(d,Math.min(p,h));for(let h of e){let g=c(t.map(h.startTime)),y=c(t.map(h.endTime));if(h.fill!==void 0&&a.push({type:"rect",x:g,y:l,w:y-g,h:s-l,fill:h.fill,hatch:h.hatch,opacity:h.opacity}),h.edges)for(let b of [g,y])a.push({type:"line",x1:b,y1:l,x2:b,y2:s,stroke:h.edges.stroke,strokeWidth:h.edges.strokeWidth,dash:"dashed"});if(h.label){let b=h.labelPosition??"middle",x=h.rotate,S=true;if(x==="auto"){let k=b!=="above"&&b!=="below",v=o(h.label,h.fontSize??11);x=k&&v>Math.abs(y-g)-4?-90:void 0,S=x===void 0||v<=Math.abs(s-l)-4;}S&&a.push({type:"text",content:h.label,x:(g+y)/2,y:Me(b,l,s,r),anchor:"middle",fontSize:h.fontSize,fill:h.labelColor,rotate:x});}}return a}function nt(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=f.gapFill,hatch:l,fillOpacity:s=f.gapFillOpacity??.15,stroke:a=f.gapStroke,strokeWidth:m=f.gapStrokeWidth,dashed:u=true,fontSize:d=f.gapFontSize,fontFill:p=f.gapFontColor,labelBaseline:c="middle",labelRotate:h,metrics:g,band:y}=i,b=()=>{if(!y)return [];let x=y.height??6,[S,k]=n,v=Math.max(S,k);return e.map(W=>{let ge=t.map(W.startTime),ye=t.map(W.endTime);return {type:"rect",x:Math.min(ge,ye),y:v-x+(y.offset??0),w:Math.abs(ye-ge),h:x,fill:y.fill??a,opacity:y.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",v=S==="dashed_border"&&u!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??l,opacity:x.fillOpacity??s},...v&&{edges:{stroke:a,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??c,labelColor:p,fontSize:d,rotate:x.rotate??h}})}).concat(b())}function rt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,l]=r,s=[];for(let a of e){let m=t.map(a.time),u=a.color??f.markerColor,d=a.pointStyle??(a.value!==void 0?"circle":"none"),p=a.lineStyle??"full";if(a.value!==void 0){let c=n.map(a.value);if(p==="to-value"?s.push({type:"line",x1:m,y1:l,x2:m,y2:c,stroke:u,strokeWidth:1,dashed:true}):p==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:c,stroke:u,strokeWidth:1,dashed:true}):p==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),d!=="none"&&ee(s,void 0,d,m,c,f.markerSize,u,u,1.5),a.label){let h=p==="to-value"?c-10:o-6;s.push({type:"text",content:a.label,x:m,y:h,anchor:"middle",fontSize:f.markerFontSize,fill:u});}}else p!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:l,stroke:u,strokeWidth:1}),a.label&&s.push({type:"text",content:a.label,x:m,y:o-6,anchor:"middle",fontSize:f.markerFontSize,fill:u});}return s}function ot(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??f.highlightColor,opacity:o.opacity??f.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??f.highlightLabelColor,fontSize:f.annotationFontSize,rotate:o.rotate}))})}function it(i,e,t){let n=(o,[l,s])=>o>=Math.min(l,s)&&o<=Math.max(l,s);if(!n(i.time,e.domain()))return false;if(i.value===void 0||!t)return true;let r=t.get(i.axis??0)??t.values().next().value;return !r||n(i.value,r.domain())}function at(i){let{annotations:e,timeScale:t,valueScales:n,plot:r}=i,o=[],l=a=>!r||it(a,t,n),s=a=>{let m=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:m?m.map(a.value):0}};for(let a of e){let m=[],u=c=>m.push(c);if((a.type==="point"||a.type==="label")&&!l(a.at))continue;let d=r!==void 0&&(a.type==="line"||a.type==="arrow"||a.type==="rect")&&!(l(a.from)&&l(a.to)),p=d?{clipRect:r}:{};switch(a.type){case "line":{let c=s(a.from),h=s(a.to);u({type:"line",x1:c.x,y1:c.y,x2:h.x,y2:h.y,stroke:a.color??f.annotationColor,strokeWidth:a.width??f.annotationWidth,dash:a.dash});break}case "arrow":{let c=s(a.from),h=s(a.to),g=a.color??f.annotationColor,y=a.headSize??f.annotationHead;u({type:"line",x1:c.x,y1:c.y,x2:h.x,y2:h.y,stroke:g,strokeWidth:a.width??f.annotationWidth});let b=Math.hypot(h.x-c.x,h.y-c.y)||1,x=(h.x-c.x)/b,S=(h.y-c.y)/b,k=h.x-x*y,v=h.y-S*y;u({type:"path",points:[{x:h.x,y:h.y},{x:k-S*y*.5,y:v+x*y*.5},{x:k+S*y*.5,y:v-x*y*.5}],fill:g,stroke:"none"});break}case "rect":{let c=s(a.from),h=s(a.to);u({type:"rect",x:Math.min(c.x,h.x),y:Math.min(c.y,h.y),w:Math.abs(h.x-c.x),h:Math.abs(h.y-c.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let c=s(a.at),h=a.color??"#334155",g=a.radius??f.annotationRadius,y=a.shape??"circle";y==="circle"?u({type:"circle",cx:c.x,cy:c.y,r:g,fill:h}):y==="square"?u({type:"rect",x:c.x-g,y:c.y-g,w:g*2,h:g*2,fill:h}):(u({type:"line",x1:c.x-g,y1:c.y-g,x2:c.x+g,y2:c.y+g,stroke:h,strokeWidth:1.5}),u({type:"line",x1:c.x-g,y1:c.y+g,x2:c.x+g,y2:c.y-g,stroke:h,strokeWidth:1.5}));break}case "label":{let c=s(a.at);u({type:"text",content:a.text,x:c.x+(a.dx??0),y:c.y+(a.dy??0),anchor:a.anchor??st(c.x+(a.dx??0),a.text,i),fontSize:f.annotationFontSize,fill:a.color??f.annotationColor,rotate:a.rotate});break}}if(a.id&&m.length>0){let c=ne(a.id);o.push({type:"group",cssClass:`annotation annotation--${c}`,...p,commands:m});}else d&&m.length>0?o.push({type:"group",cssClass:"annotation",...p,commands:m}):o.push(...m);}return o}function st(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,l]=r.range(),s=n(e,f.annotationFontSize)/2;return i-s<o?"start":i+s>l?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
|
|
25
25
|
`);return `<clipPath id="${e}">
|
|
26
26
|
${t}
|
|
27
|
-
</clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let l=1;l<=e;l++)t.push(r+(o-r)*l/(e+1));}return t}var z={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},G=class{#e;#t;constructor(e){this.#e=new E({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??z).axisColor}get tickColor(){return (this.#t.colors??z).tickColor}get textColor(){return (this.#t.colors??z).textColor}get textSize(){return (this.#t.colors??z).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??z,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,n)/2;return Math.max(l+2,Math.min(r-l-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function lt(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ae=class{#e;#t;constructor(e){this.#e=new A({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??ie;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=a/n,u=Math.pow(10,Math.floor(Math.log10(m))),d=m/u,p;if(d<=1.5?p=u:d<=3?p=2*u:d<=7?p=5*u:p=10*u,p<=0||!Number.isFinite(p))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=g=>ie(g,p));let c=[],h=Math.ceil(l/p)*p;for(let g=h;g<=s;g+=p)c.push({value:g,position:this.#e.map(g),label:t(g)});return c}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=d=>l.some(p=>Math.abs(p-d)<=s),m=[];if(r==="vertical"){let[d,p]=this.#e.range();m.push({type:"line",x1:n,y1:d,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let c=lt(e);e.forEach((h,g)=>{let y=a(h.position),b=c[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:h.position,x2:n,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:h.label,x:this.#n(n-8,h.label,"end"),y:h.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:h.position,x2:n+4,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:h.label,x:this.#n(n+8,h.label,"start"),y:h.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[d,p]=this.#e.range();m.push({type:"line",x1:d,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let c of e)m.push({type:"line",x1:c.position,y1:n,x2:c.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:c.label,x:c.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let d of this.generateMinorTicks())m.push(u?{type:"line",x1:o==="right"?n:n-2,y1:d,x2:o==="right"?n+2:n,y2:d,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:d,y1:n,x2:d,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-l-2,Math.max(2,e))}};var se=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,u)=>m+u.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var le=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new H({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),u=this.#e.map(a),d=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:u,color:d,isGap:o.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var M=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var me=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,r=e.gapThreshold??f.gapThreshold,o=e.id,l=T.getRuns(this.data,d=>d.value===null,r),s=l.reduce((d,p)=>d+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(d=>({data:d})),u=[];return u.push(...L(m,a,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&u.push(...Q(l.flat(),a,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),u}};var ue=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??f.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),u=e.valueScale.map(a.max),d=e.valueScale.map(a.min),p=l,c=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:u,w:p,h:d-u,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${c}`:void 0}),r&&a.avg!==null){let h=e.valueScale.map(a.avg);s.push({type:"line",x1:m-p/2,y1:h,x2:m+p/2,y2:h,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${c}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...l})}var he=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,r=e.avgColor??f.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=T.getRuns(this.data,h=>h.min===null||h.max===null||h.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},d=[];m.forEach((h,g)=>{if(h.length<2)return;let y=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Le(h,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:l,smoothingType:s});d.push(...b);}if(e.fillToMin){let b=Le(h,u,x=>x.min,e.fillToMin,e.fillToMinHatch,y("fillToMin"),{smoothing:l,smoothingType:s});d.push(...b);}});let p=m.filter(h=>h.length>=2),c=(h,g,y,b=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:h(S)}))})),u,{stroke:g,strokeWidth:a,smoothing:l,smoothingType:s,dashed:b,id:this.id?`${this.id}-${y}`:void 0});return d.push(...c(h=>h.max,n,"max"),...c(h=>h.min,t,"min"),...c(h=>h.avg,r,"avg",o)),d}};var mt=1,de=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let d=t.map(u.startTime),p=t.map(u.endTime);if(p<l[0]||d>l[1])continue;let c=Math.max(l[0],Math.min(l[1],d)),h=Math.max(l[0],Math.min(l[1],p)),g=Math.max(h-c,mt);c+g>l[1]&&(c=Math.max(l[0],l[1]-g));let y=c+g/2;if(m.push({type:"rect",x:c,y:s,w:g,h:a,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new G({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:u=f.statsLabelColor}=this.#e,d=be.compute(e),p=[{name:"min",value:d.min,enabled:r},{name:"max",value:d.max,enabled:o},{name:"avg",value:d.avg,enabled:l},{name:"median",value:d.median,enabled:s}],c=[],[h,g]=n;for(let y of p.filter(b=>b.enabled)){let b=t.map(y.value);c.push({type:"line",x1:h,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let x=`${y.name}: ${y.value.toFixed(1)}`;(a==="start"||a==="both")&&c.push({type:"text",content:x,x:h+4,y:b-4,anchor:"start",fontSize:f.statFontSize,fill:u}),(a==="end"||a==="both")&&c.push({type:"text",content:x,x:g-4,y:b-4,anchor:"end",fontSize:f.statFontSize,fill:u}),a==="center"&&c.push({type:"text",content:x,x:(h+g)/2,y:b-4,anchor:"middle",fontSize:f.statFontSize,fill:u});}return c}};var R=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return B(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return B(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var $=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var F=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var ut={time:new R,value:new $,enum:new F};function fe(i,e){let t=D();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function De(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Ae(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function Pe(i){return i.style?.gap}function Re(i){return i.style?.fill}function ct(i){return {lines:De(i),fill:Re(i),markers:_e(i),shadow:Ae(i),gap:Pe(i),id:i.style?.id??i.id}}/*!
|
|
27
|
+
</clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let l=1;l<=e;l++)t.push(r+(o-r)*l/(e+1));}return t}var z={axisColor:f.axisColor,tickColor:f.tickColor,textColor:f.textColor,textSize:f.textSize},G=class{#e;#t;constructor(e){this.#e=new E({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??z).axisColor}get tickColor(){return (this.#t.colors??z).tickColor}get textColor(){return (this.#t.colors??z).textColor}get textSize(){return (this.#t.colors??z).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??z,n=this.#t.y??0,r=[],[o,l]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:l,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,n)/2;return Math.max(l+2,Math.min(r-l-2,e))}};var A={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function ie(i,e){let t=n=>e===void 0||e>=n;return Math.abs(i)>=1e6&&t(1e5)?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3&&t(100)?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function lt(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ae=class{#e;#t;constructor(e){this.#e=new P({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??A).axisColor}get tickColor(){return (this.#t.colors??A).tickColor}get textColor(){return (this.#t.colors??A).textColor}get textSize(){return (this.#t.colors??A).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??ie;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??ie,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),l=Math.min(r,o),s=Math.max(r,o),a=s-l;if(a===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=a/n,u=Math.pow(10,Math.floor(Math.log10(m))),d=m/u,p;if(d<=1.5?p=u:d<=3?p=2*u:d<=7?p=5*u:p=10*u,p<=0||!Number.isFinite(p))return [{value:r,position:this.#e.map(r),label:t(r)}];this.#t.format||(t=g=>ie(g,p));let c=[],h=Math.ceil(l/p)*p;for(let g=h;g<=s;g+=p)c.push({value:g,position:this.#e.map(g),label:t(g)});return c}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??A,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",l=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,a=d=>l.some(p=>Math.abs(p-d)<=s),m=[];if(r==="vertical"){let[d,p]=this.#e.range();m.push({type:"line",x1:n,y1:d,x2:n,y2:p,stroke:t.axisColor,strokeWidth:t.axisWidth});let c=lt(e);e.forEach((h,g)=>{let y=a(h.position),b=c[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:h.position,x2:n,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:h.label,x:this.#n(n-8,h.label,"end"),y:h.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:h.position,x2:n+4,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:h.label,x:this.#n(n+8,h.label,"start"),y:h.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[d,p]=this.#e.range();m.push({type:"line",x1:d,y1:n,x2:p,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let c of e)m.push({type:"line",x1:c.position,y1:n,x2:c.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:c.label,x:c.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let d of this.generateMinorTicks())m.push(u?{type:"line",x1:o==="right"?n:n-2,y1:d,x2:o==="right"?n+2:n,y2:d,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:d,y1:n,x2:d,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let l=o(t,(this.#t.colors??A).textSize);return n==="end"?Math.max(l+2,Math.min(r-2,e)):Math.min(r-l-2,Math.max(2,e))}};var se=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,l)=>o.time-l.time),r=[];for(let o=0;o<n.length;o++){let l=Math.max(0,o-t+1),s=n.slice(l,o+1),a=s.reduce((m,u)=>m+u.value,0)/s.length;r.push({time:n[o].time,value:a});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,a)=>s.time-a.time);if(n.length===0)return [];let r=2/(t+1),o=[],l=n[0].value;o.push({time:n[0].time,value:l});for(let s=1;s<n.length;s++)l=n[s].value*r+l*(1-r),o.push({time:n[s].time,value:l});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var le=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new H({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((l,s)=>{let a=Number(l),m=t?e[a]??String(a):String(a),u=this.#e.map(a),d=n?f.palette[s%f.palette.length]:void 0;return {value:a,label:m,y:u,color:d,isGap:o.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return f.palette[t%f.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:f.textSize,fill:r.color??f.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var M=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var me=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??f.stroke,strokeWidth:e.strokeWidth??f.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??f.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??f.pointThreshold,r=e.gapThreshold??f.gapThreshold,o=e.id,l=T.getRuns(this.data,d=>d.value===null,r),s=l.reduce((d,p)=>d+p.length,0);if(s===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=l.map(d=>({data:d})),u=[];return u.push(...L(m,a,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n&&u.push(...Q(l.flat(),a,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke)),u}};var ue=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),l=e.map(t[r].value);r===0?n.push({x:o,y:l}):n.push({x:o,y:n[n.length-1].y},{x:o,y:l});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??f.stroke,strokeWidth:this.#e.strokeWidth??f.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ce=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??f.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??f.bandAvgLine,l=e.bandWidth??10,s=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),u=e.valueScale.map(a.max),d=e.valueScale.map(a.min),p=l,c=this.data.indexOf(a);if(s.push({type:"rect",x:m-p/2,y:u,w:p,h:d-u,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${c}`:void 0}),r&&a.avg!==null){let h=e.valueScale.map(a.avg);s.push({type:"line",x1:m-p/2,y1:h,x2:m+p/2,y2:h,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${c}`:void 0});}}return s}};function Le(i,e,t,n,r,o,l){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...l})}var he=class extends M{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??f.minColor,n=e.maxColor??f.maxColor,r=e.avgColor??f.avgColor,o=e.avgDashed??true,l=e.smoothing??false,s=e.smoothingType,a=e.strokeWidth??f.strokeWidth,m=T.getRuns(this.data,h=>h.min===null||h.max===null||h.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},d=[];m.forEach((h,g)=>{if(h.length<2)return;let y=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Le(h,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:l,smoothingType:s});d.push(...b);}if(e.fillToMin){let b=Le(h,u,x=>x.min,e.fillToMin,e.fillToMinHatch,y("fillToMin"),{smoothing:l,smoothingType:s});d.push(...b);}});let p=m.filter(h=>h.length>=2),c=(h,g,y,b=false)=>L(p.map(x=>({data:x.map(S=>({time:S.time,value:h(S)}))})),u,{stroke:g,strokeWidth:a,smoothing:l,smoothingType:s,dashed:b,id:this.id?`${this.id}-${y}`:void 0});return d.push(...c(h=>h.max,n,"max"),...c(h=>h.min,t,"min"),...c(h=>h.avg,r,"avg",o)),d}};var mt=1,de=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:l,y:s,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:l[0],y:s,w:l[1]-l[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let d=t.map(u.startTime),p=t.map(u.endTime);if(p<l[0]||d>l[1])continue;let c=Math.max(l[0],Math.min(l[1],d)),h=Math.max(l[0],Math.min(l[1],p)),g=Math.max(h-c,mt);c+g>l[1]&&(c=Math.max(l[0],l[1]-g));let y=c+g/2;if(m.push({type:"rect",x:c,y:s,w:g,h:a,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new G({domain:t.domain(),xRange:l,y:s+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var pe=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:l=true,showMedian:s=false,labelPosition:a="end",lineColor:m=f.statsLineColor,labelColor:u=f.statsLabelColor}=this.#e,d=be.compute(e),p=[{name:"min",value:d.min,enabled:r},{name:"max",value:d.max,enabled:o},{name:"avg",value:d.avg,enabled:l},{name:"median",value:d.median,enabled:s}],c=[],[h,g]=n;for(let y of p.filter(b=>b.enabled)){let b=t.map(y.value);c.push({type:"line",x1:h,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let x=`${y.name}: ${y.value.toFixed(1)}`;(a==="start"||a==="both")&&c.push({type:"text",content:x,x:h+4,y:b-4,anchor:"start",fontSize:f.statFontSize,fill:u}),(a==="end"||a==="both")&&c.push({type:"text",content:x,x:g-4,y:b-4,anchor:"end",fontSize:f.statFontSize,fill:u}),a==="center"&&c.push({type:"text",content:x,x:(h+g)/2,y:b-4,anchor:"middle",fontSize:f.statFontSize,fill:u});}return c}};var R=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return B(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return B(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,l=36e5,s=6e4,a={};return r<s?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):r<l?(a.minute="2-digit",a.hour="2-digit"):r<o?(a.hour="2-digit",a.minute="2-digit"):r<7*o?(a.weekday="short",a.day="numeric"):r<365*o?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var $=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var F=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var ut={time:new R,value:new $,enum:new F};function fe(i,e){let t=D();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function De(i){let e=i.style?.line;return e===false?[]:e===void 0?[fe({},i)]:Array.isArray(e)?e.map(t=>fe(t,i)):[fe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=D(),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 ct(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 Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time
|
|
|
43
43
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
44
44
|
* MIT with Attribution: free use incl. commercial must have visible credit to
|
|
45
45
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
46
|
-
*/export{de as AnnotationBandSeries,H as BandScale,ce as BandSeries,oe as Clip,O as CommandBuilder,le as EnumAxis,F as EnumFormatter,ut as Formatters,re as Layout,me as LineSeries,
|
|
46
|
+
*/export{de as AnnotationBandSeries,H as BandScale,ce as BandSeries,oe as Clip,O as CommandBuilder,le as EnumAxis,F as EnumFormatter,ut as Formatters,re as Layout,me as LineSeries,P as LinearScale,he as MinMaxAvgSeries,se as MovingAvg,Z as Renderer,pe as StatsOverlay,ue as StepSeries,w as TIME_INTERVALS,G as TimeAxis,R as TimeFormatter,E as TimeScale,ae as ValueAxis,$ as ValueFormatter,Te as getHatch,ve as measureLegend,at as renderAnnotations,We as renderArea,nt as renderGaps,Ze as renderGrid,ot as renderHighlights,Ye as renderLegend,L as renderLine,rt as renderMarkers,Q as renderSeriesMarkers,Fe as renderSplitLine,q as renderStep,Qe as renderThresholds,J as renderZonedArea,Re as resolveFill,Ae as resolveGap,De as resolveLines,_e as resolveMarkers,ct as resolveSeriesStyle,Pe as resolveShadow,ne as slugify,f as theme,$e as toStepData,K as toStepPoints};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig,
|
|
1
|
+
import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, S as SmoothingType, k as HatchVariant, T as TimeScale, L as LinearScale, D as DataPoint } from './types-pKdGBqvc.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = "svg" | "canvas" | "none";
|
|
@@ -842,4 +842,5 @@ interface RenderingContext {
|
|
|
842
842
|
declare function renderMarkers(points: DataPoint[], ctx: RenderingContext, style: FlatSeriesStyle, getColor: (p: DataPoint) => string): DrawCommand[];
|
|
843
843
|
declare function drawMarker(commands: DrawCommand[], id: string | undefined, shape: Exclude<PointStyleType, "none">, x: number, y: number, size: number, stroke: string, fill: string, sw: number): void;
|
|
844
844
|
|
|
845
|
-
export {
|
|
845
|
+
export { Renderer as R, drawMarker as m, estimateMetrics as n, getDefaultTheme as o, liberationMetrics as p, slugify as q, resetDefaultTheme as r, setDefaultTheme as s, Layout as u, measureLegend as x, renderLegend as y, renderMarkers as z };
|
|
846
|
+
export type { AxesConfig as A, FlatSeriesStyle as F, GridLineStyle as G, LegendItem as L, MLTimeGraphOptions as M, TextMetrics as T, XAxisConfig as X, YAxisConfig as Y, LayoutResult as a, Margin as b, LegendOptions as c, LegendPosition as d, LegendOrientation as e, Marker as f, RenderOutput as g, AxisLabelsStyle as h, AxisStyle as i, GridStyle as j, Theme as k, TickConfig as l, RenderingContext as t, LayoutConfig as v, LegendConfig as w };
|
|
@@ -1243,4 +1243,5 @@ interface AnnotationBandConfig {
|
|
|
1243
1243
|
items: AnnotationBandItem[];
|
|
1244
1244
|
}
|
|
1245
1245
|
|
|
1246
|
-
export {
|
|
1246
|
+
export { LinearScale as L, TimeScale as T, getLineStyle as aa, resolveDash as ab, BandScale as aj, TIME_INTERVALS as ax, getHatch as az };
|
|
1247
|
+
export type { MovingAverageType as $, AxisPosition as A, DataPointRef as B, FillBound as C, DataPoint as D, EnumMap as E, FillSpec as F, GridLayer as G, Highlight as H, FillRegion as I, FillSide as J, FillStyle as K, MarkerLineStyle as M, FillWhere as N, GapBand as O, PointStyleType as P, GapConfig as Q, RangeLabelPosition as R, SmoothingType as S, GapLabel as U, GapRegion as V, GapStyle as W, GapsAtEnd as X, LineShape as Y, LineStyle as Z, MarkerStyle as _, DrawCommand as a, SVGLineStyle as a0, SensorType as a1, SeriesGapStyle as a2, SeriesGaps as a3, SeriesOverlay as a4, SeriesOverlayKind as a5, SeriesType as a6, ShadowStyle as a7, SolidDashStyle as a8, ThresholdLabelConfig as a9, LineParams as ac, PathParams as ad, RectParams as ae, CircleParams as af, TextParams as ag, GapParams as ah, Point as ai, BandScaleConfig as ak, Dashstyle_t as al, DomainScaleConfig as am, DrawCircle as an, DrawGap as ao, DrawGapType_t$1 as ap, DrawLine as aq, DrawPath as ar, DrawRect as as, DrawText as at, LinearScaleConfig as au, Scale as av, ScaleConfig as aw, TimeScaleConfig as ay, LineDashStyle as b, LineVariant as c, DrawGroup as d, AnySeries as e, Threshold as f, Gap as g, GapsConfig as h, Annotation as i, AnnotationBandConfig as j, HatchVariant as k, SeriesStyle as l, TimeSeries as m, ThresholdFill as n, ThresholdLabelPosition as o, AnnotationPointShape as p, LabelAnchor as q, AnnotationBandItem as r, TextBaseline as s, AggregatedPoint as t, AggregatedSeries as u, AggregatedShowAs as v, AggregationConfig as w, AggregationMode as x, AnnotationKind as y, AxisOrientation as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ml-time-graph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.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",
|