New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

datamodel

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datamodel - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

docs/Categorical.html

2

dist/datamodel.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DataModel",[],t):"object"==typeof exports?exports.DataModel=t():e.DataModel=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e){e.exports={name:"datamodel",description:"Relational algebra compliant in-memory tabular data store",homepage:"https://github.com/chartshq/datamodel",version:"2.0.0",license:"MIT",main:"dist/datamodel.js",author:"Charts.com <support@charts.com>",keywords:["datamodel","data","relational","algebra","model","muze","fusioncharts","table","tabular","operation"],repository:{type:"git",url:"https://github.com/chartshq/datamodel.git"},contributors:[{name:"Akash Goswami",email:"akash@charts.com"},{name:"Subhash Haldar",email:"subhash@charts.com"},{name:"Rousan Ali",email:"rousan@charts.com",url:"https://rousan.io"},{name:"Ujjal Kumar Dutta",email:"ujjal@charts.com"}],dependencies:{"d3-dsv":"^1.0.8"},devDependencies:{"babel-cli":"6.26.0","babel-core":"^6.26.3","babel-eslint":"6.1.2","babel-loader":"^7.1.4","babel-plugin-transform-runtime":"^6.23.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-flow":"^6.23.0",chai:"3.5.0","cross-env":"^5.0.5",eslint:"3.19.0","eslint-config-airbnb":"15.1.0","eslint-plugin-import":"2.7.0","eslint-plugin-jsx-a11y":"5.1.1","eslint-plugin-react":"7.3.0","istanbul-instrumenter-loader":"^3.0.0",jsdoc:"3.5.5",json2yaml:"^1.1.0",karma:"1.7.1","karma-chai":"0.1.0","karma-chrome-launcher":"2.1.1","karma-coverage-istanbul-reporter":"^1.3.0","karma-mocha":"1.3.0","karma-spec-reporter":"0.0.31","karma-webpack":"2.0.3",marked:"^0.5.0",mocha:"3.4.2","mocha-webpack":"0.7.0","transform-runtime":"0.0.0",webpack:"^4.12.0","webpack-cli":"^3.0.7","webpack-dev-server":"^3.1.4"},scripts:{test:"npm run lint && npm run ut",ut:"karma start karma.conf.js",utd:"karma start --single-run false --browsers Chrome karma.conf.js ",build:"webpack --mode production",start:"webpack-dev-server --config webpack.config.dev.js --mode development --open",lint:"eslint ./src","lint-errors":"eslint --quiet ./src",docs:"rm -rf yaml && mkdir yaml && jsdoc -c jsdoc.conf.json"}}},function(e,t,n){var r=n(2);e.exports=r.default?r.default:r},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"DataFormat",function(){return o}),n.d(r,"DimensionSubtype",function(){return u}),n.d(r,"MeasureSubtype",function(){return c}),n.d(r,"FieldType",function(){return f}),n.d(r,"FilteringMode",function(){return s});var i={};n.r(i),n.d(i,"DSVArr",function(){return je}),n.d(i,"DSVStr",function(){return Ie}),n.d(i,"FlatJSON",function(){return Le}),n.d(i,"Auto",function(){return Ue});var a={};n.r(a),n.d(a,"sum",function(){return it}),n.d(a,"avg",function(){return at}),n.d(a,"min",function(){return ot}),n.d(a,"max",function(){return ut}),n.d(a,"first",function(){return ct}),n.d(a,"last",function(){return ft}),n.d(a,"count",function(){return st}),n.d(a,"sd",function(){return lt});var o={FLAT_JSON:"FlatJSON",DSV_STR:"DSVStr",DSV_ARR:"DSVArr",AUTO:"Auto"},u={CATEGORICAL:"categorical",TEMPORAL:"temporal",GEO:"geo"},c={DISCRETE:"discrete"},f={MEASURE:"measure",DIMENSION:"dimension"},s={NORMAL:"normal",INVERSE:"inverse",ALL:"all"};function l(e,t){e.length>0&&e.split(",").forEach(function(e){var n=e.split("-"),r=+n[0],i=+(n[1]||n[0]);if(i>=r)for(var a=r;a<=i;a+=1)t(a)})}var d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var p=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ref=t,this._rowDiff=n}return d(e,[{key:"sanitize",value:function(){return this._ref.sanitize()}},{key:"parsed",value:function(e){return this._ref.parsed(e)}},{key:"domain",value:function(){var e,t=null;(e=this.getData(),"dimension"===this._ref.fieldType&&this._ref.subType()!==u.TEMPORAL)?t=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(new Set(e))):t=[Math.min.apply(null,e),Math.max.apply(null,e)];return t}},{key:"parse",value:function(e){return this._ref.parse(e)}},{key:"clone",value:function(e){return this._ref.clone(e)}},{key:"fieldName",value:function(){return this._ref.fieldName()}},{key:"type",value:function(){return this._ref.type()}},{key:"description",value:function(){return this._ref.description()}},{key:"subType",value:function(){return this._ref.subType()}},{key:"getMinDiff",value:function(){return this._ref.getMinDiff()}},{key:"unit",value:function(){return this._ref.unit()}},{key:"scale",value:function(){return this._ref.scale()}},{key:"defAggFn",value:function(){return this._ref.defAggFn()}},{key:"getData",value:function(){var e=this,t=[];return l(this._rowDiff,function(n){t.push(e._ref.data[n])}),t}},{key:"bins",value:function(){return this._ref.bins()}},{key:"name",get:function(){return this._ref.name}},{key:"schema",get:function(){return this._ref.schema}},{key:"data",get:function(){return this._ref.data}}]),e}();function h(e){return e instanceof Date?e:new Date(e)}function v(e){return e<10?"0"+e:e}function m(e){this.format=e,this.dtParams=void 0,this.nativeDate=void 0}RegExp.escape=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},m.TOKEN_PREFIX="%",m.DATETIME_PARAM_SEQUENCE={YEAR:0,MONTH:1,DAY:2,HOUR:3,MINUTE:4,SECOND:5,MILLISECOND:6},m.defaultNumberParser=function(e){return function(t){var n;return isFinite(n=parseInt(t,10))?n:e}},m.defaultRangeParser=function(e,t){return function(n){var r,i=void 0;if(!n)return t;var a=n.toLowerCase();for(i=0,r=e.length;i<r;i++)if(e[i].toLowerCase()===a)return i;return void 0===i?t:null}},m.getTokenDefinitions=function(){var e={short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},t={short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],long:["January","February","March","April","May","June","July","August","September","October","November","December"]};return{H:{name:"H",index:3,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getHours().toString()}},l:{name:"l",index:3,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){var t=h(e).getHours()%12;return(0===t?12:t).toString()}},p:{name:"p",index:3,extract:function(){return"(AM|PM)"},parser:function(e){return e?e.toLowerCase():null},formatter:function(e){return h(e).getHours()<12?"AM":"PM"}},P:{name:"P",index:3,extract:function(){return"(am|pm)"},parser:function(e){return e?e.toLowerCase():null},formatter:function(e){return h(e).getHours()<12?"am":"pm"}},M:{name:"M",index:4,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return v(h(e).getMinutes())}},S:{name:"S",index:5,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return v(h(e).getSeconds())}},K:{name:"K",index:6,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getMilliseconds().toString()}},a:{name:"a",index:2,extract:function(){return"("+e.short.join("|")+")"},parser:m.defaultRangeParser(e.short),formatter:function(t){var n=h(t).getDay();return e.short[n].toString()}},A:{name:"A",index:2,extract:function(){return"("+e.long.join("|")+")"},parser:m.defaultRangeParser(e.long),formatter:function(t){var n=h(t).getDay();return e.long[n].toString()}},e:{name:"e",index:2,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getDate().toString()}},d:{name:"d",index:2,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return v(h(e).getDate())}},b:{name:"b",index:1,extract:function(){return"("+t.short.join("|")+")"},parser:m.defaultRangeParser(t.short),formatter:function(e){var n=h(e).getMonth();return t.short[n].toString()}},B:{name:"B",index:1,extract:function(){return"("+t.long.join("|")+")"},parser:m.defaultNumberParser(t.long),formatter:function(e){var n=h(e).getMonth();return t.long[n].toString()}},m:{name:"m",index:1,extract:function(){return"(\\d+)"},parser:function(e){return m.defaultNumberParser()(e)-1},formatter:function(e){return v(h(e).getMonth()+1)}},y:{name:"y",index:0,extract:function(){return"(\\d{4})"},parser:function(e){if(e){var t=e.length;e=e.substring(t-2,t)}return m.defaultNumberParser()(e)},formatter:function(e){var t=h(e).getFullYear().toString(),n=void 0;return t&&(n=t.length,t=t.substring(n-2,n)),t}},Y:{name:"Y",index:0,extract:function(){return"(\\d{4})"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getFullYear().toString()}}}},m.getTokenFormalNames=function(){var e=m.getTokenDefinitions();return{HOUR:e.H,HOUR_12:e.l,AMPM_UPPERCASE:e.p,AMPM_LOWERCASE:e.P,MINUTE:e.M,SECOND:e.S,SHORT_DAY:e.a,LONG_DAY:e.A,DAY_OF_MONTH:e.e,DAY_OF_MONTH_CONSTANT_WIDTH:e.d,SHORT_MONTH:e.b,LONG_MONTH:e.B,MONTH_OF_YEAR:e.m,SHORT_YEAR:e.y,LONG_YEAR:e.Y}},m.tokenResolver=function(){var e=m.getTokenDefinitions(),t=function(){for(var e=0,t=void 0,n=void 0,r=arguments.length;e<r;e++)t=arguments.length<=e?void 0:arguments[e],(arguments.length<=e?void 0:arguments[e])&&(n=t);return n?n[0].parser(n[1]):null};return{YEAR:[e.y,e.Y,t],MONTH:[e.b,e.B,e.m,t],DAY:[e.a,e.A,e.e,e.d,t],HOUR:[e.H,e.l,e.p,e.P,function(e,t,n,r){var i=void 0,a=void 0,o=void 0,u=void 0;return t&&(a=n||r)?("pm"===a[0].parser(a[1])&&(o=!0),i=t):i=t||e,i?(u=i[0].parser(i[1]),o&&(u+=12),u):null}],MINUTE:[e.M,t],SECOND:[e.S,t]}},m.findTokens=function(e){for(var t=m.TOKEN_PREFIX,n=m.getTokenDefinitions(),r=Object.keys(n),i=[],a=void 0,o=void 0;(a=e.indexOf(t,a+1))>=0;)o=e[a+1],-1!==r.indexOf(o)&&i.push({index:a,token:o});return i},m.formatAs=function(e,t){var n,r=h(e),i=m.findTokens(t),a=m.getTokenDefinitions(),o=String(t),u=m.TOKEN_PREFIX,c=void 0,f=void 0,s=void 0;for(s=0,n=i.length;s<n;s++)f=a[c=i[s].token].formatter(r),o=o.replace(new RegExp(u+c,"g"),f);return o},m.prototype.parse=function(e,t){var n=m.tokenResolver(),r=this.extractTokenValue(e),i=m.DATETIME_PARAM_SEQUENCE,a=t&&t.noBreak,o=[],u=[],c=void 0,f=void 0,s=void 0,l=void 0,d=void 0,p=void 0,h=void 0,v=void 0;for(c in n)if({}.hasOwnProperty.call(n,c)){for(u.length=0,s=(f=n[c]).splice(f.length-1,1)[0],d=0,v=f.length;d<v;d++)void 0===(l=r[(p=f[d]).name])?u.push(null):u.push([p,l]);if((void 0===(h=s.apply(this,u))||null===h)&&!a)break;o[i[c]]=h}return o},m.prototype.extractTokenValue=function(e){var t,n=this.format,r=m.getTokenDefinitions(),i=m.TOKEN_PREFIX,a=m.findTokens(n),o={},u=void 0,c=void 0,f=void 0,s=void 0,l=void 0,d=void 0;l=String(n);var p=a.map(function(e){return e.token}),h=a.length;for(d=h-1;d>=0;d--)(f=a[d].index)+1!==l.length-1?(void 0===u&&(u=l.length),s=l.substring(f+2,u),l=l.substring(0,f+2)+RegExp.escape(s)+l.substring(u,l.length),u=f):u=f;for(d=0;d<h;d++)c=a[d],l=l.replace(i+c.token,r[c.token].extract());var v=e.match(new RegExp(l))||[];for(v.shift(),d=0,t=p.length;d<t;d++)o[p[d]]=v[d];return o},m.prototype.getNativeDate=function(e){if(e instanceof Date)return e;if(isFinite(e)&&this.format)return new Date(e);var t=this.dtParams=this.parse(e);return t.unshift(null),this.nativeDate=new(Function.prototype.bind.apply(Date,t)),this.nativeDate},m.prototype.formatAs=function(e,t){var n=void 0;return t?n=this.nativeDate=this.getNativeDate(t):(n=this.nativeDate)||(n=this.getNativeDate(t)),m.formatAs(n,e)};var y=function(e){var t=0;return function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];r.forEach(function(n,r){e[r]instanceof Array||(e[r]=Array.from({length:t})),e[r].push(n)}),t++}},g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b="object",_=Object.prototype.toString,O="[object Object]",A="[object Array]";function E(e,t){for(var n=t.length,r=-1;n;){if(e===t[n])return r=n;n-=1}return r}function w(e,t,n){return(void 0===e?"undefined":g(e))!==b&&(void 0===t?"undefined":g(t))!==b?null:(void 0===t?"undefined":g(t))!==b||null===t?e:((void 0===e?"undefined":g(e))!==b&&(e=t instanceof Array?[]:{}),function e(t,n,r,i,a){var o,u,c,f,s;if(a?(i.push(t),a.push(n)):(i=[t],a=[n]),n instanceof Array)for(o=0;o<n.length;o+=1){try{u=t[o],c=n[o]}catch(e){continue}(void 0===c?"undefined":g(c))!==b?r&&void 0===c||(t[o]=c):(null!==u&&(void 0===u?"undefined":g(u))===b||(u=t[o]=c instanceof Array?[]:{}),-1!==(s=E(c,a))?u=t[o]=i[s]:e(u,c,r,i,a))}else for(o in n){try{u=t[o],c=n[o]}catch(e){continue}if(null!==c&&(void 0===c?"undefined":g(c))===b)(f=_.call(c))===O?(null!==u&&(void 0===u?"undefined":g(u))===b||(u=t[o]={}),-1!==(s=E(c,a))?u=t[o]=i[s]:e(u,c,r,i,a)):f===A?(null!==u&&u instanceof Array||(u=t[o]=[]),-1!==(s=E(c,a))?u=t[o]=i[s]:e(u,c,r,i,a)):t[o]=c;else{if(r&&void 0===c)continue;t[o]=c}}return t}(e,t,n),e)}function k(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function S(e){return Array.isArray(e)}function j(e){return"function"==typeof e}var T=function(){return"id-"+(new Date).getTime()+Math.round(1e4*Math.random())},R=function(e){return[].concat(k(new Set(e)))},C=function(e,t){var n=void 0,r=void 0;if((r=R(void 0!==t?e.map(function(e){return e[t]}):e)).length>1){n=Math.abs(r[1]-r[0]);for(var i=2,a=r.length;i<a;i++)n=Math.min(n,Math.abs(r[i]-r[i-1]))}else n=r[0];return n};function P(e,t){if(!S(e)||!S(t))return e===t;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function F(e){return e}var M={data:{},createNamespace:function(e,t){var n=t||T();return this.data[n]={name:n,fields:e,fieldsObj:function(){var e={};return this.fields.forEach(function(t){e[t.name]=t}),e},getMeasure:function(){var e={};return this.fields.forEach(function(t){t.schema.type===f.MEASURE&&(e[t.name]=t)}),e},getDimension:function(){var e={};return this.fields.forEach(function(t){t.schema.type===f.DIMENSION&&(e[t.name]=t)}),e}},this.data[n]}},N=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var x=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"_value",{enumerable:!1,configurable:!1,writable:!1,value:t}),this.field=n}return N(e,[{key:"toString",value:function(){return String(this.value)}},{key:"valueOf",value:function(){return this.value}},{key:"value",get:function(){return this._value}}]),e}(),D=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function I(e,t,n){var r=n.buckets,i=n.binCount,a=n.binSize,o=n.start,u=[],c=[],f=e.domain(),s=D(f,2),d=s[0],p=s[1],h=p,v=[],m=void 0,y=void 0,g=void 0,b=void 0;if(l(t,function(t){u.push({data:e.data[t],index:t})}),!r){var _=((p+=1)-d)%(a=a||(p-d)/i);for(i||0===_||(p=p+a-_),m=d+a;m<=p;)v.push(m),m+=a;r={start:o=o||d,stops:v}}y=0===r.start?0:r.start||d,r.stops.forEach(function(e){u.filter(function(t){return t.data>=y&&t.data<e}).forEach(function(t){c[t.index]=y+"-"+e}),y=e}),u.filter(function(e){return e.data<r.start}).forEach(function(e){c[e.index]=d+"-"+r.start}),u.filter(function(e){return e.data>=r.stops[r.stops.length-1]}).forEach(function(e){c[e.index]=r.stops[r.stops.length-1]+"-"+h}),r.stops.unshift(r.start),b=new Set(r.stops),d<r.start&&b.add(d),h>r.stops[r.stops.length-1]&&b.add(h),b=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(b)).sort(function(e,t){return e-t}),g=[];for(var O=1;O<b.length;O++)g.push((b[O-1]+b[O])/2);return{data:c,mid:g,range:b}}var L={SELECT:"select",PROJECT:"project",GROUPBY:"group",COMPOSE:"compose",CAL_VAR:"calculatedVariable",BIN:"bin"},U={CROSS:"cross",LEFTOUTER:"leftOuter",RIGHTOUTER:"rightOuter",NATURAL:"natural",FULLOUTER:"fullOuter"},V="and";function H(e,t,n){e._children.forEach(function(e){if(e._derivation&&1===e._derivation.length)switch(n){case L.SELECT:e._derivation[0].op===L.SELECT&&t(e,e._derivation[0].criteria);break;case L.PROJECT:e._derivation[0].op===L.PROJECT&&t(e,e._derivation[0].meta.actualProjField);break;case L.GROUPBY:e._derivation[0].op===L.GROUPBY&&t(e,{groupByString:e._derivation[0].meta.groupByString,reducer:e._derivation[0].criteria});break;case L.CAL_VAR:if(e._derivation[0].op===L.CAL_VAR){var r=[e._derivation[0].meta.config,[e._derivation[0].meta.fields,e._derivation[0].criteria]];t.apply(void 0,[e].concat(r))}}})}function B(e,t){var n=[],r=[];return e.fields.forEach(function(e){r.push(e.schema.name)}),t.fields.forEach(function(e){-1!==r.indexOf(e.schema.name)&&n.push(e.schema.name)}),n}function Y(){return!0}function J(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:U.CROSS,a=[],o=[],u=n||Y,c=e.getFieldspace(),f=t.getFieldspace(),s=c.name,d=f.name,p=c.name+"."+f.name,h=B(c,f);if(s===d)throw new Error("DataModels must have different alias names");return c.fields.forEach(function(e){var t=w({},e.schema);-1===h.indexOf(t.name)||r||(t.name=c.name+"."+t.name),a.push(t)}),f.fields.forEach(function(e){var t=w({},e.schema);-1!==h.indexOf(t.name)?r||(t.name=f.name+"."+t.name,a.push(t)):a.push(t)}),l(e._rowDiffset,function(e){var n=!1,p=void 0;l(t._rowDiffset,function(t){var l=[],v={};v[s]={},v[d]={},c.fields.forEach(function(t){l.push(t.data[e]),v[s][t.name]=t.data[e]}),f.fields.forEach(function(e){-1!==h.indexOf(e.schema.name)&&r||l.push(e.data[t]),v[d][e.name]=e.data[t]});var m=Ye(v[s]),y=Ye(v[d]);if(u(m,y)){var g={};l.forEach(function(e,t){g[a[t].name]=e}),n&&U.CROSS!==i?o[p]=g:(o.push(g),n=!0,p=e)}else if((i===U.LEFTOUTER||i===U.RIGHTOUTER)&&!n){var b={},_=c.fields.length-1;l.forEach(function(e,t){b[a[t].name]=t<=_?e:null}),n=!0,p=e,o.push(b)}})}),new rt(o,a,{name:p})}function G(e,t){var n=""+e,r=""+t;return n<r?-1:n>r?1:0}function q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G;return e.length>1&&function e(t,n,r,i){if(r===n)return t;var a=n+Math.floor((r-n)/2);return e(t,n,a,i),e(t,a+1,r,i),function(e,t,n,r,i){for(var a=e,o=[],u=t;u<=r;u+=1)o[u]=a[u];for(var c=t,f=n+1,s=t;s<=r;s+=1)c>n?(a[s]=o[f],f+=1):f>r?(a[s]=o[c],c+=1):i(o[c],o[f])<=0?(a[s]=o[c],c+=1):(a[s]=o[f],f+=1)}(t,n,a,r,i),t}(e,0,e.length-1,t),e}function K(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function W(e,t,n){var r=void 0;switch(e){case f.MEASURE:case u.TEMPORAL:r="desc"===t?function(e,t){return t[n]-e[n]}:function(e,t){return e[n]-t[n]};break;default:r=function(e,r){var i=""+e[n],a=""+r[n];return i<a?"desc"===t?1:-1:i>a?"desc"===t?-1:1:0}}return r}function z(e,t){var n=new Map,r=[];return e.forEach(function(e){var i=e[t];n.has(i)?r[n.get(i)][1].push(e):(r.push([i,[e]]),n.set(i,r.length-1))}),r}function X(e,t,n){var r={label:e[0]};return t.reduce(function(t,r,i){return t[r]=e[1].map(function(e){return e[n[i].index]}),t},r),r}function Q(e,t,n,r,i){var a={schema:[],data:[],uids:[]},o=(i=Object.assign({},{addUid:!1,columnWise:!1},i)).addUid,u=r&&r.length>0,c=[];if(n.split(",").forEach(function(t){for(var n=0;n<e.length;n+=1)if(e[n].name===t){c.push(e[n]);break}}),c.forEach(function(e){a.schema.push(e.schema)}),o&&a.schema.push({name:"uid",type:"identifier"}),l(t,function(e){a.data.push([]);var t=a.data.length-1;c.forEach(function(n,r){a.data[t][r+0]=n.data[e]}),o&&(a.data[t][c.length]=e),a.uids.push(e),u&&a.data[t].push(e)}),u&&function(e,t){for(var n=e.data,r=e.schema,i=void 0,a=void 0,o=void 0,u=t.length-1;u>=0;u--)i=t[u][0],a=t[u][1],(o=ze(r,i))&&(j(a)?q(n,function(e,t){return a(e[o.index],t[o.index])}):S(a)?function(){var e=z(n,o.index),t=a[a.length-1],i=a.slice(0,a.length-1),u=i.map(function(e){return ze(r,e)});e.forEach(function(e){e.push(X(e,i,u))}),q(e,function(e,n){var r=e[2],i=n[2];return t(r,i)}),n.length=0,e.forEach(function(e){n.push.apply(n,K(e[1]))})}():(a="desc"===String(a).toLowerCase()?"desc":"asc",q(n,W(o.type,a,o.index))));e.uids=[],n.forEach(function(t){e.uids.push(t.pop())})}(a,r),i.columnWise){var f=Array.apply(void 0,K(Array(a.schema.length))).map(function(){return[]});a.data.forEach(function(e){e.forEach(function(e,t){f[t].push(e)})}),a.data=f}return a}function $(e,t){var n={},r=[],i=[],a=[],o=e.getFieldspace(),u=t.getFieldspace(),c=o.fieldsObj(),f=u.fieldsObj(),s=o.name+" union "+u.name;if(!P(e._colIdentifier.split(",").sort(),t._colIdentifier.split(",").sort()))return null;function d(e,t,r){l(e._rowDiffset,function(e){var o={},u="";i.forEach(function(n){var r=t[n].data[e];u+="-"+r,o[n]=r}),n[u]||(r&&a.push(o),n[u]=!0)})}return e._colIdentifier.split(",").forEach(function(e){var t=c[e];r.push(w({},t.schema)),i.push(t.schema.name)}),d(t,f,!1),d(e,c,!0),new rt(a,r,{name:s})}function Z(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function ee(e){var t=!0,n=e[0]instanceof Array,r=e.reduce(function(e,r){return n?e.map(function(e,t){return e+r[t]}):(t=t&&null===r,e+r)},n?Array.apply(void 0,Z(Array(e[0].length))).map(function(){return 0}):0);return t?null:r}function te(e){var t=e[0]instanceof Array,n=e.length||1,r=ee(e);return t?r.map(function(e){return e/n}):null===r?null:r/n}var ne={sum:ee,avg:te,min:function(e){return e[0]instanceof Array?e.reduce(function(e,t){return e.map(function(e,n){return Math.min(e,t[n])})},Array.apply(void 0,Z(Array(e[0].length))).map(function(){return 1/0})):e.every(function(e){return null===e})?null:Math.min.apply(Math,Z(e))},max:function(e){return e[0]instanceof Array?e.reduce(function(e,t){return e.map(function(e,n){return Math.max(e,t[n])})},Array.apply(void 0,Z(Array(e[0].length))).map(function(){return-1/0})):e.every(function(e){return null===e})?null:Math.max.apply(Math,Z(e))},first:function(e){return e[0]},last:function(e){return e[e.length-1]},count:function(e){var t=e[0]instanceof Array,n=e.length;return t?Array.apply(void 0,Z(Array(e[0].length))).map(function(){return n}):n},std:function(e){return Math.sqrt(function(e){var t=te(e);return te(e.map(function(e){return Math.pow(e-t,2)}))}(e))}},re="sum",ie=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var ae=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store=new Map,this.store.set("defReducer",ee),Object.entries(ne).forEach(function(e){t.store.set(e[0],e[1])})}return ie(e,[{key:"defaultReducer",value:function(){if(arguments.length){var e=arguments.length<=0?void 0:arguments[0];return"function"==typeof e?this.store.set("defReducer",e):"string"==typeof e&&-1!==Object.keys(ne).indexOf(e)&&this.store.set("defReducer",ne[e]),this}return this.store.get("defReducer")}},{key:"register",value:function(e,t){var n=this;return"string"==typeof e&&"function"==typeof t&&this.store.set(e,t),function(){n.__unregister(e)}}},{key:"__unregister",value:function(e){this.store.has(e)&&this.store.delete(e)}},{key:"resolve",value:function(e){return e instanceof Function?e:this.store.get(e)}}]),e}(),oe=function(){var e=null;return null===e&&(e=new ae),e}(),ue=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function ce(e,t,n,r){var i=function(e,t){var n=[],r=e.getPartialFieldspace(),i=r.getDimension(),a=r.getMeasure();return Object.entries(i).forEach(function(e){var r=ue(e,1)[0];t&&t.length?-1!==t.indexOf(r)&&n.push(r):n.push(r)}),Object.entries(a).forEach(function(e){var r=ue(e,1)[0];"discrete"===a[r].subType()&&(t&&t.length?-1!==t.indexOf(r)&&n.push(r):n.push(r))}),n}(e,t),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},r=t,i=e.getPartialFieldspace().getMeasure(),a=oe.defaultReducer();return"function"==typeof t&&(a=t),Object.entries(i).forEach(function(e){var o=ue(e,1)[0];"string"==typeof t[o]&&(r[o]=oe.resolve(r[o])?oe.resolve(r[o]):a),"function"!=typeof t[o]&&(r[o]=void 0),n[o]=r[o]||oe.resolve(i[o].defAggFn())||a}),n}(e,n),o=e.getPartialFieldspace(),u=o.fieldsObj(),c=o.name,f=[],s=[],d=[],p={},h=[],v=void 0;Object.entries(u).forEach(function(e){var t=ue(e,2),n=t[0],r=t[1];(-1!==i.indexOf(n)||a[n])&&(d.push(w({},r.schema)),"measure"===r.schema.type&&"discrete"!==r.schema.subtype?s.push(n):"dimension"!==r.schema.type&&"discrete"!==r.schema.subtype||f.push(n))});var m=0;return l(e._rowDiffset,function(e){var t="";f.forEach(function(n){t=t+"-"+u[n].data[e]}),void 0===p[t]?(p[t]=m,h.push({}),f.forEach(function(t){h[m][t]=u[t].data[e]}),s.forEach(function(t){h[m][t]=[u[t].data[e]]}),m+=1):s.forEach(function(n){h[p[t]][n].push(u[n].data[e])})}),h.forEach(function(e){var t=e;s.forEach(function(n){t[n]=a[n](e[n])})}),r?(r.__calculateFieldspace(),v=r):v=new pt(h,d,{name:c}),v}function fe(e,t){var n=B(e.getFieldspace(),t.getFieldspace());return function(e,t){var r=!0;return n.forEach(function(n){r=!(e[n].value!==t[n].value||!r)}),r}}function se(e,t){var n={},r=[],i=[],a=[],o=e.getFieldspace(),u=t.getFieldspace(),c=o.fieldsObj(),f=u.fieldsObj(),s=o.name+" union "+u.name;if(!P(e._colIdentifier.split(",").sort(),t._colIdentifier.split(",").sort()))return null;function d(e,t){l(e._rowDiffset,function(e){var r={},o="";i.forEach(function(n){var i=t[n].data[e];o+="-"+i,r[n]=i}),n[o]||(a.push(r),n[o]=!0)})}return e._colIdentifier.split(",").forEach(function(e){var t=c[e];r.push(w({},t.schema)),i.push(t.schema.name)}),d(e,c),d(t,f),new pt(a,r,{name:s})}function le(e,t,n){return J(e,t,n,!1,U.LEFTOUTER)}function de(e,t,n){return J(t,e,n,!1,U.RIGHTOUTER)}var pe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var he=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.data=n||[],this.schema=r,this.fieldDescription=r.description,this.fieldType=r.type,this.sanitize()}return pe(e,[{key:"sanitize",value:function(){var e=this;return this.data=this.data.map(function(t){return e.parsed(e.parse(t))}),this}},{key:"parsed",value:function(e){return e}},{key:"domain",value:function(){throw new Error("Not yet implemented!")}},{key:"subType",value:function(){return null}},{key:"parse",value:function(){throw new Error("Not yet implemented!")}},{key:"clone",value:function(e){e=e||w([],this.data);var t=w({},this.schema);return new this.constructor(this.name,e,t)}},{key:"fieldName",value:function(){return this.name}},{key:"type",value:function(){return this.fieldType}},{key:"description",value:function(){return this.fieldDescription}}]),e}(),ve=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var me=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.fieldUnit=r.unit,i.fieldScale=r.scale,i.fieldDefAggFn=r.defAggFn||re,i.fieldNumberformat=r.numberFormat instanceof Function?r.numberFormat:F,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,he),ve(t,[{key:"domain",value:function(){return function(e){var t=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.forEach(function(e){e<t&&(t=e),e>n&&(n=e)}),[t,n]}(this.data)}},{key:"parse",value:function(e){return e=parseFloat(e,10),Number.isNaN(e)?null:e}},{key:"unit",value:function(){return this.fieldUnit}},{key:"scale",value:function(){return this.fieldScale}},{key:"numberFormat",value:function(){var e=this.fieldNumberformat;return function(t){return e(t)}}},{key:"defAggFn",value:function(){return this.fieldDefAggFn}}]),t}(),ye=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var ge=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,he),ye(t,[{key:"domain",value:function(){return function(e){return[].concat(k(new Set(e)))}(this.data)}},{key:"parse",value:function(e){return(e=void 0===e||null===e?"":e.toString()).trim()}},{key:"parsed",value:function(e){this._unique=this._unique||{};var t=this._unique;return e in t?t[e]++:t[e]=1,e}}]),t}(),be=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var _e=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.subtype=u.CATEGORICAL,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,ge),be(t,[{key:"subType",value:function(){return this.subtype}}]),t}(),Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Ae=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.subtype=u.TEMPORAL,i.minDiff=C(i.data),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,ge),Oe(t,[{key:"subType",value:function(){return this.subtype}},{key:"getMinDiff",value:function(){return this.minDiff}},{key:"parse",value:function(e){return this.schema.format?(this._dtf=this._dtf||new m(this.schema.format),this._dtf.getNativeDate(e).getTime()):+new Date(e)}}]),t}(),Ee=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var we=function(e){function t(e,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return a.bin=i,a.subtype="discrete",a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,me),Ee(t,[{key:"parse",value:function(e){return(e=void 0===e||null===e?"":e.toString()).trim()}},{key:"bins",value:function(){return this.bin}},{key:"subType",value:function(){return this.subtype}}]),t}();var ke=function(e,t,n){var r={};return n&&n.length||(n=t.map(function(e){return e.name})),n.forEach(function(e,t){r[e]=t}),t.map(function(t){return function(e,t){switch(t.type){case f.MEASURE:switch(t.subtype){case"discrete":return new we(t.name,e,t,t.bins);default:return new me(t.name,e,t)}case f.DIMENSION:default:switch(t.subtype){case u.CATEGORICAL:return new _e(t.name,e,t);case u.TEMPORAL:return new Ae(t.name,e,t);case u.GEO:default:return new _e(t.name,e,t)}}}(e[r[t.name]],t)})},Se={dataFormat:o.AUTO};var je=function(e,t){t=Object.assign({},{firstRowHeader:!0},t);var n=void 0,r=[],i=y(r);return n=t.firstRowHeader?e.splice(0,1)[0]:[],e.forEach(function(e){return i.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e))}),[n,r]},Te={},Re={},Ce=34,Pe=10,Fe=13;function Me(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}")}var Ne=function(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function r(e,t){var r,i=[],a=e.length,o=0,u=0,c=a<=0,f=!1;function s(){if(c)return Re;if(f)return f=!1,Te;var t,r,i=o;if(e.charCodeAt(i)===Ce){for(;o++<a&&e.charCodeAt(o)!==Ce||e.charCodeAt(++o)===Ce;);return(t=o)>=a?c=!0:(r=e.charCodeAt(o++))===Pe?f=!0:r===Fe&&(f=!0,e.charCodeAt(o)===Pe&&++o),e.slice(i+1,t-1).replace(/""/g,'"')}for(;o<a;){if((r=e.charCodeAt(t=o++))===Pe)f=!0;else if(r===Fe)f=!0,e.charCodeAt(o)===Pe&&++o;else if(r!==n)continue;return e.slice(i,t)}return c=!0,e.slice(i,a)}for(e.charCodeAt(a-1)===Pe&&--a,e.charCodeAt(a-1)===Fe&&--a;(r=s())!==Re;){for(var l=[];r!==Te&&r!==Re;)l.push(r),r=s();t&&null==(l=t(l,u++))||i.push(l)}return i}function i(t){return t.map(a).join(e)}function a(e){return null==e?"":t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,i,a=r(e,function(e,r){if(n)return n(e,r-1);i=e,n=t?function(e,t){var n=Me(e);return function(r,i){return t(n(r),i,e)}}(e,t):Me(e)});return a.columns=i||[],a},parseRows:r,format:function(t,n){return null==n&&(n=function(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}(t)),[n.map(a).join(e)].concat(t.map(function(t){return n.map(function(e){return a(t[e])}).join(e)})).join("\n")},formatRows:function(e){return e.map(i).join("\n")}}},xe=Ne(","),De=(xe.parse,xe.parseRows,xe.format,xe.formatRows,Ne("\t"));De.parse,De.parseRows,De.format,De.formatRows;var Ie=function(e,t){t=Object.assign({},{firstRowHeader:!0,fieldSeparator:","},t);var n=Ne(t.fieldSeparator);return je(n.parseRows(e),t)};var Le=function(e){var t={},n=0,r=void 0,i=[],a=y(i);return e.forEach(function(e){var i=[];for(var o in e)o in t?r=t[o]:(t[o]=n++,r=n-1),i[r]=e[o];a.apply(void 0,i)}),[Object.keys(t),i]};var Ue=function(e,t){var n=void 0;if(function(e){return"string"==typeof e}(e))n=Ie;else if(S(e)&&S(e[0]))n=je;else{if(!S(e)||0!==e.length&&!function(e){return e===Object(e)}(e[0]))throw new Error("Couldn't detect the data format");n=Le}return n(e,t)},Ve=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function He(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function Be(e,t){var n={},r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done);r=!0){var c=o.value;n[c.name]=new x(c.data[t],c)}}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}function Ye(e){var t={};return Object.keys(e).forEach(function(n){t[n]=new x(e[n],n)}),t}var Je=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=void 0;t!==L.COMPOSE?(a={op:t,meta:r,criteria:i},e._derivation.push(a)):(a=[].concat(He(i)),e._derivation.length=0,(n=e._derivation).push.apply(n,He(a)))},Ge=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.operation||V,i=n.filterByMeasure||!1,a=[];a=null===t?[function(){return!1}]:t.map(function(e){return function(e){var t=e.getData(),n=t.schema,r=e.getFieldsConfig(),a=e.getFieldspace().fieldsObj(),o=t.data,u=Object.values(r).reduce(function(e,t){return e[t.def.name]=a[t.def.name].domain(),e},{});return function(e){return!!o.length&&o.some(function(t){return n.every(function(n){if(!(n.name in e))return!0;var a=e[n.name].valueOf();if(i&&n.type===f.MEASURE)return a>=u[n.name][0]&&a<=u[n.name][1];if(n.type!==f.DIMENSION)return!0;var o=r[n.name].index;return t[o]===e[n.name].valueOf()})})}}(e)});var o=void 0;r===V?o=e.clone(!1,!1).select(function(e){return a.every(function(t){return t(e)})},{saveChild:!1,mode:s.ALL}):o=e.clone(!1,!1).select(function(e){return a.some(function(t){return t(e)})},{mode:s.ALL,saveChild:!1});return o},qe=function(e,t,n,r){var i=e.clone(r.saveChild),a=function(e,t,n,r){var i=[],a=-1,o=void 0,u=function(e){return n(Be(t,e),e)};return r.mode===s.INVERSE&&(u=function(e){return!n(Be(t,e))}),l(e,function(e){u(e)&&(-1!==a&&e===a+1?(o=i.length-1,i[o]=i[o].split("-")[0]+"-"+e):i.push(""+e),a=e)}),i.join(",")}(i._rowDiffset,i.getPartialFieldspace().fields,t,n);return i._rowDiffset=a,i.__calculateFieldspace().calculateFieldsConfig(),r.saveChild&&Je(i,L.SELECT,{config:n},t),i},Ke=function(e,t,n,r){var i=e.clone(n.saveChild),a=t;return n.mode===s.INVERSE&&(a=r.filter(function(e){return-1===t.indexOf(e)})),i._colIdentifier=a.join(","),i.__calculateFieldspace().calculateFieldsConfig(),n.saveChild&&Je(i,L.PROJECT,{projField:t,config:n,actualProjField:a},null),i},We=function(e,t,n,r){r=Object.assign(Object.assign({},Se),r);var a=i[r.dataFormat];if(!a||"function"!=typeof a)throw new Error("No converter function found for "+r.dataFormat+" format");var o=a(t,r),u=Ve(o,2),c=u[0],f=u[1],s=ke(f,n,c),l=M.createNamespace(s,r.name);return e._partialFieldspace=l,e._rowDiffset=f.length&&f[0].length?"0-"+(f[0].length-1):"",e._colIdentifier=n.map(function(e){return e.name}).join(),e},ze=function(e,t){for(var n=0;n<e.length;++n)if(t===e[n].name)return{type:e[n].subtype||e[n].type,index:n};return null},Xe=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=arguments[4],o=function(t,n,a){e(t,n,r,i,a)};t!==i&&t.handlePropagation({payload:r.payload,data:n,sourceIdentifiers:r.sourceIdentifiers,sourceId:r.propagationSourceId,groupedPropModel:!!a}),function(e,t){H(e,t,L.SELECT)}(t,function(e,t){if(e!==i){var r=n[0].select(t,{saveChild:!1}),u=n[1].select(t,{saveChild:!1});o(e,[r,u],a)}}),function(e,t){H(e,t,L.PROJECT)}(t,function(e,t){if(e!==i){var r=n[0].project(t,{saveChild:!1}),u=n[1].project(t,{saveChild:!1});o(e,[r,u],a)}}),function(e,t){H(e,t,L.GROUPBY)}(t,function(e,t){if(e!==i){var r=t.reducer,a=t.groupByString,u=n[0].groupBy(a.split(","),r,{saveChild:!1}),c=n[1].groupBy(a.split(","),r,{saveChild:!1});o(e,[u,c],!0)}}),function(e,t){H(e,t,L.CAL_VAR)}(t,function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),u=1;u<t;u++)r[u-1]=arguments[u];if(e!==i){var c,f,s=(c=n[0].clone(!1,!1)).calculateVariable.apply(c,r.concat([{saveChild:!1,replaceVar:!0}])),l=(f=n[1].clone(!1,!1)).calculateVariable.apply(f,r.concat([{saveChild:!1,replaceVar:!0}]));o(e,[s,l],a)}})},Qe=function e(t){return t._parent?e(t._parent):t},$e=function(e,t,n){var r=void 0,i=void 0,a=n.propagationNameSpace,o=n.payload,u=n.propagationSourceId;if(null===e)r=null;else{var c,f=Object.entries(a.mutableActions).filter(function(e){return e[0]!==u}).map(function(e){return Object.values(e[1]).map(function(e){return e.criteria})});r=(c=[]).concat.apply(c,[].concat(He(f),[e]))}var s=t.groupByModel,l=t.model,d={payload:o,propagationSourceId:u,sourceIdentifiers:e};s&&(i=Ge(s,r,{filterByMeasure:!0}),Xe(s,i,d)),i=Ge(l,r,{filterByMeasure:!s}),Xe(l,i,d,s)},Ze=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var et=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var t=void 0;this._parent=null,this._derivation=[],this._children=[];for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];1===r.length&&(t=r[0])instanceof e?(this._colIdentifier=t._colIdentifier,this._rowDiffset=t._rowDiffset,this._parent=t,this._partialFieldspace=this._parent._partialFieldspace,this._fieldStoreName=T(),this.__calculateFieldspace().calculateFieldsConfig()):(We.apply(void 0,[this].concat(r)),this._fieldStoreName=this._partialFieldspace.name,this.__calculateFieldspace().calculateFieldsConfig(),this._propagationNameSpace={mutableActions:{},immutableActions:{}})}return Ze(e,[{key:"getSchema",value:function(){return this.getFieldspace().fields.map(function(e){return e.schema})}},{key:"getName",value:function(){return this._fieldStoreName}},{key:"getFieldspace",value:function(){return this._fieldspace}},{key:"__calculateFieldspace",value:function(){return this._fieldspace=function(e,t,n){var r=Ve(e,2),i=r[0],a=r[1],o=a.length?a.split(","):[],u=t.fieldsObj(),c=o.map(function(e){return new p(u[e],i)});return M.createNamespace(c,n)}([this._rowDiffset,this._colIdentifier],this.getPartialFieldspace(),this._fieldStoreName),this}},{key:"getPartialFieldspace",value:function(){return this._partialFieldspace}},{key:"join",value:function(e,t){return J(this,e,t)}},{key:"naturalJoin",value:function(e){return J(this,e,fe(this,e),!0)}},{key:"union",value:function(e){return se(this,e)}},{key:"difference",value:function(e){return $(this,e)}},{key:"select",value:function(e,t){var n={mode:s.NORMAL,saveChild:!0},r={saveChild:(t=Object.assign({},n,t)).saveChild},i=void 0;t.mode===s.ALL?i=[qe(this,e,{mode:s.NORMAL},r),qe(this,e,{mode:s.INVERSE},r)]:i=qe(this,e,t,r);return i}},{key:"isEmpty",value:function(){return!this._rowDiffset.length||!this._colIdentifier.length}},{key:"clone",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=void 0;if(!1===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])){var n=this.getData({getAllFields:!0}),r=n.data,i=n.schema,a=r.map(function(e){var t={};return i.forEach(function(n,r){t[n.name]=e[r]}),t});t=new this.constructor(a,i)}else t=new this.constructor(this);return e&&this._children.push(t),t}},{key:"project",value:function(e,t){var n={mode:s.NORMAL,saveChild:!0};t=Object.assign({},n,t);var r=this.getFieldsConfig(),i=Object.keys(r),a=t.mode,o=e.reduce(function(e,t){return"RegExp"===t.constructor.name?e.push.apply(e,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(i.filter(function(e){return-1!==e.search(t)}))):t in r&&e.push(t),e},[]);o=Array.from(new Set(o)).map(function(e){return e.trim()});var u=void 0;a===s.ALL?u=[Ke(this,o,{mode:s.NORMAL,saveChild:t.saveChild},i),Ke(this,o,{mode:s.INVERSE,saveChild:t.saveChild},i)]:u=Ke(this,o,t,i);return u}},{key:"getFieldsConfig",value:function(){return this._fieldConfig}},{key:"calculateFieldsConfig",value:function(){return this._fieldConfig=this._fieldspace.fields.reduce(function(e,t,n){return e[t.name]={index:n,def:{name:t._ref.name,type:t._ref.fieldType,subtype:t._ref.subType()}},e},{}),this}},{key:"dispose",value:function(){this._parent.removeChild(this),this._parent=null}},{key:"removeChild",value:function(e){var t=this._children.findIndex(function(t){return t===e});-1===t||this._children.splice(t,1)}},{key:"addParent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];Je(this,L.COMPOSE,null,t),this._parent=e,e._children.push(this)}}]),e}(),tt=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),nt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var rt=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return a._onPropagation=[],a._sortingDetails=[],a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,et),nt(t,[{key:"getData",value:function(e){e=Object.assign({},{order:"row",formatter:null,withUid:!1,getAllFields:!1,sort:[]},e);var t=this.getPartialFieldspace().fields,n=Q.call(this,this.getPartialFieldspace().fields,this._rowDiffset,e.getAllFields?t.map(function(e){return e.name}).join():this._colIdentifier,e.sort,{columnWise:"column"===e.order,addUid:!!e.withUid});if(!e.formatter)return n;var r=e.formatter,i=n.data,a=n.schema,o=n.uids,u=a.map(function(e){return e.name}),c=Object.keys(r).reduce(function(e,t){var n=u.indexOf(t);return-1!==n&&e.push([n,r[t]]),e},[]);return"column"===e.order?c.forEach(function(e){var t=e[0],n=e[1];i[t].forEach(function(e,r){i[t][r]=n.call(void 0,e,o[r],a[t])})}):i.forEach(function(e,t){c.forEach(function(n){var r=n[0],i=n[1];e[r]=i.call(void 0,e[r],o[t],a[r])})}),n}},{key:"groupBy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{saveChild:!0},r=""+e.join(),i=[this,e,t],a=ce.apply(void 0,i);return n.saveChild&&(this._children.push(a),Je(a,L.GROUPBY,{fieldsArr:e,groupByString:r,defaultReducer:oe.defaultReducer()},t)),a._parent=this,a}},{key:"sort",value:function(e){var t=this.getData({order:"row",sort:e}),n=[t.schema.map(function(e){return e.name})].concat(t.data),r=new this.constructor(n,t.schema,{dataFormat:"DSVArr"});return r._sortingDetails=e,r}},{key:"addField",value:function(e){var t=e.fieldName();this._colIdentifier+=","+t;var n=this._partialFieldspace;if(n.fieldsObj()[e.fieldName()]){var r=n.fields.findIndex(function(e){return e.name===t});r>=0&&(n.fields[r]=e)}else n.fields.push(e);return this.__calculateFieldspace().calculateFieldsConfig(),this}},{key:"calculateVariable",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{saveChild:!0,replaceVar:!1},r=this.getFieldsConfig(),i=t.slice(0,t.length-1),a=t[t.length-1];if(r[e.name]&&!n.replaceVar)throw new Error(e.name+" field already exists in model.");var o=i.map(function(e){var t=r[e];if(!t)throw new Error(e+" is not a valid column name.");return t.index}),u=this.clone(),c=u.getFieldspace().fields,f=o.map(function(e){return c[e]}),s=[];l(u._rowDiffset,function(e){var t=f.map(function(t){return t.data[e]});s[e]=a.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t).concat([e,c]))});var d=ke([s],[e],[e.name]),p=tt(d,1)[0];return u.addField(p),n.saveChild&&Je(u,L.CAL_VAR,{config:e,fields:i},a),u}},{key:"propagate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.isMutableAction,i=n.sourceId,a=Qe(this),o=a._propagationNameSpace,u={groupByModel:function e(t){return t._parent&&t._derivation.find(function(e){return"group"!==e.op})?e(t._parent):t}(this),model:a};return $e(e,u,{propagationNameSpace:o,payload:t,propagationSourceId:i}),r&&function(e,t,n){var r=t.groupByModel,i=t.model,a=e.immutableActions;for(var o in a){var u=a[o];for(var c in u){var f=u[c].criteria;$e(f,{groupByModel:r,model:i},{propagationNameSpace:e,payload:u[c].payload,propagationSourceId:n})}}}(o,u,i),this}},{key:"addToPropNamespace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=void 0,r=t.actionName,i=t.payload,a=t.isMutableAction,o=Qe(this)._propagationNameSpace,u=t.criteria;return a?(!o.mutableActions[e]&&(o.mutableActions[e]={}),n=o.mutableActions[e]):(!o.immutableActions[e]&&(o.immutableActions[e]={}),n=o.immutableActions[e]),null===u?delete n[r]:n[r]={criteria:u,payload:i},this}},{key:"on",value:function(e,t){switch(e){case"propagation":this._onPropagation.push(t)}return this}},{key:"unsubscribe",value:function(e){switch(e){case"propagation":this._onPropagation=[]}return this}},{key:"handlePropagation",value:function(e){var t=this;this._onPropagation.forEach(function(n){return n.call(t,e)})}},{key:"bin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.clone(),r=t.name||e+"_binned";if(this.getFieldsConfig()[r]||!this.getFieldsConfig()[e])throw new Error("Field "+e+" already exists.");var i=I(this._partialFieldspace.fields.find(function(t){return t.name===e}),this._rowDiffset,t),a=ke([i.data],[{name:r,type:f.MEASURE,subtype:"discrete",bins:{range:i.range,mid:i.mid}}],[r])[0];return n.addField(a),Je(n,L.BIN,{measureName:e,config:t,binFieldName:r},null),n}}],[{key:"Reducers",get:function(){return oe}}]),t}(),it=ne.sum,at=ne.avg,ot=ne.min,ut=ne.max,ct=ne.first,ft=ne.last,st=ne.count,lt=ne.std,dt=n(0);rt.Operators={compose:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){var n=e,r=void 0,i=[],a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{saveChild:!0}).saveChild;return t.forEach(function(e){n=e(n),i.push.apply(i,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(n._derivation)),r||(r=n)}),a&&n.addParent(e,i),i.length>1&&r.dispose(),n}},bin:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.bin.apply(e,t)}},select:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.select.apply(e,t)}},project:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.project.apply(e,t)}},groupBy:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.groupBy.apply(e,t)}},calculateVariable:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.calculateVariable.apply(e,t)}},sort:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.sort.apply(e,t)}},crossProduct:J,difference:$,naturalJoin:function(e,t){return J(e,t,fe(e,t),!0)},leftOuterJoin:le,rightOuterJoin:de,fullOuterJoin:function(e,t,n){return se(le(e,t,n),de(e,t,n))},union:se},rt.Stats=a,Object.assign(rt,r),rt.DateTimeFormatter=m,rt.DataFormat=o,rt.FilteringMode=s,rt.version=dt.version;var pt=t.default=rt}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DataModel",[],t):"object"==typeof exports?exports.DataModel=t():e.DataModel=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e){e.exports={name:"datamodel",description:"Relational algebra compliant in-memory tabular data store",homepage:"https://github.com/chartshq/datamodel",version:"2.0.1",license:"MIT",main:"dist/datamodel.js",author:"Charts.com <support@charts.com>",keywords:["datamodel","data","relational","algebra","model","muze","fusioncharts","table","tabular","operation"],repository:{type:"git",url:"https://github.com/chartshq/datamodel.git"},contributors:[{name:"Akash Goswami",email:"akash@charts.com"},{name:"Subhash Haldar",email:"subhash@charts.com"},{name:"Rousan Ali",email:"rousan@charts.com",url:"https://rousan.io"},{name:"Ujjal Kumar Dutta",email:"ujjal@charts.com"}],dependencies:{"d3-dsv":"^1.0.8"},devDependencies:{"babel-cli":"6.26.0","babel-core":"^6.26.3","babel-eslint":"6.1.2","babel-loader":"^7.1.4","babel-plugin-transform-runtime":"^6.23.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-flow":"^6.23.0",chai:"3.5.0","cross-env":"^5.0.5",eslint:"3.19.0","eslint-config-airbnb":"15.1.0","eslint-plugin-import":"2.7.0","eslint-plugin-jsx-a11y":"5.1.1","eslint-plugin-react":"7.3.0","istanbul-instrumenter-loader":"^3.0.0",jsdoc:"3.5.5",json2yaml:"^1.1.0",karma:"1.7.1","karma-chai":"0.1.0","karma-chrome-launcher":"2.1.1","karma-coverage-istanbul-reporter":"^1.3.0","karma-mocha":"1.3.0","karma-spec-reporter":"0.0.31","karma-webpack":"2.0.3",marked:"^0.5.0",mocha:"3.4.2","mocha-webpack":"0.7.0","transform-runtime":"0.0.0",webpack:"^4.12.0","webpack-cli":"^3.0.7","webpack-dev-server":"^3.1.4"},scripts:{test:"npm run lint && npm run ut",ut:"karma start karma.conf.js",utd:"karma start --single-run false --browsers Chrome karma.conf.js ",build:"webpack --mode production",start:"webpack-dev-server --config webpack.config.dev.js --mode development --open",lint:"eslint ./src","lint-errors":"eslint --quiet ./src",docs:"rm -rf yaml && mkdir yaml && jsdoc -c jsdoc.conf.json"}}},function(e,t,n){var r=n(2);e.exports=r.default?r.default:r},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"DataFormat",function(){return o}),n.d(r,"DimensionSubtype",function(){return u}),n.d(r,"MeasureSubtype",function(){return c}),n.d(r,"FieldType",function(){return f}),n.d(r,"FilteringMode",function(){return s});var i={};n.r(i),n.d(i,"DSVArr",function(){return je}),n.d(i,"DSVStr",function(){return Ie}),n.d(i,"FlatJSON",function(){return Le}),n.d(i,"Auto",function(){return Ue});var a={};n.r(a),n.d(a,"sum",function(){return it}),n.d(a,"avg",function(){return at}),n.d(a,"min",function(){return ot}),n.d(a,"max",function(){return ut}),n.d(a,"first",function(){return ct}),n.d(a,"last",function(){return ft}),n.d(a,"count",function(){return st}),n.d(a,"sd",function(){return lt});var o={FLAT_JSON:"FlatJSON",DSV_STR:"DSVStr",DSV_ARR:"DSVArr",AUTO:"Auto"},u={CATEGORICAL:"categorical",TEMPORAL:"temporal",GEO:"geo"},c={DISCRETE:"discrete"},f={MEASURE:"measure",DIMENSION:"dimension"},s={NORMAL:"normal",INVERSE:"inverse",ALL:"all"};function l(e,t){e.length>0&&e.split(",").forEach(function(e){var n=e.split("-"),r=+n[0],i=+(n[1]||n[0]);if(i>=r)for(var a=r;a<=i;a+=1)t(a)})}var d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var p=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ref=t,this._rowDiff=n}return d(e,[{key:"sanitize",value:function(){return this._ref.sanitize()}},{key:"parsed",value:function(e){return this._ref.parsed(e)}},{key:"domain",value:function(){var e,t=null;(e=this.getData(),"dimension"===this._ref.fieldType&&this._ref.subType()!==u.TEMPORAL)?t=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(new Set(e))):t=[Math.min.apply(null,e),Math.max.apply(null,e)];return t}},{key:"parse",value:function(e){return this._ref.parse(e)}},{key:"clone",value:function(e){return this._ref.clone(e)}},{key:"fieldName",value:function(){return this._ref.fieldName()}},{key:"type",value:function(){return this._ref.type()}},{key:"description",value:function(){return this._ref.description()}},{key:"subType",value:function(){return this._ref.subType()}},{key:"getMinDiff",value:function(){return this._ref.getMinDiff()}},{key:"unit",value:function(){return this._ref.unit()}},{key:"scale",value:function(){return this._ref.scale()}},{key:"defAggFn",value:function(){return this._ref.defAggFn()}},{key:"getData",value:function(){var e=this,t=[];return l(this._rowDiff,function(n){t.push(e._ref.data[n])}),t}},{key:"bins",value:function(){return this._ref.bins()}},{key:"name",get:function(){return this._ref.name}},{key:"schema",get:function(){return this._ref.schema}},{key:"data",get:function(){return this._ref.data}}]),e}();function h(e){return e instanceof Date?e:new Date(e)}function v(e){return e<10?"0"+e:e}function m(e){this.format=e,this.dtParams=void 0,this.nativeDate=void 0}RegExp.escape=function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},m.TOKEN_PREFIX="%",m.DATETIME_PARAM_SEQUENCE={YEAR:0,MONTH:1,DAY:2,HOUR:3,MINUTE:4,SECOND:5,MILLISECOND:6},m.defaultNumberParser=function(e){return function(t){var n;return isFinite(n=parseInt(t,10))?n:e}},m.defaultRangeParser=function(e,t){return function(n){var r,i=void 0;if(!n)return t;var a=n.toLowerCase();for(i=0,r=e.length;i<r;i++)if(e[i].toLowerCase()===a)return i;return void 0===i?t:null}},m.getTokenDefinitions=function(){var e={short:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],long:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},t={short:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],long:["January","February","March","April","May","June","July","August","September","October","November","December"]};return{H:{name:"H",index:3,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getHours().toString()}},l:{name:"l",index:3,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){var t=h(e).getHours()%12;return(0===t?12:t).toString()}},p:{name:"p",index:3,extract:function(){return"(AM|PM)"},parser:function(e){return e?e.toLowerCase():null},formatter:function(e){return h(e).getHours()<12?"AM":"PM"}},P:{name:"P",index:3,extract:function(){return"(am|pm)"},parser:function(e){return e?e.toLowerCase():null},formatter:function(e){return h(e).getHours()<12?"am":"pm"}},M:{name:"M",index:4,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return v(h(e).getMinutes())}},S:{name:"S",index:5,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return v(h(e).getSeconds())}},K:{name:"K",index:6,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getMilliseconds().toString()}},a:{name:"a",index:2,extract:function(){return"("+e.short.join("|")+")"},parser:m.defaultRangeParser(e.short),formatter:function(t){var n=h(t).getDay();return e.short[n].toString()}},A:{name:"A",index:2,extract:function(){return"("+e.long.join("|")+")"},parser:m.defaultRangeParser(e.long),formatter:function(t){var n=h(t).getDay();return e.long[n].toString()}},e:{name:"e",index:2,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getDate().toString()}},d:{name:"d",index:2,extract:function(){return"(\\d+)"},parser:m.defaultNumberParser(),formatter:function(e){return v(h(e).getDate())}},b:{name:"b",index:1,extract:function(){return"("+t.short.join("|")+")"},parser:m.defaultRangeParser(t.short),formatter:function(e){var n=h(e).getMonth();return t.short[n].toString()}},B:{name:"B",index:1,extract:function(){return"("+t.long.join("|")+")"},parser:m.defaultNumberParser(t.long),formatter:function(e){var n=h(e).getMonth();return t.long[n].toString()}},m:{name:"m",index:1,extract:function(){return"(\\d+)"},parser:function(e){return m.defaultNumberParser()(e)-1},formatter:function(e){return v(h(e).getMonth()+1)}},y:{name:"y",index:0,extract:function(){return"(\\d{4})"},parser:function(e){if(e){var t=e.length;e=e.substring(t-2,t)}return m.defaultNumberParser()(e)},formatter:function(e){var t=h(e).getFullYear().toString(),n=void 0;return t&&(n=t.length,t=t.substring(n-2,n)),t}},Y:{name:"Y",index:0,extract:function(){return"(\\d{4})"},parser:m.defaultNumberParser(),formatter:function(e){return h(e).getFullYear().toString()}}}},m.getTokenFormalNames=function(){var e=m.getTokenDefinitions();return{HOUR:e.H,HOUR_12:e.l,AMPM_UPPERCASE:e.p,AMPM_LOWERCASE:e.P,MINUTE:e.M,SECOND:e.S,SHORT_DAY:e.a,LONG_DAY:e.A,DAY_OF_MONTH:e.e,DAY_OF_MONTH_CONSTANT_WIDTH:e.d,SHORT_MONTH:e.b,LONG_MONTH:e.B,MONTH_OF_YEAR:e.m,SHORT_YEAR:e.y,LONG_YEAR:e.Y}},m.tokenResolver=function(){var e=m.getTokenDefinitions(),t=function(){for(var e=0,t=void 0,n=void 0,r=arguments.length;e<r;e++)t=arguments.length<=e?void 0:arguments[e],(arguments.length<=e?void 0:arguments[e])&&(n=t);return n?n[0].parser(n[1]):null};return{YEAR:[e.y,e.Y,t],MONTH:[e.b,e.B,e.m,t],DAY:[e.a,e.A,e.e,e.d,t],HOUR:[e.H,e.l,e.p,e.P,function(e,t,n,r){var i=void 0,a=void 0,o=void 0,u=void 0;return t&&(a=n||r)?("pm"===a[0].parser(a[1])&&(o=!0),i=t):i=t||e,i?(u=i[0].parser(i[1]),o&&(u+=12),u):null}],MINUTE:[e.M,t],SECOND:[e.S,t]}},m.findTokens=function(e){for(var t=m.TOKEN_PREFIX,n=m.getTokenDefinitions(),r=Object.keys(n),i=[],a=void 0,o=void 0;(a=e.indexOf(t,a+1))>=0;)o=e[a+1],-1!==r.indexOf(o)&&i.push({index:a,token:o});return i},m.formatAs=function(e,t){var n,r=h(e),i=m.findTokens(t),a=m.getTokenDefinitions(),o=String(t),u=m.TOKEN_PREFIX,c=void 0,f=void 0,s=void 0;for(s=0,n=i.length;s<n;s++)f=a[c=i[s].token].formatter(r),o=o.replace(new RegExp(u+c,"g"),f);return o},m.prototype.parse=function(e,t){var n=m.tokenResolver(),r=this.extractTokenValue(e),i=m.DATETIME_PARAM_SEQUENCE,a=t&&t.noBreak,o=[],u=[],c=void 0,f=void 0,s=void 0,l=void 0,d=void 0,p=void 0,h=void 0,v=void 0;for(c in n)if({}.hasOwnProperty.call(n,c)){for(u.length=0,s=(f=n[c]).splice(f.length-1,1)[0],d=0,v=f.length;d<v;d++)void 0===(l=r[(p=f[d]).name])?u.push(null):u.push([p,l]);if((void 0===(h=s.apply(this,u))||null===h)&&!a)break;o[i[c]]=h}return o},m.prototype.extractTokenValue=function(e){var t,n=this.format,r=m.getTokenDefinitions(),i=m.TOKEN_PREFIX,a=m.findTokens(n),o={},u=void 0,c=void 0,f=void 0,s=void 0,l=void 0,d=void 0;l=String(n);var p=a.map(function(e){return e.token}),h=a.length;for(d=h-1;d>=0;d--)(f=a[d].index)+1!==l.length-1?(void 0===u&&(u=l.length),s=l.substring(f+2,u),l=l.substring(0,f+2)+RegExp.escape(s)+l.substring(u,l.length),u=f):u=f;for(d=0;d<h;d++)c=a[d],l=l.replace(i+c.token,r[c.token].extract());var v=e.match(new RegExp(l))||[];for(v.shift(),d=0,t=p.length;d<t;d++)o[p[d]]=v[d];return o},m.prototype.getNativeDate=function(e){if(e instanceof Date)return e;if(isFinite(e)&&this.format)return new Date(e);var t=this.dtParams=this.parse(e);return t.unshift(null),this.nativeDate=new(Function.prototype.bind.apply(Date,t)),this.nativeDate},m.prototype.formatAs=function(e,t){var n=void 0;return t?n=this.nativeDate=this.getNativeDate(t):(n=this.nativeDate)||(n=this.getNativeDate(t)),m.formatAs(n,e)};var y=function(e){var t=0;return function(){for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];r.forEach(function(n,r){e[r]instanceof Array||(e[r]=Array.from({length:t})),e[r].push(n)}),t++}},g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b="object",_=Object.prototype.toString,O="[object Object]",A="[object Array]";function E(e,t){for(var n=t.length,r=-1;n;){if(e===t[n])return r=n;n-=1}return r}function w(e,t,n){return(void 0===e?"undefined":g(e))!==b&&(void 0===t?"undefined":g(t))!==b?null:(void 0===t?"undefined":g(t))!==b||null===t?e:((void 0===e?"undefined":g(e))!==b&&(e=t instanceof Array?[]:{}),function e(t,n,r,i,a){var o,u,c,f,s;if(a?(i.push(t),a.push(n)):(i=[t],a=[n]),n instanceof Array)for(o=0;o<n.length;o+=1){try{u=t[o],c=n[o]}catch(e){continue}(void 0===c?"undefined":g(c))!==b?r&&void 0===c||(t[o]=c):(null!==u&&(void 0===u?"undefined":g(u))===b||(u=t[o]=c instanceof Array?[]:{}),-1!==(s=E(c,a))?u=t[o]=i[s]:e(u,c,r,i,a))}else for(o in n){try{u=t[o],c=n[o]}catch(e){continue}if(null!==c&&(void 0===c?"undefined":g(c))===b)(f=_.call(c))===O?(null!==u&&(void 0===u?"undefined":g(u))===b||(u=t[o]={}),-1!==(s=E(c,a))?u=t[o]=i[s]:e(u,c,r,i,a)):f===A?(null!==u&&u instanceof Array||(u=t[o]=[]),-1!==(s=E(c,a))?u=t[o]=i[s]:e(u,c,r,i,a)):t[o]=c;else{if(r&&void 0===c)continue;t[o]=c}}return t}(e,t,n),e)}function k(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function S(e){return Array.isArray(e)}function j(e){return"function"==typeof e}var T=function(){return"id-"+(new Date).getTime()+Math.round(1e4*Math.random())},R=function(e){return[].concat(k(new Set(e)))},C=function(e,t){var n=void 0,r=void 0;if((r=R(void 0!==t?e.map(function(e){return e[t]}):e)).length>1){n=Math.abs(r[1]-r[0]);for(var i=2,a=r.length;i<a;i++)n=Math.min(n,Math.abs(r[i]-r[i-1]))}else n=r[0];return n};function P(e,t){if(!S(e)||!S(t))return e===t;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function F(e){return e}var M={data:{},createNamespace:function(e,t){var n=t||T();return this.data[n]={name:n,fields:e,fieldsObj:function(){var e={};return this.fields.forEach(function(t){e[t.name]=t}),e},getMeasure:function(){var e={};return this.fields.forEach(function(t){t.schema.type===f.MEASURE&&(e[t.name]=t)}),e},getDimension:function(){var e={};return this.fields.forEach(function(t){t.schema.type===f.DIMENSION&&(e[t.name]=t)}),e}},this.data[n]}},N=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var x=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.defineProperty(this,"_value",{enumerable:!1,configurable:!1,writable:!1,value:t}),this.field=n}return N(e,[{key:"toString",value:function(){return String(this.value)}},{key:"valueOf",value:function(){return this.value}},{key:"value",get:function(){return this._value}}]),e}(),D=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function I(e,t,n){var r=n.buckets,i=n.binCount,a=n.binSize,o=n.start,u=[],c=[],f=e.domain(),s=D(f,2),d=s[0],p=s[1],h=p,v=[],m=void 0,y=void 0,g=void 0,b=void 0;if(l(t,function(t){u.push({data:e.data[t],index:t})}),!r){var _=((p+=1)-d)%(a=a||(p-d)/i);for(i||0===_||(p=p+a-_),m=d+a;m<=p;)v.push(m),m+=a;r={start:o=o||d,stops:v}}y=0===r.start?0:r.start||d,r.stops.forEach(function(e){u.filter(function(t){return t.data>=y&&t.data<e}).forEach(function(t){c[t.index]=y+"-"+e}),y=e}),u.filter(function(e){return e.data<r.start}).forEach(function(e){c[e.index]=d+"-"+r.start}),u.filter(function(e){return e.data>=r.stops[r.stops.length-1]}).forEach(function(e){c[e.index]=r.stops[r.stops.length-1]+"-"+h}),r.stops.unshift(r.start),b=new Set(r.stops),d<r.start&&b.add(d),h>r.stops[r.stops.length-1]&&b.add(h),b=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(b)).sort(function(e,t){return e-t}),g=[];for(var O=1;O<b.length;O++)g.push((b[O-1]+b[O])/2);return{data:c,mid:g,range:b}}var L={SELECT:"select",PROJECT:"project",GROUPBY:"group",COMPOSE:"compose",CAL_VAR:"calculatedVariable",BIN:"bin"},U={CROSS:"cross",LEFTOUTER:"leftOuter",RIGHTOUTER:"rightOuter",NATURAL:"natural",FULLOUTER:"fullOuter"},V="and";function H(e,t,n){e._children.forEach(function(e){if(e._derivation&&1===e._derivation.length)switch(n){case L.SELECT:e._derivation[0].op===L.SELECT&&t(e,e._derivation[0].criteria);break;case L.PROJECT:e._derivation[0].op===L.PROJECT&&t(e,e._derivation[0].meta.actualProjField);break;case L.GROUPBY:e._derivation[0].op===L.GROUPBY&&t(e,{groupByString:e._derivation[0].meta.groupByString,reducer:e._derivation[0].criteria});break;case L.CAL_VAR:if(e._derivation[0].op===L.CAL_VAR){var r=[e._derivation[0].meta.config,[e._derivation[0].meta.fields,e._derivation[0].criteria]];t.apply(void 0,[e].concat(r))}}})}function B(e,t){var n=[],r=[];return e.fields.forEach(function(e){r.push(e.schema.name)}),t.fields.forEach(function(e){-1!==r.indexOf(e.schema.name)&&n.push(e.schema.name)}),n}function Y(){return!0}function J(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:U.CROSS,a=[],o=[],u=n||Y,c=e.getFieldspace(),f=t.getFieldspace(),s=c.name,d=f.name,p=c.name+"."+f.name,h=B(c,f);if(s===d)throw new Error("DataModels must have different alias names");return c.fields.forEach(function(e){var t=w({},e.schema);-1===h.indexOf(t.name)||r||(t.name=c.name+"."+t.name),a.push(t)}),f.fields.forEach(function(e){var t=w({},e.schema);-1!==h.indexOf(t.name)?r||(t.name=f.name+"."+t.name,a.push(t)):a.push(t)}),l(e._rowDiffset,function(e){var n=!1,p=void 0;l(t._rowDiffset,function(t){var l=[],v={};v[s]={},v[d]={},c.fields.forEach(function(t){l.push(t.data[e]),v[s][t.name]=t.data[e]}),f.fields.forEach(function(e){-1!==h.indexOf(e.schema.name)&&r||l.push(e.data[t]),v[d][e.name]=e.data[t]});var m=Ye(v[s]),y=Ye(v[d]);if(u(m,y)){var g={};l.forEach(function(e,t){g[a[t].name]=e}),n&&U.CROSS!==i?o[p]=g:(o.push(g),n=!0,p=e)}else if((i===U.LEFTOUTER||i===U.RIGHTOUTER)&&!n){var b={},_=c.fields.length-1;l.forEach(function(e,t){b[a[t].name]=t<=_?e:null}),n=!0,p=e,o.push(b)}})}),new rt(o,a,{name:p})}function G(e,t){var n=""+e,r=""+t;return n<r?-1:n>r?1:0}function q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G;return e.length>1&&function e(t,n,r,i){if(r===n)return t;var a=n+Math.floor((r-n)/2);return e(t,n,a,i),e(t,a+1,r,i),function(e,t,n,r,i){for(var a=e,o=[],u=t;u<=r;u+=1)o[u]=a[u];for(var c=t,f=n+1,s=t;s<=r;s+=1)c>n?(a[s]=o[f],f+=1):f>r?(a[s]=o[c],c+=1):i(o[c],o[f])<=0?(a[s]=o[c],c+=1):(a[s]=o[f],f+=1)}(t,n,a,r,i),t}(e,0,e.length-1,t),e}function K(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function W(e,t,n){var r=void 0;switch(e){case f.MEASURE:case u.TEMPORAL:r="desc"===t?function(e,t){return t[n]-e[n]}:function(e,t){return e[n]-t[n]};break;default:r=function(e,r){var i=""+e[n],a=""+r[n];return i<a?"desc"===t?1:-1:i>a?"desc"===t?-1:1:0}}return r}function z(e,t){var n=new Map,r=[];return e.forEach(function(e){var i=e[t];n.has(i)?r[n.get(i)][1].push(e):(r.push([i,[e]]),n.set(i,r.length-1))}),r}function X(e,t,n){var r={label:e[0]};return t.reduce(function(t,r,i){return t[r]=e[1].map(function(e){return e[n[i].index]}),t},r),r}function Q(e,t,n,r,i){var a={schema:[],data:[],uids:[]},o=(i=Object.assign({},{addUid:!1,columnWise:!1},i)).addUid,u=r&&r.length>0,c=[];if(n.split(",").forEach(function(t){for(var n=0;n<e.length;n+=1)if(e[n].name===t){c.push(e[n]);break}}),c.forEach(function(e){a.schema.push(e.schema)}),o&&a.schema.push({name:"uid",type:"identifier"}),l(t,function(e){a.data.push([]);var t=a.data.length-1;c.forEach(function(n,r){a.data[t][r+0]=n.data[e]}),o&&(a.data[t][c.length]=e),a.uids.push(e),u&&a.data[t].push(e)}),u&&function(e,t){for(var n=e.data,r=e.schema,i=void 0,a=void 0,o=void 0,u=t.length-1;u>=0;u--)i=t[u][0],a=t[u][1],(o=ze(r,i))&&(j(a)?q(n,function(e,t){return a(e[o.index],t[o.index])}):S(a)?function(){var e=z(n,o.index),t=a[a.length-1],i=a.slice(0,a.length-1),u=i.map(function(e){return ze(r,e)});e.forEach(function(e){e.push(X(e,i,u))}),q(e,function(e,n){var r=e[2],i=n[2];return t(r,i)}),n.length=0,e.forEach(function(e){n.push.apply(n,K(e[1]))})}():(a="desc"===String(a).toLowerCase()?"desc":"asc",q(n,W(o.type,a,o.index))));e.uids=[],n.forEach(function(t){e.uids.push(t.pop())})}(a,r),i.columnWise){var f=Array.apply(void 0,K(Array(a.schema.length))).map(function(){return[]});a.data.forEach(function(e){e.forEach(function(e,t){f[t].push(e)})}),a.data=f}return a}function $(e,t){var n={},r=[],i=[],a=[],o=e.getFieldspace(),u=t.getFieldspace(),c=o.fieldsObj(),f=u.fieldsObj(),s=o.name+" union "+u.name;if(!P(e._colIdentifier.split(",").sort(),t._colIdentifier.split(",").sort()))return null;function d(e,t,r){l(e._rowDiffset,function(e){var o={},u="";i.forEach(function(n){var r=t[n].data[e];u+="-"+r,o[n]=r}),n[u]||(r&&a.push(o),n[u]=!0)})}return e._colIdentifier.split(",").forEach(function(e){var t=c[e];r.push(w({},t.schema)),i.push(t.schema.name)}),d(t,f,!1),d(e,c,!0),new rt(a,r,{name:s})}function Z(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function ee(e){var t=!0,n=e[0]instanceof Array,r=e.reduce(function(e,r){return n?e.map(function(e,t){return e+r[t]}):(t=t&&null===r,e+r)},n?Array.apply(void 0,Z(Array(e[0].length))).map(function(){return 0}):0);return t?null:r}function te(e){var t=e[0]instanceof Array,n=e.length||1,r=ee(e);return t?r.map(function(e){return e/n}):null===r?null:r/n}var ne={sum:ee,avg:te,min:function(e){return e[0]instanceof Array?e.reduce(function(e,t){return e.map(function(e,n){return Math.min(e,t[n])})},Array.apply(void 0,Z(Array(e[0].length))).map(function(){return 1/0})):e.every(function(e){return null===e})?null:Math.min.apply(Math,Z(e))},max:function(e){return e[0]instanceof Array?e.reduce(function(e,t){return e.map(function(e,n){return Math.max(e,t[n])})},Array.apply(void 0,Z(Array(e[0].length))).map(function(){return-1/0})):e.every(function(e){return null===e})?null:Math.max.apply(Math,Z(e))},first:function(e){return e[0]},last:function(e){return e[e.length-1]},count:function(e){var t=e[0]instanceof Array,n=e.length;return t?Array.apply(void 0,Z(Array(e[0].length))).map(function(){return n}):n},std:function(e){return Math.sqrt(function(e){var t=te(e);return te(e.map(function(e){return Math.pow(e-t,2)}))}(e))}},re="sum",ie=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var ae=function(){function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store=new Map,this.store.set("defReducer",ee),Object.entries(ne).forEach(function(e){t.store.set(e[0],e[1])})}return ie(e,[{key:"defaultReducer",value:function(){if(arguments.length){var e=arguments.length<=0?void 0:arguments[0];return"function"==typeof e?this.store.set("defReducer",e):"string"==typeof e&&-1!==Object.keys(ne).indexOf(e)&&this.store.set("defReducer",ne[e]),this}return this.store.get("defReducer")}},{key:"register",value:function(e,t){var n=this;return"string"==typeof e&&"function"==typeof t&&this.store.set(e,t),function(){n.__unregister(e)}}},{key:"__unregister",value:function(e){this.store.has(e)&&this.store.delete(e)}},{key:"resolve",value:function(e){return e instanceof Function?e:this.store.get(e)}}]),e}(),oe=function(){var e=null;return null===e&&(e=new ae),e}(),ue=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function ce(e,t,n,r){var i=function(e,t){var n=[],r=e.getPartialFieldspace(),i=r.getDimension(),a=r.getMeasure();return Object.entries(i).forEach(function(e){var r=ue(e,1)[0];t&&t.length?-1!==t.indexOf(r)&&n.push(r):n.push(r)}),Object.entries(a).forEach(function(e){var r=ue(e,1)[0];"discrete"===a[r].subType()&&(t&&t.length?-1!==t.indexOf(r)&&n.push(r):n.push(r))}),n}(e,t),a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},r=t,i=e.getPartialFieldspace().getMeasure(),a=oe.defaultReducer();return"function"==typeof t&&(a=t),Object.entries(i).forEach(function(e){var o=ue(e,1)[0];"string"==typeof t[o]&&(r[o]=oe.resolve(r[o])?oe.resolve(r[o]):a),"function"!=typeof t[o]&&(r[o]=void 0),n[o]=r[o]||oe.resolve(i[o].defAggFn())||a}),n}(e,n),o=e.getPartialFieldspace(),u=o.fieldsObj(),c=o.name,f=[],s=[],d=[],p={},h=[],v=void 0;Object.entries(u).forEach(function(e){var t=ue(e,2),n=t[0],r=t[1];(-1!==i.indexOf(n)||a[n])&&(d.push(w({},r.schema)),"measure"===r.schema.type&&"discrete"!==r.schema.subtype?s.push(n):"dimension"!==r.schema.type&&"discrete"!==r.schema.subtype||f.push(n))});var m=0;return l(e._rowDiffset,function(e){var t="";f.forEach(function(n){t=t+"-"+u[n].data[e]}),void 0===p[t]?(p[t]=m,h.push({}),f.forEach(function(t){h[m][t]=u[t].data[e]}),s.forEach(function(t){h[m][t]=[u[t].data[e]]}),m+=1):s.forEach(function(n){h[p[t]][n].push(u[n].data[e])})}),h.forEach(function(e){var t=e;s.forEach(function(n){t[n]=a[n](e[n])})}),r?(r.__calculateFieldspace(),v=r):v=new pt(h,d,{name:c}),v}function fe(e,t){var n=B(e.getFieldspace(),t.getFieldspace());return function(e,t){var r=!0;return n.forEach(function(n){r=!(e[n].value!==t[n].value||!r)}),r}}function se(e,t){var n={},r=[],i=[],a=[],o=e.getFieldspace(),u=t.getFieldspace(),c=o.fieldsObj(),f=u.fieldsObj(),s=o.name+" union "+u.name;if(!P(e._colIdentifier.split(",").sort(),t._colIdentifier.split(",").sort()))return null;function d(e,t){l(e._rowDiffset,function(e){var r={},o="";i.forEach(function(n){var i=t[n].data[e];o+="-"+i,r[n]=i}),n[o]||(a.push(r),n[o]=!0)})}return e._colIdentifier.split(",").forEach(function(e){var t=c[e];r.push(w({},t.schema)),i.push(t.schema.name)}),d(e,c),d(t,f),new pt(a,r,{name:s})}function le(e,t,n){return J(e,t,n,!1,U.LEFTOUTER)}function de(e,t,n){return J(t,e,n,!1,U.RIGHTOUTER)}var pe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var he=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.data=n||[],this.schema=r,this.fieldDescription=r.description,this.fieldType=r.type,this.sanitize()}return pe(e,[{key:"sanitize",value:function(){var e=this;return this.data=this.data.map(function(t){return e.parsed(e.parse(t))}),this}},{key:"parsed",value:function(e){return e}},{key:"domain",value:function(){throw new Error("Not yet implemented!")}},{key:"subType",value:function(){return null}},{key:"parse",value:function(){throw new Error("Not yet implemented!")}},{key:"clone",value:function(e){e=e||w([],this.data);var t=w({},this.schema);return new this.constructor(this.name,e,t)}},{key:"fieldName",value:function(){return this.name}},{key:"type",value:function(){return this.fieldType}},{key:"description",value:function(){return this.fieldDescription}}]),e}(),ve=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var me=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.fieldUnit=r.unit,i.fieldScale=r.scale,i.fieldDefAggFn=r.defAggFn||re,i.fieldNumberformat=r.numberFormat instanceof Function?r.numberFormat:F,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,he),ve(t,[{key:"domain",value:function(){return function(e){var t=Number.POSITIVE_INFINITY,n=Number.NEGATIVE_INFINITY;return e.forEach(function(e){e<t&&(t=e),e>n&&(n=e)}),[t,n]}(this.data)}},{key:"parse",value:function(e){return e=parseFloat(e,10),Number.isNaN(e)?null:e}},{key:"unit",value:function(){return this.fieldUnit}},{key:"scale",value:function(){return this.fieldScale}},{key:"numberFormat",value:function(){var e=this.fieldNumberformat;return function(t){return e(t)}}},{key:"defAggFn",value:function(){return this.fieldDefAggFn}}]),t}(),ye=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var ge=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,he),ye(t,[{key:"domain",value:function(){return function(e){return[].concat(k(new Set(e)))}(this.data)}},{key:"parse",value:function(e){return(e=void 0===e||null===e?"":e.toString()).trim()}},{key:"parsed",value:function(e){this._unique=this._unique||{};var t=this._unique;return e in t?t[e]++:t[e]=1,e}}]),t}(),be=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var _e=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.subtype=u.CATEGORICAL,i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,ge),be(t,[{key:"subType",value:function(){return this.subtype}}]),t}(),Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Ae=function(e){function t(e,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var i=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return i.subtype=u.TEMPORAL,i.minDiff=C(i.data),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,ge),Oe(t,[{key:"subType",value:function(){return this.subtype}},{key:"getMinDiff",value:function(){return this.minDiff}},{key:"parse",value:function(e){return this.schema.format?(this._dtf=this._dtf||new m(this.schema.format),this._dtf.getNativeDate(e).getTime()):+new Date(e)}}]),t}(),Ee=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var we=function(e){function t(e,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,r));return a.bin=i,a.subtype="discrete",a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,me),Ee(t,[{key:"parse",value:function(e){return(e=void 0===e||null===e?"":e.toString()).trim()}},{key:"bins",value:function(){return this.bin}},{key:"subType",value:function(){return this.subtype}}]),t}();var ke=function(e,t,n){var r={};return n&&n.length||(n=t.map(function(e){return e.name})),n.forEach(function(e,t){r[e]=t}),t.map(function(t){return function(e,t){switch(t.type){case f.MEASURE:switch(t.subtype){case"discrete":return new we(t.name,e,t,t.bins);default:return new me(t.name,e,t)}case f.DIMENSION:default:switch(t.subtype){case u.CATEGORICAL:return new _e(t.name,e,t);case u.TEMPORAL:return new Ae(t.name,e,t);case u.GEO:default:return new _e(t.name,e,t)}}}(e[r[t.name]],t)})},Se={dataFormat:o.AUTO};var je=function(e,t){t=Object.assign({},{firstRowHeader:!0},t);var n=void 0,r=[],i=y(r);return n=t.firstRowHeader?e.splice(0,1)[0]:[],e.forEach(function(e){return i.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(e))}),[n,r]},Te={},Re={},Ce=34,Pe=10,Fe=13;function Me(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}")}var Ne=function(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function r(e,t){var r,i=[],a=e.length,o=0,u=0,c=a<=0,f=!1;function s(){if(c)return Re;if(f)return f=!1,Te;var t,r,i=o;if(e.charCodeAt(i)===Ce){for(;o++<a&&e.charCodeAt(o)!==Ce||e.charCodeAt(++o)===Ce;);return(t=o)>=a?c=!0:(r=e.charCodeAt(o++))===Pe?f=!0:r===Fe&&(f=!0,e.charCodeAt(o)===Pe&&++o),e.slice(i+1,t-1).replace(/""/g,'"')}for(;o<a;){if((r=e.charCodeAt(t=o++))===Pe)f=!0;else if(r===Fe)f=!0,e.charCodeAt(o)===Pe&&++o;else if(r!==n)continue;return e.slice(i,t)}return c=!0,e.slice(i,a)}for(e.charCodeAt(a-1)===Pe&&--a,e.charCodeAt(a-1)===Fe&&--a;(r=s())!==Re;){for(var l=[];r!==Te&&r!==Re;)l.push(r),r=s();t&&null==(l=t(l,u++))||i.push(l)}return i}function i(t){return t.map(a).join(e)}function a(e){return null==e?"":t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,i,a=r(e,function(e,r){if(n)return n(e,r-1);i=e,n=t?function(e,t){var n=Me(e);return function(r,i){return t(n(r),i,e)}}(e,t):Me(e)});return a.columns=i||[],a},parseRows:r,format:function(t,n){return null==n&&(n=function(e){var t=Object.create(null),n=[];return e.forEach(function(e){for(var r in e)r in t||n.push(t[r]=r)}),n}(t)),[n.map(a).join(e)].concat(t.map(function(t){return n.map(function(e){return a(t[e])}).join(e)})).join("\n")},formatRows:function(e){return e.map(i).join("\n")}}},xe=Ne(","),De=(xe.parse,xe.parseRows,xe.format,xe.formatRows,Ne("\t"));De.parse,De.parseRows,De.format,De.formatRows;var Ie=function(e,t){t=Object.assign({},{firstRowHeader:!0,fieldSeparator:","},t);var n=Ne(t.fieldSeparator);return je(n.parseRows(e),t)};var Le=function(e){var t={},n=0,r=void 0,i=[],a=y(i);return e.forEach(function(e){var i=[];for(var o in e)o in t?r=t[o]:(t[o]=n++,r=n-1),i[r]=e[o];a.apply(void 0,i)}),[Object.keys(t),i]};var Ue=function(e,t){var n=void 0;if(function(e){return"string"==typeof e}(e))n=Ie;else if(S(e)&&S(e[0]))n=je;else{if(!S(e)||0!==e.length&&!function(e){return e===Object(e)}(e[0]))throw new Error("Couldn't detect the data format");n=Le}return n(e,t)},Ve=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function He(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function Be(e,t){var n={},r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done);r=!0){var c=o.value;n[c.name]=new x(c.data[t],c)}}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}function Ye(e){var t={};return Object.keys(e).forEach(function(n){t[n]=new x(e[n],n)}),t}var Je=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=void 0;t!==L.COMPOSE?(a={op:t,meta:r,criteria:i},e._derivation.push(a)):(a=[].concat(He(i)),e._derivation.length=0,(n=e._derivation).push.apply(n,He(a)))},Ge=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.operation||V,i=n.filterByMeasure||!1,a=[];a=null===t?[function(){return!1}]:t.map(function(e){return function(e){var t=e.getData(),n=t.schema,r=e.getFieldsConfig(),a=e.getFieldspace().fieldsObj(),o=t.data,u=Object.values(r).reduce(function(e,t){return e[t.def.name]=a[t.def.name].domain(),e},{});return function(e){return!!o.length&&o.some(function(t){return n.every(function(n){if(!(n.name in e))return!0;var a=e[n.name].valueOf();if(i&&n.type===f.MEASURE)return a>=u[n.name][0]&&a<=u[n.name][1];if(n.type!==f.DIMENSION)return!0;var o=r[n.name].index;return t[o]===e[n.name].valueOf()})})}}(e)});var o=void 0;r===V?o=e.clone(!1,!1).select(function(e){return a.every(function(t){return t(e)})},{saveChild:!1,mode:s.ALL}):o=e.clone(!1,!1).select(function(e){return a.some(function(t){return t(e)})},{mode:s.ALL,saveChild:!1});return o},qe=function(e,t,n,r){var i=e.clone(r.saveChild),a=function(e,t,n,r){var i=[],a=-1,o=void 0,u=function(e){return n(Be(t,e),e)};return r.mode===s.INVERSE&&(u=function(e){return!n(Be(t,e))}),l(e,function(e){u(e)&&(-1!==a&&e===a+1?(o=i.length-1,i[o]=i[o].split("-")[0]+"-"+e):i.push(""+e),a=e)}),i.join(",")}(i._rowDiffset,i.getPartialFieldspace().fields,t,n);return i._rowDiffset=a,i.__calculateFieldspace().calculateFieldsConfig(),r.saveChild&&Je(i,L.SELECT,{config:n},t),i},Ke=function(e,t,n,r){var i=e.clone(n.saveChild),a=t;return n.mode===s.INVERSE&&(a=r.filter(function(e){return-1===t.indexOf(e)})),i._colIdentifier=a.join(","),i.__calculateFieldspace().calculateFieldsConfig(),n.saveChild&&Je(i,L.PROJECT,{projField:t,config:n,actualProjField:a},null),i},We=function(e,t,n,r){r=Object.assign(Object.assign({},Se),r);var a=i[r.dataFormat];if(!a||"function"!=typeof a)throw new Error("No converter function found for "+r.dataFormat+" format");var o=a(t,r),u=Ve(o,2),c=u[0],f=u[1],s=ke(f,n,c),l=M.createNamespace(s,r.name);return e._partialFieldspace=l,e._rowDiffset=f.length&&f[0].length?"0-"+(f[0].length-1):"",e._colIdentifier=n.map(function(e){return e.name}).join(),e},ze=function(e,t){for(var n=0;n<e.length;++n)if(t===e[n].name)return{type:e[n].subtype||e[n].type,index:n};return null},Xe=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=arguments[4],o=function(t,n,a){e(t,n,r,i,a)};t!==i&&(t.handlePropagation({payload:r.payload,data:n,sourceIdentifiers:r.sourceIdentifiers,sourceId:r.propagationSourceId,groupedPropModel:!!a}),function(e,t){H(e,t,L.SELECT)}(t,function(e,t){if(e!==i){var r=n[0].select(t,{saveChild:!1}),u=n[1].select(t,{saveChild:!1});o(e,[r,u],a)}}),function(e,t){H(e,t,L.PROJECT)}(t,function(e,t){if(e!==i){var r=n[0].project(t,{saveChild:!1}),u=n[1].project(t,{saveChild:!1});o(e,[r,u],a)}}),function(e,t){H(e,t,L.GROUPBY)}(t,function(e,t){if(e!==i){var r=t.reducer,a=t.groupByString,u=n[0].groupBy(a.split(","),r,{saveChild:!1}),c=n[1].groupBy(a.split(","),r,{saveChild:!1});o(e,[u,c],!0)}}),function(e,t){H(e,t,L.CAL_VAR)}(t,function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),u=1;u<t;u++)r[u-1]=arguments[u];if(e!==i){var c,f,s=(c=n[0].clone(!1,!1)).calculateVariable.apply(c,r.concat([{saveChild:!1,replaceVar:!0}])),l=(f=n[1].clone(!1,!1)).calculateVariable.apply(f,r.concat([{saveChild:!1,replaceVar:!0}]));o(e,[s,l],a)}}))},Qe=function e(t){return t._parent?e(t._parent):t},$e=function(e,t,n){var r=void 0,i=void 0,a=n.propagationNameSpace,o=n.payload,u=n.propagationSourceId;if(null===e)r=null;else{var c,f=Object.entries(a.mutableActions).filter(function(e){return e[0]!==u}).map(function(e){return Object.values(e[1]).map(function(e){return e.criteria})});r=(c=[]).concat.apply(c,[].concat(He(f),[e]))}var s=t.groupByModel,l=t.model,d={payload:o,propagationSourceId:u,sourceIdentifiers:e};s&&(i=Ge(s,r,{filterByMeasure:!0}),Xe(s,i,d)),i=Ge(l,r,{filterByMeasure:!s}),Xe(l,i,d,s)},Ze=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var et=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var t=void 0;this._parent=null,this._derivation=[],this._children=[];for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];1===r.length&&(t=r[0])instanceof e?(this._colIdentifier=t._colIdentifier,this._rowDiffset=t._rowDiffset,this._parent=t,this._partialFieldspace=this._parent._partialFieldspace,this._fieldStoreName=T(),this.__calculateFieldspace().calculateFieldsConfig()):(We.apply(void 0,[this].concat(r)),this._fieldStoreName=this._partialFieldspace.name,this.__calculateFieldspace().calculateFieldsConfig(),this._propagationNameSpace={mutableActions:{},immutableActions:{}})}return Ze(e,[{key:"getSchema",value:function(){return this.getFieldspace().fields.map(function(e){return e.schema})}},{key:"getName",value:function(){return this._fieldStoreName}},{key:"getFieldspace",value:function(){return this._fieldspace}},{key:"__calculateFieldspace",value:function(){return this._fieldspace=function(e,t,n){var r=Ve(e,2),i=r[0],a=r[1],o=a.length?a.split(","):[],u=t.fieldsObj(),c=o.map(function(e){return new p(u[e],i)});return M.createNamespace(c,n)}([this._rowDiffset,this._colIdentifier],this.getPartialFieldspace(),this._fieldStoreName),this}},{key:"getPartialFieldspace",value:function(){return this._partialFieldspace}},{key:"join",value:function(e,t){return J(this,e,t)}},{key:"naturalJoin",value:function(e){return J(this,e,fe(this,e),!0)}},{key:"union",value:function(e){return se(this,e)}},{key:"difference",value:function(e){return $(this,e)}},{key:"select",value:function(e,t){var n={mode:s.NORMAL,saveChild:!0},r={saveChild:(t=Object.assign({},n,t)).saveChild},i=void 0;t.mode===s.ALL?i=[qe(this,e,{mode:s.NORMAL},r),qe(this,e,{mode:s.INVERSE},r)]:i=qe(this,e,t,r);return i}},{key:"isEmpty",value:function(){return!this._rowDiffset.length||!this._colIdentifier.length}},{key:"clone",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=void 0;if(!1===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])){var n=this.getData({getAllFields:!0}),r=n.data,i=n.schema,a=r.map(function(e){var t={};return i.forEach(function(n,r){t[n.name]=e[r]}),t});t=new this.constructor(a,i)}else t=new this.constructor(this);return e&&this._children.push(t),t}},{key:"project",value:function(e,t){var n={mode:s.NORMAL,saveChild:!0};t=Object.assign({},n,t);var r=this.getFieldsConfig(),i=Object.keys(r),a=t.mode,o=e.reduce(function(e,t){return"RegExp"===t.constructor.name?e.push.apply(e,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(i.filter(function(e){return-1!==e.search(t)}))):t in r&&e.push(t),e},[]);o=Array.from(new Set(o)).map(function(e){return e.trim()});var u=void 0;a===s.ALL?u=[Ke(this,o,{mode:s.NORMAL,saveChild:t.saveChild},i),Ke(this,o,{mode:s.INVERSE,saveChild:t.saveChild},i)]:u=Ke(this,o,t,i);return u}},{key:"getFieldsConfig",value:function(){return this._fieldConfig}},{key:"calculateFieldsConfig",value:function(){return this._fieldConfig=this._fieldspace.fields.reduce(function(e,t,n){return e[t.name]={index:n,def:{name:t._ref.name,type:t._ref.fieldType,subtype:t._ref.subType()}},e},{}),this}},{key:"dispose",value:function(){this._parent.removeChild(this),this._parent=null}},{key:"removeChild",value:function(e){var t=this._children.findIndex(function(t){return t===e});-1===t||this._children.splice(t,1)}},{key:"addParent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];Je(this,L.COMPOSE,null,t),this._parent=e,e._children.push(this)}}]),e}(),tt=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),nt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var rt=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return a._onPropagation=[],a._sortingDetails=[],a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,et),nt(t,[{key:"getData",value:function(e){e=Object.assign({},{order:"row",formatter:null,withUid:!1,getAllFields:!1,sort:[]},e);var t=this.getPartialFieldspace().fields,n=Q.call(this,this.getPartialFieldspace().fields,this._rowDiffset,e.getAllFields?t.map(function(e){return e.name}).join():this._colIdentifier,e.sort,{columnWise:"column"===e.order,addUid:!!e.withUid});if(!e.formatter)return n;var r=e.formatter,i=n.data,a=n.schema,o=n.uids,u=a.map(function(e){return e.name}),c=Object.keys(r).reduce(function(e,t){var n=u.indexOf(t);return-1!==n&&e.push([n,r[t]]),e},[]);return"column"===e.order?c.forEach(function(e){var t=e[0],n=e[1];i[t].forEach(function(e,r){i[t][r]=n.call(void 0,e,o[r],a[t])})}):i.forEach(function(e,t){c.forEach(function(n){var r=n[0],i=n[1];e[r]=i.call(void 0,e[r],o[t],a[r])})}),n}},{key:"groupBy",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{saveChild:!0},r=""+e.join(),i=[this,e,t],a=ce.apply(void 0,i);return n.saveChild&&(this._children.push(a),Je(a,L.GROUPBY,{fieldsArr:e,groupByString:r,defaultReducer:oe.defaultReducer()},t)),a._parent=this,a}},{key:"sort",value:function(e){var t=this.getData({order:"row",sort:e}),n=[t.schema.map(function(e){return e.name})].concat(t.data),r=new this.constructor(n,t.schema,{dataFormat:"DSVArr"});return r._sortingDetails=e,r}},{key:"addField",value:function(e){var t=e.fieldName();this._colIdentifier+=","+t;var n=this._partialFieldspace;if(n.fieldsObj()[e.fieldName()]){var r=n.fields.findIndex(function(e){return e.name===t});r>=0&&(n.fields[r]=e)}else n.fields.push(e);return this.__calculateFieldspace().calculateFieldsConfig(),this}},{key:"calculateVariable",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{saveChild:!0,replaceVar:!1},r=this.getFieldsConfig(),i=t.slice(0,t.length-1),a=t[t.length-1];if(r[e.name]&&!n.replaceVar)throw new Error(e.name+" field already exists in model.");var o=i.map(function(e){var t=r[e];if(!t)throw new Error(e+" is not a valid column name.");return t.index}),u=this.clone(),c=u.getFieldspace().fields,f=o.map(function(e){return c[e]}),s=[];l(u._rowDiffset,function(e){var t=f.map(function(t){return t.data[e]});s[e]=a.apply(void 0,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t).concat([e,c]))});var d=ke([s],[e],[e.name]),p=tt(d,1)[0];return u.addField(p),n.saveChild&&Je(u,L.CAL_VAR,{config:e,fields:i},a),u}},{key:"propagate",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.isMutableAction,i=n.sourceId,a=Qe(this),o=a._propagationNameSpace,u={groupByModel:function e(t){return t._parent&&t._derivation.find(function(e){return"group"!==e.op})?e(t._parent):t}(this),model:a};return $e(e,u,{propagationNameSpace:o,payload:t,propagationSourceId:i}),r&&function(e,t,n){var r=t.groupByModel,i=t.model,a=e.immutableActions;for(var o in a){var u=a[o];for(var c in u){var f=u[c].criteria;$e(f,{groupByModel:r,model:i},{propagationNameSpace:e,payload:u[c].payload,propagationSourceId:n})}}}(o,u,i),this}},{key:"addToPropNamespace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=void 0,r=t.actionName,i=t.payload,a=t.isMutableAction,o=Qe(this)._propagationNameSpace,u=t.criteria;return a?(!o.mutableActions[e]&&(o.mutableActions[e]={}),n=o.mutableActions[e]):(!o.immutableActions[e]&&(o.immutableActions[e]={}),n=o.immutableActions[e]),null===u?delete n[r]:n[r]={criteria:u,payload:i},this}},{key:"on",value:function(e,t){switch(e){case"propagation":this._onPropagation.push(t)}return this}},{key:"unsubscribe",value:function(e){switch(e){case"propagation":this._onPropagation=[]}return this}},{key:"handlePropagation",value:function(e){var t=this;this._onPropagation.forEach(function(n){return n.call(t,e)})}},{key:"bin",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.clone(),r=t.name||e+"_binned";if(this.getFieldsConfig()[r]||!this.getFieldsConfig()[e])throw new Error("Field "+e+" already exists.");var i=I(this._partialFieldspace.fields.find(function(t){return t.name===e}),this._rowDiffset,t),a=ke([i.data],[{name:r,type:f.MEASURE,subtype:"discrete",bins:{range:i.range,mid:i.mid}}],[r])[0];return n.addField(a),Je(n,L.BIN,{measureName:e,config:t,binFieldName:r},null),n}}],[{key:"Reducers",get:function(){return oe}}]),t}(),it=ne.sum,at=ne.avg,ot=ne.min,ut=ne.max,ct=ne.first,ft=ne.last,st=ne.count,lt=ne.std,dt=n(0);rt.Operators={compose:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){var n=e,r=void 0,i=[],a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{saveChild:!0}).saveChild;return t.forEach(function(e){n=e(n),i.push.apply(i,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(n._derivation)),r||(r=n)}),a&&n.addParent(e,i),i.length>1&&r.dispose(),n}},bin:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.bin.apply(e,t)}},select:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.select.apply(e,t)}},project:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.project.apply(e,t)}},groupBy:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.groupBy.apply(e,t)}},calculateVariable:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.calculateVariable.apply(e,t)}},sort:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return e.sort.apply(e,t)}},crossProduct:J,difference:$,naturalJoin:function(e,t){return J(e,t,fe(e,t),!0)},leftOuterJoin:le,rightOuterJoin:de,fullOuterJoin:function(e,t,n){return se(le(e,t,n),de(e,t,n))},union:se},rt.Stats=a,Object.assign(rt,r),rt.DateTimeFormatter=m,rt.DataFormat=o,rt.FilteringMode=s,rt.version=dt.version;var pt=t.default=rt}])});
//# sourceMappingURL=datamodel.js.map

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/chartshq/datamodel",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "dist/datamodel.js",

@@ -148,3 +148,3 @@ <!-- <h3 align="center">

Checkout the [CONTRIBUTING](https://github.com/chartshq/datamodel/CONTRIBUTING.md) guides.
Checkout the [CONTRIBUTING](https://github.com/chartshq/datamodel/blob/master/CONTRIBUTING.md) guides.

@@ -151,0 +151,0 @@ ## License

@@ -218,3 +218,7 @@ import { FieldType, FilteringMode } from './enums';

dataModel !== nonTraversingModel && dataModel.handlePropagation({
if (dataModel === nonTraversingModel) {
return;
}
dataModel.handlePropagation({
payload: config.payload,

@@ -221,0 +225,0 @@ data: propModel,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc