(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{104:function(t,e,n){"use strict";function o(t){const e=t.length;let n=t[0],o=t[0];for(let i=0;in?n=e:evoid 0!==n[o]?n[o]:void 0!==e[o]?e[o]:t[o]})}function s(t,e,n=!0){let o,i,a=null;return(...l)=>{o=!0,i=l,a||(n&&(o=!1,t(...i)),a=window.setInterval(()=>{if(!o)return window.clearInterval(a),void(a=null);o=!1,t(...i)},e))}}function r(t){let e,n=!1;return function(...o){e=o,n||(n=!0,requestAnimationFrame(()=>{n=!1,t(...e)}))}}function c(t,e,n=!0,o=!0){let i=null;return function(){i?(clearTimeout(i),i=null):n&&t(),i=setTimeout(()=>{o&&t(),i=null},e)}}n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return i})),n.d(e,"e",(function(){return a})),n.d(e,"d",(function(){return l})),n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return r})),n.d(e,"a",(function(){return c}))},300:function(t,e,n){},304:function(t,e,n){"use strict";n.r(e),n.d(e,"create",(function(){return U}));var o=n(41);function i(t){const e={};let n=null,i=null,a=null,l=null,s=null,r=null;function c(t){delete e[t],d()||(cancelAnimationFrame(n),n=null)}function d(){return Boolean(Object.keys(e).length)}function u(t){return!(!t&&(r||s))&&(null===a||a>=o.z)}function h(){const r=!u();!i||Date.now()-i>=o.A?(l&&(a=l,s||u(!0)||(s=Date.now())),i=Date.now(),l=0):l++;const f={};Object.keys(e).forEach(t=>{const{startedAt:n,from:i,to:a,duration:l=o.B,options:s}=e[t],r=Math.min(1,(Date.now()-n)/l);let d=i+(a-i)*(u=r,1-Math.pow(1-u,1.675));var u;s.includes("ceil")?d=Math.ceil(d):s.includes("floor")&&(d=Math.floor(d)),e[t].current=d,e[t].progress=r,f[t]=d,1===r&&c(t)}),r||t(f),d()&&(n=requestAnimationFrame(h))}return{add:function(t,o,a,c,d){e[t]={from:o,to:a,duration:c,options:d,current:o,startedAt:Date.now(),progress:0},n||(!function(){i=null,l=null,s&&Date.now()-s>5e3&&(s=null);r=Boolean(s)||!u(!0)}(),n=requestAnimationFrame(h))},remove:c,get:function(t){return e[t]},getState:function(){const t={};return Object.keys(e).forEach(n=>{const{current:o,from:i,to:a,progress:l}=e[n];t[n]=o,t[n+"From"]=i,t[n+"To"]=a,t[n+"Progress"]=l}),t},isRunning:d,isFast:u}}var a=n(104);const l=[1,2,8,18,50,100,250,500,1e3,2500,5e3,1e4,25e3,5e4,1e5,25e4,5e5,1e6,25e5,5e6,1e7,25e6,5e7,1e8];function s(t){return l[t]||l[l.length-1]}function r(t,e,n){const i=Math.min(e+o.h,n-e);return i<=4*o.h&&(t=Math.min(1,t,i/(4*o.h))),t}function c(t,e){return e-o.h<=2*o.h?Math.min(1,t,(e-o.h)/(2*o.h)):t}function d(t){return Math.min(...t.getSize())*o.t}function u(t,e){return Math.abs(e.value-t.value)>o.j}function h(t){return t>=o.x?Math.min(t/1e3,1):0}function f(t,e,n){const l={begin:0,end:1},r=function(){const e={};return t.datasets.forEach(({key:t})=>{e[t]=!0}),e}(),c=function(){const e=[],n=t.datasets.map(({key:t})=>`opacity#${t} 300`);return Object(a.c)([o.a,n]).forEach(t=>{const[n,o,...i]=t.split(" ");e.push({prop:n,duration:o,options:i})}),e}(),d=i(f),u=Object(a.g)(f);let h={};function f(){const t=d.isFast()?Object(a.d)(h,d.getState()):h;t.static=h,n(t)}return{update:function({range:n={},filter:i={},focusOn:f,minimapDelta:y}={},g){Object.assign(l,n),Object.assign(r,i);const v=h;h=function(t,e,n,i,l,r,c){const{begin:d,end:u}=n,h=t.xLabels.length-1,f=Math.max(0,Math.ceil(h*d)),y=Math.min(Math.floor(h*u),h),g=function(t,e,n){const i=n-e,a=Math.floor(t/o.c);return l=i/a,Math.ceil(Math.log2(l||1));var l}(e.width,f,y),v=t.isStacked?function(t,e,n,o,i){const l=t.datasets.filter(t=>e[t.key]).map(({values:t})=>t),s=l.length?Object(a.e)(l):[],{max:r=i.yMaxMinimap}=Object(a.b)(s),{max:c=i.yMaxViewport}=Object(a.b)(s.slice(n,o+1));return{yMinViewport:0,yMaxViewport:c,yMinMinimap:0,yMaxMinimap:r}}(t,i,f,y,c):function(t,e,n,o,i){const a=t.hasSecondYAxis&&t.datasets.slice(-1)[0],l=t.datasets.filter(t=>e[t.key]&&t!==a),s=p(t,n,o,i,l);if(a){e[a.key];const{yMinViewport:l,yMaxViewport:r,yMinMinimap:c,yMaxMinimap:d}=p(t,n,o,i,[a]);Object.assign(s,{yMinViewportSecond:l,yMaxViewportSecond:r,yMinMinimapSecond:c,yMaxMinimapSecond:d})}return s}(t,i,f,y,c),x=m(e.height,v.yMinViewport,v.yMaxViewport),b=t.hasSecondYAxis&&m(e.height,v.yMinViewportSecond,v.yMaxViewportSecond),M=s(x);if(v.yMinViewport-=v.yMinViewport%M,b){const t=s(b);v.yMinViewportSecond-=v.yMinViewportSecond%t}const w={};return t.datasets.forEach(({key:t})=>{w["opacity#"+t]=i[t]?1:0}),Object.assign({totalXWidth:h,xAxisScale:g,yAxisScale:x,yAxisScaleSecond:b,labelFromIndex:Math.max(0,f-1),labelToIndex:Math.min(y+1,h),filter:Object.assign({},i),focusOn:void 0!==l?l:c.focusOn,minimapDelta:void 0!==r?r:c.minimapDelta},v,w,n)}(t,e,l,r,f,y,v),g||c.forEach(({prop:t,duration:e,options:n})=>{const o=d.get(t),i=o?o.to:v[t];if(void 0!==i&&i!==h[t]){const i=o?n.includes("fast")?v[t]:o.current:v[t];o&&d.remove(t),d.add(t,i,h[t],e,n)}}),d.isRunning()&&d.isFast()||u()},hasAnimations:function(){return d.isFast()}}}function p(t,e,n,i,l){const{min:s=i.yMinMinimap,max:r=i.yMaxMinimap}=Object(a.b)(Object(a.c)(l.map(({yMax:t,yMin:e})=>[t,e]))),c=s/r>o.G?s:0;let d,u;if(0===e&&n===t.xLabels.length-1)d=c,u=r;else{const t=l.map(({values:t})=>t).map(t=>t.slice(e,n+1)),s=Object(a.b)(Object(a.c)(t)),r=void 0!==s.min?s.min:i.yMinViewport;u=void 0!==s.max?s.max:i.yMaxViewport,d=r/u>o.G?r:0}return{yMinViewport:d,yMaxViewport:u,yMinMinimap:c,yMaxMinimap:r}}function m(t,e,n){const i=t-o.E,a=n-e,s=Math.floor(i/o.d);return r=a/s,l.findIndex(t=>t>=r)||l.length-1;var r}const y=(t="div")=>document.createElement(t);function g(t,e,n){t.addEventListener(e,n)}function v(t,e,n){t.removeEventListener(e,n)}function x(t,e,n="",o=!1){const i=t.parentNode;i.classList.add("lovely-chart--transition-container");const a=y(t.tagName);a.className=`${n} lovely-chart--transition lovely-chart--position-${o?"top":"bottom"} lovely-chart--state-hidden`,a.innerHTML=e;const l=n.length?"."+n.split(" ").join("."):"";return i.querySelectorAll(l+".lovely-chart--state-hidden").forEach(t=>t.remove()),t.classList.add("lovely-chart--transition"),t.classList.remove("lovely-chart--position-bottom","lovely-chart--position-top"),t.classList.add(o?"lovely-chart--position-bottom":"lovely-chart--position-top"),i.insertBefore(a,t.nextSibling),function(t){t.classList.remove("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-animated"),t.classList.remove("lovely-chart--state-hidden")}(a),function(t){t.classList.remove("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-hidden")}(t),a}function b(t,e=1){return t>=1e6?M(t/1e6,e)+"M":t>=1e3?M(t/1e3,e)+"K":t}function M(t,e){return t.toFixed(e).replace(/(\d{3,})\.\d+/,"$1").replace(/\.0+$/,"")}function w(t){return String(t).replace(/\d(?=(\d{3})+$)/g,"$& ")}function k(t,{isShort:e=!1}={}){return L(t,{isShort:e,displayWeekDay:!0})}function L(t,{isShort:e=!1,displayWeekDay:n=!1,displayYear:i=!0,displayHours:a=!1}={}){const{value:l}=t,s=new Date(l),r=e?o.D:o.C;let c=`${s.getUTCDate()} ${o.p[s.getUTCMonth()]}`;return n&&(c=r[s.getUTCDay()]+", "+c),i&&(c+=" "+(s.getUTCFullYear()+1)),a&&(c+=`, ${("0"+s.getUTCHours()).slice(-2)}:${("0"+s.getUTCMinutes()).slice(-2)}`),c}function S(){return document.documentElement.classList.contains("dark")?"skin-night":"skin-day"}let T=S();const P={"skin-day":{background:"#FFFFFF","text-color":"#222222","minimap-mask":"#E2EEF9/0.6","minimap-slider":"#C0D1E1","grid-lines":"#182D3B/0.1","zoom-out-text":"#108BE3","tooltip-background":"#FFFFFF","tooltip-arrow":"#D2D5D7",mask:"#FFFFFF/0.5","x-axis-text":"#252529/0.6","y-axis-text":"#252529/0.6"},"skin-night":{background:"#242F3E","text-color":"#FFFFFF","minimap-mask":"#304259/0.6","minimap-slider":"#56626D","grid-lines":"#FFFFFF/0.1","zoom-out-text":"#48AAF0","tooltip-background":"#1c2533","tooltip-arrow":"#D2D5D7",mask:"#242F3E/0.5","x-axis-text":"#A3B1C2/0.6","y-axis-text":"#A3B1C2/0.6"}},A=document.createElement("style");A.type="text/css",A.appendChild(document.createTextNode("")),document.head.appendChild(A);const O=A.sheet;function F(t){const e={},n=".lovely-chart--color";return["skin-day","skin-night"].forEach(o=>{e[o]={},Object.keys(P[o]).forEach(t=>{e[o][t]=E(P[o][t])}),Object.keys(t).forEach(i=>{e[o]["dataset#"+i]=E(t[i]),C(O,`.lovely-chart--tooltip-dataset-value${n}-${t[i].slice(1)}`,"color: "+t[i]),C(O,`.lovely-chart--button${n}-${t[i].slice(1)}`,`border-color: ${t[i]}; color: ${t[i]}`),C(O,`.lovely-chart--button.lovely-chart--state-checked${n}-${t[i].slice(1)}`,"background-color: "+t[i])})}),e}function I(t,e,n){return function([t,e,n,o=1],i=1){return`rgba(${t}, ${e}, ${n}, ${o*i})`}(t[T][e],n)}function E(t){const[e,n]=t.replace("#","").split("/");return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),n?parseFloat(n):1]}function C(t,e,n){t.insertRule(`${e} { ${n} }`,t.cssRules.length)}function V(t){const{begin:e,end:n,totalXWidth:o,yMin:i,yMax:l,availableWidth:s,availableHeight:r,xPadding:c=0,yPadding:d=0}=t;let u=s;0===e&&(u-=c),1===n&&(u-=c);const h=u/((n-e)*o);let f=e*o*h;0===e&&(f-=c);const p=r-d,m=p/(l-i),y=i*m;return{findClosestLabelIndex:function(t){return Math.round((t+f)/h)},copy:function(e,n){return V(Object(a.d)(t,e))},getCenter:function(){return[s/2,r-p/2]},getSize:function(){return[s,p]},getParams:function(){return t},getState:function(){return{xFactor:h,xOffsetPx:f,availableHeight:r,yFactor:m,yOffsetPx:y}}}}function W(t,e,n){const{xFactor:o,xOffsetPx:i,availableHeight:a,yFactor:l,yOffsetPx:s}=t.getState();return[e*o-i,a-(n*l-s)]}function $(t,e,n,i){function a(e,a,l,r,d,u=1,h=null,f=!1){const p=s(l),m=Math.ceil(r/p)*p,y=Math.floor(d/p)*p;t.font=o.b,t.textAlign=f?"right":"left",t.textBaseline="bottom",t.lineWidth=1,t.beginPath();for(let e=m;e<=y;e+=p){const[,l]=W(a,0,e),s=c(u,l);t.fillStyle=I(i,h||"y-axis-text",s),f?t.fillText(b(e),n.width-o.h,l-o.h/2):t.fillText(b(e),o.h,l-o.h/2),f?(t.strokeStyle=I(i,h,u),t.moveTo(n.width-o.h,l),t.lineTo(n.width-2*o.h,l)):(t.moveTo(o.h,l),t.strokeStyle=I(i,"grid-lines",u),t.lineTo(n.width-o.h,l))}t.stroke()}return{drawXAxis:function(a,l){t.clearRect(0,n.height-o.E+1,n.width,o.E+1);const s=n.height-o.E/2,c=Math.floor(a.xAxisScale),d=function(t){return Math.pow(2,t)}(c),u=1-(a.xAxisScale-c);t.font=o.b,t.textAlign="center",t.textBaseline="middle";for(let c=a.labelFromIndex;c<=a.labelToIndex;c++){const a=c-o.F;if(a%d!=0)continue;const h=e.xLabels[c],[f]=W(l,c,0);let p=a%(2*d)==0?1:u;p=r(p,f,n.width),t.fillStyle=I(i,"x-axis-text",p),t.fillText(h.text,f,s)}},drawYAxis:function(l,s,r){const{yAxisScale:c,yAxisScaleFrom:d,yAxisScaleTo:u,yAxisScaleProgress:h=0,yMinViewport:f,yMinViewportFrom:p,yMinViewportTo:m,yMaxViewport:y,yMaxViewportFrom:g,yMaxViewportTo:v,yMinViewportSecond:x,yMinViewportSecondFrom:b,yMinViewportSecondTo:M,yMaxViewportSecond:w,yMaxViewportSecondFrom:k,yMaxViewportSecondTo:L}=l,S=r&&"dataset#"+e.datasets[0].key,T=void 0!==p||void 0!==g;if(e.isPercentage?function(e){const[,a]=e.getSize();t.font=o.b,t.textAlign="left",t.textBaseline="bottom",t.lineWidth=1,t.beginPath(),[0,.25,.5,.75,1].forEach(e=>{const l=a-a*e+o.v;t.fillStyle=I(i,"y-axis-text",1),t.fillText(100*e+"%",o.h,l-o.h/4),t.moveTo(o.h,l),t.strokeStyle=I(i,"grid-lines",1),t.lineTo(n.width-o.h,l)}),t.stroke()}(s):a(l,s,Math.round(u||c),void 0!==m?m:f,void 0!==v?v:y,d?h:1,S),h>0&&T&&a(l,s,Math.round(d),void 0!==p?p:f,void 0!==g?g:y,1-h,S),r){const{yAxisScaleSecond:t,yAxisScaleSecondFrom:n,yAxisScaleSecondTo:o,yAxisScaleSecondProgress:i=0}=l,s="dataset#"+e.datasets[e.datasets.length-1].key,c=void 0!==b||void 0!==k;a(l,r,Math.round(o||t),void 0!==M?M:x,void 0!==L?L:w,n?i:1,s,!0),i>0&&c&&a(l,r,Math.round(n),void 0!==b?b:x,void 0!==k?k:w,1-i,s,!0)}}}}function j(t,{width:e,height:n}){const i=y("canvas");i.width=e*o.g,i.height=n*o.g,i.style.width="100%",i.style.height=n+"px";const a=i.getContext("2d");return a.scale(o.g,o.g),t.appendChild(i),{canvas:i,context:a}}function D(t,e){e.clearRect(0,0,t.width,t.height)}function H(t,e,n,o,i,l){let s=e.map(({values:t})=>t.slice(n.from,n.to+1));t.isPie&&!l&&(s=function(t){return t.map(t=>[t.reduce((t,e)=>t+e,0)])}(s));const r=s.map((e,i)=>e.map((e,a)=>{let l=e;return t.isStacked&&(l*=o[i]),{labelIndex:n.from+a,value:e,visibleValue:l,stackOffset:0,stackValue:l}}));return t.isPercentage&&function(t,e){const n=function(t){return Object(a.e)(t.map(t=>t.map(({visibleValue:t})=>t)))}(t);t.forEach(t=>{t.forEach((t,o)=>{t.percent=t.visibleValue/n[o],t.visibleValue=t.percent*e.yMax})})}(r,i),t.isStacked&&function(t){const e=[];t.forEach(t=>{t.forEach((t,n)=>{void 0===e[n]&&(e[n]=0),t.stackOffset=e[n],e[n]+=t.visibleValue,t.stackValue=e[n]})})}(r),r}document.documentElement.addEventListener("darkmode",()=>{T=S()});const Z=(()=>{let t=1/Math.pow(2,22);function e(t,e,n,o,i){let a,l=+e[0],s=+e[1];a=+((t[0]-l)*o[0]+(t[1]-s)*o[1])*i,a>1?(l=+n[0],s=+n[1]):a>0&&(l+=+o[0]*a,s+=+o[1]*a);let r=+t[0]-l,c=+t[1]-s;return+r*r+c*c}return function(n,o,i){if(n.length<6)return function(){return{points:n,indexes:o,removed:[]}};let a=function(n,o){let i,a=n.length,l=[],s=[];for(let t=0,e=n.length;tr){if(et||Math.abs(a[1])>t){let t=1/(a[0]*a[0]+a[1]*a[1]);for(let o=r+1;oh&&(i=o,h=l)}}else i=Math.round(.5*(r+c)),h=u;l[i]=h}d={start:r,end:c,index:i,distance:h}}return d.index&&d.distance>i&&(d.index-r>=2&&s.push({start:r,end:d.index,record:d.left,currentLimit:d.distance,parent:d,parentProperty:"left"}),c-d.index>=2&&s.push({start:d.index,end:c,record:d.right,currentLimit:d.distance,parent:d,parentProperty:"right"})),d}(a);return a.parent&&a.parentProperty&&(a.parent[a.parentProperty]=r),r}return function(t){for(i=t,s.push({start:0,end:a-1,record:r,currentLimit:1e5}),r=c();s.length;)c();return l}}(n,i);return function(t){let e=[],i=[],l=[],s=t*t,r=a(s);for(let t=0,a=n.length;t=s||0==t||t==a-1?(e.push(n[t]),i.push(o?o[t]:t)):l.push(t);return{points:e,indexes:i,removed:l}}}})();function X(t,e,n,i,l,s,r,c,u,h,f,p,m){if(n.datasets.forEach(({key:y,type:g,hasOwnYAxis:v},x)=>{if(!h[x])return;const b={color:I(f,"dataset#"+y),lineWidth:u,opacity:n.isStacked?1:h[x],simplification:m},M="pie"===g&&p?"bar":g;let w=v?r:l[x],k=v?c:s;if("area"===M){const{yMin:t,yMax:e}=s.getParams(),n=e-t,o=[{labelIndex:i.from,stackValue:0},{labelIndex:i.to,stackValue:0}],r=[{labelIndex:i.to,stackValue:n},{labelIndex:i.from,stackValue:n}];w=Object(a.c)([l[x-1]||o,r])}if("pie"===M&&(b.center=s.getCenter(),b.radius=d(s),b.pointerVector=e.focusOn),"bar"===M){const[t]=W(s,0,0),[n]=W(s,1,0);b.lineWidth=n-t,b.focusOn=e.focusOn}!function(t,...e){switch(t){case"line":return function(t,e,n,o){t.beginPath();let i=[];for(let t=0,o=e.length;t{t.lineTo(e,n)}),t.save(),t.strokeStyle=o.color,t.lineWidth=o.lineWidth,t.globalAlpha=o.opacity,t.lineJoin="bevel",t.lineCap="butt",t.stroke(),t.restore()}(...e);case"bar":return function(t,e,n,i){const{yMin:a}=n.getParams();t.save(),t.globalAlpha=i.opacity,t.fillStyle=i.color;for(let l=0,s=e.length;l{t.lineTo(e,n)}),t.save(),t.fillStyle=o.color,t.lineWidth=o.lineWidth,t.globalAlpha=o.opacity,t.lineJoin="bevel",t.lineCap="butt",t.fill(),t.restore()}(...e);case"pie":(function(t,e,n,i){const{visibleValue:a,stackValue:l,stackOffset:s=0}=e[0];if(!a)return;const{yMin:r,yMax:c}=n.getParams(),d=1/(c-r),u=a*d,h=s*d*Math.PI*2-Math.PI/2,f=l*d*Math.PI*2-Math.PI/2,{radius:p=120,center:[m,y],pointerVector:g}=i,v=g&&h<=g.angle&&g.angle=.99?0:Math.min(1-Math.log(30*t)/5,.8)*e}(u,p);t.fillText(Math.round(100*u)+"%",m+b*L+w,y+M*L+k),t.restore()})(...e)}}(M,t,w,k,b)}),e.focusOn&&n.isBars){const[n]=W(s,0,0),[i]=W(s,1,0);!function(t,e,n){const[i,a]=e.getCenter(),[l,s]=e.getSize(),[r]=W(e,n.focusOn,0);t.fillStyle=n.color,t.fillRect(i-l/2,a-s/2,r-n.lineWidth/2+o.q,s),t.fillRect(r+n.lineWidth/2,a-s/2,l-(r+n.lineWidth/2),s)}(t,s,{focusOn:e.focusOn,color:I(f,"mask"),lineWidth:i-n})}}function q(t,e){let n=null,i=null;function a(t){n=t,"mousedown"===t.type?(g(document,"mousemove",s),g(document,"mouseup",l)):"touchstart"===t.type&&(g(document,"touchmove",s),g(document,"touchend",l),g(document,"touchcancel",l),void 0===t.pageX&&(t.pageX=t.touches[0].pageX)),e.draggingCursor&&document.documentElement.classList.add("cursor-"+e.draggingCursor),e.onCapture&&e.onCapture(t),e.onLongPress&&(i=setTimeout(()=>e.onLongPress(),o.i))}function l(t){n&&(i&&(clearTimeout(i),i=null),e.draggingCursor&&document.documentElement.classList.remove("cursor-"+e.draggingCursor),v(document,"mouseup",l),v(document,"mousemove",s),v(document,"touchcancel",l),v(document,"touchend",l),v(document,"touchmove",s),n=null,e.onRelease&&e.onRelease(t))}function s(t){n&&(i&&(clearTimeout(i),i=null),"touchmove"===t.type&&void 0===t.pageX&&(t.pageX=t.touches[0].pageX),e.onDrag&&e.onDrag(t,n,{dragOffsetX:t.pageX-n.pageX}))}g(t,"mousedown",a),g(t,"touchstart",a)}function B(t,e,n,i){let l,s,r,c,d,u,f,p,m={};const g=Object(a.g)((function(){const{begin:t,end:e}=m;d.children[0].style.width=100*t+"%",d.children[1].style.width=100*(e-t)+"%",d.children[2].style.width=100*(1-e)+"%"}));function v(t){t.preventDefault(),f=t.target.offsetLeft}function x(){f=null}function b(t,e,{dragOffsetX:n}){const i=c.width-u.offsetWidth,a=Math.max(0,Math.min(f+n-o.k,i)),l=a+u.offsetWidth;k({begin:a/c.width,end:l/c.width})}function M(t,e,{dragOffsetX:n}){const i=u.offsetLeft+u.offsetWidth-2*o.k;k({begin:Math.min(i,Math.max(0,f+n))/c.width})}function w(t,e,{dragOffsetX:n}){const i=u.offsetLeft+2*o.k,a=c.width;k({end:Math.max(i,Math.min(f+o.k+n,a))/c.width})}function k(t,e){let n=Object.assign({},m,t);p&&p.minimapDelta&&!e&&(n=function(t){const e=Math.round(t.begin/p.minimapDelta)*p.minimapDelta,n=Math.round(t.end/p.minimapDelta)*p.minimapDelta;return{begin:e,end:n}}(n)),n.begin===m.begin&&n.end===m.end||(m=n,g(),e||i(m))}return l=y(),l.className="lovely-chart--minimap",l.style.height=o.l+"px",function(){const{canvas:e,context:n}=j(l,{width:t.offsetWidth-2*o.n,height:o.l});s=e,r=n}(),d=y(),d.className="lovely-chart--minimap-ruler",d.innerHTML='
',u=d.children[1],q(u.children[1],{onCapture:v,onDrag:b,onRelease:x,draggingCursor:"grabbing"}),q(u.children[0],{onCapture:v,onDrag:M,onRelease:x,draggingCursor:"ew-resize"}),q(u.children[2],{onCapture:v,onDrag:w,onRelease:x,draggingCursor:"ew-resize"}),l.appendChild(d),t.appendChild(l),c={width:s.offsetWidth,height:s.offsetHeight},k(o.f),{update:function(t){const{begin:i,end:l}=t;f||k({begin:i,end:l},!0),e.datasets.length>=o.o&&(t=t.static),function(t){if(!p)return!0;const{datasets:n}=e;if(n.some(({key:e})=>p["opacity#"+e]!==t["opacity#"+e]))return!0;if(p.yMaxMinimap!==t.yMaxMinimap)return!0;return!1}(t)&&(p=Object(a.d)(t,{focusOn:null}),D(s,r),function(t={}){const{datasets:i}=e,a={from:0,to:t.totalXWidth},l={begin:0,end:1,totalXWidth:t.totalXWidth,yMin:t.yMinMinimap,yMax:t.yMaxMinimap,availableWidth:c.width,availableHeight:c.height,yPadding:1},s=i.map(({key:t})=>p["opacity#"+t]),d=H(e,i,a,s,l,!0),u=V(l);let f=null,m=null;if(e.hasSecondYAxis){const n=i.find(t=>t.hasOwnYAxis),o={yMin:t.yMinMinimapSecond,yMax:t.yMaxMinimapSecond};f=H(e,[n],a,s,o)[0],m=u.copy(o)}const y=h(d.reduce((t,e)=>t+e.length,0))*o.w;X(r,t,e,a,d,u,f,m,o.m,s,n,!0,y)}(p))},toggle:function(t){l.classList.toggle("lovely-chart--state-hidden",!t),requestAnimationFrame(()=>{l.classList.toggle("lovely-chart--state-transparent",!t)})}}}function Y(t,e,n,i,l,s){let r,c,h,f,p,m,v,x,b,M,S,T=null,P=!1,A=!1;const O=Object(a.g)(X),F=Object(a.f)(Y,100,!0,!0);function E(t){if(t.target===b||b.contains(t.target)||T)return;A=!1;const e=m.getBoundingClientRect();M=(t.touches?t.touches[0].clientX:t.clientX)-e.left,S=(t.touches?t.touches[0].clientY:t.clientY)-e.top,O()}function C(t){null===M||t.target===m||m.contains(t.target)||H()}function V(t){if(A)return;const e=T;T=null,E(t);const n=Z();n!==e&&(T=n)}function $(){if(b.classList.contains("lovely-chart--state-inactive"))return;const t=h.findClosestLabelIndex(M);l(t)}function H(t){M=null,T=null,D(v,x),N(),!t&&s&&s(null)}function Z(){const t=h.findClosestLabelIndex(M);return tr.labelToIndex?null:t}function X(t){if(!M||!r||A)return;const a=Z();if(null===a)return void H(t);const l=z(),m=!e.isPie||l.distance<=d(h);function y(t,n){return e.isPie?t.slice(r.labelFromIndex,r.labelToIndex+1).reduce((t,e)=>t+e,0):t[n]}!t&&s&&(e.isPie?s(l):s(a));const[g]=W(h,a,0),w=e.datasets.map(({key:t,name:e,values:n,hasOwnYAxis:o},i)=>({key:t,name:e,value:y(n,a),hasOwnYAxis:o,originalIndex:i})).filter(({key:t})=>r.filter[t]);w.length&&m?function(t,n){b.style.transform=`translate3D(${function(t){const n=(r.labelFromIndex+r.labelToIndex)/2,{angle:i}=z();return(e.isPie?i>Math.PI/2:t{const l=e-r.labelFromIndex,s=o?f[l]:c[a][l];if(!s)return;const[d,u]=W(o?p:h,e,s.stackValue);!function([t,e],n,o){x.strokeStyle=n,x.fillStyle=o,x.lineWidth=2,x.beginPath(),x.arc(t,e,4,0,2*Math.PI),x.fill(),x.stroke()}([d,u],I(i,"dataset#"+n),I(i,"background"))})}(w,a),function(t,e,n){x.strokeStyle=n,x.lineWidth=1,x.beginPath(),x.moveTo(t,0),x.lineTo(t,e),x.stroke()}(g,n.height-o.E,I(i,"grid-lines")))}function q(t,n,o){if(!e.isPercentage)return;if(e.isPie)return void Array.from(t.querySelectorAll(".lovely-chart--percentage-title")).forEach(t=>t.remove());const i=Math.round(n/o*100),a=t.querySelector(".lovely-chart--percentage-title:not(.lovely-chart--state-hidden)");if(a)a.innerHTML=i+"%";else{const e=y("span");e.className="lovely-chart--percentage-title lovely-chart--position-left",e.innerHTML=i+"%",t.prepend(e)}}function B(t){const n=b.children[1];e.isPie&&n.classList.add("lovely-chart--tooltip-legend-pie"),Array.from(n.children).forEach(t=>{!e.isPie&&n.classList.contains("lovely-chart--tooltip-legend-pie")?t.remove():t.setAttribute("data-present","false")});const o=t.reduce((t,e)=>t+e.value,0),i=z();(e.isPie?t.filter(({value:e},n)=>function(t,e,n,o,i){const a=o>0?t.slice(0,o).reduce((t,e)=>t+e.value,0):0,l=a/n*Math.PI*2-Math.PI/2,s=(a+e)/n*Math.PI*2-Math.PI/2;return i&&l<=i.angle&&i.angle{const i=n.querySelector(`[data-name="${t.name}"]`);i?function(t,{key:n,value:o}={},i){t.setAttribute("data-present","true"),t.querySelector(`.lovely-chart--tooltip-dataset-value.lovely-chart--color-${e.colors[n].slice(1)}:not(.lovely-chart--state-hidden)`).innerHTML=w(o),q(t,o,i)}(i,t,o):function(t,{name:n,key:o,value:i},a){const l="lovely-chart--tooltip-dataset-value lovely-chart--position-right lovely-chart--color-"+e.colors[o].slice(1),s=y();s.className="lovely-chart--tooltip-dataset",s.setAttribute("data-present","true"),s.setAttribute("data-name",n),s.innerHTML=`${n}${w(i)}`,q(s,i,a);const r=t.querySelector('[data-total="true"]');r?t.insertBefore(s,r):t.appendChild(s)}(n,t,o)}),e.isBars&&e.isStacked&&function(t,e){const n=t.querySelector('[data-total="true"]');if(n){n.setAttribute("data-present","true");n.querySelector(".lovely-chart--tooltip-dataset-value:not(.lovely-chart--state-hidden)").innerHTML=e}else{const n=y();n.className="lovely-chart--tooltip-dataset",n.setAttribute("data-present","true"),n.setAttribute("data-total","true"),n.innerHTML=`All${e}`,t.appendChild(n)}}(n,w(o)),Array.from(n.querySelectorAll('[data-present="false"]')).forEach(t=>{t.remove()})}function Y(t,n){!function(t){const n=b.children[0];if(e.isPie)n&&(n.style.display="none");else{"none"===n.style.display&&(n.style.display="");const e=n.querySelector(":not(.lovely-chart--state-hidden)");n.innerHTML&&e?e.innerHTML=t:n.innerHTML=`${t}`}}(t),B(n)}function N(){b.classList.remove("lovely-chart--state-shown")}function z(){const{width:t,height:e}=m.getBoundingClientRect(),n=[t/2,e/2],o=Math.atan2(S-n[1],M-n[0]),i=Math.sqrt((M-n[0])**2+(S-n[1])**2);return{angle:o>=-Math.PI/2?o:2*Math.PI+o,distance:i}}return function(){m=y(),m.className="lovely-chart--tooltip",function(){const{canvas:t,context:e}=j(m,n);v=t,x=e}(),function(){b=y(),b.className="lovely-chart--tooltip-balloon"+(e.isZoomable?"":" lovely-chart--state-inactive"),b.innerHTML='
',e.isZoomable&&g(b,"click",$);m.appendChild(b)}(),"ontouchstart"in window?(g(m,"touchmove",E),g(m,"touchstart",E),g(document,"touchstart",C)):(g(m,"mousemove",E),g(m,"click",V),g(document,"mousemove",C));t.appendChild(m)}(),{update:function(t,e,n,o,i){r=t,c=e,h=n,f=o,p=i,X(!0)},toggleLoading:function(t){b.classList.toggle("lovely-chart--state-loading",t),t||H()},toggleIsZoomed:function(t){t!==P&&(A=!0),P=t,b.classList.toggle("lovely-chart--state-inactive",t)}}}function N(t){const{title:e,labelType:n,isStacked:i,isPercentage:l,hasSecondYAxis:s,onZoom:r}=t,{datasets:c,labels:d}=function(t){const{type:e,labels:n,datasets:o,hasSecondYAxis:i}=t;return{labels:z(n),datasets:o.map(({name:t,color:n,values:l},s)=>{const{min:r,max:c}=Object(a.b)(l);return{type:e,key:"y"+s,name:t,color:n,values:z(l),hasOwnYAxis:i&&s===o.length-1,yMin:r,yMax:c}})}}(t),u={};let h,f=1/0,p=-1/0;switch(c.forEach(({key:t,color:e,yMin:n,yMax:o})=>{u[t]=e,np&&(p=o)}),n){case"hour":h=function(t){return t.map(t=>{const e=new Date(t),n=e.getUTCHours(),o=e.getUTCMinutes();return{value:t,text:`${n<10?"0":""}${n}:${o<10?"0":""}${o}`}})}(d);break;case"text":h=function(t){return t.map((t,e)=>({value:e,text:t}))}(d);break;default:h=function(t){return t.map(t=>{const e=new Date(t);return{value:t,text:`${e.getDate()} ${o.p[e.getMonth()]}`}})}(d)}const m={title:e,labelType:n,xLabels:h,datasets:c,isStacked:i,isPercentage:l,hasSecondYAxis:s,onZoom:r,isLines:"line"===t.type,isBars:"bar"===t.type,isAreas:"area"===t.type,isPie:"pie"===t.type,yMin:f,yMax:p,colors:u};return m.shouldZoomToPie=!m.onZoom&&m.isPercentage,m.isZoomable=m.onZoom||m.shouldZoomToPie,m}function z(t){return t.slice(0)}function R(t,e,n,i,a,l,s,r,c){let d,u,h=!1;function f(e,f,p){r.toggleLoading(!1);const m=1/t.xLabels.length,y=f/(t.xLabels.length-1),g={};t.datasets.forEach(({key:t})=>g[t]=!1);const v=N(e,h||t.shouldZoomToPie),x=Object.keys(t.datasets).length!==Object.keys(v.datasets).length;i.update({range:{begin:y-m/2,end:y+m/2},filter:g}),setTimeout(()=>{Object.assign(t,v),x&&Object.assign(n,F(e.colors)),x&&(s.toggle(h),c.redraw(),a.style.width=a.scrollWidth+"px",a.style.height=a.scrollHeight+"px"),i.update({range:{begin:o.I-o.H,end:o.I+o.H},focusOn:null},!0);const r=1/(h||t.shouldZoomToPie?t.xLabels.length:t.xLabels.length/24)/2;let f,m;h?(f={begin:d.begin,end:d.end},m=x?d.filter:u.filter):x?(f={begin:0,end:1},m={},t.datasets.forEach(({key:t})=>m[t]=!0)):(f={begin:o.I-r,end:o.I+r},m=d.filter),i.update({range:f,filter:m,minimapDelta:h?null:f.end-f.begin}),p&&l.zoom(k(p)),h=!h,l.toggleIsZooming(!1)},i.hasAnimations()?o.J:0),setTimeout(()=>{t.shouldZoomToPie&&a.classList.remove("lovely-chart--state-animating")},i.hasAnimations()?1e3:0)}return{zoomIn:function(n,o){if(h)return;const i=t.xLabels[o];d=n,l.toggleIsZooming(!0),r.toggleLoading(!0),r.toggleIsZoomed(!0),t.shouldZoomToPie&&(a.classList.add("lovely-chart--state-zoomed-in"),a.classList.add("lovely-chart--state-animating"));const{value:s}=i;(t.shouldZoomToPie?Promise.resolve(function(t){return Object.assign({},e,{type:"pie",labels:e.labels.slice(t-3,t+4),datasets:e.datasets.map(e=>({...e,values:e.values.slice(t-3,t+4)}))})}(o)):t.onZoom(s)).then(t=>f(t,o,i))},zoomOut:function(n){if(!h)return;u=n,l.toggleIsZooming(!0),r.toggleLoading(!0),r.toggleIsZoomed(!1),t.shouldZoomToPie&&(a.classList.remove("lovely-chart--state-zoomed-in"),a.classList.add("lovely-chart--state-animating"));const o=Math.round((n.labelFromIndex+n.labelToIndex)/2);f(e,o)},isZoomed:function(){return h}}}(()=>{const t=[],e=Object(a.a)((function(){t.forEach(t=>{t.classList.remove("lovely-chart--state-invisible")})}),500,!0,!1),n=Object(a.a)((function(){t.forEach(t=>{const{top:e,bottom:n}=t.getBoundingClientRect(),o=n<0||e>window.innerHeight;t.classList.contains("lovely-chart--state-invisible")||(t.style.width=t.scrollWidth+"px",t.style.height=t.scrollHeight+"px"),t.classList.toggle("lovely-chart--state-invisible",o)})}),500,!1,!0)})();n(300);function U(t,e){let n,i,l,s,r,c,d,p,m,v,b,M,w=window.innerWidth;const S=N(e),T=F(S.colors),P=Object(a.a)((function(){Object.assign(S,N(e)),i.remove(),A()}),500,!1,!0);function A(){i=y(),i.className="lovely-chart--container"+(S.shouldZoomToPie?" lovely-chart--container-type-pie":""),t.appendChild(i),c=function(t,e,n){let o,i,l,s,r;const c=Object(a.f)(d,100,!1);function d(t){r||(s.innerHTML=t)}function u(){i=x(l,e,"lovely-chart--header-title",!0),n()}return o=y(),o.className="lovely-chart--header",i=y(),i.className="lovely-chart--header-title",i.innerHTML=e,o.appendChild(i),s=y(),s.className="lovely-chart--header-caption lovely-chart--position-right",o.appendChild(s),t.appendChild(o),{setCaption:c,zoom:function(t){l=x(i,"Zoom Out","lovely-chart--header-title lovely-chart--header-zoom-out-control"),setTimeout(()=>{g(l,"click",u)},500),d(t)},toggleIsZooming:function(t){r=t}}}(i,S.title,Z),function(){const{canvas:t,context:e}=j(i,{width:i.clientWidth,height:o.r});l=t,s=e,r={width:l.offsetWidth,height:l.offsetHeight}}(),n=f(S,r,O),d=$(s,S,r,T),p=B(i,S,T,I),m=Y(i,S,r,T,W,C),v=function(t,e,n){let o;function i(){o=y(),o.className="lovely-chart--tools",e.datasets.length<2&&(o.className+=" lovely-chart--state-hidden"),e.datasets.forEach(({key:t,name:n})=>{const i=y("a");i.href="#",i.dataset.key=t,i.className=`lovely-chart--button lovely-chart--color-${e.colors[t].slice(1)} lovely-chart--state-checked`,i.innerHTML=`${n}`,i.addEventListener("click",t=>{t.preventDefault(),i.dataset.clickPrevented||a(i),delete i.dataset.clickPrevented}),q(i,{onLongPress:()=>{i.dataset.clickPrevented="true",a(i,!0)}}),o.appendChild(i)}),t.appendChild(o)}function a(t,e=!1){const i=Array.from(o.getElementsByTagName("a")),a=1===o.querySelectorAll(".lovely-chart--state-checked").length;t&&(t.classList.contains("lovely-chart--state-checked")&&a?e?(i.forEach(t=>t.classList.add("lovely-chart--state-checked")),t.classList.remove("lovely-chart--state-checked")):(t.classList.remove("lovely-chart--state-shake"),requestAnimationFrame(()=>{t.classList.add("lovely-chart--state-shake")})):e?(i.forEach(t=>t.classList.remove("lovely-chart--state-checked")),t.classList.add("lovely-chart--state-checked")):t.classList.toggle("lovely-chart--state-checked"));const l={};i.forEach(t=>{l[t.dataset.key]=t.classList.contains("lovely-chart--state-checked")}),n(l)}return i(),a(),{redraw:function(){if(o){const t=o;t.classList.add("lovely-chart--state-hidden"),setTimeout(()=>{t.parentNode.removeChild(t)},500)}i(),o.classList.add("lovely-chart--state-transparent"),requestAnimationFrame(()=>{o.classList.remove("lovely-chart--state-transparent")})}}}(i,S,E),b=S.isZoomable&&R(S,e,T,n,i,c,p,m,v)}function O(t){M=t;const{datasets:e}=S,n={from:t.labelFromIndex,to:t.labelToIndex},i={begin:t.begin,end:t.end,totalXWidth:t.totalXWidth,yMin:t.yMinViewport,yMax:t.yMaxViewport,availableWidth:r.width,availableHeight:r.height-o.E,xPadding:o.h,yPadding:o.v},a=e.map(({key:e})=>t["opacity#"+e]),f=H(S,e,n,a,i),y=V(i);let g=null,v=null;if(S.hasSecondYAxis){const o=e.find(t=>t.hasOwnYAxis),i={yMin:t.yMinViewportSecond,yMax:t.yMaxViewportSecond};g=H(S,[o],n,a,i)[0],v=y.copy(i)}c.setCaption(function(t){let e,n;b&&b.isZoomed()?(e=0===t.labelFromIndex?0:t.labelFromIndex+1,n=t.labelToIndex===t.totalXWidth-1?t.labelToIndex:t.labelToIndex-1):(e=t.labelFromIndex,n=t.labelToIndex);return u(S.xLabels[e],S.xLabels[n])?L(S.xLabels[e])+" — "+L(S.xLabels[n]):k(S.xLabels[e])}(t)),D(l,s);const x=h(f.reduce((t,e)=>t+e.length,0))*o.y;X(s,t,S,n,f,y,g,v,o.s,a,T,!1,x),S.isPie||(d.drawYAxis(t,y,v),d.drawXAxis(t,y)),p.update(t),m.update(t,f,y,g,v)}function I(t){n.update({range:t})}function E(t){n.update({filter:t})}function C(t){(S.isBars||S.isPie)&&n.update({focusOn:t})}function W(t){b.zoomIn(M,t)}function Z(){b.zoomOut(M)}A(),document.documentElement.addEventListener("darkmode",()=>{n.update()}),window.addEventListener("resize",()=>{window.innerWidth!==w&&(w=window.innerWidth,P())}),window.addEventListener("orientationchange",()=>{P()})}}}]);