telegram-tt/dist/878.10fc2a2ac02923a134fa.js
Alexander Zinchuk 7d63a7f812 [Build]
2022-04-19 15:14:57 +02:00

2 lines
36 KiB
JavaScript

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[878],{8878:(t,e,n)=>{n.r(e),n.d(e,{create:()=>ut});const o=window.devicePixelRatio||1,a={begin:.8,end:1},i=300,l=10,s=.5,r="300 10px Helvetica, Arial, sans-serif",c=i,d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],h=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],f=["begin 200 fast","end 200 fast","labelFromIndex 200 fast floor","labelToIndex 200 fast ceil","xAxisScale 400","yMinViewport","yMaxViewport","yMinViewportSecond","yMaxViewportSecond","yMinMinimap","yMaxMinimap","yMinMinimapSecond","yMaxMinimapSecond","yAxisScale","yAxisScaleSecond"];function m(t){const e=t.length;let n=t[0],o=t[0];for(let a=0;a<e;a++){const e=t[a];e>n?n=e:e<o&&(o=e)}return{max:n,min:o}}function p(t){return[].concat.apply([],t)}function g(t){const e=[],n=t.length;for(let o=0,a=t[0].length;o<a;o++){e[o]=0;for(let a=0;a<n;a++)e[o]+=t[a][o]}return e}function y(t,e){return new Proxy({},{get:(n,o)=>void 0!==n[o]?n[o]:void 0!==e[o]?e[o]:t[o]})}function v(t,e){let n,o,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=null;return function(){n=!0;for(var l=arguments.length,s=new Array(l),r=0;r<l;r++)s[r]=arguments[r];o=s,i||(a&&(n=!1,t(...o)),i=window.setInterval((()=>{if(!n)return window.clearInterval(i),void(i=null);n=!1,t(...o)}),e))}}function x(t){let e,n=!1;return function(){for(var o=arguments.length,a=new Array(o),i=0;i<o;i++)a[i]=arguments[i];e=a,n||(n=!0,requestAnimationFrame((()=>{n=!1,t(...e)})))}}const M=[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 b(t){return M[t]||M[M.length-1]}function w(t,e,n){const o=Math.min(e+l,n-e);return o<=40&&(t=Math.min(1,t,o/40)),t}function k(t,e){return e-l<=20?Math.min(1,t,(e-l)/20):t}function S(t){return.45*Math.min(...t.getSize())}function L(t){return t>=1e3?Math.min(t/1e3,1):0}function F(t,e,n,o,a,i,l){const{begin:s,end:r}=n,c=t.xLabels.length-1,d=Math.max(0,Math.ceil(c*s)),u=Math.min(Math.floor(c*r),c),h=function(t,e,n){return o=(n-e)/Math.floor(t/45),Math.ceil(Math.log2(o||1));var o}(e.width,d,u),f=t.isStacked?function(t,e,n,o,a){const i=t.datasets.filter((t=>e[t.key])).map((t=>{let{values:e}=t;return e})),l=i.length?g(i):[],{max:s=a.yMaxMinimap}=m(l),{max:r=a.yMaxViewport}=m(l.slice(n,o+1));return{yMinViewport:0,yMaxViewport:r,yMinMinimap:0,yMaxMinimap:s}}(t,o,d,u,l):function(t,e,n,o,a){const i=t.hasSecondYAxis&&t.datasets.slice(-1)[0],l=t.datasets.filter((t=>e[t.key]&&t!==i)),s=T(t,n,o,a,l);if(i){const{yMinViewport:e,yMaxViewport:l,yMinMinimap:r,yMaxMinimap:c}=T(t,n,o,a,[i]);Object.assign(s,{yMinViewportSecond:e,yMaxViewportSecond:l,yMinMinimapSecond:r,yMaxMinimapSecond:c})}return s}(t,o,d,u,l),p=A(e.height,f.yMinViewport,f.yMaxViewport),y=t.hasSecondYAxis&&A(e.height,f.yMinViewportSecond,f.yMaxViewportSecond),v=b(p);if(f.yMinViewport-=f.yMinViewport%v,y){const t=b(y);f.yMinViewportSecond-=f.yMinViewportSecond%t}const x={};return t.datasets.forEach((t=>{let{key:e}=t;x[`opacity#${e}`]=o[e]?1:0})),Object.assign({totalXWidth:c,xAxisScale:h,yAxisScale:p,yAxisScaleSecond:y,labelFromIndex:Math.max(0,d-1),labelToIndex:Math.min(u+1,c),filter:Object.assign({},o),focusOn:void 0!==a?a:l.focusOn,minimapDelta:void 0!==i?i:l.minimapDelta},f,x,n)}function T(t,e,n,o,a){const{min:i=o.yMinMinimap,max:l=o.yMaxMinimap}=m(p(a.map((t=>{let{yMax:e,yMin:n}=t;return[e,n]})))),s=i/l>.1?i:0;let r,c;if(0===e&&n===t.xLabels.length-1)r=s,c=l;else{const t=m(p(a.map((t=>{let{values:e}=t;return e})).map((t=>t.slice(e,n+1))))),i=void 0!==t.min?t.min:o.yMinViewport;c=void 0!==t.max?t.max:o.yMaxViewport,r=i/c>.1?i:0}return{yMinViewport:r,yMaxViewport:c,yMinMinimap:s,yMaxMinimap:l}}function A(t,e,n){const o=t-30,a=n-e,i=Math.floor(o/50);return l=a/i,M.findIndex((t=>t>=l))||M.length-1;var l}const P=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div";return document.createElement(t)};function $(t,e,n){t.addEventListener(e,n)}function I(t,e,n){t.removeEventListener(e,n)}function V(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const a=t.parentNode;a.classList.add("lovely-chart--transition-container");const i=P(t.tagName);i.className=`${n} lovely-chart--transition lovely-chart--position-${o?"top":"bottom"} lovely-chart--state-hidden`,i.innerHTML=e;const l=n.length?`.${n.split(" ").join(".")}`:"",s=a.querySelectorAll(`${l}.lovely-chart--state-hidden`);return s.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"),a.insertBefore(i,t.nextSibling),C(i),O(t),i}function C(t){t.classList.remove("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-animated"),t.classList.remove("lovely-chart--state-hidden")}function O(t){t.classList.remove("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-animated"),t.classList.add("lovely-chart--state-hidden")}function E(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t>=1e6?W(t/1e6,e)+"M":t>=1e3?W(t/1e3,e)+"K":t}function W(t,e){return t.toFixed(e).replace(/(\d{3,})\.\d+/,"$1").replace(/\.0+$/,"")}function D(t){return String(t).replace(/\d(?=(\d{3})+$)/g,"$& ")}function Z(t){let{isShort:e=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return H(t,{isShort:e,displayWeekDay:!0})}function H(t){let{isShort:e=!1,displayWeekDay:n=!1,displayYear:o=!0,displayHours:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{value:i}=t,l=new Date(i),s=e?h:u;let r=`${l.getUTCDate()} ${d[l.getUTCMonth()]}`;return n&&(r=`${s[l.getUTCDay()]}, `+r),o&&(r+=` ${l.getUTCFullYear()}`),a&&(r+=`, ${("0"+l.getUTCHours()).slice(-2)}:${("0"+l.getUTCMinutes()).slice(-2)}`),r}function X(){return document.documentElement.classList.contains("theme-dark")?"skin-night":"skin-day"}let z=X();const N={"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"}},R=document.createElement("style");R.type="text/css",R.appendChild(document.createTextNode("")),document.head.appendChild(R);const Y=R.sheet;function B(t){const e={},n=".lovely-chart--color";return["skin-day","skin-night"].forEach((o=>{e[o]={},Object.keys(N[o]).forEach((t=>{e[o][t]=q(N[o][t])})),Object.keys(t).forEach((a=>{e[o][`dataset#${a}`]=q(t[a]),U(Y,`.lovely-chart--tooltip-dataset-value${n}-${t[a].slice(1)}`,`color: ${t[a]}`),U(Y,`.lovely-chart--button${n}-${t[a].slice(1)}`,`border-color: ${t[a]}; color: ${t[a]}`),U(Y,`.lovely-chart--button.lovely-chart--state-checked${n}-${t[a].slice(1)}`,`background-color: ${t[a]}`)}))})),e}function j(t,e,n){return function(t){let[e,n,o,a=1]=t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return`rgba(${e}, ${n}, ${o}, ${a*i})`}(t[z][e],n)}function q(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 U(t,e,n){t.insertRule(`${e} { ${n} }`,t.cssRules.length)}function J(t){const{begin:e,end:n,totalXWidth:o,yMin:a,yMax:i,availableWidth:l,availableHeight:s,xPadding:r=0,yPadding:c=0}=t;let d=l;0===e&&(d-=r),1===n&&(d-=r);const u=d/((n-e)*o);let h=e*o*u;0===e&&(h-=r);const f=s-c,m=f/(i-a),p=a*m;return{findClosestLabelIndex:function(t){return Math.round((t+h)/u)},copy:function(e,n){return J(y(t,e))},getCenter:function(){return[l/2,s-f/2]},getSize:function(){return[l,f]},getParams:function(){return t},getState:function(){return{xFactor:u,xOffsetPx:h,availableHeight:s,yFactor:m,yOffsetPx:p}}}}function _(t,e,n){const{xFactor:o,xOffsetPx:a,availableHeight:i,yFactor:l,yOffsetPx:s}=t.getState();return[e*o-a,i-(n*l-s)]}function K(t,e){let{width:n,height:a}=e;const i=P("canvas");i.width=n*o,i.height=a*o,i.style.width="100%",i.style.height=`${a}px`;const l=i.getContext("2d");return l.scale(o,o),t.appendChild(i),{canvas:i,context:l}}function G(t,e){e.clearRect(0,0,t.width,t.height)}function Q(t,e,n,o,a,i){let l=e.map((t=>{let{values:e}=t;return e.slice(n.from,n.to+1)}));t.isPie&&!i&&(l=function(t){return t.map((t=>[t.reduce(((t,e)=>t+e),0)]))}(l));const s=l.map(((e,a)=>e.map(((e,i)=>{let l=e;return t.isStacked&&(l*=o[a]),{labelIndex:n.from+i,value:e,visibleValue:l,stackOffset:0,stackValue:l}}))));return t.isPercentage&&function(t,e){const n=function(t){return g(t.map((t=>t.map((t=>{let{visibleValue:e}=t;return e})))))}(t);t.forEach((t=>{t.forEach(((t,o)=>{t.percent=t.visibleValue/n[o],t.visibleValue=t.percent*e.yMax}))}))}(s,a),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]}))}))}(s),s}document.documentElement.addEventListener("darkmode",(()=>{z=X()}));const tt=(()=>{let t=1/Math.pow(2,22),e=1e5;function n(t,e,n,o,a){let i,l=+e[0],s=+e[1];i=+((t[0]-l)*o[0]+(t[1]-s)*o[1])*a,i>1?(l=+n[0],s=+n[1]):i>0&&(l+=+o[0]*i,s+=+o[1]*i);let r=+t[0]-l,c=+t[1]-s;return+r*r+c*c}return function(o,a,i){if(o.length<6)return function(){return{points:o,indexes:a,removed:[]}};let l=function(o,a){let i,l=o.length,s=[],r=[];for(let t=0,e=o.length;t<e;++t)s[t]=0;a||(a=[]);let c=0;for(let t=0,n=a.length;t<n;++t)s[a[t]]=e;function d(){let l=r.pop(),c=function(l){let c=l.start,d=l.end,u=l.record,h=l.currentLimit,f=0;if(!u){let i=-1,l=[o[d][0]-o[c][0],o[d][1]-o[c][1]];for(let t=0,n=a.length;t<n;++t){let n=a[t];if(n>c){if(n<d){i=n,f=e;break}break}}if(i<0){if(Math.abs(l[0])>t||Math.abs(l[1])>t){let t=1/(l[0]*l[0]+l[1]*l[1]);for(let e=c+1;e<d;++e){let a=n(o[e],o[c],o[d],l,t);a>f&&(i=e,f=a)}}else i=Math.round(.5*(c+d)),f=h;s[i]=f}u={start:c,end:d,index:i,distance:f}}return u.index&&u.distance>i&&(u.index-c>=2&&r.push({start:c,end:u.index,record:u.left,currentLimit:u.distance,parent:u,parentProperty:"left"}),d-u.index>=2&&r.push({start:u.index,end:d,record:u.right,currentLimit:u.distance,parent:u,parentProperty:"right"})),u}(l);return l.parent&&l.parentProperty&&(l.parent[l.parentProperty]=c),c}return function(t){for(i=t,r.push({start:0,end:l-1,record:c,currentLimit:e}),c=d();r.length;)d();return s}}(o,i);return function(t){let e=[],n=[],i=[],s=t*t,r=l(s);for(let t=0,l=o.length;t<l;t++)r[t]>=s||0==t||t==l-1?(e.push(o[t]),n.push(a?a[t]:t)):i.push(t);return{points:e,indexes:n,removed:i}}}})();function et(t,e,n,o,a,i,l,r,c,d,u,h,f){if(n.datasets.forEach(((s,m)=>{let{key:g,type:y,hasOwnYAxis:v}=s;if(!d[m])return;const x={color:j(u,`dataset#${g}`),lineWidth:c,opacity:n.isStacked?1:d[m],simplification:f},M="pie"===y&&h?"bar":y;let b=v?l:a[m],w=v?r:i;if("area"===M){const{yMin:t,yMax:e}=i.getParams(),n=e-t,l=[{labelIndex:o.from,stackValue:0},{labelIndex:o.to,stackValue:0}],s=[{labelIndex:o.to,stackValue:n},{labelIndex:o.from,stackValue:n}];b=p([a[m-1]||l,s])}if("pie"===M&&(x.center=i.getCenter(),x.radius=S(i),x.pointerVector=e.focusOn),"bar"===M){const[t]=_(i,0,0),[n]=_(i,1,0);x.lineWidth=n-t,x.focusOn=e.focusOn}!function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),o=1;o<e;o++)n[o-1]=arguments[o];switch(t){case"line":return nt(...n);case"bar":return ot(...n);case"step":return at(...n);case"area":return it(...n);case"pie":lt(...n)}}(M,t,b,w,x)})),e.focusOn&&(n.isBars||n.isSteps)){const[o]=_(i,0,0),[a]=_(i,1,0);!function(t,e,n){const[o,a]=e.getCenter(),[i,l]=e.getSize(),[r]=_(e,n.focusOn,0);t.fillStyle=n.color,t.fillRect(o-i/2,a-l/2,r-n.lineWidth/2+s,l),t.fillRect(r+n.lineWidth/2,a-l/2,i-(r+n.lineWidth/2),l)}(t,i,{focusOn:e.focusOn,color:j(u,"mask"),lineWidth:n.isSteps?a-o+c:a-o})}}function nt(t,e,n,o){t.beginPath();let a=[];for(let t=0,o=e.length;t<o;t++){const{labelIndex:o,stackValue:i}=e[t];a.push(_(n,o,i))}o.simplification&&(a=tt(a)(o.simplification).points),a.forEach((e=>{let[n,o]=e;t.lineTo(n,o)})),t.save(),t.strokeStyle=o.color,t.lineWidth=o.lineWidth,t.globalAlpha=o.opacity,t.lineJoin="bevel",t.lineCap="butt",t.stroke(),t.restore()}function ot(t,e,n,o){const{yMin:a}=n.getParams();t.save(),t.globalAlpha=o.opacity,t.fillStyle=o.color;for(let i=0,l=e.length;i<l;i++){const{labelIndex:l,stackValue:r,stackOffset:c=0}=e[i],[,d]=_(n,l,Math.max(c,a)),[u,h]=_(n,l,r),f=u-o.lineWidth/2,m=h,p=1===o.opacity?o.lineWidth+s:o.lineWidth+s*o.opacity,g=d-h;t.fillRect(f,m,p,g)}t.restore()}function at(t,e,n,o){t.beginPath();let a=[];for(let t=0,o=e.length;t<o;t++){const{labelIndex:o,stackValue:i}=e[t];a.push(_(n,o-s,i),_(n,o+s,i))}a.forEach((e=>{let[n,o]=e;t.lineTo(n,o)})),t.save(),t.strokeStyle=o.color,t.lineWidth=o.lineWidth,t.globalAlpha=o.opacity,t.stroke(),t.restore()}function it(t,e,n,o){t.beginPath();let a=[];for(let t=0,o=e.length;t<o;t++){const{labelIndex:o,stackValue:i}=e[t];a.push(_(n,o,i))}o.simplification&&(a=tt(a)(o.simplification).points),a.forEach((e=>{let[n,o]=e;t.lineTo(n,o)})),t.save(),t.fillStyle=o.color,t.lineWidth=o.lineWidth,t.globalAlpha=o.opacity,t.lineJoin="bevel",t.lineCap="butt",t.fill(),t.restore()}function lt(t,e,n,o){const{visibleValue:a,stackValue:i,stackOffset:l=0}=e[0];if(!a)return;const{yMin:s,yMax:r}=n.getParams(),c=1/(r-s),d=a*c,u=l*c*Math.PI*2-Math.PI/2,h=i*c*Math.PI*2-Math.PI/2,{radius:f=120,center:[m,p],pointerVector:g}=o,y=g&&u<=g.angle&&g.angle<h&&g.distance<=f?10:0,v=(u+h)/2,x=Math.cos(v),M=Math.sin(v),b=x*y,w=M*y;if(t.save(),t.beginPath(),t.fillStyle=o.color,t.moveTo(m+b,p+w),t.arc(m+b,p+w,f,u,h),t.lineTo(m+b,p+w),t.fill(),d>=.02){t.font=`700 ${function(t,e){return(e+200*t)/10}(d,f)}px Helvetica, Arial, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle="white";const e=function(t,e,n){return t>=.99?0:Math.min(1-Math.log(30*t)/5,.8)*e}(d,f);t.fillText(`${Math.round(100*d)}%`,m+x*e+b,p+M*e+w)}t.restore()}function st(t,e){let n=null,o=null;function a(t){n=t,"mousedown"===t.type?($(document,"mousemove",l),$(document,"mouseup",i)):"touchstart"===t.type&&($(document,"touchmove",l),$(document,"touchend",i),$(document,"touchcancel",i),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&&(o=setTimeout((()=>e.onLongPress()),500))}function i(t){n&&(o&&(clearTimeout(o),o=null),e.draggingCursor&&document.documentElement.classList.remove(`cursor-${e.draggingCursor}`),I(document,"mouseup",i),I(document,"mousemove",l),I(document,"touchcancel",i),I(document,"touchend",i),I(document,"touchmove",l),n=null,e.onRelease&&e.onRelease(t))}function l(t){n&&(o&&(clearTimeout(o),o=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}))}$(t,"mousedown",a),$(t,"touchstart",a)}function rt(t,e,n,o,a,i){let l,s,r,c,d,u,h,f,m,p,g,y=null,M=!1,b=!1;const w=x(C),k=v(E,100,!0,!0);function L(t){if(t.target===m||m.contains(t.target)||y)return;b=!1;const e=u.getBoundingClientRect();p=(t.touches?t.touches[0].clientX:t.clientX)-e.left,g=(t.touches?t.touches[0].clientY:t.clientY)-e.top,w()}function F(t){null===p||t.target===u||u.contains(t.target)||I()}function T(t){if(!b&&e.isZoomable){const e=y;y=null,L(t);const n=V();n!==e&&(y=n),a(n)}}function A(){if(m.classList.contains("lovely-chart--state-inactive"))return;const t=r.findClosestLabelIndex(p);a(t)}function I(t){p=null,y=null,G(h,f),W(),!t&&i&&i(null)}function V(){const t=r.findClosestLabelIndex(p);return t<l.labelFromIndex||t>l.labelToIndex?null:t}function C(a){if(!p||!l||b)return;const u=V();if(null===u)return void I(a);const y=Z(),v=!e.isPie||y.distance<=S(r);function x(t,n){return e.isPie?t.slice(l.labelFromIndex,l.labelToIndex+1).reduce(((t,e)=>t+e),0):t[n]}!a&&i&&(e.isPie?i(y):i(u));const[M]=_(r,u,0),w=e.datasets.map(((t,e)=>{let{key:n,name:o,values:a,hasOwnYAxis:i}=t;return{key:n,name:o,value:x(a,u),hasOwnYAxis:i,originalIndex:e}})).filter((t=>{let{key:e}=t;return l.filter[e]}));w.length&&v?function(n,o){m.style.transform=`translate3D(${function(n){const o=(l.labelFromIndex+l.labelToIndex)/2,{angle:a}=Z(),i=(e.isPie?a>Math.PI/2:n<o)?p+20:p-(m.offsetWidth+20);return Math.min(Math.max(0,i),t.offsetWidth-m.offsetWidth)}(o)}px, ${e.isPie?`${g}px`:0}, 0)`,m.classList.add("lovely-chart--state-shown"),e.isPie?E(null,n):k(function(t,e){switch(t.tooltipFormatter){case"statsFormatDayHourFull":return`${t.xLabels[e].value}:00`;case"statsTooltipFormat('day')":return H(t.xLabels[e]);case"statsTooltipFormat('hour')":case"statsTooltipFormat('5min')":return n=t.xLabels[e],new Date(n.value).toString().match(/(\d+:\d+):/)[1];default:return t.xLabels[e].text}var n}(e,o),n)}(w,u):W(),G(h,f),(e.isLines||e.isAreas)&&(e.isLines&&function(t,e){t.forEach((t=>{let{value:n,key:a,hasOwnYAxis:i,originalIndex:u}=t;const h=e-l.labelFromIndex,m=i?c[h]:s[u][h];if(!m)return;const[p,g]=_(i?d:r,e,m.stackValue);!function(t,e,n){let[o,a]=t;f.strokeStyle=e,f.fillStyle=n,f.lineWidth=2,f.beginPath(),f.arc(o,a,4,0,2*Math.PI),f.fill(),f.stroke()}([p,g],j(o,`dataset#${a}`),j(o,"background"))}))}(w,u),function(t,e,n){f.strokeStyle=n,f.lineWidth=1,f.beginPath(),f.moveTo(t,0),f.lineTo(t,e),f.stroke()}(M,n.height-30,j(o,"grid-lines")))}function O(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 a=o?Math.round(n/o*100):0,i=t.querySelector(".lovely-chart--percentage-title:not(.lovely-chart--state-hidden)");if(i)i.innerHTML=`${a}%`;else{const e=P("span");e.className="lovely-chart--percentage-title lovely-chart--position-left",e.innerHTML=`${a}%`,t.prepend(e)}}function E(t,n){!function(t){const n=m.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=`<span>${t}</span>`}}(t),function(t){const n=m.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),a=Z(),i=e.isPie?t.filter(((e,n)=>{let{value:i}=e;return function(t,e,n,o,a){const i=o>0?t.slice(0,o).reduce(((t,e)=>t+e.value),0):0,l=i/n*Math.PI*2-Math.PI/2,s=(i+e)/n*Math.PI*2-Math.PI/2;return a&&l<=a.angle&&a.angle<s&&a.distance<=S(r)}(t,i,o,n,a)})):t;i.forEach((t=>{const a=n.querySelector(`[data-name="${t.name}"]`);a?function(t){let{key:n,value:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0;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=D(o),O(t,o,a)}(a,t,o):function(t,n,o){let{name:a,key:i,value:l}=n;const s=`lovely-chart--tooltip-dataset-value lovely-chart--position-right lovely-chart--color-${e.colors[i].slice(1)}`,r=P();r.className="lovely-chart--tooltip-dataset",r.setAttribute("data-present","true"),r.setAttribute("data-name",a),r.innerHTML=`<span class="lovely-chart--dataset-title">${a}</span><span class="${s}">${D(l)}</span>`,O(r,l,o);const c=t.querySelector('[data-total="true"]');c?t.insertBefore(r,c):t.appendChild(r)}(n,t,o)})),(e.isBars||e.isSteps)&&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=P();n.className="lovely-chart--tooltip-dataset",n.setAttribute("data-present","true"),n.setAttribute("data-total","true"),n.innerHTML=`<span>All</span><span class="lovely-chart--tooltip-dataset-value lovely-chart--position-right">${e}</span>`,t.appendChild(n)}}(n,D(o)),Array.from(n.querySelectorAll('[data-present="false"]')).forEach((t=>{t.remove()}))}(n)}function W(){m.classList.remove("lovely-chart--state-shown")}function Z(){const{width:t,height:e}=u.getBoundingClientRect(),n=[t/2,e/2],o=Math.atan2(g-n[1],p-n[0]),a=Math.sqrt((p-n[0])**2+(g-n[1])**2);return{angle:o>=-Math.PI/2?o:2*Math.PI+o,distance:a}}return u=P(),u.className="lovely-chart--tooltip",function(){const{canvas:t,context:e}=K(u,n);h=t,f=e}(),m=P(),m.className="lovely-chart--tooltip-balloon"+(e.isZoomable?"":" lovely-chart--state-inactive"),m.innerHTML='<div class="lovely-chart--tooltip-title"></div><div class="lovely-chart--tooltip-legend"></div><div class="lovely-chart--spinner"></div>',"ontouchstart"in window&&e.isZoomable&&$(m,"click",A),u.appendChild(m),"ontouchstart"in window?($(u,"touchmove",L),$(u,"touchstart",L),$(document,"touchstart",F)):($(u,"mousemove",L),$(u,"click",T),$(document,"mousemove",F)),t.appendChild(u),{update:function(t,e,n,o,a){l=t,s=e,r=n,c=o,d=a,C(!0)},toggleLoading:function(t){m.classList.toggle("lovely-chart--state-loading",t),t||I()},toggleIsZoomed:function(t){t!==M&&(b=!0),M=t,m.classList.toggle("lovely-chart--state-inactive",t)}}}function ct(t){const{title:e,labelFormatter:n,tooltipFormatter:o,isStacked:a,isPercentage:i,hasSecondYAxis:l,onZoom:s,minimapRange:r,hideCaption:c,zoomOutLabel:u}=t,{datasets:h,labels:f}=function(t){const{type:e,labels:n,datasets:o,hasSecondYAxis:a}=t;return{labels:dt(n),datasets:o.map(((t,n)=>{let{name:i,color:l,values:s}=t;const{min:r,max:c}=m(s);return{type:e,key:`y${n}`,name:i,color:l,values:dt(s),hasOwnYAxis:a&&n===o.length-1,yMin:r,yMax:c}}))}}(t),p={};let g,y=1/0,v=-1/0;switch(h.forEach((t=>{let{key:e,color:n,yMin:o,yMax:a}=t;p[e]=n,o<y&&(y=o),a>v&&(v=a)})),n){case"statsFormatDayHour":g=function(t){return t.map((t=>({value:t,text:`${t}:00`})))}(f);break;case"statsFormat('day')":g=function(t){return t.map((t=>{const e=new Date(t);return{value:t,text:`${e.getDate()} ${d[e.getMonth()]}`}}))}(f);break;case"statsFormat('hour')":case"statsFormat('5min')":g=function(t){return t.map((t=>({value:t,text:new Date(t).toString().match(/(\d+:\d+):/)[1]})))}(f);break;default:g=function(t){return t.map(((t,e)=>({value:e,text:t})))}(f)}const x={title:e,labelFormatter:n,tooltipFormatter:o,xLabels:g,datasets:h,isStacked:a,isPercentage:i,hasSecondYAxis:l,onZoom:s,isLines:"line"===t.type,isBars:"bar"===t.type,isSteps:"step"===t.type,isAreas:"area"===t.type,isPie:"pie"===t.type,yMin:y,yMax:v,colors:p,minimapRange:r,hideCaption:c,zoomOutLabel:u};return x.shouldZoomToPie=!x.onZoom&&x.isPercentage,x.isZoomable=x.onZoom||x.shouldZoomToPie,x}function dt(t){return t.slice(0)}function ut(t,e){let n,o,s,d,u,h,m,g,M,S,T,A,I=window.innerWidth;const C=ct(e),O=B(C.colors),W=function(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=null;return function(){a?(clearTimeout(a),a=null):n&&t(),a=setTimeout((()=>{o&&t(),a=null}),e)}}((function(){Object.assign(C,ct(e)),o.remove(),D()}),500,!1,!0);function D(){o=P(),o.className="lovely-chart--container"+(C.shouldZoomToPie?" lovely-chart--container-type-pie":""),t.appendChild(o),h=function(t,e){let n,o,a,i,l,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"Zoom out",r=arguments.length>3?arguments[3]:void 0;const c=v(d,100,!1);function d(t){l||(i.innerHTML=t)}function u(t){a=V(o,s,"lovely-chart--header-title lovely-chart--header-zoom-out-control"),setTimeout((()=>{$(a,"click",m)}),500),d(t)}function h(t){l=t}function f(){n=P(),n.className="lovely-chart--header",o=P(),o.className="lovely-chart--header-title",o.innerHTML=e,n.appendChild(o),i=P(),i.className="lovely-chart--header-caption lovely-chart--position-right",n.appendChild(i),t.appendChild(n)}function m(){o=V(a,e,"lovely-chart--header-title",!0),o.classList.remove("lovely-chart--transition"),r()}return f(),{setCaption:c,zoom:u,toggleIsZooming:h}}(o,C.title,C.zoomOutLabel,q),function(){const{canvas:t,context:e}=K(o,{width:o.clientWidth,height:320});s=t,d=e,u={width:s.offsetWidth,height:s.offsetHeight}}(),n=function(t,e,n){const o={begin:0,end:1},a=function(){const e={};return t.datasets.forEach((t=>{let{key:n}=t;e[n]=!0})),e}(),l=function(){const e=[],n=t.datasets.map((t=>{let{key:e}=t;return`opacity#${e} 300`}));return p([f,n]).forEach((t=>{const[n,o,...a]=t.split(" ");e.push({prop:n,duration:o,options:a})})),e}(),s=function(t){const e={};let n=null,o=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>=4)}function h(){const r=!u();!o||Date.now()-o>=200?(l&&(a=l,s||u(!0)||(s=Date.now())),o=Date.now(),l=0):l++;const f={};Object.keys(e).forEach((t=>{const{startedAt:n,from:o,to:a,duration:l=i,options:s}=e[t],r=Math.min(1,(Date.now()-n)/l);let d=o+(a-o)*(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,a,i,c,d){e[t]={from:a,to:i,duration:c,options:d,current:a,startedAt:Date.now(),progress:0},n||(o=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:a,to:i,progress:l}=e[n];t[n]=o,t[`${n}From`]=a,t[`${n}To`]=i,t[`${n}Progress`]=l})),t},isRunning:d,isFast:u}}(d),r=x(d);let c={};function d(){const t=s.isFast()?y(c,s.getState()):c;t.static=c,n(t)}return{update:function(){let{range:n={},filter:i={},focusOn:d,minimapDelta:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h=arguments.length>1?arguments[1]:void 0;Object.assign(o,n),Object.assign(a,i);const f=c;c=F(t,e,o,a,d,u,f),h||l.forEach((t=>{let{prop:e,duration:n,options:o}=t;const a=s.get(e),i=a?a.to:f[e];if(void 0!==i&&i!==c[e]){const t=a?o.includes("fast")?f[e]:a.current:f[e];a&&s.remove(e),s.add(e,t,c[e],n,o)}})),s.isRunning()&&s.isFast()||r()},hasAnimations:function(){return s.isFast()}}}(C,u,X),m=function(t,e,n,o){function a(e,a,i,s,c){let d=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,h=arguments.length>7&&void 0!==arguments[7]&&arguments[7];const f=b(i),m=Math.ceil(s/f)*f,p=Math.floor(c/f)*f;t.font=r,t.textAlign=h?"right":"left",t.textBaseline="bottom",t.lineWidth=1,t.beginPath();for(let e=m;e<=p;e+=f){const[,i]=_(a,0,e),s=k(d,i);t.fillStyle=j(o,u||"y-axis-text",s),h?t.fillText(E(e),n.width-l,i-5):t.fillText(E(e),l,i-5),h?(t.strokeStyle=j(o,u,d),t.moveTo(n.width-l,i),t.lineTo(n.width-20,i)):(t.moveTo(l,i),t.strokeStyle=j(o,"grid-lines",d),t.lineTo(n.width-l,i))}t.stroke()}return{drawXAxis:function(a,i){t.clearRect(0,n.height-30+1,n.width,31);const l=n.height-15,s=Math.floor(a.xAxisScale),c=function(t){return Math.pow(2,t)}(s),d=1-(a.xAxisScale-s);t.font=r,t.textAlign="center",t.textBaseline="middle";for(let s=a.labelFromIndex;s<=a.labelToIndex;s++){const a=s-1;if(a%c!=0)continue;const r=e.xLabels[s],[u]=_(i,s,0);let h=a%(2*c)==0?1:d;h=w(h,u,n.width),t.fillStyle=j(o,"x-axis-text",h),t.fillText(r.text,u,l)}},drawYAxis:function(i,s,c){const{yAxisScale:d,yAxisScaleFrom:u,yAxisScaleTo:h,yAxisScaleProgress:f=0,yMinViewport:m,yMinViewportFrom:p,yMinViewportTo:g,yMaxViewport:y,yMaxViewportFrom:v,yMaxViewportTo:x,yMinViewportSecond:M,yMinViewportSecondFrom:b,yMinViewportSecondTo:w,yMaxViewportSecond:k,yMaxViewportSecondFrom:S,yMaxViewportSecondTo:L}=i,F=c&&`dataset#${e.datasets[0].key}`,T=void 0!==p||void 0!==v;if(e.isPercentage?function(e){const[,a]=e.getSize();t.font=r,t.textAlign="left",t.textBaseline="bottom",t.lineWidth=1,t.beginPath(),[0,.25,.5,.75,1].forEach((e=>{const i=a-a*e+15;t.fillStyle=j(o,"y-axis-text",1),t.fillText(100*e+"%",l,i-2.5),t.moveTo(l,i),t.strokeStyle=j(o,"grid-lines",1),t.lineTo(n.width-l,i)})),t.stroke()}(s):a(i,s,Math.round(h||d),void 0!==g?g:m,void 0!==x?x:y,u?f:1,F),f>0&&T&&a(i,s,Math.round(u),void 0!==p?p:m,void 0!==v?v:y,1-f,F),c){const{yAxisScaleSecond:t,yAxisScaleSecondFrom:n,yAxisScaleSecondTo:o,yAxisScaleSecondProgress:l=0}=i,s=`dataset#${e.datasets[e.datasets.length-1].key}`,r=void 0!==b||void 0!==S;a(i,c,Math.round(o||t),void 0!==w?w:M,void 0!==L?L:k,n?l:1,s,!0),l>0&&r&&a(i,c,Math.round(n),void 0!==b?b:M,void 0!==S?S:k,1-l,s,!0)}}}}(d,C,u,O),g=function(t,e,n,o){let i,l,s,r,c,d,u,h,f={};const m=x((function(){const{begin:t,end:e}=f;c.children[0].style.width=100*t+"%",c.children[1].style.width=100*(e-t)+"%",c.children[2].style.width=100*(1-e)+"%"}));function p(t){t.preventDefault(),u=t.target.offsetLeft}function g(){u=null}function v(t,e){let n=Object.assign({},f,t);h&&h.minimapDelta&&!e&&(n=function(t){return{begin:Math.round(t.begin/h.minimapDelta)*h.minimapDelta,end:Math.round(t.end/h.minimapDelta)*h.minimapDelta}}(n)),n.begin===f.begin&&n.end===f.end||(f=n,m(),e||o(f))}return i=P(),i.className="lovely-chart--minimap",i.style.height="40px",function(){const{canvas:e,context:n}=K(i,{width:t.offsetWidth-20,height:40});l=e,s=n}(),c=P(),c.className="lovely-chart--minimap-ruler",c.innerHTML='<div class="lovely-chart--minimap-mask"></div><div class="lovely-chart--minimap-slider"><div class="lovely-chart--minimap-slider-handle"><span class="lovely-chart--minimap-slider-handle-pin"></span></div><div class="lovely-chart--minimap-slider-inner"></div><div class="lovely-chart--minimap-slider-handle"><span class="lovely-chart--minimap-slider-handle-pin"></span></div></div><div class="lovely-chart--minimap-mask"></div>',d=c.children[1],st(d.children[1],{onCapture:p,onDrag:function(t,e,n){let{dragOffsetX:o}=n;const a=r.width-d.offsetWidth,i=Math.max(0,Math.min(u+o-8,a)),l=i+d.offsetWidth;v({begin:i/r.width,end:l/r.width})},onRelease:g,draggingCursor:"grabbing"}),st(d.children[0],{onCapture:p,onDrag:function(t,e,n){let{dragOffsetX:o}=n;const a=d.offsetLeft+d.offsetWidth-16;v({begin:Math.min(a,Math.max(0,u+o))/r.width})},onRelease:g,draggingCursor:"ew-resize"}),st(d.children[2],{onCapture:p,onDrag:function(t,e,n){let{dragOffsetX:o}=n;const a=d.offsetLeft+16,i=r.width;v({end:Math.max(a,Math.min(u+8+o,i))/r.width})},onRelease:g,draggingCursor:"ew-resize"}),i.appendChild(c),t.appendChild(i),r={width:l.offsetWidth,height:l.offsetHeight},v(e.minimapRange||a),{update:function(t){const{begin:o,end:a}=t;u||v({begin:o,end:a},!0),e.datasets.length>=4&&(t=t.static),function(t){if(!h)return!0;const{datasets:n}=e;return!!n.some((e=>{let{key:n}=e;return h[`opacity#${n}`]!==t[`opacity#${n}`]}))||h.yMaxMinimap!==t.yMaxMinimap}(t)&&(h=y(t,{focusOn:null}),G(l,s),function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{datasets:o}=e,a={from:0,to:t.totalXWidth},i={begin:0,end:1,totalXWidth:t.totalXWidth,yMin:t.yMinMinimap,yMax:t.yMaxMinimap,availableWidth:r.width,availableHeight:r.height,yPadding:1},l=o.map((t=>{let{key:e}=t;return h[`opacity#${e}`]})),c=Q(e,o,a,l,i,!0),d=J(i);let u=null,f=null;if(e.hasSecondYAxis){const n=o.find((t=>t.hasOwnYAxis)),i={yMin:t.yMinMinimapSecond,yMax:t.yMaxMinimapSecond};u=Q(e,[n],a,l,i)[0],f=d.copy(i)}const m=.5*L(c.reduce(((t,e)=>t+e.length),0));et(s,t,e,a,c,d,u,f,1,l,n,!0,m)}(h))},toggle:function(t){i.classList.toggle("lovely-chart--state-hidden",!t),requestAnimationFrame((()=>{i.classList.toggle("lovely-chart--state-transparent",!t)}))}}}(o,C,O,z),M=rt(o,C,u,O,Y,R),S=function(t,e,n){let o;function a(){o=P(),o.className="lovely-chart--tools",e.datasets.length<2&&(o.className+=" lovely-chart--state-hidden"),e.datasets.forEach((t=>{let{key:n,name:a}=t;const l=P("a");l.href="#",l.dataset.key=n,l.className=`lovely-chart--button lovely-chart--color-${e.colors[n].slice(1)} lovely-chart--state-checked`,l.innerHTML=`<span class="lovely-chart--button-check"></span><span class="lovely-chart--button-label">${a}</span>`,l.addEventListener("click",(t=>{t.preventDefault(),l.dataset.clickPrevented||i(l),delete l.dataset.clickPrevented})),st(l,{onLongPress:()=>{l.dataset.clickPrevented="true",i(l,!0)}}),o.appendChild(l)})),t.appendChild(o)}function i(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const a=Array.from(o.getElementsByTagName("a")),i=1===o.querySelectorAll(".lovely-chart--state-checked").length;t&&(t.classList.contains("lovely-chart--state-checked")&&i?e?(a.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?(a.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={};a.forEach((t=>{l[t.dataset.key]=t.classList.contains("lovely-chart--state-checked")})),n(l)}return a(),i(),{redraw:function(){if(o){const t=o;t.classList.add("lovely-chart--state-hidden"),setTimeout((()=>{t.parentNode.removeChild(t)}),500)}a(),o.classList.add("lovely-chart--state-transparent"),requestAnimationFrame((()=>{o.classList.remove("lovely-chart--state-transparent")}))}}}(o,C,N),T=C.isZoomable&&function(t,e,n,o,a,i,l,s,r){let d,u,h=!1;function f(e,f,m){if(!e)return s.toggleLoading(!1),s.toggleIsZoomed(!1),void i.toggleIsZooming(!1);s.toggleLoading(!1);const p=1/t.xLabels.length,g=f/(t.xLabels.length-1),y={};t.datasets.forEach((t=>{let{key:e}=t;return y[e]=!1}));const v=ct(e,h||t.shouldZoomToPie),x=Object.keys(t.datasets).length!==Object.keys(v.datasets).length;o.update({range:{begin:g-p/2,end:g+p/2},filter:y}),setTimeout((()=>{Object.assign(t,v),x&&e.colors&&Object.assign(n,B(e.colors)),x&&(l.toggle(h),r.redraw(),a.style.width=`${a.scrollWidth}px`,a.style.height=`${a.scrollHeight}px`),o.update({range:{begin:.4,end:.6},focusOn:null},!0);const s=1/(h||t.shouldZoomToPie?t.xLabels.length:t.xLabels.length/24)/2;let c,f;h?(c={begin:d.begin,end:d.end},f=x?d.filter:u.filter):x?(c={begin:0,end:1},f={},t.datasets.forEach((t=>{let{key:e}=t;return f[e]=!0}))):(c=t.shouldZoomToPie?{begin:.5-s,end:.5+s}:v.minimapRange,f=d.filter),o.update({range:c,filter:f,minimapDelta:h?null:c.end-c.begin}),m&&i.zoom(Z(m)),h=!h,i.toggleIsZooming(!1)}),o.hasAnimations()?c:0),setTimeout((()=>{t.shouldZoomToPie&&a.classList.remove("lovely-chart--state-animating")}),o.hasAnimations()?1e3:0)}return{zoomIn:function(n,o){if(h)return;const l=t.xLabels[o];d=n,i.toggleIsZooming(!0),s.toggleLoading(!0),s.toggleIsZoomed(!0),t.shouldZoomToPie&&(a.classList.add("lovely-chart--state-zoomed-in"),a.classList.add("lovely-chart--state-animating"));const{value:r}=l,c=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(r);c.then((t=>f(t,o,l)))},zoomOut:function(n){if(!h)return;u=n,i.toggleIsZooming(!0),s.toggleLoading(!0),s.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}}}(C,e,O,n,o,h,g,M,S)}function X(t){A=t;const{datasets:e}=C,n={from:t.labelFromIndex,to:t.labelToIndex},o={begin:t.begin,end:t.end,totalXWidth:t.totalXWidth,yMin:t.yMinViewport,yMax:t.yMaxViewport,availableWidth:u.width,availableHeight:u.height-30,xPadding:l,yPadding:15},a=e.map((e=>{let{key:n}=e;return t[`opacity#${n}`]})),i=Q(C,e,n,a,o),r=J(o);let c=null,f=null;if(C.hasSecondYAxis){const o=e.find((t=>t.hasOwnYAxis)),i={yMin:t.yMinViewportSecond,yMax:t.yMaxViewportSecond};c=Q(C,[o],n,a,i)[0],f=r.copy(i)}C.hideCaption||h.setCaption(function(t){let e,n;return T&&T.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),o=C.xLabels[e],a=C.xLabels[n],Math.abs(a.value-o.value)>864e5?`${H(C.xLabels[e])}${H(C.xLabels[n])}`:Z(C.xLabels[e]);var o,a}(t)),G(s,d);const p=1*L(i.reduce(((t,e)=>t+e.length),0));et(d,t,C,n,i,r,c,f,2,a,O,!1,p),C.isPie||(m.drawYAxis(t,r,f),m.drawXAxis(t,r)),g.update(t),M.update(t,i,r,c,f)}function z(t){n.update({range:t})}function N(t){n.update({filter:t})}function R(t){(C.isBars||C.isPie||C.isSteps)&&n.update({focusOn:t})}function Y(t){T.zoomIn(A,t)}function q(){T.zoomOut(A)}D(),document.documentElement.addEventListener("darkmode",(()=>{n.update()})),window.addEventListener("resize",(()=>{window.innerWidth!==I&&(I=window.innerWidth,W())})),window.addEventListener("orientationchange",(()=>{W()}))}}}]);
//# sourceMappingURL=878.10fc2a2ac02923a134fa.js.map