@jrc03c/make-key 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js ADDED
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ commonjs: true,
5
+ es2021: true,
6
+ node: true,
7
+ vue: true,
8
+ },
9
+ extends: "eslint:recommended",
10
+ overrides: [],
11
+ parserOptions: {
12
+ ecmaVersion: "latest",
13
+ },
14
+ rules: {},
15
+ }
package/bin.js CHANGED
@@ -1,21 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
  const { exec } = require("child_process")
3
- const makeKey = require("./index.js")
3
+ const makeKey = require("./src/index.js")
4
4
 
5
5
  if (typeof require !== "undefined" && require.main === module) {
6
- if (process.argv.length <= 2) {
6
+ const args = process.argv.slice(2)
7
+
8
+ if (args.length === 0) {
7
9
  console.log("You must specify a key length.")
8
10
  process.exit(0)
9
11
  }
10
12
 
11
- let keyLength = parseInt(process.argv[2])
12
- let keySeed = null
13
+ const keyLength = parseInt(args[0])
14
+ let keySeed, charset
13
15
 
14
- try {
15
- keySeed = parseInt(process.argv[3])
16
- } catch (e) {}
16
+ if (args.length === 2) {
17
+ if (!isNaN(parseInt(args[1]))) {
18
+ keySeed = parseInt(args[1])
19
+ } else {
20
+ charset = args[1]
21
+ }
22
+ } else if (args.length > 2) {
23
+ keySeed = parseInt(args[1])
24
+ charset = args[2]
25
+ }
17
26
 
18
- const key = makeKey(keyLength, keySeed)
27
+ const key = makeKey(keyLength, keySeed, charset)
19
28
  console.log(key)
20
29
 
21
30
  try {
@@ -0,0 +1,27 @@
1
+ (()=>{var hn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var X=c((Oy,mn)=>{var ec=new Function(`
2
+ try {
3
+ return this === window
4
+ } catch(e) {}
5
+
6
+ try {
7
+ return typeof importScripts !== "undefined"
8
+ } catch(e) {}
9
+
10
+ return false
11
+ `),ut=class extends Error{constructor(t){ec()?super(t):super(`
12
+
13
+ \x1B[31m`+t+`
14
+ \x1B[0m`)}};mn.exports=ut});var h=c((_y,dn)=>{var tc=X();dn.exports=function(e,t){if(!e)throw new tc(t)}});var m=c((Dy,pn)=>{function nc(e){try{return e instanceof Array||typeof e.constructor<"u"&&e.constructor.name==="Array"}catch{return!1}}pn.exports=nc});var g=c((Fy,qn)=>{function rc(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/dataframe")}catch{return!1}}qn.exports=rc});var D=c((Ay,gn)=>{function sc(e){return typeof e=="function"}gn.exports=sc});var p=c((Ey,yn)=>{function ic(e){return typeof e=="number"&&!isNaN(e)}yn.exports=ic});var b=c((jy,bn)=>{function oc(e){return e===null||typeof e>"u"}bn.exports=oc});var k=c((Iy,Nn)=>{var uc=m(),ac=b();function cc(e){return typeof e=="object"&&!ac(e)&&!uc(e)}Nn.exports=cc});var q=c((My,vn)=>{function lc(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/series")}catch{return!1}}vn.exports=lc});var ue=c((Uy,xn)=>{var fc=h(),wn=m(),hc=g(),mc=D(),at=p(),Sn=k(),dc=q();function ct(e,t){if(hc(e)){let i=ct(e.values,t);return i.length>0&&at(i[0])&&i[0]>=0&&i[0]<e.index.length&&(i[0]=e.index[i[0]]),i.length>1&&at(i[1])&&i[1]>=0&&i[1]<e.columns.length&&(i[1]=e.columns[i[1]]),i}if(dc(e)){let i=ct(e.values,t);return i.length>0&&at(i[0])&&i[0]>=0&&i[0]<e.index.length&&(i[0]=e.index[i[0]]),i}if(fc(Sn(e)||wn(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `indexOf` function!"),!mc(t)){let i=t;t=o=>o===i}function n(i,o,u){if(u=u||[],u.indexOf(i)>-1)return null;if(Sn(i)){u.push(i);let a=Object.keys(i);for(let l=0;l<a.length;l++){let f=a[l],d=i[f];if(o(d))return[f];let y=n(d,o,u);if(y&&y.length>0)return[f].concat(y)}}else if(wn(i)){u.push(i);for(let a=0;a<i.length;a++){let l=i[a];if(o(l))return[a];let f=n(l,o,u);if(f&&f.length>0)return[a].concat(f)}}else if(o(i))return[];return null}function r(i){try{return t(i)}catch{return!1}}let s=n(e,r);return s&&s.length>0?s:null}xn.exports=ct});var U=c((zy,Fn)=>{var pc=ue(),Tn=m(),On=g(),_n=q();function Q(e){try{return structuredClone(e)}catch{if(typeof e=="object"){if(e===null)return null;if(Tn(e))return e.map(r=>Q(r));if(_n(e)){let r=e.copy();return r.values=Q(r.values),r}if(On(e)){let r=e.copy();return r.values=Q(e.values),r}e=Dn(e);let n={};return Object.keys(e).forEach(r=>{n[r]=Q(e[r])}),n}else return e}}function Dn(e){function t(s,i,o){if(i=i||[],o=o||"",i.indexOf(s)>-1){let u=o.split("/").slice(o.startsWith("/")?1:0);if(u.some((l,f)=>{let d=u.slice(0,u.length-f-1),y=n;return d.forEach(O=>{y=y[O]}),y===s}))return`<reference to "${n===s?"/":"/"+pc(n,s).join("/")}">`}return typeof s=="object"?s===null?null:(i.push(s),Tn(s)?s.map((u,a)=>t(u,i,o+"/"+a)):(Object.keys(s).forEach(u=>{s[u]=t(s[u],i,o+"/"+u)}),s)):s}let n=Q(e),r=t(n);if(On(e)){let s=e.copy();s._values=r.values,s._columns=r.columns,s._index=r.index,r=s}if(_n(e)){let s=e.copy();s.name=r.name,s._values=r.values,s._index=r.index,r=s}return r}Fn.exports={copy:Q,decycle:Dn}});var S=c((Cy,jn)=>{var{copy:qc}=U(),gc=h(),An=m(),yc=g(),bc=q();function En(e){if(yc(e)||bc(e))return En(e.values);gc(An(e),"The `flatten` function only works on arrays, Series, and DataFrames!");function t(n){let r=[];return qc(n).forEach(s=>{An(s)?r=r.concat(t(s)):r.push(s)}),r}return t(e)}jn.exports=En});var I=c((By,Mn)=>{var{decycle:In}=U();function Nc(e,t){function n(r,s){let i=typeof r;if(i!==typeof s)return!1;if(i==="undefined")return!0;if(i==="boolean"||i==="symbol")return r===s;if(i==="number"||i==="bigint")return r.toString()==="NaN"&&s.toString()==="NaN"?!0:r===s;if(i==="string"||i==="function")return r===s;if(i==="object"){if(r===null||s===null)return r===null&&s===null;{let u=Object.keys(r),a=Object.keys(s);if(u.length!==a.length)return!1;for(let l=0;l<u.length;l++){let f=u[l];if(!n(r[f],s[f]))return!1}return!0}}}try{return e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():n(e,t)}catch{return n(In(e),In(t))}}Mn.exports=Nc});var M=c((ky,Bn)=>{var vc=h(),wc=S(),Sc=m(),Un=g(),xc=D(),zn=q(),Tc=b();function ae(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[parseInt(Math.random()*t.length)];return n}var Oc=ae(256),_c=ae(256),Dc=ae(256),Fc=ae(256),Ac=ae(256);function Cn(e){if(Un(e)||zn(e))return Cn(e.values);vc(Sc(e),"The `set` function only works on arrays, Series, and DataFrames!");let t=[],n={};return wc(e).forEach(r=>{let s=typeof r=="object"&&r===null?Oc:Tc(r)?_c:xc(r)?r.toString():typeof r=="symbol"?r.toString()+" - "+Ac:r===1/0?Dc:r===-1/0?Fc:Un(r)?r.toJSONString():zn(r)?JSON.stringify(r.toObject()):JSON.stringify(r);n[s]||t.push(r),n[s]=!0}),t}Bn.exports=Cn});var ce=c((Jy,Pn)=>{var Ec=h(),lt=S(),kn=m(),jc=g(),Jn=I(),Ic=D(),Mc=q(),Uc=M();function xe(e,t){if(jc(e)||Mc(e))return arguments.length>1?xe(e.values,t):xe(e.values,e.values);if(Ec(kn(e),"The first argument to the `count` function must be an array, Series, or DataFrame!"),Ic(t))return lt(e).filter(n=>t(n)).length;if(kn(t)){let n=lt(e);return Uc(t).map(r=>({value:r,count:n.filter(s=>Jn(s,r)).length}))}else return arguments.length>1?lt(e).filter(n=>Jn(n,t)).length:xe(e,e)}Pn.exports=xe});var le=c((Py,$n)=>{var zc=h(),Yn=m(),Cc=g(),Bc=q();function ft(e){if(Cc(e)||Bc(e))return ft(e.values);zc(Yn(e),"The `isJagged` function only works on arrays, Series, and DataFrames!");let t=0,n=null;for(let r=0;r<e.length;r++)if(Yn(e[r])){if(t++,ft(e[r]))return!0;if(n===null)n=e[r].length;else if(e[r].length!==n)return!0}return t>0&&t<e.length}$n.exports=ft});var Te=c((Yy,Kn)=>{var kc=h(),Rn=m(),Jc=g(),Pc=q();function Ln(e){if(Jc(e)||Pc(e))return Ln(e.values);kc(Rn(e),"The `isNested` function only works on arrays, Series, and DataFrames!");for(let t=0;t<e.length;t++)if(Rn(e[t]))return!0;return!1}Kn.exports=Ln});var J=c(($y,Gn)=>{var W=h(),Yc=m(),$c=Te(),Rc=p(),Lc=b(),Z="You must pass a natural number or a one-dimensional array of natural numbers into the `ndarray` function!";function Vn(e){W(!Lc(e),Z),Yc(e)||(e=[e]),W(!$c(e),Z),W(e.length>0,Z);let t=e[0];if(W(Rc(t),Z),W(parseInt(t)===t,Z),W(t>=0,Z),W(t!==1/0,"We can't create an array containing an infinite number of values!"),e.length===1){let n=[];for(let r=0;r<t;r++)n.push(void 0);return n}else{let n=[];for(let r=0;r<t;r++)n.push(Vn(e.slice(1)));return n}}Gn.exports=Vn});var fe=c((Ry,Wn)=>{var Kc=h(),Vc=m(),Gc=g(),Wc=q();function ht(e){if(Gc(e)||Wc(e)){let n=e.copy();return n.values=ht(n.values),n.index=ht(n.index),n}Kc(Vc(e),"The `reverse` function only works on arrays, Series, and DataFrames!");let t=[];for(let n=e.length-1;n>=0;n--)t.push(e[n]);return t}Wn.exports=ht});var E=c((Ly,Hn)=>{var mt=h(),dt=p(),pt=b(),Hc=fe();function Xc(e,t,n=1){mt(!pt(e)&&!pt(t)&&!pt(n),"You must pass two numbers and optionally a step value to the `range` function!"),mt(dt(e)&&dt(t)&&dt(n),"You must pass two numbers and optionally a step value to the `range` function!"),mt(n>0,"The step value must be greater than 0! (NOTE: The step value is a magnitude; it does not indicate direction.)");let r=!1;if(e>t){r=!0;let i=e;e=t+n,t=i+n}let s=[];for(let i=e;i<t;i+=n)s.push(i);return r&&(s=Hc(s)),s}Hn.exports=Xc});var v=c((Ky,er)=>{var Qc=h(),Xn=m(),Zc=g(),el=I(),tl=q(),nl=b();function Qn(e){if(!Xn(e))return;let t=[e.length],n=0,r=e.map(s=>{let i=Qn(s);return nl(i)?i:(n++,i.length===1?i[0]:i)});return n>0?n===e.length&&r.slice(0,-1).every((i,o)=>el(i,r[o+1]))?t.concat(r[0]):(t.push(r),t):t}function Zn(e){return Zc(e)||tl(e)?Zn(e.values):(Qc(Xn(e),"The `shape` function only works on arrays, Series, and DataFrames!"),Qn(e))}er.exports=Zn});var or=c((Vy,ir)=>{var tr=h(),rl=m(),sl=g(),il=le(),ol=q(),ul=b(),nr=X(),Oe=J(),rr=E(),al=M(),cl=v();function sr(e,t,n){if(ul(n)&&(n=0),tr(n===0||n===1||n==="vertical"||n==="horizontal",'The only valid axis values for use when appending data to a DataFrame are 0, 1, "vertical", and "horizontal". Note that 0 == "horizontal" and 1 == "vertical".'),rl(t)){tr(!il(t),"The array of data you're trying to append to this DataFrame is jagged!");let r=cl(t);if(r.length===1)if(n===0){let s=e.copy();s._values.push(t);let i=Math.max(e.shape[1],r[0]);for(s._values.forEach(o=>{for(;o.length<i;)o.push(void 0)});s._index.length<s._values.length;)s._index.push("row"+s._index.length);for(;s._columns.length<i;)s._columns.push("col"+s._columns.length);return s}else{let s=Math.max(e.shape[0],r[0]),i=e.copy();for(rr(0,s).forEach(o=>{o>=i._values.length&&i._values.push(Oe(e.shape[1])),i._values[o].push(t[o])});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<i._values[0].length;)i._columns.push("col"+i._columns.length);return i}else if(r.length===2)if(n===0){let s=Math.max(...t.map(o=>o.length).concat([e.shape[1]])),i=e.copy();for(i._values=i._values.concat(t).map(o=>{for(;o.length<s;)o.push(void 0);return o});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<s;)i._columns.push("col"+i._columns.length);return i}else{let s=Math.max(...t.map(u=>u.length))+e.shape[1],i=Math.max(e.shape[0],r[0]),o=e.copy();for(rr(0,i).forEach(u=>{for(u>=o._values.length&&o._values.push(Oe(e.shape[1])),o._values[u]=o._values[u].concat(t[u]);o._values[u].length<s;)o._values[u].push(void 0)});o._index.length<o._values.length;)o._index.push("row"+o._index.length);for(;o._columns.length<s;)o._columns.push("col"+o._columns.length);return o}else throw new nr("Only 1- and 2-dimensional arrays can be appended to a DataFrame!")}else if(ol(t)){let r=sr(e,t.values,n);return n===0?r.index[r.index.length-1]=r.index.indexOf(t.name)>-1?t.name+" (2)":t.name:r.columns[r.columns.length-1]=r.columns.indexOf(t.name)>-1?t.name+" (2)":t.name,r}else if(sl(t))if(n===0){let r=e.copy(),s=al(r._columns.concat(t._columns)).length;for(r._values.forEach(i=>{for(;i.length<s;)i.push(void 0)}),t.apply(i=>{let o=i.copy(),u=[];r._columns.forEach(a=>{let l=o._index.indexOf(a);l>-1?(u.push(o._values[l]),o._values.splice(l,1),o._index.splice(l,1)):u.push(void 0)}),r._values.push(u.concat(o._values))},1),r._columns=r._columns.concat(t._columns.filter(i=>r._columns.indexOf(i)<0));r._index.length<r._values.length;){let i="row"+r._index.length;r._index.push(i+(e._index.indexOf(i)>-1?" (2)":""))}return r}else{let r=e.copy();return r._index.forEach((s,i)=>{let o=t._index.indexOf(s);o>-1?r._values[i]=r._values[i].concat(t._values[o]):r._values[i]=r._values[i].concat(Oe(t.shape[1]))}),t._index.forEach((s,i)=>{r._index.indexOf(s)<0&&(r._index.push(s),r._values.push(Oe(r._columns.length).concat(t._values[i])))}),r._columns=r._columns.concat(t._columns.map(s=>s+(r._columns.indexOf(s)>-1?" (2)":""))),r}else throw new nr("Only 1- or 2-dimensional arrays, Series, and DataFrames can be appended to a DataFrame!")}ir.exports=sr});var fr=c((Gy,lr)=>{var ur=h(),ar=m(),ll=D(),cr=b();function fl(e,t,n,r,s){if(s=s||0,ur(ll(r),"The first parameter to the `apply` method must be a function."),ur(s===0||s===1,"The second parameter to the `apply` method (the `axis`) must be 0 or 1."),s===0){let i={},o;if(n.columns.forEach((u,a)=>{let l=new t(n.values.map(d=>d[a]));l.name=u,l.index=n.index;let f=r(l,a,n);f instanceof t?i[u]=f.values:i[u]=f,cr(o)&&(o=f instanceof t||ar(f))}),o){let u=new e(i);return u.index=n.index,u}else{let u=new t(n.columns.map(a=>i[a]));return u.index=n.columns,u}}else if(s===1){let i,o=n.values.map((u,a)=>{let l=new t(u);l.name=n.index[a],l.index=n.columns;let f=r(l,a,n);return cr(i)&&(i=f instanceof t||ar(f)),f instanceof t?f.values:f});if(i){let u=new e(o);return u.index=n.index,u.columns=n.columns,u}else{let u=new t(o);return u.index=n.index,u}}}lr.exports=fl});var F=c((Wy,hr)=>{function hl(e){return typeof e=="string"}hr.exports=hl});var pr=c((Hy,dr)=>{var mr=h(),ml=m(),dl=le(),pl=k(),ql=F(),gl=b(),yl=X(),bl=v();function Nl(e,t,n,r,s){let i=u=>u instanceof e,o=u=>u instanceof t;if(gl(s)){if(i(r))return n.append(r,1);if(o(r))return n.append(r,1);if(pl(r)){let u=Math.max(...Object.keys(r).map(a=>r[a].length));return Object.keys(r).forEach(a=>{for(;r[a].length<u;)r[a].push(void 0)}),n.append(new e(r),1)}else throw new yl("You must pass a DataFrame, Series, or object into the `assign` method!")}else{mr(ql(r),"If passing two arguments into the `assign` method, then the first argument must be a string name!"),mr(ml(s)&&!dl(s)&&bl(s).length===1,"If passing two arguments into the `assign` method, then the second argument must be a 1-dimensional array!");let u=n.append(s,1);return u.columns[u.columns.length-1]=r,u}}dr.exports=Nl});var gr=c((Xy,qr)=>{var{copy:vl}=U();function wl(e,t){if(t.isEmpty)return new e;let n=new e(vl(t.values));return n.columns=t.columns.slice(),n.index=t.index.slice(),n}qr.exports=wl});var xr=c((Qy,Sr)=>{var _e=h(),yr=m(),br=p(),Nr=F(),vr=b(),wr=v();function Sl(e,t,n,r,s){vr(r)&&(r=[]),vr(s)&&(s=[]),(Nr(r)||br(r))&&(r=[r]),(Nr(s)||br(s))&&(s=[s]),_e(yr(r),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),_e(yr(s),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),_e(wr(r).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),_e(wr(s).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings.");let i,o;n.index.forEach((a,l)=>{r.indexOf(a)<0&&r.indexOf(l)<0&&(i||(i=[]),i.push(a))}),n.columns.forEach((a,l)=>{s.indexOf(a)<0&&s.indexOf(l)<0&&(o||(o=[]),o.push(a))});let u=n.get(i,o);if(u instanceof t){let a=new e;a=a.assign(u),n.index.indexOf(u.name)>-1&&(a=a.transpose()),u=a}return u}Sr.exports=Sl});var he=c((Zy,Tr)=>{var xl=p();function Tl(e){return xl(e)&&parseInt(e)===e}function Ol(e){return Tl(e)&&e>=0}Tr.exports=Ol});var _r=c((eb,Or)=>{var qt=h(),_l=F(),De=b(),Dl=he(),Fl=v();function Al(e,t,n,r,s,i){r=r||0,qt(r===0||r===1,"The first parameter of the `dropMissing` method (the `axis`) must be 0 or 1."),i=i||0,qt(Dl(i),"The third parameter of the `dropMissing` method (the `threshold`) should be a whole number (meaning that data should be dropped if it contains more than `threshold` null values)."),s=i>0?"none":s||"any",qt(s==="any"||s==="all"||s==="none","The second parameter of the `dropMissing` method (the `condition` parameter, which indicates the condition under which data should be dropped) should be 'any' or 'all' (meaning that if 'any' of the data contains null values, then it should be dropped; or that if 'all' of the data contains null values, then it should be dropped).");function o(l){if(i>0){let f=0;for(let d=0;d<l.length;d++){let y=l[d];if(De(y)&&f++,f>=i)return[]}}else if(s==="any")for(let f=0;f<l.length;f++){let d=l[f];if(De(d))return[]}else if(s==="all"){for(let f=0;f<l.length;f++){let d=l[f];if(!De(d))return l}return[]}return l}let u=n.copy(),a=Math.random().toString();if(r===0){u=u.assign(a,u.index);let l=u.values.map(o).filter(d=>d.length>0);if(Fl(l).length<2)return new e;u.values=l;let f=u.get(null,a);if(De(f))return new e;_l(f)&&(f=[f]),f instanceof t&&(f=f.values),u.index=f,u=u.drop(null,a)}else if(r===1){let l={};if(u.columns.forEach((d,y)=>{let O=u.values.map(_=>_[y]),G=o(O);G.length>0&&(l[d]=G)}),Object.keys(l).length===0)return new e;let f=new e(l);return f.index=u.index,f}return u}Or.exports=Al});var gt=c((tb,Fr)=>{var El=h(),jl=m(),Il=g(),Ml=p(),Ul=q();function Dr(e){if(Il(e)||Ul(e))return e.dropNaN(...Object.values(arguments).slice(1));El(jl(e),"The `dropNaN` function only works on arrays, Series, and DataFrames!");let t=[];return e.forEach(n=>{try{return t.push(Dr(n))}catch{if(Ml(n))return t.push(n)}}),t}Fr.exports=Dr});var Er=c((nb,Ar)=>{var yt=h(),zl=gt(),Cl=he();function Bl(e,t,n,r,s){n=n||0,yt(n===0||n===1,"The first parameter of the `dropNaN` method (the `axis`) must be 0 or 1."),s=s||0,yt(Cl(s),"The third parameter of the `dropNaN` method (the `threshold`) should be a whole number (meaning that data should be dropped if it contains more than `threshold` NaN values)."),r=s>0?"none":r||"any",yt(r==="any"||r==="all"||r==="none","The second parameter of the `dropNaN` method (the `condition` parameter, which indicates the condition under which data should be dropped) should be 'any' or 'all' (meaning that if 'any' of the data contains NaN values, then it should be dropped; or that if 'all' of the data contains NaN values, then it should be dropped).");function i(u){let a=zl(u);return s>0?u.length-a.length<s:r==="any"?a.length===u.length:r==="all"?a.length>0:!0}let o=t.copy();if(n===0){let u=o.index.filter(a=>{let l=o.get(a,null).values;return i(l)});return u.length>0?o.get(u,null):new e}else if(n===1){let u=o.columns.filter(a=>{let l=o.get(null,a).values;return i(l)});return u.length>0?o.get(null,u):new e}return o}Ar.exports=Bl});var Ur=c((rb,Mr)=>{var jr=h(),me=S(),kl=D(),Jl=b();function Ir(e){let t={};return me(e).forEach((n,r)=>{t[n]=r}),t}function ee(e){return Object.keys(e).sort((t,n)=>e[t]-e[n])}function Pl(e,t,n,r,s){jr(kl(r),"The `filter` method takes a single parameter: a function that is used to filter the values."),Jl(s)&&(s=0),jr(s===0||s===1,"The `axis` parameter to the `filter` method must be 0 or 1.");let i=n.copy();if(i.isEmpty)return i;let o=Ir(i.index),u=Ir(i.columns);if(s===0){let a=i.values.filter((l,f)=>{let d=new t(l);d.name=n.index[f],d.index=n.columns;let y=r(d,f,n);return y||delete o[i.index[f]],y});if(me(a).length===0)return new e;if(a.length===1){let l=new t(me(a));return l.name=ee(o)[0],l.index=ee(u),l}i.values=a,i.index=ee(o)}else if(s===1){i=i.transpose();let a=i.values.filter((l,f)=>{let d=new t(l);d.name=n.columns[f],d.index=n.index;let y=r(d,f,n);return y||delete u[i.index[f]],y});if(me(a).length===0)return new e;if(a.length===1){let l=new t(me(a));return l.name=ee(u)[0],l.index=ee(o),l}i.values=a,i.index=ee(u),i=i.transpose()}return i}Mr.exports=Pl});var Br=c((sb,Cr)=>{var j=h(),Fe=p(),Ae=F(),zr=b(),Yl=M();function $l(e,t,n){(Ae(t)||Fe(t))&&(t=[t]),(Ae(n)||Fe(n))&&(n=[n]);let r=Yl((t||[]).concat(n||[]).map(s=>typeof s));return j(r.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===1&&j(r[0]==="string"||r[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===2&&(j(r.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),j(r.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),zr(t)||(t=t.map(s=>{if(Ae(s))return j(e.index.indexOf(s)>-1,`Row "${s}" does not exist!`),s;if(Fe(s))return j(s>=0,`Index ${s} is out of bounds!`),j(parseInt(s)===s,"Row numbers must be integers!"),j(s<e.index.length,`Index ${s} is out of bounds!`),e.index[s]})),zr(n)||(n=n.map(s=>{if(Ae(s))return j(e.columns.indexOf(s)>-1,`Column "${s}" does not exist!`),s;if(Fe(s))return j(s>=0,`Column ${s} is out of bounds!`),j(parseInt(s)===s,"Column numbers must be integers!"),j(s<e.columns.length,`Column ${s} is out of bounds!`),e.columns[s]})),e.getSubsetByNames(t,n)}Cr.exports=$l});var P=c((ib,Jr)=>{var kr=h(),Rl=m(),Ll=g(),Kl=D(),Vl=q(),Gl=b();function Wl(e,t){try{return e<t?-1:e>t?1:0}catch{return e=typeof e=="object"&&e!==null?JSON.stringify(e):e.toString(),t=typeof t=="object"&&t!==null?JSON.stringify(t):t.toString(),e<t?-1:e>t?1:0}}function Hl(e,t){if(Gl(t)&&(t=Wl),Ll(e)||Vl(e))return e.sort(...Object.values(arguments).slice(1));kr(Rl(e),"The `sort` function only works on arrays, Series, and DataFrames!"),kr(Kl(t),"The second parameter of the `sort` function must be a comparison function!");let n=e.slice();return n.sort(t),n}Jr.exports=Hl});var Rr=c((ob,$r)=>{var Pr=h(),Yr=F(),Xl=b(),Ql=M(),Zl=P();function ef(e){let t=e.toLowerCase(),n="";for(let s=0;s<t.length;s++){let i=t[s];i.match(/[a-z0-9]/g)?n+=i:n+=" "}let r=n.split(" ").filter(s=>s.length>0);return r[0]+r.slice(1).map(s=>s[0].toUpperCase()+s.substring(1)).join("")}function tf(e,t,n){Xl(n)?n=t.columns:Yr(n)&&(n=[n]);let r={};n.forEach(i=>{Pr(Yr(i),"You must pass either a string or a one-dimensional array of strings into the `getDummies` (AKA `oneHotEncode`) method!");let o=t.columns.indexOf(i);Pr(o>-1,`The given DataFrame does not have a column called "${i}"!`);let u=t.values.map(l=>l[o]),a=Zl(Ql(u));u.forEach(l=>{a.forEach(f=>{let d=i+"_"+ef(f.toString());r[d]||(r[d]=[]),l===f?r[d].push(1):r[d].push(0)})})});let s=new e(r);return s.index=t.index,s}$r.exports=tf});var Qr=c((ub,Xr)=>{var Y=h(),Lr=m(),Kr=p(),Vr=b(),Gr=he(),Wr=E(),Hr=v();function nf(e,t,n){let r=e.shape;Vr(t)&&(t=Wr(0,r[0])),Vr(n)&&(n=Wr(0,r[1])),Kr(t)&&(t=[t]),Kr(n)&&(n=[n]),Y(Lr(t)&&Lr(n),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),Y(Hr(t).length===1&&Hr(n).length===1,"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),Y(t.length>0,"The `rowIndices` array must contain at least one index."),Y(n.length>0,"The `colIndices` array must contain at least one index."),t.forEach(o=>{Y(Gr(o),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),Y(o<e.index.length,`The row index ${o} is out of bounds.`)}),n.forEach(o=>{Y(Gr(o),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),Y(o<e.columns.length,`The column index ${o} is out of bounds.`)});let s=t.map(o=>e.index[o]),i=n.map(o=>e.columns[o]);return e.getSubsetByNames(s,i)}Xr.exports=nf});var rs=c((ab,ns)=>{var $=h(),bt=S(),Zr=m(),Ee=F(),es=b(),ts=v();function rf(e,t,n,r,s){es(r)&&(r=n.index),es(s)&&(s=n.columns),Ee(r)&&(r=[r]),Ee(s)&&(s=[s]),$(Zr(r)&&Zr(s),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),$(ts(r).length===1&&ts(s).length===1,"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),$(r.length>0,"The `rows` array must contain at least one row name."),$(s.length>0,"The `cols` array must contain at least one column name."),r.forEach(u=>{$(Ee(u),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),$(n.index.indexOf(u)>-1,`The row name "${u}" does not exist in the list of rows.`)}),s.forEach(u=>{$(Ee(u),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),$(n.columns.indexOf(u)>-1,`The column name "${u}" does not exist in the list of columns.`)});let i=r.map(u=>s.map(a=>n.values[n.index.indexOf(u)][n.columns.indexOf(a)]));if(r.length===1&&s.length===1)return bt(i)[0];if(r.length===1){let u=new t(bt(i));return u.name=r[0],u.index=s,u}if(s.length===1){let u=new t(bt(i));return u.name=s[0],u.index=r,u}let o=new e(i);return o.columns=s,o.index=r,o}ns.exports=rf});var is=c((cb,ss)=>{var sf=F(),de=E();function of(e,t,n){function r(y,O){return sf(y)&&y.length>O?y.substring(0,O-3)+"...":y}if(n.isEmpty)return console.table({}),console.log("Shape:",[0,0],`
15
+ `),n;let s=typeof window>"u"?20:10,i=parseInt(s/2),o=typeof process>"u"?10:Math.floor(process.stdout.columns/24)-1,u=parseInt(o/2),a=s>n.index.length?null:de(0,i).concat(de(n.index.length-i,n.index.length)),l=o>n.columns.length?null:de(0,u).concat(de(n.columns.length-u,n.columns.length)),f=n.get(a,l);f instanceof t&&(n.shape[0]===1?(f=new e([f.values]),f.index=n.index,f.columns=new t(n.columns).get(l).values):n.shape[1]===1&&(f=new e([f.values]).transpose(),f.index=new t(n.index).get(a).values,f.columns=n.columns)),s<=n.index.length&&(f._index.splice(i,0,"..."),f._values.splice(i,0,de(0,f.columns.length).map(()=>"..."))),o<=n.columns.length&&(f._columns.splice(u,0,"..."),f._values=f._values.map(y=>(y.splice(u,0,"..."),y)));let d=28;return f instanceof t?(f.values=f.values.map(y=>r(y,d)),f.name=r(f.name,d),f.index=f.index.map(y=>r(y,d))):(f.values=f.values.map(y=>y.map(O=>r(O,d))),f.columns=f.columns.map(y=>r(y,d)),f.index=f.index.map(y=>r(y,d))),console.table(f.toObject()),console.log("Shape:",n.shape,`
16
+ `),n}ss.exports=of});var je=c((lb,os)=>{var uf=h(),af=p();function cf(e,t){uf(af(e),"The `leftPad` function only works on numbers!");let n=e.toString();for(;n.length<t;)n="0"+n;return n}os.exports=cf});var as=c((fb,us)=>{var lf=je(),ff=E();function hf(e,t){let n=t?e:e.copy();return n.index=ff(0,e.shape[0]).map(r=>"row"+lf(r,(n.index.length-1).toString().length)),n}us.exports=hf});var pe=c((hb,ls)=>{var mf=h(),df=S(),pf=m(),qf=g(),gf=q();function cs(e){if(qf(e)||gf(e))return cs(e.values);mf(pf(e),"The `product` function only works on arrays, Series, and DataFrames!");try{return e.length===0?NaN:df(e).reduce((t,n)=>t*n,1)}catch{return NaN}}ls.exports=cs});var Ie=c((mb,ds)=>{var qe=h(),fs=S(),hs=m(),yf=g(),ms=p(),bf=q(),Nf=pe(),vf=v();function Nt(e,t){if(yf(e)||bf(e))return Nt(e.values,t);if(qe(hs(e),"The first argument passed into the `reshape` function must be an array!"),ms(t)&&(t=[t]),qe(hs(t),"The second argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),qe(vf(t).length===1,"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),t.forEach(i=>{qe(ms(i)&&parseInt(i)===i&&i>0,"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!")}),t.length===0)return fs(e);let n=fs(e);if(t.length===1&&t[0]===n.length)return n;qe(Nf(t)===n.length,"The new shape doesn't match the number of values available in `x` (the first argument passed into the `reshape` function)!");let r=[],s=parseInt(n.length/t[0]);for(let i=0;i<t[0];i++){let o=n.slice(i*s,(i+1)*s);r.push(Nt(o,t.slice(1)))}return r}ds.exports=Nt});var te=c((db,vs)=>{var{copy:gs}=U(),wf=h(),Sf=m(),xf=p(),ys=b(),Tf=J(),Of=pe(),_f=Ie(),bs=Math.pow(2,64),w=[];Ns(parseInt(Math.random()*bs));function Df(e,t){e=T(e);function n(){e+=T("0x9e3779b97f4a7c15");let s=gs(e);return s=(s^s>>30n)*T("0xbf58476d1ce4e5b9"),s=(s^s>>27n)*T("0x94d049bb133111eb"),s^s>>31n}let r=[];for(let s=0;s<t;s++)r.push(n());return r}function T(e){return BigInt.asUintN(64,BigInt(e))}function ps(e,t){return e=T(e),t=BigInt(t),T(T(e<<t)|T(e>>T(64n-t)))}function Ns(e){if(ys(e))return gs(w);{wf(xf(e),"If passing a value into the `seed` function, then that value must be an integer!");let t=Df(parseInt(e),4);w[0]=t[0],w[1]=t[1],w[2]=t[2],w[3]=t[3]}}function qs(){let e=T(ps(w[0]+w[3],23)+w[0]),t=T(w[1]<<17n);return w[2]=T(w[2]^w[0]),w[3]=T(w[3]^w[1]),w[1]=T(w[1]^w[2]),w[0]=T(w[0]^w[3]),w[2]=T(w[2]^t),w[3]=ps(w[3],45),parseInt(e)/bs}function Ff(e){return ys(e)?qs():(Sf(e)||(e=[e]),_f(Tf(Of(e)).map(qs),e))}vs.exports={random:Ff,seed:Ns}});var Me=c((pb,ws)=>{var{random:Af}=te(),Ef=h(),jf=m(),If=g(),Mf=q();function Uf(e){if(If(e)||Mf(e))return e.shuffle(...Object.values(arguments).slice(1));Ef(jf(e),"The `shuffle` function only works on arrays, Series, and DataFrames!");let t=[],n=e.slice();for(let r=0;r<e.length;r++){let s=parseInt(Af()*n.length);t.push(n.splice(s,1)[0])}return t}ws.exports=Uf});var Ts=c((qb,xs)=>{var zf=h(),Cf=b(),Ss=Me();function Bf(e,t){return Cf(t)&&(t=0),zf(t===0||t===1,"The `axis` parameter to the `shuffle` must be 0, 1, or undefined."),e.get(t===0?Ss(e.index):null,t===1?Ss(e.columns):null)}xs.exports=Bf});var Ue=c((gb,Os)=>{function kf(e){return typeof e=="boolean"}Os.exports=kf});var Es=c((yb,As)=>{var{random:Jf}=te(),A=h(),Pf=S(),_s=m(),vt=Ue(),Fs=D(),ze=p(),ne=F(),wt=b(),Yf=E(),Ds=v(),St=P();function $f(e,t,n){return Fs(t)?Rf(e,t,n):Lf(e,t,n)}function Rf(e,t,n){if(n=wt(n)?0:n,A(Fs(t),"When sorting a DataFrame using a function, the first argument to the `sort` method must be a function!"),A(ze(n),"When sorting a DataFrame using a function, the second argument to the `sort` method must be null, undefined, 0, or 1 to indicate the axis along which the data should be sorted! An axis of 0 means that the rows will be sorted relative to each other, whereas an axis of 1 means that the columns will be sorted relative to each other."),n===0){let r=St(e.index,(s,i)=>t(e.get(s,null),e.get(i,null)));return e.get(r,null)}else{let r=St(e.columns,(s,i)=>t(e.get(null,s),e.get(null,i)));return e.get(null,r)}}function Lf(e,t,n){let r=e.copy(),s=Jf().toString();return r=r.assign(s,r.index),wt(t)&&(t=[s],n=[!0]),(ze(t)||ne(t))&&(t=[t],(vt(n)||ne(n))&&(n=[n])),A(_s(t),"The first parameter of the `sort` method must be (1) a string or index representing a column name or index, respectively; (2) a 1-dimensional array of strings and/or indices; or (3) null."),A(Ds(t).length===1,"The first parameter of the `sort` method must be (1) a string or index representing a column name or index, respectively; (2) a 1-dimensional array of strings and/or indices; or (3) null."),wt(n)&&(n=Yf(0,t.length).map(()=>!0)),A(_s(n),"The second parameter of the `sort` method must be (1) a string or boolean representing the sort direction ('ascending' / 'descending', or true / false); (2) a 1-dimensional array of strings and/or booleans; or (3) null."),A(Ds(n).length===1,"The second parameter of the `sort` method must be (1) a string or boolean representing the sort direction ('ascending' / 'descending', or true / false); (2) a 1-dimensional array of strings and/or booleans; or (3) null."),A(t.length===n.length,"The arrays passed into the `sort` method must be equal in length."),t=t.map(i=>{if(A(ne(i)||ze(i),"Column references can either be column names (as strings) or column indices (as whole numbers)."),ne(i)){let o=r.columns.indexOf(i);return A(o>-1,`The column "${i}" does not exist!`),o}if(ze(i))return A(parseInt(i)===i,"Column indices must be whole numbers!"),A(i>=0,`The column index ${i} is out of bounds!`),A(i<r.columns.length,`The index ${i} is out of bounds!`),i}),n=n.map(i=>{if(A(ne(i)||vt(i),"Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),ne(i)){let o=i.trim().toLowerCase();return A(o==="ascending"||o==="descending","Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),o==="ascending"}if(vt(i))return i}),r.values=St(r.values,(i,o)=>{let u=0;for(;i[t[u]]===o[t[u]]&&u<t.length;)u++;let a=n[u];if(i[t[u]]===o[t[u]])return 0;if(i[t[u]]<o[t[u]])return a?-1:1;if(i[t[u]]>o[t[u]])return a?1:-1}),r.index=Pf(r.get(null,s).values),r=r.dropColumns(s),r}As.exports=$f});var xt=c((bb,js)=>{function Kf(e,t){return JSON.stringify(e.toObject(t))}js.exports=Kf});var Is=c((Nb,Ot)=>{var Tt=X(),Vf=xt();function Gf(e,t,n){let r=Vf(e,n),s=!1,i=!1,o,u;try{let a=t;if(t.includes("/")){let f=t.split("/");a=f[f.length-1]}let l=document.createElement("a");l.href=`data:application/json;charset=utf-8,${encodeURIComponent(r)}`,l.download=a,l.dispatchEvent(new MouseEvent("click")),s=!0}catch(a){o=a}try{let a=hn("fs"),l=hn("path");a.writeFileSync(l.resolve(t),r,"utf8"),i=!0}catch(a){u=a}if(!s&&!i)throw typeof window<"u"?new Tt(o):typeof Ot<"u"?new Tt(u):new Tt("I don't know what's going wrong, but it doesn't seem like you're in Node or the browser, and we couldn't download and/or write the file to disk!");return e}Ot.exports=Gf});var Us=c((vb,Ms)=>{var Wf=h(),Hf=b();function Xf(e,t){Hf(t)?t=0:Wf(t===0||t===1,"The axis parameter of the `toObject` method must be undefined, 0, or 1. An axis of 0 indicates that the returned object should be organized first by rows and then by columns. An axis of 1 indicates that the returned object should be organized first by columns and then by rows.");let n={};return t===0?e.index.forEach((r,s)=>{let i={};e.columns.forEach((o,u)=>{i[o]=e.values[s][u]}),n[r]=i}):e.columns.forEach((r,s)=>{let i={};e.index.forEach((o,u)=>{i[o]=e.values[u][s]}),n[r]=i}),n}Ms.exports=Xf});var H=c((wb,Bs)=>{var zs=h(),Qf=m(),Zf=g(),eh=q(),th=J(),Cs=fe(),nh=v();function rh(e){if(Zf(e)||eh(e))return e.transpose();zs(Qf(e),"The `transpose` function only works on arrays, Series, and DataFrames!");let t=nh(e);if(zs(t.length<=2,"I'm not smart enough to know how to transpose arrays that have more than 2 dimensions. Sorry for the inconvenience! Please only pass 1- or 2-dimensional arrays into the `transpose` function!"),t.length===1)return Cs(e);if(t.length===2){let n=th(Cs(t));for(let r=0;r<t[0];r++)for(let s=0;s<t[1];s++)n[s][r]=e[r][s];return n}}Bs.exports=rh});var Ys=c((Sb,Ps)=>{var ks=h(),sh=m(),ih=g(),oh=Te(),uh=q(),ah=v();function Js(e,t,n){if(uh(n))return new e(t.values.concat(n.values));if(sh(n)){let r=ah(n);ks(r.length===1&&!oh(r),"Only vectors can be appended to Series!");let s=t.copy();return n.forEach((i,o)=>{s._values.push(i),s._index.push("item"+(t.values.length+o))}),s}return ks(!ih(n),"DataFrames cannot be appended to Series!"),Js(t,[n])}Ps.exports=Js});var Rs=c((xb,$s)=>{var ch=h(),lh=D();function fh(e,t){ch(lh(t),"The parameter to the `apply` method must be a function.");let n=e.copy();return n._values=n._values.map((r,s)=>t(r,s)),n}$s.exports=fh});var Ks=c((Tb,Ls)=>{var hh=b();function mh(e){let t=e.copy(),n=[];return t._values=t.values.filter((r,s)=>hh(r)?!1:(n.push(t.index[s]),!0)),t._index=n,t}Ls.exports=mh});var Gs=c((Ob,Vs)=>{var dh=p();function ph(e,t){let n=[],r=[];t.values.forEach((i,o)=>{dh(i)&&(r.push(i),n.push(t.index[o]))});let s=new e(r);return s.name=t.name,s.index=n,s}Vs.exports=ph});var Hs=c((_b,Ws)=>{var{copy:qh}=U();function gh(e,t,n){let r=t.copy(),s=qh(r.index),i=[],o=r.values.filter((u,a)=>{let l=n(u,a,r.values);return l||i.push(r.index[a]),l});return i.forEach(u=>{s.splice(s.indexOf(u),1)}),o.length===0?(r=new e,r.name=t.name,r):(r.values=o,r.index=s,r)}Ws.exports=gh});var Qs=c((Db,Xs)=>{var R=h(),yh=p(),bh=F(),Nh=b(),vh=M();function wh(e,t){(bh(t)||yh(t))&&(t=[t]);let n=vh((t||[]).map(r=>typeof r));return R(n.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===1&&R(n[0]==="string"||n[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===2&&(R(n.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),R(n.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),Nh(t)||(t=t.map(r=>{if(typeof r=="string")return R(e.index.indexOf(r)>-1,`Index "${r}" does not exist!`),r;if(typeof r=="number")return R(r>=0,`Index ${r} is out of bounds!`),R(parseInt(r)===r,"Indices must be integers!"),R(r<e.index.length,`Index ${r} is out of bounds!`),e.index[r]})),e.getSubsetByNames(t)}Xs.exports=wh});var ei=c((Fb,Zs)=>{var ge=h(),Sh=m(),xh=b(),Th=he(),Oh=E(),_h=v();function Dh(e,t){let n=e.shape;xh(t)&&(t=Oh(0,n[0])),ge(Sh(t),"The `indices` array must be 1-dimensional array of whole numbers."),ge(_h(t).length===1,"The `indices` array must be a 1-dimensional array of whole numbers."),ge(t.length>0,"The `indices` array must contain at least one index."),t.forEach(s=>{ge(Th(s),"The `indices` array must be a 1-dimensional array of whole numbers."),ge(s<e.index.length,`The row index ${s} is out of bounds.`)});let r=t.map(s=>e.index[s]);return e.getSubsetByNames(r)}Zs.exports=Dh});var ni=c((Ab,ti)=>{var ye=h(),Fh=m(),Ah=F(),Eh=b(),jh=v();function Ih(e,t,n){Eh(n)&&(n=t.index),ye(Fh(n),"The `indices` array must be a 1-dimensional array of strings."),ye(jh(n).length===1,"The `indices` array must be a 1-dimensional array of strings."),ye(n.length>0,"The `indices` array must contain at least one index name."),n.forEach(i=>{ye(Ah(i),"The `indices` array must contain only strings."),ye(t.index.indexOf(i)>-1,`The name "${i}" does not exist in the index.`)});let r=n.map(i=>t.values[t.index.indexOf(i)]);if(r.length===1)return r[0];let s=new e(r);return s.index=n,s.name=t.name,s}ti.exports=Ih});var ii=c((Eb,si)=>{var{copy:Mh}=U(),ri=E();function Uh(e){let t=e.copy(),n=typeof window>"u"?20:10;if(t.index.length>n){t=t.get(ri(0,n/2).concat(ri(t.index.length-n/2,t.index.length)));let s=Mh(t.index);s.splice(parseInt(s.length/2),0,"..."),t.values.push("..."),t.index.push("..."),t=t.get(s)}let r={};return t.values.forEach((s,i)=>{let o={};o[t.name]=s,r[t.index[i]]=o}),console.table(r),console.log("Shape:",e.shape,`
17
+ `),e}si.exports=Uh});var ui=c((jb,oi)=>{var zh=Me();function Ch(e){let t=e.copy();return t.get(zh(t.index))}oi.exports=Ch});var ci=c((Ib,ai)=>{var Bh=h(),kh=D(),Jh=b(),Ph=P(),Yh=H();function $h(e,t,n){n=n||((a,l)=>a<l?-1:1),Bh(Jh(n)||kh(n),"You must pass undefined, null, or a comparison function as the second argument to the `sort` method!");let r=Yh([t.values,t.index]),s=Ph(r,(a,l)=>n(a[0],l[0])),i=[],o=[];s.forEach(a=>{i.push(a[0]),o.push(a[1])});let u=new e;return u._values=i,u._index=o,u.name=t.name,u}ai.exports=$h});var hi=c((Mb,fi)=>{var Rh=P(),li=H();function Lh(e,t){let n=li([t.values,t.index]);n=li(Rh(n,(s,i)=>{if(s[1]===i[1])return 0;if(s[1]<i[1])return-1;if(s[1]>i[1])return 1}));let r=new e(n[0]);return r.index=n[1],r.name=t.name,r}fi.exports=Lh});var di=c((Ub,mi)=>{function Kh(e){let t={};return t[e.name]={},e.index.forEach((n,r)=>{t[e.name][n]=e.values[r]}),t}mi.exports=Kh});var bi=c((zb,yi)=>{var{copy:Ce}=U(),C=h(),_t=m(),Vh=F(),Gh=b(),pi=je(),qi=E(),Be=fe(),Wh=Ys(),Hh=Rs(),Xh=Ks(),Qh=Gs(),Zh=Hs(),em=Qs(),tm=ei(),nm=ni(),rm=ii(),sm=ui(),im=ci(),om=hi(),um=di(),be=v(),am=H(),gi=Symbol.for("@jrc03c/js-math-tools/series");yi.exports=function(e){class t{static[Symbol.hasInstance](r){try{return!!r._symbol&&r._symbol===gi}catch{return!1}}constructor(r){let s=this;if(s.name="data",Object.defineProperty(s,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:gi}),Object.defineProperty(s,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(s,"values",{configurable:!0,enumerable:!0,get(){return s._values},set(i){C(_t(i),"The new values must be a 1-dimensional array!");let o=be(i);C(o.length===1,"The new array of values must be 1-dimensional!"),o[0]<s._index.length?s._index=s._index.slice(0,o[0]):o[0]>s._index.length&&(s._index=s._index.concat(qi(s._index.length,o[0]).map(u=>"item"+pi(u,(i.length-1).toString().length)))),s._values=i}}),Object.defineProperty(s,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(s,"index",{configurable:!0,enumerable:!0,get(){return s._index},set(i){C(_t(i),"The new index must be a 1-dimensional array of strings!"),C(i.length===s.shape[0],"The new index must be the same length as the old index!"),C(be(i).length===1,"The new index must be a 1-dimensional array of strings!"),i.forEach(o=>{C(Vh(o),"All of the row names must be strings!")}),s._index=i}}),r){if(r instanceof t)s.name=r.name,s.values=Ce(r.values),s.index=Ce(r.index);else if(_t(r)){let i=be(r);C(i.length===1,"When passing an array into the constructor of a Series, the array must be 1-dimensional!"),s.values=r}else if(r instanceof Object){let i=Object.keys(r);C(i.length===1,"When passing an object into the constructor of a Series, the object must have only 1 key-value pair, where the key is the name of the data and the value is the 1-dimensional array of values!");let o=i[0],u=r[o];C(be(u).length===1,"When passing an object into the constructor of a Series, the object must have only 1 key-value pair, where the key is the name of the data and the value is the 1-dimensional array of values!"),s.name=o,s.values=u.slice()}}}get shape(){return be(this.values)}get length(){return this.shape[0]}get isEmpty(){return this.values.filter(s=>!Gh(s)).length===0}clear(){let s=this.copy();return s.values.forEach((i,o)=>{s.values[o]=void 0}),s}get(r){return em(this,r)}getSubsetByNames(r){return nm(t,this,r)}getSubsetByIndices(r){return tm(this,r)}loc(r){return this.getSubsetByNames(r)}iloc(r){return this.getSubsetByIndices(r)}reverse(){let r=this,s=new t(Be(r.values));return s.index=Be(r.index),s.name=r.name,s}resetIndex(){let r=this,s=r.copy();return s.index=qi(0,r.shape[0]).map(i=>"item"+pi(i,(s.index.length-1).toString().length)),s}copy(){let r=this,s=new t;return s._values=Ce(r.values),s._index=Ce(r.index),s.name=r.name,s}append(r){return Wh(t,this,r)}apply(r){return Hh(this,r)}concat(r){return this.append(r)}dropMissing(r,s){return Xh(this,r,s)}dropNaN(){return Qh(t,this)}toObject(){return um(this)}print(){return rm(this)}shuffle(){return sm(this)}sort(r){return im(t,this,r)}sortByIndex(){return om(t,this)}filter(r){return Zh(t,this,r)}toDataFrame(){let r=this,s=new e(am([r.values]));return s.columns=[r.name],s.index=r.index,s}transpose(){let s=this.copy();return s.values=Be(s.values),s.index=Be(s.index),s}getDummies(){return this.toDataFrame().getDummies()}oneHotEncode(){return this.getDummies()}}return t}});var ve=c((Cb,Ti)=>{var{copy:Dt}=U(),z=h(),Ni=ce(),cm=or(),lm=fr(),fm=pr(),hm=gr(),mm=xr(),dm=_r(),pm=Er(),qm=Ur(),gm=Br(),vi=Rr(),ym=Qr(),bm=rs(),Nm=is(),vm=as(),wm=Ts(),Sm=Es(),xm=Is(),Tm=xt(),Om=Us(),_m=S(),Ne=m(),Dm=k(),wi=b(),Ft=je(),Fm=J(),At=E(),re=v(),Si=H(),xi=Symbol.for("@jrc03c/js-math-tools/dataframe");function ke(e){let t="abcdefghijklmnopqrstuvwxyz1234567890",n="";for(let r=0;r<e;r++)n+=t[parseInt(Math.random()*t.length)];return n}var x=class{static[Symbol.hasInstance](t){try{return!!t._symbol&&t._symbol===xi}catch{return!1}}constructor(t){let n=this;if(Object.defineProperty(n,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:xi}),Object.defineProperty(n,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(n,"values",{configurable:!0,enumerable:!0,get(){return n._values.length===0||!wi(n._values[0])&&n._values[0].length===0?[[]]:n._values},set(r){z(Ne(r),"The new values must be a 2-dimensional array!");let s=re(r);z(s.length===2,"The new array of values must be 2-dimensional!"),s[0]<n._index.length?n._index=n._index.slice(0,s[0]):s[0]>n._index.length&&(n._index=n._index.concat(At(n._index.length,s[0]).map(i=>"row"+Ft(i,(s[0]-1).toString().length)))),s[1]<n._columns.length?n._columns=n._columns.slice(0,s[1]):s[1]>n._columns.length&&(n._columns=n._columns.concat(At(n._columns.length,s[1]).map(i=>"col"+Ft(i,(s[1]-1).toString().length)))),n._values=r}}),Object.defineProperty(n,"_columns",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(n,"columns",{configurable:!0,enumerable:!0,get(){return n._columns},set(r){z(Ne(r),"The new columns list must be a 1-dimensional array of strings!"),z(n.isEmpty||r.length===n.shape[1],"The new columns list must be the same length as the old columns list!"),z(re(r).length===1,"The new columns list must be a 1-dimensional array of strings!"),r=r.map(i=>(typeof i!="string"&&(i=JSON.stringify(i)||i.toString()),i.trim().length===0?"untitled_"+ke(8):i.trim()));let s=(()=>{let i=Ni(r),o={};return i.forEach(u=>{o[u.value]=u.count}),o})();r=r.map(i=>s[i]>1?i+"_"+ke(8):i),n._columns=r}}),Object.defineProperty(n,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(n,"index",{configurable:!0,enumerable:!0,get(){return n._index},set(r){z(Ne(r),"The new index must be a 1-dimensional array of strings!"),z(n.isEmpty||r.length===n.shape[0],"The new index must be the same length as the old index!"),z(re(r).length===1,"The new index must be a 1-dimensional array of strings!"),r=r.map(i=>(typeof i!="string"&&(i=JSON.stringify(i)||i.toString()),i.trim().length===0?"untitled_"+ke(8):i.trim()));let s=(()=>{let i=Ni(r),o={};return i.forEach(u=>{o[u.value]=u.count}),o})();r=r.map(i=>s[i]>1?i+"_"+ke(8):i),n._index=r}}),z(wi(t)||Dm(t)||Ne(t),"The `data` passed into the constructor of a DataFrame must be either (1) an object where the key-value pairs are (respectively) column names and 1-dimensional arrays of values, or (2) a 2-dimensional array of values."),t)if(t instanceof x)n.values=Dt(t.values),n.columns=Dt(t.columns),n.index=Dt(t.index);else if(Ne(t)){let r=re(t);z(r.length===2,"The `data` array passed into the constructor of a DataFrame must be 2-dimensional!"),n.values=t}else{n._columns=Object.keys(t);let r=[];n._columns.forEach(i=>{let o=t[i];r.push(o)}),n._values=Si(r);let s=re(n.values);n._index=At(0,s[0]).map(i=>"row"+Ft(i,(s[0]-1).toString().length))}}get shape(){return re(this.values)}get length(){return this.shape[0]}get width(){return this.shape[1]}get rows(){return this.index}set rows(t){let n=this;n.index=t}get isEmpty(){return _m(this.values).length===0}clear(){let t=this,n=new x(Fm(t.shape));return n.columns=t.columns.slice(),n.index=t.index.slice(),n}get(t,n){let r=this;if(arguments.length===0)return r;if(arguments.length===1)try{return r.get(null,t)}catch{return r.get(t,null)}return gm(r,t,n)}getSubsetByNames(t,n){return bm(x,L,this,t,n)}getSubsetByIndices(t,n){return ym(this,t,n)}getDummies(t){return vi(x,this,t)}oneHotEncode(t){return vi(x,this,t)}transpose(){let t=this,n=new x(Si(t.values));return n.columns=t.index.slice(),n.index=t.columns.slice(),n}get T(){return this.transpose()}resetIndex(t){return vm(this,t)}copy(){return hm(x,this)}assign(t,n){return fm(x,L,this,t,n)}apply(t,n){return lm(x,L,this,t,n)}dropMissing(t,n,r){return dm(x,L,this,t,n,r)}dropNaN(t,n,r){return pm(x,this,t,n,r)}drop(t,n){return mm(x,L,this,t,n)}dropColumns(t){return this.drop(null,t)}dropRows(t){return this.drop(t,null)}toObject(t){return Om(this,t)}toJSONString(t){return Tm(this,t)}saveAsJSON(t,n){return xm(this,t,n)}print(){return Nm(x,L,this)}sort(t,n){return Sm(this,t,n)}sortByIndex(){return this.sort()}filter(t,n){return qm(x,L,this,t,n)}shuffle(t){return wm(this,t)}append(t,n){return cm(this,t,n)}concat(t,n){return this.append(t,n)}join(t,n){return this.append(t,n)}toString(){return JSON.stringify(this)}},L=bi()(x);Ti.exports={DataFrame:x,Series:L}});var se=c((Bb,_i)=>{var Am=h(),Em=S(),jm=m(),Im=g(),Mm=q();function Oi(e){if(Im(e)||Mm(e))return Oi(e.values);Am(jm(e),"The `max` function only works on arrays, Series, and DataFrames!");try{return Math.max(...Em(e))}catch{return NaN}}_i.exports=Oi});var N=c((kb,ji)=>{var{DataFrame:Di,Series:Fi}=ve(),Ai=h(),we=m(),Et=g(),Ei=I(),Um=D(),jt=q(),zm=se(),Cm=E(),Je=v();function Bm(e){return we(e)||jt(e)||Et(e)}function km(e){return Ai(Um(e),"You must pass a function into the `vectorize` function!"),function t(){let n,r,s=[],i=[],o=Object.keys(arguments).filter(u=>{let a=arguments[u];return we(a)?!0:jt(a)?(n=!0,s.push(a),!0):Et(a)?(r=!0,i.push(a),!0):!1}).map(u=>arguments[u]);if(o.slice(0,-1).forEach((u,a)=>{Ai(Ei(we(u)?Je(u):u.shape,we(o[a+1])?Je(o[a+1]):o[a+1].shape),`When passing multiple arrays into the \`${e.name}\` function, all of the arrays must have the same shape!`)}),o.length>0){let u=zm(o.map(l=>l.length?l.length:l.values.length)),a=Cm(0,u).map(l=>{let f=Object.keys(arguments).map(d=>{if(Bm(arguments[d])){if(we(arguments[d]))return arguments[d][l];if(jt(arguments[d]))return arguments[d].values[l];if(Et(arguments[d]))return arguments[d].values[l]}else return arguments[d]});return t(...f)});if(r)try{if(i.length===1&&Ei(Je(i[0]),Je(a))){let l=new Di(a);return l.index=i[0].index.slice(),l.columns=i[0].columns.slice(),l}else return new Di(a)}catch{return a}if(n)try{if(s.length===1&&s[0].length===a.length){let l=new Fi(a);return l.name=s[0].name,l.index=s[0].index.slice(),l}else return new Fi(a)}catch{return a}return a}else return e(...arguments)}}ji.exports=km});var Pe=c((Jb,Ii)=>{var Jm=p(),Pm=N();function Ym(e){try{return Jm(e)?Math.abs(e):NaN}catch{return NaN}}Ii.exports=Pm(Ym)});var Ye=c((Pb,Mi)=>{var $m=p(),Rm=N();function Lm(){try{let e=0,t=Object.values(arguments);for(let n=0;n<t.length;n++){if(!$m(t[n]))return NaN;e+=t[n]}return e}catch{return NaN}}Mi.exports=Rm(Lm)});var Se=c((Yb,Ui)=>{var Km=N();function Vm(e,t){try{return t(e)}catch{return NaN}}Ui.exports=Km(Vm)});var Ci=c(($b,zi)=>{var Gm=p(),Wm=N();function Hm(e){try{return Gm(e)?Math.acos(e):NaN}catch{return NaN}}zi.exports=Wm(Hm)});var ki=c((Rb,Bi)=>{var Xm=p(),Qm=N();function Zm(e){try{return Xm(e)?Math.asin(e):NaN}catch{return NaN}}Bi.exports=Qm(Zm)});var Pi=c((Lb,Ji)=>{var ed=p(),td=N();function nd(e){try{return ed(e)?Math.atan(e):NaN}catch{return NaN}}Ji.exports=td(nd)});var $i=c((Kb,Yi)=>{var rd=h(),sd=ue(),id=m(),od=g(),ud=q(),ad=se();function It(e){if(od(e)){let t=It(e.values);return[e.index[t[0]],e.columns[t[1]]]}if(ud(e)){let t=It(e.values);return[e.index[t]]}rd(id(e),"The `argmax` function only works on arrays, Series, and DataFrames!");try{let t=sd(e,ad(e));return t?t.length===0?void 0:t.length===1?t[0]:t:void 0}catch{return}}Yi.exports=It});var $e=c((Vb,Li)=>{var cd=h(),ld=S(),fd=m(),hd=g(),md=q();function Ri(e){if(hd(e)||md(e))return Ri(e.values);cd(fd(e),"The `min` function only works on arrays, Series, and DataFrames!");try{return Math.min(...ld(e))}catch{return NaN}}Li.exports=Ri});var Vi=c((Gb,Ki)=>{var dd=h(),pd=ue(),qd=m(),gd=g(),yd=q(),bd=$e();function Mt(e){if(gd(e)){let t=Mt(e.values);return[e.index[t[0]],e.columns[t[1]]]}if(yd(e)){let t=Mt(e.values);return[e.index[t]]}dd(qd(e),"The `argmin` function only works on arrays, Series, and DataFrames!");try{let t=pd(e,bd(e));return t?t.length===0?void 0:t.length===1?t[0]:t:void 0}catch{return}}Ki.exports=Mt});var Ct=c((Wb,Hi)=>{var Gi=m(),Ut=Ue(),Nd=g(),vd=I(),Wi=p(),wd=k(),Sd=q(),zt=b();function B(e,t){if(Nd(e)||Sd(e))return e.apply(n=>B(n,t));if(Gi(e))return e.map(n=>B(n,t));if(t==="null")return null;if(t==="number"){if(zt(e))return NaN;let n=B(e,"boolean");if(Ut(n))return n?1:0;try{JSON.parse(e)}catch{let i=B(e,"date");if(i instanceof Date)return i.getTime()}let r=parseFloat(e);return isNaN(r)?NaN:r}if(t==="boolean"){if(Ut(e))return e;if(Wi(e))return e===0?!1:e===1?!0:null;try{let n=(typeof e=="object"?e.toString()==="null"?"false":JSON.stringify(e):e.toString()).trim().toLowerCase();return n==="true"||n==="yes"||n==="y"?!0:n==="false"||n==="no"||n==="n"?!1:null}catch{return null}}if(t==="date"){if(e instanceof Date)return e;if(zt(e))return null;let n=parseFloat(e);if(!isNaN(n)){let r=new Date(e);return r.toString()==="Invalid Date"?null:r}return null}if(t==="object"){if(wd(e))return e;let n=B(e,"boolean");if(Ut(n))return null;try{let s=B(e,"number");if(Wi(s))return JSON.parse(e),null}catch{}let r=B(e,"date");if(r)return r;try{let s=JSON.parse(e);return Gi(s)?s.map(i=>B(i,t)):s}catch{return null}}if(t==="string")return zt(e)?vd(e,void 0)?"undefined":"null":e instanceof Date?e.toJSON():(()=>typeof e=="object"?e===null?"null":JSON.stringify(e):e.toString())()}Hi.exports=B});var Qi=c((Hb,Xi)=>{var xd=p(),Td=N();function Od(e){try{return xd(e)?Math.ceil(e):NaN}catch{return NaN}}Xi.exports=Td(Od)});var to=c((Xb,eo)=>{var _d=Pe(),Zi=p(),Dd=b(),Fd=N();function Ad(e,t){try{if(!Zi(e))return NaN;if(Dd(t))t=1e-10;else if(!Zi(t))return NaN;return _d(e)<t?0:e}catch{return NaN}}eo.exports=Fd(Ad)});var ro=c((Qb,no)=>{var Bt=p(),Ed=N();function jd(e,t,n){try{return Bt(e)?Bt(t)?Bt(n)?e<t?t:e>n?n:e:NaN:NaN:NaN}catch{return NaN}}no.exports=Ed(jd)});var io=c((Zb,so)=>{var kt=h(),Id=S(),Md=m(),Ud=g(),zd=p(),Cd=q();function Jt(e,t){if(Ud(e)||Cd(e))return Jt(e.values,t);if(kt(Md(e),"The `combinations` function only works on arrays, Series, and DataFrames!"),kt(zd(t),"`r` must be a whole number!"),e=Id(e),t>e.length)return[e];if(t<=0)return[[]];if(kt(t===parseInt(t),"`r` must be a whole number!"),e.length<2)return e;let n=[];return e.forEach((r,s)=>{let i=e.slice(s+1);if(i.length<t-1)return;Jt(i,t-1).forEach(u=>{n.push([r].concat(u))})}),n}so.exports=Jt});var Re=c((e0,uo)=>{var Bd=h(),kd=S(),Jd=m(),Pd=g(),Yd=q();function oo(e){if(Pd(e)||Yd(e))return oo(e.values);Bd(Jd(e),"The `mean` function only works on arrays, Series, and DataFrames!");try{let t=kd(e),n=0;return t.forEach(r=>{n+=r}),n/t.length}catch{return NaN}}uo.exports=oo});var Yt=c((t0,mo)=>{var ao=h(),co=m(),Le=p(),lo=q(),fo=Re(),ho=v();function Pt(e,t){if(lo(e))return Pt(e.values,t);if(lo(t))return Pt(e,t.values);ao(co(e)&&co(t)&&ho(e).length===1&&ho(t).length===1,"The `covariance` function only works on 1-dimensional arrays and Series!"),ao(e.length===t.length,"The two arrays or Series passed into the `covariance` function must have the same length!");try{let n=fo(e),r=fo(t);if(!Le(n)||!Le(r))return NaN;let s=Math.max(e.length,t.length),i=0;for(let o=0;o<s;o++){if(!Le(e[o]))return NaN;if(!Le(t[o]))return NaN;i+=(e[o]-n)*(t[o]-r)}return i/e.length}catch{return NaN}}mo.exports=Pt});var Ke=c((n0,po)=>{var $d=p(),Rd=N();function Ld(e){try{return $d(e)?Math.sqrt(e):NaN}catch{return NaN}}po.exports=Rd(Ld)});var $t=c((r0,go)=>{var Kd=h(),Vd=S(),Gd=m(),Wd=g(),Hd=p(),Xd=q(),Qd=Re();function qo(e){if(Wd(e)||Xd(e))return qo(e.values);Kd(Gd(e),"The `variance` function only works on arrays, Series, and DataFrames!");try{let t=Vd(e),n=Qd(t),r=0;for(let s=0;s<t.length;s++){if(!Hd(t[s]))return NaN;r+=(t[s]-n)*(t[s]-n)}return r/t.length}catch{return NaN}}go.exports=qo});var Ve=c((s0,bo)=>{var Zd=h(),ep=m(),tp=g(),np=q(),rp=Ke(),sp=$t();function yo(e){if(tp(e)||np(e))return yo(e.values);Zd(ep(e),"The `std` function only works on arrays, Series, and DataFrames!");try{return rp(sp(e))}catch{return NaN}}bo.exports=yo});var Oo=c((i0,To)=>{var No=h(),ip=Yt(),vo=m(),wo=q(),So=v(),xo=Ve();function Rt(e,t){if(wo(e))return Rt(e.values,t);if(wo(t))return Rt(e,t.values);No(vo(e)&&vo(t)&&So(e).length===1&&So(t).length===1,"The `correl` function only works on 1-dimensional arrays and Series!"),No(e.length===t.length,"The two arrays or Series passed into the `correl` function must have the same length!");try{return ip(e,t)/(xo(e)*xo(t))}catch{return NaN}}To.exports=Rt});var Do=c((o0,_o)=>{var op=p(),up=N();function ap(e){try{return op(e)?Math.cos(e):NaN}catch{return NaN}}_o.exports=up(ap)});var Ao=c((u0,Fo)=>{Fo.exports=Object.freeze({boolean:"boolean",date:"date",null:"null",number:"number",object:"object",string:"string"})});var zo=c((a0,Uo)=>{var cp=h(),Eo=m(),jo=g(),lp=I(),Io=q(),Mo=M();function Lt(e,t){if(jo(e)||Io(e))return Lt(e.values,t);if(jo(t)||Io(t))return Lt(e,t.values);cp(Eo(e)&&Eo(t),"The `diff` function only works on arrays, Series, and DataFrames!");let n=Mo(e),r=Mo(t),s=[];return n.forEach(i=>{r.findIndex(o=>lp(o,i))<0&&s.push(i)}),s}Uo.exports=Lt});var Ge=c((c0,Bo)=>{var Co=p(),fp=N();function hp(e,t){try{return Co(e)?Co(t)?Math.pow(e,t):NaN:NaN}catch{return NaN}}Bo.exports=fp(hp)});var Kt=c((l0,ko)=>{var mp=p(),dp=N();function pp(){try{let e=Object.values(arguments);if(e.length===0)return NaN;let t=1;for(let n=0;n<e.length;n++){if(!mp(e[n]))return NaN;t*=e[n]}return t}catch{return NaN}}ko.exports=dp(pp)});var ie=c((f0,Jo)=>{var qp=Kt();function gp(){return qp(...arguments)}Jo.exports=gp});var Vt=c((h0,Po)=>{var yp=Ye(),bp=ie();function Np(e,t){return yp(e,bp(t,-1))}Po.exports=Np});var We=c((m0,$o)=>{var vp=h(),wp=S(),Sp=m(),xp=g(),Tp=q();function Yo(e){if(xp(e)||Tp(e))return Yo(e.values);vp(Sp(e),"The `sum` function only works on arrays, Series, and DataFrames!");try{return e.length===0?NaN:wp(e).reduce((t,n)=>t+n,0)}catch{return NaN}}$o.exports=Yo});var Ho=c((d0,Wo)=>{var Op=Pe(),_p=h(),Ro=m(),Lo=g(),Dp=I(),Ko=p(),Vo=q(),Fp=Ge(),Go=v(),Ap=Ke(),Ep=Vt(),jp=We();function Gt(e,t){if(Ko(e)&&Ko(t))return Op(e-t);if(Lo(e)||Vo(e))return Gt(e.values,t);if(Lo(t)||Vo(t))return Gt(e,t.values);Ro(e)&&Ro(t)&&_p(Dp(Go(e),Go(t)),"If passing two arrays, Series, or DataFrames into the `distance` function, then those objects must have the same shape!");try{return Ap(jp(Fp(Ep(e,t),2)))}catch{return NaN}}Wo.exports=Gt});var Qo=c((p0,Xo)=>{var Ip=Ge(),Mp=ie();function Up(e,t){return Mp(e,Ip(t,-1))}Xo.exports=Up});var Ht=c((q0,su)=>{var{DataFrame:Zo,Series:eu}=ve(),He=h(),tu=S(),nu=m(),Wt=g(),zp=p(),Xe=q(),Cp=ie(),Qe=v(),Bp=We(),ru=H();function K(e,t){if(Wt(e)){let s=K(e.values,t);if(Qe(s).length===1){let i=new eu(s);return i.name=Xe(t)?t.name:i.name,i.index=e.index.slice(),i}else{let i=new Zo(s);return i.index=e.index.slice(),Wt(t)&&(i.columns=t.columns.slice()),i}}if(Wt(t)){let s=K(e,t.values);if(Qe(s).length===1){let i=new eu(s);return i.name=Xe(e)?e.name:i.name,i.index=t.columns.slice(),i}else{let i=new Zo(s);return i.columns=t.columns.slice(),i}}if(Xe(e))return K(e.values,t);if(Xe(t))return K(e,t.values);He(nu(e)&&nu(t),"The `dot` function only works on arrays, Series, and DataFrames!"),tu(e).concat(tu(t)).forEach(s=>{He(zp(s),"One of the arrays you passed into the `dot` function contains non-numerical values!")});let n=Qe(e),r=Qe(t);if(He(n.length<=2&&r.length<=2,"I'm not smart enough to know how to get the dot-product of arrays that have more than 2 dimensions. Sorry for the inconvenience! Please only pass 1- or 2-dimensional arrays into the `dot` function!"),He(n[n.length-1]===r[0],`There's a dimension misalignment in the two arrays you passed into the \`dot\` function. (${n[n.length-1]} !== ${r[0]})`),n.length===1&&r.length===1)return Bp(Cp(e,t));if(n.length===1&&r.length===2)return ru(t).map(s=>K(e,s));if(n.length===2&&r.length===1)return e.map(s=>K(s,t));if(n.length===2&&r.length===2){let s=ru(t),i=[];for(let o=0;o<e.length;o++){let u=[];for(let a=0;a<s.length;a++)u.push(K(e[o],s[a]));i.push(u)}return i}}su.exports=K});var Xt=c((g0,ou)=>{var kp=h(),Jp=m(),Pp=g(),Yp=q(),$p=b();function iu(e){if(Pp(e)||Yp(e))return e.dropMissing(...Object.values(arguments).slice(1));kp(Jp(e),"The `dropMissing` function only works on arrays, Series, and DataFrames!");let t=[];return e.forEach(n=>{try{return t.push(iu(n))}catch{$p(n)||t.push(n)}}),t}ou.exports=iu});var du=c((y0,mu)=>{var uu=h(),au=m(),cu=g(),Rp=I(),lu=q(),fu=b(),hu=v();function Ze(e,t){if(cu(e)||lu(e))return Ze(e.values,t);if(cu(t)||lu(t))return Ze(e,t.values);uu(au(e)&&au(t),"The `dropMissingPairwise` function only works on arrays, Series, and DataFrames!"),uu(Rp(hu(e),hu(t)),"The two arrays, Series, and/or DataFrames passed into the `dropMissingPairwise` function must have the same shape!");let n=[],r=[];for(let s=0;s<e.length;s++)try{let[i,o]=Ze(e[s],t[s]);n.push(i),r.push(o)}catch{!fu(e[s])&&!fu(t[s])&&(n.push(e[s]),r.push(t[s]))}return[n,r]}mu.exports=Ze});var wu=c((b0,vu)=>{var pu=h(),qu=m(),gu=g(),Lp=I(),yu=p(),bu=q(),Nu=v();function et(e,t){if(gu(e)||bu(e))return et(e.values,t);if(gu(t)||bu(t))return et(e,t.values);pu(qu(e)&&qu(t),"The `dropNaNPairwise` only works on arrays, Series, and DataFrames!"),pu(Lp(Nu(e),Nu(t)),"The two arrays, Series, and/or DataFrames passed into the `dropNaNPairwise` must have the same shape!");let n=[],r=[];for(let s=0;s<e.length;s++)try{let[i,o]=et(e[s],t[s]);n.push(i),r.push(o)}catch{yu(e[s])&&yu(t[s])&&(n.push(e[s]),r.push(t[s]))}return[n,r]}vu.exports=et});var xu=c((N0,Su)=>{var Kp=Xt();function Vp(e){return Kp(e)}Su.exports=Vp});var Ou=c((v0,Tu)=>{var Gp=p(),Wp=N();function Hp(e){try{return Gp(e)?Math.exp(e):NaN}catch{return NaN}}Tu.exports=Wp(Hp)});var Fu=c((w0,Du)=>{var Xp=N();function _u(e){try{return e!==parseInt(e)?NaN:e<=1?1:e*_u(e-1)}catch{return NaN}}Du.exports=Xp(_u)});var Iu=c((S0,ju)=>{var Qp=h(),Zp=S(),Au=m(),eq=g(),tq=D(),Eu=k(),nq=q();function Qt(e,t){if(eq(e))return Qt(Zp(e.values),t);if(nq(e))return Qt(e.values,t);if(Qp(Eu(e)||Au(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `find` function!"),!tq(t)){let s=t;t=i=>i===s}function n(s,i,o){if(o=o||[],o.indexOf(s)>-1)return null;if(Eu(s)){o.push(s);let u=Object.keys(s);for(let a=0;a<u.length;a++){let l=u[a],f=s[l];if(i(f))return f;let d=n(f,i,o);if(d)return d}}else if(Au(s)){o.push(s);for(let u=0;u<s.length;u++){let a=s[u];if(i(a))return a;let l=n(a,i,o);if(l)return l}}else if(i(s))return s;return null}function r(s){try{return t(s)}catch{return!1}}return n(e,r)}ju.exports=Qt});var Cu=c((x0,zu)=>{var rq=h(),sq=S(),Mu=m(),iq=g(),oq=D(),Uu=k(),uq=q();function Zt(e,t){if(iq(e))return Zt(sq(e.values),t);if(uq(e))return Zt(e.values,t);if(rq(Uu(e)||Mu(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `findAll` function!"),!oq(t)){let i=t;t=o=>o===i}function n(i,o,u){if(u=u||[],u.indexOf(i)>-1)return null;if(Uu(i)){u.push(i);let a=Object.keys(i),l=[];for(let f=0;f<a.length;f++){let d=a[f],y=i[d],O=!1;o(y)&&(l.push(y),O=!0);let G=n(y,o,u);G&&G.length>0&&G.slice(O?1:0).forEach(_=>l.push(_))}return l}else if(Mu(i)){u.push(i);let a=[];for(let l=0;l<i.length;l++){let f=i[l],d=!1;o(f)&&(a.push(f),d=!0);let y=n(f,o,u);y&&y.length>0&&y.slice(d?1:0).forEach(O=>a.push(O))}return a}else if(o(i))return[i];return null}function r(i){try{return t(i)}catch{return!1}}let s=n(e,r);return s&&s.length>0?s:null}zu.exports=Zt});var ku=c((T0,Bu)=>{var aq=p(),cq=N();function lq(e){try{if(e==="Infinity")return 1/0;if(e==="-Infinity")return-1/0;let t=JSON.parse(e);return aq(t)?t:NaN}catch{return NaN}}Bu.exports=cq(lq)});var Pu=c((O0,Ju)=>{var fq=p(),hq=N();function mq(e){try{return fq(e)?Math.floor(e):NaN}catch{return NaN}}Ju.exports=hq(mq)});var en=c((_0,Yu)=>{var dq=p(),pq=pe(),qq=Ie();function gq(e){dq(e)&&(e=[e]);let t=[],n=pq(e);for(let r=0;r<n;r++)t.push(0);return qq(t,e)}Yu.exports=gq});var Ru=c((D0,$u)=>{var tt=h(),yq=p(),bq=b(),Nq=en();function vq(e){tt(!bq(e),"You must pass an integer greater than 0 (representing the size) into the `identity` function!"),tt(yq(e),"You must pass an integer greater than 0 (representing the size) into the `identity` function!"),tt(parseInt(e)===e,"You must pass an integer greater than 0 (representing the size) into the `identity` function!"),tt(e>0,"You must pass an integer greater than 0 (representing the size) into the `identity` function!");let t=Nq([e,e]);for(let n=0;n<e;n++)t[n][n]=1;return t}$u.exports=vq});var Ku=c((F0,Lu)=>{Lu.exports=["true","false","yes","no"]});var Gu=c((A0,Vu)=>{Vu.exports=["null","none","nan","na","n/a","","undefined"]});var Hu=c((E0,Wu)=>{var wq=Se(),Sq=h(),xq=Ku(),Tq=Ct(),Oq=ce(),_q=S(),tn=m(),Dq=g(),Fq=p(),Aq=q(),Eq=F(),jq=Gu();function nt(e){if(Dq(e)){let s=e.copy(),i=nt(e.values);return s.values=i.values,{type:i.type,values:s}}if(Aq(e)){let s=e.copy(),i=nt(e.values);return s.values=i.values,{type:i.type,values:s}}if(e instanceof Date)return{type:"date",value:e};if(!tn(e)){let s=nt([e]);return s.value=s.values[0],delete s.values,s}Sq(tn(e),"The `inferType` function only works on arrays, Series, and DataFrames!");let t=_q(e).map(s=>{if(s===void 0)return"null";if(s instanceof Date)return"date";Eq(s)||(s=JSON.stringify(s));let o=s.toLowerCase().trim();if(jq.indexOf(o)>-1)return"null";if(xq.indexOf(o)>-1)return"boolean";try{let u=JSON.parse(s);return Fq(u)?"number":typeof u=="object"?tn(u)?"string":"object":"string"}catch{return new Date(s).toString()!=="Invalid Date"?"date":"string"}}),r=Oq(t).sort((s,i)=>i.count-s.count)[0].value;return{type:r,values:wq(e,s=>Tq(s,r))}}Wu.exports=nt});var Qu=c((j0,Xu)=>{var Iq=p(),Mq=N();function Uq(e){try{let t=JSON.parse(e);return Iq(t)?parseInt(t):NaN}catch{return NaN}}Xu.exports=Mq(Uq)});var ea=c((I0,Zu)=>{var zq=h(),Cq=m(),Bq=g(),kq=I(),Jq=q(),nn=M();function Pq(){let e=Object.values(arguments).map(n=>Bq(n)||Jq(n)?nn(n.values):(zq(Cq(n),"The `intersect` function only works on arrays, Series, and DataFrames!"),nn(n)));return nn(e).filter(n=>e.every(r=>r.findIndex(s=>kq(s,n))>-1))}Zu.exports=Pq});var sa=c((M0,ra)=>{var ta=Ye(),V=h(),Yq=Ht(),$q=S(),Rq=m(),Lq=g(),rn=p(),na=ie(),Kq=v();function rt(e){if(Lq(e)){let n=e.copy();return n.values=rt(n.values),n}V(Rq(e),"The `inverse` function only works on square 2-dimensional arrays or DataFrames!"),$q(e).forEach(n=>V(rn(n),"The array passed into the `inverse` function must contain only numbers!"));let t=Kq(e);if(V(t.length===2,"The array passed into the `inverse` function must be exactly two-dimensional and square!"),V(t[0]===t[1],"The array passed into the `inverse` function must be exactly two-dimensional and square!"),V(t[0]>=0,"The array passed into the `inverse` function must be exactly two-dimensional and square!"),t[0]===0)return e;if(t[0]===1)return V(e[0][0]!==0,"This matrix cannot be inverted!"),1/e[0][0];if(t[0]===2){let n=e[0][0],r=e[0][1],s=e[1][0],i=e[1][1],o=n*i-r*s;V(o!==0,"This matrix cannot be inverted!");let u=[[i,-r],[-s,n]];return na(u,1/o)}else if(t[0]>1){let n=(r,s)=>rn(r)||rn(s)?na(r,s):Yq(r,s);for(let r=1;r<t[0]-1;r++)try{let s=e.slice(0,r).map(_=>_.slice(0,r)),i=e.slice(0,r).map(_=>_.slice(r,t[0])),o=e.slice(r,t[0]).map(_=>_.slice(0,r)),u=e.slice(r,t[0]).map(_=>_.slice(r,t[0])),a=rt(s),l=rt(ta(u,n(-1,n(n(o,a),i)))),f=ta(a,n(n(n(n(a,i),l),o),a)),d=n(-1,n(n(a,i),l)),y=n(-1,n(n(l,o),a)),O=l;return f.map((_,ot)=>_.concat(d[ot])).concat(y.map((_,ot)=>_.concat(O[ot])))}catch{}V(!1,"This matrix cannot be inverted!")}}ra.exports=rt});var oa=c((U0,ia)=>{var Vq=new Function(`
18
+ try {
19
+ return this === window
20
+ } catch(e) {}
21
+
22
+ try {
23
+ return !!importScripts
24
+ } catch(e){}
25
+
26
+ return false
27
+ `);ia.exports=Vq});var aa=c((z0,ua)=>{var sn=p(),Gq=N();function Wq(e,t,n){try{return sn(e)?sn(t)?sn(n)?n*(t-e)+e:NaN:NaN:NaN}catch{return NaN}}ua.exports=Gq(Wq)});var fa=c((C0,la)=>{var ca=p(),Hq=b(),Xq=N();function Qq(e,t){try{return t=Hq(t)?Math.E:t,ca(e)?ca(t)?Math.log(e)/Math.log(t):NaN:NaN}catch{return NaN}}la.exports=Xq(Qq)});var da=c((B0,ma)=>{var Zq=h(),eg=S(),tg=m(),ng=g(),rg=q(),sg=P();function ha(e){if(ng(e)||rg(e))return ha(e.values);Zq(tg(e),"The `median` function only works on arrays, Series, and DataFrames!");try{let t=sg(eg(e));return t.length===0?NaN:t.length%2===0?(t[t.length/2-1]+t[t.length/2])/2:t[parseInt(t.length/2)]}catch{return NaN}}ma.exports=ha});var ga=c((k0,qa)=>{var pa=p(),ig=N();function og(e,t){try{return pa(e)?pa(t)?e%t:NaN:NaN}catch{return NaN}}qa.exports=ig(og)});var va=c((J0,Na)=>{var ug=h(),ag=ce(),cg=S(),lg=m(),fg=g(),hg=q(),mg=M(),ya=P();function ba(e){if(fg(e)||hg(e))return ba(e.values);ug(lg(e),"The `mode` function only works on arrays, Series, and DataFrames!");try{if(e.length===0)return NaN;let t=cg(e);if(t.length===0)return NaN;let n={},r=mg(t);r.forEach(u=>{n[u]=ag(t,u)});let s=ya(r,(u,a)=>n[a]-n[u]),i=s[0];return ya(s.filter(u=>n[u]===n[i]))}catch{return NaN}}Na.exports=ba});var Ta=c((P0,xa)=>{var{random:wa}=te(),dg=Se(),pg=b(),qg=J();function Sa(){let e=wa(),t=wa();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}function gg(e){return pg(e)?Sa():dg(qg(e),Sa)}xa.exports=gg});var _a=c((Y0,Oa)=>{var yg=Se(),bg=J();function Ng(e){return yg(bg(e),()=>1)}Oa.exports=Ng});var Fa=c(($0,Da)=>{var on=h(),vg=S(),wg=m(),Sg=g(),xg=p(),Tg=q(),Og=b();function st(e,t){if(Sg(e)||Tg(e))return st(e.values,t);if(on(wg(e),"The `permutations` function only works on arrays, Series, and DataFrames!"),Og(t)&&(t=e.length),on(xg(t),"`r` must be a whole number!"),e=vg(e),t>e.length)return st(e);if(t<=0)return[[]];if(on(t===parseInt(t),"`r` must be a whole number!"),e.length<2)return e;let n=[];return e.forEach((r,s)=>{let i=e.slice(0,s),o=e.slice(s+1),u=i.concat(o);st(u,t-1).forEach(l=>{n.push([r].concat(l))})}),n}Da.exports=st});var Ea=c((R0,Aa)=>{var{DataFrame:_g,Series:Dg}=ve(),Fg=m(),Ag=g(),Eg=le(),jg=q(),Ig=v();function Mg(){Object.keys(arguments).forEach(e=>{let t=arguments[e];if(Fg(t))if(Eg(t))console.log(t);else{let n=Ig(t);n.length===1?new Dg(t).print():n.length==2?new _g(t).print():console.log(t)}else Ag(t)||jg(t)?t.print():console.log(t)})}Aa.exports=Mg});var Ma=c((L0,Ia)=>{var Ug=m(),zg=p(),ja=b(),Cg=se(),Bg=$e(),kg=N(),Jg=kg(function(e,t,n,r,s){try{return[e,t,n,r,s].every(i=>zg(i))?n-t===0?NaN:(s-r)*(e-t)/(n-t)+r:NaN}catch{return NaN}});function Pg(e,t,n,r,s){return Ug(e)&&ja(r)&&ja(s)&&(r=t,s=n,t=Bg(e),n=Cg(e)),Jg(e,t,n,r,s)}Ia.exports=Pg});var za=c((K0,Ua)=>{var Yg=p(),$g=N();function Rg(e){try{return Yg(e)?Math.round(e):NaN}catch{return NaN}}Ua.exports=$g(Rg)});var Ba=c((V0,Ca)=>{var Lg=p(),Kg=N();function Vg(e){try{return Lg(e)?e<0?-1:e>0?1:0:NaN}catch{return NaN}}Ca.exports=Kg(Vg)});var Ja=c((G0,ka)=>{var Gg=p(),Wg=N();function Hg(e){try{return Gg(e)?Math.sin(e):NaN}catch{return NaN}}ka.exports=Wg(Hg)});var Ya=c((W0,Pa)=>{var Xg=Ve();function Qg(e){return Xg(e)}Pa.exports=Qg});var Ra=c((H0,$a)=>{var Zg=p(),ey=N();function ty(e){try{return Zg(e)?Math.tan(e):NaN}catch{return NaN}}$a.exports=ey(ty)});var it=c((X0,Va)=>{var La=h(),Ka=D();function ny(e,t){La(Ka(e),"`fn` must be a function!");let n=new Date;return t?e(...t):e(),new Date-n}async function ry(e,t){La(Ka(e),"`fn` must be a function!");let n=new Date;return t?await e(...t):await e(),new Date-n}Va.exports={timeSync:ny,timeAsync:ry}});var Wa=c((Q0,Ga)=>{var sy=m(),iy=g(),oy=q(),uy=M();function ay(){return uy([...arguments].map(e=>sy(e)?e:iy(e)||oy(e)?e.values:[e]))}Ga.exports=ay});var Xa=c((Z0,Ha)=>{var cy=h(),ly=m(),fy=g(),hy=q(),my=b(),dy=se(),py=E();function qy(){let e=[],t=Object.values(arguments).map(n=>((fy(n)||hy(n))&&(n=n.values),cy(ly(n),"The `zip` function only works on arrays, Series, and DataFrames!"),n));return py(0,dy(t.map(n=>n.length))).forEach(n=>{let r=[];t.forEach(s=>{let i=s[n];r.push(my(i)?void 0:i)}),e.push(r)}),e}Ha.exports=qy});var Qa=c((eN,un)=>{var{copy:gy,decycle:yy}=U(),{DataFrame:by,Series:Ny}=ve(),oe={abs:Pe(),add:Ye(),apply:Se(),arccos:Ci(),arcsin:ki(),arctan:Pi(),argmax:$i(),argmin:Vi(),assert:h(),cast:Ct(),ceil:Qi(),chop:to(),clamp:ro(),combinations:io(),copy:gy,correl:Oo(),cos:Do(),count:ce(),covariance:Yt(),DataFrame:by,dataTypes:Ao(),decycle:yy,diff:zo(),distance:Ho(),divide:Qo(),dot:Ht(),dropMissing:Xt(),dropMissingPairwise:du(),dropNaN:gt(),dropNaNPairwise:wu(),dropUndefined:xu(),exp:Ou(),factorial:Fu(),find:Iu(),findAll:Cu(),flatten:S(),float:ku(),floor:Pu(),identity:Ru(),indexOf:ue(),inferType:Hu(),int:Qu(),intersect:ea(),inverse:sa(),isArray:m(),isBoolean:Ue(),isBrowser:oa(),isDataFrame:g(),isEqual:I(),isFunction:D(),isJagged:le(),isNested:Te(),isNumber:p(),isObject:k(),isSeries:q(),isString:F(),isUndefined:b(),lerp:aa(),log:fa(),MathError:X(),max:se(),mean:Re(),median:da(),min:$e(),mod:ga(),mode:va(),multiply:Kt(),ndarray:J(),normal:Ta(),ones:_a(),permutations:Fa(),pow:Ge(),print:Ea(),product:pe(),random:te().random,range:E(),remap:Ma(),reshape:Ie(),reverse:fe(),round:za(),scale:ie(),seed:te().seed,Series:Ny,set:M(),shape:v(),shuffle:Me(),sign:Ba(),sin:Ja(),sort:P(),sqrt:Ke(),std:Ve(),stdev:Ya(),subtract:Vt(),sum:We(),tan:Ra(),time:it().timeSync,timeSync:it().timeSync,timeAsync:it().timeAsync,transpose:H(),union:Wa(),variance:$t(),vectorize:N(),zeros:en(),zip:Xa(),dump:function(){let e=typeof global<"u"?global:window;if(!e)throw new oe.MathError("Cannot dump functions into global scope because neither `global` nor `window` exist in the current context!");Object.keys(oe).forEach(t=>{try{Object.defineProperty(e,t,{configurable:!1,enumerable:!0,writable:!1,value:oe[t]})}catch{e[t]=oe[t]}})}};typeof un<"u"&&(un.exports=oe);typeof window<"u"&&(window.JSMathTools=oe)});var xy=c((tN,fn)=>{var{assert:an,int:cn,isNumber:ln,isString:vy,random:wy,seed:Sy}=Qa();function Za(e,t,n){arguments.length===2&&(ln(arguments[1])?n=null:(n=t,t=null)),an(ln(e)&&cn(e)===e,"`keyLength` must be an integer!"),t&&(an(ln(t)&&cn(t)===t,"`keySeed` must be an integer!"),Sy(t)),n&&an(vy(n),"`charset` must be a string!");let r="";n=n||"abcdefg1234567890";for(let s=0;s<e;s++)r+=n[cn(wy()*n.length)];return r}typeof fn<"u"&&(fn.exports=Za);typeof window<"u"&&(window.makeKey=Za)});xy();})();
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@jrc03c/make-key",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
- "main": "index.js",
5
+ "main": "src/index.js",
6
6
  "scripts": {
7
+ "build": "esbuild src/index.js --bundle --outfile=dist/make-key.js --minify",
8
+ "watch": "esbuild src/index.js --bundle --outfile=dist/make-key.js --minify --watch",
9
+ "test": "jest",
7
10
  "pub": "npm version patch --force && npm publish --access=public"
8
11
  },
9
12
  "keywords": [],
@@ -15,5 +18,10 @@
15
18
  },
16
19
  "dependencies": {
17
20
  "@jrc03c/js-math-tools": "github:jrc03c/js-math-tools"
21
+ },
22
+ "devDependencies": {
23
+ "esbuild": "^0.17.11",
24
+ "eslint": "^8.36.0",
25
+ "jest": "^29.5.0"
18
26
  }
19
27
  }
package/readme.md CHANGED
@@ -12,10 +12,12 @@ npm install --save https://github.com/jrc03c/make-key
12
12
 
13
13
  ## Usage
14
14
 
15
+ Node / bundlers:
16
+
15
17
  ```js
16
- let makeKey = require("@jrc03c/make-key")
17
- let keyLength = 32
18
- let keySeed = 1234
18
+ const makeKey = require("@jrc03c/make-key")
19
+ const keyLength = 32
20
+ const keySeed = 1234
19
21
 
20
22
  console.log(makeKey(keyLength))
21
23
  // "8v1101x1whevcm1cgdhuq90e12549xri"
@@ -24,6 +26,30 @@ console.log(makeKey(keyLength, keySeed))
24
26
  // "dcb09fuuv3smirvqaetiyggvhap90e88"
25
27
  ```
26
28
 
29
+ Browser:
30
+
31
+ ```html
32
+ <script src="path/to/@jrc03c/make-key/dist/make-key.js"></script>
33
+ <script>
34
+ // (makeKey is now in the global scope)
35
+
36
+ const keyLength = 32
37
+ const keySeed = 1234
38
+
39
+ console.log(makeKey(keyLength))
40
+ // "8v1101x1whevcm1cgdhuq90e12549xri"
41
+
42
+ console.log(makeKey(keyLength, keySeed))
43
+ // "dcb09fuuv3smirvqaetiyggvhap90e88"
44
+ </script>
45
+ ```
46
+
47
+ ## API
48
+
49
+ ### `makeKey(length, seed, charset)`
50
+
51
+ Returns a random string of length `length`. Can optionally be given a random `seed` value as a number and/or a `charset` as a string of characters from which to generate the new string.
52
+
27
53
  # CLI
28
54
 
29
55
  ## Installation
@@ -43,6 +69,12 @@ sudo apt-get install -y xsel
43
69
  ## Usage
44
70
 
45
71
  ```bash
46
- # key <length> <seed-integer>
72
+ # key <length> <seed>
47
73
  key 32 12345
48
74
  ```
75
+
76
+ ## API
77
+
78
+ ### `key <length> <seed> <charset>`
79
+
80
+ These arguments mean the same thing as in the Node / browser API.
package/src/index.js ADDED
@@ -0,0 +1,54 @@
1
+ const {
2
+ assert,
3
+ int,
4
+ isNumber,
5
+ isString,
6
+ random,
7
+ seed,
8
+ } = require("@jrc03c/js-math-tools")
9
+
10
+ function makeKey(keyLength, keySeed, charset) {
11
+ if (arguments.length === 2) {
12
+ if (isNumber(arguments[1])) {
13
+ charset = null
14
+ } else {
15
+ charset = keySeed
16
+ keySeed = null
17
+ }
18
+ }
19
+
20
+ assert(
21
+ isNumber(keyLength) && int(keyLength) === keyLength,
22
+ "`keyLength` must be an integer!"
23
+ )
24
+
25
+ if (keySeed) {
26
+ assert(
27
+ isNumber(keySeed) && int(keySeed) === keySeed,
28
+ "`keySeed` must be an integer!"
29
+ )
30
+
31
+ seed(keySeed)
32
+ }
33
+
34
+ if (charset) {
35
+ assert(isString(charset), "`charset` must be a string!")
36
+ }
37
+
38
+ let out = ""
39
+ charset = charset || "abcdefg1234567890"
40
+
41
+ for (let i = 0; i < keyLength; i++) {
42
+ out += charset[int(random() * charset.length)]
43
+ }
44
+
45
+ return out
46
+ }
47
+
48
+ if (typeof module !== "undefined") {
49
+ module.exports = makeKey
50
+ }
51
+
52
+ if (typeof window !== "undefined") {
53
+ window.makeKey = makeKey
54
+ }
@@ -0,0 +1,39 @@
1
+ const makeKey = require("./index.js")
2
+
3
+ test("tests that random strings can be generated correctly", () => {
4
+ const a = makeKey(123)
5
+ expect(a.length).toBe(123)
6
+
7
+ const b = makeKey(123)
8
+ const c = makeKey(123)
9
+ expect(b).not.toBe(c)
10
+
11
+ const d = makeKey(123, 12345)
12
+ const e = makeKey(123, 12345)
13
+ expect(d).toBe(e)
14
+
15
+ const f = makeKey(64, 12345)
16
+ const g = makeKey(32, 12345)
17
+ expect(f.includes(g)).toBe(true)
18
+ expect(g.includes(f)).toBe(false)
19
+
20
+ const charset = "Hello, world!"
21
+ const h = makeKey(123, charset)
22
+
23
+ h.split("").forEach(char => {
24
+ expect(charset.includes(char)).toBe(true)
25
+ })
26
+
27
+ const i = makeKey(123, charset)
28
+ expect(h).not.toBe(i)
29
+
30
+ const j = makeKey(123, 12345, charset)
31
+ const k = makeKey(123, 12345, charset)
32
+ expect(j).toBe(k)
33
+ expect(makeKey(123, 12345, "foobar")).not.toBe(k)
34
+
35
+ const l = makeKey(64, 12345, charset)
36
+ const m = makeKey(32, 12345, charset)
37
+ expect(l.includes(m)).toBe(true)
38
+ expect(m.includes(l)).toBe(false)
39
+ })
package/index.js DELETED
@@ -1,30 +0,0 @@
1
- const { assert, isNumber, int, seed, random } = require("@jrc03c/js-math-tools")
2
-
3
- function makeKey(keyLength, keySeed) {
4
- assert(
5
- isNumber(keyLength) && int(keyLength) === keyLength,
6
- "`keyLength` must be an integer!"
7
- )
8
-
9
- if (keySeed) {
10
- assert(
11
- isNumber(keySeed) && int(keySeed) === keySeed,
12
- "`keySeed` must be an integer!"
13
- )
14
-
15
- seed(keySeed)
16
- }
17
-
18
- let out = ""
19
- let alpha = "abcdefghijklmnopqrstuvwxyz1234567890"
20
-
21
- for (let i = 0; i < keyLength; i++) {
22
- out += alpha[int(random() * alpha.length)]
23
- }
24
-
25
- return out
26
- }
27
-
28
- if (typeof module !== "undefined") {
29
- module.exports = makeKey
30
- }