From db4ac42e57a5312bf33673465986918a9699c09f Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Fri, 9 Apr 2021 17:22:30 -0500 Subject: [PATCH] 1.6.8 --- dist/uPlot.cjs.js | 2 +- dist/uPlot.esm.js | 2 +- dist/uPlot.iife.js | 2 +- dist/uPlot.iife.min.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/uPlot.cjs.js b/dist/uPlot.cjs.js index 910f886b..4f799438 100644 --- a/dist/uPlot.cjs.js +++ b/dist/uPlot.cjs.js @@ -4,7 +4,7 @@ * * uPlot.js (μPlot) * A small, fast chart for time series, lines, areas, ohlc & bars -* https://github.com/leeoniya/uPlot (v1.6.7) +* https://github.com/leeoniya/uPlot (v1.6.8) */ 'use strict'; diff --git a/dist/uPlot.esm.js b/dist/uPlot.esm.js index 3d4d6758..52c08136 100644 --- a/dist/uPlot.esm.js +++ b/dist/uPlot.esm.js @@ -4,7 +4,7 @@ * * uPlot.js (μPlot) * A small, fast chart for time series, lines, areas, ohlc & bars -* https://github.com/leeoniya/uPlot (v1.6.7) +* https://github.com/leeoniya/uPlot (v1.6.8) */ const FEAT_TIME = true; diff --git a/dist/uPlot.iife.js b/dist/uPlot.iife.js index 96c0db5e..a3e1b195 100644 --- a/dist/uPlot.iife.js +++ b/dist/uPlot.iife.js @@ -4,7 +4,7 @@ * * uPlot.js (μPlot) * A small, fast chart for time series, lines, areas, ohlc & bars -* https://github.com/leeoniya/uPlot (v1.6.7) +* https://github.com/leeoniya/uPlot (v1.6.8) */ var uPlot = (function () { diff --git a/dist/uPlot.iife.min.js b/dist/uPlot.iife.min.js index cf199383..ff19d3c3 100644 --- a/dist/uPlot.iife.min.js +++ b/dist/uPlot.iife.min.js @@ -1,2 +1,2 @@ -/*! https://github.com/leeoniya/uPlot (v1.6.7) */ +/*! https://github.com/leeoniya/uPlot (v1.6.8) */ var uPlot=function(){"use strict";function n(n,e,r,t){var l;r=r||0;for(var i=2147483647>=(t=t||e.length-1);t-r>1;)n>e[l=i?r+t>>1:m((r+t)/2)]?r=l:t=l;return n-e[r]>e[t]-n?t:r}function e(n,e,r,t){for(var l=1==t?e:r;l>=e&&r>=l;l+=t)if(null!=n[l])return l;return-1}var r=[0,0];function t(n,e,t,l){return r[0]=0>t?H(n,-t):n,r[1]=0>l?H(e,-l):e,r}function l(n,e,r,l){var i,a,o,s=10==r?k:y;return n==e&&(n/=r,e*=r),l?(i=m(s(n)),a=g(s(e)),n=(o=t(b(r,i),b(r,a),i,a))[0],e=o[1]):(i=m(s(d(n))),a=m(s(d(e))),n=C(n,(o=t(b(r,i),b(r,a),i,a))[0]),e=Y(e,o[1])),[n,e]}function i(n,e,r,t){var i=l(n,e,r,t);return 0==n&&(i[0]=0),0==e&&(i[1]=0),i}var a={pad:0,soft:null,mode:0},o={min:a,max:a};function s(n,e,r,t){return V(r)?f(n,e,r):(a.pad=r,a.soft=t?0:null,a.mode=t?3:0,f(n,e,o))}function u(n,e){return null==n?e:n}function f(n,e,r){var t=r.min,l=r.max,i=u(t.pad,0),a=u(l.pad,0),o=u(t.hard,-S),s=u(l.hard,S),f=u(t.soft,S),c=u(l.soft,-S),v=u(t.mode,0),h=u(l.mode,0),p=e-n,g=p||d(e)||1e3,_=k(g),y=b(10,m(_)),M=H(C(n-g*(0==p?0==n?.1:1:i),y/10),6),z=f>n||1!=v&&(3!=v||M>f)&&(2!=v||f>M)?S:f,D=w(o,z>M&&n>=z?z:x(z,M)),T=H(Y(e+g*(0==p?0==e?.1:1:a),y/10),6),E=e>c||1!=h&&(3!=h||c>T)&&(2!=h||T>c)?-S:c,P=x(s,T>E&&E>=e?E:w(E,T));return D==P&&0==D&&(P=100),[D,P]}var c=new Intl.NumberFormat(navigator.language).format,v=Math,h=v.PI,d=v.abs,m=v.floor,p=v.round,g=v.ceil,x=v.min,w=v.max,b=v.pow,_=v.sqrt,k=v.log10,y=v.log2,M=(n,e)=>(void 0===e&&(e=1),v.asinh(n/e)),S=1/0;function z(n,e){return p(n/e)*e}function D(n,e,r){return x(w(n,e),r)}function T(n){return"function"==typeof n?n:()=>n}var E=n=>n,P=(n,e)=>e,A=()=>null,W=()=>!0;function Y(n,e){return g(n/e)*e}function C(n,e){return m(n/e)*e}function H(n,e){return p(n*(e=Math.pow(10,e)))/e}var F=new Map;function R(n){return((""+n).split(".")[1]||"").length}function L(n,e,r,t){for(var l=[],i=t.map(R),a=e;r>a;a++)for(var o=d(a),s=H(b(n,a),o),u=0;t.length>u;u++){var f=t[u]*s,c=(0>f||0>a?o:0)+(i[u]>a?i[u]:0),v=H(f,c);l.push(v),F.set(v,c)}return l}var N={},I=Array.isArray;function O(n){return"string"==typeof n}function V(n){var e=!1;if(null!=n){var r=n.constructor;e=null==r||r==Object}return e}function j(n){return null!=n&&"object"==typeof n}function G(n,e){var r;if(e=e||V,I(n))r=n.map((n=>G(n,e)));else if(e(n))for(var t in r={},n)r[t]=G(n[t],e);else r=n;return r}function U(n){for(var e=arguments,r=1;e.length>r;r++){var t=e[r];for(var l in t)V(n[l])?U(n[l],G(t[l])):n[l]=G(t[l])}return n}function B(n,e,r){for(var t=0,l=void 0,i=-1;e.length>t;t++){var a=e[t];if(a>i){for(l=a-1;l>=0&&null==n[l];)n[l--]=null;for(l=a+1;r>l&&null==n[l];)n[i=l++]=null}}}var J="undefined"==typeof queueMicrotask?n=>Promise.resolve().then(n):queueMicrotask,q="width",Z="height",K="top",X="bottom",Q="left",$="right",nn="#000",en="#0000",rn="mousemove",tn="mousedown",ln="mouseup",an="mouseenter",on="mouseleave",sn="dblclick",un="u-off",fn="u-label",cn=document,vn=window,hn=devicePixelRatio;function dn(n,e){if(null!=e){var r=n.classList;!r.contains(e)&&r.add(e)}}function mn(n,e){var r=n.classList;r.contains(e)&&r.remove(e)}function pn(n,e,r){n.style[e]=r+"px"}function gn(n,e,r,t){var l=cn.createElement(n);return null!=e&&dn(l,e),null!=r&&r.insertBefore(l,t),l}function xn(n,e){return gn("div",n,e)}function wn(n,e,r,t,l){n.style.transform="translate("+e+"px,"+r+"px)",0>e||0>r||e>t||r>l?dn(n,un):mn(n,un)}var bn={passive:!0},_n=U({capture:!0},bn);function kn(n,e,r,t){e.addEventListener(n,r,t?_n:bn)}function yn(n,e,r,t){e.removeEventListener(n,r,t?_n:bn)}var Mn=["January","February","March","April","May","June","July","August","September","October","November","December"],Sn=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function zn(n){return n.slice(0,3)}var Dn=Sn.map(zn),Tn=Mn.map(zn),En={MMMM:Mn,MMM:Tn,WWWW:Sn,WWW:Dn};function Pn(n){return(10>n?"0":"")+n}var An={YYYY:n=>n.getFullYear(),YY:n=>(n.getFullYear()+"").slice(2),MMMM:(n,e)=>e.MMMM[n.getMonth()],MMM:(n,e)=>e.MMM[n.getMonth()],MM:n=>Pn(n.getMonth()+1),M:n=>n.getMonth()+1,DD:n=>Pn(n.getDate()),D:n=>n.getDate(),WWWW:(n,e)=>e.WWWW[n.getDay()],WWW:(n,e)=>e.WWW[n.getDay()],HH:n=>Pn(n.getHours()),H:n=>n.getHours(),h:n=>{var e=n.getHours();return 0==e?12:e>12?e-12:e},AA:n=>12>n.getHours()?"AM":"PM",aa:n=>12>n.getHours()?"am":"pm",a:n=>12>n.getHours()?"a":"p",mm:n=>Pn(n.getMinutes()),m:n=>n.getMinutes(),ss:n=>Pn(n.getSeconds()),s:n=>n.getSeconds(),fff:n=>function(n){return(10>n?"00":100>n?"0":"")+n}(n.getMilliseconds())};function Wn(n,e){e=e||En;for(var r,t=[],l=/\{([a-z]+)\}|[^{]+/gi;r=l.exec(n);)t.push("{"==r[0][0]?An[r[1]]:r[0]);return n=>{for(var r="",l=0;t.length>l;l++)r+="string"==typeof t[l]?t[l]:t[l](n,e);return r}}var Yn=(new Intl.DateTimeFormat).resolvedOptions().timeZone,Cn=n=>n%1==0,Hn=[1,2,2.5,5],Fn=L(10,-16,0,Hn),Rn=L(10,0,16,Hn),Ln=Rn.filter(Cn),Nn=Fn.concat(Rn),In="{YYYY}",On="\n"+In,Vn="{M}/{D}",jn="\n"+Vn,Gn=jn+"/{YY}",Un="{aa}",Bn="{h}:{mm}"+Un,Jn="\n"+Bn,qn=":{ss}",Zn=null;function Kn(n){var e=1e3*n,r=60*e,t=60*r,l=24*t,i=30*l,a=365*l;return[(1==n?L(10,0,3,Hn).filter(Cn):L(10,-3,0,Hn)).concat([e,5*e,10*e,15*e,30*e,r,5*r,10*r,15*r,30*r,t,2*t,3*t,4*t,6*t,8*t,12*t,l,2*l,3*l,4*l,5*l,6*l,7*l,8*l,9*l,10*l,15*l,i,2*i,3*i,4*i,6*i,a,2*a,5*a,10*a,25*a,50*a,100*a]),[[a,In,Zn,Zn,Zn,Zn,Zn,Zn,1],[28*l,"{MMM}",On,Zn,Zn,Zn,Zn,Zn,1],[l,Vn,On,Zn,Zn,Zn,Zn,Zn,1],[t,"{h}"+Un,Gn,Zn,jn,Zn,Zn,Zn,1],[r,Bn,Gn,Zn,jn,Zn,Zn,Zn,1],[e,qn,Gn+" "+Bn,Zn,jn+" "+Bn,Zn,Jn,Zn,1],[n,qn+".{fff}",Gn+" "+Bn,Zn,jn+" "+Bn,Zn,Jn,Zn,1]],function(e){return(o,s,u,f,c,v)=>{var h=[],d=c>=a,g=c>=i&&a>c,x=e(u),w=H(x*n,3),b=oe(x.getFullYear(),d?0:x.getMonth(),g||d?1:x.getDate()),_=H(b*n,3);if(g||d)for(var k=g?c/i:0,y=d?c/a:0,M=w==_?w:H(oe(b.getFullYear()+y,b.getMonth()+k,1)*n,3),S=new Date(p(M/n)),z=S.getFullYear(),D=S.getMonth(),T=0;f>=M;T++){var E=oe(z+y*T,D+k*T,1),P=E-e(H(E*n,3));(M=H((+E+P)*n,3))>f||h.push(M)}else{var A=l>c?c:l,W=_+(m(u)-m(w))+Y(w-_,A);h.push(W);for(var C=e(W),F=C.getHours()+C.getMinutes()/r+C.getSeconds()/t,R=c/t,L=v/o.axes[s]._space;(W=H(W+c,1==n?0:3))<=f;)if(R>1){var N=m(H(F+R,6))%24,I=e(W).getHours()-N;I>1&&(I=-1),F=(F+R)%24,.7>H(((W-=I*t)-h[h.length-1])/c,3)*L||h.push(W)}else h.push(W)}return h}}]}var Xn=Kn(1),Qn=Xn[0],$n=Xn[1],ne=Xn[2],ee=Kn(.001),re=ee[0],te=ee[1],le=ee[2];function ie(n,e){return n.map((n=>n.map(((r,t)=>0==t||8==t||null==r?r:e(1==t||0==n[8]?r:n[1]+r)))))}function ae(n,e){return(r,t,l,i,a)=>{var o,s,u,f,c,v,h=e.find((n=>a>=n[0]))||e[e.length-1];return t.map((e=>{var r=n(e),t=r.getFullYear(),l=r.getMonth(),i=r.getDate(),a=r.getHours(),d=r.getMinutes(),m=r.getSeconds(),p=t!=o&&h[2]||l!=s&&h[3]||i!=u&&h[4]||a!=f&&h[5]||d!=c&&h[6]||m!=v&&h[7]||h[1];return o=t,s=l,u=i,f=a,c=d,v=m,p(r)}))}}function oe(n,e,r){return new Date(n,e,r)}function se(n,e){return e(n)}function ue(n,e){return(r,t)=>e(n(t))}L(2,-53,53,[1]);var fe={show:!0,width:2,stroke:function(n,e){var r=n.series[e];return r.width?r.stroke(n,e):r.points.width?r.points.stroke(n,e):null},fill:function(n,e){return n.series[e].fill(n,e)},dash:"solid",live:!0,isolate:!1,idx:null,values:[]},ce=[0,0];function ve(n,e,r){return n=>{0==n.button&&r(n)}}function he(n,e,r){return r}var de={show:!0,x:!0,y:!0,lock:!1,move:function(n,e,r){return ce[0]=e,ce[1]=r,ce},points:{show:function(n,e){var r=n.cursor.points,t=xn(),l=r.stroke(n,e),i=r.fill(n,e);t.style.background=i||l;var a=r.size(n,e),o=r.width(n,e,a);o&&(t.style.border=o+"px solid "+l);var s=a/-2;return pn(t,q,a),pn(t,Z,a),pn(t,"marginLeft",s),pn(t,"marginTop",s),t},size:function(n,e){return We(n.series[e].width,1)},width:0,stroke:function(n,e){return n.series[e].stroke(n,e)},fill:function(n,e){return n.series[e].stroke(n,e)}},bind:{mousedown:ve,mouseup:ve,click:ve,dblclick:ve,mousemove:he,mouseleave:he,mouseenter:he},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,_x:!1,_y:!1},focus:{prox:-1},left:-10,top:-10,idx:null,dataIdx:function(n,e,r){return r}},me={show:!0,stroke:"rgba(0,0,0,0.07)",width:2,filter:P},pe=U({},me,{size:10}),ge='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',xe="bold "+ge,we={show:!0,scale:"x",stroke:nn,space:50,gap:5,size:50,labelSize:30,labelFont:xe,side:2,grid:me,ticks:pe,font:ge,rotate:0},be={show:!0,scale:"x",auto:!1,sorted:1,min:S,max:-S,idxs:[]};function _e(n,e){return e.map((n=>null==n?"":c(n)))}function ke(n,e,r,t,l,i,a){for(var o=[],s=F.get(l)||0,u=r=a?r:H(Y(r,l),s);t>=u;u=H(u+l,s))o.push(Object.is(u,-0)?0:u);return o}function ye(n,e,r,t,l){var i=[],a=n.scales[n.axes[e].scale].log,o=m((10==a?k:y)(r));l=b(a,o),0>o&&(l=H(l,-o));var s=r;do{i.push(s),l*a>(s=H(s+l,F.get(l)))||(l=s)}while(t>=s);return i}function Me(n,e,r,t,l){var i=n.scales[n.axes[e].scale].asinh,a=t>i?ye(n,e,w(i,r),t,l):[i],o=0>t||r>0?[]:[0];return(-i>r?ye(n,e,w(i,-t),-r,l):[i]).reverse().map((n=>-n)).concat(o,a)}var Se=/./,ze=/[12357]/,De=/[125]/,Te=/1/;function Ee(n,e,r){var t=n.axes[r],l=t.scale,i=n.scales[l];if(3==i.distr&&2==i.log)return e;var a=n.valToPos,o=t._space,s=a(10,l),u=a(9,l)-s4==i.distr&&0==n||u.test(n)?n:null))}function Pe(n,e){return null==e?"":c(e)}var Ae={show:!0,scale:"y",stroke:nn,space:30,gap:5,size:50,labelSize:30,labelFont:xe,side:3,grid:me,ticks:pe,font:ge,rotate:0};function We(n,e){return H((3+2*(n||1))*e,3)}function Ye(n,e){var r=n.scales[n.series[e].scale],t=n.bands&&n.bands.some((n=>n.series[0]==e));return 3==r.distr||t?r.min:0}var Ce={scale:"y",auto:!0,sorted:0,show:!0,band:!1,spanGaps:!1,alpha:1,points:{show:function(n,e){var r=n.series[0].idxs;return(0==n.scales[n.series[0].scale].ori?n.bbox.width:n.bbox.height)/(n.series[e].points.space*hn)>=r[1]-r[0]}},values:null,min:S,max:-S,idxs:[],path:null,clip:null};function He(n,e,r){return r/10}var Fe={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Re=U({},Fe,{time:!1,ori:1}),Le={};function Ne(n){var e=Le[n];if(!e){var r=[];e={key:n,sub:function(n){r.push(n)},unsub:function(n){r=r.filter((e=>e!=n))},pub:function(n,e,t,l,i,a){for(var o=0;r.length>o;o++)r[o]!=e&&r[o].pub(n,e,t,l,i,a,o)}},null!=n&&(Le[n]=e)}return e}function Ie(n,e,r){var t=n.series[e],l=n.scales,i=n.bbox,a=n._data[0],o=n._data[e],s=l[n.series[0].scale],u=l[t.scale],f=i.left,c=i.top,v=i.width,h=i.height,d=n.valToPosH,m=n.valToPosV;return 0==s.ori?r(t,a,o,s,u,d,m,f,c,v,h,Ue,Je,Ze,Xe,$e):r(t,a,o,s,u,m,d,c,f,h,v,Be,qe,Ke,Qe,nr)}function Oe(n,e,r,t,l){return Ie(n,e,((n,e,i,a,o,s,u,f,c,v,h)=>{var d,m,p=0==a.ori?Je:qe;1==a.dir*(0==a.ori?1:-1)?(d=r,m=t):(d=t,m=r);var g=z(s(e[d],a,v,f),.5),x=z(u(i[d],o,h,c),.5),w=z(s(e[m],a,v,f),.5),b=z(u(o.max,o,h,c),.5),_=new Path2D(l);return p(_,w,b),p(_,g,b),p(_,g,x),_}))}function Ve(n,e,r,t,l,i){var a=null;if(n.length>0){a=new Path2D;for(var o=0==e?Ze:Ke,s=r,u=0;n.length>u;u++){var f=n[u];o(a,s,t,f[0]-s,t+i),s=f[1]}o(a,s,t,r+l-s,t+i)}return a}function je(n,e,r){if(r>e){var t=n[n.length-1];t&&t[0]==e?t[1]=r:n.push([e,r])}}function Ge(n){return 0==n?E:1==n?p:e=>z(e,n)}function Ue(n,e,r){n.moveTo(e,r)}function Be(n,e,r){n.moveTo(r,e)}function Je(n,e,r){n.lineTo(e,r)}function qe(n,e,r){n.lineTo(r,e)}function Ze(n,e,r,t,l){n.rect(e,r,t,l)}function Ke(n,e,r,t,l){n.rect(r,e,l,t)}function Xe(n,e,r,t,l,i){n.arc(e,r,t,l,i)}function Qe(n,e,r,t,l,i){n.arc(r,e,t,l,i)}function $e(n,e,r,t,l,i,a){n.bezierCurveTo(e,r,t,l,i,a)}function nr(n,e,r,t,l,i,a){n.bezierCurveTo(r,e,l,t,a,i)}function er(n){return(e,r,t,l,i,a)=>{t!=l&&(i!=t&&a!=t&&n(e,r,t),i!=l&&a!=l&&n(e,r,l),n(e,r,a))}}var rr=er(Je),tr=er(qe);function lr(){return(n,r,t,l)=>Ie(n,r,((i,a,o,s,u,f,c,v,h,d,m)=>{var p,g,b=i.pxRound;0==s.ori?(p=Je,g=rr):(p=qe,g=tr);var _,k,y,M,D=s.dir*(0==s.ori?1:-1),T={stroke:new Path2D,fill:null,clip:null,band:null},E=T.stroke,P=S,A=-S,W=[],Y=b(f(a[1==D?t:l],s,d,v)),C=!1,H=e(o,t,l,1*D),F=e(o,t,l,-1*D),R=z(f(a[H],s,d,v),.5),L=z(f(a[F],s,d,v),.5);R>v&&je(W,v,R);for(var N=1==D?t:l;N>=t&&l>=N;N+=D){var I=b(f(a[N],s,d,v));if(I==Y)null!=o[N]?(k=b(c(o[N],u,m,h)),P==S&&(p(E,I,k),_=k),P=x(k,P),A=w(k,A)):C||null!==o[N]||(C=!0);else{var O=!1;P!=S?(g(E,Y,P,A,_,k),y=M=Y):C&&(O=!0,C=!1),null!=o[N]?(p(E,I,k=b(c(o[N],u,m,h))),P=A=_=k,I-Y>1&&null===o[N-D]&&(O=!0)):(P=S,A=-S,C||null!==o[N]||(C=!0)),O&&je(W,y,I),Y=I}}if(P!=S&&P!=A&&M!=Y&&g(E,Y,P,A,_,k),v+d>L&&je(W,L,v+d),null!=i.fill){var V=T.fill=new Path2D(E),j=b(c(i.fillTo(n,r,i.min,i.max),u,m,h));p(V,L,j),p(V,R,j)}return i.spanGaps||(T.clip=Ve(W,s.ori,v,h,d,m)),n.bands.length>0&&(T.band=Oe(n,r,t,l,E)),T}))}function ir(n,e,r,t,l,i){var a,o,s,u,f,c,v,h,d,m,p,g,x,w,k,y,M,S,z,D,T,E,P,A,W,Y=new Path2D,C=n.length;t(Y,i(n[0]),i(e[0]));for(var H=0;C-1>H;H++){var F=0==H?0:H-1;o=e[F],u=e[H],f=n[H+1],c=e[H+1],C>H+2?(v=n[H+2],h=e[H+2]):(v=f,h=c),x=_(b((a=n[F])-(s=n[H]),2)+b(o-u,2)),w=_(b(s-f,2)+b(u-c,2)),k=_(b(f-v,2)+b(c-h,2)),D=b(k,r),E=b(k,2*r),T=b(w,r),P=b(w,2*r),(S=3*(W=b(x,r))*(W+T))>0&&(S=1/S),(z=3*D*(D+T))>0&&(z=1/z),m=(-P*o+(y=2*(A=b(x,2*r))+3*W*T+P)*u+A*c)*S,g=(E*u+(M=2*E+3*D*T+P)*c-P*h)*z,0==(d=(-P*a+y*s+A*f)*S)&&0==m&&(d=s,m=u),0==(p=(E*s+M*f-P*v)*z)&&0==g&&(p=f,g=c),l(Y,d,m,p,g,f,c)}return Y}var ar=new Set;function or(){ar.forEach((n=>{n.syncRect(!0)}))}kn("resize",vn,or),kn("scroll",vn,or,!0);var sr=lr();function ur(n,e,r,t){return(t?[n[0],n[1]].concat(n.slice(2)):[n[0]].concat(n.slice(1))).map(((n,t)=>fr(n,t,e,r)))}function fr(n,e,r,t){return U({},0==e?r:t,n)}var cr=[null,null];function vr(n,e,r){return null==e?cr:[e,r]}var hr=vr;function dr(n,e,r){return null==e?cr:s(e,r,.1,!0)}function mr(n,e,r,t){return null==e?cr:l(e,r,n.scales[t].log,!1)}var pr=mr;function gr(n,e,r,t){return null==e?cr:i(e,r,n.scales[t].log,!1)}var xr=gr;function wr(n){var e;return[n=n.replace(/(\d+)px/,((n,r)=>(e=p(r*hn))+"px")),e]}function br(e,r,t){var a={};function o(n,e){return((3==e.distr?k(n>0?n:e.clamp(a,n,e.min,e.max,e.key)):4==e.distr?M(n,e.asinh):n)-e._min)/(e._max-e._min)}function f(n,e,r,t){var l=o(n,e);return t+r*(-1==e.dir?1-l:l)}function c(n,e,r,t){var l=o(n,e);return t+r*(-1==e.dir?l:1-l)}function _(n,e,r,t){return 0==e.ori?f(n,e,r,t):c(n,e,r,t)}a.valToPosH=f,a.valToPosV=c;var y=!1;a.status=0;var E=a.root=xn("uplot");null!=e.id&&(E.id=e.id),dn(E,e.class),e.title&&(xn("u-title",E).textContent=e.title);var C=gn("canvas"),R=a.ctx=C.getContext("2d"),L=xn("u-wrap",E),B=xn("u-under",L);L.appendChild(C);var nn=xn("u-over",L),vn=+u((e=G(e)).pxAlign,1),bn=Ge(vn);(e.plugins||[]).forEach((n=>{n.opts&&(e=n.opts(a,e)||e)}));var _n=e.ms||.001,Mn=a.series=ur(e.series||[],be,Ce,!1),Sn=a.axes=ur(e.axes||[],we,Ae,!0),zn=a.scales={},Dn=a.bands=e.bands||[];Dn.forEach((n=>{n.fill=T(n.fill||null)}));var Tn=Mn[0].scale,En={axes:function(){Sn.forEach(((n,e)=>{if(n.show&&n._show){var r=zn[n.scale],t=n.side,l=t%2,i=0==l?$e:nr,o=0==l?Ze:Ke,s=p(n.gap*hn),u=n.ticks,f=u.show?p(u.size*hn):0,c=n._found,v=c[0],d=c[1],m=n._splits,g=2==r.distr?m.map((n=>Hr[n])):m,x=2==r.distr?Hr[m[1]]-Hr[m[0]]:v,w=n._rotate*-h/180,b=bn(n._pos*hn),k=b+(f+s)*(0==l&&0==t||1==l&&3==t?-1:1),y=0==l?k:0,M=1==l?k:0;R.font=n.font[0],R.fillStyle=n.stroke(a,e),R.textAlign=1==n.align?Q:2==n.align?$:w>0?Q:0>w?$:0==l?"center":3==t?$:Q,R.textBaseline=w||1==l?"middle":2==t?K:X;var S=1.5*n.font[1],z=m.map((n=>bn(_(n,r,i,o))));if(n._values.forEach(((n,e)=>{null!=n&&(0==l?M=z[e]:y=z[e],(""+n).split(/\n/gm).forEach(((n,e)=>{w?(R.save(),R.translate(M,y+e*S),R.rotate(w),R.fillText(n,0,0),R.restore()):R.fillText(n,M,y+e*S)})))})),n.label){R.save();var D=p(n._lpos*hn);1==l?(M=y=0,R.translate(D,p(Ke+nr/2)),R.rotate((3==t?-h:h)/2)):(M=p(Ze+$e/2),y=D),R.font=n.labelFont[0],R.textAlign="center",R.textBaseline=2==t?K:X,R.fillText(n.label,M,y),R.restore()}u.show&&Or(z,u.filter(a,g,e,d,x),l,t,b,f,H(u.width*hn,3),u.stroke(a,e),u.dash,u.cap);var T=n.grid;T.show&&Or(z,T.filter(a,g,e,d,x),l,0==l?2:1,0==l?Ke:Ze,0==l?nr:$e,H(T.width*hn,3),T.stroke(a,e),T.dash,T.cap)}})),Nt("drawAxes")},series:function(){Er>0&&(Mn.forEach(((n,e)=>{if(e>0&&n.show&&null==n._paths){var t=function(n){for(var e=D(Wr-1,0,Er-1),r=D(Yr+1,0,Er-1);null==n[e]&&e>0;)e--;for(;null==n[r]&&Er-1>r;)r++;return[e,r]}(r[e]);n._paths=n.paths(a,e,t[0],t[1])}})),Mn.forEach(((n,e)=>{e>0&&n.show&&(n._paths&&function(n){var e=Mn[n],r=e._paths,t=r.stroke,l=r.fill,i=r.clip,o=H(e.width*hn,3),s=o%2/2,u=e._stroke=e.stroke(a,n),f=e._fill=e.fill(a,n);R.globalAlpha=e.alpha;var c=1==e.pxAlign;c&&R.translate(s,s),R.save();var v=Ze,h=Ke,d=$e,m=nr,p=o*hn/2;0==e.min&&(m+=p),0==e.max&&(h-=p,m+=p),R.beginPath(),R.rect(v,h,d,m),R.clip(),i&&R.clip(i),function(n,e,r,t,l,i,o,s){var u=!1;Dn.forEach(((f,c)=>{if(f.series[0]==n){var v=Mn[f.series[1]],h=(v._paths||N).band;R.save();var d=null;v.show&&h&&(d=f.fill(a,c)||i,R.clip(h)),Ir(e,r,t,l,d,o,s),R.restore(),u=!0}})),u||Ir(e,r,t,l,i,o,s)}(n,u,o,e.dash,e.cap,f,t,l),R.restore(),c&&R.translate(-s,-s),R.globalAlpha=1}(e),n.points.show(a,e,Wr,Yr)&&function(n){var e=Mn[n],t=e.points,l=e.pxRound,i=H(t.width*hn,3),o=i%2/2,s=t.width>0,u=(t.size-t.width)/2*hn,f=H(2*u,3),c=1==e.pxAlign;c&&R.translate(o,o),R.save(),R.beginPath(),R.rect(Ze-f,Ke-f,$e+2*f,nr+2*f),R.clip(),R.globalAlpha=e.alpha;var v,d,m,p,g=new Path2D,x=zn[e.scale];0==In.ori?(v=$e,d=Ze,m=nr,p=Ke):(v=nr,d=Ke,m=$e,p=Ze);for(var w=Wr;Yr>=w;w++)if(null!=r[n][w]){var b=l(Cn(r[0][w],In,v,d)),_=l(Hn(r[n][w],x,m,p));Fn(g,b+u,_),Rn(g,b,_,u,0,2*h)}var k=t._stroke=t.stroke(a,n),y=t._fill=t.fill(a,n);Nr(k,i,t.dash,t.cap,y||(s?"#fff":e._stroke)),R.fill(g),s&&R.stroke(g),R.globalAlpha=1,R.restore(),c&&R.translate(-o,-o)}(e),Nt("drawSeries",e))})))}},Pn=(e.drawOrder||["axes","series"]).map((n=>En[n]));function An(n){var r=zn[n];if(null==r){var t=(e.scales||N)[n]||N;if(null!=t.from)An(t.from),zn[n]=U({},zn[t.from],t);else{(r=zn[n]=U({},n==Tn?Fe:Re,t)).key=n;var l=r.time,i=r.range,a=I(i);if(n!=Tn&&!a&&V(i)){var o=i;i=(n,e,r)=>null==e?cr:s(e,r,o)}r.range=T(i||(l?hr:n==Tn?3==r.distr?pr:4==r.distr?xr:vr:3==r.distr?mr:4==r.distr?gr:dr)),r.auto=T(!a&&r.auto),r.clamp=T(r.clamp||He),r._min=r._max=null}}}for(var Yn in An("x"),An("y"),Mn.forEach((n=>{An(n.scale)})),Sn.forEach((n=>{An(n.scale)})),e.scales)An(Yn);var Cn,Hn,Fn,Rn,In=zn[Tn],On=In.distr;0==In.ori?(dn(E,"u-hz"),Cn=f,Hn=c,Fn=Ue,Rn=Xe):(dn(E,"u-vt"),Cn=c,Hn=f,Fn=Be,Rn=Qe);var Vn={};for(var jn in zn){var Gn=zn[jn];null==Gn.min&&null==Gn.max||(Vn[jn]={min:Gn.min,max:Gn.max},Gn.min=Gn.max=null)}var Un,Bn=e.tzDate||(n=>new Date(p(n/_n))),Jn=e.fmtDate||Wn,qn=1==_n?ne(Bn):le(Bn),Zn=ae(Bn,ie(1==_n?$n:te,Jn)),Kn=ue(Bn,se("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Jn)),Xn=a.legend=U({},fe,e.legend),ee=Xn.show;Xn.width=T(Xn.width),Xn.dash=T(Xn.dash),Xn.stroke=T(Xn.stroke),Xn.fill=T(Xn.fill);var oe,ce=[],ve=!1,he={};if(Xn.live){var me=Mn[1]?Mn[1].values:null;for(var pe in oe=(ve=null!=me)?me(a,1,0):{_:0})he[pe]="--"}if(ee)if(Un=gn("table","u-legend",E),ve){var ge=gn("tr","u-thead",Un);for(var xe in gn("th",null,ge),oe)gn("th",fn,ge).textContent=xe}else dn(Un,"u-inline"),Xn.live&&dn(Un,"u-live");var Se={show:!0},ze={show:!1},De=new Map;function Te(n,e,r){var t=De.get(e)||{},l=_r.bind[n](a,e,r);l&&(kn(n,e,t[n]=l),De.set(e,t))}function Le(n,e){var r=De.get(e)||{};for(var t in r)null!=n&&t!=n||(yn(t,e,r[t]),delete r[t]);null==n&&De.delete(e)}var Ie=0,Oe=0,Ve=0,je=0,Je=0,qe=0,Ze=0,Ke=0,$e=0,nr=0;a.bbox={};var er=!1,rr=!1,tr=!1,lr=!1,ir=!1;function or(n,e){n==a.width&&e==a.height||br(n,e),Gr(!1),tr=!0,rr=!0,lr=!0,ir=!0,lt()}function br(n,e){a.width=Ie=Ve=n,a.height=Oe=je=e,Je=qe=0,function(){var n=!1,e=!1,r=!1,t=!1;Sn.forEach((l=>{if(l.show&&l._show){var i=l.side,a=i%2,o=l._size+(l.labelSize=null!=l.label?l.labelSize||30:0);o>0&&(a?(Ve-=o,3==i?(Je+=o,t=!0):r=!0):(je-=o,0==i?(qe+=o,n=!0):e=!0))}})),Dr[0]=n,Dr[1]=r,Dr[2]=e,Dr[3]=t,Ve-=Ar[1]+Ar[3],Je+=Ar[3],je-=Ar[2]+Ar[0],qe+=Ar[0]}(),function(){var n=Je+Ve,e=qe+je,r=Je,t=qe;function l(l,i){switch(l){case 1:return(n+=i)-i;case 2:return(e+=i)-i;case 3:return(r-=i)+i;case 0:return(t-=i)+i}}Sn.forEach((n=>{if(n.show&&n._show){var e=n.side;n._pos=l(e,n._size),null!=n.label&&(n._lpos=l(e,n.labelSize))}}))}();var r=a.bbox;Ze=r.left=z(Je*hn,.5),Ke=r.top=z(qe*hn,.5),$e=r.width=z(Ve*hn,.5),nr=r.height=z(je*hn,.5)}a.setSize=function(n){or(n.width,n.height)};var _r=a.cursor=U({},de,e.cursor);_r._lock=!1;var kr=_r.points;kr.show=T(kr.show),kr.size=T(kr.size),kr.stroke=T(kr.stroke),kr.width=T(kr.width),kr.fill=T(kr.fill);var yr=a.focus=U({},e.focus||{alpha:.3},_r.focus),Mr=yr.prox>=0,Sr=[null];function zr(n,e){var r=zn[n.scale].time,t=n.value;if(n.value=r?O(t)?ue(Bn,se(t,Jn)):t||Kn:t||Pe,n.label=n.label||(r?"Time":"Value"),e>0){n.width=null==n.width?1:n.width,n.paths=n.paths||sr||A,n.fillTo=T(n.fillTo||Ye),n.pxAlign=+u(n.pxAlign,vn),n.pxRound=Ge(n.pxAlign),n.stroke=T(n.stroke||null),n.fill=T(n.fill||null),n._stroke=n._fill=n._paths=n._focus=null;var l=We(n.width,1),i=n.points=U({},{size:l,width:w(1,.2*l),stroke:n.stroke,space:2*l,_stroke:null,_fill:null},n.points);i.show=T(i.show),i.fill=T(i.fill),i.stroke=T(i.stroke)}if(ee&&(ce.splice(e,0,function(n,e){if(0==e&&(ve||!Xn.live))return null;var r=[],t=gn("tr","u-series",Un,Un.childNodes[e]);dn(t,n.class),n.show||dn(t,un);var l=gn("th",null,t),i=xn("u-marker",l);if(e>0){var o=Xn.width(a,e);o&&(i.style.border=o+"px "+Xn.dash(a,e)+" "+Xn.stroke(a,e)),i.style.background=Xn.fill(a,e)}var s=xn(fn,l);for(var u in s.textContent=n.label,e>0&&(Te("click",l,(e=>{if(!_r._lock){var r=Mn.indexOf(n);if(e.ctrlKey!=Xn.isolate){var t=Mn.some(((n,e)=>e>0&&e!=r&&n.show));Mn.forEach(((n,e)=>{e>0&&xt(e,t?e==r?Se:ze:Se,It.setSeries)}))}else xt(r,{show:!n.show},It.setSeries)}})),Mr&&Te(an,l,(()=>{_r._lock||xt(Mn.indexOf(n),wt,It.setSeries)}))),oe){var f=gn("td","u-value",t);f.textContent="--",r.push(f)}return r}(n,e)),Xn.values.push(null)),_r.show){var o=function(n,e){if(e>0){var r=_r.points.show(a,e);if(r)return dn(r,"u-cursor-pt"),dn(r,n.class),wn(r,-10,-10,Ve,je),nn.insertBefore(r,Sr[e]),r}}(n,e);o&&Sr.splice(e,0,o)}}a.addSeries=function(n,e){n=fr(n,e=null==e?Mn.length:e,be,Ce),Mn.splice(e,0,n),zr(Mn[e],e)},a.delSeries=function(n){if(Mn.splice(n,1),ee){Xn.values.splice(n,1);var e=ce.splice(n,1)[0][0].parentNode;Le(null,e.firstChild),e.remove()}Sr.length>1&&Sr.splice(n,1)[0].remove()},Mn.forEach(zr);var Dr=[!1,!1,!1,!1];function Tr(n,e,r){var t=r[0],l=r[1],i=r[2],a=r[3],o=e%2,s=0;return 0==o&&(a||l)&&(s=0==e&&!t||2==e&&!i?p(we.size/3):0),1==o&&(t||i)&&(s=1==e&&!l||3==e&&!a?p(Ae.size/2):0),s}Sn.forEach((function(n,e){if(n._show=n.show,n.show){var r=zn[n.scale];null==r&&(n.scale=n.side%2?Mn[1].scale:Tn,r=zn[n.scale]);var t=r.time;n.size=T(n.size),n.space=T(n.space),n.rotate=T(n.rotate),n.incrs=T(n.incrs||(2==r.distr?Ln:t?1==_n?Qn:re:Nn)),n.splits=T(n.splits||(t&&1==r.distr?qn:3==r.distr?ye:4==r.distr?Me:ke)),n.stroke=T(n.stroke),n.grid.stroke=T(n.grid.stroke),n.ticks.stroke=T(n.ticks.stroke);var l=n.values;n.values=I(l)&&!I(l[0])?T(l):t?I(l)?ae(Bn,ie(l,Jn)):O(l)?function(n,e){var r=Wn(e);return(e,t)=>t.map((e=>r(n(e))))}(Bn,l):l||Zn:l||_e,n.filter=T(n.filter||(3>r.distr?P:Ee)),n.font=wr(n.font),n.labelFont=wr(n.labelFont),n._size=n.size(a,null,e,0),n._space=n._rotate=n._incrs=n._found=n._splits=n._values=null,n._size>0&&(Dr[e]=!0)}}));var Er,Pr=a.padding=(e.padding||[Tr,Tr,Tr,Tr]).map((n=>T(u(n,Tr)))),Ar=a._padding=Pr.map(((n,e)=>n(a,e,Dr,0))),Wr=null,Yr=null,Cr=Mn[0].idxs,Hr=null,Fr=!1;function Rr(n,e){if((r=(n||[]).slice())[0]=r[0]||[],a.data=r.slice(),Er=(Hr=r[0]).length,2==On&&(r[0]=Hr.map(((n,e)=>e))),a._data=r,Gr(!0),Nt("setData"),!1!==e){var t=In;t.auto(a,Fr)?Lr():gt(Tn,t.min,t.max),lr=_r.left>=0,ir=!0,lt()}}function Lr(){var n,e,t,a,o;Fr=!0,Er>0?(Wr=Cr[0]=0,Yr=Cr[1]=Er-1,a=r[0][Wr],o=r[0][Yr],2==On?(a=Wr,o=Yr):1==Er&&(3==On?(a=(n=l(a,a,In.log,!1))[0],o=n[1]):4==On?(a=(e=i(a,a,In.log,!1))[0],o=e[1]):In.time?o=a+p(86400/_n):(a=(t=s(a,o,.1,!0))[0],o=t[1]))):(Wr=Cr[0]=a=null,Yr=Cr[1]=o=null),gt(Tn,a,o)}function Nr(n,e,r,t,l){R.strokeStyle=n||en,R.lineWidth=e,R.lineJoin="round",R.lineCap=t||"butt",R.setLineDash(r||[]),R.fillStyle=l||en}function Ir(n,e,r,t,l,i,a){Nr(n,e,r,t,l),l&&a&&R.fill(a),n&&i&&e&&R.stroke(i)}function Or(n,e,r,t,l,i,a,o,s,u){var f=a%2/2;1==vn&&R.translate(f,f),Nr(o,a,s,u),R.beginPath();var c,v,h,d,m=l+(0==t||3==t?-i:i);0==r?(v=l,d=m):(c=l,h=m),n.forEach(((n,t)=>{null!=e[t]&&(0==r?c=h=n:v=d=n,R.moveTo(c,v),R.lineTo(h,d))})),R.stroke(),1==vn&&R.translate(-f,-f)}function Vr(n){var e=!0;return Sn.forEach(((r,t)=>{if(r.show){var l=zn[r.scale];if(null!=l.min){r._show||(e=!1,r._show=!0,Gr(!1));var i=r.side,o=l.min,s=l.max,u=function(n,e,r,t){var l,i=Sn[n];if(t>0){var o=i._space=i.space(a,n,e,r,t),s=i._incrs=i.incrs(a,n,e,r,t,o);l=i._found=function(n,e,r,t,l){for(var i=t/(e-n),a=(""+m(n)).length,o=0;r.length>o;o++){var s=r[o]*i,u=10>r[o]?F.get(r[o]):0;if(s>=l&&17>a+u)return[r[o],s]}return[0,0]}(e,r,s,t,o)}else l=[0,0];return l}(t,o,s,0==i%2?Ve:je),f=u[0],c=u[1];if(0!=c){var v=r._splits=r.splits(a,t,o,s,f,c,2==l.distr),h=2==l.distr?v.map((n=>Hr[n])):v,d=2==l.distr?Hr[v[1]]-Hr[v[0]]:f,p=r._values=r.values(a,r.filter(a,h,t,c,d),t,c,d);r._rotate=2==i?r.rotate(a,p,t,c):0;var x=r._size;r._size=g(r.size(a,p,t,n)),null!=x&&r._size!=x&&(e=!1)}}else r._show&&(e=!1,r._show=!1,Gr(!1))}})),e}function jr(n){var e=!0;return Pr.forEach(((r,t)=>{var l=r(a,t,Dr,n);l!=Ar[t]&&(e=!1),Ar[t]=l})),e}function Gr(n){Mn.forEach(((e,r)=>{r>0&&(e._paths=null,n&&(e.min=null,e.max=null))}))}a.setData=Rr;var Ur,Br,Jr,qr,Zr,Kr,Xr,Qr,$r,nt,et,rt,tt=!1;function lt(){tt||(J(it),tt=!0)}function it(){er&&(function(){var e=G(zn,j);for(var t in e){var l=e[t],i=Vn[t];if(null!=i&&null!=i.min)U(l,i),t==Tn&&Gr(!0);else if(t!=Tn)if(0==Er&&null==l.from){var o=l.range(a,null,null,t);l.min=o[0],l.max=o[1]}else l.min=S,l.max=-S}if(Er>0)for(var s in Mn.forEach(((t,l)=>{var i=t.scale,o=e[i],s=Vn[i];if(0==l){var u=o.range(a,o.min,o.max,i);o.min=u[0],o.max=u[1],Wr=n(o.min,r[0]),Yr=n(o.max,r[0]),o.min>r[0][Wr]&&Wr++,r[0][Yr]>o.max&&Yr--,t.min=Hr[Wr],t.max=Hr[Yr]}else if(t.show&&t.auto&&o.auto(a,Fr)&&(null==s||null==s.min)){var f=null==t.min?3==o.distr?function(n,e,r){for(var t=S,l=-S,i=e;r>=i;i++)n[i]>0&&(t=x(t,n[i]),l=w(l,n[i]));return[t==S?1:t,l==-S?10:l]}(r[l],Wr,Yr):function(n,e,r,t){var l=S,i=-S;if(1==t)l=n[e],i=n[r];else if(-1==t)l=n[r],i=n[e];else for(var a=e;r>=a;a++)null!=n[a]&&(l=x(l,n[a]),i=w(i,n[a]));return[l,i]}(r[l],Wr,Yr,t.sorted):[t.min,t.max];o.min=x(o.min,t.min=f[0]),o.max=w(o.max,t.max=f[1])}t.idxs[0]=Wr,t.idxs[1]=Yr})),e){var u=e[s],f=Vn[s];if(null==u.from&&(null==f||null==f.min)){var c=u.range(a,u.min==S?null:u.min,u.max==-S?null:u.max,s);u.min=c[0],u.max=c[1]}}for(var v in e){var h=e[v];if(null!=h.from){var d=e[h.from],m=h.range(a,d.min,d.max,v);h.min=m[0],h.max=m[1]}}var p={},g=!1;for(var b in e){var _=e[b],y=zn[b];if(y.min!=_.min||y.max!=_.max){y.min=_.min,y.max=_.max;var z=y.distr;y._min=3==z?k(y.min):4==z?M(y.min,y.asinh):y.min,y._max=3==z?k(y.max):4==z?M(y.max,y.asinh):y.max,p[b]=g=!0}}if(g){for(var D in Mn.forEach((n=>{p[n.scale]&&(n._paths=null)})),p)tr=!0,Nt("setScale",D);_r.show&&(lr=_r.left>=0)}for(var T in Vn)Vn[T]=null}(),er=!1),tr&&(function(){for(var n=!1,e=0;!n;){var r=Vr(++e),t=jr(e);(n=r&&t)||(br(a.width,a.height),rr=!0)}}(),tr=!1),rr&&(pn(B,Q,Je),pn(B,K,qe),pn(B,q,Ve),pn(B,Z,je),pn(nn,Q,Je),pn(nn,K,qe),pn(nn,q,Ve),pn(nn,Z,je),pn(L,q,Ie),pn(L,Z,Oe),C.width=p(Ie*hn),C.height=p(Oe*hn),Pt(!1),Nt("setSize"),rr=!1),Ie>0&&Oe>0&&(R.clearRect(0,0,C.width,C.height),Nt("drawClear"),Pn.forEach((n=>n())),Nt("draw")),_r.show&&lr&&(Tt(),lr=!1),y||(y=!0,a.status=1,Nt("ready")),Fr=!1,tt=!1}function at(e,t){var l=zn[e];if(null==l.from){if(0==Er){var i=l.range(a,t.min,t.max,e);t.min=i[0],t.max=i[1]}if(t.min>t.max){var o=t.min;t.min=t.max,t.max=o}if(Er>1&&null!=t.min&&null!=t.max&&1e-16>t.max-t.min)return;e==Tn&&2==l.distr&&Er>0&&(t.min=n(t.min,r[0]),t.max=n(t.max,r[0])),Vn[e]=t,er=!0,lt()}}a.redraw=(n,e)=>{tr=e||!1,!1!==n?gt(Tn,In.min,In.max):lt()},a.setScale=at;var ot=!1,st=_r.drag,ut=st.x,ft=st.y;_r.show&&(_r.x&&(Ur=xn("u-cursor-x",nn)),_r.y&&(Br=xn("u-cursor-y",nn)),0==In.ori?(Jr=Ur,qr=Br):(Jr=Br,qr=Ur),et=_r.left,rt=_r.top);var ct,vt,ht,dt=a.select=U({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),mt=dt.show?xn("u-select",dt.over?nn:B):null;function pt(n,e){if(dt.show){for(var r in n)pn(mt,r,dt[r]=n[r]);!1!==e&&Nt("setSelect")}}function gt(n,e,r){at(n,{min:e,max:r})}function xt(n,e,r){var t=Mn[n];null!=e.focus&&function(n){if(n!=ht){var e=null==n,r=1!=yr.alpha;Mn.forEach(((t,l)=>{var i=e||0==l||l==n;t._focus=e?null:i,r&&function(n,e){Mn[n].alpha=e,_r.show&&Sr[n]&&(Sr[n].style.opacity=e),ee&&ce[n]&&(ce[n][0].parentNode.style.opacity=e)}(l,i?1:yr.alpha)})),ht=n,r&<()}}(n),null!=e.show&&(t.show=e.show,function(n){var e=ee?ce[n][0].parentNode:null;Mn[n].show?e&&mn(e,un):(e&&dn(e,un),Sr.length>1&&wn(Sr[n],-10,-10,Ve,je))}(n),gt(t.scale,null,null),lt()),Nt("setSeries",n,e),r&&Vt("setSeries",a,n,e)}a.setSelect=pt,a.setSeries=xt;var wt={focus:!0},bt={focus:!1};function _t(n,e){var r=zn[e],t=Ve;1==r.ori&&(n=(t=je)-n),-1==r.dir&&(n=t-n);var l=r._min,i=l+n/t*(r._max-l),a=r.distr;return 3==a?b(10,i):4==a?((n,e)=>(void 0===e&&(e=1),v.sinh(n/e)))(i,r.asinh):i}function kt(n,e){pn(mt,Q,dt.left=n),pn(mt,q,dt.width=e)}function yt(n,e){pn(mt,K,dt.top=n),pn(mt,Z,dt.height=e)}ee&&Mr&&kn(on,Un,(()=>{_r._lock||(xt(null,bt,It.setSeries),Tt())})),a.valToIdx=e=>n(e,r[0]),a.posToIdx=function(e){return n(_t(e,Tn),r[0],Wr,Yr)},a.posToVal=_t,a.valToPos=(n,e,r)=>0==zn[e].ori?f(n,zn[e],r?$e:Ve,r?Ze:0):c(n,zn[e],r?nr:je,r?Ke:0),a.batch=function(n){n(a),lt()},a.setCursor=n=>{et=n.left,rt=n.top,Tt()};var Mt=0==In.ori?kt:yt,St=1==In.ori?kt:yt;function zt(n,e){if(null!=n){var r=n.idx;Xn.idx=r,Mn.forEach(((n,e)=>{(e>0||!ve)&&Dt(e,r)}))}ee&&Xn.live&&function(){if(ee&&Xn.live)for(var n=0;Mn.length>n;n++)if(0!=n||!ve){var e=Xn.values[n],r=0;for(var t in e)ce[n][r++].firstChild.nodeValue=e[t]}}(),ir=!1,!1!==e&&Nt("setLegend")}function Dt(n,e){var t;if(null==e)t=he;else{var l=Mn[n],i=0==n&&2==On?Hr:r[n];t=ve?l.values(a,n,e):{_:l.value(a,i[e],n,e)}}Xn.values[n]=t}function Tt(e,t){var l,i;$r=et,nt=rt,l=_r.move(a,et,rt),et=l[0],rt=l[1],_r.show&&(Jr&&wn(Jr,p(et),0,Ve,je),qr&&wn(qr,0,p(rt),Ve,je));var o=!1;ct=S;var s=0==In.ori?Ve:je,u=1==In.ori?Ve:je;if(0>et||0==Er||Wr>Yr){i=null;for(var f=0;Mn.length>f;f++)f>0&&Sr.length>1&&wn(Sr[f],-10,-10,Ve,je);if(Mr&&xt(null,wt,It.setSeries),Xn.live){o=!0;for(var c=0;Mn.length>c;c++)Xn.values[c]=he}}else{var v=_t(0==In.ori?et:rt,Tn);i=n(v,r[0],Wr,Yr);for(var h=Y(Cn(r[0][i],In,s,0),.5),m=0;Mn.length>m;m++){var g=Mn[m],w=_r.dataIdx(a,m,i,v),b=w==i?h:Y(Cn(r[0][w],In,s,0),.5);if(m>0&&g.show){var _=r[m][w],k=null==_?-10:Y(Hn(_,zn[g.scale],u,0),.5);if(k>0){var M=d(k-rt);M>ct||(ct=M,vt=m)}var z=void 0,D=void 0;0==In.ori?(z=b,D=k):(z=k,D=b),Sr.length>1&&wn(Sr[m],z,D,Ve,je)}if(Xn.live){if(w==_r.idx&&!ir||0==m&&ve)continue;o=!0,Dt(m,w)}}}if(o&&(Xn.idx=i,zt()),dt.show&&ot)if(null!=t){var T=It.scales,E=T[0],P=T[1],A=t.cursor.drag;ut=A._x,ft=A._y;var W,C,H,F,R,L=t.select,N=L.left,I=L.top,O=L.width,V=L.height,j=t.scales[E].ori,G=t.posToVal;E&&(0==j?(W=N,C=O):(W=I,C=V),H=zn[E],F=Cn(G(W,E),H,s,0),R=Cn(G(W+C,E),H,s,0),Mt(x(F,R),d(R-F)),P||St(0,u)),P&&(1==j?(W=N,C=O):(W=I,C=V),H=zn[P],F=Hn(G(W,P),H,u,0),R=Hn(G(W+C,P),H,u,0),St(x(F,R),d(R-F)),E||Mt(0,s))}else{var U=d($r-Zr),B=d(nt-Kr);if(1==In.ori){var J=U;U=B,B=J}ut=st.x&&U>=st.dist,ft=st.y&&B>=st.dist;var q,Z,K=st.uni;null!=K?ut&&ft&&(ft=B>=K,(ut=U>=K)||ft||(B>U?ft=!0:ut=!0)):st.x&&st.y&&(ut||ft)&&(ut=ft=!0),ut&&(0==In.ori?(q=Xr,Z=et):(q=Qr,Z=rt),Mt(x(q,Z),d(Z-q)),ft||St(0,u)),ft&&(1==In.ori?(q=Xr,Z=et):(q=Qr,Z=rt),St(x(q,Z),d(Z-q)),ut||Mt(0,s)),ut||ft||(Mt(0,0),St(0,0))}if(_r.idx=i,_r.left=et,_r.top=rt,st._x=ut,st._y=ft,null!=e&&(Vt(rn,a,et,rt,s,u,i),Mr)){var X=It.setSeries,Q=yr.prox;null==ht?ct>Q||xt(vt,wt,X):ct>Q?xt(null,wt,X):vt!=ht&&xt(vt,wt,X)}y&&Nt("setCursor")}a.setLegend=zt;var Et=null;function Pt(n){Et=n?null:nn.getBoundingClientRect()}function At(n,e,r,t,l,i){_r._lock||(Wt(n,e,r,t,l,i,0,!1,null!=n),null!=n?Tt(1):Tt(null,e))}function Wt(n,e,r,t,l,i,o,s,u){var f;if(null==Et&&Pt(!1),null!=n)r=n.clientX-Et.left,t=n.clientY-Et.top;else{if(0>r||0>t)return et=-10,void(rt=-10);var c=Ve,v=je,h=l,d=i,m=r,p=t;1==In.ori&&(c=je,v=Ve);var g=It.scales,x=g[0],w=g[1];if(1==e.scales[x].ori&&(h=i,d=l,m=t,p=r),r=null!=x?_(e.posToVal(m,x),zn[x],c,0):c*(m/h),t=null!=w?_(e.posToVal(p,w),zn[w],v,0):v*(p/d),1==In.ori){var b=r;r=t,t=b}}u&&(r>1&&Ve-1>r||(r=z(r,Ve)),t>1&&je-1>t||(t=z(t,je))),s?(Zr=r,Kr=t,f=_r.move(a,r,t),Xr=f[0],Qr=f[1]):(et=r,rt=t)}function Yt(){pt({width:0,height:0},!1)}function Ct(n,e,r,t,l,i){ot=!0,ut=ft=st._x=st._y=!1,Wt(n,e,r,t,l,i,0,!0,!1),null!=n&&(Te(ln,cn,Ht),Vt(tn,a,Xr,Qr,Ve,je,null))}function Ht(n,e,r,t,l,i){ot=st._x=st._y=!1,Wt(n,e,r,t,l,i,0,!1,!0);var o=dt.left,s=dt.top,u=dt.width,f=dt.height,c=u>0||f>0;if(c&&pt(dt),st.setScale&&c){var v=o,h=u,d=s,m=f;if(1==In.ori&&(v=s,h=f,d=o,m=u),ut&>(Tn,_t(v,Tn),_t(v+h,Tn)),ft)for(var p in zn){var g=zn[p];p!=Tn&&null==g.from&&g.min!=S&>(p,_t(d+m,p),_t(d,p))}Yt()}else _r.lock&&(_r._lock=!_r._lock,_r._lock||Tt());null!=n&&(Le(ln,cn),Vt(ln,a,et,rt,Ve,je,null))}function Ft(n){Lr(),Yt(),null!=n&&Vt(sn,a,et,rt,Ve,je,null)}var Rt={};Rt.mousedown=Ct,Rt.mousemove=At,Rt.mouseup=Ht,Rt.dblclick=Ft,Rt.setSeries=(n,e,r,t)=>{xt(r,t)},_r.show&&(Te(tn,nn,Ct),Te(rn,nn,At),Te(an,nn,Pt),Te(on,nn,(function(){if(!_r._lock){var n=ot;if(ot){var e,r,t=!0,l=!0;0==In.ori?(e=ut,r=ft):(e=ft,r=ut),e&&r&&(t=10>=et||et>=Ve-10,l=10>=rt||rt>=je-10),e&&t&&(et=Xr>et?0:Ve),r&&l&&(rt=Qr>rt?0:je),Tt(1),ot=!1}et=-10,rt=-10,Tt(1),n&&(ot=n)}})),Te(sn,nn,Ft),ar.add(a),a.syncRect=Pt);var Lt=a.hooks=e.hooks||{};function Nt(n,e,r){n in Lt&&Lt[n].forEach((n=>{n.call(null,a,e,r)}))}(e.plugins||[]).forEach((n=>{for(var e in n.hooks)Lt[e]=(Lt[e]||[]).concat(n.hooks[e])}));var It=U({key:null,setSeries:!1,filters:{pub:W,sub:W},scales:[Tn,null]},_r.sync),Ot=Ne(It.key);function Vt(n,e,r,t,l,i,a){It.filters.pub(n,e,r,t,l,i,a)&&Ot.pub(n,e,r,t,l,i,a)}function jt(){Nt("init",e,r),Rr(r||e.data,!1),Vn[Tn]?at(Tn,Vn[Tn]):Lr(),or(e.width,e.height),Tt(),pt(dt,!1)}return Ot.sub(a),a.pub=function(n,e,r,t,l,i,a){It.filters.sub(n,e,r,t,l,i,a)&&Rt[n](null,e,r,t,l,i,a)},a.destroy=function(){Ot.unsub(a),ar.delete(a),De.clear(),E.remove(),Nt("destroy")},t?t instanceof HTMLElement?(t.appendChild(E),jt()):t(a,jt):jt(),a}br.assign=U,br.fmtNum=c,br.rangeNum=s,br.rangeLog=l,br.rangeAsinh=i,br.orient=Ie,br.join=function(n,e){for(var r=new Set,t=0;n.length>t;t++)for(var l=n[t][0],i=l.length,a=0;i>a;a++)r.add(l[a]);for(var o=[Array.from(r).sort(((n,e)=>n-e))],s=o[0].length,u=new Map,f=0;s>f;f++)u.set(o[0][f],f);for(var c=0;n.length>c;c++)for(var v=n[c],h=v[0],d=1;v.length>d;d++){for(var m=v[d],p=Array(s).fill(void 0),g=e?e[c][d]:1,x=[],w=0;m.length>w;w++){var b=m[w],_=u.get(h[w]);null==b?0!=g&&(p[_]=b,2==g&&x.push(_)):p[_]=b}B(p,x,s),o.push(p)}return o},br.fmtDate=Wn,br.tzDate=function(n,e){var r;return"UTC"==e||"Etc/UTC"==e?r=new Date(+n+6e4*n.getTimezoneOffset()):e==Yn?r=n:(r=new Date(n.toLocaleString("en-US",{timeZone:e}))).setMilliseconds(n.getMilliseconds()),r},br.sync=Ne,br.addGap=je,br.clipGaps=Ve;var _r=br.paths={};return _r.linear=lr,_r.spline=function(){return(n,r,t,l)=>Ie(n,r,((i,a,o,s,u,f,c,v,h,d,m)=>{var p,g,x,w=i.pxRound;0==s.ori?(p=Ue,x=Je,g=$e):(p=Be,x=qe,g=nr);var b=1*s.dir*(0==s.ori?1:-1);t=e(o,t,l,1),l=e(o,t,l,-1);for(var _=[],k=!1,y=w(f(a[1==b?t:l],s,d,v)),M=y,S=[],z=[],D=1==b?t:l;D>=t&&l>=D;D+=b){var T=o[D],E=f(a[D],s,d,v);null!=T?(k&&(je(_,M,E),k=!1),S.push(M=E),z.push(c(o[D],u,m,h))):null===T&&(je(_,M,E),k=!0)}var P={stroke:ir(S,z,.5,p,g,w),fill:null,clip:null,band:null},A=P.stroke;if(null!=i.fill){var W=P.fill=new Path2D(A),Y=w(c(i.fillTo(n,r,i.min,i.max),u,m,h));x(W,M,Y),x(W,y,Y)}return i.spanGaps||(P.clip=Ve(_,s.ori,v,h,d,m)),n.bands.length>0&&(P.band=Oe(n,r,t,l,A)),P}))},_r.stepped=function(n){var r=u(n.align,1),t=u(n.ascDesc,!1);return(n,l,i,a)=>Ie(n,l,((o,s,u,f,c,v,h,d,m,p,g)=>{var x=o.pxRound,w=0==f.ori?Je:qe,b={stroke:new Path2D,fill:null,clip:null,band:null},_=b.stroke,k=1*f.dir*(0==f.ori?1:-1);i=e(u,i,a,1),a=e(u,i,a,-1);var y=[],M=!1,S=x(h(u[1==k?i:a],c,g,m)),z=x(v(s[1==k?i:a],f,p,d)),D=z;w(_,z,S);for(var T=1==k?i:a;T>=i&&a>=T;T+=k){var E=u[T],P=x(v(s[T],f,p,d));if(null!=E){var A=x(h(E,c,g,m));if(M){if(je(y,D,P),S!=A){var W=o.width*hn/2,Y=y[y.length-1];Y[0]+=t||1==r?W:-W,Y[1]-=t||-1==r?W:-W}M=!1}1==r?w(_,P,S):w(_,D,A),w(_,P,A),S=A,D=P}else null===E&&(je(y,D,P),M=!0)}if(null!=o.fill){var C=b.fill=new Path2D(_),H=x(h(o.fillTo(n,l,o.min,o.max),c,g,m));w(C,D,H),w(C,z,H)}return o.spanGaps||(b.clip=Ve(y,f.ori,d,m,p,g)),n.bands.length>0&&(b.band=Oe(n,l,i,a,_)),b}))},_r.bars=function(n){var r=u((n=n||N).size,[.6,S]),t=n.align||0,l=1-r[0],i=u(r[1],S)*hn;return(n,r,a,o)=>Ie(n,r,((s,u,f,c,v,h,d,m,p,g,b)=>{var _,k=s.pxRound,y=0==c.ori?Ze:Ke,M=h(u[1],c,g,m)-h(u[0],c,g,m),S=M*l,D=d(s.fillTo(n,r,s.min,s.max),v,b,p),T=k(s.width*hn),E=k(x(i,M-S)-T),P=1==t?0:-1==t?E:E/2,A={stroke:new Path2D,fill:null,clip:null,band:null},W=n.bands.length>0;W&&(A.band=new Path2D,_=z(d(v.max,v,b,p),.5));for(var Y=A.stroke,C=A.band,H=c.dir*(0==c.ori?1:-1),F=1==H?a:o;F>=a&&o>=F;F+=H){var R=f[F];if(null==R){if(!W)continue;var L=e(f,1==H?a:o,F,-H),N=e(f,F,1==H?o:a,H),I=f[L];R=I+(F-L)/(N-L)*(f[N]-I)}var O=h(2==c.distr?F:u[F],c,g,m),V=d(R,v,b,p),j=k(O-P),G=k(w(V,D)),U=k(x(V,D)),B=G-U;null!=f[F]&&y(Y,j,U,E,B),W&&(G=U,y(C,j,U=_,E,B=G-U))}return null!=s.fill&&(A.fill=new Path2D(Y)),A}))},br}(); diff --git a/package.json b/package.json index e0aaf7f9..ea4a3bad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uplot", - "version": "1.6.7", + "version": "1.6.8", "description": "A small, fast chart for time series, lines, areas, ohlc & bars", "main": "./dist/uPlot.cjs.js", "module": "./dist/uPlot.esm.js",