UNPKG

uplot-react-js

Version:

"This is chart wrapper for uplot library"

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