@jrc03c/make-key 0.0.6 → 0.0.7

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