UNPKG

uplot-react-js

Version:

"This is chart wrapper for uplot library"

3 lines (2 loc) 49 kB
import{t as e,_ as t}from"./throttle-b9b1f622.js";import l,{useRef as n,useMemo as i,useEffect as o}from"react";import s from"./uuid.js";const r="u-off",u="undefined"!=typeof window,a=u?document:null,c=u?window:null,f=u?navigator:null;let h,d;function p(e,t){if(null!=t){let l=e.classList;!l.contains(t)&&l.add(t)}}function m(e,t){let l=e.classList;l.contains(t)&&l.remove(t)}function g(e,t,l){e.style[t]=l+"px"}function x(e,t,l,n){let i=a.createElement(e);return null!=t&&p(i,t),null!=l&&l.insertBefore(i,n),i}function w(e,t){return x("div",e,t)}const v=new WeakMap;function b(e,t,l,n,i){let o="translate("+t+"px,"+l+"px)";o!=v.get(e)&&(e.style.transform=o,v.set(e,o),t<0||l<0||t>n||l>i?p(e,r):m(e,r))}const y=new WeakMap;function k(e,t,l){let n=t+l;n!=y.get(e)&&(y.set(e,n),e.style.background=t,e.style.borderColor=l)}const _=new WeakMap;function M(e,t,l,n){let i=t+""+l;i!=_.get(e)&&(_.set(e,i),e.style.height=l+"px",e.style.width=t+"px",e.style.marginLeft=n?-t/2+"px":0,e.style.marginTop=n?-l/2+"px":0)}const S={passive:!0},z={...S,capture:!0};function E(e,t,l,n){t.addEventListener(e,l,n?z:S)}function D(e,t,l,n){t.removeEventListener(e,l,n?z:S)}function T(e,t,l,n){let i;l=l||0;let o=(n=n||t.length-1)<=2147483647;for(;n-l>1;)i=o?l+n>>1:V((l+n)/2),t[i]<e?l=i:n=i;return e-t[l]<=t[n]-e?l:n}function A(e,t,l,n){for(let i=1==n?t:l;i>=t&&i<=l;i+=n)if(null!=e[i])return i;return-1}u&&function e(){let t=devicePixelRatio;h!=t&&(h=t,d&&D("change",d,e),d=matchMedia(`(min-resolution: ${h-.001}dppx) and (max-resolution: ${h+.001}dppx)`),E("change",d,e),c.dispatchEvent(new CustomEvent("dppxchange")))}();const C=[0,0];function Y(e,t,l,n){return C[0]=l<0?pe(e,-l):e,C[1]=n<0?pe(t,-n):t,C}function P(e,t,l,n){let i,o,s,r=X(e),u=10==l?Q:ee;return e==t&&(-1==r?(e*=l,t/=l):(e/=l,t*=l)),n?(i=V(u(e)),o=J(u(t)),s=Y($(l,i),$(l,o),i,o),e=s[0],t=s[1]):(i=V(u(U(e))),o=V(u(U(t))),s=Y($(l,i),$(l,o),i,o),e=de(e,s[0]),t=he(t,s[1])),[e,t]}function W(e,t,l,n){let i=P(e,t,l,n);return 0==e&&(i[0]=0),0==t&&(i[1]=0),i}const R={mode:3,pad:.1},H={pad:0,soft:null,mode:0},F={min:H,max:H};function N(e,t,l,n){return _e(l)?j(e,t,l):(H.pad=l,H.soft=n?0:null,H.mode=n?3:0,j(e,t,F))}function I(e,t){return null==e?t:e}function j(e,t,l){let n=l.min,i=l.max,o=I(n.pad,0),s=I(i.pad,0),r=I(n.hard,-le),u=I(i.hard,le),a=I(n.soft,le),c=I(i.soft,-le),f=I(n.mode,0),h=I(i.mode,0),d=t-e;d<1e-9&&(d=0,0!=e&&0!=t||(d=1e-9,2==f&&a!=le&&(o=0),2==h&&c!=-le&&(s=0)));let p=d||U(t)||1e3,m=Q(p),g=$(10,V(m)),x=pe(de(e-p*(0==d?0==e?.1:1:o),g/10),9),w=e>=a&&(1==f||3==f&&x<=a||2==f&&x>=a)?a:le,v=Z(r,x<w&&e>=w?w:K(w,x)),b=pe(he(t+p*(0==d?0==t?.1:1:s),g/10),9),y=t<=c&&(1==h||3==h&&b>=c||2==h&&b<=c)?c:-le,k=K(u,b>y&&t<=y?y:Z(y,b));return v==k&&0==v&&(k=100),[v,k]}const B=new Intl.NumberFormat(u?f.language:"en-US"),G=e=>B.format(e),L=Math,O=L.PI,U=L.abs,V=L.floor,q=L.round,J=L.ceil,K=L.min,Z=L.max,$=L.pow,X=L.sign,Q=L.log10,ee=L.log2,te=(e,t=1)=>L.asinh(e/t),le=1/0;function ne(e){return 1+(0|Q((e^e>>31)-(e>>31)))}function ie(e,t){return q(e/t)*t}function oe(e,t,l){return K(Z(e,t),l)}function se(e){return"function"==typeof e?e:()=>e}const re=e=>e,ue=(e,t)=>t,ae=e=>null,ce=e=>!0,fe=(e,t)=>e==t;function he(e,t){return J(e/t)*t}function de(e,t){return V(e/t)*t}function pe(e,t){return q(e*(t=10**t))/t}const me=new Map;function ge(e){return((""+e).split(".")[1]||"").length}function xe(e,t,l,n){let i=[],o=n.map(ge);for(let s=t;s<l;s++){let t=U(s),l=pe($(e,s),t);for(let e=0;e<n.length;e++){let r=n[e]*l,u=(r>=0&&s>=0?0:t)+(s>=o[e]?0:o[e]),a=pe(r,u);i.push(a),me.set(a,u)}}return i}const we={},ve=[],be=[null,null],ye=Array.isArray;function ke(e){return"string"==typeof e}function _e(e){let t=!1;if(null!=e){let l=e.constructor;t=null==l||l==Object}return t}function Me(e){return null!=e&&"object"==typeof e}const Se=Object.getPrototypeOf(Uint8Array);function ze(e,t=_e){let l;if(ye(e)){let n=e.find((e=>null!=e));if(ye(n)||t(n)){l=Array(e.length);for(let n=0;n<e.length;n++)l[n]=ze(e[n],t)}else l=e.slice()}else if(e instanceof Se)l=e.slice();else if(t(e)){l={};for(let n in e)l[n]=ze(e[n],t)}else l=e;return l}function Ee(e){let t=arguments;for(let l=1;l<t.length;l++){let n=t[l];for(let t in n)_e(e[t])?Ee(e[t],ze(n[t])):e[t]=ze(n[t])}return e}function De(e,t,l){for(let n,i=0,o=-1;i<t.length;i++){let s=t[i];if(s>o){for(n=s-1;n>=0&&null==e[n];)e[n--]=null;for(n=s+1;n<l&&null==e[n];)e[o=n++]=null}}}const Te="undefined"==typeof queueMicrotask?e=>Promise.resolve().then(e):queueMicrotask,Ae=["January","February","March","April","May","June","July","August","September","October","November","December"],Ce=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Ye(e){return e.slice(0,3)}const Pe=Ce.map(Ye),We=Ae.map(Ye),Re={MMMM:Ae,MMM:We,WWWW:Ce,WWW:Pe};function He(e){return(e<10?"0":"")+e}const Fe={YYYY:e=>e.getFullYear(),YY:e=>(e.getFullYear()+"").slice(2),MMMM:(e,t)=>t.MMMM[e.getMonth()],MMM:(e,t)=>t.MMM[e.getMonth()],MM:e=>He(e.getMonth()+1),M:e=>e.getMonth()+1,DD:e=>He(e.getDate()),D:e=>e.getDate(),WWWW:(e,t)=>t.WWWW[e.getDay()],WWW:(e,t)=>t.WWW[e.getDay()],HH:e=>He(e.getHours()),H:e=>e.getHours(),h:e=>{let t=e.getHours();return 0==t?12:t>12?t-12:t},AA:e=>e.getHours()>=12?"PM":"AM",aa:e=>e.getHours()>=12?"pm":"am",a:e=>e.getHours()>=12?"p":"a",mm:e=>He(e.getMinutes()),m:e=>e.getMinutes(),ss:e=>He(e.getSeconds()),s:e=>e.getSeconds(),fff:e=>{return((t=e.getMilliseconds())<10?"00":t<100?"0":"")+t;var t}};function Ne(e,t){t=t||Re;let l,n=[],i=/\{([a-z]+)\}|[^{]+/gi;for(;l=i.exec(e);)n.push("{"==l[0][0]?Fe[l[1]]:l[0]);return e=>{let l="";for(let i=0;i<n.length;i++)l+="string"==typeof n[i]?n[i]:n[i](e,t);return l}}const Ie=(new Intl.DateTimeFormat).resolvedOptions().timeZone;const je=e=>e%1==0,Be=[1,2,2.5,5],Ge=xe(10,-16,0,Be),Le=xe(10,0,16,Be),Oe=Le.filter(je),Ue=Ge.concat(Le),Ve="{M}/{D}",qe="\n"+Ve,Je=qe+"/{YY}",Ke="{h}:{mm}{aa}",Ze=null;function $e(e){let t=1e3*e,l=60*t,n=60*l,i=24*n,o=30*i,s=365*i;return[(1==e?xe(10,0,3,Be).filter(je):xe(10,-3,0,Be)).concat([t,5*t,10*t,15*t,30*t,l,5*l,10*l,15*l,30*l,n,2*n,3*n,4*n,6*n,8*n,12*n,i,2*i,3*i,4*i,5*i,6*i,7*i,8*i,9*i,10*i,15*i,o,2*o,3*o,4*o,6*o,s,2*s,5*s,10*s,25*s,50*s,100*s]),[[s,"{YYYY}",Ze,Ze,Ze,Ze,Ze,Ze,1],[28*i,"{MMM}","\n{YYYY}",Ze,Ze,Ze,Ze,Ze,1],[i,Ve,"\n{YYYY}",Ze,Ze,Ze,Ze,Ze,1],[n,"{h}{aa}",Je,Ze,qe,Ze,Ze,Ze,1],[l,Ke,Je,Ze,qe,Ze,Ze,Ze,1],[t,":{ss}",Je+" "+Ke,Ze,qe+" "+Ke,Ze,"\n{h}:{mm}{aa}",Ze,1],[e,":{ss}.{fff}",Je+" "+Ke,Ze,qe+" "+Ke,Ze,"\n{h}:{mm}{aa}",Ze,1]],function(t){return(r,u,a,c,f,h)=>{let d=[],p=f>=s,m=f>=o&&f<s,g=t(a),x=pe(g*e,3),w=st(g.getFullYear(),p?0:g.getMonth(),m||p?1:g.getDate()),v=pe(w*e,3);if(m||p){let l=m?f/o:0,n=p?f/s:0,i=x==v?x:pe(st(w.getFullYear()+n,w.getMonth()+l,1)*e,3),r=new Date(q(i/e)),u=r.getFullYear(),a=r.getMonth();for(let o=0;i<=c;o++){let s=st(u+n*o,a+l*o,1),r=s-t(pe(s*e,3));i=pe((+s+r)*e,3),i<=c&&d.push(i)}}else{let o=f>=i?i:f,s=v+(V(a)-V(x))+he(x-v,o);d.push(s);let p=t(s),m=p.getHours()+p.getMinutes()/l+p.getSeconds()/n,g=f/n,w=h/r.axes[u]._space;for(;s=pe(s+f,1==e?0:3),!(s>c);)if(g>1){let e=V(pe(m+g,6))%24,l=t(s).getHours()-e;l>1&&(l=-1),s-=l*n,m=(m+g)%24,pe((s-d[d.length-1])/f,3)*w>=.7&&d.push(s)}else d.push(s)}return d}}]}const[Xe,Qe,et]=$e(1),[tt,lt,nt]=$e(.001);function it(e,t){return e.map((e=>e.map(((l,n)=>0==n||8==n||null==l?l:t(1==n||0==e[8]?l:e[1]+l)))))}function ot(e,t){return(l,n,i,o,s)=>{let r,u,a,c,f,h,d=t.find((e=>s>=e[0]))||t[t.length-1];return n.map((t=>{let l=e(t),n=l.getFullYear(),i=l.getMonth(),o=l.getDate(),s=l.getHours(),p=l.getMinutes(),m=l.getSeconds(),g=n!=r&&d[2]||i!=u&&d[3]||o!=a&&d[4]||s!=c&&d[5]||p!=f&&d[6]||m!=h&&d[7]||d[1];return r=n,u=i,a=o,c=s,f=p,h=m,g(l)}))}}function st(e,t,l){return new Date(e,t,l)}function rt(e,t){return t(e)}xe(2,-53,53,[1]);function ut(e,t){return(l,n)=>t(e(n))}const at={show:!0,live:!0,isolate:!1,markers:{show:!0,width:2,stroke:function(e,t){let l=e.series[t];return l.width?l.stroke(e,t):l.points.width?l.points.stroke(e,t):null},fill:function(e,t){return e.series[t].fill(e,t)},dash:"solid"},idx:null,idxs:null,values:[]};const ct=[0,0];function ft(e,t,l){return e=>{0==e.button&&l(e)}}function ht(e,t,l){return l}const dt={show:!0,x:!0,y:!0,lock:!1,move:function(e,t,l){return ct[0]=t,ct[1]=l,ct},points:{show:function(e,t){let l=e.cursor.points,n=w(),i=l.size(e,t);g(n,"width",i),g(n,"height",i);let o=i/-2;g(n,"marginLeft",o),g(n,"marginTop",o);let s=l.width(e,t,i);return s&&g(n,"borderWidth",s),n},size:function(e,t){return Pt(e.series[t].points.width,1)},width:0,stroke:function(e,t){let l=e.series[t].points;return l._stroke||l._fill},fill:function(e,t){let l=e.series[t].points;return l._fill||l._stroke}},bind:{mousedown:ft,mouseup:ft,click:ft,dblclick:ft,mousemove:ht,mouseleave:ht,mouseenter:ht},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(e,t,l){return l},idxs:null},pt={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},mt=Ee({},pt,{filter:ue}),gt=Ee({},mt,{size:10}),xt=Ee({},pt,{show:!1}),wt='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"',vt="bold "+wt,bt={show:!0,scale:"x",stroke:"#000",space:50,gap:5,size:50,labelGap:0,labelSize:30,labelFont:vt,side:2,grid:mt,ticks:gt,border:xt,font:wt,rotate:0},yt={show:!0,scale:"x",auto:!1,sorted:1,min:le,max:-le,idxs:[]};function kt(e,t,l,n,i){return t.map((e=>null==e?"":G(e)))}function _t(e,t,l,n,i,o,s){let r=[],u=me.get(i)||0;for(let e=l=s?l:pe(he(l,i),u);e<=n;e=pe(e+i,u))r.push(Object.is(e,-0)?0:e);return r}function Mt(e,t,l,n,i,o,s){const r=[],u=e.scales[e.axes[t].scale].log,a=V((10==u?Q:ee)(l));i=$(u,a),a<0&&(i=pe(i,-a));let c=l;do{r.push(c),c=pe(c+i,me.get(i)),c>=i*u&&(i=c)}while(c<=n);return r}function St(e,t,l,n,i,o,s){let r=e.scales[e.axes[t].scale].asinh,u=n>r?Mt(e,t,Z(r,l),n,i):[r],a=n>=0&&l<=0?[0]:[];return(l<-r?Mt(e,t,Z(r,-n),-l,i):[r]).reverse().map((e=>-e)).concat(a,u)}const zt=/./,Et=/[12357]/,Dt=/[125]/,Tt=/1/;function At(e,t,l,n,i){let o=e.axes[l],s=o.scale,r=e.scales[s];if(3==r.distr&&2==r.log)return t;let u=e.valToPos,a=o._space,c=u(10,s),f=u(9,s)-c>=a?zt:u(7,s)-c>=a?Et:u(5,s)-c>=a?Dt:Tt;return t.map((e=>4==r.distr&&0==e||f.test(e)?e:null))}function Ct(e,t){return null==t?"":G(t)}const Yt={show:!0,scale:"y",stroke:"#000",space:30,gap:5,size:50,labelGap:0,labelSize:30,labelFont:vt,side:3,grid:mt,ticks:gt,border:xt,font:wt,rotate:0};function Pt(e,t){return pe((3+2*(e||1))*t,3)}const Wt={scale:null,auto:!0,sorted:0,min:le,max:-le},Rt={show:!0,auto:!0,sorted:0,alpha:1,facets:[Ee({},Wt,{scale:"x"}),Ee({},Wt,{scale:"y"})]},Ht={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:(e,t,l,n,i)=>i,alpha:1,points:{show:function(e,t){let{scale:l,idxs:n}=e.series[0],i=e._data[0],o=e.valToPos(i[n[0]],l,!0),s=e.valToPos(i[n[1]],l,!0),r=U(s-o)/(e.series[t].points.space*h);return n[1]-n[0]<=r},filter:null},values:null,min:le,max:-le,idxs:[],path:null,clip:null};function Ft(e,t,l,n,i){return l/10}const Nt={time:!0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},It=Ee({},Nt,{time:!1,ori:1}),jt={};function Bt(e,t){let l=jt[e];return l||(l={key:e,plots:[],sub(e){l.plots.push(e)},unsub(e){l.plots=l.plots.filter((t=>t!=e))},pub(e,t,n,i,o,s,r){for(let u=0;u<l.plots.length;u++)l.plots[u]!=t&&l.plots[u].pub(e,t,n,i,o,s,r)}},null!=e&&(jt[e]=l)),l}function Gt(e,t,l){const n=e.series[t],i=e.scales,o=e.bbox,s=2==e.mode?i[n.facets[0].scale]:i[e.series[0].scale];let r=e._data[0],u=e._data[t],a=s,c=2==e.mode?i[n.facets[1].scale]:i[n.scale],f=o.left,h=o.top,d=o.width,p=o.height,m=e.valToPosH,g=e.valToPosV;return 0==a.ori?l(n,r,u,a,c,m,g,f,h,d,p,Zt,Xt,el,ll,il):l(n,r,u,a,c,g,m,h,f,p,d,$t,Qt,tl,nl,ol)}function Lt(e,t){let l=0,n=0,i=I(e.bands,ve);for(let e=0;e<i.length;e++){let o=i[e];o.series[0]==t?l=o.dir:o.series[1]==t&&(1==o.dir?n|=1:n|=2)}return[l,1==n?-1:2==n?1:3==n?2:0]}function Ot(e,t,l,n,i){let o=e.scales[e.series[t].scale];return-1==i?o.min:1==i?o.max:3==o.distr?1==o.dir?o.min:o.max:0}function Ut(e,t,l,n,i,o){return Gt(e,t,((e,t,s,r,u,a,c,f,h,d,p)=>{let m=e.pxRound;const g=r.dir*(0==r.ori?1:-1),x=0==r.ori?Xt:Qt;let w,v;1==g?(w=l,v=n):(w=n,v=l);let b=m(a(t[w],r,d,f)),y=m(c(s[w],u,p,h)),k=m(a(t[v],r,d,f)),_=m(c(1==o?u.max:u.min,u,p,h)),M=new Path2D(i);return x(M,k,_),x(M,b,_),x(M,b,y),M}))}function Vt(e,t,l,n,i,o){let s=null;if(e.length>0){s=new Path2D;const r=0==t?el:tl;let u=l;for(let t=0;t<e.length;t++){let l=e[t];if(l[1]>l[0]){let e=l[0]-u;e>0&&r(s,u,n,e,n+o),u=l[1]}}let a=l+i-u;a>0&&r(s,u,n,a,n+o)}return s}function qt(e,t,l,n,i,o,s){let r=[];for(let u=1==i?l:n;u>=l&&u<=n;u+=i){if(null===t[u]){let a=u,c=u;if(1==i)for(;++u<=n&&null===t[u];)c=u;else for(;--u>=l&&null===t[u];)c=u;let f=o(e[a]),h=c==a?f:o(e[c]);f=s<=0?o(e[a-i]):f,h=s>=0?o(e[c+i]):h,h>=f&&r.push([f,h])}}return r}function Jt(e){return 0==e?re:1==e?q:t=>ie(t,e)}function Kt(e){let t=0==e?Zt:$t,l=0==e?(e,t,l,n,i,o)=>{e.arcTo(t,l,n,i,o)}:(e,t,l,n,i,o)=>{e.arcTo(l,t,i,n,o)},n=0==e?(e,t,l,n,i)=>{e.rect(t,l,n,i)}:(e,t,l,n,i)=>{e.rect(l,t,i,n)};return(e,i,o,s,r,u=0)=>{0==u?n(e,i,o,s,r):(u=K(u,s/2,r/2),t(e,i+u,o),l(e,i+s,o,i+s,o+r,u),l(e,i+s,o+r,i,o+r,u),l(e,i,o+r,i,o,u),l(e,i,o,i+s,o,u),e.closePath())}}const Zt=(e,t,l)=>{e.moveTo(t,l)},$t=(e,t,l)=>{e.moveTo(l,t)},Xt=(e,t,l)=>{e.lineTo(t,l)},Qt=(e,t,l)=>{e.lineTo(l,t)},el=Kt(0),tl=Kt(1),ll=(e,t,l,n,i,o)=>{e.arc(t,l,n,i,o)},nl=(e,t,l,n,i,o)=>{e.arc(l,t,n,i,o)},il=(e,t,l,n,i,o,s)=>{e.bezierCurveTo(t,l,n,i,o,s)},ol=(e,t,l,n,i,o,s)=>{e.bezierCurveTo(l,t,i,n,s,o)};function sl(e){return(e,t,l,n,i)=>Gt(e,t,((t,o,s,r,u,a,c,f,d,p,m)=>{let g,x,{pxRound:w,points:v}=t;0==r.ori?(g=Zt,x=ll):(g=$t,x=nl);const b=pe(v.width*h,3);let y=(v.size-v.width)/2*h,k=pe(2*y,3),_=new Path2D,M=new Path2D,{left:S,top:z,width:E,height:D}=e.bbox;el(M,S-k,z-k,E+2*k,D+2*k);const T=e=>{if(null!=s[e]){let t=w(a(o[e],r,p,f)),l=w(c(s[e],u,m,d));g(_,t+y,l),x(_,t,l,y,0,2*O)}};if(i)i.forEach(T);else for(let e=l;e<=n;e++)T(e);return{stroke:b>0?_:null,fill:_,clip:M,flags:3}}))}function rl(e){return(t,l,n,i,o,s)=>{n!=i&&(o!=n&&s!=n&&e(t,l,n),o!=i&&s!=i&&e(t,l,i),e(t,l,s))}}const ul=rl(Xt),al=rl(Qt);function cl(e){const t=I(e?.alignGaps,0);return(e,l,n,i)=>Gt(e,l,((o,s,r,u,a,c,f,h,d,p,m)=>{let g,x,w=o.pxRound,v=e=>w(c(e,u,p,h)),b=e=>w(f(e,a,m,d));0==u.ori?(g=Xt,x=ul):(g=Qt,x=al);const y=u.dir*(0==u.ori?1:-1),k={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},_=k.stroke;let M,S,z,E=le,D=-le,T=v(s[1==y?n:i]),C=A(r,n,i,1*y),Y=A(r,n,i,-1*y),P=v(s[C]),W=v(s[Y]);for(let e=1==y?n:i;e>=n&&e<=i;e+=y){let t=v(s[e]);t==T?null!=r[e]&&(S=b(r[e]),E==le&&(g(_,t,S),M=S),E=K(S,E),D=Z(S,D)):(E!=le&&(x(_,T,E,D,M,S),z=T),null!=r[e]?(S=b(r[e]),g(_,t,S),E=D=M=S):(E=le,D=-le),T=t)}E!=le&&E!=D&&z!=T&&x(_,T,E,D,M,S);let[R,H]=Lt(e,l);if(null!=o.fill||0!=R){let t=k.fill=new Path2D(_),n=b(o.fillTo(e,l,o.min,o.max,R));g(t,W,n),g(t,P,n)}if(!o.spanGaps){let a=[];a.push(...qt(s,r,n,i,y,v,t)),k.gaps=a=o.gaps(e,l,n,i,a),k.clip=Vt(a,u.ori,h,d,p,m)}return 0!=H&&(k.band=2==H?[Ut(e,l,n,i,_,-1),Ut(e,l,n,i,_,1)]:Ut(e,l,n,i,_,H)),k}))}function fl(e,t,l,n,i,o){const s=e.length;if(s<2)return null;const r=new Path2D;if(l(r,e[0],t[0]),2==s)n(r,e[1],t[1]);else{let l=Array(s),n=Array(s-1),o=Array(s-1),u=Array(s-1);for(let l=0;l<s-1;l++)o[l]=t[l+1]-t[l],u[l]=e[l+1]-e[l],n[l]=o[l]/u[l];l[0]=n[0];for(let e=1;e<s-1;e++)0===n[e]||0===n[e-1]||n[e-1]>0!=n[e]>0?l[e]=0:(l[e]=3*(u[e-1]+u[e])/((2*u[e]+u[e-1])/n[e-1]+(u[e]+2*u[e-1])/n[e]),isFinite(l[e])||(l[e]=0));l[s-1]=n[s-2];for(let n=0;n<s-1;n++)i(r,e[n]+u[n]/3,t[n]+l[n]*u[n]/3,e[n+1]-u[n]/3,t[n+1]-l[n+1]*u[n]/3,e[n+1],t[n+1])}return r}const hl=new Set;function dl(){hl.forEach((e=>{e.syncRect(!0)}))}u&&(E("resize",c,dl),E("scroll",c,dl,!0),E("dppxchange",c,(()=>{Dl.pxRatio=h})));const pl=cl(),ml=sl();function gl(e,t,l,n){return(n?[e[0],e[1]].concat(e.slice(2)):[e[0]].concat(e.slice(1))).map(((e,n)=>xl(e,n,t,l)))}function xl(e,t,l,n){return Ee({},0==t?l:n,e)}function wl(e,t,l){return null==t?be:[t,l]}const vl=wl;function bl(e,t,l){return null==t?be:N(t,l,.1,!0)}function yl(e,t,l,n){return null==t?be:P(t,l,e.scales[n].log,!1)}const kl=yl;function _l(e,t,l,n){return null==t?be:W(t,l,e.scales[n].log,!1)}const Ml=_l;function Sl(e,t,l,n,i){let o=Z(ne(e),ne(t)),s=t-e,r=T(i/n*s,l);do{let e=l[r],t=n*e/s;if(t>=i&&o+(e<5?me.get(e):0)<=17)return[e,t]}while(++r<l.length);return[0,0]}function zl(e){let t,l;return[e=e.replace(/(\d+)px/,((e,n)=>(t=q((l=+n)*h))+"px")),t,l]}function El(e){e.show&&[e.font,e.labelFont].forEach((e=>{let t=pe(e[2]*h,1);e[0]=e[0].replace(/[0-9.]+px/,t+"px"),e[1]=t}))}function Dl(e,t,l){const n={mode:I(e.mode,1)},i=n.mode;function o(e,t){return((3==t.distr?Q(e>0?e:t.clamp(n,e,t.min,t.max,t.key)):4==t.distr?te(e,t.asinh):e)-t._min)/(t._max-t._min)}function s(e,t,l,n){let i=o(e,t);return n+l*(-1==t.dir?1-i:i)}function u(e,t,l,n){let i=o(e,t);return n+l*(-1==t.dir?i:1-i)}function f(e,t,l,n){return 0==t.ori?s(e,t,l,n):u(e,t,l,n)}n.valToPosH=s,n.valToPosV=u;let d=!1;n.status=0;const v=n.root=w("uplot");if(null!=e.id&&(v.id=e.id),p(v,e.class),e.title){w("u-title",v).textContent=e.title}const y=x("canvas"),_=n.ctx=y.getContext("2d"),S=w("u-wrap",v),z=n.under=w("u-under",S);S.appendChild(y);const A=n.over=w("u-over",S),C=+I((e=ze(e)).pxAlign,1),Y=Jt(C);(e.plugins||[]).forEach((t=>{t.opts&&(e=t.opts(n,e)||e)}));const H=e.ms||.001,F=n.series=1==i?gl(e.series||[],yt,Ht,!1):(j=e.series||[null],B=Rt,j.map(((e,t)=>0==t?null:Ee({},B,e))));var j,B;const G=n.axes=gl(e.axes||[],bt,Yt,!0),V=n.scales={},X=n.bands=e.bands||[];X.forEach((e=>{e.fill=se(e.fill||null),e.dir=I(e.dir,-1)}));const ee=2==i?F[1].facets[0].scale:F[0].scale,ne={axes:function(){for(let e=0;e<G.length;e++){let t=G[e];if(!t.show||!t._show)continue;let l,i,o=t.side,s=o%2,r=t.stroke(n,e),u=0==o||3==o?-1:1;if(t.label){let e=t.labelGap*u,n=q((t._lpos+e)*h);Hl(t.labelFont[0],r,"center",2==o?"top":"bottom"),_.save(),1==s?(l=i=0,_.translate(n,q(vt+Et/2)),_.rotate((3==o?-O:O)/2)):(l=q(wt+zt/2),i=n),_.fillText(t.label,l,i),_.restore()}let[a,c]=t._found;if(0==c)continue;let d=V[t.scale],p=0==s?zt:Et,m=0==s?wt:vt,g=q(t.gap*h),x=t._splits,w=2==d.distr?x.map((e=>Cl[e])):x,v=2==d.distr?Cl[x[1]]-Cl[x[0]]:a,b=t.ticks,y=t.border,k=b.show?q(b.size*h):0,M=t._rotate*-O/180,S=Y(t._pos*h),z=S+(k+g)*u;i=0==s?z:0,l=1==s?z:0;let E=t.font[0],D=1==t.align?"left":2==t.align?"right":M>0?"left":M<0?"right":0==s?"center":3==o?"right":"left";Hl(E,r,D,M||1==s?"middle":2==o?"top":"bottom");let T=1.5*t.font[1],A=x.map((e=>Y(f(e,d,p,m)))),C=t._values;for(let e=0;e<C.length;e++){let t=C[e];if(null!=t){0==s?l=A[e]:i=A[e],t=""+t;let n=-1==t.indexOf("\n")?[t]:t.split(/\n/gm);for(let e=0;e<n.length;e++){let t=n[e];M?(_.save(),_.translate(l,i+e*T),_.rotate(M),_.fillText(t,0,0),_.restore()):_.fillText(t,l,i+e*T)}}}b.show&&Ll(A,b.filter(n,w,e,c,v),s,o,S,k,pe(b.width*h,3),b.stroke(n,e),b.dash,b.cap);let P=t.grid;P.show&&Ll(A,P.filter(n,w,e,c,v),s,0==s?2:1,0==s?vt:wt,0==s?Et:zt,pe(P.width*h,3),P.stroke(n,e),P.dash,P.cap),y.show&&Ll([S],[1],0==s?1:0,0==s?1:2,1==s?vt:wt,1==s?Et:zt,pe(y.width*h,3),y.stroke(n,e),y.dash,y.cap)}Ln("drawAxes")},series:function(){ll>0&&(F.forEach(((e,l)=>{if(l>0&&e.show&&null==e._paths){let i=function(e){let t=oe(nl-1,0,ll-1),l=oe(il+1,0,ll-1);for(;null==e[t]&&t>0;)t--;for(;null==e[l]&&l<ll-1;)l++;return[t,l]}(t[l]);e._paths=e.paths(n,l,i[0],i[1])}})),F.forEach(((e,t)=>{if(t>0&&e.show){Al!=e.alpha&&(_.globalAlpha=Al=e.alpha),Nl(t,!1),e._paths&&Il(t,!1);{Nl(t,!0);let l=e.points.show(n,t,nl,il),i=e.points.filter(n,t,l,e._paths?e._paths.gaps:null);(l||i)&&(e.points._paths=e.points.paths(n,t,nl,il,i),Il(t,!0))}1!=Al&&(_.globalAlpha=Al=1),Ln("drawSeries",t)}})))}},re=(e.drawOrder||["axes","series"]).map((e=>ne[e]));function de(t){let l=V[t];if(null==l){let n=(e.scales||we)[t]||we;if(null!=n.from)de(n.from),V[t]=Ee({},V[n.from],n,{key:t});else{l=V[t]=Ee({},t==ee?Nt:It,n),l.key=t;let e=l.time,o=l.range,s=ye(o);if((t!=ee||2==i&&!e)&&(!s||null!=o[0]&&null!=o[1]||(o={min:null==o[0]?R:{mode:1,hard:o[0],soft:o[0]},max:null==o[1]?R:{mode:1,hard:o[1],soft:o[1]}},s=!1),!s&&_e(o))){let e=o;o=(t,l,n)=>null==l?be:N(l,n,e)}l.range=se(o||(e?vl:t==ee?3==l.distr?kl:4==l.distr?Ml:wl:3==l.distr?yl:4==l.distr?_l:bl)),l.auto=se(!s&&l.auto),l.clamp=se(l.clamp||Ft),l._min=l._max=null}}}de("x"),de("y"),1==i&&F.forEach((e=>{de(e.scale)})),G.forEach((e=>{de(e.scale)}));for(let t in e.scales)de(t);const me=V[ee],ge=me.distr;let xe,Se;0==me.ori?(p(v,"u-hz"),xe=s,Se=u):(p(v,"u-vt"),xe=u,Se=s);const De={};for(let e in V){let t=V[e];null==t.min&&null==t.max||(De[e]={min:t.min,max:t.max},t.min=t.max=null)}const Ae=e.tzDate||(e=>new Date(q(e/H))),Ce=e.fmtDate||Ne,Ye=1==H?et(Ae):nt(Ae),Pe=ot(Ae,it(1==H?Qe:lt,Ce)),We=ut(Ae,rt("{YYYY}-{MM}-{DD} {h}:{mm}{aa}",Ce)),Re=[],He=n.legend=Ee({},at,e.legend),Fe=He.show,Ie=He.markers;let je;He.idxs=Re,Ie.width=se(Ie.width),Ie.dash=se(Ie.dash),Ie.stroke=se(Ie.stroke),Ie.fill=se(Ie.fill);let Be,Ge=[],Le=[],Ve=!1,qe={};if(He.live){const e=F[1]?F[1].values:null;Ve=null!=e,Be=Ve?e(n,1,0):{_:0};for(let e in Be)qe[e]="--"}if(Fe)if(je=x("table","u-legend",v),Ve){let e=x("tr","u-thead",je);for(var Je in x("th",null,e),Be)x("th","u-label",e).textContent=Je}else p(je,"u-inline"),He.live&&p(je,"u-live");const Ke={show:!0},Ze={show:!1};const $e=new Map;function st(e,t,l){const i=$e.get(t)||{},o=Vt.bind[e](n,t,l);o&&(E(e,t,i[e]=o),$e.set(t,i))}function ct(e,t,l){const n=$e.get(t)||{};for(let l in n)null!=e&&l!=e||(D(l,t,n[l]),delete n[l]);null==e&&$e.delete(t)}let ft=0,ht=0,pt=0,mt=0,gt=0,xt=0,wt=0,vt=0,zt=0,Et=0;n.bbox={};let Dt=!1,Tt=!1,Wt=!1,jt=!1,Gt=!1;function Lt(e,t,l){(l||e!=n.width||t!=n.height)&&Ut(e,t),Vl(!1),Wt=!0,Tt=!0,jt=Gt=Vt.left>=0,rn()}function Ut(e,t){n.width=ft=pt=e,n.height=ht=mt=t,gt=xt=0,function(){let e=!1,t=!1,l=!1,n=!1;G.forEach(((i,o)=>{if(i.show&&i._show){let{side:o,_size:s}=i,r=o%2,u=s+(null!=i.label?i.labelSize:0);u>0&&(r?(pt-=u,3==o?(gt+=u,n=!0):l=!0):(mt-=u,0==o?(xt+=u,e=!0):t=!0))}})),Xt[0]=e,Xt[1]=l,Xt[2]=t,Xt[3]=n,pt-=tl[1]+tl[3],gt+=tl[3],mt-=tl[2]+tl[0],xt+=tl[0]}(),function(){let e=gt+pt,t=xt+mt,l=gt,n=xt;function i(i,o){switch(i){case 1:return e+=o,e-o;case 2:return t+=o,t-o;case 3:return l-=o,l+o;case 0:return n-=o,n+o}}G.forEach(((e,t)=>{if(e.show&&e._show){let t=e.side;e._pos=i(t,e._size),null!=e.label&&(e._lpos=i(t,e.labelSize))}}))}();let l=n.bbox;wt=l.left=ie(gt*h,.5),vt=l.top=ie(xt*h,.5),zt=l.width=ie(pt*h,.5),Et=l.height=ie(mt*h,.5)}n.setSize=function({width:e,height:t}){Lt(e,t)};const Vt=n.cursor=Ee({},dt,{drag:{y:2==i}},e.cursor);{Vt.idxs=Re,Vt._lock=!1;let e=Vt.points;e.show=se(e.show),e.size=se(e.size),e.stroke=se(e.stroke),e.width=se(e.width),e.fill=se(e.fill)}const qt=n.focus=Ee({},e.focus||{alpha:.3},Vt.focus),Kt=qt.prox>=0;let Zt=[null];function $t(e,t){if(1==i||t>0){let t=1==i&&V[e.scale].time,l=e.value;e.value=t?ke(l)?ut(Ae,rt(l,Ce)):l||We:l||Ct,e.label=e.label||(t?"Time":"Value")}if(t>0){e.width=null==e.width?1:e.width,e.paths=e.paths||pl||ae,e.fillTo=se(e.fillTo||Ot),e.pxAlign=+I(e.pxAlign,C),e.pxRound=Jt(e.pxAlign),e.stroke=se(e.stroke||null),e.fill=se(e.fill||null),e._stroke=e._fill=e._paths=e._focus=null;let t=Pt(e.width,1),l=e.points=Ee({},{size:t,width:Z(1,.2*t),stroke:e.stroke,space:2*t,paths:ml,_stroke:null,_fill:null},e.points);l.show=se(l.show),l.filter=se(l.filter),l.fill=se(l.fill),l.stroke=se(l.stroke),l.paths=se(l.paths),l.pxAlign=e.pxAlign}if(Fe){let l=function(e,t){if(0==t&&(Ve||!He.live||2==i))return be;let l=[],o=x("tr","u-series",je,je.childNodes[t]);p(o,e.class),e.show||p(o,r);let s=x("th",null,o);if(Ie.show){let e=w("u-marker",s);if(t>0){let l=Ie.width(n,t);l&&(e.style.border=l+"px "+Ie.dash(n,t)+" "+Ie.stroke(n,t)),e.style.background=Ie.fill(n,t)}}let u=w("u-label",s);for(var a in u.textContent=e.label,t>0&&(Ie.show||(u.style.color=e.width>0?Ie.stroke(n,t):Ie.fill(n,t)),st("click",s,(t=>{if(Vt._lock)return;let l=F.indexOf(e);if((t.ctrlKey||t.metaKey)!=He.isolate){let e=F.some(((e,t)=>t>0&&t!=l&&e.show));F.forEach(((t,n)=>{n>0&&wn(n,e?n==l?Ke:Ze:Ke,!0,On.setSeries)}))}else wn(l,{show:!e.show},!0,On.setSeries)})),Kt&&st("mouseenter",s,(t=>{Vt._lock||wn(F.indexOf(e),kn,!0,On.setSeries)}))),Be){let e=x("td","u-value",o);e.textContent="--",l.push(e)}return[o,l]}(e,t);Ge.splice(t,0,l[0]),Le.splice(t,0,l[1]),He.values.push(null)}if(Vt.show){Re.splice(t,0,null);let l=function(e,t){if(t>0){let l=Vt.points.show(n,t);if(l)return p(l,"u-cursor-pt"),p(l,e.class),b(l,-10,-10,pt,mt),A.insertBefore(l,Zt[t]),l}}(e,t);l&&Zt.splice(t,0,l)}Ln("addSeries",t)}n.addSeries=function(e,t){e=xl(e,t=null==t?F.length:t,yt,Ht),F.splice(t,0,e),$t(F[t],t)},n.delSeries=function(e){if(F.splice(e,1),Fe){He.values.splice(e,1),Le.splice(e,1);let t=Ge.splice(e,1)[0];ct(null,t.firstChild),t.remove()}Vt.show&&(Re.splice(e,1),Zt.length>1&&Zt.splice(e,1)[0].remove()),Ln("delSeries",e)};const Xt=[!1,!1,!1,!1];function Qt(e,t,l,n){let[i,o,s,r]=l,u=t%2,a=0;return 0==u&&(r||o)&&(a=0==t&&!i||2==t&&!s?q(bt.size/3):0),1==u&&(i||s)&&(a=1==t&&!o||3==t&&!r?q(Yt.size/2):0),a}const el=n.padding=(e.padding||[Qt,Qt,Qt,Qt]).map((e=>se(I(e,Qt)))),tl=n._padding=el.map(((e,t)=>e(n,t,Xt,0)));let ll,nl=null,il=null;const ol=1==i?F[0].idxs:null;let sl,rl,ul,al,cl,fl,dl,Dl,Tl,Al,Cl=null,Yl=!1;function Pl(e,l){if(t=null==e?[]:ze(e,Me),2==i){ll=0;for(let e=1;e<F.length;e++)ll+=t[e][0].length;n.data=t=e}else if(null==t[0]&&(t[0]=[]),n.data=t.slice(),Cl=t[0],ll=Cl.length,2==ge){t[0]=Array(ll);for(let e=0;e<ll;e++)t[0][e]=e}if(n._data=t,Vl(!0),Ln("setData"),2==ge&&(Wt=!0),!1!==l){let e=me;e.auto(n,Yl)?Wl():xn(ee,e.min,e.max),jt=Vt.left>=0,Gt=!0,rn()}}function Wl(){let e,l;Yl=!0,1==i&&(ll>0?(nl=ol[0]=0,il=ol[1]=ll-1,e=t[0][nl],l=t[0][il],2==ge?(e=nl,l=il):1==ll&&(3==ge?[e,l]=P(e,e,me.log,!1):4==ge?[e,l]=W(e,e,me.log,!1):me.time?l=e+q(86400/H):[e,l]=N(e,l,.1,!0))):(nl=ol[0]=e=null,il=ol[1]=l=null)),xn(ee,e,l)}function Rl(e="#0000",t,l=ve,n="butt",i="#0000",o="round"){e!=sl&&(_.strokeStyle=sl=e),i!=rl&&(_.fillStyle=rl=i),t!=ul&&(_.lineWidth=ul=t),o!=cl&&(_.lineJoin=cl=o),n!=fl&&(_.lineCap=fl=n),l!=al&&_.setLineDash(al=l)}function Hl(e,t,l,n){t!=rl&&(_.fillStyle=rl=t),e!=dl&&(_.font=dl=e),l!=Dl&&(_.textAlign=Dl=l),n!=Tl&&(_.textBaseline=Tl=n)}function Fl(e,t,l,i,o=0){if(i.length>0&&e.auto(n,Yl)&&(null==t||null==t.min)){let t=I(nl,0),n=I(il,i.length-1),s=null==l.min?3==e.distr?function(e,t,l){let n=le,i=-le;for(let o=t;o<=l;o++)e[o]>0&&(n=K(n,e[o]),i=Z(i,e[o]));return[n==le?1:n,i==-le?10:i]}(i,t,n):function(e,t,l,n){let i=le,o=-le;if(1==n)i=e[t],o=e[l];else if(-1==n)i=e[l],o=e[t];else for(let n=t;n<=l;n++)null!=e[n]&&(i=K(i,e[n]),o=Z(o,e[n]));return[i,o]}(i,t,n,o):[l.min,l.max];e.min=K(e.min,l.min=s[0]),e.max=Z(e.max,l.max=s[1])}}function Nl(e,t){let l=t?F[e].points:F[e];l._stroke=l.stroke(n,e),l._fill=l.fill(n,e)}function Il(e,l){let i=l?F[e].points:F[e],o=i._stroke,s=i._fill,{stroke:r,fill:u,clip:a,flags:c}=i._paths,f=null,d=pe(i.width*h,3),p=d%2/2;l&&null==s&&(s=d>0?"#fff":o);let m=1==i.pxAlign;if(m&&_.translate(p,p),!l){let e=wt,t=vt,l=zt,n=Et,o=d*h/2;0==i.min&&(n+=o),0==i.max&&(t-=o,n+=o),f=new Path2D,f.rect(e,t,l,n)}l?jl(o,d,i.dash,i.cap,s,r,u,c,a):function(e,l,i,o,s,r,u,a,c,f,h){let d=!1;X.forEach(((p,m)=>{if(p.series[0]==e){let e,g=F[p.series[1]],x=t[p.series[1]],w=(g._paths||we).band;ye(w)&&(w=1==p.dir?w[0]:w[1]);let v=null;g.show&&w&&function(e,t,l){for(t=I(t,0),l=I(l,e.length-1);t<=l;){if(null!=e[t])return!0;t++}return!1}(x,nl,il)?(v=p.fill(n,m)||r,e=g._paths.clip):w=null,jl(l,i,o,s,v,u,a,c,f,h,e,w),d=!0}})),d||jl(l,i,o,s,r,u,a,c,f,h)}(e,o,d,i.dash,i.cap,s,r,u,c,f,a),m&&_.translate(-p,-p)}n.setData=Pl;function jl(e,t,l,n,i,o,s,r,u,a,c,f){Rl(e,t,l,n,i),(u||a||f)&&(_.save(),u&&_.clip(u),a&&_.clip(a)),f?3==(3&r)?(_.clip(f),c&&_.clip(c),Gl(i,s),Bl(e,o,t)):2&r?(Gl(i,s),_.clip(f),Bl(e,o,t)):1&r&&(_.save(),_.clip(f),c&&_.clip(c),Gl(i,s),_.restore(),Bl(e,o,t)):(Gl(i,s),Bl(e,o,t)),(u||a||f)&&_.restore()}function Bl(e,t,l){l>0&&(t instanceof Map?t.forEach(((e,t)=>{_.strokeStyle=sl=t,_.stroke(e)})):null!=t&&e&&_.stroke(t))}function Gl(e,t){t instanceof Map?t.forEach(((e,t)=>{_.fillStyle=rl=t,_.fill(e)})):null!=t&&e&&_.fill(t)}function Ll(e,t,l,n,i,o,s,r,u,a){let c=s%2/2;1==C&&_.translate(c,c),Rl(r,s,u,a,r),_.beginPath();let f,h,d,p,m=i+(0==n||3==n?-o:o);0==l?(h=i,p=m):(f=i,d=m);for(let n=0;n<e.length;n++)null!=t[n]&&(0==l?f=d=e[n]:h=p=e[n],_.moveTo(f,h),_.lineTo(d,p));_.stroke(),1==C&&_.translate(-c,-c)}function Ol(e){let t=!0;return G.forEach(((l,i)=>{if(!l.show)return;let o=V[l.scale];if(null==o.min)return void(l._show&&(t=!1,l._show=!1,Vl(!1)));l._show||(t=!1,l._show=!0,Vl(!1));let s=l.side,r=s%2,{min:u,max:a}=o,[c,f]=function(e,t,l,i){let o,s=G[e];if(i<=0)o=[0,0];else{let r=s._space=s.space(n,e,t,l,i);o=Sl(t,l,s._incrs=s.incrs(n,e,t,l,i,r),i,r)}return s._found=o}(i,u,a,0==r?pt:mt);if(0==f)return;let h=2==o.distr,d=l._splits=l.splits(n,i,u,a,c,f,h),p=2==o.distr?d.map((e=>Cl[e])):d,m=2==o.distr?Cl[d[1]]-Cl[d[0]]:c,g=l._values=l.values(n,l.filter(n,p,i,f,m),i,f,m);l._rotate=2==s?l.rotate(n,g,i,f):0;let x=l._size;l._size=J(l.size(n,g,i,e)),null!=x&&l._size!=x&&(t=!1)})),t}function Ul(e){let t=!0;return el.forEach(((l,i)=>{let o=l(n,i,Xt,e);o!=tl[i]&&(t=!1),tl[i]=o})),t}function Vl(e){F.forEach(((t,l)=>{l>0&&(t._paths=null,e&&(1==i?(t.min=null,t.max=null):t.facets.forEach((e=>{e.min=null,e.max=null}))))}))}let ql,Jl,Kl,Zl,$l,Xl,Ql,en,tn,ln,nn,on,sn=!1;function rn(){sn||(Te(un),sn=!0)}function un(){Dt&&(!function(){let e=ze(V,Me);for(let t in e){let l=e[t],o=De[t];if(null!=o&&null!=o.min)Ee(l,o),t==ee&&Vl(!0);else if(t!=ee||2==i)if(0==ll&&null==l.from){let e=l.range(n,null,null,t);l.min=e[0],l.max=e[1]}else l.min=le,l.max=-le}if(ll>0){F.forEach(((l,o)=>{if(1==i){let i=l.scale,s=e[i],r=De[i];if(0==o){let e=s.range(n,s.min,s.max,i);s.min=e[0],s.max=e[1],nl=T(s.min,t[0]),il=T(s.max,t[0]),t[0][nl]<s.min&&nl++,t[0][il]>s.max&&il--,l.min=Cl[nl],l.max=Cl[il]}else l.show&&l.auto&&Fl(s,r,l,t[o],l.sorted);l.idxs[0]=nl,l.idxs[1]=il}else if(o>0&&l.show&&l.auto){let[n,i]=l.facets,s=n.scale,r=i.scale,[u,a]=t[o];Fl(e[s],De[s],n,u,n.sorted),Fl(e[r],De[r],i,a,i.sorted),l.min=i.min,l.max=i.max}}));for(let t in e){let l=e[t],i=De[t];if(null==l.from&&(null==i||null==i.min)){let e=l.range(n,l.min==le?null:l.min,l.max==-le?null:l.max,t);l.min=e[0],l.max=e[1]}}}for(let t in e){let l=e[t];if(null!=l.from){let i=e[l.from];if(null==i.min)l.min=l.max=null;else{let e=l.range(n,i.min,i.max,t);l.min=e[0],l.max=e[1]}}}let l={},o=!1;for(let t in e){let n=e[t],i=V[t];if(i.min!=n.min||i.max!=n.max){i.min=n.min,i.max=n.max;let e=i.distr;i._min=3==e?Q(i.min):4==e?te(i.min,i.asinh):i.min,i._max=3==e?Q(i.max):4==e?te(i.max,i.asinh):i.max,l[t]=o=!0}}if(o){F.forEach(((e,t)=>{2==i?t>0&&l.y&&(e._paths=null):l[e.scale]&&(e._paths=null)}));for(let e in l)Wt=!0,Ln("setScale",e);Vt.show&&(jt=Gt=Vt.left>=0)}for(let e in De)De[e]=null}(),Dt=!1),Wt&&(!function(){let e=!1,t=0;for(;!e;){t++;let l=Ol(t),i=Ul(t);e=3==t||l&&i,e||(Ut(n.width,n.height),Tt=!0)}}(),Wt=!1),Tt&&(g(z,"left",gt),g(z,"top",xt),g(z,"width",pt),g(z,"height",mt),g(A,"left",gt),g(A,"top",xt),g(A,"width",pt),g(A,"height",mt),g(S,"width",ft),g(S,"height",ht),y.width=q(ft*h),y.height=q(ht*h),G.forEach((({_el:e,_show:t,_size:l,_pos:n,side:i})=>{if(null!=e)if(t){let t=i%2==1;g(e,t?"left":"top",n-(3===i||0===i?l:0)),g(e,t?"width":"height",l),g(e,t?"top":"left",t?xt:gt),g(e,t?"height":"width",t?mt:pt),m(e,r)}else p(e,r)})),sl=rl=ul=cl=fl=dl=Dl=Tl=al=null,Al=1,Yn(!0),Ln("setSize"),Tt=!1),ft>0&&ht>0&&(_.clearRect(0,0,y.width,y.height),Ln("drawClear"),re.forEach((e=>e())),Ln("draw")),Vt.show&&jt&&(An(null,!0,!1),jt=!1),d||(d=!0,n.status=1,Ln("ready")),Yl=!1,sn=!1}function an(e,l){let i=V[e];if(null==i.from){if(0==ll){let t=i.range(n,l.min,l.max,e);l.min=t[0],l.max=t[1]}if(l.min>l.max){let e=l.min;l.min=l.max,l.max=e}if(ll>1&&null!=l.min&&null!=l.max&&l.max-l.min<1e-16)return;e==ee&&2==i.distr&&ll>0&&(l.min=T(l.min,t[0]),l.max=T(l.max,t[0]),l.min==l.max&&l.max++),De[e]=l,Dt=!0,rn()}}n.redraw=(e,t)=>{Wt=t||!1,!1!==e?xn(ee,me.min,me.max):rn()},n.setScale=an;let cn=!1;const fn=Vt.drag;let hn=fn.x,dn=fn.y;Vt.show&&(Vt.x&&(ql=w("u-cursor-x",A)),Vt.y&&(Jl=w("u-cursor-y",A)),0==me.ori?(Kl=ql,Zl=Jl):(Kl=Jl,Zl=ql),nn=Vt.left,on=Vt.top);const pn=n.select=Ee({show:!0,over:!0,left:0,width:0,top:0,height:0},e.select),mn=pn.show?w("u-select",pn.over?A:z):null;function gn(e,t){if(pn.show){for(let t in e)g(mn,t,pn[t]=e[t]);!1!==t&&Ln("setSelect")}}function xn(e,t,l){an(e,{min:t,max:l})}function wn(e,t,l,o){null!=t.focus&&function(e){if(e!=yn){let t=null==e,l=1!=qt.alpha;F.forEach(((n,i)=>{let o=t||0==i||i==e;n._focus=t?null:o,l&&function(e,t){F[e].alpha=t,Vt.show&&Zt[e]&&(Zt[e].style.opacity=t);Fe&&Ge[e]&&(Ge[e].style.opacity=t)}(i,o?1:qt.alpha)})),yn=e,l&&rn()}}(e),null!=t.show&&F.forEach(((l,n)=>{n>0&&(e==n||null==e)&&(l.show=t.show,function(e,t){let l=F[e],n=Fe?Ge[e]:null;l.show?n&&m(n,r):(n&&p(n,r),Zt.length>1&&b(Zt[e],-10,-10,pt,mt))}(n,t.show),xn(2==i?l.facets[1].scale:l.scale,null,null),rn())})),!1!==l&&Ln("setSeries",e,t),o&&qn("setSeries",n,e,t)}let vn,bn,yn;n.setSelect=gn,n.setSeries=wn,n.addBand=function(e,t){e.fill=se(e.fill||null),e.dir=I(e.dir,-1),t=null==t?X.length:t,X.splice(t,0,e)},n.setBand=function(e,t){Ee(X[e],t)},n.delBand=function(e){null==e?X.length=0:X.splice(e,1)};const kn={focus:!0};function _n(e,t,l){let n=V[t];l&&(e=e/h-(1==n.ori?xt:gt));let i=pt;1==n.ori&&(i=mt,e=i-e),-1==n.dir&&(e=i-e);let o=n._min,s=o+(n._max-o)*(e/i),r=n.distr;return 3==r?$(10,s):4==r?((e,t=1)=>L.sinh(e)*t)(s,n.asinh):s}function Mn(e,t){g(mn,"left",pn.left=e),g(mn,"width",pn.width=t)}function Sn(e,t){g(mn,"top",pn.top=e),g(mn,"height",pn.height=t)}Fe&&Kt&&E("mouseleave",je,(e=>{Vt._lock||null!=yn&&wn(null,kn,!0,On.setSeries)})),n.valToIdx=e=>T(e,t[0]),n.posToIdx=function(e,l){return T(_n(e,ee,l),t[0],nl,il)},n.posToVal=_n,n.valToPos=(e,t,l)=>0==V[t].ori?s(e,V[t],l?zt:pt,l?wt:0):u(e,V[t],l?Et:mt,l?vt:0),n.batch=function(e){e(n),rn()},n.setCursor=(e,t,l)=>{nn=e.left,on=e.top,An(null,t,l)};let zn=0==me.ori?Mn:Sn,En=1==me.ori?Mn:Sn;function Dn(e,t){if(null!=e){let t=e.idx;He.idx=t,F.forEach(((e,l)=>{(l>0||!Ve)&&Tn(l,t)}))}Fe&&He.live&&function(){if(Fe&&He.live)for(let e=2==i?1:0;e<F.length;e++){if(0==e&&Ve)continue;let t=He.values[e],l=0;for(let n in t)Le[e][l++].firstChild.nodeValue=t[n]}}(),Gt=!1,!1!==t&&Ln("setLegend")}function Tn(e,l){let i;if(null==l)i=qe;else{let o=F[e],s=0==e&&2==ge?Cl:t[e];i=Ve?o.values(n,e,l):{_:o.value(n,s[l],e,l)}}He.values[e]=i}function An(e,l,o){let s;tn=nn,ln=on,[nn,on]=Vt.move(n,nn,on),Vt.show&&(Kl&&b(Kl,q(nn),0,pt,mt),Zl&&b(Zl,0,q(on),pt,mt));let r=nl>il;vn=le;let u=0==me.ori?pt:mt,a=1==me.ori?pt:mt;if(nn<0||0==ll||r){s=null;for(let e=0;e<F.length;e++)e>0&&Zt.length>1&&b(Zt[e],-10,-10,pt,mt);if(Kt&&wn(null,kn,!0,null==e&&On.setSeries),He.live){Re.fill(null),Gt=!0;for(let e=0;e<F.length;e++)He.values[e]=qe}}else{let e,l,o;1==i&&(e=0==me.ori?nn:on,l=_n(e,ee),s=T(l,t[0],nl,il),o=he(xe(t[0][s],me,u,0),.5));for(let e=2==i?1:0;e<F.length;e++){let r=F[e],c=Re[e],f=1==i?t[e][c]:t[e][1][c],h=Vt.dataIdx(n,e,s,l),d=1==i?t[e][h]:t[e][1][h];Gt=Gt||d!=f||h!=c,Re[e]=h;let p=h==s?o:he(xe(1==i?t[0][h]:t[e][0][h],me,u,0),.5);if(e>0&&r.show){let t,l,o=null==d?-10:he(Se(d,1==i?V[r.scale]:V[r.facets[1].scale],a,0),.5);if(o>0&&1==i){let t=U(o-on);t<=vn&&(vn=t,bn=e)}if(0==me.ori?(t=p,l=o):(t=o,l=p),Gt&&Zt.length>1){k(Zt[e],Vt.points.fill(n,e),Vt.points.stroke(n,e));let i,o,s,r,u=!0,a=Vt.points.bbox;if(null!=a){u=!1;let t=a(n,e);s=t.left,r=t.top,i=t.width,o=t.height}else s=t,r=l,i=o=Vt.points.size(n,e);M(Zt[e],i,o,u),b(Zt[e],s,r,pt,mt)}}if(He.live){if(!Gt||0==e&&Ve)continue;Tn(e,h)}}}if(Vt.idx=s,Vt.left=nn,Vt.top=on,Gt&&(He.idx=s,Dn()),pn.show&&cn)if(null!=e){let[t,l]=On.scales,[n,i]=On.match,[o,s]=e.cursor.sync.scales,r=e.cursor.drag;if(hn=r._x,dn=r._y,hn||dn){let r,c,f,h,d,{left:p,top:m,width:g,height:x}=e.select,w=e.scales[t].ori,v=e.posToVal,b=null!=t&&n(t,o),y=null!=l&&i(l,s);b&&hn?(0==w?(r=p,c=g):(r=m,c=x),f=V[t],h=xe(v(r,o),f,u,0),d=xe(v(r+c,o),f,u,0),zn(K(h,d),U(d-h))):zn(0,u),y&&dn?(1==w?(r=p,c=g):(r=m,c=x),f=V[l],h=Se(v(r,s),f,a,0),d=Se(v(r+c,s),f,a,0),En(K(h,d),U(d-h))):En(0,a)}else Hn()}else{let e=U(tn-$l),t=U(ln-Xl);if(1==me.ori){let l=e;e=t,t=l}hn=fn.x&&e>=fn.dist,dn=fn.y&&t>=fn.dist;let l,n,i=fn.uni;null!=i?hn&&dn&&(hn=e>=i,dn=t>=i,hn||dn||(t>e?dn=!0:hn=!0)):fn.x&&fn.y&&(hn||dn)&&(hn=dn=!0),hn&&(0==me.ori?(l=Ql,n=nn):(l=en,n=on),zn(K(l,n),U(n-l)),dn||En(0,a)),dn&&(1==me.ori?(l=Ql,n=nn):(l=en,n=on),En(K(l,n),U(n-l)),hn||zn(0,u)),hn||dn||(zn(0,0),En(0,0))}if(fn._x=hn,fn._y=dn,null==e){if(o){if(null!=Un){let[e,t]=On.scales;On.values[0]=null!=e?_n(0==me.ori?nn:on,e):null,On.values[1]=null!=t?_n(1==me.ori?nn:on,t):null}qn("mousemove",n,nn,on,pt,mt,s)}if(Kt){let e=o&&On.setSeries,t=qt.prox;null==yn?vn<=t&&wn(bn,kn,!0,e):vn>t?wn(null,kn,!0,e):bn!=yn&&wn(bn,kn,!0,e)}}d&&!1!==l&&Ln("setCursor")}n.setLegend=Dn;let Cn=null;function Yn(e){!0===e?Cn=null:(Cn=A.getBoundingClientRect(),Ln("syncRect",Cn))}function Pn(e,t,l,n,i,o,s){Vt._lock||(Wn(e,t,l,n,i,o,s,!1,null!=e),null!=e?An(null,!0,!0):An(t,!0,!1))}function Wn(e,t,l,i,o,s,r,u,a){if(null==Cn&&Yn(!1),null!=e)l=e.clientX-Cn.left,i=e.clientY-Cn.top;else{if(l<0||i<0)return nn=-10,void(on=-10);let[e,n]=On.scales,r=t.cursor.sync,[u,a]=r.values,[c,h]=r.scales,[d,p]=On.match,m=t.axes[0].side%2==1,g=0==me.ori?pt:mt,x=1==me.ori?pt:mt,w=m?s:o,v=m?o:s,b=m?i:l,y=m?l:i;if(l=null!=c?d(e,c)?f(u,V[e],g,0):-10:g*(b/w),i=null!=h?p(n,h)?f(a,V[n],x,0):-10:x*(y/v),1==me.ori){let e=l;l=i,i=e}}a&&((l<=1||l>=pt-1)&&(l=ie(l,pt)),(i<=1||i>=mt-1)&&(i=ie(i,mt))),u?($l=l,Xl=i,[Ql,en]=Vt.move(n,l,i)):(nn=l,on=i)}const Rn={width:0,height:0};function Hn(){gn(Rn,!1)}function Fn(e,t,l,i,o,s,r){cn=!0,hn=dn=fn._x=fn._y=!1,Wn(e,t,l,i,o,s,0,!0,!1),null!=e&&(st("mouseup",a,Nn),qn("mousedown",n,Ql,en,pt,mt,null))}function Nn(e,t,l,i,o,s,r){cn=fn._x=fn._y=!1,Wn(e,t,l,i,o,s,0,!1,!0);let{left:u,top:c,width:f,height:h}=pn,d=f>0||h>0;if(d&&gn(pn),fn.setScale&&d){let e=u,t=f,l=c,n=h;if(1==me.ori&&(e=c,t=h,l=u,n=f),hn&&xn(ee,_n(e,ee),_n(e+t,ee)),dn)for(let e in V){let t=V[e];e!=ee&&null==t.from&&t.min!=le&&xn(e,_n(l+n,e),_n(l,e))}Hn()}else Vt.lock&&(Vt._lock=!Vt._lock,Vt._lock||An(null,!0,!1));null!=e&&(ct("mouseup",a),qn("mouseup",n,nn,on,pt,mt,null))}function In(e,t,l,i,o,s,r){Wl(),Hn(),null!=e&&qn("dblclick",n,nn,on,pt,mt,null)}function jn(){G.forEach(El),Lt(n.width,n.height,!0)}E("dppxchange",c,jn);const Bn={};Bn.mousedown=Fn,Bn.mousemove=Pn,Bn.mouseup=Nn,Bn.dblclick=In,Bn.setSeries=(e,t,l,n)=>{wn(l,n,!0,!1)},Vt.show&&(st("mousedown",A,Fn),st("mousemove",A,Pn),st("mouseenter",A,Yn),st("mouseleave",A,(function(e,t,l,n,i,o,s){if(!Vt._lock){let e=cn;if(cn){let e,t,l=!0,n=!0,i=10;0==me.ori?(e=hn,t=dn):(e=dn,t=hn),e&&t&&(l=nn<=i||nn>=pt-i,n=on<=i||on>=mt-i),e&&l&&(nn=nn<Ql?0:pt),t&&n&&(on=on<en?0:mt),An(null,!0,!0),cn=!1}nn=-10,on=-10,An(null,!0,!0),e&&(cn=e)}})),st("dblclick",A,In),hl.add(n),n.syncRect=Yn);const Gn=n.hooks=e.hooks||{};function Ln(e,t,l){e in Gn&&Gn[e].forEach((e=>{e.call(null,n,t,l)}))}(e.plugins||[]).forEach((e=>{for(let t in e.hooks)Gn[t]=(Gn[t]||[]).concat(e.hooks[t])}));const On=Ee({key:null,setSeries:!1,filters:{pub:ce,sub:ce},scales:[ee,F[1]?F[1].scale:null],match:[fe,fe],values:[null,null]},Vt.sync);Vt.sync=On;const Un=On.key,Vn=Bt(Un);function qn(e,t,l,n,i,o,s){On.filters.pub(e,t,l,n,i,o,s)&&Vn.pub(e,t,l,n,i,o,s)}function Jn(){Ln("init",e,t),Pl(t||e.data,!1),De[ee]?an(ee,De[ee]):Wl(),Lt(e.width,e.height),An(null,!0,!1),gn(pn,!1)}return Vn.sub(n),n.pub=function(e,t,l,n,i,o,s){On.filters.sub(e,t,l,n,i,o,s)&&Bn[e](null,t,l,n,i,o,s)},n.destroy=function(){Vn.unsub(n),hl.delete(n),$e.clear(),D("dppxchange",c,jn),v.remove(),Ln("destroy")},F.forEach($t),G.forEach((function(e,t){if(e._show=e.show,e.show){let l=e.side%2,i=V[e.scale];null==i&&(e.scale=l?F[1].scale:ee,i=V[e.scale]);let o=i.time;e.size=se(e.size),e.space=se(e.space),e.rotate=se(e.rotate),e.incrs=se(e.incrs||(2==i.distr?Oe:o?1==H?Xe:tt:Ue)),e.splits=se(e.splits||(o&&1==i.distr?Ye:3==i.distr?Mt:4==i.distr?St:_t)),e.stroke=se(e.stroke),e.grid.stroke=se(e.grid.stroke),e.ticks.stroke=se(e.ticks.stroke),e.border.stroke=se(e.border.stroke);let s=e.values;e.values=ye(s)&&!ye(s[0])?se(s):o?ye(s)?ot(Ae,it(s,Ce)):ke(s)?function(e,t){let l=Ne(t);return(t,n,i,o,s)=>n.map((t=>l(e(t))))}(Ae,s):s||Pe:s||kt,e.filter=se(e.filter||(i.distr>=3?At:ue)),e.font=zl(e.font),e.labelFont=zl(e.labelFont),e._size=e.size(n,null,t,0),e._space=e._rotate=e._incrs=e._found=e._splits=e._values=null,e._size>0&&(Xt[t]=!0,e._el=w("u-axis",S))}})),l?l instanceof HTMLElement?(l.appendChild(v),Jn()):l(n,Jn):Jn(),n}Dl.assign=Ee,Dl.fmtNum=G,Dl.rangeNum=N,Dl.rangeLog=P,Dl.rangeAsinh=W,Dl.orient=Gt,Dl.pxRatio=h,Dl.join=function(e,t){let l=new Set;for(let t=0;t<e.length;t++){let n=e[t][0],i=n.length;for(let e=0;e<i;e++)l.add(n[e])}let n=[Array.from(l).sort(((e,t)=>e-t))],i=n[0].length,o=new Map;for(let e=0;e<i;e++)o.set(n[0][e],e);for(let l=0;l<e.length;l++){let s=e[l],r=s[0];for(let e=1;e<s.length;e++){let u=s[e],a=Array(i).fill(void 0),c=t?t[l][e]:1,f=[];for(let e=0;e<u.length;e++){let t=u[e],l=o.get(r[e]);null===t?0!=c&&(a[l]=t,2==c&&f.push(l)):a[l]=t}De(a,f,i),n.push(a)}}return n},Dl.fmtDate=Ne,Dl.tzDate=function(e,t){let l;return"UTC"==t||"Etc/UTC"==t?l=new Date(+e+6e4*e.getTimezoneOffset()):t==Ie?l=e:(l=new Date(e.toLocaleString("en-US",{timeZone:t})),l.setMilliseconds(e.getMilliseconds())),l},Dl.sync=Bt;{Dl.addGap=function(e,t,l){let n=e[e.length-1];n&&n[0]==t?n[1]=l:e.push([t,l])},Dl.clipGaps=Vt;let e=Dl.paths={points:sl};e.linear=cl,e.stepped=function(e){const t=I(e.align,1),l=I(e.ascDesc,!1),n=I(e.alignGaps,0);return(e,i,o,s)=>Gt(e,i,((r,u,a,c,f,d,p,m,g,x,w)=>{let v=r.pxRound,b=e=>v(d(e,c,x,m)),y=e=>v(p(e,f,w,g)),k=0==c.ori?Xt:Qt;const _={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:1},M=_.stroke,S=c.dir*(0==c.ori?1:-1);o=A(a,o,s,1),s=A(a,o,s,-1);let z=y(a[1==S?o:s]),E=b(u[1==S?o:s]),D=E;k(M,E,z);for(let e=1==S?o:s;e>=o&&e<=s;e+=S){let l=a[e];if(null==l)continue;let n=b(u[e]),i=y(l);1==t?k(M,n,z):k(M,D,i),k(M,n,i),z=i,D=n}let[T,C]=Lt(e,i);if(null!=r.fill||0!=T){let t=_.fill=new Path2D(M),l=y(r.fillTo(e,i,r.min,r.max,T));k(t,D,l),k(t,E,l)}if(!r.spanGaps){let f=[];f.push(...qt(u,a,o,s,S,b,n));let d=r.width*h/2,p=l||1==t?d:-d,v=l||-1==t?-d:d;f.forEach((e=>{e[0]+=p,e[1]+=v})),_.gaps=f=r.gaps(e,i,o,s,f),_.clip=Vt(f,c.ori,m,g,x,w)}return 0!=C&&(_.band=2==C?[Ut(e,i,o,s,M,-1),Ut(e,i,o,s,M,1)]:Ut(e,i,o,s,M,C)),_}))},e.bars=function(e){const t=I((e=e||we).size,[.6,le,1]),l=e.align||0,n=(e.gap||0)*h,i=I(e.radius,0),o=1-t[0],s=I(t[1],le)*h,r=I(t[2],1)*h,u=I(e.disp,we),a=I(e.each,(e=>{})),{fill:c,stroke:f}=u;return(e,t,d,p)=>Gt(e,t,((m,g,x,w,v,b,y,k,_,M,S)=>{let z=m.pxRound;const E=w.dir*(0==w.ori?1:-1),D=v.dir*(1==v.ori?1:-1);let T,A,C=0==w.ori?el:tl,Y=0==w.ori?a:(e,t,l,n,i,o,s)=>{a(e,t,l,i,n,s,o)},[P,W]=Lt(e,t),R=3==v.distr?1==P?v.max:v.min:0,H=y(R,v,S,_),F=z(m.width*h),N=!1,j=null,B=null,G=null,L=null;null==c||0!=F&&null==f||(N=!0,j=c.values(e,t,d,p),B=new Map,new Set(j).forEach((e=>{null!=e&&B.set(e,new Path2D)})),F>0&&(G=f.values(e,t,d,p),L=new Map,new Set(G).forEach((e=>{null!=e&&L.set(e,new Path2D)}))));let{x0:O,size:q}=u;if(null!=O&&null!=q){g=O.values(e,t,d,p),2==O.unit&&(g=g.map((t=>e.posToVal(k+t*M,w.key,!0))));let l=q.values(e,t,d,p);A=2==q.unit?l[0]*M:b(l[0],w,M,k)-b(0,w,M,k),A=z(A-F),T=1==E?-F/2:A+F/2}else{let e=M;if(g.length>1){let t=null;for(let l=0,n=1/0;l<g.length;l++)if(void 0!==x[l]){if(null!=t){let i=U(g[l]-g[t]);i<n&&(n=i,e=U(b(g[l],w,M,k)-b(g[t],w,M,k)))}t=l}}A=z(K(s,Z(r,e-e*o))-F-n),T=(0==l?A/2:l==E?0:A)-l*E*n/2}const J={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:3};let $;0!=W&&(J.band=new Path2D,$=z(y(1==W?v.max:v.min,v,S,_)));const X=N?null:new Path2D,Q=J.band;let{y0:ee,y1:te}=u,le=null;null!=ee&&null!=te&&(x=te.values(e,t,d,p),le=ee.values(e,t,d,p));for(let l=1==E?d:p;l>=d&&l<=p;l+=E){let n=x[l];if(void 0===n)continue;let o=b(2!=w.distr||null!=u?g[l]:l,w,M,k),s=y(I(n,R),v,S,_);null!=le&&null!=n&&(H=y(le[l],v,S,_));let r=z(o-T),a=z(Z(s,H)),c=z(K(s,H)),f=a-c,h=i*A;null!=n&&(N?(F>0&&null!=G[l]&&C(L.get(G[l]),r,c+V(F/2),A,Z(0,f-F),h),null!=j[l]&&C(B.get(j[l]),r,c+V(F/2),A,Z(0,f-F),h)):C(X,r,c+V(F/2),A,Z(0,f-F),h),Y(e,t,l,r-F/2,c,A+F,f)),0!=W&&(D*W==1?(a=c,c=$):(c=a,a=$),f=a-c,C(Q,r-F/2,c,A+F,Z(0,f),0))}return F>0&&(J.stroke=N?L:X),J.fill=N?B:X,J}))},e.spline=function(e){return function(e,t){const l=I(t?.alignGaps,0);return(t,n,i,o)=>Gt(t,n,((s,r,u,a,c,f,h,d,p,m,g)=>{let x,w,v,b=s.pxRound,y=e=>b(f(e,a,m,d)),k=e=>b(h(e,c,g,p));0==a.ori?(x=Zt,v=Xt,w=il):(x=$t,v=Qt,w=ol);const _=a.dir*(0==a.ori?1:-1);i=A(u,i,o,1),o=A(u,i,o,-1);let M=y(r[1==_?i:o]),S=M,z=[],E=[];for(let e=1==_?i:o;e>=i&&e<=o;e+=_)if(null!=u[e]){let t=y(r[e]);z.push(S=t),E.push(k(u[e]))}const D={stroke:e(z,E,x,v,w,b),fill:null,clip:null,band:null,gaps:null,flags:1},T=D.stroke;let[C,Y]=Lt(t,n);if(null!=s.fill||0!=C){let e=D.fill=new Path2D(T),l=k(s.fillTo(t,n,s.min,s.max,C));v(e,S,l),v(e,M,l)}if(!s.spanGaps){let e=[];e.push(...qt(r,u,i,o,_,y,l)),D.gaps=e=s.gaps(t,n,i,o,e),D.clip=Vt(e,a.ori,d,p,m,g)}return 0!=Y&&(D.band=2==Y?[Ut(t,n,i,o,T,-1),Ut(t,n,i,o,T,1)]:Ut(t,n,i,o,T,Y)),D}))}(fl,e)}}!function(e,t){void 0===t&&(t={});var l=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===l&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}('.uplot, .uplot *, .uplot *::before, .uplot *::after {box-sizing: border-box;}.uplot {font-family: 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";line-height: 1.5;width: min-content;}.u-title {text-align: center;font-size: 18px;font-weight: bold;}.u-wrap {position: relative;user-select: none;}.u-over, .u-under {position: absolute;}.u-under {overflow: hidden;}.uplot canvas {display: block;position: relative;width: 100%;height: 100%;}.u-axis {position: absolute;}.u-legend {font-size: 14px;margin: auto;text-align: center;}.u-inline {display: block;}.u-inline * {display: inline-block;}.u-inline tr {margin-right: 16px;}.u-legend th {font-weight: 600;}.u-legend th > * {vertical-align: middle;display: inline-block;}.u-legend .u-marker {width: 1em;height: 1em;margin-right: 4px;background-clip: padding-box !important;}.u-inline.u-live th::after {content: ":";vertical-align: middle;}.u-inline:not(.u-live) .u-value {display: none;}.u-series > * {padding: 4px;}.u-series th {cursor: pointer;}.u-legend .u-off > * {opacity: 0.3;}.u-select {background: rgba(0,0,0,0.07);position: absolute;pointer-events: none;}.u-cursor-x, .u-cursor-y {position: absolute;left: 0;top: 0;pointer-events: none;will-change: transform;z-index: 100;}.u-hz .u-cursor-x, .u-vt .u-cursor-y {height: 100%;border-right: 1px dashed #607D8B;}.u-hz .u-cursor-y, .u-vt .u-cursor-x {width: 100%;border-bottom: 1px dashed #607D8B;}.u-cursor-pt {position: absolute;top: 0;left: 0;border-radius: 50%;border: 0 solid;pointer-events: none;will-change: transform;z-index: 100;/*this has to be !important since we set inline "background" shorthand */background-clip: padding-box !important;}.u-axis.u-off, .u-select.u-off, .u-cursor-x.u-off, .u-cursor-y.u-off, .u-cursor-pt.u-off {display: none;}');var Tl=function(r){var u,a,c,f=r.id,h=r.options,d=r.data,p=r.configs,m=r.handlers,g=n(),x=n(),w=n(),v=i((function(){return null!=f?f:s()}),[f]),b=e((function(e){var t=e.width,l=e.height,n=e.uplot;null==n||n.setSize({width:t,height:l})}),300),y=function(e,t,l){if(e&&t){if(g.current){var n=new Dl(e,t,g.current);(null==p?void 0:p.autoResize)||e.width&&e.height||console.warn("width and height must required in options if you do not use autoResize!"),p&&p.autoResize&&function(e){if(w&&w.current){var t=new ResizeObserver((function(t){for(var l,n,i=0,o=t;i<o.length;i++){var s=o[i].contentRect;if(e.width!==s.width||e.height!==s.height){var r=0,u=null===(l=document.getElementById(v))||void 0===l?void 0:l.getElementsByClassName("u-legend")[0];u&&(r=null!==(n=u.clientHeight)&&void 0!==n?n:0);var a=s.width-0,c=r>s.height?s.height:s.height-r;b({width:a,height:c,uplot:e})}}}));t.observe(w.current)}}(n),l(n)}}else console.error("options and data is required!")};return o((function(){return y(h,d,(function(e){x.current=e,m&&m.onCreated&&m.onCreated(e)})),function(){var e;m&&m.beforeDelete&&m.beforeDelete(x.current),(e=x.current)&&(null==e||e.destroy())}}),[h]),o((function(){var e;null===(e=null==x?void 0:x.current)||void 0===e||e.setData(d)}),[d]),o((function(){return function(){g.current=null}}),[]),l.createElement("div",{id:v,ref:w,style:t({width:"auto",height:"100%"},null===(u=null==p?void 0:p.wrapper)||void 0===u?void 0:u.style),className:null!==(c=null===(a=null==p?void 0:p.wrapper)||void 0===a?void 0:a.className)&&void 0!==c?c:""},l.createElement("div",{ref:g}))};export{Tl as default}; //# sourceMappingURL=index2.js.map