text: "use strict";var flatten$1=function t(r){return r instanceof Array?r.reduce(function(r,e){return e instanceof Array?r.push.apply(r,t(e)):e?r.push(e):r.push(null),r},[]):r},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},defineProperty=function(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r},_extends=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},ArrayMatrix$2=function(){var s={dataset:null,order:0,orders:[]},l={},c=[];function i(r){for(var e=Object.keys(r),t=new Array(s.order).fill(null),n=0,o=e.length;n<o;n++){var i=e[n],a=s.orders.indexOf(i);if(-1===a)throw new Error("Tuple Error: Axis "+i+" not found in available axes: "+s.orders.join(", ")+".");if("string"!=typeof r[i]){if("number"!=typeof r[i])throw new Error("Tuple Error: "+r[i]+" for axis "+i+" is not a valid string or integer.");t[a]=r[i]}else if(t[a]=l[i][r[i]],void 0===t[a])throw new Error("Tuple Error: Point "+[r[i]]+" not found in axis "+i+" points: "+Object.keys(l[i]).join(", "))}return t}function a(r,e){return e&&e.length?r?a(r[e.shift()],e):[]:r}return this.getAxes=function(){return Object.keys(l).reduce(function(r,e){return _extends({},r,defineProperty({},e,Object.keys(l[e])))},{})},this.getAxisPoints=function(r){return l[r]?Object.keys(l[r]):null},this.getDimension=function(r){if(!r||"object"!==(void 0===r?"undefined":_typeof(r)))throw new Error("Dimension Error: Malformed points argument.");var e=Object.keys(r);if(e.length!==s.order-1)throw new Error("Dimension Error: "+e.length+" points provided for "+s.order+" order matrix array. The number of points must be equal to n - 1, where n is the order or rank of the matrix array.");var t=i(r),n=t.indexOf(null),o=function(){if(0===n)return t.splice(0,1),c.map(function(r){var e=a(r,[].concat(t));return e&&e.length?e:[null]});var r=a(c,t.slice(0,n));return r?r.map(function(r){return a(r,t.slice(n+1))}):new Array(Object.keys(l[s.orders[n]]).length).fill(null)}();return flatten$1(o)},this.getEntry=function(r){var e=Object.keys(r);if(e.length!==s.order)throw new Error("Entry Error: "+e.length+" points provided for "+s.order+" order matrix array. The number of points must be equal to n, where n is the order or rank of the matrix array.");for(var t=i(r),n=0,o=c;n<t.length;){if(!o[t[n]])return null;o=o[t[n]],n+=1}return o[0]},this.debug=function(){return{matrix:c,axes:l,props:s}},function(r){var e=r.data,f=r.orders;return s.order=f.length,s.orders=f,s.dataset=e,function(){for(var r=f.length;r--;)l[f[r]]={}}(),e.forEach(function(r){for(var e=0,t=c;e<s.order;){var n=f[e];t=t[(o=n,i=r[n],a=t,u=void 0,u=l[o],"number"!=typeof u[i]&&(u[i]=Object.keys(u).length),a[u[i]]instanceof Array||(a[u[i]]=[]),u[i])],e+=1}var o,i,a,u;t.push(r)}),this}.apply(this,arguments)};module.exports=ArrayMatrix$2;
  //# sourceMappingURL=index.cjs.js.map
  