ml-time-graph 1.14.0 → 1.16.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 +47 -0
- package/USAGE.md +79 -18
- package/dist/index.d.ts +154 -19
- package/dist/index.js +33 -33
- package/dist/interaction/index.d.ts +1 -1
- package/dist/interaction/index.js +2 -2
- package/dist/internals.d.ts +4 -4
- package/dist/internals.js +4 -4
- package/dist/{marker_renderer-C5rNViFi.d.ts → marker_renderer-CN1N04nS.d.ts} +48 -3
- package/dist/{scale-CDPJGYpZ.d.ts → scale-kRRbXFik.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as DataPoint, a as DrawCommand, T as TimeScale, L as LinearScale } from '../scale-
|
|
1
|
+
import { D as DataPoint, a as DrawCommand, T as TimeScale, L as LinearScale } from '../scale-kRRbXFik.js';
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
1
|
+
var v=class{_config;_state;constructor(t,n){this._config={enabled:n?.enabled??true,zoomSpeed:n?.zoomSpeed??.1,minDomainMs:n?.minDomainMs??0,maxDomainMs:n?.maxDomainMs??365*24*60*60*1e3},this._state={domain:[...t],originalDomain:[...t],scale:1,offset:0};}get state(){return {...this._state,domain:[...this._state.domain]}}applyZoom(t,n,o){if(!this._config.enabled)return;let r=1+Math.sign(n)*this._config.zoomSpeed;if(r<=0)return;let[i,a]=this._state.domain,d=a-i,s=t/o,e=d/r,l=this._config.minDomainMs??0,m=this._config.maxDomainMs??1/0;e<l&&(e=l),e>m&&(e=m);let p=i+d*s,h=p-e*s,c=p+e*(1-s),[b,_]=this._state.originalDomain;c-h>_-b?(h=b,c=_,e=_-b):(h<b&&(c=_-(_-b)*((c-h)/(_-b)),h=b),c>_&&(h=b+(_-b)*((h-b)/(_-b)),c=_)),this._state.domain=[h,c],this._state.scale=(a-i)/e;}applyPan(t,n){if(!this._config.enabled)return;let[o,r]=this._state.domain,i=r-o,[a,d]=this._state.originalDomain,s=-(t/n)*i,e=o+s,l=r+s;e<a&&(s-=e-a),l>d&&(s-=l-d),this._state.domain=[o+s,r+s];}reset(){this._state.domain=[...this._state.originalDomain],this._state.scale=1,this._state.offset=0;}get enabled(){return this._config.enabled??true}};var w=new Map;function R(u,t){return `${u}|${JSON.stringify(t??{})}`}function k(u,t){let n=R(u,t),o=w.get(n);return o||(o=new Intl.DateTimeFormat(u,t),w.set(n,o)),o}function M(){return typeof navigator<"u"?navigator.language:void 0}var y=class{#t;#e;constructor(t){this.#t=[...t.domain],this.#e=[...t.range];}map(t){let n=Number(t),[o,r]=this.#t,[i,a]=this.#e;return r===o?i:i+(n-o)/(r-o)*(a-i)}invert(t){let[n,o]=this.#t,[r,i]=this.#e;return i===r?n:n+(t-r)/(i-r)*(o-n)}domain(){return [...this.#t]}range(){return [...this.#e]}},g=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],x=class{#t;#e;#n;constructor(t){this.#t=new y({domain:t.domain,range:t.range}),this.#e=t.locale||(M()??"en-US"),this.#n=t.timeZone;}map(t){return this.#t.map(Number(t))}invert(t){return this.#t.invert(t)}domain(){return this.#t.domain()}range(){return this.#t.range()}get timeZone(){return this.#n}get locale(){return this.#e}tickInterval(t,n=3,o=12){let[r,i]=this.#t.domain(),a=i-r;if(a<=0)return {interval:g[0].ms};let d=a/t,s=g[0].ms;for(let m of g)if(m.ms>=d){s=m.ms;break}let e=s,l=Math.round(a/e);for(;l>o&&e<g[g.length-1].ms;){let m=g.findIndex(p=>p.ms===e);e=g[Math.min(m+1,g.length-1)].ms,l=Math.round(a/e);}for(;l<n&&e>g[0].ms;){let m=g.findIndex(p=>p.ms===e);e=g[Math.max(m-1,0)].ms,l=Math.round(a/e);}return {interval:e}}ticks(t){let n=t?.minTicks??5,o=t?.maxTicks??12,{interval:r}=this.tickInterval((n+o)/2,n,o),[i,a]=this.#t.domain(),d=[],s=Math.ceil(i/r)*r;for(let e=s;e<=a;e+=r)d.push(e);return d}format(t,n){let o=this.#n?{...n,timeZone:this.#n}:n;return k(this.#e,o).format(new Date(t))}};function T(u){let t=1/0,n=-1/0;for(let o=0;o<u.length;o++){let r=u[o];r<t&&(t=r),r>n&&(n=r);}return [t,n]}var L={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 F={...L};function S(){return F}var f=new Proxy({},{get:(u,t)=>S()[t],has:(u,t)=>t in S(),ownKeys:()=>Reflect.ownKeys(S()),getOwnPropertyDescriptor:(u,t)=>Reflect.getOwnPropertyDescriptor(S(),t)});var C=class{_data;_width;_height;_x;_y;_zoom;_stroke;_bgColor;_brushColor;constructor(t){this._data=t.data,this._width=t.width,this._height=t.height,this._x=t.x,this._y=t.y,this._zoom=t.zoom,this._stroke=t.stroke??f.minimapStroke,this._bgColor=t.bgColor??f.minimapBg,this._brushColor=t.brushColor??f.minimapBrush;}render(){if(this._data.length===0)return [];let t=[],n=this._data.map(e=>e.time),o=this._data.map(e=>e.value).filter(e=>e!==null),r=T(n),i=T(o),a=new x({domain:r,range:[0,this._width]}),d=new y({domain:i,range:[this._height,0]});t.push({type:"rect",x:this._x,y:this._y,w:this._width,h:this._height,fill:this._bgColor});let s=this._data.map(e=>({x:this._x+a.map(e.time),y:this._y+d.map(e.value)}));if(t.push({type:"path",points:s,smoothing:false,stroke:this._stroke,strokeWidth:1}),this._zoom){let e=this._zoom.state,l=this._x+a.map(e.domain[0]),m=this._x+a.map(e.domain[1]),p=Math.max(2,m-l);t.push({type:"rect",x:l,y:this._y,w:p,h:this._height,fill:this._brushColor});}return t}navigateTo(t){let n=this._data.map(a=>a.time),o=T(n),r=new x({domain:o,range:[0,this._width]}),i=t-this._x;return r.invert(i)}};var D=class{_mouseX;_mouseY;_timeScale;_valueScale;_data;_xRange;_yRange;_snapRadius;_bgColor;_borderColor;_textColor;constructor(t){this._mouseX=t.mouseX,this._mouseY=t.mouseY,this._timeScale=t.timeScale,this._valueScale=t.valueScale,this._data=t.data,this._xRange=t.xRange,this._yRange=t.yRange,this._snapRadius=t.snapRadius??f.tooltipSnapRadius,this._bgColor=t.bgColor??f.tooltipBg,this._borderColor=t.borderColor??f.tooltipBorder,this._textColor=t.textColor??f.tooltipText;}compute(){let t=[...this._data].filter(h=>h.value!==null).sort((h,c)=>h.time-c.time),n,o=1/0;for(let h of t){let c=this._timeScale.map(h.time),b=Math.abs(this._mouseX-c);b<o&&(o=b,n=h);}if(!n||o>this._snapRadius)return {visible:false,commands:[]};let r=this._timeScale.map(n.time),i=this._valueScale.map(n.value),a=[];a.push({type:"line",x1:r,y1:this._yRange[0],x2:r,y2:this._yRange[1],stroke:"#94a3b8",strokeWidth:1},{type:"line",x1:this._xRange[0],y1:i,x2:this._xRange[1],y2:i,stroke:"#94a3b8",strokeWidth:1},{type:"circle",cx:r,cy:i,r:5,fill:"#3b82f6"});let d=new Date(n.time).toLocaleString(),s=n.value.toFixed(2),e=120,l=44,m=r+12,p=i-l-4;return m+e>this._xRange[1]&&(m=r-e-12),p<this._yRange[0]&&(p=i+12),a.push({type:"rect",x:m,y:p,w:e,h:l,fill:this._bgColor,stroke:this._borderColor,strokeWidth:1},{type:"text",content:d,x:m+8,y:p+16,fontSize:f.tooltipTimeFontSize,fill:this._textColor},{type:"text",content:`Value: ${s}`,x:m+8,y:p+32,fontSize:f.tooltipValueFontSize,fill:"#3b82f6"}),{visible:true,commands:a,dataPoint:n,snapX:r}}};/*!
|
|
2
2
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
3
3
|
* MIT with Attribution: free use incl. commercial requires visible credit to
|
|
4
4
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
5
|
-
*/export{
|
|
5
|
+
*/export{C as Minimap,D as Tooltip,v as Zoom};
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { k as Theme, t as RenderingContext, S as SeriesStyle, T as TextMetrics, f as Marker } from './marker_renderer-
|
|
2
|
-
export { u as Layout, v as LayoutConfig, a as LayoutResult, w as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, x as measureLegend, y as renderLegend, z as renderSeriesMarkers, q as slugify } from './marker_renderer-
|
|
3
|
-
import { D as DataPoint, a as DrawCommand, t as AggregatedPoint,
|
|
4
|
-
export { ag as BandScaleConfig, ah as Dashstyle_t, ai as DomainScaleConfig, aj as DrawCircle, ak as DrawGap, al as DrawGapType_t, am as DrawLine, an as DrawPath, ao as DrawRect, ap as DrawText, q as LabelAnchor, aq as LinearScaleConfig, ar as Scale, as as ScaleConfig, at as TIME_INTERVALS, au as TimeScaleConfig, av as getHatch } from './scale-
|
|
1
|
+
import { k as Theme, t as RenderingContext, S as SeriesStyle, T as TextMetrics, f as Marker } from './marker_renderer-CN1N04nS.js';
|
|
2
|
+
export { u as Layout, v as LayoutConfig, a as LayoutResult, w as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, x as measureLegend, y as renderLegend, z as renderSeriesMarkers, q as slugify } from './marker_renderer-CN1N04nS.js';
|
|
3
|
+
import { D as DataPoint, a as DrawCommand, t as AggregatedPoint, k as HatchVariant, f as Threshold, L as LinearScale, g as Gap, T as TimeScale, R as RangeLabelPosition, a7 as GapBand, H as Highlight, i as Annotation, a8 as LineParams, a9 as PathParams, aa as RectParams, ab as CircleParams, ac as TextParams, ad as GapParams, d as DrawGroup, z as AxisOrientation, A as AxisPosition, Y as MovingAverageType, ae as Point, E as EnumMap, af as BandScale, S as SmoothingType, P as PointStyleType, r as AnnotationBandItem, c as LineVariant, V as LineShape, F as FillSpec, U as GapStyle, m as TimeSeries } from './scale-kRRbXFik.js';
|
|
4
|
+
export { ag as BandScaleConfig, ah as Dashstyle_t, ai as DomainScaleConfig, aj as DrawCircle, ak as DrawGap, al as DrawGapType_t, am as DrawLine, an as DrawPath, ao as DrawRect, ap as DrawText, q as LabelAnchor, aq as LinearScaleConfig, ar as Scale, as as ScaleConfig, at as TIME_INTERVALS, au as TimeScaleConfig, av as getHatch } from './scale-kRRbXFik.js';
|
|
5
5
|
import { DataPoint as DataPoint$1 } from './analyze/index.js';
|
|
6
6
|
|
|
7
7
|
/*!
|
package/dist/internals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Z=class{};var w=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((s,l)=>s.time-l.time),r=[],o=[],a=null;for(let s of n){let l=e(s),m=t>0&&a&&s.time-a.time>t;(l||m)&&o.length&&(r.push(o),o=[]),l||o.push(s),a=s;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((m,u)=>m-u),o=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let u=0;for(let h=0;h<r.length&&m>=r[h];h++)u=h+1;return u},l=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],h=i[m],c=t(u),f=t(h),d;f>c?d=r.filter(y=>y>c&&y<=f):f<c?d=r.filter(y=>y>=f&&y<c).reverse():d=[];let g=c;for(let y of d){let b=(y-c)/(f-c),x=n(u,h,b);l.push(x);let S=s((g+y)/2);o.push({data:l,zoneIndex:S,zoneLow:a(S)}),l=[x],g=y;}(d.length===0||d[d.length-1]!==f)&&l.push(h);}if(l.length>1||i.length===1){let m=t(l[0]),u=t(l[l.length-1]),h=s((m+u)/2);o.push({data:l,zoneIndex:h,zoneLow:a(h)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let a of r)a.zoneIndex===0?o.below.push(a.data):o.above.push(a.data);return o}};var ye=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,l)=>s-l);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,l)=>s+l,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,l)=>s+Math.pow(l-n,2),0)/t,a=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:a,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function q(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function $e(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function D(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function Fe(i,e,t,n){let r=w.splitByThreshold(i,e,a=>a.value,w.interpolateDataPoint),o=[];return n.below&&o.push(...C(r.below.map(a=>({data:a})),t,n.below)),n.above&&o.push(...C(r.above.map(a=>({data:a})),t,n.above)),o}function C(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];a.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:a.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):a.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(a.data[0].time),cy:e.valueScale.map(a.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:a.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function K(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];if(a.data.length<2)continue;let s=q(a.data.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function We(i,e,t,n,r){let o=[],a=D(t);for(let s=0;s<i.length;s++){let l=i[s];if(l.data.length<2)continue;let m=l.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n(h))})),u=l.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(r(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...u],fill:l.color??a.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=w.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let a=0;a<r.length;a++){let s=r[a];if(s.data.length<2)continue;let l=t.getColor(s.zoneIndex);if(!l)continue;let m=s.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yLow(h))})),u=s.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yHigh(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${a}`:void 0,points:[...m,...u],fill:l,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return o}function Q(i,e,t,n){let r=D(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let a=0;a<i.length;a++){let s=i[a],l=e.timeScale.map(s.time),m=e.valueScale.map(s.value),u=n(s),h=t.pointStroke??u,c=t.pointFill??u,f=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${a}`:void 0;ee(o,d,r.markers.type,l,m,r.markers.size,h,c,f);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,a,s,l){let m=u=>e===void 0?void 0:`${e}-${u}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:a,strokeWidth:l,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:a,strokeWidth:l,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:a,strokeWidth:l,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:a,strokeWidth:l,id:m(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "star":{let u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,f=Math.PI/2*3+h*Math.PI/5;u.push({x:n+c*Math.cos(f),y:r+c*Math.sin(f)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:a,strokeWidth:l,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:l,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:a,strokeWidth:l,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "hexagon":{let u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:n+o*Math.cos(c),y:r+o*Math.sin(c)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:l,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:a,strokeWidth:l,id:e});}}var je=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],be=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of je){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function xe(i){return Oe.get(i)??be}var j=(i,e)=>{let t=0;for(let n of i)t+=xe(n.codePointAt(0)??0);return t*e};var Se={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var Ie={...Se};function M(){return Ie}function Be(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function Ee(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ke(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Be(t),a=Ee(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
1
|
+
var Z=class{};var T=class{static interpolateDataPoint(i,e,t){return {time:i.time+Math.round(t*(e.time-i.time)),value:(i.value??0)+t*((e.value??0)-(i.value??0)),synthetic:true}}static interpolateAggregatedPoint(i,e,t){let n=(r,o)=>r!==null&&o!==null?r+t*(o-r):null;return {time:i.time+t*(e.time-i.time),min:n(i.min,e.min),max:n(i.max,e.max),avg:n(i.avg,e.avg),count:Math.round(i.count+t*(e.count-i.count))}}static getRuns(i,e,t=0){let n=[...i].sort((s,l)=>s.time-l.time),r=[],o=[],a=null;for(let s of n){let l=e(s),m=t>0&&a&&s.time-a.time>t;(l||m)&&o.length&&(r.push(o),o=[]),l||o.push(s),a=s;}return o.length&&r.push(o),r}static splitByBoundaries(i,e,t,n){if(i.length===0)return [];if(e.length===0)return [{data:i,zoneIndex:0,zoneLow:Number.NEGATIVE_INFINITY}];let r=[...e].sort((m,u)=>m-u),o=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],s=m=>{let u=0;for(let h=0;h<r.length&&m>=r[h];h++)u=h+1;return u},l=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],h=i[m],c=t(u),f=t(h),d;f>c?d=r.filter(y=>y>c&&y<=f):f<c?d=r.filter(y=>y>=f&&y<c).reverse():d=[];let g=c;for(let y of d){let b=(y-c)/(f-c),x=n(u,h,b);l.push(x);let S=s((g+y)/2);o.push({data:l,zoneIndex:S,zoneLow:a(S)}),l=[x],g=y;}(d.length===0||d[d.length-1]!==f)&&l.push(h);}if(l.length>1||i.length===1){let m=t(l[0]),u=t(l[l.length-1]),h=s((m+u)/2);o.push({data:l,zoneIndex:h,zoneLow:a(h)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let a of r)a.zoneIndex===0?o.below.push(a.data):o.above.push(a.data);return o}};var ye=class{static compute(i){let e=i.map(s=>s.value).filter(s=>s!==null).sort((s,l)=>s-l);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((s,l)=>s+l,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((s,l)=>s+Math.pow(l-n,2),0)/t,a=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:a,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function K(i){let e=[];for(let t of i)e.length===0?e.push(t):e.push({x:t.x,y:e[e.length-1].y},t);return e}function $e(i){let e=[];for(let t of i)e.length>0&&e.push({...t,value:e[e.length-1].value}),e.push(t);return e}function D(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function Fe(i,e,t,n){let r=T.splitByThreshold(i,e,a=>a.value,T.interpolateDataPoint),o=[];return n.below&&o.push(...C(r.below.map(a=>({data:a})),t,n.below)),n.above&&o.push(...C(r.above.map(a=>({data:a})),t,n.above)),o}function C(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];a.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:a.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})),stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,smoothingType:r.line.smoothingType,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):a.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(a.data[0].time),cy:e.valueScale.map(a.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:a.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];if(a.data.length<2)continue;let s=K(a.data.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:s,stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function We(i,e,t,n,r){let o=[],a=D(t);for(let s=0;s<i.length;s++){let l=i[s];if(l.data.length<2)continue;let m=l.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(n(h))})),u=l.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(r(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${s}`:void 0,points:[...m,...u],fill:l.color??a.fill,hatch:t.hatch,stroke:"none"});}return o}function J(i,e,t,n){if(i.length<2)return [];let r=T.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let a=0;a<r.length;a++){let s=r[a];if(s.data.length<2)continue;let l=t.getColor(s.zoneIndex);if(!l)continue;let m=s.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yLow(h))})),u=s.data.map(h=>({x:e.timeScale.map(h.time),y:e.valueScale.map(t.yHigh(h))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${a}`:void 0,points:[...m,...u],fill:l,hatch:t.getHatch?.(s.zoneIndex),stroke:"none",...n?.smoothing?{smoothing:true,smoothingType:n.smoothingType,smoothCount:s.data.length,smoothTail:s.data.length}:{}});}return o}function Q(i,e,t,n){let r=D(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let a=0;a<i.length;a++){let s=i[a],l=e.timeScale.map(s.time),m=e.valueScale.map(s.value),u=n(s),h=t.pointStroke??u,c=t.pointFill??u,f=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${a}`:void 0;ee(o,d,r.markers.type,l,m,r.markers.size,h,c,f);}return o.length===0?[]:[{type:"group",cssClass:"series-markers",sharedStyles:true,commands:o}]}function ee(i,e,t,n,r,o,a,s,l){let m=u=>e===void 0?void 0:`${e}-${u}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:a,strokeWidth:l,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:s,stroke:a,strokeWidth:l,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:a,strokeWidth:l,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:a,strokeWidth:l,id:m(2)});break;case "diamond":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r},{x:n,y:r+o},{x:n-o,y:r}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:r-o},{x:n+o,y:r+o},{x:n-o,y:r+o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "star":{let u=[];for(let h=0;h<10;h++){let c=h%2===0?o:o*.5,f=Math.PI/2*3+h*Math.PI/5;u.push({x:n+c*Math.cos(f),y:r+c*Math.sin(f)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-o,y:r+o},{x:n,y:r-o},{x:n+o,y:r+o}],stroke:a,strokeWidth:l,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:l,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:a,strokeWidth:l,id:m(2)});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:r+o},{x:n+o,y:r-o},{x:n-o,y:r-o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "hexagon":{let u=[];for(let h=0;h<6;h++){let c=h*(Math.PI/3);u.push({x:n+o*Math.cos(c),y:r+o*Math.sin(c)});}i.push({type:"path",points:u,closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-o,y:r-o},{x:n+o,y:r-o},{x:n-o,y:r+o},{x:n+o,y:r+o}],closed:true,fill:s,stroke:a,strokeWidth:l,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:l,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:s,stroke:a,strokeWidth:l,id:e});}}var je=[[32,126,"278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584"],[160,255,"278,333,556,556,556,556,260,556,333,737,370,556,584,333,737,552,400,549,333,333,333,576,537,333,333,333,365,556,834,834,834,611,667,667,667,667,667,667,1000,722,667,667,667,667,278,278,278,278,722,722,778,778,778,778,778,584,778,722,722,722,722,667,667,611,556,556,556,556,556,556,889,500,556,556,556,556,278,278,278,278,556,556,556,556,556,556,556,549,611,556,556,556,556,500,556,500"]],be=.6,Oe=(()=>{let i=new Map;for(let[e,,t]of je){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function xe(i){return Oe.get(i)??be}var j=(i,e)=>{let t=0;for(let n of i)t+=xe(n.codePointAt(0)??0);return t*e};var Se={fontFamily:"Liberation Sans, Arial, Helvetica, sans-serif",stroke:"#4285f4",strokeWidth:2,pointSize:4,pointThreshold:100,gapThreshold:0,fill:"none",hatch:null,bandFill:"#4285f4",bandOpacity:.6,bandAvgLine:"#e53e3e",minColor:"#3b82f6",maxColor:"#ef4444",avgColor:"#64748b",areaFillAlpha:"4285f433",axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:11,axisLabelColor:"#444",axisLabelSize:12,gridStroke:"#e2e8f0",gridStrokeWidth:1,gridOpacity:1,legendStroke:"#ccc",legendText:"#333",legendFont:11,annotationColor:"#334155",annotationWidth:1.5,annotationHead:9,annotationRadius:4,annotationFontSize:11,markerFontSize:11,statFontSize:10,tooltipTimeFontSize:10,tooltipValueFontSize:11,thresholdColor:"#666",thresholdLine:"dashed",thresholdFillOpacity:.12,thresholdFontSize:10,highlightColor:"#fbbf24",highlightOpacity:.2,highlightLabelColor:"#92400e",markerColor:"#f59e0b",markerSize:5,gapFill:"#fff",gapStroke:"#ccc",gapStrokeWidth:1,gapFontColor:"#999",gapFontSize:10,gapFillOpacity:.15,tooltipBg:"#fff",tooltipBorder:"#cbd5e1",tooltipText:"#1e293b",tooltipValue:"#3b82f6",tooltipCrosshair:"#94a3b8",tooltipSnapRadius:20,statsLineColor:"#94a3b8",statsLabelColor:"#64748b",minimapStroke:"#94a3b8",minimapBg:"#f8f9fa",minimapBrush:"#3b82f644",palette:["#4285f4","#ea4335","#22c55e","#fbbc05","#9334ea","#12b5e5","#fb923c","#6366f1"]};var Ie={...Se};function M(){return Ie}function Ee(i){let e=i.trim();if(e.startsWith("#"))return e.length===9?e.slice(0,7):e.length===5?e.slice(0,4):e;if(e.toLowerCase().startsWith("rgba(")){let n=e.slice(5,e.lastIndexOf(")")).split(",");if(n.length===4)return `rgb(${n[0].trim()}, ${n[1].trim()}, ${n[2].trim()})`}return e}function He(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function ke(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??Ee(t),a=He(t)?"":' fill-opacity="0.3"';if(e==="none")return `
|
|
2
2
|
<pattern id="${i}" width="10" height="10" patternUnits="userSpaceOnUse">
|
|
3
3
|
<rect width="10" height="10" fill="${t}" />
|
|
4
4
|
</pattern>
|
|
@@ -21,10 +21,10 @@ var Z=class{};var w=class{static interpolateDataPoint(i,e,t){return {time:i.time
|
|
|
21
21
|
${h}
|
|
22
22
|
${u}
|
|
23
23
|
</pattern>
|
|
24
|
-
`.trim()}var p=new Proxy({},{get:(i,e)=>M()[e],has:(i,e)=>e in M(),ownKeys:()=>Reflect.ownKeys(M()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(M(),e)});var O=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var He="#ffffff",ze="#cccccc",Ge=6,Ve=.85,L=12,N=8,I=20,Ne=11,V=18,te=(i,e)=>e(i,Ne);function we(i,e,t){let n=s=>L+N+te(s.name,e);if(t===void 0){let s=i.reduce((l,m)=>l+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],a=0;for(let s of i){let l=n(s),m=o.length===0?l:a+V+l;o.length>0&&m>t?(r.push({items:o,breite:a}),o=[s],a=l):(o=[...o,s],a=m);}return o.length>0&&r.push({items:o,breite:a}),r}function Te(i,e="vertical",t=j,n){if(e==="horizontal"){let o=we(i,t,n);return {width:o.reduce((a,s)=>Math.max(a,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:L+N+r,height:i.length*I}}function Xe(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=j,maxBreite:a,box:s,itemClass:l}=i,m=new O;if(s&&e.length>0){let c=Te(e,r,o,a),d=((r==="horizontal"?c.height/I:e.length)-1)*I+L,g=s.padding??Ge,y=s.stroke??ze;m.rect({x:t-g,y:n-g,w:c.width+2*g,h:d+2*g,fill:s.fill??He,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ve});}let u=r==="horizontal"?we(e,o,a):e.map(c=>({items:[c],breite:0})),h=new Map;return u.forEach((c,f)=>{let d=t;for(let g of c.items)h.set(g,{x:d,y:n+f*I}),d+=L+N+te(g.name,o)+V;}),e.forEach(c=>{let f=h.get(c)??{x:t,y:n},d=f.x,g=f.y,y=["legend-item"];c.id&&y.push(`legend-item--${c.id}`),l&&y.push(l),m.group({cssClass:y.join(" "),...c.id?{id:`legend-${c.id}`}:{}},b=>{b.rect({x:d,y:g,w:L,h:L,fill:c.color,stroke:p.legendStroke,strokeWidth:1}).text({content:c.name,x:d+L+N,y:g+L-2,fontSize:p.legendFont,fill:p.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ye(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=p.gridStroke,strokeWidth:a=p.gridStrokeWidth,dashed:s=false,opacity:l=p.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:a,dashed:s,opacity:l});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:a,dashed:s,opacity:l});return m}var ve=new Map;function Ue(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ue(i,e),n=ve.get(t);return n||(n=new Intl.DateTimeFormat(i,e),ve.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var _=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,a]=this.#t;return r===n?o:o+(t-n)/(r-n)*(a-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},T=[{label:"second",ms:1e3},{label:"2_seconds",ms:2e3},{label:"5_seconds",ms:5e3},{label:"10_seconds",ms:1e4},{label:"30_seconds",ms:3e4},{label:"minute",ms:6e4},{label:"5_minutes",ms:3e5},{label:"15_minutes",ms:9e5},{label:"30_minutes",ms:18e5},{label:"hour",ms:36e5},{label:"3_hours",ms:108e5},{label:"6_hours",ms:216e5},{label:"day",ms:864e5},{label:"week",ms:6048e5},{label:"month",ms:2592e6},{label:"3_months",ms:7776e6},{label:"6_months",ms:15552e6},{label:"year",ms:31536e6},{label:"2_years",ms:63072e6},{label:"5_years",ms:15768e7}],E=class{#e;#t;#n;constructor(e){this.#e=new _({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),a=o-r;if(a<=0)return {interval:T[0].ms};let s=a/e,l=T[0].ms;for(let h of T)if(h.ms>=s){l=h.ms;break}let m=l,u=Math.round(a/m);for(;u>n&&m<T[T.length-1].ms;){let h=T.findIndex(c=>c.ms===m);m=T[Math.min(h+1,T.length-1)].ms,u=Math.round(a/m);}for(;u<t&&m>T[0].ms;){let h=T.findIndex(c=>c.ms===m);m=T[Math.max(h-1,0)].ms,u=Math.round(a/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,a]=this.#e.domain(),s=[],l=Math.ceil(o/r)*r;for(let m=l;m<=a;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},H=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(h=>String(h)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let a=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-a,l=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*l+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),a=Math.abs(e-o);a<n&&(n=a,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ze(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function qe(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[a,s]=t.range(),l=Math.min(a,s),m=Math.max(a,s),u=[],h=[];for(let c of e){let f=c.color??p.thresholdColor,d=t.map(c.value);c.fill==="above"?u.push({type:"rect",x:r,y:l,w:o-r,h:Math.max(0,d-l),fill:f,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&u.push({type:"rect",x:r,y:d,w:o-r,h:Math.max(0,m-d),fill:f,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let g=c.line??p.thresholdLine;if(g!=="none"){let S=Ze(g),k={type:"line",x1:r,y1:d,x2:o,y2:d,stroke:f,strokeWidth:1,...S,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(k.shadowColor=c.shadowColor,k.shadowBlur=c.shadowBlur??4,k.shadowOffsetX=c.shadowOffsetX??0,k.shadowOffsetY=c.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(c.value>=Math.min(y,b)&&c.value<=Math.max(y,b)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,k=typeof c.label=="string"?c.label:S?.text??c.name,F=S?.position??"right",W=Qe(k,F,r,o,d,f,S);h.push({...W,y:Je(W.y,Math.min(a,s),Math.max(a,s),p.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function Ke(i){let e=qe(i);return [...e.inside,...e.labels]}function Je(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function Qe(i,e,t,n,r,o,a){let s=(t+n)/2,l={type:"text",content:i,fontSize:p.thresholdFontSize,fill:o},m=a?{...a.rotate!==void 0&&{rotate:a.rotate},...a.textBaseline!==void 0&&{textBaseline:a.textBaseline}}:{};switch(e){case "left":return {...l,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...l,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...l,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...l,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...l,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...l,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...l,...m,x:n-4,y:r-4,anchor:"end"}}}function Ce(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=j}=i,[a,s]=n,l=[],[m,u]=t.range(),h=Math.min(m,u),c=Math.max(m,u),f=d=>Math.max(h,Math.min(c,d));for(let d of e){let g=f(t.map(d.startTime)),y=f(t.map(d.endTime));if(d.fill!==void 0&&l.push({type:"rect",x:g,y:a,w:y-g,h:s-a,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let b of [g,y])l.push({type:"line",x1:b,y1:a,x2:b,y2:s,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let b=d.labelPosition??"middle",x=d.rotate;if(x==="auto"){let S=b!=="above"&&b!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(y-g)-4?-90:void 0;}l.push({type:"text",content:d.label,x:(g+y)/2,y:Ce(b,a,s,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return l}function et(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=p.gapFill,hatch:a,fillOpacity:s=p.gapFillOpacity??.15,stroke:l=p.gapStroke,strokeWidth:m=p.gapStrokeWidth,dashed:u=true,fontSize:h=p.gapFontSize,fontFill:c=p.gapFontColor,labelBaseline:f="middle",labelRotate:d,metrics:g,band:y}=i,b=()=>{if(!y)return [];let x=y.height??6,[S,k]=n,F=Math.max(S,k);return e.map(W=>{let fe=t.map(W.startTime),ge=t.map(W.endTime);return {type:"rect",x:Math.min(fe,ge),y:F-x+(y.offset??0),w:Math.abs(ge-fe),h:x,fill:y.fill??l,opacity:y.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",F=S==="dashed_border"&&u!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??a,opacity:x.fillOpacity??s},...F&&{edges:{stroke:l,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??f,labelColor:c,fontSize:h,rotate:x.rotate??d}})}).concat(b())}function tt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,a]=r,s=[];for(let l of e){let m=t.map(l.time),u=l.color??p.markerColor,h=l.pointStyle??(l.value!==void 0?"circle":"none"),c=l.lineStyle??"full";if(l.value!==void 0){let f=n.map(l.value);if(c==="to-value"?s.push({type:"line",x1:m,y1:a,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):c==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),h!=="none"&&ee(s,void 0,h,m,f,p.markerSize,u,u,1.5),l.label){let d=c==="to-value"?f-10:o-6;s.push({type:"text",content:l.label,x:m,y:d,anchor:"middle",fontSize:p.markerFontSize,fill:u});}}else c!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),l.label&&s.push({type:"text",content:l.label,x:m,y:o-6,anchor:"middle",fontSize:p.markerFontSize,fill:u});}return s}function nt(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??p.highlightColor,opacity:o.opacity??p.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:o.rotate}))})}function rt(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=a=>{let s=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:s?s.map(a.value):0}};for(let a of e){let s=[],l=m=>s.push(m);switch(a.type){case "line":{let m=o(a.from),u=o(a.to);l({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:a.color??p.annotationColor,strokeWidth:a.width??p.annotationWidth,dash:a.dash});break}case "arrow":{let m=o(a.from),u=o(a.to),h=a.color??p.annotationColor,c=a.headSize??p.annotationHead;l({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:h,strokeWidth:a.width??p.annotationWidth});let f=Math.hypot(u.x-m.x,u.y-m.y)||1,d=(u.x-m.x)/f,g=(u.y-m.y)/f,y=u.x-d*c,b=u.y-g*c;l({type:"path",points:[{x:u.x,y:u.y},{x:y-g*c*.5,y:b+d*c*.5},{x:y+g*c*.5,y:b-d*c*.5}],fill:h,stroke:"none"});break}case "rect":{let m=o(a.from),u=o(a.to);l({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let m=o(a.at),u=a.color??"#334155",h=a.radius??p.annotationRadius,c=a.shape??"circle";c==="circle"?l({type:"circle",cx:m.x,cy:m.y,r:h,fill:u}):c==="square"?l({type:"rect",x:m.x-h,y:m.y-h,w:h*2,h:h*2,fill:u}):(l({type:"line",x1:m.x-h,y1:m.y-h,x2:m.x+h,y2:m.y+h,stroke:u,strokeWidth:1.5}),l({type:"line",x1:m.x-h,y1:m.y+h,x2:m.x+h,y2:m.y-h,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(a.at);l({type:"text",content:a.text,x:m.x+(a.dx??0),y:m.y+(a.dy??0),anchor:a.anchor??ot(m.x+(a.dx??0),a.text,i),fontSize:p.annotationFontSize,fill:a.color??p.annotationColor,rotate:a.rotate});break}}if(a.id&&s.length>0){let m=ne(a.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:s});}else r.push(...s);}return r}function ot(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,a]=r.range(),s=n(e,p.annotationFontSize)/2;return i-s<o?"start":i+s>a?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
|
|
24
|
+
`.trim()}var p=new Proxy({},{get:(i,e)=>M()[e],has:(i,e)=>e in M(),ownKeys:()=>Reflect.ownKeys(M()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(M(),e)});var O=class i{#e=[];get commands(){return [...this.#e]}get length(){return this.#e.length}line(e){return this.#e.push({type:"line",...e}),this}path(e){return this.#e.push({type:"path",...e}),this}rect(e){return this.#e.push({type:"rect",...e}),this}circle(e){return this.#e.push({type:"circle",...e}),this}text(e){return this.#e.push({type:"text",...e}),this}gap(e){return this.#e.push({type:"gap",...e}),this}push(...e){return this.#e.push(...e),this}group(e,t){let n=new i;return t(n),n.length===0?this:(this.#e.push({type:"group",...e,commands:n.commands}),this)}toGroup(e={}){return {type:"group",...e,commands:this.commands}}};var ze="#ffffff",Ge="#cccccc",Ve=6,Ne=.85,L=12,N=8,I=20,Xe=11,V=18,te=(i,e)=>e(i,Xe);function Te(i,e,t){let n=s=>L+N+te(s.name,e);if(t===void 0){let s=i.reduce((l,m)=>l+n(m)+V,0)-V;return [{items:i,breite:Math.max(0,s)}]}let r=[],o=[],a=0;for(let s of i){let l=n(s),m=o.length===0?l:a+V+l;o.length>0&&m>t?(r.push({items:o,breite:a}),o=[s],a=l):(o=[...o,s],a=m);}return o.length>0&&r.push({items:o,breite:a}),r}function we(i,e="vertical",t=j,n){if(e==="horizontal"){let o=Te(i,t,n);return {width:o.reduce((a,s)=>Math.max(a,s.breite),0),height:o.length*I}}let r=0;for(let o of i)r=Math.max(r,te(o.name,t));return {width:L+N+r,height:i.length*I}}function Ye(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=j,maxBreite:a,box:s,itemClass:l}=i,m=new O;if(s&&e.length>0){let c=we(e,r,o,a),d=((r==="horizontal"?c.height/I:e.length)-1)*I+L,g=s.padding??Ve,y=s.stroke??Ge;m.rect({x:t-g,y:n-g,w:c.width+2*g,h:d+2*g,fill:s.fill??ze,...y==="none"?{}:{stroke:y,strokeWidth:s.strokeWidth??1},opacity:s.opacity??Ne});}let u=r==="horizontal"?Te(e,o,a):e.map(c=>({items:[c],breite:0})),h=new Map;return u.forEach((c,f)=>{let d=t;for(let g of c.items)h.set(g,{x:d,y:n+f*I}),d+=L+N+te(g.name,o)+V;}),e.forEach(c=>{let f=h.get(c)??{x:t,y:n},d=f.x,g=f.y,y=["legend-item"];c.id&&y.push(`legend-item--${c.id}`),l&&y.push(l),m.group({cssClass:y.join(" "),...c.id?{id:`legend-${c.id}`}:{}},b=>{b.rect({x:d,y:g,w:L,h:L,fill:c.color,stroke:p.legendStroke,strokeWidth:1}).text({content:c.name,x:d+L+N,y:g+L-2,fontSize:p.legendFont,fill:p.legendText});});}),m.toGroup({cssClass:"chart-legend"})}function Ue(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=p.gridStroke,strokeWidth:a=p.gridStrokeWidth,dashed:s=false,opacity:l=p.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:a,dashed:s,opacity:l});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:a,dashed:s,opacity:l});return m}var ve=new Map;function Ze(i,e){return `${i}|${JSON.stringify(e??{})}`}function B(i,e){let t=Ze(i,e),n=ve.get(t);return n||(n=new Intl.DateTimeFormat(i,e),ve.set(t,n)),n}function X(){return typeof navigator<"u"?navigator.language:void 0}var _=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,a]=this.#t;return r===n?o:o+(t-n)/(r-n)*(a-o)}invert(e){let[t,n]=this.#e,[r,o]=this.#t;return o===r?t:t+(e-r)/(o-r)*(n-t)}domain(){return [...this.#e]}range(){return [...this.#t]}},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 _({domain:e.domain,range:e.range}),this.#t=e.locale||(X()??"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),a=o-r;if(a<=0)return {interval:w[0].ms};let s=a/e,l=w[0].ms;for(let h of w)if(h.ms>=s){l=h.ms;break}let m=l,u=Math.round(a/m);for(;u>n&&m<w[w.length-1].ms;){let h=w.findIndex(c=>c.ms===m);m=w[Math.min(h+1,w.length-1)].ms,u=Math.round(a/m);}for(;u<t&&m>w[0].ms;){let h=w.findIndex(c=>c.ms===m);m=w[Math.max(h-1,0)].ms,u=Math.round(a/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:r}=this.tickInterval((t+n)/2,t,n),[o,a]=this.#e.domain(),s=[],l=Math.ceil(o/r)*r;for(let m=l;m<=a;m+=r)s.push(m);return s}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return B(this.#t,n).format(new Date(e))}},H=class{#e;#t;#n;#r;constructor(e){this.#e=[...e.domain],this.#t=[...e.range],this.#n=e.paddingInner??.1,this.#r=e.paddingOuter??.05;}get step(){let[e,t]=this.#t,n=this.#e.length;return n<=1?Math.abs(t-e):Math.abs(t-e)*(1-this.#r*2)/n+Math.abs(t-e)*this.#n*2/n}get bandwidth(){let[e,t]=this.#t,n=this.#e.length;if(n<=1)return Math.abs(t-e)*(1-this.#r*2);let r=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-r)/n*(1-this.#n)}map(e){let t=this.#e.findIndex(h=>String(h)===String(e));if(t===-1)return this.#t[0];let[n,r]=this.#t,o=this.#e.length;if(o<=1)return (n+r)/2;let a=this.#r*2*Math.abs(r-n),s=Math.abs(r-n)-a,l=r>=n?1:-1,m=s/o;return n+this.#r*Math.abs(r-n)*l+t*m}invert(e){let t=0,n=1/0;for(let r=0;r<this.#e.length;r++){let o=this.map(this.#e[r]),a=Math.abs(e-o);a<n&&(n=a,t=r);}return this.#e[t]}domain(){return this.#e.length===0?["",""]:[this.#e[0],this.#e[this.#e.length-1]]}range(){return [...this.#t]}positions(){let e=new Map;for(let t of this.#e)e.set(t,this.map(t));return e}};function ne(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function Ke(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function qe(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[a,s]=t.range(),l=Math.min(a,s),m=Math.max(a,s),u=[],h=[];for(let c of e){let f=c.color??p.thresholdColor,d=t.map(c.value);c.fill==="above"?u.push({type:"rect",x:r,y:l,w:o-r,h:Math.max(0,d-l),fill:f,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0}):c.fill==="below"&&u.push({type:"rect",x:r,y:d,w:o-r,h:Math.max(0,m-d),fill:f,hatch:c.fillHatch,opacity:c.fillOpacity??.12,id:c.id?`${c.id}-fill`:void 0});let g=c.line??p.thresholdLine;if(g!=="none"){let S=Ke(g),k={type:"line",x1:r,y1:d,x2:o,y2:d,stroke:f,strokeWidth:1,...S,id:c.id?`${c.id}-line`:void 0};c.shadowColor&&(k.shadowColor=c.shadowColor,k.shadowBlur=c.shadowBlur??4,k.shadowOffsetX=c.shadowOffsetX??0,k.shadowOffsetY=c.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(c.value>=Math.min(y,b)&&c.value<=Math.max(y,b)&&c.label!==void 0&&c.label!==null&&c.label!==false){let S=typeof c.label=="object"?c.label:void 0,k=typeof c.label=="string"?c.label:S?.text??c.name,F=S?.position??"right",W=et(k,F,r,o,d,f,S);h.push({...W,y:Qe(W.y,Math.min(a,s),Math.max(a,s),p.thresholdFontSize),id:c.id?`${c.id}-label`:void 0});}}return {inside:u,labels:h}}function Je(i){let e=qe(i);return [...e.inside,...e.labels]}function Qe(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function et(i,e,t,n,r,o,a){let s=(t+n)/2,l={type:"text",content:i,fontSize:p.thresholdFontSize,fill:o},m=a?{...a.rotate!==void 0&&{rotate:a.rotate},...a.textBaseline!==void 0&&{textBaseline:a.textBaseline}}:{};switch(e){case "left":return {...l,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...l,...m,x:s,y:r-6,anchor:"middle"};case "below":return {...l,...m,x:s,y:r+14,anchor:"middle"};case "center":return {...l,...m,x:s,y:r-4,anchor:"middle"};case "outside-left":return {...l,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...l,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...l,...m,x:n-4,y:r-4,anchor:"end"}}}function Ce(i,e,t,n){switch(i){case "above":return e-5;case "below":return n!==void 0?n-5:t+14;case "center":case "middle":return (e+t)/2+4;case "bottom":return t-6;default:return e+14}}function Y(i){let{ranges:e,timeScale:t,yRange:n,height:r,metrics:o=j}=i,[a,s]=n,l=[],[m,u]=t.range(),h=Math.min(m,u),c=Math.max(m,u),f=d=>Math.max(h,Math.min(c,d));for(let d of e){let g=f(t.map(d.startTime)),y=f(t.map(d.endTime));if(d.fill!==void 0&&l.push({type:"rect",x:g,y:a,w:y-g,h:s-a,fill:d.fill,hatch:d.hatch,opacity:d.opacity}),d.edges)for(let b of [g,y])l.push({type:"line",x1:b,y1:a,x2:b,y2:s,stroke:d.edges.stroke,strokeWidth:d.edges.strokeWidth,dash:"dashed"});if(d.label){let b=d.labelPosition??"middle",x=d.rotate;if(x==="auto"){let S=b!=="above"&&b!=="below",k=o(d.label,d.fontSize??11);x=S&&k>Math.abs(y-g)-4?-90:void 0;}l.push({type:"text",content:d.label,x:(g+y)/2,y:Ce(b,a,s,r),anchor:"middle",fontSize:d.fontSize,fill:d.labelColor,rotate:x});}}return l}function tt(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=p.gapFill,hatch:a,fillOpacity:s=p.gapFillOpacity??.15,stroke:l=p.gapStroke,strokeWidth:m=p.gapStrokeWidth,dashed:u=true,fontSize:h=p.gapFontSize,fontFill:c=p.gapFontColor,labelBaseline:f="middle",labelRotate:d,metrics:g,band:y}=i,b=()=>{if(!y)return [];let x=y.height??6,[S,k]=n,F=Math.max(S,k);return e.map(W=>{let fe=t.map(W.startTime),ge=t.map(W.endTime);return {type:"rect",x:Math.min(fe,ge),y:F-x+(y.offset??0),w:Math.abs(ge-fe),h:x,fill:y.fill??l,opacity:y.opacity??.75}})};return Y({timeScale:t,yRange:n,height:r,metrics:g,ranges:e.map(x=>{let S=x.style??"dashed_border",k=S==="filled"||S==="dashed_border",F=S==="dashed_border"&&u!==false;return {startTime:x.startTime,endTime:x.endTime,...k&&{fill:x.fill??o,hatch:x.hatch??a,opacity:x.fillOpacity??s},...F&&{edges:{stroke:l,strokeWidth:m}},label:x.label,labelPosition:x.labelBaseline??f,labelColor:c,fontSize:h,rotate:x.rotate??d}})}).concat(b())}function nt(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,a]=r,s=[];for(let l of e){let m=t.map(l.time),u=l.color??p.markerColor,h=l.pointStyle??(l.value!==void 0?"circle":"none"),c=l.lineStyle??"full";if(l.value!==void 0){let f=n.map(l.value);if(c==="to-value"?s.push({type:"line",x1:m,y1:a,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):c==="to-top"?s.push({type:"line",x1:m,y1:o,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):c==="full"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),h!=="none"&&ee(s,void 0,h,m,f,p.markerSize,u,u,1.5),l.label){let d=c==="to-value"?f-10:o-6;s.push({type:"text",content:l.label,x:m,y:d,anchor:"middle",fontSize:p.markerFontSize,fill:u});}}else c!=="none"&&s.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),l.label&&s.push({type:"text",content:l.label,x:m,y:o-6,anchor:"middle",fontSize:p.markerFontSize,fill:u});}return s}function rt(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return Y({metrics:i.metrics,timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??p.highlightColor,opacity:o.opacity??p.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:o.rotate}))})}function ot(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=a=>{let s=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:s?s.map(a.value):0}};for(let a of e){let s=[],l=m=>s.push(m);switch(a.type){case "line":{let m=o(a.from),u=o(a.to);l({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:a.color??p.annotationColor,strokeWidth:a.width??p.annotationWidth,dash:a.dash});break}case "arrow":{let m=o(a.from),u=o(a.to),h=a.color??p.annotationColor,c=a.headSize??p.annotationHead;l({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:h,strokeWidth:a.width??p.annotationWidth});let f=Math.hypot(u.x-m.x,u.y-m.y)||1,d=(u.x-m.x)/f,g=(u.y-m.y)/f,y=u.x-d*c,b=u.y-g*c;l({type:"path",points:[{x:u.x,y:u.y},{x:y-g*c*.5,y:b+d*c*.5},{x:y+g*c*.5,y:b-d*c*.5}],fill:h,stroke:"none"});break}case "rect":{let m=o(a.from),u=o(a.to);l({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let m=o(a.at),u=a.color??"#334155",h=a.radius??p.annotationRadius,c=a.shape??"circle";c==="circle"?l({type:"circle",cx:m.x,cy:m.y,r:h,fill:u}):c==="square"?l({type:"rect",x:m.x-h,y:m.y-h,w:h*2,h:h*2,fill:u}):(l({type:"line",x1:m.x-h,y1:m.y-h,x2:m.x+h,y2:m.y+h,stroke:u,strokeWidth:1.5}),l({type:"line",x1:m.x-h,y1:m.y+h,x2:m.x+h,y2:m.y-h,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(a.at);l({type:"text",content:a.text,x:m.x+(a.dx??0),y:m.y+(a.dy??0),anchor:a.anchor??it(m.x+(a.dx??0),a.text,i),fontSize:p.annotationFontSize,fill:a.color??p.annotationColor,rotate:a.rotate});break}}if(a.id&&s.length>0){let m=ne(a.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:s});}else r.push(...s);}return r}function it(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,a]=r.range(),s=n(e,p.annotationFontSize)/2;return i-s<o?"start":i+s>a?"end":"middle"}var re=class i{_config;constructor(e){this._config=e;}compute(){let{width:e,height:t,margin:n}=this._config;return {totalWidth:e,totalHeight:t,chartWidth:e-n.left-n.right,chartHeight:t-n.top-n.bottom,chartX:n.left,chartY:n.top,margin:n}}static default(e=800,t=400){return new i({width:e,height:t,margin:{top:20,right:20,bottom:40,left:60}})}};var oe=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
|
|
25
25
|
`);return `<clipPath id="${e}">
|
|
26
26
|
${t}
|
|
27
|
-
</clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let a=1;a<=e;a++)t.push(r+(o-r)*a/(e+1));}return t}var z={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},G=class{#e;#t;constructor(e){this.#e=new E({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??z).axisColor}get tickColor(){return (this.#t.colors??z).tickColor}get textColor(){return (this.#t.colors??z).textColor}get textSize(){return (this.#t.colors??z).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??z,n=this.#t.y??0,r=[],[o,a]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:a,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let a=o(t,n)/2;return Math.max(a+2,Math.min(r-a-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Me(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function it(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ie=class{#e;#t;constructor(e){this.#e=new _({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??P).axisColor}get tickColor(){return (this.#t.colors??P).tickColor}get textColor(){return (this.#t.colors??P).textColor}get textSize(){return (this.#t.colors??P).textSize}generateTicks(){let e=this.#t.tickValues;if(e&&e.length>0){let g=this.#t.format??Me;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??Me,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),a=Math.min(r,o),s=Math.max(r,o),l=s-a;if(l===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=l/n,u=Math.pow(10,Math.floor(Math.log10(m))),h=m/u,c;if(h<=1.5?c=u:h<=3?c=2*u:h<=7?c=5*u:c=10*u,c<=0||!Number.isFinite(c))return [{value:r,position:this.#e.map(r),label:t(r)}];let f=[],d=Math.ceil(a/c)*c;for(let g=d;g<=s;g+=c)f.push({value:g,position:this.#e.map(g),label:t(g)});return f}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??P,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",a=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,l=h=>a.some(c=>Math.abs(c-h)<=s),m=[];if(r==="vertical"){let[h,c]=this.#e.range();m.push({type:"line",x1:n,y1:h,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let f=it(e);e.forEach((d,g)=>{let y=l(d.position),b=f[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[h,c]=this.#e.range();m.push({type:"line",x1:h,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let f of e)m.push({type:"line",x1:f.position,y1:n,x2:f.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:f.label,x:f.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())m.push(u?{type:"line",x1:o==="right"?n:n-2,y1:h,x2:o==="right"?n+2:n,y2:h,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:h,y1:n,x2:h,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let a=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(a+2,Math.min(r-2,e)):Math.min(r-a-2,Math.max(2,e))}};var ae=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,a)=>o.time-a.time),r=[];for(let o=0;o<n.length;o++){let a=Math.max(0,o-t+1),s=n.slice(a,o+1),l=s.reduce((m,u)=>m+u.value,0)/s.length;r.push({time:n[o].time,value:l});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,l)=>s.time-l.time);if(n.length===0)return [];let r=2/(t+1),o=[],a=n[0].value;o.push({time:n[0].time,value:a});for(let s=1;s<n.length;s++)a=n[s].value*r+a*(1-r),o.push({time:n[s].time,value:a});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var se=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new H({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((a,s)=>{let l=Number(a),m=t?e[l]??String(l):String(l),u=this.#e.map(l),h=n?p.palette[s%p.palette.length]:void 0;return {value:l,label:m,y:u,color:h,isGap:o.has(l)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return p.palette[t%p.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:p.textSize,fill:r.color??p.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var v=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var le=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??p.stroke,strokeWidth:e.strokeWidth??p.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??p.pointThreshold,r=e.gapThreshold??p.gapThreshold,o=e.id,a=w.getRuns(this.data,h=>h.value===null,r),s=a.reduce((h,c)=>h+c.length,0);if(s===0)return [];let l={timeScale:this.timeScale,valueScale:e.valueScale},m=a.map(h=>({data:h})),u=[];if(u.push(...C(m,l,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n)for(let h of a)u.push(...Q(h,l,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var me=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),a=e.map(t[r].value);r===0?n.push({x:o,y:a}):n.push({x:o,y:n[n.length-1].y},{x:o,y:a});}return n}render(){let e=w.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return K(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ue=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??p.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??p.bandAvgLine,a=e.bandWidth??10,s=[];for(let l of this.data){if(l.min===null||l.max===null)continue;let m=this.timeScale.map(l.time),u=e.valueScale.map(l.max),h=e.valueScale.map(l.min),c=a,f=this.data.indexOf(l);if(s.push({type:"rect",x:m-c/2,y:u,w:c,h:h-u,fill:t,hatch:n,opacity:this.opacity(l.count),id:this.id?`${this.id}-slot-${f}`:void 0}),r&&l.avg!==null){let d=e.valueScale.map(l.avg);s.push({type:"line",x1:m-c/2,y1:d,x2:m+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${f}`:void 0});}}return s}};function Le(i,e,t,n,r,o,a){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:w.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...a})}var ce=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,r=e.avgColor??p.avgColor,o=e.avgDashed??true,a=e.smoothing??false,s=e.smoothingType,l=e.strokeWidth??p.strokeWidth,m=w.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];m.forEach((d,g)=>{if(d.length<2)return;let y=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Le(d,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:a,smoothingType:s});h.push(...b);}if(e.fillToMin){let b=Le(d,u,x=>x.min,e.fillToMin,e.fillToMinHatch,y("fillToMin"),{smoothing:a,smoothingType:s});h.push(...b);}});let c=m.filter(d=>d.length>=2),f=(d,g,y,b=false)=>C(c.map(x=>({data:x.map(S=>({time:S.time,value:d(S)}))})),u,{stroke:g,strokeWidth:l,smoothing:a,smoothingType:s,dashed:b,id:this.id?`${this.id}-${y}`:void 0});return h.push(...f(d=>d.max,n,"max"),...f(d=>d.min,t,"min"),...f(d=>d.avg,r,"avg",o)),h}};var at=1,he=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:a,y:s,height:l}=this.#e,m=[];n&&m.push({type:"rect",x:a[0],y:s,w:a[1]-a[0],h:l,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let h=t.map(u.startTime),c=t.map(u.endTime);if(c<a[0]||h>a[1])continue;let f=Math.max(a[0],Math.min(a[1],h)),d=Math.max(a[0],Math.min(a[1],c)),g=Math.max(d-f,at);f+g>a[1]&&(f=Math.max(a[0],a[1]-g));let y=f+g/2;if(m.push({type:"rect",x:f,y:s,w:g,h:l,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new G({domain:t.domain(),xRange:a,y:s+l+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var de=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:a=true,showMedian:s=false,labelPosition:l="end",lineColor:m=p.statsLineColor,labelColor:u=p.statsLabelColor}=this.#e,h=ye.compute(e),c=[{name:"min",value:h.min,enabled:r},{name:"max",value:h.max,enabled:o},{name:"avg",value:h.avg,enabled:a},{name:"median",value:h.median,enabled:s}],f=[],[d,g]=n;for(let y of c.filter(b=>b.enabled)){let b=t.map(y.value);f.push({type:"line",x1:d,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let x=`${y.name}: ${y.value.toFixed(1)}`;(l==="start"||l==="both")&&f.push({type:"text",content:x,x:d+4,y:b-4,anchor:"start",fontSize:p.statFontSize,fill:u}),(l==="end"||l==="both")&&f.push({type:"text",content:x,x:g-4,y:b-4,anchor:"end",fontSize:p.statFontSize,fill:u}),l==="center"&&f.push({type:"text",content:x,x:(d+g)/2,y:b-4,anchor:"middle",fontSize:p.statFontSize,fill:u});}return f}};var A=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return B(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return B(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,a=36e5,s=6e4,l={};return r<s?(l.second="2-digit",l.minute="2-digit",l.hour="2-digit"):r<a?(l.minute="2-digit",l.hour="2-digit"):r<o?(l.hour="2-digit",l.minute="2-digit"):r<7*o?(l.weekday="short",l.day="numeric"):r<365*o?(l.month="short",l.day="numeric"):(l.month="short",l.year="numeric"),{...n,...l}}};var R=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var $=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var st={time:new A,value:new R,enum:new $};function pe(i,e){let t=M();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function De(i){let e=i.style?.line;return e===false?[]:e===void 0?[pe({},i)]:Array.isArray(e)?e.map(t=>pe(t,i)):[pe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=M(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Pe(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function Ae(i){return i.style?.gap}function Re(i){return i.style?.fill}function lt(i){return {lines:De(i),fill:Re(i),markers:_e(i),shadow:Pe(i),gap:Ae(i),id:i.style?.id??i.id}}/*!
|
|
27
|
+
</clipPath>`}get regions(){return [...this.#e]}};function U(i,e){if(e<=0||i.length<2)return [];let t=[];for(let n=0;n<i.length-1;n++){let r=i[n],o=i[n+1];for(let a=1;a<=e;a++)t.push(r+(o-r)*a/(e+1));}return t}var z={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},G=class{#e;#t;constructor(e){this.#e=new E({domain:e.domain,range:e.xRange,locale:e.locale,timeZone:e.timeZone}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??z).axisColor}get tickColor(){return (this.#t.colors??z).tickColor}get textColor(){return (this.#t.colors??z).textColor}get textSize(){return (this.#t.colors??z).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,r=this.#e.ticks({minTicks:e,maxTicks:t}).map(o=>({time:o,x:this.#e.map(o),label:this.tickLabel(o)}));return this.antiOverlap(r)}tickLabel(e){if(this.#t.format)return this.#t.format(new Date(e));let t=this.#t.minTicks??5,n=this.#t.maxTicks??12,{interval:r}=this.#e.tickInterval((t+n)/2,t,n),o={};return r<6e4?(o.hour="2-digit",o.minute="2-digit",o.second="2-digit"):r<36e5||r<864e5?(o.hour="2-digit",o.minute="2-digit"):r<31536e6?(o.day="numeric",o.month="short",r>=2592e6&&(o.day=void 0,o.month="long")):(o.year="numeric",r<2*31536e6&&(o.month="short")),this.#e.format(e,o)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let r=1;r<e.length;r++){let o=n[n.length-1].x;Math.abs(e[r].x-o)>=t&&n.push(e[r]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??z,n=this.#t.y??0,r=[],[o,a]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:a,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let s of this.generateMinorTicks())r.push({type:"line",x1:s,y1:n,x2:s,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let s of e)r.push({type:"line",x1:s.x,y1:n,x2:s.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:s.label,x:this.#n(s.x,s.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return U(this.generateTicks().map(e=>e.x),this.#t.minorTicks??0)}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let a=o(t,n)/2;return Math.max(a+2,Math.min(r-a-2,e))}};var A={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Me(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function at(i){let e=new Array(i.length).fill(false),t=0;for(;t<i.length;){let n=t;for(;n+1<i.length&&i[n+1].label===i[t].label;)n++;for(let r=t+1;r<n;r++)e[r]=true;t=n+1;}return e}var ie=class{#e;#t;constructor(e){this.#e=new _({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??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??Me;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??Me,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),a=Math.min(r,o),s=Math.max(r,o),l=s-a;if(l===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=l/n,u=Math.pow(10,Math.floor(Math.log10(m))),h=m/u,c;if(h<=1.5?c=u:h<=3?c=2*u:h<=7?c=5*u:c=10*u,c<=0||!Number.isFinite(c))return [{value:r,position:this.#e.map(r),label:t(r)}];let f=[],d=Math.ceil(a/c)*c;for(let g=d;g<=s;g+=c)f.push({value:g,position:this.#e.map(g),label:t(g)});return f}generateMinorTicks(){return U(this.generateTicks().map(e=>e.position),this.#t.minorTicks??0)}render(){let e=this.generateTicks(),t=this.#t.colors??A,n=this.#t.x??0,r=this.#t.orientation??"vertical",o=this.#t.position??"left",a=this.#t.suppressLabelsNear??[],s=this.#t.suppressTolerancePx??8,l=h=>a.some(c=>Math.abs(c-h)<=s),m=[];if(r==="vertical"){let[h,c]=this.#e.range();m.push({type:"line",x1:n,y1:h,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let f=at(e);e.forEach((d,g)=>{let y=l(d.position),b=f[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[h,c]=this.#e.range();m.push({type:"line",x1:h,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let f of e)m.push({type:"line",x1:f.position,y1:n,x2:f.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:f.label,x:f.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let h of this.generateMinorTicks())m.push(u?{type:"line",x1:o==="right"?n:n-2,y1:h,x2:o==="right"?n+2:n,y2:h,stroke:t.tickColor,strokeWidth:t.axisWidth}:{type:"line",x1:h,y1:n,x2:h,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});return m}#n(e,t,n){let r=this.#t.gesamtbreite,o=this.#t.metrics;if(r===void 0||o===void 0)return e;let a=o(t,(this.#t.colors??A).textSize);return n==="end"?Math.max(a+2,Math.min(r-2,e)):Math.min(r-a-2,Math.max(2,e))}};var ae=class i{#e;#t;#n;#r;#a;#o;#i;constructor(e){this.#e=[...e.data].sort((t,n)=>t.time-n.time),this.#t=e.windowSize,this.#n=e.type??"simple",this.#r=e.timeScale,this.#a=e.valueScale,this.#o=e.stroke??"#e53e3e",this.#i=e.strokeWidth??2;}static simple(e,t){let n=[...e].filter(o=>o.value!==null).sort((o,a)=>o.time-a.time),r=[];for(let o=0;o<n.length;o++){let a=Math.max(0,o-t+1),s=n.slice(a,o+1),l=s.reduce((m,u)=>m+u.value,0)/s.length;r.push({time:n[o].time,value:l});}return r}static exponential(e,t){let n=[...e].filter(s=>s.value!==null).sort((s,l)=>s.time-l.time);if(n.length===0)return [];let r=2/(t+1),o=[],a=n[0].value;o.push({time:n[0].time,value:a});for(let s=1;s<n.length;s++)a=n[s].value*r+a*(1-r),o.push({time:n[s].time,value:a});return o}points(){return (this.#n==="exponential"?i.exponential(this.#e,this.#t):i.simple(this.#e,this.#t)).map(t=>({x:this.#r.map(t.time),y:this.#a.map(t.value)}))}render(){let e=this.points();return e.length<2?e.map(t=>({type:"circle",cx:t.x,cy:t.y,r:this.#i,fill:this.#o})):[{type:"path",points:e,smoothing:true,stroke:this.#o,strokeWidth:this.#i}]}};var se=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,r)=>n-r).map(String);this.#t=t,this.#e=new H({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:r}=this.#n,o=new Set(r??[]);return this.#t.map((a,s)=>{let l=Number(a),m=t?e[l]??String(l):String(l),u=this.#e.map(l),h=n?p.palette[s%p.palette.length]:void 0;return {value:l,label:m,y:u,color:h,isGap:o.has(l)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return p.palette[t%p.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let r of e)r.isGap||n.push({type:"text",content:r.label,x:t,y:r.y+4,anchor:"end",fontSize:p.textSize,fill:r.color??p.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var v=class i{#e;#t;static uidcnt=0;#n;constructor(e,t=[]){this.#e=e.id??"series-"+ ++i.uidcnt,this.#t=e.timeScale,this.#n=t;}get id(){return this.#e}get timeScale(){return this.#t}get data(){return this.#n}};var le=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,smoothingType:e.smoothingType,stroke:e.stroke??p.stroke,strokeWidth:e.strokeWidth??p.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??p.pointThreshold,r=e.gapThreshold??p.gapThreshold,o=e.id,a=T.getRuns(this.data,h=>h.value===null,r),s=a.reduce((h,c)=>h+c.length,0);if(s===0)return [];let l={timeScale:this.timeScale,valueScale:e.valueScale},m=a.map(h=>({data:h})),u=[];if(u.push(...C(m,l,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&s<=n)for(let h of a)u.push(...Q(h,l,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var me=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(r=>r.value!==null).sort((r,o)=>r.time-o.time),n=[];for(let r=0;r<t.length;r++){let o=this.timeScale.map(t[r].time),a=e.map(t[r].value);r===0?n.push({x:o,y:a}):n.push({x:o,y:n[n.length-1].y},{x:o,y:a});}return n}render(){let e=T.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var ue=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}opacity(e){if(!(this.#e.countOpacity??false))return .6;let t=0;for(let n of this.data)n.count>t&&(t=n.count);return t===0?.2:.2+.8*e/t}render(){let e=this.#e,t=e.fill??p.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??p.bandAvgLine,a=e.bandWidth??10,s=[];for(let l of this.data){if(l.min===null||l.max===null)continue;let m=this.timeScale.map(l.time),u=e.valueScale.map(l.max),h=e.valueScale.map(l.min),c=a,f=this.data.indexOf(l);if(s.push({type:"rect",x:m-c/2,y:u,w:c,h:h-u,fill:t,hatch:n,opacity:this.opacity(l.count),id:this.id?`${this.id}-slot-${f}`:void 0}),r&&l.avg!==null){let d=e.valueScale.map(l.avg);s.push({type:"line",x1:m-c/2,y1:d,x2:m+c/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${f}`:void 0});}}return s}};function Le(i,e,t,n,r,o,a){return J(i,e,{boundaries:[],yLow:s=>s.avg,yHigh:t,getValue:s=>s.avg,interpolate:T.interpolateAggregatedPoint,getColor:()=>n,getHatch:()=>r},{id:o,...a})}var ce=class extends v{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,r=e.avgColor??p.avgColor,o=e.avgDashed??true,a=e.smoothing??false,s=e.smoothingType,l=e.strokeWidth??p.strokeWidth,m=T.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},h=[];m.forEach((d,g)=>{if(d.length<2)return;let y=b=>this.id?`${this.id}-${b}-${g}`:void 0;if(e.fillToMax){let b=Le(d,u,x=>x.max,e.fillToMax,e.fillToMaxHatch,y("fillToMax"),{smoothing:a,smoothingType:s});h.push(...b);}if(e.fillToMin){let b=Le(d,u,x=>x.min,e.fillToMin,e.fillToMinHatch,y("fillToMin"),{smoothing:a,smoothingType:s});h.push(...b);}});let c=m.filter(d=>d.length>=2),f=(d,g,y,b=false)=>C(c.map(x=>({data:x.map(S=>({time:S.time,value:d(S)}))})),u,{stroke:g,strokeWidth:l,smoothing:a,smoothingType:s,dashed:b,id:this.id?`${this.id}-${y}`:void 0});return h.push(...f(d=>d.max,n,"max"),...f(d=>d.min,t,"min"),...f(d=>d.avg,r,"avg",o)),h}};var st=1,he=class{#e;constructor(e,t,n,r){this.#e={...e,xRange:t,y:n,height:r};}render(){let{items:e,timeScale:t,background:n,hatch:r,showAxis:o,xRange:a,y:s,height:l}=this.#e,m=[];n&&m.push({type:"rect",x:a[0],y:s,w:a[1]-a[0],h:l,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let h=t.map(u.startTime),c=t.map(u.endTime);if(c<a[0]||h>a[1])continue;let f=Math.max(a[0],Math.min(a[1],h)),d=Math.max(a[0],Math.min(a[1],c)),g=Math.max(d-f,st);f+g>a[1]&&(f=Math.max(a[0],a[1]-g));let y=f+g/2;if(m.push({type:"rect",x:f,y:s,w:g,h:l,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new G({domain:t.domain(),xRange:a,y:s+l+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var de=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:a=true,showMedian:s=false,labelPosition:l="end",lineColor:m=p.statsLineColor,labelColor:u=p.statsLabelColor}=this.#e,h=ye.compute(e),c=[{name:"min",value:h.min,enabled:r},{name:"max",value:h.max,enabled:o},{name:"avg",value:h.avg,enabled:a},{name:"median",value:h.median,enabled:s}],f=[],[d,g]=n;for(let y of c.filter(b=>b.enabled)){let b=t.map(y.value);f.push({type:"line",x1:d,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let x=`${y.name}: ${y.value.toFixed(1)}`;(l==="start"||l==="both")&&f.push({type:"text",content:x,x:d+4,y:b-4,anchor:"start",fontSize:p.statFontSize,fill:u}),(l==="end"||l==="both")&&f.push({type:"text",content:x,x:g-4,y:b-4,anchor:"end",fontSize:p.statFontSize,fill:u}),l==="center"&&f.push({type:"text",content:x,x:(d+g)/2,y:b-4,anchor:"middle",fontSize:p.statFontSize,fill:u});}return f}};var P=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(X()??"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return B(this.#e,r).format(new Date(e))}catch{for(let r of this.#t)try{return B(r,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),r=this.format(t);return `${n} \u2014 ${r}`}#r(e,t,n){let r=Math.abs(e-t),o=864e5,a=36e5,s=6e4,l={};return r<s?(l.second="2-digit",l.minute="2-digit",l.hour="2-digit"):r<a?(l.minute="2-digit",l.hour="2-digit"):r<o?(l.hour="2-digit",l.minute="2-digit"):r<7*o?(l.weekday="short",l.day="numeric"):r<365*o?(l.month="short",l.day="numeric"):(l.month="short",l.year="numeric"),{...n,...l}}};var R=class i{#e;#t;_compact;#n;constructor(e){this.#e=e?.unit??"",this.#t=e?.decimals??1,this._compact=e?.compact??false,this.#n=e?.custom;}format(e){if(this.#n)return this.#n(e);let t;return this._compact&&Math.abs(e)>=1e6?t=`${(e/1e6).toFixed(this.#t)}M`:this._compact&&Math.abs(e)>=1e3?t=`${(e/1e3).toFixed(this.#t)}k`:t=e.toFixed(this.#t),this.#e?`${t}${this.#e}`:t}formatRange(e,t){return `${this.format(e)} \u2014 ${this.format(t)}`}static unit(e,t=1){return new i({unit:e,decimals:t})}static temperature(e="\xB0C"){return new i({unit:e,decimals:1})}static percentage(){return new i({unit:"%",decimals:0})}};var $=class i{#e;#t;#n;constructor(e){this.#e=e?.map??{},this.#t=e?.fallback??(t=>String(t)),this.#n=e?.showValue??false;}format(e){let t=this.#e[e]??this.#t(e);return this.#n?`(${e}) ${t}`:t}has(e){return e in this.#e}labels(){return Object.values(this.#e)}values(){return Object.keys(this.#e).map(Number)}static fromLabels(e,t=false){let n={};return e.forEach((r,o)=>{n[o]=r;}),new i({map:n,showValue:t})}};var lt={time:new P,value:new R,enum:new $};function pe(i,e){let t=M();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,smoothingType:i.smoothingType,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function De(i){let e=i.style?.line;return e===false?[]:e===void 0?[pe({},i)]:Array.isArray(e)?e.map(t=>pe(t,i)):[pe(e,i)]}function _e(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=M(),r=(i.style?.line&&!Array.isArray(i.style.line)?i.style.line.color:void 0)??t.stroke;return {type:e.type,size:e.size??t.pointSize,stroke:e.stroke??r,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function Ae(i){let e=i.style?.shadow;if(!(!e?.color||e.color==="transparent"||e.color==="none"))return {color:e.color,blur:e.blur??4,offsetX:e.offsetX??0,offsetY:e.offsetY??0}}function Pe(i){return i.style?.gap}function Re(i){return i.style?.fill}function mt(i){return {lines:De(i),fill:Re(i),markers:_e(i),shadow:Ae(i),gap:Pe(i),id:i.style?.id??i.id}}/*!
|
|
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 w=class{static interpolateDataPoint(i,e,t){return {time:i.time
|
|
|
43
43
|
* MLTimeGraph — Copyright (c) 2026 Michael Lechner
|
|
44
44
|
* MIT with Attribution: free use incl. commercial must have visible credit to
|
|
45
45
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
46
|
-
*/export{he as AnnotationBandSeries,H as BandScale,ue as BandSeries,oe as Clip,O as CommandBuilder,se as EnumAxis,$ as EnumFormatter,
|
|
46
|
+
*/export{he as AnnotationBandSeries,H as BandScale,ue as BandSeries,oe as Clip,O as CommandBuilder,se as EnumAxis,$ as EnumFormatter,lt as Formatters,re as Layout,le as LineSeries,_ as LinearScale,ce as MinMaxAvgSeries,ae as MovingAvg,Z as Renderer,de as StatsOverlay,me as StepSeries,w as TIME_INTERVALS,G as TimeAxis,P as TimeFormatter,E as TimeScale,ie as ValueAxis,R as ValueFormatter,ke as getHatch,we as measureLegend,ot as renderAnnotations,We as renderArea,tt as renderGaps,Ue as renderGrid,rt as renderHighlights,Ye as renderLegend,C as renderLine,nt as renderMarkers,Q as renderSeriesMarkers,Fe as renderSplitLine,q as renderStep,Je as renderThresholds,J as renderZonedArea,Re as resolveFill,Pe as resolveGap,De as resolveLines,_e as resolveMarkers,mt as resolveSeriesStyle,Ae as resolveShadow,ne as slugify,p as theme,$e as toStepData,K as toStepPoints};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DrawCommand, b as LineVariant, P as PointStyleType,
|
|
1
|
+
import { a as DrawCommand, b as LineDashStyle, c as LineVariant, P as PointStyleType, d as DrawGroup, M as MarkerLineStyle, G as GridLayer, A as AxisPosition, e as AnySeries, f as Threshold, H as Highlight, g as Gap, h as GapsConfig, i as Annotation, j as AnnotationBandConfig, T as TimeScale, L as LinearScale, S as SmoothingType, k as HatchVariant, D as DataPoint } from './scale-kRRbXFik.js';
|
|
2
2
|
|
|
3
3
|
/** Output format type for the renderer (SVG string, Canvas, or nothing). */
|
|
4
4
|
type RenderType = "svg" | "canvas" | "none";
|
|
@@ -188,8 +188,26 @@ declare const theme: {
|
|
|
188
188
|
* "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
|
|
189
189
|
*/
|
|
190
190
|
|
|
191
|
-
/**
|
|
192
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Ein Literaltyp, aufgeweitet: `"#777"` -> `string`, `11` -> `number`, Arrays
|
|
193
|
+
* und Objekte rekursiv und ohne `readonly`.
|
|
194
|
+
*/
|
|
195
|
+
type Aufgeweitet<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T extends readonly (infer U)[] ? readonly Aufgeweitet<U>[] : T extends object ? {
|
|
196
|
+
-readonly [K in keyof T]: Aufgeweitet<T[K]>;
|
|
197
|
+
} : T;
|
|
198
|
+
/**
|
|
199
|
+
* The Theme type — the shape of the built-in defaults, with ordinary field
|
|
200
|
+
* types: any colour is a `string`, any size a `number`.
|
|
201
|
+
*
|
|
202
|
+
* Bis 1.15.x war es `typeof BUILTIN_DEFAULTS`, und die Vorgaben stehen mit
|
|
203
|
+
* `as const` da -- jede Farbe war damit ihr eigener Literaltyp ("#777"), und
|
|
204
|
+
* `setDefaultTheme({ textColor: '#94a3b8' })` liess sich nur mit
|
|
205
|
+
* `as unknown as` uebergeben. So stand es im Wrapper des Sensor Monitorings.
|
|
206
|
+
*/
|
|
207
|
+
type Theme = Omit<Aufgeweitet<typeof theme>, "thresholdLine"> & {
|
|
208
|
+
/** Felder mit einer festen Auswahl behalten ihren Typ -- hier die Strichart. */
|
|
209
|
+
thresholdLine: LineDashStyle;
|
|
210
|
+
};
|
|
193
211
|
/**
|
|
194
212
|
* Apply a partial override on top of the current global default theme.
|
|
195
213
|
* Merged shallowly — nested objects (e.g. {@link Theme.palette}) are replaced
|
|
@@ -310,6 +328,19 @@ interface LegendItem {
|
|
|
310
328
|
* anklickbar machen wollte, musste sie selbst zeichnen.
|
|
311
329
|
*/
|
|
312
330
|
id?: string;
|
|
331
|
+
/**
|
|
332
|
+
* The series' key for `hidden` and `pointsAt` -- its `id`, or its `name`
|
|
333
|
+
* when it has none. Not the same as {@link id}, which is that key turned
|
|
334
|
+
* into a CSS-safe slug (`Kuehlraum 1` -> `kuehlraum-1`). A legend that hides
|
|
335
|
+
* series needs both: this one for `pointsAt`, `id` for `.series--<id>`.
|
|
336
|
+
*/
|
|
337
|
+
seriesId?: string;
|
|
338
|
+
/**
|
|
339
|
+
* The width the series' line is drawn with -- for the swatch's dashes:
|
|
340
|
+
* `resolveDash(line, width)` gives exactly the curve's pattern. Undefined
|
|
341
|
+
* for a series with several lines, like {@link line}.
|
|
342
|
+
*/
|
|
343
|
+
width?: number;
|
|
313
344
|
/**
|
|
314
345
|
* The series' line variant, for a caller drawing its own legend: the swatch
|
|
315
346
|
* has to show the same dashes as the curve it names, or it is wrong the moment
|
|
@@ -468,6 +499,13 @@ interface YAxisConfig {
|
|
|
468
499
|
top?: number;
|
|
469
500
|
bottom?: number;
|
|
470
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* With an automatic `domain`, widen it to the thresholds drawn on this axis
|
|
504
|
+
* (`line` other than `'none'`), so a limit line shows even when no reading
|
|
505
|
+
* comes near it. Default off. `padding` then applies as usual. A threshold
|
|
506
|
+
* with `line: 'none'` is a reference only (a zone anchor) and does not count.
|
|
507
|
+
*/
|
|
508
|
+
includeThresholds?: boolean;
|
|
471
509
|
/** Format a tick value into its label text. */
|
|
472
510
|
format?: (value: number) => string;
|
|
473
511
|
/** Tick density / sizing. */
|
|
@@ -607,6 +645,13 @@ interface MLTimeGraphOptions {
|
|
|
607
645
|
* steht in keinem JSON, der Go-Port kann sie nicht nachbilden.
|
|
608
646
|
*/
|
|
609
647
|
textMetrics?: TextMetrics;
|
|
648
|
+
/**
|
|
649
|
+
* This chart's colours and sizes, over the global defaults
|
|
650
|
+
* (`setDefaultTheme`). Two charts on one page can differ -- a dark one and
|
|
651
|
+
* a light one for printing -- without touching global state. Same field in
|
|
652
|
+
* the Go port's JSON options.
|
|
653
|
+
*/
|
|
654
|
+
theme?: Partial<Theme>;
|
|
610
655
|
/** Chart dimensions */
|
|
611
656
|
width?: number;
|
|
612
657
|
height?: number;
|
|
@@ -1123,4 +1123,4 @@ declare class BandScale implements Scale {
|
|
|
1123
1123
|
positions(): Map<string, number>;
|
|
1124
1124
|
}
|
|
1125
1125
|
|
|
1126
|
-
export { type SeriesOverlay as $, type AxisPosition as A, type DataPointRef as B, type FillBound as C, type DataPoint as D, type EnumMap as E, type FillSpec as F, type GridLayer as G, type Highlight as H, type FillRegion as I, type FillSide as J, type FillStyle as K, LinearScale as L, type MarkerLineStyle as M, type GapConfig as N, type GapLabel as O, type PointStyleType as P, type GapRegion as Q, type RangeLabelPosition as R, type SmoothingType as S, TimeScale as T, type GapStyle as U, type LineShape as V, type LineStyle as W, type MarkerStyle as X, type MovingAverageType as Y, type SVGLineStyle as Z, type SensorType as _, type DrawCommand as a, type SeriesOverlayKind as a0, type SeriesType as a1, type ShadowStyle as a2, type SolidDashStyle as a3, type ThresholdLabelConfig as a4, getLineStyle as a5, resolveDash as a6, type GapBand as a7, type LineParams as a8, type PathParams as a9, type RectParams as aa, type CircleParams as ab, type TextParams as ac, type GapParams as ad, type Point as ae, BandScale as af, type BandScaleConfig as ag, type Dashstyle_t as ah, type DomainScaleConfig as ai, type DrawCircle as aj, type DrawGap as ak, type DrawGapType_t$1 as al, type DrawLine as am, type DrawPath as an, type DrawRect as ao, type DrawText as ap, type LinearScaleConfig as aq, type Scale as ar, type ScaleConfig as as, TIME_INTERVALS as at, type TimeScaleConfig as au, getHatch as av, type
|
|
1126
|
+
export { type SeriesOverlay as $, type AxisPosition as A, type DataPointRef as B, type FillBound as C, type DataPoint as D, type EnumMap as E, type FillSpec as F, type GridLayer as G, type Highlight as H, type FillRegion as I, type FillSide as J, type FillStyle as K, LinearScale as L, type MarkerLineStyle as M, type GapConfig as N, type GapLabel as O, type PointStyleType as P, type GapRegion as Q, type RangeLabelPosition as R, type SmoothingType as S, TimeScale as T, type GapStyle as U, type LineShape as V, type LineStyle as W, type MarkerStyle as X, type MovingAverageType as Y, type SVGLineStyle as Z, type SensorType as _, type DrawCommand as a, type SeriesOverlayKind as a0, type SeriesType as a1, type ShadowStyle as a2, type SolidDashStyle as a3, type ThresholdLabelConfig as a4, getLineStyle as a5, resolveDash as a6, type GapBand as a7, type LineParams as a8, type PathParams as a9, type RectParams as aa, type CircleParams as ab, type TextParams as ac, type GapParams as ad, type Point as ae, BandScale as af, type BandScaleConfig as ag, type Dashstyle_t as ah, type DomainScaleConfig as ai, type DrawCircle as aj, type DrawGap as ak, type DrawGapType_t$1 as al, type DrawLine as am, type DrawPath as an, type DrawRect as ao, type DrawText as ap, type LinearScaleConfig as aq, type Scale as ar, type ScaleConfig as as, TIME_INTERVALS as at, type TimeScaleConfig as au, getHatch as av, type LineDashStyle as b, type LineVariant as c, type DrawGroup as d, type AnySeries as e, type Threshold as f, type Gap as g, type GapsConfig as h, type Annotation as i, type AnnotationBandConfig as j, type HatchVariant as k, type SeriesStyle as l, type TimeSeries as m, type ThresholdFill as n, type ThresholdLabelPosition as o, type AnnotationPointShape as p, type LabelAnchor as q, type AnnotationBandItem as r, type TextBaseline as s, type AggregatedPoint as t, type AggregatedSeries as u, type AggregatedShowAs as v, type AggregationConfig as w, type AggregationMode as x, type AnnotationKind as y, type 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.16.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",
|