You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
32 KiB
2 lines
32 KiB
|
4 months ago
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Scale={})}(this,function(t){"use strict";function l(t,...e){return e.reduce((e,n)=>t=>e(n(t)),t)}function h(e,n){return n-e?t=>(t-e)/(n-e):t=>.5}function c(t,e,n,r,o){let a=n||0,i=r||t.length;for(var s=o||(t=>t);a<i;){var u=Math.floor((a+i)/2);s(t[u])>e?i=u:a=u+1}return a}const F=Math.sqrt(50),R=Math.sqrt(10),P=Math.sqrt(2);function u(t,e,n){e=(e-t)/Math.max(0,n),t=Math.floor(Math.log(e)/Math.LN10),n=e/10**t;return 0<=t?(n>=F?10:n>=R?5:n>=P?2:1)*10**t:-(10**-t)/(n>=F?10:n>=R?5:n>=P?2:1)}function K(t,e,n){n=Math.abs(e-t)/Math.max(0,n);let r=10**Math.floor(Math.log(n)/Math.LN10);n/=r;return n>=F?r*=10:n>=R?r*=5:n>=P&&(r*=2),e<t?-r:r}const q=(t,e,n=5)=>{t=[t,e];let r=0,o=t.length-1,a=t[r],i=t[o],s;return i<a&&([a,i]=[i,a],[r,o]=[o,r]),0<(s=u(a,i,n))?(a=Math.floor(a/s)*s,i=Math.ceil(i/s)*s,s=u(a,i,n)):s<0&&(a=Math.ceil(a*s)/s,i=Math.floor(i*s)/s,s=u(a,i,n)),0<s?(t[r]=Math.floor(a/s)*s,t[o]=Math.ceil(i/s)*s):s<0&&(t[r]=Math.ceil(a*s)/s,t[o]=Math.floor(i*s)/s),t},n=1e3,r=6e4,o=36e5,a=24*o,i=7*a;var B=30*a,E=365*a;function e(t,n,s,r){const o=(t,e)=>{let n=e;for(;n&&r(t)%e!=0;)s(t,-1),--n;return t},u=(t,e)=>{e&&o(t,e),n(t)};const l=(t,e)=>{t=new Date(+t-1);return u(t,e),s(t,e),u(t),t};return{ceil:l,floor:(t,e)=>{t=new Date(+t);return u(t,e),t},range:(t,e,n,r)=>{for(var o=[],a=Math.floor(n),i=r?l(t,n):l(t);i<e;s(i,a),u(i))o.push(new Date(+i));return o},duration:t}}var s=e(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),d=e(n,t=>{t.setMilliseconds(0)},(t,e=1)=>{t.setTime(+t+n*e)},t=>t.getSeconds()),g=e(r,t=>{t.setSeconds(0,0)},(t,e=1)=>{t.setTime(+t+r*e)},t=>t.getMinutes()),p=e(o,t=>{t.setMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getHours()),f=e(a,t=>{t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+a*e)},t=>t.getDate()-1);const W=e(B,t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e=1)=>{var n=t.getMonth();t.setMonth(n+e)},t=>t.getMonth());var $=e(i,t=>{t.setDate(t.getDate()-t.getDay()%7),t.setHours(0,0,0,0)},(t,e=1)=>{t.setDate(t.getDate()+7*e)},t=>{var e=W.floor(t),t=new Date(+t);return Math.floor((+t-+e)/i)}),_=e(E,t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e=1)=>{var n=t.getFullYear();t.setFullYear(n+e)},t=>t.getFullYear());const z={millisecond:s,second:d,minute:g,hour:p,day:f,week:$,month:W,year:_};s=e(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),d=e(n,t=>{t.setUTCMilliseconds(0)},(t,e=1)=>{t.setTime(+t+n*e)},t=>t.getUTCSeconds()),g=e(r,t=>{t.setUTCSeconds(0,0)},(t,e=1)=>{t.setTime(+t+r*e)},t=>t.getUTCMinutes()),p=e(o,t=>{t.setUTCMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getUTCHours()),f=e(a,t=>{t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+a*e)},t=>t.getUTCDate()-1);const L=e(B,t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCMonth();t.setUTCMonth(n+e)},t=>t.getUTCMonth());$=e(i,t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7)%7),t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+i*e)},t=>{var e=L.floor(t),t=new Date(+t);return Math.floor((+t-+e)/i)}),_=e(E,t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCFullYear();t.setUTCFullYear(n+e)},t=>t.getUTCFullYear());const Z={millisecond:s,second:d,minute:g,hour:p,day:f,week:$,month:L,year:_};function J(t,e,n,r,o){var t=+t,e=+e,{tickIntervals:o,year:a,millisecond:i}=function(t){var{year:t,month:e,week:n,day:r,hour:o,minute:a,second:i,millisecond:s}=t?Z:z;return{tickIntervals:[[i,1],[i,5],[i,15],[i,30],[a,1],[a,5],[a,15],[a,30],[o,1],[o,3],[o,6],[o,12],[r,1],[r,2],[n,1],[e,1],[e,3],[t,1]],year:t,millisecond:s}}(o),s=([t,e])=>t.duration*e,n=r?(e-t)/r:n||5,u=r||(e-t)/n,l=o.length,h=c(o,u,0,l,s);let d;return d=h===l?[a,K(t/a.duration,e/a.duration,n)]:h?([l,a]=u/s(o[h-1])<s(o[h])/u?o[h-1]:o[h],[l,r?Math.ceil(r/l.duration):a]):[i,Math.max(K(t,e,n),1)]}const Q=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e,[e,n]=J(i,t,n,r,o),r=[e.floor(i,n),e.ceil(t,n)];return a?r.reverse():r};var V=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)
|