UNPKG

@northflank/cli

Version:

Provides a command-line interface to the Northflank platform.

1 lines 3.74 kB
function a8m(){const m1=['floor','80351HSxXQT','slice','symbols','max','abs','min','isArray','2069485FBpnPs','undefined','offset','1990148gMxJID','6IhVXuZ','padding','252597ugpjNm','\x20\x20\x20','join','toFixed','2330419qiXeAo','2-digit','round','4265680aBMxaS','black','unit','toLocaleTimeString','grey','h24','push','toLocaleDateString','21786003kePRYE','10owNvOG','height','repeat','length','blue'];a8m=function(){return m1;};return a8m();}(function(m,E){const p=a8E,h=m();while(!![]){try{const I=parseInt(p(0xfb))/0x1+parseInt(p(0xf5))/0x2*(-parseInt(p(0x108))/0x3)+-parseInt(p(0x105))/0x4+-parseInt(p(0x102))/0x5+-parseInt(p(0x106))/0x6*(parseInt(p(0x10c))/0x7)+-parseInt(p(0x10f))/0x8+parseInt(p(0x117))/0x9;if(I===E)break;else h['push'](h['shift']());}catch(T){h['push'](h['shift']());}}}(a8m,0x49d7e));import a8h from'chalk';const colored=(m,E)=>{return E===undefined?m:a8h[E](m);};function a8E(m,E){const h=a8m();return a8E=function(I,T){I=I-0xf5;let e=h[I];return e;},a8E(m,E);}export const getAsciiChart=(m,E={})=>{const j=a8E,h=Array[j(0x101)](m[0x0])?m:[m];let I=typeof E[j(0x100)]!==j(0x103)?E['min']:h[0x0][0x0],T=typeof E[j(0xfe)]!==j(0x103)?E[j(0xfe)]:h[0x0][0x0];for(let N=0x0;N<h['length'];N++){for(let w=0x0;w<h[N][j(0xf8)];w++){I=Math[j(0x100)](I,h[N][w]),T=Math[j(0xfe)](T,h[N][w]);}}let e=['┼','┤','╶','╴','─','╰','╭','╮','╯','│'],o=Math['abs'](T-I),g=typeof E['offset']!==j(0x103)?E[j(0x104)]:0x3,J=typeof E[j(0x107)]!==j(0x103)?E[j(0x107)]:'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',L=typeof E['height']!=='undefined'?E[j(0xf6)]:o,P=typeof E['colors']!==j(0x103)?E['colors']:[j(0xf9),'red','green',j(0x113),j(0x110)],X=o!==0x0?L/o:0x1,W=Math[j(0x10e)](I*X),K=Math[j(0x10e)](T*X),z=Math['abs'](K-W),S=0x0;for(let b=0x0;b<h[j(0xf8)];b++){S=Math[j(0xfe)](S,h[b][j(0xf8)]);}S=S+g;let H=typeof E[j(0xfd)]!=='undefined'?E['symbols']:e,r=E['format']!==undefined?E['format']:function(n){const d=j;return(J+n[d(0x10b)](0x2)+E[d(0x111)])[d(0xfc)](-J[d(0xf8)]);},F=new Array(z+0x1);for(let n=0x0;n<=z;n++){F[n]=new Array(S);for(let Q=0x0;Q<S;Q++){F[n][Q]='\x20';}}for(let c=W;c<=K;++c){const O=r(z>0x0?T-(c-W)*o/z:c,c-W);F[c-W][Math[j(0xfe)](g-O[j(0xf8)],0x0)]=O,F[c-W][g-0x1]=c==0x0?H[0x0]:H[0x1];}for(let B=0x0;B<h[j(0xf8)];B++){let q=P[B%P[j(0xf8)]],a=Math['round'](h[B][0x0]*X)-W;F[z-a][g-0x1]=colored(H[0x0],q);for(let R=0x0;R<h[B][j(0xf8)]-0x1;R++){let D=Math[j(0x10e)](h[B][R+0x0]*X)-W,f=Math[j(0x10e)](h[B][R+0x1]*X)-W;if(D==f)F[z-D][R+g]=colored(H[0x4],q);else{F[z-f][R+g]=colored(D>f?H[0x5]:H[0x6],q),F[z-D][R+g]=colored(D>f?H[0x7]:H[0x8],q);let M=Math[j(0x100)](D,f),U=Math['max'](D,f);for(let C=M+0x1;C<U;C++){F[z-C][R+g]=colored(H[0x9],q);}}}}const {startTs:t,endTs:Y}=E;if(t||Y){const Z=u=>{const v=j;if(!u)return v(0x109);const k=u[v(0x116)](undefined,{'day':v(0x10d),'month':v(0x10d),'year':v(0x10d)}),A=u[v(0x112)](undefined,{'hourCycle':v(0x114)});return k+'\x20'+A;},V=Z(Y),G=Z(t),l=J[j(0xfc)](0x0,Math[j(0xfe)](0x2,J['length']-G[j(0xf8)]/0x2+0x1)),s='\x20'[j(0xf7)](Math[j(0xfe)](S-(J[j(0xf8)]+V[j(0xf8)]/0x2),0x1));F[j(0x115)]([''+l+G+s+V]),F['push']([]);}return F['map'](u=>u[j(0x10a)](''))['join']('\x0a');};export const downSampleData=(m,E)=>{const m0=a8E,h=m[m0(0xf8)];if(E>=h||E===0x0)return m;const I=[];let T=0x0;const e=(h-0x2)/(E-0x2);let o=0x0,g,J,L,P;I[T++]=m[o];for(var X=0x0;X<E-0x2;X++){let r=0x0,F=0x0,t=Math['floor']((X+0x1)*e)+0x1,Y=Math[m0(0xfa)]((X+0x2)*e)+0x1;Y=Y<h?Y:h;var W=Y-t;for(;t<Y;t++){r+=m[t][0x0],F+=m[t][0x1];}r/=W,F/=W;var K=Math[m0(0xfa)](X*e)+0x1,z=Math[m0(0xfa)]((X+0x1)*e)+0x1,S=m[o][0x0],H=m[o][0x1];J=L=-0x1;for(;K<z;K++){L=Math[m0(0xff)]((S-r)*(m[K][0x1]-H)-(S-m[K][0x0])*(F-H))*0.5,L>J&&(J=L,g=m[K],P=K);}I[T++]=g,o=P;}return I[T++]=m[h-0x1],I;};