From b54eeb6e833d42bd9712b08d5560f58728bd4241 Mon Sep 17 00:00:00 2001 From: Krzysztof Budnik Date: Fri, 21 Jul 2017 14:57:08 +0200 Subject: [PATCH 1/3] Update travis config --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cf836572..9bfbc502 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,4 +20,4 @@ after_success: notifications: email: false slack: - secure: m548zGgvRHMY3sm2DutezQxxXbNOE8x0HlXHucJixwrastBsj82VfvkXldIuFZW93XGFM2o6oQ9+XJL9rPMDF9G30eTuIqS7u6Gw1UwPPTgH1VUuJej45iGujEnnitiEQS/D0wTxLCh+XD/6B/r+QwIn3ksxkVp+0lzVQof32+fonD1cqJelrKLsbuWikquIfzo/e9yxQD8tRLKNuibtIwj+y7aM1wdppKb97irNSrnwQ5P1yxDeJJtsjipDgwdOgUq5LfDepeWGNXTQCg47W0M2YHG7RGEs3UFbMBcZ1y2dhLmmhOO7vDueIWg7Hr/dQg18bLK3snEJEUZ0dEIRjwuSl6YVw2nuaGVihsXLiaNzgWAADxjCg1IhtDhwY4r8PS0Gmihg+5WoXmRHo9/CXZ4s+n9eXRO6KXOYBb6m9/rhna/t2vOf+WaKHL3wNep9RwhaVRMI91Ijy0LHADGtqRiUUObfbIeQBFWBP7ay7Q/ToIkECM4qkvFmh0ym5K7jay+nysi7OKtQEC3s52ynTToVlWvRfmg2bccLyfU5rOhLMxNT9kuzWLIrXrAm5eArQIXGD1KaWibSVH8g8YSb2vTlLsddWIew/++2/leUqbx25bfABRgTZPdFI/uJ+3EJAD+65e4WkUDH7mfun8/O2+q4Ar/Xjbg1M5D8BYyE1tI= + secure: NfC4fkY0ArSdIK0cR1i6x+GBPWviKltO6Qa1dtxCjJc3bxsiRdyfW8LpixaUC2s189VSREl+AobxruwFSkfcy/JZK2E44cMBysMmbh7QM5vyc8OBPx0ZkG519oBpRJ+br8rPoHrWzcbAGkLmWoA8BCc7zRB4NrDZJG0ltZvrFaU6f5pOVVR2M+AH3u4taafTBYFokRIt9Z6Y4ieEtPR5t2sKCba2MjPIyWOSu4Ve3qeh2GXQvczsIA8Ll/5rP5NrAZ44oBu37RcjRpADtGj9rkknnTP5T6wGgSgk+cRzM/YgMOmP7M4DDu4njcm9A4hfCbFyPQmTVGAay2r9hJLJFMaIMgOiYkkoS/Vnt78kCaQjgkxdG2KfibRaV4FOUMum5f5VvRas5ae2S9dwRJGFPgov9gLH+bV5ChuUjNOHC3t8Dw7CaDhpsEppvE8RuKNbfwVdYE2VWJgrgS9r/PzT4X/gbqsPBrA/z+4kVZ+m4Hb99Fdex3JHRCLVNCI911AWOe9kCn52wAuNd5CxW+L21Rg72zzSC+eTzb0ZyNr+368/ShNB0ly9g060SiuokzwErInR3gE3YTwtv1yt8i/JHK8/Vtrb306uH2jkBAYvv/kRRTMXYb0MpuReQD1UQn9xAT59gHahq0wdMF1UdP/k11qFYCzSEVCXcn1S5SfrTnk= From 96ee511561629d943d9cd9c7295209d07625ba0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20=C5=9Alipko?= Date: Wed, 20 Sep 2017 11:43:46 +0200 Subject: [PATCH 2/3] custom functions --- README.md | 48 +++++++++++++++++++++++++- src/parser.js | 51 +++++++++++++++++++++++++++- test/integration/parsing/function.js | 27 +++++++++++++++ test/unit/parser.js | 39 +++++++++++++++++++++ 4 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 test/integration/parsing/function.js diff --git a/README.md b/README.md index 4c4caf16..20947249 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ It supports: * Relative and absolute cell coordinates like `A1`, `$A1`, `A$1`, `$A$1`; * Build-in variables like `TRUE`, `FALSE`, `NULL` * Custom variables; - * [TODO] Custom functions/formulas; + * Custom functions/formulas; * Node and Browser environment. ## API (methods) @@ -90,6 +90,37 @@ parser.setVariable('fooBar', 10); parser.getVariable('fooBar'); // returns `10` ``` +### .setFunction(name, fn) + +Set custom function which can be visible while parsing formula expression. + +```js +parser.setFunction('ADD_5', function(params) { + return params[0] + 5; +}); +parser.setFunction('GET_LETTER', function(params) { + var string = params[0]; + var index = params[1] - 1; + + return string.charAt(index); +}); + +parser.parse('SUM(4, ADD_5(1))'); // returns `10` +parser.parse('GET_LETTER("Some string", 3)'); // returns `m` +``` + +### .getFunction(name) + +Get custom function. + +```js +parser.setFunction('ADD_5', function(params) { + return params[0] + 5; +}); + +parser.getFunction('ADD_5')([1]); // returns `6` +``` + ### .SUPPORTED_FORMULAS List of all supported formulas function. @@ -114,6 +145,21 @@ parser.on('callVariable', function(name, done) { parser.parse('SUM(SIN(foo), COS(foo))'); // returns `1` ``` +### 'callFunction' (name, params, done) + +Fired while calling function. If function was defined earlier using `setFunction` you can overwrite it's result by this hook. +You can also use this to override result of build-in formulas. + +```js +parser.on('callFunction', function(name, params, done) { + if (name === 'ADD_5') { + done(params[0] + 5); + } +}); + +parser.parse('ADD_5(3)'); // returns `8` +``` + ### 'callCellValue' (cellCoord, done) Fired while retrieving cell value by its label (eq: `B3`, `B$3`, `B$3`, `$B$3`). diff --git a/src/parser.js b/src/parser.js index 3e295c61..732f604e 100644 --- a/src/parser.js +++ b/src/parser.js @@ -20,11 +20,12 @@ class Parser extends Emitter { throwError: (errorName) => this._throwError(errorName), callVariable: (variable) => this._callVariable(variable), evaluateByOperator, - callFunction: evaluateByOperator, + callFunction: (name, params) => this._callFunction(name, params), cellValue: (value) => this._callCellValue(value), rangeValue: (start, end) => this._callRangeValue(start, end), }; this.variables = Object.create(null); + this.functions = Object.create(null); this .setVariable('TRUE', true) @@ -115,6 +116,54 @@ class Parser extends Emitter { return value; } + /** + * Set custom function which can be visible while parsing formula expression. + * + * @param {String} name Custom function name. + * @param {Function} fn Custom function. + * @returns {Parser} + */ + setFunction(name, fn) { + this.functions[name] = fn; + + return this; + } + + /** + * Get custom function. + * + * @param {String} name Custom function name. + * @returns {*} + */ + getFunction(name) { + return this.functions[name]; + } + + /** + * Call function with provided params. + * + * @param name Function name. + * @param params Function params. + * @returns {*} + * @private + */ + _callFunction(name, params = []) { + const fn = this.getFunction(name); + let value; + + if (fn) { + value = fn(params); + } + + this.emit('callFunction', name, params, (newValue) => { + if (newValue !== void 0) { + value = newValue; + } + }); + + return value === void 0 ? evaluateByOperator(name, params) : value; + } + /** * Retrieve value by its label (`B3`, `B$3`, `B$3`, `$B$3`). * diff --git a/test/integration/parsing/function.js b/test/integration/parsing/function.js new file mode 100644 index 00000000..8d96dd33 --- /dev/null +++ b/test/integration/parsing/function.js @@ -0,0 +1,27 @@ +import Parser from '../../../src/parser'; + +describe('.parse() custom function', () => { + let parser; + + beforeEach(() => { + parser = new Parser(); + }); + afterEach(() => { + parser = null; + }); + + it('should evaluate custom functions', () => { + expect(parser.parse('foo()')).toMatchObject({error: '#NAME?', result: null}); + + parser.setFunction('ADD_5', (params) => params[0] + 5); + parser.setFunction('GET_LETTER', (params) => { + const string = params[0]; + const index = params[1] - 1; + + return string.charAt(index); + }); + + expect(parser.parse('SUM(4, ADD_5(1))')).toMatchObject({error: null, result: 10}); + expect(parser.parse('GET_LETTER("Some string", 3)')).toMatchObject({error: null, result: 'm'}); + }); +}); diff --git a/test/unit/parser.js b/test/unit/parser.js index 2b7773b0..eedfa47f 100644 --- a/test/unit/parser.js +++ b/test/unit/parser.js @@ -127,6 +127,16 @@ describe('Parser', () => { }); }); + describe('.setFunction()/.getFunction()', () => { + it('should return custom functions', () => { + parser.setFunction('foo', () => 1234); + parser.setFunction('bar', (params) => params[0] + params[1]); + + expect(parser.getFunction('foo')()).toBe(1234); + expect(parser.getFunction('bar')([1, 2])).toBe(3); + }); + }); + describe('._callVariable()', () => { it('should return error (NAME) when variable not set', () => { parser.getVariable = jest.fn(() => void 0); @@ -153,6 +163,35 @@ describe('Parser', () => { }); }); + describe('._callFunction()', () => { + it('should return error (NAME) when function not set', () => { + expect(() => parser._callFunction('NOT_DEFINED()')).toThrow(/NAME/); + }); + + it('should call predefined function', () => { + parser.getFunction = jest.fn(() => void 0); + + expect(parser._callFunction('SUM', [1, 2])).toBe(3); + }); + + it('should call custom funciton when it was set', () => { + parser.getFunction = jest.fn(() => (params) => params[0] + 1); + + expect(parser._callFunction('ADD_1', [2])).toBe(3); + }); + + it('should return variable set by event emitter', () => { + parser.getFunction = jest.fn(() => (params) => params[0] + 1); + + parser.on('callFunction', (name, params, done) => { + done(name === 'OVERRIDDEN' ? params[0] + 2 : void 0); + }); + + expect(parser._callFunction('ADD_1', [2])).toBe(3); + expect(parser._callFunction('OVERRIDDEN', [2])).toBe(4); + }); + }); + describe('._callCellValue()', () => { it('should return undefined if under specified coordinates data value not exist', () => { expect(parser._callCellValue('A1')).not.toBeDefined(); From 838cdc357586e8e852e6cada8ca4b4658d0d354d Mon Sep 17 00:00:00 2001 From: budnix Date: Wed, 20 Sep 2017 11:47:51 +0200 Subject: [PATCH 3/3] 2.3.0 --- dist/formula-parser.js | 61 +++++++++++++++++++++++++++++++++++++- dist/formula-parser.min.js | 6 ++-- package.json | 2 +- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/dist/formula-parser.js b/dist/formula-parser.js index 26e08147..a73bfefc 100644 --- a/dist/formula-parser.js +++ b/dist/formula-parser.js @@ -12550,7 +12550,9 @@ var Parser = function (_Emitter) { return _this._callVariable(variable); }, evaluateByOperator: _evaluateByOperator2['default'], - callFunction: _evaluateByOperator2['default'], + callFunction: function callFunction(name, params) { + return _this._callFunction(name, params); + }, cellValue: function cellValue(value) { return _this._callCellValue(value); }, @@ -12559,6 +12561,7 @@ var Parser = function (_Emitter) { } }; _this.variables = Object.create(null); + _this.functions = Object.create(null); _this.setVariable('TRUE', true).setVariable('FALSE', false).setVariable('NULL', null); return _this; @@ -12655,6 +12658,62 @@ var Parser = function (_Emitter) { return value; }; + /** + * Set custom function which can be visible while parsing formula expression. + * + * @param {String} name Custom function name. + * @param {Function} fn Custom function. + * @returns {Parser} + */ + + + Parser.prototype.setFunction = function setFunction(name, fn) { + this.functions[name] = fn; + + return this; + }; + + /** + * Get custom function. + * + * @param {String} name Custom function name. + * @returns {*} + */ + + + Parser.prototype.getFunction = function getFunction(name) { + return this.functions[name]; + }; + + /** + * Call function with provided params. + * + * @param name Function name. + * @param params Function params. + * @returns {*} + * @private + */ + + + Parser.prototype._callFunction = function _callFunction(name) { + var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + + var fn = this.getFunction(name); + var value = void 0; + + if (fn) { + value = fn(params); + } + + this.emit('callFunction', name, params, function (newValue) { + if (newValue !== void 0) { + value = newValue; + } + }); + + return value === void 0 ? (0, _evaluateByOperator2['default'])(name, params) : value; + }; + /** * Retrieve value by its label (`B3`, `B$3`, `B$3`, `$B$3`). * diff --git a/dist/formula-parser.min.js b/dist/formula-parser.min.js index 38384f62..59b05429 100644 --- a/dist/formula-parser.min.js +++ b/dist/formula-parser.min.js @@ -1,11 +1,11 @@ -!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formulaParser=e():r.formulaParser=e()}(this,function(){return function(r){function e(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return r[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var t={};return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{configurable:!1,enumerable:!0,get:n})},e.n=function(r){var t=r&&r.__esModule?function(){return r["default"]}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},e.p="",e(e.s=16)}([function(r,e){e.nil=Error("#NULL!"),e.div0=Error("#DIV/0!"),e.value=Error("#VALUE!"),e.ref=Error("#REF!"),e.name=Error("#NAME?"),e.num=Error("#NUM!"),e.na=Error("#N/A"),e.error=Error("#ERROR!"),e.data=Error("#GETTING_DATA")},function(r,e,t){var n=t(0);e.flattenShallow=function(r){return r&&r.reduce?r.reduce(function(r,e){var t=Array.isArray(r),n=Array.isArray(e);return t&&n?r.concat(e):t?(r.push(e),r):n?[r].concat(e):[r,e]}):r},e.isFlat=function(r){if(!r)return!1;for(var e=0;r.length>e;++e)if(Array.isArray(r[e]))return!1;return!0},e.flatten=function(){for(var r=e.argsToArray.apply(null,arguments);!e.isFlat(r);)r=e.flattenShallow(r);return r},e.argsToArray=function(r){var t=[];return e.arrayEach(r,function(r){t.push(r)}),t},e.numbers=function(){return this.flatten.apply(null,arguments).filter(function(r){return"number"==typeof r})},e.cleanFloat=function(r){return Math.round(1e14*r)/1e14},e.parseBool=function(r){if("boolean"==typeof r)return r;if(r instanceof Error)return r;if("number"==typeof r)return 0!==r;if("string"==typeof r){var e=r.toUpperCase();if("TRUE"===e)return!0;if("FALSE"===e)return!1}return r instanceof Date&&!isNaN(r)||n.value},e.parseNumber=function(r){return r===undefined||""===r?n.value:isNaN(r)?n.value:parseFloat(r)},e.parseNumberArray=function(r){var t;if(!r||0===(t=r.length))return n.value;for(var i;t--;){if((i=e.parseNumber(r[t]))===n.value)return i;r[t]=i}return r},e.parseMatrix=function(r){if(!r||0===r.length)return n.value;for(var t,i=0;r.length>i;i++)if(t=e.parseNumberArray(r[i]),r[i]=t,t instanceof Error)return t;return r};var i=new Date(1900,0,1);e.parseDate=function(r){if(!isNaN(r)){if(r instanceof Date)return new Date(r);var e=parseInt(r,10);return 0>e?n.num:e>60?new Date(i.getTime()+864e5*(e-2)):new Date(i.getTime()+864e5*(e-1))}return"string"!=typeof r||(r=new Date(r),isNaN(r))?n.value:r},e.parseDateArray=function(r){for(var e,t=r.length;t--;){if((e=this.parseDate(r[t]))===n.value)return e;r[t]=e}return r},e.anyIsError=function(){for(var r=arguments.length;r--;)if(arguments[r]instanceof Error)return!0;return!1},e.arrayValuesToNumbers=function(r){for(var e,t=r.length;t--;)if("number"!=typeof(e=r[t]))if(!0!==e)if(!1!==e){if("string"==typeof e){var n=this.parseNumber(e);r[t]=n instanceof Error?0:n}}else r[t]=0;else r[t]=1;return r},e.rest=function(r,e){return e=e||1,r&&"function"==typeof r.slice?r.slice(e):r},e.initial=function(r,e){return e=e||1,r&&"function"==typeof r.slice?r.slice(0,r.length-e):r},e.arrayEach=function(r,e){for(var t=-1,n=r.length;++t-1?parseFloat(r):parseInt(r,10)),e}function i(r){return-1*n(r)}e.__esModule=!0,e.toNumber=n,e.invertNumber=i},function(module,exports,__webpack_require__){var utils=__webpack_require__(1),error=__webpack_require__(0),statistical=__webpack_require__(5),information=__webpack_require__(7);exports.ABS=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.abs(r)},exports.ACOS=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.acos(r);return isNaN(e)&&(e=error.num),e},exports.ACOSH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.log(r+Math.sqrt(r*r-1));return isNaN(e)&&(e=error.num),e},exports.ACOT=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.atan(1/r)},exports.ACOTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=.5*Math.log((r+1)/(r-1));return isNaN(e)&&(e=error.num),e},exports.AGGREGATE=function(r,e,t,n){if(r=utils.parseNumber(r),e=utils.parseNumber(r),utils.anyIsError(r,e))return error.value;switch(r){case 1:return statistical.AVERAGE(t);case 2:return statistical.COUNT(t);case 3:return statistical.COUNTA(t);case 4:return statistical.MAX(t);case 5:return statistical.MIN(t);case 6:return exports.PRODUCT(t);case 7:return statistical.STDEV.S(t);case 8:return statistical.STDEV.P(t);case 9:return exports.SUM(t);case 10:return statistical.VAR.S(t);case 11:return statistical.VAR.P(t);case 12:return statistical.MEDIAN(t);case 13:return statistical.MODE.SNGL(t);case 14:return statistical.LARGE(t,n);case 15:return statistical.SMALL(t,n);case 16:return statistical.PERCENTILE.INC(t,n);case 17:return statistical.QUARTILE.INC(t,n);case 18:return statistical.PERCENTILE.EXC(t,n);case 19:return statistical.QUARTILE.EXC(t,n)}},exports.ARABIC=function(r){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(r))return error.value;var e=0;return r.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(r){e+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[r]}),e},exports.ASIN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.asin(r);return isNaN(e)&&(e=error.num),e},exports.ASINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r+Math.sqrt(r*r+1))},exports.ATAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.atan(r)},exports.ATAN2=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.atan2(r,e)},exports.ATANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.log((1+r)/(1-r))/2;return isNaN(e)&&(e=error.num),e},exports.BASE=function(r,e,t){if(t=t||0,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;t=t===undefined?0:t;var n=r.toString(e);return Array(Math.max(t+1-n.length,0)).join("0")+n},exports.CEILING=function(r,e,t){if(e=e===undefined?1:Math.abs(e),t=t||0,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;if(0===e)return 0;var n=-Math.floor(Math.log(e)/Math.log(10));return 0>r?0===t?-exports.ROUND(Math.floor(Math.abs(r)/e)*e,n):-exports.ROUND(Math.ceil(Math.abs(r)/e)*e,n):exports.ROUND(Math.ceil(r/e)*e,n)},exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:exports.FACT(r)/(exports.FACT(e)*exports.FACT(r-e))},exports.COMBINA=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0===r&&0===e?1:exports.COMBIN(r+e-1,r-1)},exports.COS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.cos(r)},exports.COSH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)+Math.exp(-r))/2},exports.COT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.tan(r)},exports.COTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e+1)/(e-1)},exports.CSC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.sin(r)},exports.CSCH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)-Math.exp(-r))},exports.DECIMAL=function(r,e){return 1>arguments.length?error.value:parseInt(r,e)},exports.DEGREES=function(r){return r=utils.parseNumber(r),r instanceof Error?r:180*r/Math.PI},exports.EVEN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:exports.CEILING(r,-2,-1)},exports.EXP=function(r){return 1>arguments.length?error.na:"number"!=typeof r||arguments.length>1?error.error:r=Math.exp(r)};var MEMOIZED_FACT=[];exports.FACT=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.floor(r);return 0===e||1===e?1:MEMOIZED_FACT[e]>0?MEMOIZED_FACT[e]:MEMOIZED_FACT[e]=exports.FACT(e-1)*e},exports.FACTDOUBLE=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.floor(r);return e>0?e*exports.FACTDOUBLE(e-2):1},exports.FLOOR=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;if(0===e)return 0;if(!(r>0&&e>0||0>r&&0>e))return error.num;e=Math.abs(e);var t=-Math.floor(Math.log(e)/Math.log(10));return 0>r?-exports.ROUND(Math.ceil(Math.abs(r)/e),t):exports.ROUND(Math.floor(r/e)*e,t)},exports.FLOOR.MATH=function(r,e,t){if(e=e===undefined?1:e,t=t===undefined?0:t,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;if(0===e)return 0;e=e?Math.abs(e):1;var n=-Math.floor(Math.log(e)/Math.log(10));return 0>r?0===t||t===undefined?-exports.ROUND(Math.ceil(Math.abs(r)/e)*e,n):-exports.ROUND(Math.floor(Math.abs(r)/e)*e,n):exports.ROUND(Math.floor(r/e)*e,n)},exports.FLOOR.PRECISE=exports.FLOOR.MATH,exports.GCD=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=r.length,t=r[0],n=0>t?-t:t,i=1;e>i;i++){for(var o=r[i],u=0>o?-o:o;n&&u;)n>u?n%=u:u%=n;n+=u}return n},exports.INT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.floor(r)},exports.ISO={CEILING:exports.CEILING},exports.LCM=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e,t,n,i,o=1;(n=r.pop())!==undefined;)for(;n>1;){if(n%2){for(e=3,t=Math.floor(Math.sqrt(n));t>=e&&n%e;e+=2);i=e>t?n:e}else i=2;for(n/=i,o*=i,e=r.length;e;r[--e]%i==0&&1==(r[e]/=i)&&r.splice(e,1));}return o},exports.LN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)},exports.LN10=function(){return Math.log(10)},exports.LN2=function(){return Math.log(2)},exports.LOG10E=function(){return Math.LOG10E},exports.LOG2E=function(){return Math.LOG2E},exports.LOG=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(e=e===undefined?10:e,Math.log(r)/Math.log(e))},exports.LOG10=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)/Math.log(10)},exports.MOD=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;if(0===e)return error.div0;var t=Math.abs(r%e);return e>0?t:-t},exports.MROUND=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0>r*e?error.num:Math.round(r/e)*e},exports.MULTINOMIAL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=0,t=1,n=0;r.length>n;n++)e+=r[n],t*=exports.FACT(r[n]);return exports.FACT(e)/t},exports.ODD=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.ceil(Math.abs(r));return e=1&e?e:e+1,r>0?e:-e},exports.PI=function(){return Math.PI},exports.E=function(){return Math.E},exports.POWER=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;var t=Math.pow(r,e);return isNaN(t)?error.num:t},exports.PRODUCT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=1,t=0;r.length>t;t++)e*=r[t];return e},exports.QUOTIENT=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:parseInt(r/e,10)},exports.RADIANS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:r*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r+Math.ceil((e-r+1)*Math.random())-1},exports.ROMAN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;for(var e=(r+"").split(""),t=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],n="",i=3;i--;)n=(t[+e.pop()+10*i]||"")+n;return Array(+e.join("")+1).join("M")+n},exports.ROUND=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.round(r*Math.pow(10,e))/Math.pow(10,e)},exports.ROUNDDOWN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)},exports.ROUNDUP=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.ceil(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)},exports.SEC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.cos(r)},exports.SECH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)+Math.exp(-r))},exports.SERIESSUM=function(r,e,t,n){if(r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumberArray(n),utils.anyIsError(r,e,t,n))return error.value;for(var i=n[0]*Math.pow(r,e),o=1;n.length>o;o++)i+=n[o]*Math.pow(r,e+o*t);return i},exports.SIGN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?-1:0===r?0:1},exports.SIN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sin(r)},exports.SINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)-Math.exp(-r))/2},exports.SQRT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?error.num:Math.sqrt(r)},exports.SQRTPI=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sqrt(r*Math.PI)},exports.SQRT1_2=function(){return 1/Math.sqrt(2)},exports.SQRT2=function(){return Math.sqrt(2)},exports.SUBTOTAL=function(r,e){if((r=utils.parseNumber(r))instanceof Error)return r;switch(r){case 1:return statistical.AVERAGE(e);case 2:return statistical.COUNT(e);case 3:return statistical.COUNTA(e);case 4:return statistical.MAX(e);case 5:return statistical.MIN(e);case 6:return exports.PRODUCT(e);case 7:return statistical.STDEV.S(e);case 8:return statistical.STDEV.P(e);case 9:return exports.SUM(e);case 10:return statistical.VAR.S(e);case 11:return statistical.VAR.P(e);case 101:return statistical.AVERAGE(e);case 102:return statistical.COUNT(e);case 103:return statistical.COUNTA(e);case 104:return statistical.MAX(e);case 105:return statistical.MIN(e);case 106:return exports.PRODUCT(e);case 107:return statistical.STDEV.S(e);case 108:return statistical.STDEV.P(e);case 109:return exports.SUM(e);case 110:return statistical.VAR.S(e);case 111:return statistical.VAR.P(e)}},exports.ADD=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r+e)},exports.MINUS=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r-e)},exports.DIVIDE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0===e?error.div0:r/e)},exports.MULTIPLY=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r*e)},exports.GTE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:r>=e)},exports.LT=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:e>r)},exports.LTE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:e>=r)},exports.EQ=function(r,e){return 2!==arguments.length?error.na:r===e},exports.NE=function(r,e){return 2!==arguments.length?error.na:r!==e},exports.POW=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:exports.POWER(r,e))},exports.SUM=function(){var r=0;return utils.arrayEach(utils.argsToArray(arguments),function(e){if("number"==typeof e)r+=e;else if("string"==typeof e){var t=parseFloat(e);!isNaN(t)&&(r+=t)}else Array.isArray(e)&&(r+=exports.SUM.apply(null,e))}),r},exports.SUMIF=function(range,criteria){if((range=utils.parseNumberArray(utils.flatten(range)))instanceof Error)return range;for(var result=0,i=0;range.length>i;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},exports.SUMIFS=function(){var args=utils.argsToArray(arguments),range=utils.parseNumberArray(utils.flatten(args.shift()));if(range instanceof Error)return range;for(var criteria=args,n_range_elements=range.length,n_criterias=criteria.length,result=0,i=0;n_range_elements>i;i++){for(var el=range[i],condition="",c=0;n_criterias>c;c++)condition+=el+criteria[c],c!==n_criterias-1&&(condition+="&&");eval(condition)&&(result+=el)}return result},exports.SUMPRODUCT=function(){if(!arguments||0===arguments.length)return error.value;for(var r,e,t,n,i=arguments.length+1,o=0,u=0;arguments[0].length>u;u++)if(arguments[0][u]instanceof Array)for(var a=0;arguments[0][u].length>a;a++){for(r=1,e=1;i>e;e++){if((n=utils.parseNumber(arguments[e-1][u][a]))instanceof Error)return n;r*=n}o+=r}else{for(r=1,e=1;i>e;e++){if((t=utils.parseNumber(arguments[e-1][u]))instanceof Error)return t;r*=t}o+=r}return o},exports.SUMSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=0,t=r.length,n=0;t>n;n++)e+=information.ISNUMBER(r[n])?r[n]*r[n]:0;return e},exports.SUMX2MY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=0,n=0;r.length>n;n++)t+=r[n]*r[n]-e[n]*e[n];return t},exports.SUMX2PY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t=0;r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e));for(var n=0;r.length>n;n++)t+=r[n]*r[n]+e[n]*e[n];return t},exports.SUMXMY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t=0;r=utils.flatten(r),e=utils.flatten(e);for(var n=0;r.length>n;n++)t+=Math.pow(r[n]-e[n],2);return t},exports.TAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.tan(r)},exports.TANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e-1)/(e+1)},exports.TRUNC=function(r,e){return e=e===undefined?0:e,r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)}},function(module,exports,__webpack_require__){var mathTrig=__webpack_require__(4),text=__webpack_require__(6),jStat=__webpack_require__(11).jStat,utils=__webpack_require__(1),error=__webpack_require__(0),misc=__webpack_require__(12);exports.AVEDEV=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.sum(jStat(r).subtract(jStat.mean(r)).abs()[0])/r.length},exports.AVERAGE=function(){for(var r,e=utils.numbers(utils.flatten(arguments)),t=e.length,n=0,i=0,o=0;t>o;o++)n+=e[o],i+=1;return r=n/i,isNaN(r)&&(r=error.num),r},exports.AVERAGEA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,i=0,o=0;t>o;o++){var u=e[o];"number"==typeof u&&(n+=u),!0===u&&n++,null!==u&&i++}return r=n/i,isNaN(r)&&(r=error.num),r},exports.AVERAGEIF=function(range,criteria,average_range){if(1>=arguments.length)return error.na;if(average_range=average_range||range,range=utils.flatten(range),(average_range=utils.parseNumberArray(utils.flatten(average_range)))instanceof Error)return average_range;for(var average_count=0,result=0,i=0;range.length>i;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},exports.AVERAGEIFS=function(){for(var args=utils.argsToArray(arguments),criteria=(args.length-1)/2,range=utils.flatten(args[0]),count=0,result=0,i=0;range.length>i;i++){for(var condition="",j=0;criteria>j;j++)condition+=args[2*j+1][i]+args[2*j+2],j!==criteria-1&&(condition+="&&");eval(condition)&&(result+=range[i],count++)}var average=result/count;return isNaN(average)?0:average},exports.BETA={},exports.BETA.DIST=function(r,e,t,n,i,o){return 4>arguments.length?error.value:(i=i===undefined?0:i,o=o===undefined?1:o,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),i=utils.parseNumber(i),o=utils.parseNumber(o),utils.anyIsError(r,e,t,i,o)?error.value:(r=(r-i)/(o-i),n?jStat.beta.cdf(r,e,t):jStat.beta.pdf(r,e,t)))},exports.BETA.INV=function(r,e,t,n,i){return n=n===undefined?0:n,i=i===undefined?1:i,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),i=utils.parseNumber(i),utils.anyIsError(r,e,t,n,i)?error.value:jStat.beta.inv(r,e,t)*(i-n)+n},exports.BINOM={},exports.BINOM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n)?error.value:n?jStat.binomial.cdf(r,e,t):jStat.binomial.pdf(r,e,t)},exports.BINOM.DIST.RANGE=function(r,e,t,n){if(n=n===undefined?t:n,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n))return error.value;for(var i=0,o=t;n>=o;o++)i+=mathTrig.COMBIN(r,o)*Math.pow(e,o)*Math.pow(1-e,r-o);return i},exports.BINOM.INV=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;for(var n=0;r>=n;){if(jStat.binomial.cdf(n,r,e)>=t)return n;n++}},exports.CHISQ={},exports.CHISQ.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.chisquare.cdf(r,e):jStat.chisquare.pdf(r,e)},exports.CHISQ.DIST.RT=function(r,e){return!r|!e?error.na:1>r||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e?error.value:1-jStat.chisquare.cdf(r,e)},exports.CHISQ.INV=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:jStat.chisquare.inv(r,e)},exports.CHISQ.INV.RT=function(r,e){return!r|!e?error.na:0>r||r>1||1>e||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e?error.value:jStat.chisquare.inv(1-r,e)},exports.CHISQ.TEST=function(r,e){if(2!==arguments.length)return error.na;if(!(r instanceof Array&&e instanceof Array))return error.value;if(r.length!==e.length)return error.value;if(r[0]&&e[0]&&r[0].length!==e[0].length)return error.value;var t,n,i,o=r.length;for(n=0;o>n;n++)r[n]instanceof Array||(t=r[n],r[n]=[],r[n].push(t)),e[n]instanceof Array||(t=e[n],e[n]=[],e[n].push(t));var u=r[0].length,a=1===u?o-1:(o-1)*(u-1),s=0,l=Math.PI;for(n=0;o>n;n++)for(i=0;u>i;i++)s+=Math.pow(r[n][i]-e[n][i],2)/e[n][i];return Math.round(1e6*function(r,e){var t=Math.exp(-.5*r);e%2==1&&(t*=Math.sqrt(2*r/l));for(var n=e;n>=2;)t=t*r/n,n-=2;for(var i=t,o=e;i>1e-10*t;)o+=2,i=i*r/o,t+=i;return 1-t}(s,a))/1e6},exports.COLUMN=function(r,e){return 2!==arguments.length?error.na:0>e?error.num:r instanceof Array&&"number"==typeof e?0===r.length?undefined:jStat.col(r,e):error.value},exports.COLUMNS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.cols(r):error.value},exports.CONFIDENCE={},exports.CONFIDENCE.NORM=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.normalci(1,r,e,t)[1]-1},exports.CONFIDENCE.T=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.tci(1,r,e,t)[1]-1},exports.CORREL=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:jStat.corrcoeff(r,e)},exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var r=utils.flatten(arguments);return r.length-exports.COUNTBLANK(r)},exports.COUNTIN=function(r,e){var t=0;r=utils.flatten(r);for(var n=0;r.length>n;n++)r[n]===e&&t++;return t},exports.COUNTBLANK=function(){for(var r,e=utils.flatten(arguments),t=0,n=0;e.length>n;n++)null!==(r=e[n])&&""!==r||t++;return t},exports.COUNTIF=function(range,criteria){range=utils.flatten(range),/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;range.length>i;i++)"string"!=typeof range[i]?eval(range[i]+criteria)&&matches++:eval('"'+range[i]+'"'+criteria)&&matches++;return matches},exports.COUNTIFS=function(){for(var args=utils.argsToArray(arguments),results=Array(utils.flatten(args[0]).length),i=0;results.length>i;i++)results[i]=!0;for(i=0;args.length>i;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;range.length>j;j++)results[j]="string"!=typeof range[j]?results[j]&&eval(range[j]+criteria):results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;results.length>i;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return misc.UNIQUE.apply(null,utils.flatten(arguments)).length},exports.COVARIANCE={},exports.COVARIANCE.P=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=0,o=r.length,u=0;o>u;u++)i+=(r[u]-t)*(e[u]-n);return i/o},exports.COVARIANCE.S=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:jStat.covariance(r,e)},exports.DEVSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=0,n=0;r.length>n;n++)t+=Math.pow(r[n]-e,2);return t},exports.EXPON={},exports.EXPON.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.exponential.cdf(r,e):jStat.exponential.pdf(r,e)},exports.F={},exports.F.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.centralF.cdf(r,e,t):jStat.centralF.pdf(r,e,t)},exports.F.DIST.RT=function(r,e,t){return 3!==arguments.length?error.na:0>r||1>e||1>t?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:1-jStat.centralF.cdf(r,e,t)},exports.F.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:0>=r||r>1?error.num:jStat.centralF.inv(r,e,t)},exports.F.INV.RT=function(r,e,t){return 3!==arguments.length?error.na:0>r||r>1||1>e||e>Math.pow(10,10)||1>t||t>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:jStat.centralF.inv(1-r,e,t)},exports.F.TEST=function(r,e){if(!r||!e)return error.na;if(!(r instanceof Array&&e instanceof Array))return error.na;if(2>r.length||2>e.length)return error.div0;var t=function(r,e){for(var t=0,n=0;r.length>n;n++)t+=Math.pow(r[n]-e,2);return t},n=mathTrig.SUM(r)/r.length,i=mathTrig.SUM(e)/e.length;return t(r,n)/(r.length-1)/(t(e,i)/(e.length-1))},exports.FISHER=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log((1+r)/(1-r))/2},exports.FISHERINV=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e-1)/(e+1)},exports.FORECAST=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,e,t))return error.value;for(var n=jStat.mean(t),i=jStat.mean(e),o=t.length,u=0,a=0,s=0;o>s;s++)u+=(t[s]-n)*(e[s]-i),a+=Math.pow(t[s]-n,2);var l=u/a;return i-l*n+l*r},exports.FREQUENCY=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=r.length,n=e.length,i=[],o=0;n>=o;o++){i[o]=0;for(var u=0;t>u;u++)0===o?r[u]>e[0]||(i[0]+=1):n>o?r[u]>e[o-1]&&e[o]>=r[u]&&(i[o]+=1):o===n&&r[u]>e[n-1]&&(i[n]+=1)}return i},exports.GAMMA=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0===r?error.num:parseInt(r,10)===r&&0>r?error.num:jStat.gammafn(r)},exports.GAMMA.DIST=function(r,e,t,n){return 4!==arguments.length?error.na:r>=0&&e>0&&t>0?"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:n?jStat.gamma.cdf(r,e,t,!0):jStat.gamma.pdf(r,e,t,!1):error.value},exports.GAMMA.INV=function(r,e,t){return 3!==arguments.length?error.na:0>r||r>1||0>=e||0>=t?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:jStat.gamma.inv(r,e,t)},exports.GAMMALN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.gammaln(r)},exports.GAMMALN.PRECISE=function(r){return 1!==arguments.length?error.na:r>0?"number"!=typeof r?error.value:jStat.gammaln(r):error.num},exports.GAUSS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.normal.cdf(r,0,1)-.5},exports.GEOMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.geomean(r)},exports.GROWTH=function(r,e,t,n){if((r=utils.parseNumberArray(r))instanceof Error)return r;var i;if(e===undefined)for(e=[],i=1;r.length>=i;i++)e.push(i);if(t===undefined)for(t=[],i=1;r.length>=i;i++)t.push(i);if(e=utils.parseNumberArray(e),t=utils.parseNumberArray(t),utils.anyIsError(e,t))return error.value;n===undefined&&(n=!0);var o=r.length,u=0,a=0,s=0,l=0;for(i=0;o>i;i++){var f=e[i],c=Math.log(r[i]);u+=f,a+=c,s+=f*c,l+=f*f}u/=o,a/=o,s/=o,l/=o;var d,m;n?(d=(s-u*a)/(l-u*u),m=a-d*u):(d=s/l,m=0);var p=[];for(i=0;t.length>i;i++)p.push(Math.exp(m+d*t[i]));return p},exports.HARMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=r.length,t=0,n=0;e>n;n++)t+=1/r[n];return e/t},exports.HYPGEOM={},exports.HYPGEOM.DIST=function(r,e,t,n,i){function o(r,e,t,n){return mathTrig.COMBIN(t,r)*mathTrig.COMBIN(n-t,e-r)/mathTrig.COMBIN(n,e)}return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n)?error.value:i?function(r,e,t,n){for(var i=0,u=0;r>=u;u++)i+=o(u,e,t,n);return i}(r,e,t,n):o(r,e,t,n)},exports.INTERCEPT=function(r,e){return r=utils.parseNumberArray(r),e=utils.parseNumberArray(e),utils.anyIsError(r,e)?error.value:r.length!==e.length?error.na:exports.FORECAST(0,r,e)},exports.KURT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,i=0;t>i;i++)n+=Math.pow(r[i]-e,4);return n/=Math.pow(jStat.stdev(r,!0),4),t*(t+1)/((t-1)*(t-2)*(t-3))*n-3*(t-1)*(t-1)/((t-2)*(t-3))},exports.LARGE=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e)?r:r.sort(function(r,e){return e-r})[e-1]},exports.LINEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=e.length,o=0,u=0,a=0;i>a;a++)o+=(e[a]-n)*(r[a]-t),u+=Math.pow(e[a]-n,2);var s=o/u;return[s,t-s*n]},exports.LOGEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=0;r.length>t;t++)r[t]=Math.log(r[t]);var n=exports.LINEST(r,e);return n[0]=Math.round(1e6*Math.exp(n[0]))/1e6,n[1]=Math.round(1e6*Math.exp(n[1]))/1e6,n},exports.LOGNORM={},exports.LOGNORM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.lognormal.cdf(r,e,t):jStat.lognormal.pdf(r,e,t)},exports.LOGNORM.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.lognormal.inv(r,e,t)},exports.MAX=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MAXA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MEDIAN=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments)),e=jStat.median(r);return isNaN(e)&&(e=error.num),e},exports.MIN=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MINA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MODE={},exports.MODE.MULT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e,t=r.length,n={},i=[],o=0,u=0;t>u;u++)e=r[u],n[e]=n[e]?n[e]+1:1,n[e]>o&&(o=n[e],i=[]),n[e]===o&&(i[i.length]=e);return i},exports.MODE.SNGL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:exports.MODE.MULT(r).sort(function(r,e){return r-e})[0]},exports.NEGBINOM={},exports.NEGBINOM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.negbin.cdf(r,e,t):jStat.negbin.pdf(r,e,t)},exports.NORM={},exports.NORM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:t>0?n?jStat.normal.cdf(r,e,t):jStat.normal.pdf(r,e,t):error.num},exports.NORM.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.normal.inv(r,e,t)},exports.NORM.S={},exports.NORM.S.DIST=function(r,e){return r=utils.parseNumber(r),r instanceof Error?error.value:e?jStat.normal.cdf(r,0,1):jStat.normal.pdf(r,0,1)},exports.NORM.S.INV=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:jStat.normal.inv(r,0,1)},exports.PEARSON=function(r,e){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=r.length,o=0,u=0,a=0,s=0;i>s;s++)o+=(r[s]-t)*(e[s]-n),u+=Math.pow(r[s]-t,2),a+=Math.pow(e[s]-n,2);return o/Math.sqrt(u*a)},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;r=r.sort(function(r,e){return r-e});var t=r.length;if(1/(t+1)>e||e>1-1/(t+1))return error.num;var n=e*(t+1)-1,i=Math.floor(n);return utils.cleanFloat(n===i?r[n]:r[i]+(n-i)*(r[i+1]-r[i]))},exports.PERCENTILE.INC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;r=r.sort(function(r,e){return r-e});var t=r.length,n=e*(t-1),i=Math.floor(n);return utils.cleanFloat(n===i?r[n]:r[i]+(n-i)*(r[i+1]-r[i]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(r,e,t){if(t=t===undefined?3:t,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;r=r.sort(function(r,e){return r-e});for(var n=misc.UNIQUE.apply(null,r),i=r.length,o=n.length,u=Math.pow(10,t),a=0,s=!1,l=0;!s&&o>l;)e===n[l]?(a=(r.indexOf(n[l])+1)/(i+1),s=!0):n[l]>e||e>=n[l+1]&&l!==o-1||(a=(r.indexOf(n[l])+1+(e-n[l])/(n[l+1]-n[l]))/(i+1),s=!0),l++;return Math.floor(a*u)/u},exports.PERCENTRANK.INC=function(r,e,t){if(t=t===undefined?3:t,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;r=r.sort(function(r,e){return r-e});for(var n=misc.UNIQUE.apply(null,r),i=r.length,o=n.length,u=Math.pow(10,t),a=0,s=!1,l=0;!s&&o>l;)e===n[l]?(a=r.indexOf(n[l])/(i-1),s=!0):n[l]>e||e>=n[l+1]&&l!==o-1||(a=(r.indexOf(n[l])+(e-n[l])/(n[l+1]-n[l]))/(i-1),s=!0),l++;return Math.floor(a*u)/u},exports.PERMUT=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:mathTrig.FACT(r)/mathTrig.FACT(r-e)},exports.PERMUTATIONA=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.pow(r,e)},exports.PHI=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:Math.exp(-.5*r*r)/2.5066282746310002},exports.POISSON={},exports.POISSON.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.poisson.cdf(r,e):jStat.poisson.pdf(r,e)},exports.PROB=function(r,e,t,n){if(t===undefined)return 0;if(n=n===undefined?t:n,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n))return error.value;if(t===n)return 0>r.indexOf(t)?0:e[r.indexOf(t)];for(var i=r.sort(function(r,e){return r-e}),o=i.length,u=0,a=0;o>a;a++)t>i[a]||i[a]>n||(u+=e[r.indexOf(i[a])]);return u},exports.QUARTILE={},exports.QUARTILE.EXC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;switch(e){case 1:return exports.PERCENTILE.EXC(r,.25);case 2:return exports.PERCENTILE.EXC(r,.5);case 3:return exports.PERCENTILE.EXC(r,.75);default:return error.num}},exports.QUARTILE.INC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;switch(e){case 1:return exports.PERCENTILE.INC(r,.25);case 2:return exports.PERCENTILE.INC(r,.5);case 3:return exports.PERCENTILE.INC(r,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;e=utils.flatten(e),t=t||!1,e=e.sort(t?function(r,e){return r-e}:function(r,e){return e-r});for(var n=e.length,i=0,o=0;n>o;o++)e[o]===r&&i++;return i>1?(2*e.indexOf(r)+i+1)/2:e.indexOf(r)+1},exports.RANK.EQ=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:(t=t||!1,e=e.sort(t?function(r,e){return r-e}:function(r,e){return e-r}),e.indexOf(r)+1)},exports.ROW=function(r,e){return 2!==arguments.length?error.na:0>e?error.num:r instanceof Array&&"number"==typeof e?0===r.length?undefined:jStat.row(r,e):error.value},exports.ROWS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.rows(r):error.value},exports.RSQ=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:Math.pow(exports.PEARSON(r,e),2)},exports.SKEW=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,i=0;t>i;i++)n+=Math.pow(r[i]-e,3);return t*n/((t-1)*(t-2)*Math.pow(jStat.stdev(r,!0),3))},exports.SKEW.P=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,i=0,o=0;t>o;o++)i+=Math.pow(r[o]-e,3),n+=Math.pow(r[o]-e,2);return i/=t,n/=t,i/Math.pow(n,1.5)},exports.SLOPE=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),i=e.length,o=0,u=0,a=0;i>a;a++)o+=(e[a]-t)*(r[a]-n),u+=Math.pow(e[a]-t,2);return o/u},exports.SMALL=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e)?r:r.sort(function(r,e){return r-e})[e-1]},exports.STANDARDIZE=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:(r-e)/t},exports.STDEV={},exports.STDEV.P=function(){var r=exports.VAR.P.apply(this,arguments),e=Math.sqrt(r);return isNaN(e)&&(e=error.num),e},exports.STDEV.S=function(){var r=exports.VAR.S.apply(this,arguments);return Math.sqrt(r)},exports.STDEVA=function(){var r=exports.VARA.apply(this,arguments);return Math.sqrt(r)},exports.STDEVPA=function(){var r=exports.VARPA.apply(this,arguments),e=Math.sqrt(r);return isNaN(e)&&(e=error.num),e},exports.STEYX=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),i=e.length,o=0,u=0,a=0,s=0;i>s;s++)o+=Math.pow(r[s]-n,2),u+=(e[s]-t)*(r[s]-n),a+=Math.pow(e[s]-t,2);return Math.sqrt((o-u*u/a)/(i-2))},exports.TRANSPOSE=function(r){return r?jStat.transpose(r):error.na},exports.T=text.T,exports.T.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.studentt.cdf(r,e):jStat.studentt.pdf(r,e)},exports.T.DIST["2T"]=function(r,e){return 2!==arguments.length?error.na:0>r||1>e?error.num:"number"!=typeof r||"number"!=typeof e?error.value:2*(1-jStat.studentt.cdf(r,e))},exports.T.DIST.RT=function(r,e){return 2!==arguments.length?error.na:0>r||1>e?error.num:"number"!=typeof r||"number"!=typeof e?error.value:1-jStat.studentt.cdf(r,e)},exports.T.INV=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:jStat.studentt.inv(r,e)},exports.T.INV["2T"]=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),0>=r||r>1||1>e?error.num:utils.anyIsError(r,e)?error.value:Math.abs(jStat.studentt.inv(r/2,e))},exports.T.TEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t,n=jStat.mean(r),i=jStat.mean(e),o=0,u=0;for(t=0;r.length>t;t++)o+=Math.pow(r[t]-n,2);for(t=0;e.length>t;t++)u+=Math.pow(e[t]-i,2);o/=r.length-1,u/=e.length-1;var a=Math.abs(n-i)/Math.sqrt(o/r.length+u/e.length);return exports.T.DIST["2T"](a,r.length+e.length-2)},exports.TREND=function(r,e,t){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,e,t))return error.value;var n=exports.LINEST(r,e),i=n[0],o=n[1],u=[];return t.forEach(function(r){u.push(i*r+o)}),u},exports.TRIMMEAN=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;var t=mathTrig.FLOOR(r.length*e,2)/2;return jStat.mean(utils.initial(utils.rest(r.sort(function(r,e){return r-e}),t),t))},exports.VAR={},exports.VAR.P=function(){for(var r,e=utils.numbers(utils.flatten(arguments)),t=e.length,n=0,i=exports.AVERAGE(e),o=0;t>o;o++)n+=Math.pow(e[o]-i,2);return r=n/t,isNaN(r)&&(r=error.num),r},exports.VAR.S=function(){for(var r=utils.numbers(utils.flatten(arguments)),e=r.length,t=0,n=exports.AVERAGE(r),i=0;e>i;i++)t+=Math.pow(r[i]-n,2);return t/(e-1)},exports.VARA=function(){for(var r=utils.flatten(arguments),e=r.length,t=0,n=0,i=exports.AVERAGEA(r),o=0;e>o;o++){var u=r[o];t+="number"==typeof u?Math.pow(u-i,2):!0===u?Math.pow(1-i,2):Math.pow(0-i,2),null!==u&&n++}return t/(n-1)},exports.VARPA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,i=0,o=exports.AVERAGEA(e),u=0;t>u;u++){var a=e[u];n+="number"==typeof a?Math.pow(a-o,2):!0===a?Math.pow(1-o,2):Math.pow(0-o,2),null!==a&&i++}return r=n/i,isNaN(r)&&(r=error.num),r},exports.WEIBULL={},exports.WEIBULL.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?1-Math.exp(-Math.pow(r/t,e)):Math.pow(r,e-1)*Math.exp(-Math.pow(r/t,e))*e/Math.pow(t,e)},exports.Z={},exports.Z.TEST=function(r,e,t){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;t=t||exports.STDEV.S(r);var n=r.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(r)-e)/(t/Math.sqrt(n)),!0)}},function(r,e,t){var n=t(1),i=t(0),o=t(9);e.ASC=function(){throw Error("ASC is not implemented")},e.BAHTTEXT=function(){throw Error("BAHTTEXT is not implemented")},e.CHAR=function(r){return r=n.parseNumber(r),r instanceof Error?r:String.fromCharCode(r)},e.CLEAN=function(r){return r=r||"",r.replace(/[\0-\x1F]/g,"")},e.CODE=function(r){r=r||"";var e=r.charCodeAt(0);return isNaN(e)&&(e=i.na),e},e.CONCATENATE=function(){for(var r=n.flatten(arguments),e=0;(e=r.indexOf(!0))>-1;)r[e]="TRUE";for(var t=0;(t=r.indexOf(!1))>-1;)r[t]="FALSE";return r.join("")},e.DBCS=function(){throw Error("DBCS is not implemented")},e.DOLLAR=function(r,e){if(e=e===undefined?2:e,r=n.parseNumber(r),e=n.parseNumber(e),n.anyIsError(r,e))return i.value;var t="";return e>0?e>0&&(t="($0,0."+Array(e+1).join("0")+")"):(r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),t="($0,0)"),o(r).format(t)},e.EXACT=function(r,e){return 2!==arguments.length?i.na:r===e},e.FIND=function(r,e,t){return 2>arguments.length?i.na:(t=t===undefined?0:t,e?e.indexOf(r,t-1)+1:null)},e.FIXED=function(r,e,t){if(e=e===undefined?2:e,t=t!==undefined&&t,r=n.parseNumber(r),e=n.parseNumber(e),n.anyIsError(r,e))return i.value;var u=t?"0":"0,0";return e>0?e>0&&(u+="."+Array(e+1).join("0")):r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),o(r).format(u)},e.HTML2TEXT=function(r){var e="";return r&&(r instanceof Array?r.forEach(function(r){""!==e&&(e+="\n"),e+=r.replace(/<(?:.|\n)*?>/gm,"")}):e=r.replace(/<(?:.|\n)*?>/gm,"")),e},e.LEFT=function(r,e){return e=e===undefined?1:e,e=n.parseNumber(e),e instanceof Error||"string"!=typeof r?i.value:r?r.substring(0,e):null},e.LEN=function(r){return 0===arguments.length?i.error:"string"==typeof r?r?r.length:0:r.length?r.length:i.value},e.LOWER=function(r){return"string"!=typeof r?i.value:r?r.toLowerCase():r},e.MID=function(r,e,t){if(e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r)return t;var i=e-1;return r.substring(i,i+t)},e.NUMBERVALUE=function(r,e,t){return e=void 0===e?".":e,t=void 0===t?",":t,+r.replace(e,".").replace(t,"")},e.PRONETIC=function(){throw Error("PRONETIC is not implemented")},e.PROPER=function(r){return r===undefined||0===r.length?i.value:(!0===r&&(r="TRUE"),!1===r&&(r="FALSE"),isNaN(r)&&"number"==typeof r?i.value:("number"==typeof r&&(r=""+r),r.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+r.substr(1).toLowerCase()})))},e.REGEXEXTRACT=function(r,e){if(2>arguments.length)return i.na;var t=r.match(RegExp(e));return t?t[t.length>1?t.length-1:0]:null},e.REGEXMATCH=function(r,e,t){if(2>arguments.length)return i.na;var n=r.match(RegExp(e));return t?n:!!n},e.REGEXREPLACE=function(r,e,t){return 3>arguments.length?i.na:r.replace(RegExp(e),t)},e.REPLACE=function(r,e,t,o){return e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r||"string"!=typeof o?i.value:r.substr(0,e-1)+o+r.substr(e-1+t)},e.REPT=function(r,e){return e=n.parseNumber(e),e instanceof Error?e:Array(e+1).join(r)},e.RIGHT=function(r,e){return e=e===undefined?1:e,e=n.parseNumber(e),e instanceof Error?e:r?r.substring(r.length-e):i.na},e.SEARCH=function(r,e,t){var n;return"string"!=typeof r||"string"!=typeof e?i.value:(t=t===undefined?0:t,n=e.toLowerCase().indexOf(r.toLowerCase(),t-1)+1,0===n?i.value:n)},e.SPLIT=function(r,e){return r.split(e)},e.SUBSTITUTE=function(r,e,t,n){if(2>arguments.length)return i.na;if(!(r&&e&&t))return r;if(n===undefined)return r.replace(RegExp(e,"g"),t);for(var o=0,u=0;r.indexOf(e,o)>0;)if(o=r.indexOf(e,o+1),++u===n)return r.substring(0,o)+t+r.substring(o+e.length)},e.T=function(r){return"string"==typeof r?r:""},e.TEXT=function(r,e){return r=n.parseNumber(r),n.anyIsError(r)?i.na:o(r).format(e)},e.TRIM=function(r){return"string"!=typeof r?i.value:r.replace(/ +/g," ").trim()},e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(r){return"string"!=typeof r?i.value:r.toUpperCase()},e.VALUE=function(r){if("string"!=typeof r)return i.value;var e=o().unformat(r);return void 0===e?0:e}},function(r,e,t){var n=t(0);e.CELL=function(){throw Error("CELL is not implemented")},e.ERROR={},e.ERROR.TYPE=function(r){switch(r){case n.nil:return 1;case n.div0:return 2;case n.value:return 3;case n.ref:return 4;case n.name:return 5;case n.num:return 6;case n.na:return 7;case n.data:return 8}return n.na},e.INFO=function(){throw Error("INFO is not implemented")},e.ISBLANK=function(r){return null===r},e.ISBINARY=function(r){return/^[01]{1,10}$/.test(r)},e.ISERR=function(r){return[n.value,n.ref,n.div0,n.num,n.name,n.nil].indexOf(r)>=0||"number"==typeof r&&(isNaN(r)||!isFinite(r))},e.ISERROR=function(r){return e.ISERR(r)||r===n.na},e.ISEVEN=function(r){return!(1&Math.floor(Math.abs(r)))},e.ISFORMULA=function(){throw Error("ISFORMULA is not implemented")},e.ISLOGICAL=function(r){return!0===r||!1===r},e.ISNA=function(r){return r===n.na},e.ISNONTEXT=function(r){return"string"!=typeof r},e.ISNUMBER=function(r){return"number"==typeof r&&!isNaN(r)&&isFinite(r)},e.ISODD=function(r){return!!(1&Math.floor(Math.abs(r)))},e.ISREF=function(){throw Error("ISREF is not implemented")},e.ISTEXT=function(r){return"string"==typeof r},e.N=function(r){return this.ISNUMBER(r)?r:r instanceof Date?r.getTime():!0===r?1:!1===r?0:this.ISERROR(r)?r:0},e.NA=function(){return n.na},e.SHEET=function(){throw Error("SHEET is not implemented")},e.SHEETS=function(){throw Error("SHEETS is not implemented")},e.TYPE=function(r){return this.ISNUMBER(r)?1:this.ISTEXT(r)?2:this.ISLOGICAL(r)?4:this.ISERROR(r)?16:Array.isArray(r)?64:void 0}},function(r,e,t){function n(r){return 1===new Date(r,1,29).getMonth()}function i(r,e){return Math.ceil((e-r)/1e3/60/60/24)}function o(r){return(r-s)/864e5+(r>-22038912e5?2:1)}var u=t(0),a=t(1),s=new Date(1900,0,1),l=[undefined,0,1,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,1,2,3,4,5,6,0],f=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],c=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],undefined,undefined,undefined,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];e.DATE=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?u.value:0>r||0>e||0>t?u.num:new Date(r,e-1,t)},e.DATEVALUE=function(r){if("string"!=typeof r)return u.value;var e=Date.parse(r);return isNaN(e)?u.value:e>-22038912e5?(e-s)/864e5+2:(e-s)/864e5+1},e.DAY=function(r){var e=a.parseDate(r);return e instanceof Error?e:e.getDate()},e.DAYS=function(r,e){return r=a.parseDate(r),e=a.parseDate(e),r instanceof Error?r:e instanceof Error?e:o(r)-o(e)},e.DAYS360=function(r,e,t){if(t=a.parseBool(t),r=a.parseDate(r),e=a.parseDate(e),r instanceof Error)return r;if(e instanceof Error)return e;if(t instanceof Error)return t;var n,i,o=r.getMonth(),u=e.getMonth();if(t)n=31===r.getDate()?30:r.getDate(),i=31===e.getDate()?30:e.getDate();else{var s=new Date(r.getFullYear(),o+1,0).getDate(),l=new Date(e.getFullYear(),u+1,0).getDate();n=r.getDate()===s?30:r.getDate(),e.getDate()===l?30>n?(u++,i=1):i=30:i=e.getDate()}return 360*(e.getFullYear()-r.getFullYear())+30*(u-o)+(i-n)},e.EDATE=function(r,e){return(r=a.parseDate(r))instanceof Error?r:isNaN(e)?u.value:(e=parseInt(e,10),r.setMonth(r.getMonth()+e),o(r))},e.EOMONTH=function(r,e){return(r=a.parseDate(r))instanceof Error?r:isNaN(e)?u.value:(e=parseInt(e,10),o(new Date(r.getFullYear(),r.getMonth()+e+1,0)))},e.HOUR=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getHours()},e.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return u.value;r=parseInt(r,10);var e=Math.floor(r/94608e4);r%=94608e4;var t=Math.floor(r/2592e3);r%=2592e3;var n=Math.floor(r/86400);r%=86400;var i=Math.floor(r/3600);r%=3600;var o=Math.floor(r/60);r%=60;var a=r;return e=e>0?e+"Y":"",t=t>0?t+"M":"",n=n>0?n+"D":"",i=i>0?i+"H":"",o=o>0?o+"M":"",a=a>0?a+"S":"","P"+e+t+n+"T"+i+o+a},e.ISOWEEKNUM=function(r){if((r=a.parseDate(r))instanceof Error)return r;r.setHours(0,0,0),r.setDate(r.getDate()+4-(r.getDay()||7));var e=new Date(r.getFullYear(),0,1);return Math.ceil(((r-e)/864e5+1)/7)},e.MINUTE=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getMinutes()},e.MONTH=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getMonth()+1},e.NETWORKDAYS=function(r,e,t){return this.NETWORKDAYS.INTL(r,e,1,t)},e.NETWORKDAYS.INTL=function(r,e,t,n){if((r=a.parseDate(r))instanceof Error)return r;if((e=a.parseDate(e))instanceof Error)return e;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return u.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var i=0;n.length>i;i++){var o=a.parseDate(n[i]);if(o instanceof Error)return o;n[i]=o}var s=(e-r)/864e5+1,l=s,f=r;for(i=0;s>i;i++){var d=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),m=!1;d!==t[0]&&d!==t[1]||(m=!0);for(var p=0;n.length>p;p++){var h=n[p];if(h.getDate()===f.getDate()&&h.getMonth()===f.getMonth()&&h.getFullYear()===f.getFullYear()){m=!0;break}}m&&l--,f.setDate(f.getDate()+1)}return l},e.NOW=function(){return new Date},e.SECOND=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getSeconds()},e.TIME=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?u.value:0>r||0>e||0>t?u.num:(3600*r+60*e+t)/86400},e.TIMEVALUE=function(r){return r=a.parseDate(r),r instanceof Error?r:(3600*r.getHours()+60*r.getMinutes()+r.getSeconds())/86400},e.TODAY=function(){return new Date},e.WEEKDAY=function(r,e){if((r=a.parseDate(r))instanceof Error)return r;e===undefined&&(e=1);var t=r.getDay();return f[e][t]},e.WEEKNUM=function(r,e){if((r=a.parseDate(r))instanceof Error)return r;if(e===undefined&&(e=1),21===e)return this.ISOWEEKNUM(r);var t=l[e],n=new Date(r.getFullYear(),0,1),i=n.getDay()e)return u.num;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return u.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var i=0;n.length>i;i++){var o=a.parseDate(n[i]);if(o instanceof Error)return o;n[i]=o}for(var s=0;e>s;){r.setDate(r.getDate()+1);var l=r.getDay();if(l!==t[0]&&l!==t[1]){for(var f=0;n.length>f;f++){var d=n[f];if(d.getDate()===r.getDate()&&d.getMonth()===r.getMonth()&&d.getFullYear()===r.getFullYear()){s--;break}}s++}}return r},e.YEAR=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getFullYear()},e.YEARFRAC=function(r,e,t){if((r=a.parseDate(r))instanceof Error)return r;if((e=a.parseDate(e))instanceof Error)return e;t=t||0;var o=r.getDate(),u=r.getMonth()+1,s=r.getFullYear(),l=e.getDate(),f=e.getMonth()+1,c=e.getFullYear();switch(t){case 0:return 31===o&&31===l?(o=30,l=30):31===o?o=30:30===o&&31===l&&(l=30),(l+30*f+360*c-(o+30*u+360*s))/360;case 1:var d=365;if(s===c||s+1===c&&(u>f||u===f&&o>=l))return(s===c&&n(s)||function(r,e){var t=r.getFullYear(),i=new Date(t,2,1);if(n(t)&&i>r&&e>=i)return!0;var o=e.getFullYear(),u=new Date(o,2,1);return n(o)&&e>=u&&u>r}(r,e)||1===f&&29===l)&&(d=366),i(r,e)/d;var m=c-s+1,p=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,h=p/m;return i(r,e)/h;case 2:return i(r,e)/360;case 3:return i(r,e)/365;case 4:return(l+30*f+360*c-(o+30*u+360*s))/360}}},function(r,e,t){(function(n){var i,o;/*! +!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.formulaParser=e():r.formulaParser=e()}(this,function(){return function(r){function e(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return r[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var t={};return e.m=r,e.c=t,e.d=function(r,t,n){e.o(r,t)||Object.defineProperty(r,t,{configurable:!1,enumerable:!0,get:n})},e.n=function(r){var t=r&&r.__esModule?function(){return r["default"]}:function(){return r};return e.d(t,"a",t),t},e.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},e.p="",e(e.s=16)}([function(r,e){e.nil=Error("#NULL!"),e.div0=Error("#DIV/0!"),e.value=Error("#VALUE!"),e.ref=Error("#REF!"),e.name=Error("#NAME?"),e.num=Error("#NUM!"),e.na=Error("#N/A"),e.error=Error("#ERROR!"),e.data=Error("#GETTING_DATA")},function(r,e,t){var n=t(0);e.flattenShallow=function(r){return r&&r.reduce?r.reduce(function(r,e){var t=Array.isArray(r),n=Array.isArray(e);return t&&n?r.concat(e):t?(r.push(e),r):n?[r].concat(e):[r,e]}):r},e.isFlat=function(r){if(!r)return!1;for(var e=0;r.length>e;++e)if(Array.isArray(r[e]))return!1;return!0},e.flatten=function(){for(var r=e.argsToArray.apply(null,arguments);!e.isFlat(r);)r=e.flattenShallow(r);return r},e.argsToArray=function(r){var t=[];return e.arrayEach(r,function(r){t.push(r)}),t},e.numbers=function(){return this.flatten.apply(null,arguments).filter(function(r){return"number"==typeof r})},e.cleanFloat=function(r){return Math.round(1e14*r)/1e14},e.parseBool=function(r){if("boolean"==typeof r)return r;if(r instanceof Error)return r;if("number"==typeof r)return 0!==r;if("string"==typeof r){var e=r.toUpperCase();if("TRUE"===e)return!0;if("FALSE"===e)return!1}return r instanceof Date&&!isNaN(r)||n.value},e.parseNumber=function(r){return r===undefined||""===r?n.value:isNaN(r)?n.value:parseFloat(r)},e.parseNumberArray=function(r){var t;if(!r||0===(t=r.length))return n.value;for(var i;t--;){if((i=e.parseNumber(r[t]))===n.value)return i;r[t]=i}return r},e.parseMatrix=function(r){if(!r||0===r.length)return n.value;for(var t,i=0;r.length>i;i++)if(t=e.parseNumberArray(r[i]),r[i]=t,t instanceof Error)return t;return r};var i=new Date(1900,0,1);e.parseDate=function(r){if(!isNaN(r)){if(r instanceof Date)return new Date(r);var e=parseInt(r,10);return 0>e?n.num:e>60?new Date(i.getTime()+864e5*(e-2)):new Date(i.getTime()+864e5*(e-1))}return"string"!=typeof r||(r=new Date(r),isNaN(r))?n.value:r},e.parseDateArray=function(r){for(var e,t=r.length;t--;){if((e=this.parseDate(r[t]))===n.value)return e;r[t]=e}return r},e.anyIsError=function(){for(var r=arguments.length;r--;)if(arguments[r]instanceof Error)return!0;return!1},e.arrayValuesToNumbers=function(r){for(var e,t=r.length;t--;)if("number"!=typeof(e=r[t]))if(!0!==e)if(!1!==e){if("string"==typeof e){var n=this.parseNumber(e);r[t]=n instanceof Error?0:n}}else r[t]=0;else r[t]=1;return r},e.rest=function(r,e){return e=e||1,r&&"function"==typeof r.slice?r.slice(e):r},e.initial=function(r,e){return e=e||1,r&&"function"==typeof r.slice?r.slice(0,r.length-e):r},e.arrayEach=function(r,e){for(var t=-1,n=r.length;++t-1?parseFloat(r):parseInt(r,10)),e}function i(r){return-1*n(r)}e.__esModule=!0,e.toNumber=n,e.invertNumber=i},function(module,exports,__webpack_require__){var utils=__webpack_require__(1),error=__webpack_require__(0),statistical=__webpack_require__(5),information=__webpack_require__(7);exports.ABS=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.abs(r)},exports.ACOS=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.acos(r);return isNaN(e)&&(e=error.num),e},exports.ACOSH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.log(r+Math.sqrt(r*r-1));return isNaN(e)&&(e=error.num),e},exports.ACOT=function(r){return(r=utils.parseNumber(r))instanceof Error?r:Math.atan(1/r)},exports.ACOTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=.5*Math.log((r+1)/(r-1));return isNaN(e)&&(e=error.num),e},exports.AGGREGATE=function(r,e,t,n){if(r=utils.parseNumber(r),e=utils.parseNumber(r),utils.anyIsError(r,e))return error.value;switch(r){case 1:return statistical.AVERAGE(t);case 2:return statistical.COUNT(t);case 3:return statistical.COUNTA(t);case 4:return statistical.MAX(t);case 5:return statistical.MIN(t);case 6:return exports.PRODUCT(t);case 7:return statistical.STDEV.S(t);case 8:return statistical.STDEV.P(t);case 9:return exports.SUM(t);case 10:return statistical.VAR.S(t);case 11:return statistical.VAR.P(t);case 12:return statistical.MEDIAN(t);case 13:return statistical.MODE.SNGL(t);case 14:return statistical.LARGE(t,n);case 15:return statistical.SMALL(t,n);case 16:return statistical.PERCENTILE.INC(t,n);case 17:return statistical.QUARTILE.INC(t,n);case 18:return statistical.PERCENTILE.EXC(t,n);case 19:return statistical.QUARTILE.EXC(t,n)}},exports.ARABIC=function(r){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(r))return error.value;var e=0;return r.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(r){e+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[r]}),e},exports.ASIN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.asin(r);return isNaN(e)&&(e=error.num),e},exports.ASINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r+Math.sqrt(r*r+1))},exports.ATAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.atan(r)},exports.ATAN2=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.atan2(r,e)},exports.ATANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.log((1+r)/(1-r))/2;return isNaN(e)&&(e=error.num),e},exports.BASE=function(r,e,t){if(t=t||0,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;t=t===undefined?0:t;var n=r.toString(e);return Array(Math.max(t+1-n.length,0)).join("0")+n},exports.CEILING=function(r,e,t){if(e=e===undefined?1:Math.abs(e),t=t||0,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;if(0===e)return 0;var n=-Math.floor(Math.log(e)/Math.log(10));return 0>r?0===t?-exports.ROUND(Math.floor(Math.abs(r)/e)*e,n):-exports.ROUND(Math.ceil(Math.abs(r)/e)*e,n):exports.ROUND(Math.ceil(r/e)*e,n)},exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:exports.FACT(r)/(exports.FACT(e)*exports.FACT(r-e))},exports.COMBINA=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0===r&&0===e?1:exports.COMBIN(r+e-1,r-1)},exports.COS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.cos(r)},exports.COSH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)+Math.exp(-r))/2},exports.COT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.tan(r)},exports.COTH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e+1)/(e-1)},exports.CSC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.sin(r)},exports.CSCH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)-Math.exp(-r))},exports.DECIMAL=function(r,e){return 1>arguments.length?error.value:parseInt(r,e)},exports.DEGREES=function(r){return r=utils.parseNumber(r),r instanceof Error?r:180*r/Math.PI},exports.EVEN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:exports.CEILING(r,-2,-1)},exports.EXP=function(r){return 1>arguments.length?error.na:"number"!=typeof r||arguments.length>1?error.error:r=Math.exp(r)};var MEMOIZED_FACT=[];exports.FACT=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.floor(r);return 0===e||1===e?1:MEMOIZED_FACT[e]>0?MEMOIZED_FACT[e]:MEMOIZED_FACT[e]=exports.FACT(e-1)*e},exports.FACTDOUBLE=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.floor(r);return e>0?e*exports.FACTDOUBLE(e-2):1},exports.FLOOR=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;if(0===e)return 0;if(!(r>0&&e>0||0>r&&0>e))return error.num;e=Math.abs(e);var t=-Math.floor(Math.log(e)/Math.log(10));return 0>r?-exports.ROUND(Math.ceil(Math.abs(r)/e),t):exports.ROUND(Math.floor(r/e)*e,t)},exports.FLOOR.MATH=function(r,e,t){if(e=e===undefined?1:e,t=t===undefined?0:t,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;if(0===e)return 0;e=e?Math.abs(e):1;var n=-Math.floor(Math.log(e)/Math.log(10));return 0>r?0===t||t===undefined?-exports.ROUND(Math.ceil(Math.abs(r)/e)*e,n):-exports.ROUND(Math.floor(Math.abs(r)/e)*e,n):exports.ROUND(Math.floor(r/e)*e,n)},exports.FLOOR.PRECISE=exports.FLOOR.MATH,exports.GCD=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=r.length,t=r[0],n=0>t?-t:t,i=1;e>i;i++){for(var o=r[i],u=0>o?-o:o;n&&u;)n>u?n%=u:u%=n;n+=u}return n},exports.INT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.floor(r)},exports.ISO={CEILING:exports.CEILING},exports.LCM=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e,t,n,i,o=1;(n=r.pop())!==undefined;)for(;n>1;){if(n%2){for(e=3,t=Math.floor(Math.sqrt(n));t>=e&&n%e;e+=2);i=e>t?n:e}else i=2;for(n/=i,o*=i,e=r.length;e;r[--e]%i==0&&1==(r[e]/=i)&&r.splice(e,1));}return o},exports.LN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)},exports.LN10=function(){return Math.log(10)},exports.LN2=function(){return Math.log(2)},exports.LOG10E=function(){return Math.LOG10E},exports.LOG2E=function(){return Math.LOG2E},exports.LOG=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(e=e===undefined?10:e,Math.log(r)/Math.log(e))},exports.LOG10=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log(r)/Math.log(10)},exports.MOD=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;if(0===e)return error.div0;var t=Math.abs(r%e);return e>0?t:-t},exports.MROUND=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0>r*e?error.num:Math.round(r/e)*e},exports.MULTINOMIAL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=0,t=1,n=0;r.length>n;n++)e+=r[n],t*=exports.FACT(r[n]);return exports.FACT(e)/t},exports.ODD=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.ceil(Math.abs(r));return e=1&e?e:e+1,r>0?e:-e},exports.PI=function(){return Math.PI},exports.E=function(){return Math.E},exports.POWER=function(r,e){if(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;var t=Math.pow(r,e);return isNaN(t)?error.num:t},exports.PRODUCT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=1,t=0;r.length>t;t++)e*=r[t];return e},exports.QUOTIENT=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:parseInt(r/e,10)},exports.RADIANS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:r*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r+Math.ceil((e-r+1)*Math.random())-1},exports.ROMAN=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;for(var e=(r+"").split(""),t=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],n="",i=3;i--;)n=(t[+e.pop()+10*i]||"")+n;return Array(+e.join("")+1).join("M")+n},exports.ROUND=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.round(r*Math.pow(10,e))/Math.pow(10,e)},exports.ROUNDDOWN=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)},exports.ROUNDUP=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.ceil(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)},exports.SEC=function(r){return r=utils.parseNumber(r),r instanceof Error?r:1/Math.cos(r)},exports.SECH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:2/(Math.exp(r)+Math.exp(-r))},exports.SERIESSUM=function(r,e,t,n){if(r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumberArray(n),utils.anyIsError(r,e,t,n))return error.value;for(var i=n[0]*Math.pow(r,e),o=1;n.length>o;o++)i+=n[o]*Math.pow(r,e+o*t);return i},exports.SIGN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?-1:0===r?0:1},exports.SIN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sin(r)},exports.SINH=function(r){return r=utils.parseNumber(r),r instanceof Error?r:(Math.exp(r)-Math.exp(-r))/2},exports.SQRT=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0>r?error.num:Math.sqrt(r)},exports.SQRTPI=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.sqrt(r*Math.PI)},exports.SQRT1_2=function(){return 1/Math.sqrt(2)},exports.SQRT2=function(){return Math.sqrt(2)},exports.SUBTOTAL=function(r,e){if((r=utils.parseNumber(r))instanceof Error)return r;switch(r){case 1:return statistical.AVERAGE(e);case 2:return statistical.COUNT(e);case 3:return statistical.COUNTA(e);case 4:return statistical.MAX(e);case 5:return statistical.MIN(e);case 6:return exports.PRODUCT(e);case 7:return statistical.STDEV.S(e);case 8:return statistical.STDEV.P(e);case 9:return exports.SUM(e);case 10:return statistical.VAR.S(e);case 11:return statistical.VAR.P(e);case 101:return statistical.AVERAGE(e);case 102:return statistical.COUNT(e);case 103:return statistical.COUNTA(e);case 104:return statistical.MAX(e);case 105:return statistical.MIN(e);case 106:return exports.PRODUCT(e);case 107:return statistical.STDEV.S(e);case 108:return statistical.STDEV.P(e);case 109:return exports.SUM(e);case 110:return statistical.VAR.S(e);case 111:return statistical.VAR.P(e)}},exports.ADD=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r+e)},exports.MINUS=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r-e)},exports.DIVIDE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:0===e?error.div0:r/e)},exports.MULTIPLY=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:r*e)},exports.GTE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:r>=e)},exports.LT=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:e>r)},exports.LTE=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:e>=r)},exports.EQ=function(r,e){return 2!==arguments.length?error.na:r===e},exports.NE=function(r,e){return 2!==arguments.length?error.na:r!==e},exports.POW=function(r,e){return 2!==arguments.length?error.na:(r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.error:exports.POWER(r,e))},exports.SUM=function(){var r=0;return utils.arrayEach(utils.argsToArray(arguments),function(e){if("number"==typeof e)r+=e;else if("string"==typeof e){var t=parseFloat(e);!isNaN(t)&&(r+=t)}else Array.isArray(e)&&(r+=exports.SUM.apply(null,e))}),r},exports.SUMIF=function(range,criteria){if((range=utils.parseNumberArray(utils.flatten(range)))instanceof Error)return range;for(var result=0,i=0;range.length>i;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},exports.SUMIFS=function(){var args=utils.argsToArray(arguments),range=utils.parseNumberArray(utils.flatten(args.shift()));if(range instanceof Error)return range;for(var criteria=args,n_range_elements=range.length,n_criterias=criteria.length,result=0,i=0;n_range_elements>i;i++){for(var el=range[i],condition="",c=0;n_criterias>c;c++)condition+=el+criteria[c],c!==n_criterias-1&&(condition+="&&");eval(condition)&&(result+=el)}return result},exports.SUMPRODUCT=function(){if(!arguments||0===arguments.length)return error.value;for(var r,e,t,n,i=arguments.length+1,o=0,u=0;arguments[0].length>u;u++)if(arguments[0][u]instanceof Array)for(var a=0;arguments[0][u].length>a;a++){for(r=1,e=1;i>e;e++){if((n=utils.parseNumber(arguments[e-1][u][a]))instanceof Error)return n;r*=n}o+=r}else{for(r=1,e=1;i>e;e++){if((t=utils.parseNumber(arguments[e-1][u]))instanceof Error)return t;r*=t}o+=r}return o},exports.SUMSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=0,t=r.length,n=0;t>n;n++)e+=information.ISNUMBER(r[n])?r[n]*r[n]:0;return e},exports.SUMX2MY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=0,n=0;r.length>n;n++)t+=r[n]*r[n]-e[n]*e[n];return t},exports.SUMX2PY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t=0;r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e));for(var n=0;r.length>n;n++)t+=r[n]*r[n]+e[n]*e[n];return t},exports.SUMXMY2=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t=0;r=utils.flatten(r),e=utils.flatten(e);for(var n=0;r.length>n;n++)t+=Math.pow(r[n]-e[n],2);return t},exports.TAN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.tan(r)},exports.TANH=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e-1)/(e+1)},exports.TRUNC=function(r,e){return e=e===undefined?0:e,r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:(r>0?1:-1)*Math.floor(Math.abs(r)*Math.pow(10,e))/Math.pow(10,e)}},function(module,exports,__webpack_require__){var mathTrig=__webpack_require__(4),text=__webpack_require__(6),jStat=__webpack_require__(11).jStat,utils=__webpack_require__(1),error=__webpack_require__(0),misc=__webpack_require__(12);exports.AVEDEV=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.sum(jStat(r).subtract(jStat.mean(r)).abs()[0])/r.length},exports.AVERAGE=function(){for(var r,e=utils.numbers(utils.flatten(arguments)),t=e.length,n=0,i=0,o=0;t>o;o++)n+=e[o],i+=1;return r=n/i,isNaN(r)&&(r=error.num),r},exports.AVERAGEA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,i=0,o=0;t>o;o++){var u=e[o];"number"==typeof u&&(n+=u),!0===u&&n++,null!==u&&i++}return r=n/i,isNaN(r)&&(r=error.num),r},exports.AVERAGEIF=function(range,criteria,average_range){if(1>=arguments.length)return error.na;if(average_range=average_range||range,range=utils.flatten(range),(average_range=utils.parseNumberArray(utils.flatten(average_range)))instanceof Error)return average_range;for(var average_count=0,result=0,i=0;range.length>i;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},exports.AVERAGEIFS=function(){for(var args=utils.argsToArray(arguments),criteria=(args.length-1)/2,range=utils.flatten(args[0]),count=0,result=0,i=0;range.length>i;i++){for(var condition="",j=0;criteria>j;j++)condition+=args[2*j+1][i]+args[2*j+2],j!==criteria-1&&(condition+="&&");eval(condition)&&(result+=range[i],count++)}var average=result/count;return isNaN(average)?0:average},exports.BETA={},exports.BETA.DIST=function(r,e,t,n,i,o){return 4>arguments.length?error.value:(i=i===undefined?0:i,o=o===undefined?1:o,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),i=utils.parseNumber(i),o=utils.parseNumber(o),utils.anyIsError(r,e,t,i,o)?error.value:(r=(r-i)/(o-i),n?jStat.beta.cdf(r,e,t):jStat.beta.pdf(r,e,t)))},exports.BETA.INV=function(r,e,t,n,i){return n=n===undefined?0:n,i=i===undefined?1:i,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),i=utils.parseNumber(i),utils.anyIsError(r,e,t,n,i)?error.value:jStat.beta.inv(r,e,t)*(i-n)+n},exports.BINOM={},exports.BINOM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n)?error.value:n?jStat.binomial.cdf(r,e,t):jStat.binomial.pdf(r,e,t)},exports.BINOM.DIST.RANGE=function(r,e,t,n){if(n=n===undefined?t:n,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n))return error.value;for(var i=0,o=t;n>=o;o++)i+=mathTrig.COMBIN(r,o)*Math.pow(e,o)*Math.pow(1-e,r-o);return i},exports.BINOM.INV=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;for(var n=0;r>=n;){if(jStat.binomial.cdf(n,r,e)>=t)return n;n++}},exports.CHISQ={},exports.CHISQ.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.chisquare.cdf(r,e):jStat.chisquare.pdf(r,e)},exports.CHISQ.DIST.RT=function(r,e){return!r|!e?error.na:1>r||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e?error.value:1-jStat.chisquare.cdf(r,e)},exports.CHISQ.INV=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:jStat.chisquare.inv(r,e)},exports.CHISQ.INV.RT=function(r,e){return!r|!e?error.na:0>r||r>1||1>e||e>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e?error.value:jStat.chisquare.inv(1-r,e)},exports.CHISQ.TEST=function(r,e){if(2!==arguments.length)return error.na;if(!(r instanceof Array&&e instanceof Array))return error.value;if(r.length!==e.length)return error.value;if(r[0]&&e[0]&&r[0].length!==e[0].length)return error.value;var t,n,i,o=r.length;for(n=0;o>n;n++)r[n]instanceof Array||(t=r[n],r[n]=[],r[n].push(t)),e[n]instanceof Array||(t=e[n],e[n]=[],e[n].push(t));var u=r[0].length,a=1===u?o-1:(o-1)*(u-1),s=0,l=Math.PI;for(n=0;o>n;n++)for(i=0;u>i;i++)s+=Math.pow(r[n][i]-e[n][i],2)/e[n][i];return Math.round(1e6*function(r,e){var t=Math.exp(-.5*r);e%2==1&&(t*=Math.sqrt(2*r/l));for(var n=e;n>=2;)t=t*r/n,n-=2;for(var i=t,o=e;i>1e-10*t;)o+=2,i=i*r/o,t+=i;return 1-t}(s,a))/1e6},exports.COLUMN=function(r,e){return 2!==arguments.length?error.na:0>e?error.num:r instanceof Array&&"number"==typeof e?0===r.length?undefined:jStat.col(r,e):error.value},exports.COLUMNS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.cols(r):error.value},exports.CONFIDENCE={},exports.CONFIDENCE.NORM=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.normalci(1,r,e,t)[1]-1},exports.CONFIDENCE.T=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.tci(1,r,e,t)[1]-1},exports.CORREL=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:jStat.corrcoeff(r,e)},exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var r=utils.flatten(arguments);return r.length-exports.COUNTBLANK(r)},exports.COUNTIN=function(r,e){var t=0;r=utils.flatten(r);for(var n=0;r.length>n;n++)r[n]===e&&t++;return t},exports.COUNTBLANK=function(){for(var r,e=utils.flatten(arguments),t=0,n=0;e.length>n;n++)null!==(r=e[n])&&""!==r||t++;return t},exports.COUNTIF=function(range,criteria){range=utils.flatten(range),/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;range.length>i;i++)"string"!=typeof range[i]?eval(range[i]+criteria)&&matches++:eval('"'+range[i]+'"'+criteria)&&matches++;return matches},exports.COUNTIFS=function(){for(var args=utils.argsToArray(arguments),results=Array(utils.flatten(args[0]).length),i=0;results.length>i;i++)results[i]=!0;for(i=0;args.length>i;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;range.length>j;j++)results[j]="string"!=typeof range[j]?results[j]&&eval(range[j]+criteria):results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;results.length>i;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return misc.UNIQUE.apply(null,utils.flatten(arguments)).length},exports.COVARIANCE={},exports.COVARIANCE.P=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=0,o=r.length,u=0;o>u;u++)i+=(r[u]-t)*(e[u]-n);return i/o},exports.COVARIANCE.S=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:jStat.covariance(r,e)},exports.DEVSQ=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=0,n=0;r.length>n;n++)t+=Math.pow(r[n]-e,2);return t},exports.EXPON={},exports.EXPON.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.exponential.cdf(r,e):jStat.exponential.pdf(r,e)},exports.F={},exports.F.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.centralF.cdf(r,e,t):jStat.centralF.pdf(r,e,t)},exports.F.DIST.RT=function(r,e,t){return 3!==arguments.length?error.na:0>r||1>e||1>t?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:1-jStat.centralF.cdf(r,e,t)},exports.F.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:0>=r||r>1?error.num:jStat.centralF.inv(r,e,t)},exports.F.INV.RT=function(r,e,t){return 3!==arguments.length?error.na:0>r||r>1||1>e||e>Math.pow(10,10)||1>t||t>Math.pow(10,10)?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:jStat.centralF.inv(1-r,e,t)},exports.F.TEST=function(r,e){if(!r||!e)return error.na;if(!(r instanceof Array&&e instanceof Array))return error.na;if(2>r.length||2>e.length)return error.div0;var t=function(r,e){for(var t=0,n=0;r.length>n;n++)t+=Math.pow(r[n]-e,2);return t},n=mathTrig.SUM(r)/r.length,i=mathTrig.SUM(e)/e.length;return t(r,n)/(r.length-1)/(t(e,i)/(e.length-1))},exports.FISHER=function(r){return r=utils.parseNumber(r),r instanceof Error?r:Math.log((1+r)/(1-r))/2},exports.FISHERINV=function(r){if((r=utils.parseNumber(r))instanceof Error)return r;var e=Math.exp(2*r);return(e-1)/(e+1)},exports.FORECAST=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,e,t))return error.value;for(var n=jStat.mean(t),i=jStat.mean(e),o=t.length,u=0,a=0,s=0;o>s;s++)u+=(t[s]-n)*(e[s]-i),a+=Math.pow(t[s]-n,2);var l=u/a;return i-l*n+l*r},exports.FREQUENCY=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=r.length,n=e.length,i=[],o=0;n>=o;o++){i[o]=0;for(var u=0;t>u;u++)0===o?r[u]>e[0]||(i[0]+=1):n>o?r[u]>e[o-1]&&e[o]>=r[u]&&(i[o]+=1):o===n&&r[u]>e[n-1]&&(i[n]+=1)}return i},exports.GAMMA=function(r){return r=utils.parseNumber(r),r instanceof Error?r:0===r?error.num:parseInt(r,10)===r&&0>r?error.num:jStat.gammafn(r)},exports.GAMMA.DIST=function(r,e,t,n){return 4!==arguments.length?error.na:r>=0&&e>0&&t>0?"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:n?jStat.gamma.cdf(r,e,t,!0):jStat.gamma.pdf(r,e,t,!1):error.value},exports.GAMMA.INV=function(r,e,t){return 3!==arguments.length?error.na:0>r||r>1||0>=e||0>=t?error.num:"number"!=typeof r||"number"!=typeof e||"number"!=typeof t?error.value:jStat.gamma.inv(r,e,t)},exports.GAMMALN=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.gammaln(r)},exports.GAMMALN.PRECISE=function(r){return 1!==arguments.length?error.na:r>0?"number"!=typeof r?error.value:jStat.gammaln(r):error.num},exports.GAUSS=function(r){return r=utils.parseNumber(r),r instanceof Error?r:jStat.normal.cdf(r,0,1)-.5},exports.GEOMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:jStat.geomean(r)},exports.GROWTH=function(r,e,t,n){if((r=utils.parseNumberArray(r))instanceof Error)return r;var i;if(e===undefined)for(e=[],i=1;r.length>=i;i++)e.push(i);if(t===undefined)for(t=[],i=1;r.length>=i;i++)t.push(i);if(e=utils.parseNumberArray(e),t=utils.parseNumberArray(t),utils.anyIsError(e,t))return error.value;n===undefined&&(n=!0);var o=r.length,u=0,a=0,s=0,l=0;for(i=0;o>i;i++){var f=e[i],c=Math.log(r[i]);u+=f,a+=c,s+=f*c,l+=f*f}u/=o,a/=o,s/=o,l/=o;var d,p;n?(d=(s-u*a)/(l-u*u),p=a-d*u):(d=s/l,p=0);var m=[];for(i=0;t.length>i;i++)m.push(Math.exp(p+d*t[i]));return m},exports.HARMEAN=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=r.length,t=0,n=0;e>n;n++)t+=1/r[n];return e/t},exports.HYPGEOM={},exports.HYPGEOM.DIST=function(r,e,t,n,i){function o(r,e,t,n){return mathTrig.COMBIN(t,r)*mathTrig.COMBIN(n-t,e-r)/mathTrig.COMBIN(n,e)}return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n)?error.value:i?function(r,e,t,n){for(var i=0,u=0;r>=u;u++)i+=o(u,e,t,n);return i}(r,e,t,n):o(r,e,t,n)},exports.INTERCEPT=function(r,e){return r=utils.parseNumberArray(r),e=utils.parseNumberArray(e),utils.anyIsError(r,e)?error.value:r.length!==e.length?error.na:exports.FORECAST(0,r,e)},exports.KURT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,i=0;t>i;i++)n+=Math.pow(r[i]-e,4);return n/=Math.pow(jStat.stdev(r,!0),4),t*(t+1)/((t-1)*(t-2)*(t-3))*n-3*(t-1)*(t-1)/((t-2)*(t-3))},exports.LARGE=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e)?r:r.sort(function(r,e){return e-r})[e-1]},exports.LINEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=e.length,o=0,u=0,a=0;i>a;a++)o+=(e[a]-n)*(r[a]-t),u+=Math.pow(e[a]-n,2);var s=o/u;return[s,t-s*n]},exports.LOGEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=0;r.length>t;t++)r[t]=Math.log(r[t]);var n=exports.LINEST(r,e);return n[0]=Math.round(1e6*Math.exp(n[0]))/1e6,n[1]=Math.round(1e6*Math.exp(n[1]))/1e6,n},exports.LOGNORM={},exports.LOGNORM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.lognormal.cdf(r,e,t):jStat.lognormal.pdf(r,e,t)},exports.LOGNORM.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.lognormal.inv(r,e,t)},exports.MAX=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MAXA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.max.apply(Math,r)},exports.MEDIAN=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments)),e=jStat.median(r);return isNaN(e)&&(e=error.num),e},exports.MIN=function(){var r=utils.numbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MINA=function(){var r=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===r.length?0:Math.min.apply(Math,r)},exports.MODE={},exports.MODE.MULT=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e,t=r.length,n={},i=[],o=0,u=0;t>u;u++)e=r[u],n[e]=n[e]?n[e]+1:1,n[e]>o&&(o=n[e],i=[]),n[e]===o&&(i[i.length]=e);return i},exports.MODE.SNGL=function(){var r=utils.parseNumberArray(utils.flatten(arguments));return r instanceof Error?r:exports.MODE.MULT(r).sort(function(r,e){return r-e})[0]},exports.NEGBINOM={},exports.NEGBINOM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?jStat.negbin.cdf(r,e,t):jStat.negbin.pdf(r,e,t)},exports.NORM={},exports.NORM.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:t>0?n?jStat.normal.cdf(r,e,t):jStat.normal.pdf(r,e,t):error.num},exports.NORM.INV=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:jStat.normal.inv(r,e,t)},exports.NORM.S={},exports.NORM.S.DIST=function(r,e){return r=utils.parseNumber(r),r instanceof Error?error.value:e?jStat.normal.cdf(r,0,1):jStat.normal.pdf(r,0,1)},exports.NORM.S.INV=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:jStat.normal.inv(r,0,1)},exports.PEARSON=function(r,e){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=r.length,o=0,u=0,a=0,s=0;i>s;s++)o+=(r[s]-t)*(e[s]-n),u+=Math.pow(r[s]-t,2),a+=Math.pow(e[s]-n,2);return o/Math.sqrt(u*a)},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;r=r.sort(function(r,e){return r-e});var t=r.length;if(1/(t+1)>e||e>1-1/(t+1))return error.num;var n=e*(t+1)-1,i=Math.floor(n);return utils.cleanFloat(n===i?r[n]:r[i]+(n-i)*(r[i+1]-r[i]))},exports.PERCENTILE.INC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;r=r.sort(function(r,e){return r-e});var t=r.length,n=e*(t-1),i=Math.floor(n);return utils.cleanFloat(n===i?r[n]:r[i]+(n-i)*(r[i+1]-r[i]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(r,e,t){if(t=t===undefined?3:t,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;r=r.sort(function(r,e){return r-e});for(var n=misc.UNIQUE.apply(null,r),i=r.length,o=n.length,u=Math.pow(10,t),a=0,s=!1,l=0;!s&&o>l;)e===n[l]?(a=(r.indexOf(n[l])+1)/(i+1),s=!0):n[l]>e||e>=n[l+1]&&l!==o-1||(a=(r.indexOf(n[l])+1+(e-n[l])/(n[l+1]-n[l]))/(i+1),s=!0),l++;return Math.floor(a*u)/u},exports.PERCENTRANK.INC=function(r,e,t){if(t=t===undefined?3:t,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t))return error.value;r=r.sort(function(r,e){return r-e});for(var n=misc.UNIQUE.apply(null,r),i=r.length,o=n.length,u=Math.pow(10,t),a=0,s=!1,l=0;!s&&o>l;)e===n[l]?(a=r.indexOf(n[l])/(i-1),s=!0):n[l]>e||e>=n[l+1]&&l!==o-1||(a=(r.indexOf(n[l])+(e-n[l])/(n[l+1]-n[l]))/(i-1),s=!0),l++;return Math.floor(a*u)/u},exports.PERMUT=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:mathTrig.FACT(r)/mathTrig.FACT(r-e)},exports.PERMUTATIONA=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:Math.pow(r,e)},exports.PHI=function(r){return r=utils.parseNumber(r),r instanceof Error?error.value:Math.exp(-.5*r*r)/2.5066282746310002},exports.POISSON={},exports.POISSON.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.poisson.cdf(r,e):jStat.poisson.pdf(r,e)},exports.PROB=function(r,e,t,n){if(t===undefined)return 0;if(n=n===undefined?t:n,r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(r,e,t,n))return error.value;if(t===n)return 0>r.indexOf(t)?0:e[r.indexOf(t)];for(var i=r.sort(function(r,e){return r-e}),o=i.length,u=0,a=0;o>a;a++)t>i[a]||i[a]>n||(u+=e[r.indexOf(i[a])]);return u},exports.QUARTILE={},exports.QUARTILE.EXC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;switch(e){case 1:return exports.PERCENTILE.EXC(r,.25);case 2:return exports.PERCENTILE.EXC(r,.5);case 3:return exports.PERCENTILE.EXC(r,.75);default:return error.num}},exports.QUARTILE.INC=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;switch(e){case 1:return exports.PERCENTILE.INC(r,.25);case 2:return exports.PERCENTILE.INC(r,.5);case 3:return exports.PERCENTILE.INC(r,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(r,e,t){if(r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;e=utils.flatten(e),t=t||!1,e=e.sort(t?function(r,e){return r-e}:function(r,e){return e-r});for(var n=e.length,i=0,o=0;n>o;o++)e[o]===r&&i++;return i>1?(2*e.indexOf(r)+i+1)/2:e.indexOf(r)+1},exports.RANK.EQ=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:(t=t||!1,e=e.sort(t?function(r,e){return r-e}:function(r,e){return e-r}),e.indexOf(r)+1)},exports.ROW=function(r,e){return 2!==arguments.length?error.na:0>e?error.num:r instanceof Array&&"number"==typeof e?0===r.length?undefined:jStat.row(r,e):error.value},exports.ROWS=function(r){return 1!==arguments.length?error.na:r instanceof Array?0===r.length?0:jStat.rows(r):error.value},exports.RSQ=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e)?error.value:Math.pow(exports.PEARSON(r,e),2)},exports.SKEW=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,i=0;t>i;i++)n+=Math.pow(r[i]-e,3);return t*n/((t-1)*(t-2)*Math.pow(jStat.stdev(r,!0),3))},exports.SKEW.P=function(){var r=utils.parseNumberArray(utils.flatten(arguments));if(r instanceof Error)return r;for(var e=jStat.mean(r),t=r.length,n=0,i=0,o=0;t>o;o++)i+=Math.pow(r[o]-e,3),n+=Math.pow(r[o]-e,2);return i/=t,n/=t,i/Math.pow(n,1.5)},exports.SLOPE=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),i=e.length,o=0,u=0,a=0;i>a;a++)o+=(e[a]-t)*(r[a]-n),u+=Math.pow(e[a]-t,2);return o/u},exports.SMALL=function(r,e){return r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e)?r:r.sort(function(r,e){return r-e})[e-1]},exports.STANDARDIZE=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:(r-e)/t},exports.STDEV={},exports.STDEV.P=function(){var r=exports.VAR.P.apply(this,arguments),e=Math.sqrt(r);return isNaN(e)&&(e=error.num),e},exports.STDEV.S=function(){var r=exports.VAR.S.apply(this,arguments);return Math.sqrt(r)},exports.STDEVA=function(){var r=exports.VARA.apply(this,arguments);return Math.sqrt(r)},exports.STDEVPA=function(){var r=exports.VARPA.apply(this,arguments),e=Math.sqrt(r);return isNaN(e)&&(e=error.num),e},exports.STEYX=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),i=e.length,o=0,u=0,a=0,s=0;i>s;s++)o+=Math.pow(r[s]-n,2),u+=(e[s]-t)*(r[s]-n),a+=Math.pow(e[s]-t,2);return Math.sqrt((o-u*u/a)/(i-2))},exports.TRANSPOSE=function(r){return r?jStat.transpose(r):error.na},exports.T=text.T,exports.T.DIST=function(r,e,t){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:t?jStat.studentt.cdf(r,e):jStat.studentt.pdf(r,e)},exports.T.DIST["2T"]=function(r,e){return 2!==arguments.length?error.na:0>r||1>e?error.num:"number"!=typeof r||"number"!=typeof e?error.value:2*(1-jStat.studentt.cdf(r,e))},exports.T.DIST.RT=function(r,e){return 2!==arguments.length?error.na:0>r||1>e?error.num:"number"!=typeof r||"number"!=typeof e?error.value:1-jStat.studentt.cdf(r,e)},exports.T.INV=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),utils.anyIsError(r,e)?error.value:jStat.studentt.inv(r,e)},exports.T.INV["2T"]=function(r,e){return r=utils.parseNumber(r),e=utils.parseNumber(e),0>=r||r>1||1>e?error.num:utils.anyIsError(r,e)?error.value:Math.abs(jStat.studentt.inv(r/2,e))},exports.T.TEST=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;var t,n=jStat.mean(r),i=jStat.mean(e),o=0,u=0;for(t=0;r.length>t;t++)o+=Math.pow(r[t]-n,2);for(t=0;e.length>t;t++)u+=Math.pow(e[t]-i,2);o/=r.length-1,u/=e.length-1;var a=Math.abs(n-i)/Math.sqrt(o/r.length+u/e.length);return exports.T.DIST["2T"](a,r.length+e.length-2)},exports.TREND=function(r,e,t){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(r,e,t))return error.value;var n=exports.LINEST(r,e),i=n[0],o=n[1],u=[];return t.forEach(function(r){u.push(i*r+o)}),u},exports.TRIMMEAN=function(r,e){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;var t=mathTrig.FLOOR(r.length*e,2)/2;return jStat.mean(utils.initial(utils.rest(r.sort(function(r,e){return r-e}),t),t))},exports.VAR={},exports.VAR.P=function(){for(var r,e=utils.numbers(utils.flatten(arguments)),t=e.length,n=0,i=exports.AVERAGE(e),o=0;t>o;o++)n+=Math.pow(e[o]-i,2);return r=n/t,isNaN(r)&&(r=error.num),r},exports.VAR.S=function(){for(var r=utils.numbers(utils.flatten(arguments)),e=r.length,t=0,n=exports.AVERAGE(r),i=0;e>i;i++)t+=Math.pow(r[i]-n,2);return t/(e-1)},exports.VARA=function(){for(var r=utils.flatten(arguments),e=r.length,t=0,n=0,i=exports.AVERAGEA(r),o=0;e>o;o++){var u=r[o];t+="number"==typeof u?Math.pow(u-i,2):!0===u?Math.pow(1-i,2):Math.pow(0-i,2),null!==u&&n++}return t/(n-1)},exports.VARPA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,i=0,o=exports.AVERAGEA(e),u=0;t>u;u++){var a=e[u];n+="number"==typeof a?Math.pow(a-o,2):!0===a?Math.pow(1-o,2):Math.pow(0-o,2),null!==a&&i++}return r=n/i,isNaN(r)&&(r=error.num),r},exports.WEIBULL={},exports.WEIBULL.DIST=function(r,e,t,n){return r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(r,e,t)?error.value:n?1-Math.exp(-Math.pow(r/t,e)):Math.pow(r,e-1)*Math.exp(-Math.pow(r/t,e))*e/Math.pow(t,e)},exports.Z={},exports.Z.TEST=function(r,e,t){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumber(e),utils.anyIsError(r,e))return error.value;t=t||exports.STDEV.S(r);var n=r.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(r)-e)/(t/Math.sqrt(n)),!0)}},function(r,e,t){var n=t(1),i=t(0),o=t(9);e.ASC=function(){throw Error("ASC is not implemented")},e.BAHTTEXT=function(){throw Error("BAHTTEXT is not implemented")},e.CHAR=function(r){return r=n.parseNumber(r),r instanceof Error?r:String.fromCharCode(r)},e.CLEAN=function(r){return r=r||"",r.replace(/[\0-\x1F]/g,"")},e.CODE=function(r){r=r||"";var e=r.charCodeAt(0);return isNaN(e)&&(e=i.na),e},e.CONCATENATE=function(){for(var r=n.flatten(arguments),e=0;(e=r.indexOf(!0))>-1;)r[e]="TRUE";for(var t=0;(t=r.indexOf(!1))>-1;)r[t]="FALSE";return r.join("")},e.DBCS=function(){throw Error("DBCS is not implemented")},e.DOLLAR=function(r,e){if(e=e===undefined?2:e,r=n.parseNumber(r),e=n.parseNumber(e),n.anyIsError(r,e))return i.value;var t="";return e>0?e>0&&(t="($0,0."+Array(e+1).join("0")+")"):(r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),t="($0,0)"),o(r).format(t)},e.EXACT=function(r,e){return 2!==arguments.length?i.na:r===e},e.FIND=function(r,e,t){return 2>arguments.length?i.na:(t=t===undefined?0:t,e?e.indexOf(r,t-1)+1:null)},e.FIXED=function(r,e,t){if(e=e===undefined?2:e,t=t!==undefined&&t,r=n.parseNumber(r),e=n.parseNumber(e),n.anyIsError(r,e))return i.value;var u=t?"0":"0,0";return e>0?e>0&&(u+="."+Array(e+1).join("0")):r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),o(r).format(u)},e.HTML2TEXT=function(r){var e="";return r&&(r instanceof Array?r.forEach(function(r){""!==e&&(e+="\n"),e+=r.replace(/<(?:.|\n)*?>/gm,"")}):e=r.replace(/<(?:.|\n)*?>/gm,"")),e},e.LEFT=function(r,e){return e=e===undefined?1:e,e=n.parseNumber(e),e instanceof Error||"string"!=typeof r?i.value:r?r.substring(0,e):null},e.LEN=function(r){return 0===arguments.length?i.error:"string"==typeof r?r?r.length:0:r.length?r.length:i.value},e.LOWER=function(r){return"string"!=typeof r?i.value:r?r.toLowerCase():r},e.MID=function(r,e,t){if(e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r)return t;var i=e-1;return r.substring(i,i+t)},e.NUMBERVALUE=function(r,e,t){return e=void 0===e?".":e,t=void 0===t?",":t,+r.replace(e,".").replace(t,"")},e.PRONETIC=function(){throw Error("PRONETIC is not implemented")},e.PROPER=function(r){return r===undefined||0===r.length?i.value:(!0===r&&(r="TRUE"),!1===r&&(r="FALSE"),isNaN(r)&&"number"==typeof r?i.value:("number"==typeof r&&(r=""+r),r.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+r.substr(1).toLowerCase()})))},e.REGEXEXTRACT=function(r,e){if(2>arguments.length)return i.na;var t=r.match(RegExp(e));return t?t[t.length>1?t.length-1:0]:null},e.REGEXMATCH=function(r,e,t){if(2>arguments.length)return i.na;var n=r.match(RegExp(e));return t?n:!!n},e.REGEXREPLACE=function(r,e,t){return 3>arguments.length?i.na:r.replace(RegExp(e),t)},e.REPLACE=function(r,e,t,o){return e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r||"string"!=typeof o?i.value:r.substr(0,e-1)+o+r.substr(e-1+t)},e.REPT=function(r,e){return e=n.parseNumber(e),e instanceof Error?e:Array(e+1).join(r)},e.RIGHT=function(r,e){return e=e===undefined?1:e,e=n.parseNumber(e),e instanceof Error?e:r?r.substring(r.length-e):i.na},e.SEARCH=function(r,e,t){var n;return"string"!=typeof r||"string"!=typeof e?i.value:(t=t===undefined?0:t,n=e.toLowerCase().indexOf(r.toLowerCase(),t-1)+1,0===n?i.value:n)},e.SPLIT=function(r,e){return r.split(e)},e.SUBSTITUTE=function(r,e,t,n){if(2>arguments.length)return i.na;if(!(r&&e&&t))return r;if(n===undefined)return r.replace(RegExp(e,"g"),t);for(var o=0,u=0;r.indexOf(e,o)>0;)if(o=r.indexOf(e,o+1),++u===n)return r.substring(0,o)+t+r.substring(o+e.length)},e.T=function(r){return"string"==typeof r?r:""},e.TEXT=function(r,e){return r=n.parseNumber(r),n.anyIsError(r)?i.na:o(r).format(e)},e.TRIM=function(r){return"string"!=typeof r?i.value:r.replace(/ +/g," ").trim()},e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(r){return"string"!=typeof r?i.value:r.toUpperCase()},e.VALUE=function(r){if("string"!=typeof r)return i.value;var e=o().unformat(r);return void 0===e?0:e}},function(r,e,t){var n=t(0);e.CELL=function(){throw Error("CELL is not implemented")},e.ERROR={},e.ERROR.TYPE=function(r){switch(r){case n.nil:return 1;case n.div0:return 2;case n.value:return 3;case n.ref:return 4;case n.name:return 5;case n.num:return 6;case n.na:return 7;case n.data:return 8}return n.na},e.INFO=function(){throw Error("INFO is not implemented")},e.ISBLANK=function(r){return null===r},e.ISBINARY=function(r){return/^[01]{1,10}$/.test(r)},e.ISERR=function(r){return[n.value,n.ref,n.div0,n.num,n.name,n.nil].indexOf(r)>=0||"number"==typeof r&&(isNaN(r)||!isFinite(r))},e.ISERROR=function(r){return e.ISERR(r)||r===n.na},e.ISEVEN=function(r){return!(1&Math.floor(Math.abs(r)))},e.ISFORMULA=function(){throw Error("ISFORMULA is not implemented")},e.ISLOGICAL=function(r){return!0===r||!1===r},e.ISNA=function(r){return r===n.na},e.ISNONTEXT=function(r){return"string"!=typeof r},e.ISNUMBER=function(r){return"number"==typeof r&&!isNaN(r)&&isFinite(r)},e.ISODD=function(r){return!!(1&Math.floor(Math.abs(r)))},e.ISREF=function(){throw Error("ISREF is not implemented")},e.ISTEXT=function(r){return"string"==typeof r},e.N=function(r){return this.ISNUMBER(r)?r:r instanceof Date?r.getTime():!0===r?1:!1===r?0:this.ISERROR(r)?r:0},e.NA=function(){return n.na},e.SHEET=function(){throw Error("SHEET is not implemented")},e.SHEETS=function(){throw Error("SHEETS is not implemented")},e.TYPE=function(r){return this.ISNUMBER(r)?1:this.ISTEXT(r)?2:this.ISLOGICAL(r)?4:this.ISERROR(r)?16:Array.isArray(r)?64:void 0}},function(r,e,t){function n(r){return 1===new Date(r,1,29).getMonth()}function i(r,e){return Math.ceil((e-r)/1e3/60/60/24)}function o(r){return(r-s)/864e5+(r>-22038912e5?2:1)}var u=t(0),a=t(1),s=new Date(1900,0,1),l=[undefined,0,1,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,1,2,3,4,5,6,0],f=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],c=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],undefined,undefined,undefined,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];e.DATE=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?u.value:0>r||0>e||0>t?u.num:new Date(r,e-1,t)},e.DATEVALUE=function(r){if("string"!=typeof r)return u.value;var e=Date.parse(r);return isNaN(e)?u.value:e>-22038912e5?(e-s)/864e5+2:(e-s)/864e5+1},e.DAY=function(r){var e=a.parseDate(r);return e instanceof Error?e:e.getDate()},e.DAYS=function(r,e){return r=a.parseDate(r),e=a.parseDate(e),r instanceof Error?r:e instanceof Error?e:o(r)-o(e)},e.DAYS360=function(r,e,t){if(t=a.parseBool(t),r=a.parseDate(r),e=a.parseDate(e),r instanceof Error)return r;if(e instanceof Error)return e;if(t instanceof Error)return t;var n,i,o=r.getMonth(),u=e.getMonth();if(t)n=31===r.getDate()?30:r.getDate(),i=31===e.getDate()?30:e.getDate();else{var s=new Date(r.getFullYear(),o+1,0).getDate(),l=new Date(e.getFullYear(),u+1,0).getDate();n=r.getDate()===s?30:r.getDate(),e.getDate()===l?30>n?(u++,i=1):i=30:i=e.getDate()}return 360*(e.getFullYear()-r.getFullYear())+30*(u-o)+(i-n)},e.EDATE=function(r,e){return(r=a.parseDate(r))instanceof Error?r:isNaN(e)?u.value:(e=parseInt(e,10),r.setMonth(r.getMonth()+e),o(r))},e.EOMONTH=function(r,e){return(r=a.parseDate(r))instanceof Error?r:isNaN(e)?u.value:(e=parseInt(e,10),o(new Date(r.getFullYear(),r.getMonth()+e+1,0)))},e.HOUR=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getHours()},e.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return u.value;r=parseInt(r,10);var e=Math.floor(r/94608e4);r%=94608e4;var t=Math.floor(r/2592e3);r%=2592e3;var n=Math.floor(r/86400);r%=86400;var i=Math.floor(r/3600);r%=3600;var o=Math.floor(r/60);r%=60;var a=r;return e=e>0?e+"Y":"",t=t>0?t+"M":"",n=n>0?n+"D":"",i=i>0?i+"H":"",o=o>0?o+"M":"",a=a>0?a+"S":"","P"+e+t+n+"T"+i+o+a},e.ISOWEEKNUM=function(r){if((r=a.parseDate(r))instanceof Error)return r;r.setHours(0,0,0),r.setDate(r.getDate()+4-(r.getDay()||7));var e=new Date(r.getFullYear(),0,1);return Math.ceil(((r-e)/864e5+1)/7)},e.MINUTE=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getMinutes()},e.MONTH=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getMonth()+1},e.NETWORKDAYS=function(r,e,t){return this.NETWORKDAYS.INTL(r,e,1,t)},e.NETWORKDAYS.INTL=function(r,e,t,n){if((r=a.parseDate(r))instanceof Error)return r;if((e=a.parseDate(e))instanceof Error)return e;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return u.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var i=0;n.length>i;i++){var o=a.parseDate(n[i]);if(o instanceof Error)return o;n[i]=o}var s=(e-r)/864e5+1,l=s,f=r;for(i=0;s>i;i++){var d=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),p=!1;d!==t[0]&&d!==t[1]||(p=!0);for(var m=0;n.length>m;m++){var h=n[m];if(h.getDate()===f.getDate()&&h.getMonth()===f.getMonth()&&h.getFullYear()===f.getFullYear()){p=!0;break}}p&&l--,f.setDate(f.getDate()+1)}return l},e.NOW=function(){return new Date},e.SECOND=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getSeconds()},e.TIME=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?u.value:0>r||0>e||0>t?u.num:(3600*r+60*e+t)/86400},e.TIMEVALUE=function(r){return r=a.parseDate(r),r instanceof Error?r:(3600*r.getHours()+60*r.getMinutes()+r.getSeconds())/86400},e.TODAY=function(){return new Date},e.WEEKDAY=function(r,e){if((r=a.parseDate(r))instanceof Error)return r;e===undefined&&(e=1);var t=r.getDay();return f[e][t]},e.WEEKNUM=function(r,e){if((r=a.parseDate(r))instanceof Error)return r;if(e===undefined&&(e=1),21===e)return this.ISOWEEKNUM(r);var t=l[e],n=new Date(r.getFullYear(),0,1),i=n.getDay()e)return u.num;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return u.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var i=0;n.length>i;i++){var o=a.parseDate(n[i]);if(o instanceof Error)return o;n[i]=o}for(var s=0;e>s;){r.setDate(r.getDate()+1);var l=r.getDay();if(l!==t[0]&&l!==t[1]){for(var f=0;n.length>f;f++){var d=n[f];if(d.getDate()===r.getDate()&&d.getMonth()===r.getMonth()&&d.getFullYear()===r.getFullYear()){s--;break}}s++}}return r},e.YEAR=function(r){return r=a.parseDate(r),r instanceof Error?r:r.getFullYear()},e.YEARFRAC=function(r,e,t){if((r=a.parseDate(r))instanceof Error)return r;if((e=a.parseDate(e))instanceof Error)return e;t=t||0;var o=r.getDate(),u=r.getMonth()+1,s=r.getFullYear(),l=e.getDate(),f=e.getMonth()+1,c=e.getFullYear();switch(t){case 0:return 31===o&&31===l?(o=30,l=30):31===o?o=30:30===o&&31===l&&(l=30),(l+30*f+360*c-(o+30*u+360*s))/360;case 1:var d=365;if(s===c||s+1===c&&(u>f||u===f&&o>=l))return(s===c&&n(s)||function(r,e){var t=r.getFullYear(),i=new Date(t,2,1);if(n(t)&&i>r&&e>=i)return!0;var o=e.getFullYear(),u=new Date(o,2,1);return n(o)&&e>=u&&u>r}(r,e)||1===f&&29===l)&&(d=366),i(r,e)/d;var p=c-s+1,m=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,h=m/p;return i(r,e)/h;case 2:return i(r,e)/360;case 3:return i(r,e)/365;case 4:return(l+30*f+360*c-(o+30*u+360*s))/360}}},function(r,e,t){(function(n){var i,o;/*! * numbro.js * version : 1.11.0 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se */ -(function(){"use strict";function u(r){this._value=r}function a(r){return 0===r?1:Math.floor(Math.log(Math.abs(r))/Math.LN10)+1}function s(r){var e,t="";for(e=0;r>e;e++)t+="0";return t}function l(r,e){var t,n,i,o,u,a,l,f;return f=""+r,t=f.split("e")[0],o=f.split("e")[1],n=t.split(".")[0],i=t.split(".")[1]||"",+o>0?f=n+i+s(o-i.length):(u=0>+n?"-0":"0",e>0&&(u+="."),l=s(-1*o-1),a=(l+Math.abs(n)+i).substr(0,e),f=u+a),+o>0&&e>0&&(f+="."+s(e)),f}function f(r,e,t,n){var i,o,u=Math.pow(10,e);return(""+r).indexOf("e")>-1?(o=l(r,e),"-"!==o.charAt(0)||0>+o||(o=o.substr(1))):o=(t(r+"e+"+e)/u).toFixed(e),n&&(i=RegExp("0{1,"+n+"}$"),o=o.replace(i,"")),o}function c(r,e,t){var n=e.replace(/\{[^\{\}]*\}/g,"");return n.indexOf("$")>-1?m(r,C[$].currency.symbol,e,t):n.indexOf("%")>-1?h(r,e,t):n.indexOf(":")>-1?b(r):E(r._value,e,t)}function d(r,e){var t,n,i,o,u,a=e,s=!1;if(e.indexOf(":")>-1)r._value=v(e);else if(e===O)r._value=0;else{for("."!==C[$].delimiters.decimal&&(e=e.replace(/\./g,"").replace(C[$].delimiters.decimal,".")),t=RegExp("[^a-zA-Z]"+C[$].abbreviations.thousand+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),n=RegExp("[^a-zA-Z]"+C[$].abbreviations.million+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),i=RegExp("[^a-zA-Z]"+C[$].abbreviations.billion+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),o=RegExp("[^a-zA-Z]"+C[$].abbreviations.trillion+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),u=1;x.length>u&&!s;++u)e.indexOf(x[u])>-1?s=Math.pow(1024,u):e.indexOf(A[u])>-1&&(s=Math.pow(1e3,u));var l=e.replace(/[^0-9\.]+/g,"");""===l?r._value=NaN:(r._value=(s||1)*(a.match(t)?Math.pow(10,3):1)*(a.match(n)?Math.pow(10,6):1)*(a.match(i)?Math.pow(10,9):1)*(a.match(o)?Math.pow(10,12):1)*(e.indexOf("%")>-1?.01:1)*((e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1)*+l,r._value=s?Math.ceil(r._value):r._value)}return r._value}function m(r,e,t,n){var i,o,u=t,a=u.indexOf("$"),s=u.indexOf("("),l=u.indexOf("+"),f=u.indexOf("-"),c="",d="";if(-1===u.indexOf("$")?"infix"===C[$].currency.position?(d=e,C[$].currency.spaceSeparated&&(d=" "+d+" ")):C[$].currency.spaceSeparated&&(c=" "):u.indexOf(" $")>-1?(c=" ",u=u.replace(" $","")):u.indexOf("$ ")>-1?(c=" ",u=u.replace("$ ","")):u=u.replace("$",""),o=E(r._value,u,n,d),-1===t.indexOf("$"))switch(C[$].currency.position){case"postfix":o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,c+e),o=o.join("")):o=o+c+e;break;case"infix":break;case"prefix":o.indexOf("(")>-1||o.indexOf("-")>-1?(o=o.split(""),i=Math.max(s,f)+1,o.splice(i,0,e+c),o=o.join("")):o=e+c+o;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else a>1?o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,c+e),o=o.join("")):o=o+c+e:o.indexOf("(")>-1||o.indexOf("+")>-1||o.indexOf("-")>-1?(o=o.split(""),i=1,(s>a||l>a||f>a)&&(i=0),o.splice(i,0,e+c),o=o.join("")):o=e+c+o;return o}function p(r,e,t,n){return m(r,e,t,n)}function h(r,e,t){var n,i="",o=100*r._value;return e.indexOf(" %")>-1?(i=" ",e=e.replace(" %","")):e=e.replace("%",""),n=E(o,e,t),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,i+"%"),n=n.join("")):n=n+i+"%",n}function b(r){var e=Math.floor(r._value/60/60),t=Math.floor((r._value-60*e*60)/60),n=Math.round(r._value-60*e*60-60*t);return e+":"+(10>t?"0"+t:t)+":"+(10>n?"0"+n:n)}function v(r){var e=r.split(":"),t=0;return 3===e.length?(t+=60*+e[0]*60,t+=60*+e[1],t+=+e[2]):2===e.length&&(t+=60*+e[0],t+=+e[1]),+t}function g(r,e,t){var n,i,o,u=e[0],a=Math.abs(r);if(a>=t){for(n=1;e.length>n;++n)if(i=Math.pow(t,n),o=Math.pow(t,n+1),a>=i&&o>a){u=e[n],r/=i;break}u===e[0]&&(r/=Math.pow(t,e.length-1),u=e[e.length-1])}return{value:r,suffix:u}}function E(r,e,t,n){var i,o,u,l,c,d,m,p,h,b,v,E,N,y,w,I,M=!1,x=!1,A=!1,R="",S=!1,D=!1,V=!1,L=!1,_=!1,P="",U="",F=Math.abs(r),k="",B=!1,G=!1,j="";if(0===r&&null!==O)return O;if(!isFinite(r))return""+r;if(0===e.indexOf("{")){var W=e.indexOf("}");if(-1===W)throw Error('Format should also contain a "}"');b=e.slice(1,W),e=e.slice(W+1)}else b="";if(e.indexOf("}")===e.length-1&&e.length){var Y=e.indexOf("{");if(-1===Y)throw Error('Format should also contain a "{"');v=e.slice(Y+1,-1),e=e.slice(0,Y+1)}else v="";var H;for(H=e.match(-1===e.indexOf(".")?/([0-9]+).*/:/([0-9]+)\..*/),w=null===H?-1:H[1].length,-1!==e.indexOf("-")&&(B=!0),e.indexOf("(")>-1?(M=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(x=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1&&(p=e.split(".")[0].match(/[0-9]+/g)||["0"],p=parseInt(p[0],10),S=e.indexOf("aK")>=0,D=e.indexOf("aM")>=0,V=e.indexOf("aB")>=0,L=e.indexOf("aT")>=0,_=S||D||V||L,e.indexOf(" a")>-1?(R=" ",e=e.replace(" a","")):e=e.replace("a",""),u=a(r),c=u%3,c=0===c?3:c,p&&0!==F&&(d=3*~~((Math.min(p,u)-c)/3),F/=Math.pow(10,d)),u!==p&&(F>=Math.pow(10,12)&&!_||L?(R+=C[$].abbreviations.trillion,r/=Math.pow(10,12)):F=Math.pow(10,9)&&!_||V?(R+=C[$].abbreviations.billion,r/=Math.pow(10,9)):F=Math.pow(10,6)&&!_||D?(R+=C[$].abbreviations.million,r/=Math.pow(10,6)):(F=Math.pow(10,3)&&!_||S)&&(R+=C[$].abbreviations.thousand,r/=Math.pow(10,3))),l=a(r),p&&p>l&&-1===e.indexOf(".")&&(e+="[.]",e+=s(p-l))),I=0;T.length>I;++I)if(i=T[I],e.indexOf(i.marker)>-1){e.indexOf(" "+i.marker)>-1&&(P=" "),e=e.replace(P+i.marker,""),o=g(r,i.suffixes,i.scale),r=o.value,P+=o.suffix;break}if(e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(U=" ",e=e.replace(" o","")):e=e.replace("o",""),C[$].ordinal&&(U+=C[$].ordinal(r))),e.indexOf("[.]")>-1&&(A=!0,e=e.replace("[.]",".")),h=e.split(".")[1],E=e.indexOf(","),h){var q=[];if(-1!==h.indexOf("*")?(k=""+r,q=k.split("."),q.length>1&&(k=f(r,q[1].length,t))):h.indexOf("[")>-1?(h=h.replace("]",""),h=h.split("["),k=f(r,h[0].length+h[1].length,t,h[1].length)):k=f(r,h.length,t),q=k.split("."),m=q[0],q.length>1&&q[1].length){k=(n?R+n:C[$].delimiters.decimal)+q[1]}else k="";A&&0==+k.slice(1)&&(k="")}else m=f(r,0,t);return m.indexOf("-")>-1&&(m=m.slice(1),G=!0),w>m.length&&(m=s(w-m.length)+m),E>-1&&(m=(""+m).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+C[$].delimiters.thousands)),0===e.indexOf(".")&&(m=""),N=e.indexOf("("),y=e.indexOf("-"),j=y>N?(M&&G?"(":"")+(B&&G||!M&&G?"-":""):(B&&G||!M&&G?"-":"")+(M&&G?"(":""),b+j+(!G&&x&&0!==r?"+":"")+m+k+(U||"")+(R&&!n?R:"")+(P||"")+(M&&G?")":"")+v}function N(r,e){C[r]=e}function y(r){$=r;var e=C[r].defaults;e&&e.format&&M.defaultFormat(e.format),e&&e.currencyFormat&&M.defaultCurrencyFormat(e.currencyFormat)}function w(r){var e=(""+r).split(".");return 2>e.length?1:Math.pow(10,e[1].length)}function I(){return Array.prototype.slice.call(arguments).reduce(function(r,e){var t=w(r),n=w(e);return t>n?t:n},-Infinity)}var M,x=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],A=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],R={general:{scale:1024,suffixes:A,marker:"bd"},binary:{scale:1024,suffixes:x,marker:"b"},decimal:{scale:1e3,suffixes:A,marker:"d"}},T=[R.general,R.binary,R.decimal],C={},S=C,$="en-US",O=null,D="0,0",V="0$",L=void 0!==r&&r.exports,_={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(r){var e=r%10;return 1==~~(r%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$",position:"prefix"},defaults:{currencyFormat:",0000 a"},formats:{fourDigits:"0000 a",fullWithTwoDecimals:"$ ,0.00",fullWithTwoDecimalsNoCurrency:",0.00"}};M=function(r){return r=M.isNumbro(r)?r.value():"string"==typeof r||"number"==typeof r?M.fn.unformat(r):NaN,new u(+r)},M.version="1.11.0",M.isNumbro=function(r){return r instanceof u},M.setLanguage=function(r,e){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var t=r,n=r.split("-")[0],i=null;S[t]||(Object.keys(S).forEach(function(r){i||r.split("-")[0]!==n||(i=r)}),t=i||e||"en-US"),y(t)},M.setCulture=function(r,e){var t=r,n=r.split("-")[1],i=null;C[t]||(n&&Object.keys(C).forEach(function(r){i||r.split("-")[1]!==n||(i=r)}),t=i||e||"en-US"),y(t)},M.language=function(r,e){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!r)return $;if(r&&!e){if(!S[r])throw Error("Unknown language : "+r);y(r)}return!e&&S[r]||N(r,e),M},M.culture=function(r,e){if(!r)return $;if(r&&!e){if(!C[r])throw Error("Unknown culture : "+r);y(r)}return!e&&C[r]||N(r,e),M},M.languageData=function(r){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!r)return S[$];if(!S[r])throw Error("Unknown language : "+r);return S[r]},M.cultureData=function(r){if(!r)return C[$];if(!C[r])throw Error("Unknown culture : "+r);return C[r]},M.culture("en-US",_),M.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),S},M.cultures=function(){return C},M.zeroFormat=function(r){O="string"==typeof r?r:null},M.defaultFormat=function(r){D="string"==typeof r?r:"0.0"},M.defaultCurrencyFormat=function(r){V="string"==typeof r?r:"0$"},M.validate=function(r,e){var t,n,i,o,u,a,s,l;if("string"!=typeof r&&(r+="",console.warn&&console.warn("Numbro.js: Value is not string. It has been co-erced to: ",r)),r=r.trim(),r=r.replace(/^[+-]?/,""),r.match(/^\d+$/))return!0;if(""===r)return!1;try{s=M.cultureData(e)}catch(f){s=M.cultureData(M.culture())}return i=s.currency.symbol,u=s.abbreviations,t=s.delimiters.decimal,n="."===s.delimiters.thousands?"\\.":s.delimiters.thousands,(null===(l=r.match(/^[^\d\.\,]+/))||(r=r.substr(1),l[0]===i))&&((null===(l=r.match(/[^\d]+$/))||(r=r.slice(0,-1),l[0]===u.thousand||l[0]===u.million||l[0]===u.billion||l[0]===u.trillion))&&(a=RegExp(n+"{2}"),!r.match(/[^\d.,]/g)&&(o=r.split(t),2>=o.length&&(2>o.length?!!o[0].match(/^\d+.*\d$/)&&!o[0].match(a):""===o[0]?!o[0].match(a)&&!!o[1].match(/^\d+$/):1===o[0].length?!!o[0].match(/^\d+$/)&&!o[0].match(a)&&!!o[1].match(/^\d+$/):!!o[0].match(/^\d+.*\d$/)&&!o[0].match(a)&&!!o[1].match(/^\d+$/)))))},M.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),M.loadCulturesInNode()},M.loadCulturesInNode=function(){var r=t(27);for(var e in r)e&&M.culture(e,r[e])},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(r,e){if(null===this||void 0===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof r)throw new TypeError(r+" is not a function");var t,n,i=this.length>>>0,o=!1;for(arguments.length>1&&(n=e,o=!0),t=0;i>t;++t)this.hasOwnProperty(t)&&(o?n=r(n,this[t],t,this):(n=this[t],o=!0));if(!o)throw new TypeError("Reduce of empty array with no initial value");return n}),M.fn=u.prototype={clone:function(){return M(this)},format:function(r,e){return c(this,r||D,e!==undefined?e:Math.round)},formatCurrency:function(r,e){return m(this,C[$].currency.symbol,r||V,e!==undefined?e:Math.round)},formatForeignCurrency:function(r,e,t){return p(this,r,e||V,t!==undefined?t:Math.round)},unformat:function(r){if("number"==typeof r)return r;if("string"==typeof r){var e=d(this,r);return isNaN(e)?undefined:e}return undefined},binaryByteUnits:function(){return g(this._value,R.binary.suffixes,R.binary.scale).suffix},byteUnits:function(){return g(this._value,R.general.suffixes,R.general.scale).suffix},decimalByteUnits:function(){return g(this._value,R.decimal.suffixes,R.decimal.scale).suffix},value:function(){return this._value},valueOf:function(){return this._value},set:function(r){return this._value=+r,this},add:function(r){function e(r,e){return r+t*e}var t=I.call(null,this._value,r);return this._value=[this._value,r].reduce(e,0)/t,this},subtract:function(r){function e(r,e){return r-t*e}var t=I.call(null,this._value,r);return this._value=[r].reduce(e,this._value*t)/t,this},multiply:function(r){function e(r,e){var t=I(r,e),n=r*t;return n*=e*t,n/=t*t}return this._value=[this._value,r].reduce(e,1),this},divide:function(r){function e(r,e){var t=I(r,e);return r*t/(e*t)}return this._value=[this._value,r].reduce(e),this},difference:function(r){return Math.abs(M(this._value).subtract(r).value())}},function(){return void 0!==n&&n.browser===undefined&&n.title&&(-1!==n.title.indexOf("node")||n.title.indexOf("meteor-tool")>0||"grunt"===n.title||"gulp"===n.title)&&!0}()&&M.loadCulturesInNode(),L?r.exports=M:("undefined"==typeof ender&&(this.numbro=M),i=[],(o=function(){return M}.apply(e,i))!==undefined&&(r.exports=o))}).call("undefined"==typeof window?this:window)}).call(e,t(10))},function(r,e){function t(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function i(r){if(f===setTimeout)return setTimeout(r,0);if((f===t||!f)&&setTimeout)return f=setTimeout,setTimeout(r,0);try{return f(r,0)}catch(e){try{return f.call(null,r,0)}catch(e){return f.call(this,r,0)}}}function o(r){if(c===clearTimeout)return clearTimeout(r);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(r);try{return c(r)}catch(e){try{return c.call(null,r)}catch(e){return c.call(this,r)}}}function u(){h&&m&&(h=!1,m.length?p=m.concat(p):b=-1,p.length&&a())}function a(){if(!h){var r=i(u);h=!0;for(var e=p.length;e;){for(m=p,p=[];++b1)for(var t=1;arguments.length>t;t++)e[t-1]=arguments[t];p.push(new s(r,e)),1!==p.length||h||i(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.binding=function(r){throw Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(r){throw Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,n){!function(r,t){e.exports=t()}(0,function(){var e=function(r,e){function t(e,t){var n=e>t?e:t;return r.pow(10,17-~~(r.log(n>0?n:-n)*r.LOG10E))}function n(r){return"[object Function]"===m.call(r)}function o(r){return"number"==typeof r&&r===r}function u(r){return c.apply([],r)}function a(){return new a._init(arguments)}function s(){return 0}function l(){return 1}function f(r,e){return r===e?1:0}var c=Array.prototype.concat,d=Array.prototype.slice,m=Object.prototype.toString,p=Array.isArray||function(r){return"[object Array]"===m.call(r)};a.fn=a.prototype,a._init=function(r){var e;if(p(r[0]))if(p(r[0][0])){n(r[1])&&(r[0]=a.map(r[0],r[1]));for(var e=0;r[0].length>e;e++)this[e]=r[0][e];this.length=r[0].length}else this[0]=n(r[1])?a.map(r[0],r[1]):r[0],this.length=1;else if(o(r[0]))this[0]=a.seq.apply(null,r),this.length=1;else{if(r[0]instanceof a)return a(r[0].toArray());this[0]=[],this.length=1}return this},a._init.prototype=a.prototype,a._init.constructor=a,a.utils={calcRdx:t,isArray:p,isFunction:n,isNumber:o,toVector:u},a.extend=function(r){var e,t;if(1===arguments.length){for(t in r)a[t]=r[t];return this}for(var e=1;arguments.length>e;e++)for(t in arguments[e])r[t]=arguments[e][t];return r},a.rows=function(r){return r.length||1},a.cols=function(r){return r[0].length||1},a.dimensions=function(r){return{rows:a.rows(r),cols:a.cols(r)}},a.row=function(r,e){return p(e)?e.map(function(e){return a.row(r,e)}):r[e]},a.rowa=function(r,e){return a.row(r,e)},a.col=function(r,e){if(p(e)){var t=a.arange(r.length).map(function(r){return Array(e.length)});return e.forEach(function(e,n){a.arange(r.length).forEach(function(i){t[i][n]=r[i][e]})}),t}for(var n=Array(r.length),i=0;r.length>i;i++)n[i]=[r[i][e]];return n},a.cola=function(r,e){return a.col(r,e).map(function(r){return r[0]})},a.diag=function(r){for(var e=a.rows(r),t=Array(e),n=0;e>n;n++)t[n]=[r[n][n]];return t},a.antidiag=function(r){for(var e=a.rows(r)-1,t=Array(e),n=0;e>=0;e--,n++)t[n]=[r[n][e]];return t},a.transpose=function(r){var e,t,n,i,o,u=[];p(r[0])||(r=[r]),t=r.length,n=r[0].length;for(var o=0;n>o;o++){for(e=Array(t),i=0;t>i;i++)e[i]=r[i][o];u.push(e)}return 1===u.length?u[0]:u},a.map=function(r,e,t){var n,i,o,u,a;for(p(r[0])||(r=[r]),i=r.length,o=r[0].length,u=t?r:Array(i),n=0;i>n;n++)for(u[n]||(u[n]=Array(o)),a=0;o>a;a++)u[n][a]=e(r[n][a],n,a);return 1===u.length?u[0]:u},a.cumreduce=function(r,e,t){var n,i,o,u,a;for(p(r[0])||(r=[r]),i=r.length,o=r[0].length,u=t?r:Array(i),n=0;i>n;n++)for(u[n]||(u[n]=Array(o)),o>0&&(u[n][0]=r[n][0]),a=1;o>a;a++)u[n][a]=e(u[n][a-1],r[n][a]);return 1===u.length?u[0]:u},a.alter=function(r,e){return a.map(r,e,!0)},a.create=function(r,e,t){var i,o,u=Array(r);n(e)&&(t=e,e=r);for(var i=0;r>i;i++)for(u[i]=Array(e),o=0;e>o;o++)u[i][o]=t(i,o);return u},a.zeros=function(r,e){return o(e)||(e=r),a.create(r,e,s)},a.ones=function(r,e){return o(e)||(e=r),a.create(r,e,l)},a.rand=function(e,t){return o(t)||(t=e),a.create(e,t,r.random)},a.identity=function(r,e){return o(e)||(e=r),a.create(r,e,f)},a.symmetric=function(r){var e,t,n=r.length;if(r.length!==r[0].length)return!1;for(e=0;n>e;e++)for(t=0;n>t;t++)if(r[t][e]!==r[e][t])return!1;return!0},a.clear=function(r){return a.alter(r,s)},a.seq=function(r,e,i,o){n(o)||(o=!1);var u,a=[],s=t(r,e),l=(e*s-r*s)/((i-1)*s),f=r;for(u=0;e>=f&&i>u;u++,f=(r*s+l*s*u)/s)a.push(o?o(f,u):f);return a},a.arange=function(r,t,n){var o=[];if(n=n||1,t===e&&(t=r,r=0),r===t||0===n)return[];if(t>r&&0>n)return[];if(r>t&&n>0)return[];if(n>0)for(i=r;it;i+=n)o.push(i);return o},a.slice=function(){function r(r,t,n,i){var o,u=[],s=r.length;if(t===e&&n===e&&i===e)return a.copy(r);if(t=t||0,n=n||r.length,t=0>t?s+t:t,n=0>n?s+n:n,i=i||1,t===n||0===i)return[];if(n>t&&0>i)return[];if(t>n&&i>0)return[];if(i>0)for(o=t;n>o;o+=i)u.push(r[o]);else for(o=t;o>n;o+=i)u.push(r[o]);return u}function t(e,t){if(t=t||{},o(t.row)){if(o(t.col))return e[t.row][t.col];var n=a.rowa(e,t.row),i=t.col||{};return r(n,i.start,i.end,i.step)}if(o(t.col)){var u=a.cola(e,t.col),s=t.row||{};return r(u,s.start,s.end,s.step)}var s=t.row||{},i=t.col||{};return r(e,s.start,s.end,s.step).map(function(e){return r(e,i.start,i.end,i.step)})}return t}(),a.sliceAssign=function(t,n,i){if(o(n.row)){if(o(n.col))return t[n.row][n.col]=i;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||t[0].length,n.col.step=n.col.step||1;var u=a.arange(n.col.start,r.min(t.length,n.col.end),n.col.step),s=n.row;return u.forEach(function(r,e){t[s][r]=i[e]}),t}if(o(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||t.length,n.row.step=n.row.step||1;var l=a.arange(n.row.start,r.min(t[0].length,n.row.end),n.row.step),f=n.col;return l.forEach(function(r,e){t[r][f]=i[e]}),t}i[0].length===e&&(i=[i]),n.row.start=n.row.start||0,n.row.end=n.row.end||t.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||t[0].length,n.col.step=n.col.step||1;var l=a.arange(n.row.start,r.min(t.length,n.row.end),n.row.step),u=a.arange(n.col.start,r.min(t[0].length,n.col.end),n.col.step);return l.forEach(function(r,e){u.forEach(function(n,o){t[r][n]=i[e][o]})}),t},a.diagonal=function(r){var e=a.zeros(r.length,r.length);return r.forEach(function(r,t){e[t][t]=r}),e},a.copy=function(r){return r.map(function(r){return o(r)?r:r.map(function(r){return r})})};var h=a.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?d.call(this):d.call(this)[0]},h.map=function(r,e){return a(a.map(this,r,e))},h.cumreduce=function(r,e){return a(a.cumreduce(this,r,e))},h.alter=function(r){return a.alter(this,r),this},function(r){for(var e=0;r.length>e;e++)!function(r){h[r]=function(e){var t,n=this;return e?(setTimeout(function(){e.call(n,h[r].call(n))}),this):(t=a[r](this),p(t)?a(t):t)}}(r[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){h[r]=function(e,t){var n=this;return t?(setTimeout(function(){t.call(n,h[r].call(n,e))}),this):a(a[r](this,e))}}(r[e])}("row col".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){h[r]=Function("return jStat(jStat."+r+".apply(null, arguments));")}(r[e])}("create zeros ones rand identity".split(" ")),a}(Math);return function(r,e){function t(r,e){return r-e}function n(r,t,n){return e.max(t,e.min(r,n))}var i=r.utils.isFunction;r.sum=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},r.sumsqrd=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t]*r[t];return e},r.sumsqerr=function(e){for(var t,n=r.mean(e),i=0,o=e.length;--o>=0;)t=e[o]-n,i+=t*t;return i},r.sumrow=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},r.product=function(r){for(var e=1,t=r.length;--t>=0;)e*=r[t];return e},r.min=function(r){for(var e=r[0],t=0;++tr[t]&&(e=r[t]);return e},r.max=function(r){for(var e=r[0],t=0;++te&&(e=r[t]);return e},r.unique=function(r){for(var e={},t=[],n=0;r.length>n;n++)e[r[n]]||(e[r[n]]=!0,t.push(r[n]));return t},r.mean=function(e){return r.sum(e)/e.length},r.meansqerr=function(e){return r.sumsqerr(e)/e.length},r.geomean=function(t){return e.pow(r.product(t),1/t.length)},r.median=function(r){var e=r.length,n=r.slice().sort(t);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},r.cumsum=function(e){return r.cumreduce(e,function(r,e){return r+e})},r.cumprod=function(e){return r.cumreduce(e,function(r,e){return r*e})},r.diff=function(r){for(var e,t=[],n=r.length,e=1;n>e;e++)t.push(r[e]-r[e-1]);return t},r.rank=function(r){for(var e=r.length,n=r.slice().sort(t),i=Array(e),o=0;e>o;o++){var u=n.indexOf(r[o]),a=n.lastIndexOf(r[o]);if(u===a)var s=u;else var s=(u+a)/2;i[o]=s+1}return i},r.mode=function(r){for(var e,n=r.length,i=r.slice().sort(t),o=1,u=0,a=0,s=[],e=0;n>e;e++)i[e]===i[e+1]?o++:(o>u?(s=[i[e]],u=o,a=0):o===u&&(s.push(i[e]),a++),o=1);return 0===a?s[0]:s},r.range=function(e){return r.max(e)-r.min(e)},r.variance=function(e,t){return r.sumsqerr(e)/(e.length-(t?1:0))},r.pooledvariance=function(e){return e.reduce(function(e,t){return e+r.sumsqerr(t)},0)/(e.reduce(function(r,e){return r+e.length},0)-e.length)},r.deviation=function(e){for(var t=r.mean(e),n=e.length,i=Array(n),o=0;n>o;o++)i[o]=e[o]-t;return i},r.stdev=function(t,n){return e.sqrt(r.variance(t,n))},r.pooledstdev=function(t){return e.sqrt(r.pooledvariance(t))},r.meandev=function(t){for(var n=r.mean(t),i=[],o=t.length-1;o>=0;o--)i.push(e.abs(t[o]-n));return r.mean(i)},r.meddev=function(t){for(var n=r.median(t),i=[],o=t.length-1;o>=0;o--)i.push(e.abs(t[o]-n));return r.median(i)},r.coeffvar=function(e){return r.stdev(e)/r.mean(e)},r.quartiles=function(r){var n=r.length,i=r.slice().sort(t);return[i[e.round(n/4)-1],i[e.round(n/2)-1],i[e.round(3*n/4)-1]]},r.quantiles=function(r,i,o,u){var a,s,l,f,c,d,m=r.slice().sort(t),p=[i.length],h=r.length;void 0===o&&(o=3/8),void 0===u&&(u=3/8);for(var a=0;i.length>a;a++)s=i[a],l=o+s*(1-o-u),f=h*s+l,c=e.floor(n(f,1,h-1)),d=n(f-c,0,1),p[a]=(1-d)*m[c-1]+d*m[c];return p},r.percentile=function(r,e){var n=r.slice().sort(t),i=e*(n.length-1),o=parseInt(i),u=i-o;return n.length>o+1?n[o]*(1-u)+n[o+1]*u:n[o]},r.percentileOfScore=function(r,e,t){var n,i,o=0,u=r.length,a=!1;"strict"===t&&(a=!0);for(var i=0;u>i;i++)n=r[i],(a&&e>n||!a&&e>=n)&&o++;return o/u},r.histogram=function(t,n){for(var i,o=r.min(t),u=n||4,a=(r.max(t)-o)/u,s=t.length,n=[],i=0;u>i;i++)n[i]=0;for(var i=0;s>i;i++)n[e.min(e.floor((t[i]-o)/a),u-1)]+=1;return n},r.covariance=function(e,t){for(var n,i=r.mean(e),o=r.mean(t),u=e.length,a=Array(u),n=0;u>n;n++)a[n]=(e[n]-i)*(t[n]-o);return r.sum(a)/(u-1)},r.corrcoeff=function(e,t){return r.covariance(e,t)/r.stdev(e,1)/r.stdev(t,1)},r.spearmancoeff=function(e,t){return e=r.rank(e),t=r.rank(t),r.corrcoeff(e,t)},r.stanMoment=function(t,n){for(var i=r.mean(t),o=r.stdev(t),u=t.length,a=0,s=0;u>s;s++)a+=e.pow((t[s]-i)/o,n);return a/t.length},r.skewness=function(e){return r.stanMoment(e,3)},r.kurtosis=function(e){return r.stanMoment(e,4)-3};var o=r.prototype;!function(e){for(var t=0;e.length>t;t++)!function(e){o[e]=function(t,n){var u=[],a=0,s=this;if(i(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,o[e].call(s,t))}),this;if(this.length>1){for(s=!0===t?this:this.transpose();s.length>a;a++)u[a]=r[e](s[a]);return u}return r[e](this[0],t)}}(e[t])}("cumsum cumprod".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){o[e]=function(t,n){var u=[],a=0,s=this;if(i(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,o[e].call(s,t))}),this;if(this.length>1){for("sumrow"!==e&&(s=!0===t?this:this.transpose());s.length>a;a++)u[a]=r[e](s[a]);return!0===t?r[e](r.utils.toVector(u)):u}return r[e](this[0],t)}}(e[t])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){o[e]=function(){var t=[],n=0,u=this,a=Array.prototype.slice.call(arguments);if(i(a[a.length-1])){var s=a[a.length-1],l=a.slice(0,a.length-1);return setTimeout(function(){s.call(u,o[e].apply(u,l))}),this}var s=undefined,f=function(t){return r[e].apply(u,[t].concat(a))};if(this.length>1){for(u=u.transpose();u.length>n;n++)t[n]=f(u[n]);return t}return f(this[0])}}(e[t])}("quantiles percentileOfScore".split(" "))}(e,Math),function(r,e){r.gammaln=function(r){var t,n,i,o=0,u=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(i=(n=t=r)+5.5,i-=(t+.5)*e.log(i);6>o;o++)a+=u[o]/++n;return e.log(2.5066282746310007*a/t)-i},r.gammafn=function(r){var t,n,i,o,u=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,d=r;if(0>=d){if(!(o=d%1+3.6e-16))return Infinity;s=(1&d?-1:1)*e.PI/e.sin(e.PI*o),d=1-d}i=d,n=1>d?d++:(d-=l=(0|d)-1)-1;for(var t=0;8>t;++t)c=(c+u[t])*n,f=f*n+a[t];if(o=c/f+1,d>i)o/=i;else if(i>d)for(var t=0;l>t;++t)o*=d,d++;return s&&(o=s/o),o},r.gammap=function(e,t){return r.lowRegGamma(e,t)*r.gammafn(e)},r.lowRegGamma=function(t,n){var i,o=r.gammaln(t),u=t,a=1/t,s=a,l=n+1-t,f=1/1e-30,c=1/l,d=c,m=1,p=-~(8.5*e.log(1>t?1/t:t)+.4*t+17);if(0>n||0>=t)return NaN;if(t+1>n){for(;p>=m;m++)a+=s*=n/++u;return a*e.exp(-n+t*e.log(n)-o)}for(;p>=m;m++)i=-m*(m-t),l+=2,c=i*c+l,f=l+i/f,c=1/c,d*=c*f;return 1-d*e.exp(-n+t*e.log(n)-o)},r.factorialln=function(e){return 0>e?NaN:r.gammaln(e+1)},r.factorial=function(e){return 0>e?NaN:r.gammafn(e+1)},r.combination=function(t,n){return t>170||n>170?e.exp(r.combinationln(t,n)):r.factorial(t)/r.factorial(n)/r.factorial(t-n)},r.combinationln=function(e,t){return r.factorialln(e)-r.factorialln(t)-r.factorialln(e-t)},r.permutation=function(e,t){return r.factorial(e)/r.factorial(e-t)},r.betafn=function(t,n){return t>0&&n>0?t+n>170?e.exp(r.betaln(t,n)):r.gammafn(t)*r.gammafn(n)/r.gammafn(t+n):undefined},r.betaln=function(e,t){return r.gammaln(e)+r.gammaln(t)-r.gammaln(e+t)},r.betacf=function(r,t,n){var i,o,u,a,s=1,l=t+n,f=t+1,c=t-1,d=1,m=1-l*r/f;for(1e-30>e.abs(m)&&(m=1e-30),m=1/m,a=m;100>=s&&(i=2*s,o=s*(n-s)*r/((c+i)*(t+i)),m=1+o*m,1e-30>e.abs(m)&&(m=1e-30),d=1+o/d,1e-30>e.abs(d)&&(d=1e-30),m=1/m,a*=m*d,o=-(t+s)*(l+s)*r/((t+i)*(f+i)),m=1+o*m,1e-30>e.abs(m)&&(m=1e-30),d=1+o/d,1e-30>e.abs(d)&&(d=1e-30),m=1/m,u=m*d,a*=u,3e-7<=e.abs(u-1));s++);return a},r.gammapinv=function(t,n){var i,o,u,a,s,l,f,c=0,d=n-1,m=r.gammaln(n);if(t>=1)return e.max(100,n+100*e.sqrt(n));if(0>=t)return 0;for(n>1?(l=e.log(d),f=e.exp(d*(l-1)-m),s=.5>t?t:1-t,u=e.sqrt(-2*e.log(s)),i=(2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u,.5>t&&(i=-i),i=e.max(.001,n*e.pow(1-1/(9*n)-i/(3*e.sqrt(n)),3))):(u=1-n*(.253+.12*n),i=u>t?e.pow(t/u,1/n):1-e.log(1-(t-u)/(1-u)));12>c;c++){if(0>=i)return 0;if(o=r.lowRegGamma(n,i)-t,u=n>1?f*e.exp(-(i-d)+d*(e.log(i)-l)):e.exp(-i+d*e.log(i)-m),a=o/u,i-=u=a/(1-.5*e.min(1,a*((n-1)/i-1))),i>0||(i=.5*(i+u)),e.abs(u)<1e-8*i)break}return i},r.erf=function(r){var t,n,i,o,u=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,3.81e-16,7.106e-15,-1.523e-15,-9.4e-17,1.21e-16,-2.8e-17],a=27,s=!1,l=0,f=0;for(0>r&&(r=-r,s=!0),t=2/(2+r),n=4*t-2;a>0;a--)i=l,l=n*l-f+u[a],f=i;return o=t*e.exp(-r*r+.5*(u[0]+n*l)-f),s?o-1:1-o},r.erfc=function(e){return 1-r.erf(e)},r.erfcinv=function(t){var n,i,o,u,a=0;if(t>=2)return-100;if(0>=t)return 100;for(u=1>t?t:2-t,o=e.sqrt(-2*e.log(u/2)),n=-.70711*((2.30753+.27061*o)/(1+o*(.99229+.04481*o))-o);2>a;a++)i=r.erfc(n)-u,n+=i/(1.1283791670955126*e.exp(-n*n)-n*i);return 1>t?n:-n},r.ibetainv=function(t,n,i){var o,u,a,s,l,f,c,d,m,p,h,b=n-1,v=i-1,g=0;if(0>=t)return 0;if(t>=1)return 1;for(1>n||1>i?(o=e.log(n/(n+i)),u=e.log(i/(n+i)),s=e.exp(n*o)/n,l=e.exp(i*u)/i,p=s+l,c=s/p>t?e.pow(n*p*t,1/n):1-e.pow(i*p*(1-t),1/i)):(a=.5>t?t:1-t,s=e.sqrt(-2*e.log(a)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,.5>t&&(c=-c),d=(c*c-3)/6,m=2/(1/(2*n-1)+1/(2*i-1)),p=c*e.sqrt(d+m)/m-(1/(2*i-1)-1/(2*n-1))*(d+5/6-2/(3*m)),c=n/(n+i*e.exp(2*p))),h=-r.gammaln(n)-r.gammaln(i)+r.gammaln(n+i);10>g;g++){if(0===c||1===c)return c;if(f=r.ibeta(c,n,i)-t,s=e.exp(b*e.log(c)+v*e.log(1-c)+h),l=f/s,c-=s=l/(1-.5*e.min(1,l*(b/c-v/(1-c)))),c>0||(c=.5*(c+s)),1>c||(c=.5*(c+s+1)),e.abs(s)<1e-8*c&&g>0)break}return c},r.ibeta=function(t,n,i){var o=0===t||1===t?0:e.exp(r.gammaln(n+i)-r.gammaln(n)-r.gammaln(i)+n*e.log(t)+i*e.log(1-t));return t>=0&&1>=t&&((n+1)/(n+i+2)>t?o*r.betacf(t,n,i)/n:1-o*r.betacf(1-t,i,n)/i)},r.randn=function(t,n){var i,o,u,a,s;if(n||(n=t),t)return r.create(t,n,function(){return r.randn()});do{i=e.random(),o=1.7156*(e.random()-.5),u=i-.449871,a=e.abs(o)+.386595,s=u*u+a*(.196*a-.25472*u)}while(s>.27597&&(s>.27846||o*o>-4*e.log(i)*i*i));return o/i},r.randg=function(t,n,i){var o,u,a,s,l,f,c=t;if(i||(i=n),t||(t=1),n)return f=r.zeros(n,i),f.alter(function(){return r.randg(t)}),f;1>t&&(t+=1),o=t-1/3,u=1/e.sqrt(9*o);do{do{l=r.randn(),s=1+u*l}while(0>=s);s*=s*s,a=e.random()}while(a>1-.331*e.pow(l,4)&&e.log(a)>.5*l*l+o*(1-s+e.log(s)));if(t==c)return o*s;do{a=e.random()}while(0===a);return e.pow(a,1/c)*o*s},function(e){for(var t=0;e.length>t;t++)!function(e){r.fn[e]=function(){return r(r.map(this,function(t){return r[e](t)}))}}(e[t])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){r.fn[e]=function(){return r(r[e].apply(null,arguments))}}(e[t])}("randn".split(" "))}(e,Math),function(r,e){function t(r){return r/e.abs(r)}function n(t,n,i){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],u=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*t;if(a>=8)return 1;var s=2*r.normal.cdf(a,0,1,1,0)-1;s=s3?2:3;for(var f=a,c=(8-a)/l,d=f+c,m=0,p=i-1,h=1;l>=h;h++){for(var b=0,v=.5*(d+f),g=.5*(d-f),E=1;12>=E;E++){var N,y;E>6?(N=12-E+1,y=o[N-1]):(N=E,y=-o[N-1]);var w=g*y,I=v+w,M=I*I;if(M>60)break;var x=2*r.normal.cdf(I,0,1,1,0),A=2*r.normal.cdf(I,t,1,1,0),R=.5*x-.5*A;Re.exp(-30/n)?(s=e.pow(s,n),1>s?s:1):0}function i(r,t,n){var i=.5-.5*r,o=e.sqrt(e.log(1/(i*i))),u=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);120>n&&(u+=(u*u*u+u)/n/4);var a=.8832-.2368*u;return 120>n&&(a+=-1.214/n+1.208*u/n),u*(a*e.log(t-1)+1.4142)}!function(e){for(var t=0;e.length>t;t++)!function(e){r[e]=function(r,e,t){return this instanceof arguments.callee?(this._a=r,this._b=e,this._c=t,this):new arguments.callee(r,e,t)},r.fn[e]=function(t,n,i){var o=r[e](t,n,i);return o.data=this,o},r[e].prototype.sample=function(t){var n=this._a,i=this._b,o=this._c;return t?r.alter(t,function(){return r[e].sample(n,i,o)}):r[e].sample(n,i,o)},function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(n){var i=this._a,o=this._b,u=this._c;return n||0===n||(n=this.data),"number"!=typeof n?r.fn.map.call(n,function(n){return r[e][t](n,i,o,u)}):r[e][t](n,i,o,u)}}(t[n])}("pdf cdf inv".split(" ")),function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(){return r[e][t](this._a,this._b,this._c)}}(t[n])}("mean median mode variance".split(" "))}(e[t])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),r.extend(r.beta,{pdf:function(t,n,i){return t>1||0>t?0:1==n&&1==i?1:512>n&&512>i?e.pow(t,n-1)*e.pow(1-t,i-1)/r.betafn(n,i):e.exp((n-1)*e.log(t)+(i-1)*e.log(1-t)-r.betaln(n,i))},cdf:function(e,t,n){return e>1||0>e?1*(e>1):r.ibeta(e,t,n)},inv:function(e,t,n){return r.ibetainv(e,t,n)},mean:function(r,e){return r/(r+e)},median:function(e,t){return r.ibetainv(.5,e,t)},mode:function(r,e){return(r-1)/(r+e-2)},sample:function(e,t){var n=r.randg(e);return n/(n+r.randg(t))},variance:function(r,t){return r*t/(e.pow(r+t,2)*(r+t+1))}}),r.extend(r.centralF,{pdf:function(t,n,i){var o,u;return 0>t?0:n>2?(o=n*t/(i+t*n),u=i/(i+t*n),n*u/2*r.binomial.pdf((n-2)/2,(n+i-2)/2,o)):0===t&&2>n?Infinity:0===t&&2===n?1:1/r.betafn(n/2,i/2)*e.pow(n/i,n/2)*e.pow(t,n/2-1)*e.pow(1+n/i*t,-(n+i)/2)},cdf:function(e,t,n){return 0>e?0:r.ibeta(t*e/(t*e+n),t/2,n/2)},inv:function(e,t,n){return n/(t*(1/r.ibetainv(e,t/2,n/2)-1))},mean:function(r,e){return e>2?e/(e-2):undefined},mode:function(r,e){return r>2?e*(r-2)/(r*(e+2)):undefined},sample:function(e,t){return 2*r.randg(e/2)/e/(2*r.randg(t/2)/t)},variance:function(r,e){return e>4?2*e*e*(r+e-2)/(r*(e-2)*(e-2)*(e-4)):undefined}}),r.extend(r.cauchy,{pdf:function(r,t,n){return 0>n?0:n/(e.pow(r-t,2)+e.pow(n,2))/e.PI},cdf:function(r,t,n){return e.atan((r-t)/n)/e.PI+.5},inv:function(r,t,n){return t+n*e.tan(e.PI*(r-.5))},median:function(r,e){return r},mode:function(r,e){return r},sample:function(t,n){return r.randn()*e.sqrt(1/(2*r.randg(.5)))*n+t}}),r.extend(r.chisquare,{pdf:function(t,n){return 0>t?0:0===t&&2===n?.5:e.exp((n/2-1)*e.log(t)-t/2-n/2*e.log(2)-r.gammaln(n/2))},cdf:function(e,t){return 0>e?0:r.lowRegGamma(t/2,e/2)},inv:function(e,t){return 2*r.gammapinv(e,.5*t)},mean:function(r){return r},median:function(r){return r*e.pow(1-2/(9*r),3)},mode:function(r){return r-2>0?r-2:0},sample:function(e){return 2*r.randg(e/2)},variance:function(r){return 2*r}}),r.extend(r.exponential,{pdf:function(r,t){return 0>r?0:t*e.exp(-t*r)},cdf:function(r,t){return 0>r?0:1-e.exp(-t*r)},inv:function(r,t){return-e.log(1-r)/t},mean:function(r){return 1/r},median:function(r){return 1/r*e.log(2)},mode:function(r){return 0},sample:function(r){return-1/r*e.log(e.random())},variance:function(r){return e.pow(r,-2)}}),r.extend(r.gamma,{pdf:function(t,n,i){return 0>t?0:0===t&&1===n?1/i:e.exp((n-1)*e.log(t)-t/i-r.gammaln(n)-n*e.log(i))},cdf:function(e,t,n){return 0>e?0:r.lowRegGamma(t,e/n)},inv:function(e,t,n){return r.gammapinv(e,t)*n},mean:function(r,e){return r*e},mode:function(r,e){return r>1?(r-1)*e:undefined},sample:function(e,t){return r.randg(e)*t},variance:function(r,e){return r*e*e}}),r.extend(r.invgamma,{pdf:function(t,n,i){return t>0?e.exp(-(n+1)*e.log(t)-i/t-r.gammaln(n)+n*e.log(i)):0},cdf:function(e,t,n){return e>0?1-r.lowRegGamma(t,n/e):0},inv:function(e,t,n){return n/r.gammapinv(1-e,t)},mean:function(r,e){return r>1?e/(r-1):undefined},mode:function(r,e){return e/(r+1)},sample:function(e,t){return t/r.randg(e)},variance:function(r,e){return r>2?e*e/((r-1)*(r-1)*(r-2)):undefined}}),r.extend(r.kumaraswamy,{pdf:function(r,t,n){return 0===r&&1===t?n:1===r&&1===n?t:e.exp(e.log(t)+e.log(n)+(t-1)*e.log(r)+(n-1)*e.log(1-e.pow(r,t)))},cdf:function(r,t,n){return 0>r?0:r>1?1:1-e.pow(1-e.pow(r,t),n)},inv:function(r,t,n){return e.pow(1-e.pow(1-r,1/n),1/t)},mean:function(e,t){return t*r.gammafn(1+1/e)*r.gammafn(t)/r.gammafn(1+1/e+t)},median:function(r,t){return e.pow(1-e.pow(2,-1/t),1/r)},mode:function(r,t){return 1>r||1>t||1===r||1===t?undefined:e.pow((r-1)/(r*t-1),1/r)},variance:function(r,e){throw Error("variance not yet implemented")}}),r.extend(r.lognormal,{pdf:function(r,t,n){return r>0?e.exp(-e.log(r)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(r)-t,2)/(2*n*n)):0},cdf:function(t,n,i){return 0>t?0:.5+.5*r.erf((e.log(t)-n)/e.sqrt(2*i*i))},inv:function(t,n,i){return e.exp(-1.4142135623730951*i*r.erfcinv(2*t)+n)},mean:function(r,t){return e.exp(r+t*t/2)},median:function(r,t){return e.exp(r)},mode:function(r,t){return e.exp(r-t*t)},sample:function(t,n){return e.exp(r.randn()*n+t)},variance:function(r,t){return(e.exp(t*t)-1)*e.exp(2*r+t*t)}}),r.extend(r.noncentralt,{pdf:function(t,n,i){return 1e-14>e.abs(i)?r.studentt.pdf(t,n):1e-14>e.abs(t)?e.exp(r.gammaln((n+1)/2)-i*i/2-.5*e.log(e.PI*n)-r.gammaln(n/2)):n/t*(r.noncentralt.cdf(t*e.sqrt(1+2/n),n+2,i)-r.noncentralt.cdf(t,n,i))},cdf:function(t,n,i){if(1e-14>e.abs(i))return r.studentt.cdf(t,n);var o=!1;0>t&&(o=!0,i=-i);for(var u=r.normal.cdf(-i,0,1),a=1e-14+1,s=a,l=t*t/(t*t+n),f=0,c=e.exp(-i*i/2),d=e.exp(-i*i/2-.5*e.log(2)-r.gammaln(1.5))*i;200>f||s>1e-14||a>1e-14;)s=a,f>0&&(c*=i*i/(2*f),d*=i*i/(2*(f+.5))),a=c*r.beta.cdf(l,f+.5,n/2)+d*r.beta.cdf(l,f+1,n/2),u+=.5*a,f++;return o?1-u:u}}),r.extend(r.normal,{pdf:function(r,t,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(r-t,2)/(2*n*n))},cdf:function(t,n,i){return.5*(1+r.erf((t-n)/e.sqrt(2*i*i)))},inv:function(e,t,n){return-1.4142135623730951*n*r.erfcinv(2*e)+t},mean:function(r,e){return r},median:function(r,e){return r},mode:function(r,e){return r},sample:function(e,t){return r.randn()*t+e},variance:function(r,e){return e*e}}),r.extend(r.pareto,{pdf:function(r,t,n){return t>r?0:n*e.pow(t,n)/e.pow(r,n+1)},cdf:function(r,t,n){return t>r?0:1-e.pow(t/r,n)},inv:function(r,t,n){return t/e.pow(1-r,1/n)},mean:function(r,t){return t>1?t*e.pow(r,t)/(t-1):undefined},median:function(r,t){return r*(t*e.SQRT2)},mode:function(r,e){return r},variance:function(r,t){return t>2?r*r*t/(e.pow(t-1,2)*(t-2)):undefined}}),r.extend(r.studentt,{pdf:function(t,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*r.betafn(.5,n/2))*e.pow(1+t*t/n,-(n+1)/2)},cdf:function(t,n){var i=n/2;return r.ibeta((t+e.sqrt(t*t+n))/(2*e.sqrt(t*t+n)),i,i)},inv:function(t,n){var i=r.ibetainv(2*e.min(t,1-t),.5*n,.5);return i=e.sqrt(n*(1-i)/i),t>.5?i:-i},mean:function(r){return r>1?0:undefined},median:function(r){return 0},mode:function(r){return 0},sample:function(t){return r.randn()*e.sqrt(t/(2*r.randg(t/2)))},variance:function(r){return r>2?r/(r-2):r>1?Infinity:undefined}}),r.extend(r.weibull,{pdf:function(r,t,n){return 0>r||0>t||0>n?0:n/t*e.pow(r/t,n-1)*e.exp(-e.pow(r/t,n))},cdf:function(r,t,n){return 0>r?0:1-e.exp(-e.pow(r/t,n))},inv:function(r,t,n){return t*e.pow(-e.log(1-r),1/n)},mean:function(e,t){return e*r.gammafn(1+1/t)},median:function(r,t){return r*e.pow(e.log(2),1/t)},mode:function(r,t){return t>1?r*e.pow((t-1)/t,1/t):0},sample:function(r,t){return r*e.pow(-e.log(e.random()),1/t)},variance:function(t,n){return t*t*r.gammafn(1+2/n)-e.pow(r.weibull.mean(t,n),2)}}),r.extend(r.uniform,{pdf:function(r,e,t){return e>r||r>t?0:1/(t-e)},cdf:function(r,e,t){return e>r?0:t>r?(r-e)/(t-e):1},inv:function(r,e,t){return e+r*(t-e)},mean:function(r,e){return.5*(r+e)},median:function(e,t){return r.mean(e,t)},mode:function(r,e){throw Error("mode is not yet implemented")},sample:function(r,t){return r/2+t/2+(t/2-r/2)*(2*e.random()-1)},variance:function(r,t){return e.pow(t-r,2)/12}}),r.extend(r.binomial,{pdf:function(t,n,i){return 0===i||1===i?n*i===t?1:0:r.combination(n,t)*e.pow(i,t)*e.pow(1-i,n-t)},cdf:function(e,t,n){var i=[],o=0;if(0>e)return 0;if(t>e){for(;e>=o;o++)i[o]=r.binomial.pdf(o,t,n);return r.sum(i)}return 1}}),r.extend(r.negbin,{pdf:function(t,n,i){return t===t>>>0&&(0>t?0:r.combination(t+n-1,n-1)*e.pow(1-i,t)*e.pow(i,n))},cdf:function(e,t,n){var i=0,o=0;if(0>e)return 0;for(;e>=o;o++)i+=r.negbin.pdf(o,t,n);return i}}),r.extend(r.hypgeom,{pdf:function(t,n,i,o){if(t!==t|0)return!1;if(0>t||i-(n-o)>t)return 0;if(t>o||t>i)return 0;if(2*i>n)return 2*o>n?r.hypgeom.pdf(n-i-o+t,n,n-i,n-o):r.hypgeom.pdf(o-t,n,n-i,o);if(2*o>n)return r.hypgeom.pdf(i-t,n,i,n-o);if(o>i)return r.hypgeom.pdf(t,n,o,i);for(var u=1,a=0,s=0;t>s;s++){for(;u>1&&o>a;)u*=1-i/(n-a),a++;u*=(o-s)*(i-s)/((s+1)*(n-i-o+s+1))}for(;o>a;a++)u*=1-i/(n-a);return e.min(1,e.max(0,u))},cdf:function(t,n,i,o){if(0>t||i-(n-o)>t)return 0;if(o>t&&i>t){if(2*i>n)return 2*o>n?r.hypgeom.cdf(n-i-o+t,n,n-i,n-o):1-r.hypgeom.cdf(o-t-1,n,n-i,o);if(2*o>n)return 1-r.hypgeom.cdf(i-t-1,n,i,n-o);if(o>i)return r.hypgeom.cdf(t,n,o,i);for(var u=1,a=1,s=0,l=0;t>l;l++){for(;u>1&&o>s;){var f=1-i/(n-s);a*=f,u*=f,s++}a*=(o-l)*(i-l)/((l+1)*(n-i-o+l+1)),u+=a}for(;o>s;s++)u*=1-i/(n-s);return e.min(1,e.max(0,u))}return 1}}),r.extend(r.poisson,{pdf:function(t,n){return 0>n||t%1!=0||0>t?0:e.pow(n,t)*e.exp(-n)/r.factorial(t)},cdf:function(e,t){var n=[],i=0;if(0>e)return 0;for(;e>=i;i++)n.push(r.poisson.pdf(i,t));return r.sum(n)},mean:function(r){return r},variance:function(r){return r},sample:function(r){var t=1,n=0,i=e.exp(-r);do{n++,t*=e.random()}while(t>i);return n-1}}),r.extend(r.triangular,{pdf:function(r,e,t,n){return e>=t||e>n||n>t?NaN:e>r||r>t?0:n>r?2*(r-e)/((t-e)*(n-e)):r===n?2/(t-e):2*(t-r)/((t-e)*(t-n))},cdf:function(r,t,n,i){return t>=n||t>i||i>n?NaN:r>t?n>r?r>i?1-e.pow(n-r,2)/((n-t)*(n-i)):e.pow(r-t,2)/((n-t)*(i-t)):1:0},inv:function(r,t,n,i){return t>=n||t>i||i>n?NaN:r>(i-t)/(n-t)?t+(n-t)*(1-e.sqrt((1-r)*(1-(i-t)/(n-t)))):t+(n-t)*e.sqrt(r*((i-t)/(n-t)))},mean:function(r,e,t){return(r+e+t)/3},median:function(r,t,n){return n>(r+t)/2?n>(r+t)/2?r+e.sqrt((t-r)*(n-r))/e.sqrt(2):void 0:t-e.sqrt((t-r)*(t-n))/e.sqrt(2)},mode:function(r,e,t){return t},sample:function(r,t,n){var i=e.random();return(n-r)/(t-r)>i?r+e.sqrt(i*(t-r)*(n-r)):t-e.sqrt((1-i)*(t-r)*(t-n))},variance:function(r,e,t){return(r*r+e*e+t*t-r*e-r*t-e*t)/18}}),r.extend(r.arcsine,{pdf:function(r,t,n){return n>t?r>t&&n>r?2/e.PI*e.pow(e.pow(n-t,2)-e.pow(2*r-t-n,2),-.5):0:NaN},cdf:function(r,t,n){return t>r?0:n>r?2/e.PI*e.asin(e.sqrt((r-t)/(n-t))):1},inv:function(r,t,n){return t+(.5-.5*e.cos(e.PI*r))*(n-t)},mean:function(r,e){return e>r?(r+e)/2:NaN},median:function(r,e){return e>r?(r+e)/2:NaN},mode:function(r,e){throw Error("mode is not yet implemented")},sample:function(t,n){return(t+n)/2+(n-t)/2*e.sin(2*e.PI*r.uniform.sample(0,1))},variance:function(r,t){return t>r?e.pow(t-r,2)/8:NaN}}),r.extend(r.laplace,{pdf:function(r,t,n){return n>0?e.exp(-e.abs(r-t)/n)/(2*n):0},cdf:function(r,t,n){return n>0?t>r?.5*e.exp((r-t)/n):1-.5*e.exp(-(r-t)/n):0},mean:function(r,e){return r},median:function(r,e){return r},mode:function(r,e){return r},variance:function(r,e){return 2*e*e},sample:function(r,n){var i=e.random()-.5;return r-n*t(i)*e.log(1-2*e.abs(i))}}),r.extend(r.tukey,{cdf:function(t,i,o){var u=i,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(0>=t)return 0;if(2>o||2>u)return NaN;if(!Number.isFinite(t))return 1;if(o>25e3)return n(t,1,u);var l,f=.5*o,c=f*e.log(o)-o*e.log(2)-r.gammaln(f),d=f-1,m=.25*o;l=o>100?o>800?o>5e3?.125:.25:.5:1,c+=e.log(l);for(var p=0,h=1;50>=h;h++){for(var b=0,v=(2*h-1)*l,g=1;16>=g;g++){var E,N;g>8?(E=g-8-1,N=c+d*e.log(v+a[E]*l)-(a[E]*l+v)*m):(E=g-1,N=c+d*e.log(v-a[E]*l)+(a[E]*l-v)*m);var y;if(N>=-30){y=g>8?t*e.sqrt(.5*(a[E]*l+v)):t*e.sqrt(.5*(-a[E]*l+v));b+=n(y,1,u)*s[E]*e.exp(N)}}if(h*l>=1&&1e-14>=b)break;p+=b}if(b>1e-14)throw Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(t,n,o){var u=n;if(2>o||2>u)return NaN;if(0>t||t>1)return NaN;if(0===t)return 0;if(1===t)return Infinity;var a,s=i(t,u,o),l=r.tukey.cdf(s,n,o)-t;a=l>0?e.max(0,s-1):s+1;for(var f,c=r.tukey.cdf(a,n,o)-t,d=1;50>d;d++){f=a-c*(a-s)/(c-l),l=c,s=a,0>f&&(f=0,c=-t),c=r.tukey.cdf(f,n,o)-t,a=f;if(1e-4>e.abs(a-s))return f}throw Error("tukey.inv failed to converge")}})}(e,Math),function(e,t){function n(r){return u(r)||r instanceof e}var o=Array.prototype.push,u=e.utils.isArray;e.extend({add:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(r,e,n){return r+t[e][n]})):e.map(r,function(r){return r+t})},subtract:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(r,e,n){return r-t[e][n]||0})):e.map(r,function(r){return r-t})},divide:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.multiply(r,e.inv(t))):e.map(r,function(r){return r/t})},multiply:function(r,t){var i,o,u,a,s,l,f,c;if(r.length===undefined&&t.length===undefined)return r*t;if(s=r.length,l=r[0].length,f=e.zeros(s,u=n(t)?t[0].length:l),c=0,n(t)){for(;u>c;c++)for(i=0;s>i;i++){for(a=0,o=0;l>o;o++)a+=r[i][o]*t[o][c];f[i][c]=a}return 1===s&&1===c?f[0][0]:f}return e.map(r,function(r){return r*t})},outer:function(r,t){return e.multiply(r.map(function(r){return[r]}),[t])},outer:function(r,t){return e.multiply(r.map(function(r){return[r]}),[t])},dot:function(r,t){n(r[0])||(r=[r]),n(t[0])||(t=[t]);for(var i,o,u=1===r[0].length&&1!==r.length?e.transpose(r):r,a=1===t[0].length&&1!==t.length?e.transpose(t):t,s=[],l=0,f=u.length,c=u[0].length;f>l;l++){for(s[l]=[],i=0,o=0;c>o;o++)i+=u[l][o]*a[l][o];s[l]=i}return 1===s.length?s[0]:s},pow:function(r,n){return e.map(r,function(r){return t.pow(r,n)})},exp:function(r){return e.map(r,function(r){return t.exp(r)})},log:function(r){return e.map(r,function(r){return t.log(r)})},abs:function(r){return e.map(r,function(r){return t.abs(r)})},norm:function(r,e){var i=0,o=0;for(isNaN(e)&&(e=2),n(r[0])&&(r=r[0]);r.length>o;o++)i+=t.pow(t.abs(r[o]),e);return t.pow(i,1/e)},angle:function(r,n){return t.acos(e.dot(r,n)/(e.norm(r)*e.norm(n)))},aug:function(r,e){for(var t=[],n=0;r.length>n;n++)t.push(r[n].slice());for(var n=0;t.length>n;n++)o.apply(t[n],e[n]);return t},inv:function(r){for(var t,n=r.length,i=r[0].length,o=e.identity(n,i),u=e.gauss_jordan(r,o),a=[],s=0;n>s;s++)for(a[s]=[],t=i;u[0].length>t;t++)a[s][t-i]=u[s][t];return a},det:function(r){var e,t=r.length,n=2*t,i=Array(n),o=t-1,u=n-1,a=o-t+1,s=u,l=0,f=0;if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(;n>l;l++)i[l]=1;for(var l=0;t>l;l++){for(e=0;t>e;e++)i[0>a?a+t:a]*=r[l][e],i[t>s?s+t:s]*=r[l][e],a++,s--;a=--o-t+1,s=--u}for(var l=0;t>l;l++)f+=i[l];for(;n>l;l++)f-=i[l];return f},gauss_elimination:function(r,n){var i,o,u,a,s=0,l=0,f=r.length,c=r[0].length,d=1,m=0,p=[];r=e.aug(r,n),i=r[0].length;for(var s=0;f>s;s++){for(o=r[s][s],l=s,a=s+1;c>a;a++)oa;a++)u=r[s][a],r[s][a]=r[l][a],r[l][a]=u;for(l=s+1;f>l;l++)for(d=r[l][s]/r[s][s],a=s;i>a;a++)r[l][a]=r[l][a]-d*r[s][a]}for(var s=f-1;s>=0;s--){for(m=0,l=s+1;f-1>=l;l++)m+=p[l]*r[s][l];p[s]=(r[s][i-1]-m)/r[s][s]}return p},gauss_jordan:function(r,n){for(var i=e.aug(r,n),o=i.length,u=i[0].length,a=0,s=0;o>s;s++){for(var l=s,f=s+1;o>f;f++)t.abs(i[f][s])>t.abs(i[l][s])&&(l=f);var c=i[s];i[s]=i[l],i[l]=c;for(var f=s+1;o>f;f++){a=i[f][s]/i[s][s];for(var d=s;u>d;d++)i[f][d]-=i[s][d]*a}}for(var s=o-1;s>=0;s--){a=i[s][s];for(var f=0;s>f;f++)for(var d=u-1;d>s-1;d--)i[f][d]-=i[s][d]*i[f][s]/a;i[s][s]/=a;for(var d=o;u>d;d++)i[s][d]/=a}return i},triaUpSolve:function(r,t){var n,i=r[0].length,o=e.zeros(1,i)[0],u=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),u=!0),e.arange(i-1,-1,-1).forEach(function(u){n=e.arange(u+1,i).map(function(e){return o[e]*r[u][e]}),o[u]=(t[u]-e.sum(n))/r[u][u]}),u?o.map(function(r){return[r]}):o},triaLowSolve:function(r,t){var n,i=r[0].length,o=e.zeros(1,i)[0],u=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),u=!0),e.arange(i).forEach(function(i){n=e.arange(i).map(function(e){return r[i][e]*o[e]}),o[i]=(t[i]-e.sum(n))/r[i][i]}),u?o.map(function(r){return[r]}):o},lu:function(r){var t,n=r.length,o=e.identity(n),u=e.zeros(r.length,r[0].length);return e.arange(n).forEach(function(e){u[0][e]=r[0][e]}),e.arange(1,n).forEach(function(a){e.arange(a).forEach(function(n){t=e.arange(n).map(function(r){return o[a][r]*u[r][n]}),o[a][n]=(r[a][n]-e.sum(t))/u[n][n]}),e.arange(a,n).forEach(function(n){t=e.arange(a).map(function(r){return o[a][r]*u[r][n]}),u[a][n]=r[i][n]-e.sum(t)})}),[o,u]},cholesky:function(r){var n,i=r.length,o=e.zeros(r.length,r[0].length);return e.arange(i).forEach(function(u){n=e.arange(u).map(function(r){return t.pow(o[u][r],2)}),o[u][u]=t.sqrt(r[u][u]-e.sum(n)),e.arange(u+1,i).forEach(function(t){n=e.arange(u).map(function(r){return o[u][r]*o[t][r]}),o[t][u]=(r[u][t]-e.sum(n))/o[u][u]})}),o},gauss_jacobi:function(r,n,i,o){for(var u,a,s,l,f=0,c=0,d=r.length,m=[],p=[],h=[];d>f;f++)for(m[f]=[],p[f]=[],h[f]=[],c=0;d>c;c++)f>c?(m[f][c]=r[f][c],p[f][c]=h[f][c]=0):c>f?(p[f][c]=r[f][c],m[f][c]=h[f][c]=0):(h[f][c]=r[f][c],m[f][c]=p[f][c]=0);for(s=e.multiply(e.multiply(e.inv(h),e.add(m,p)),-1),a=e.multiply(e.inv(h),n),u=i,l=e.add(e.multiply(s,i),a),f=2;t.abs(e.norm(e.subtract(l,u)))>o;)u=l,l=e.add(e.multiply(s,u),a),f++;return l},gauss_seidel:function(r,n,i,o){for(var u,a,s,l,f,c=0,d=r.length,m=[],p=[],h=[];d>c;c++)for(m[c]=[],p[c]=[],h[c]=[],u=0;d>u;u++)c>u?(m[c][u]=r[c][u],p[c][u]=h[c][u]=0):u>c?(p[c][u]=r[c][u],m[c][u]=h[c][u]=0):(h[c][u]=r[c][u],m[c][u]=p[c][u]=0);for(l=e.multiply(e.multiply(e.inv(e.add(h,m)),p),-1),s=e.multiply(e.inv(e.add(h,m)),n),a=i,f=e.add(e.multiply(l,i),s),c=2;t.abs(e.norm(e.subtract(f,a)))>o;)a=f,f=e.add(e.multiply(l,a),s),c+=1;return f},SOR:function(r,n,i,o,u){for(var a,s,l,f,c,d=0,m=r.length,p=[],h=[],b=[];m>d;d++)for(p[d]=[],h[d]=[],b[d]=[],a=0;m>a;a++)d>a?(p[d][a]=r[d][a],h[d][a]=b[d][a]=0):a>d?(h[d][a]=r[d][a],p[d][a]=b[d][a]=0):(b[d][a]=r[d][a],p[d][a]=h[d][a]=0);for(f=e.multiply(e.inv(e.add(b,e.multiply(p,u))),e.subtract(e.multiply(b,1-u),e.multiply(h,u))),l=e.multiply(e.multiply(e.inv(e.add(b,e.multiply(p,u))),n),u),s=i,c=e.add(e.multiply(f,i),l),d=2;t.abs(e.norm(e.subtract(c,s)))>o;)s=c,c=e.add(e.multiply(f,s),l),d++;return c},householder:function(r){for(var n,i,o,u,a,s=r.length,l=r[0].length,f=0,c=[],d=[];s-1>f;f++){for(n=0,u=f+1;l>u;u++)n+=r[u][f]*r[u][f];for(a=r[f+1][f]>0?-1:1,n=a*t.sqrt(n),i=t.sqrt((n*n-r[f+1][f]*n)/2),c=e.zeros(s,1),c[f+1][0]=(r[f+1][f]-n)/(2*i),o=f+2;s>o;o++)c[o][0]=r[o][f]/(2*i);d=e.subtract(e.identity(s,l),e.multiply(e.multiply(c,e.transpose(c)),2)),r=e.multiply(d,e.multiply(r,d))}return r},QR:function(){function n(n){var u=n.length,a=n[0].length;n=e.copy(n),r=e.zeros(a,a);var s,l,f;for(l=0;a>l;l++){for(r[l][l]=t.sqrt(i(o(u).map(function(r){return n[r][l]*n[r][l]}))),s=0;u>s;s++)n[s][l]=n[s][l]/r[l][l];for(f=l+1;a>f;f++)for(r[l][f]=i(o(u).map(function(r){return n[r][l]*n[r][f]})),s=0;u>s;s++)n[s][f]=n[s][f]-n[s][l]*r[l][f]}return[n,r]}var i=e.sum,o=e.arange;return n}(),lstsq:function(r,t){function n(r){r=e.copy(r);var t=r.length,n=e.identity(t);return e.arange(t-1,-1,-1).forEach(function(t){e.sliceAssign(n,{row:t},e.divide(e.slice(n,{row:t}),r[t][t])),e.sliceAssign(r,{row:t},e.divide(e.slice(r,{row:t}),r[t][t])),e.arange(t).forEach(function(i){var o=e.multiply(r[i][t],-1),u=e.slice(r,{row:i}),a=e.multiply(e.slice(r,{row:t}),o);e.sliceAssign(r,{row:i},e.add(u,a));var s=e.slice(n,{row:i}),l=e.multiply(e.slice(n,{row:t}),o);e.sliceAssign(n,{row:i},e.add(s,l))})}),n}function i(r,t){var i=!1;t[0].length===undefined&&(t=t.map(function(r){return[r]}),i=!0);var o=e.QR(r),u=o[0],a=o[1],s=r[0].length,l=e.slice(u,{col:{end:s}}),f=e.slice(a,{row:{end:s}}),c=n(f),d=e.transpose(l);d[0].length===undefined&&(d=[d]);var m=e.multiply(e.multiply(c,d),t);return m.length===undefined&&(m=[[m]]),i?m.map(function(r){return r[0]}):m}return i}(),jacobi:function(r){for(var n,i,o,u,a,s,l,f,c=1,d=0,m=r.length,p=e.identity(m,m),h=[];1===c;){d++,s=r[0][1],u=0,a=1;for(var i=0;m>i;i++)for(o=0;m>o;o++)i!=o&&s0?t.PI/4:-t.PI/4:t.atan(2*r[u][a]/(r[u][u]-r[a][a]))/2,f=e.identity(m,m),f[u][u]=t.cos(l),f[u][a]=-t.sin(l),f[a][u]=t.sin(l),f[a][a]=t.cos(l),p=e.multiply(p,f),n=e.multiply(e.multiply(e.inv(f),r),f),r=n,c=0;for(var i=1;m>i;i++)for(o=1;m>o;o++)i!=o&&t.abs(r[i][o])>.001&&(c=1)}for(var i=0;m>i;i++)h.push(r[i][i]);return[p,h]},rungekutta:function(r,e,t,n,i,o){var u,a,s,l,f;if(2===o)for(;t>=n;)u=e*r(n,i),a=e*r(n+e,i+u),s=i+(u+a)/2,i=s,n+=e;if(4===o)for(;t>=n;)u=e*r(n,i),a=e*r(n+e/2,i+u/2),l=e*r(n+e/2,i+a/2),f=e*r(n+e,i+l),s=i+(u+2*a+2*l+f)/6,i=s,n+=e;return i},romberg:function(r,e,n,i){for(var o,u,a,s,l,f=0,c=(n-e)/2,d=[],m=[],p=[];i/2>f;){for(l=r(e),a=e,s=0;n>=a;a+=c,s++)d[s]=a;for(o=d.length,a=1;o-1>a;a++)l+=(a%2!=0?4:2)*r(d[a]);l=c/3*(l+r(n)),p[f]=l,c/=2,f++}for(u=p.length,o=1;1!==u;){for(a=0;u-1>a;a++)m[a]=(t.pow(4,o)*p[a+1]-p[a])/(t.pow(4,o)-1);u=m.length,p=m,m=[],o++}return p},richardson:function(r,e,n,i){function o(r,e){for(var t,n=0,i=r.length;i>n;n++)r[n]===e&&(t=n);return t}for(var u,a,s,l,f,c=t.abs(n-r[o(r,n)+1]),d=0,m=[],p=[];i>=c;)u=o(r,n+i),a=o(r,n),m[d]=(e[u]-2*e[a]+e[2*a-u])/(i*i),i/=2,d++;for(l=m.length,s=1;1!=l;){for(f=0;l-1>f;f++)p[f]=(t.pow(4,s)*m[f+1]-m[f])/(t.pow(4,s)-1);l=p.length,m=p,p=[],s++}return m},simpson:function(r,e,t,n){for(var i,o=(t-e)/n,u=r(e),a=[],s=e,l=0,f=1;t>=s;s+=o,l++)a[l]=s;for(i=a.length;i-1>f;f++)u+=(f%2!=0?4:2)*r(a[f]);return o/3*(u+r(t))},hermite:function(r,e,t,n){for(var i,o=r.length,u=0,a=0,s=[],l=[],f=[],c=[];o>a;a++){for(s[a]=1,i=0;o>i;i++)a!=i&&(s[a]*=(n-r[i])/(r[a]-r[i]));for(l[a]=0,i=0;o>i;i++)a!=i&&(l[a]+=1/(r[a]-r[i]));f[a]=s[a]*s[a]*(1-2*(n-r[a])*l[a]),c[a]=s[a]*s[a]*(n-r[a]),u+=f[a]*e[a]+c[a]*t[a]}return u},lagrange:function(r,e,t){for(var n,i,o=0,u=0,a=r.length;a>u;u++){for(i=e[u],n=0;a>n;n++)u!=n&&(i*=(t-r[n])/(r[u]-r[n]));o+=i}return o},cubic_spline:function(r,t,n){for(var i,o=r.length,u=0,a=[],s=[],l=[],f=[],c=[],d=[],m=[];o-1>u;u++)c[u]=r[u+1]-r[u];l[0]=0;for(var u=1;o-1>u;u++)l[u]=3/c[u]*(t[u+1]-t[u])-3/c[u-1]*(t[u]-t[u-1]);for(var u=1;o-1>u;u++)a[u]=[],s[u]=[],a[u][u-1]=c[u-1],a[u][u]=2*(c[u-1]+c[u]),a[u][u+1]=c[u],s[u][0]=l[u];for(f=e.multiply(e.inv(a),s),i=0;o-1>i;i++)d[i]=(t[i+1]-t[i])/c[i]-c[i]*(f[i+1][0]+2*f[i][0])/3,m[i]=(f[i+1][0]-f[i][0])/(3*c[i]);for(i=0;o>i&&r[i]<=n;i++);return i-=1,t[i]+(n-r[i])*d[i]+e.sq(n-r[i])*f[i]+(n-r[i])*e.sq(n-r[i])*m[i]},gauss_quadrature:function(){throw Error("gauss_quadrature not yet implemented")},PCA:function(r){for(var t,n,i=r.length,o=r[0].length,u=0,a=[],s=[],l=[],f=[],c=[],d=[],m=[],p=[],h=[],b=[],u=0;i>u;u++)a[u]=e.sum(r[u])/o;for(var u=0;o>u;u++)for(m[u]=[],t=0;i>t;t++)m[u][t]=r[t][u]-a[t];m=e.transpose(m);for(var u=0;i>u;u++)for(p[u]=[],t=0;i>t;t++)p[u][t]=e.dot([m[u]],[m[t]])/(o-1);l=e.jacobi(p),h=l[0],s=l[1],b=e.transpose(h);for(var u=0;s.length>u;u++)for(t=u;s.length>t;t++)s[t]>s[u]&&(n=s[u],s[u]=s[t],s[t]=n,f=b[u],b[u]=b[t],b[t]=f);d=e.transpose(m);for(var u=0;i>u;u++)for(c[u]=[],t=0;d.length>t;t++)c[u][t]=e.dot([b[u]],[d[t]]);return[r,s,b,c]}}),function(r){for(var t=0;r.length>t;t++)!function(r){e.fn[r]=function(t,n){var i=this;return n?(setTimeout(function(){n.call(i,e.fn[r].call(i,t))},15),this):"number"==typeof e[r](this,t)?e[r](this,t):e(e[r](this,t))}}(r[t])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(r,e){function t(r,t,n,i){if(r>1||n>1||0>=r||0>=n)throw Error("Proportions should be greater than 0 and less than 1");var o=(r*t+n*i)/(t+i);return(r-n)/e.sqrt(o*(1-o)*(1/t+1/i))}var n=[].slice,i=r.utils.isNumber,o=r.utils.isArray;r.extend({zscore:function(){var e=n.call(arguments);return i(e[1])?(e[0]-e[1])/e[2]:(e[0]-r.mean(e[1]))/r.stdev(e[1],e[2])},ztest:function(){var t,i=n.call(arguments);return o(i[1])?(t=r.zscore(i[0],i[1],i[3]),1===i[2]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):i.length>2?(t=r.zscore(i[0],i[1],i[2]),1===i[3]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):(t=i[0],1===i[1]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1))}}),r.extend(r.fn,{zscore:function(r,e){return(r-this.mean())/this.stdev(e)},ztest:function(t,n,i){var o=e.abs(this.zscore(t,i));return 1===n?r.normal.cdf(-o,0,1):2*r.normal.cdf(-o,0,1)}}),r.extend({tscore:function(){var t=n.call(arguments);return 4===t.length?(t[0]-t[1])/(t[2]/e.sqrt(t[3])):(t[0]-r.mean(t[1]))/(r.stdev(t[1],!0)/e.sqrt(t[1].length))},ttest:function(){var t,o=n.call(arguments);return 5===o.length?(t=e.abs(r.tscore(o[0],o[1],o[2],o[3])),1===o[4]?r.studentt.cdf(-t,o[3]-1):2*r.studentt.cdf(-t,o[3]-1)):i(o[1])?(t=e.abs(o[0]),1==o[2]?r.studentt.cdf(-t,o[1]-1):2*r.studentt.cdf(-t,o[1]-1)):(t=e.abs(r.tscore(o[0],o[1])),1==o[2]?r.studentt.cdf(-t,o[1].length-1):2*r.studentt.cdf(-t,o[1].length-1))}}),r.extend(r.fn,{tscore:function(r){return(r-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(t,n){return 1===n?1-r.studentt.cdf(e.abs(this.tscore(t)),this.cols()-1):2*r.studentt.cdf(-e.abs(this.tscore(t)),this.cols()-1)}}),r.extend({anovafscore:function(){var t,i,o,u,a,s,l,f,c=n.call(arguments);if(1===c.length){a=Array(c[0].length);for(var l=0;c[0].length>l;l++)a[l]=c[0][l];c=a}if(2===c.length)return r.variance(c[0])/r.variance(c[1]);i=[];for(var l=0;c.length>l;l++)i=i.concat(c[l]);o=r.mean(i),t=0;for(var l=0;c.length>l;l++)t+=c[l].length*e.pow(r.mean(c[l])-o,2);t/=c.length-1,s=0;for(var l=0;c.length>l;l++)for(u=r.mean(c[l]),f=0;c[l].length>f;f++)s+=e.pow(c[l][f]-u,2);return s/=i.length-c.length,t/s},anovaftest:function(){var e,t,o,u,a=n.call(arguments);if(i(a[0]))return 1-r.centralF.cdf(a[0],a[1],a[2]);anovafscore=r.anovafscore(a),e=a.length-1,o=0;for(var u=0;a.length>u;u++)o+=a[u].length;return t=o-e-1,1-r.centralF.cdf(anovafscore,e,t)},ftest:function(e,t,n){return 1-r.centralF.cdf(e,t,n)}}),r.extend(r.fn,{anovafscore:function(){return r.anovafscore(this.toArray())},anovaftes:function(){for(var e,t=0,e=0;this.length>e;e++)t+=this[e].length;return r.ftest(this.anovafscore(),this.length-1,t-this.length)}}),r.extend({qscore:function(){var t,o,u,a,s,l=n.call(arguments);return i(l[0])?(t=l[0],o=l[1],u=l[2],a=l[3],s=l[4]):(t=r.mean(l[0]),o=r.mean(l[1]),u=l[0].length,a=l[1].length,s=l[2]),e.abs(t-o)/(s*e.sqrt((1/u+1/a)/2))},qtest:function(){var e,t=n.call(arguments);3===t.length?(e=t[0],t=t.slice(1)):7===t.length?(e=r.qscore(t[0],t[1],t[2],t[3],t[4]),t=t.slice(5)):(e=r.qscore(t[0],t[1],t[2]),t=t.slice(3));var i=t[0],o=t[1];return 1-r.tukey.cdf(e,o,i-o)},tukeyhsd:function(e){for(var t=r.pooledstdev(e),n=e.map(function(e){return r.mean(e)}),i=e.reduce(function(r,e){return r+e.length},0),o=[],u=0;e.length>u;++u)for(var a=u+1;e.length>a;++a){var s=r.qtest(n[u],n[a],e[u].length,e[a].length,t,i,e.length);o.push([[u,a],s])}return o}}),r.extend({normalci:function(){var t,i=n.call(arguments),o=Array(2);return t=e.abs(4===i.length?r.normal.inv(i[1]/2,0,1)*i[2]/e.sqrt(i[3]):r.normal.inv(i[1]/2,0,1)*r.stdev(i[2])/e.sqrt(i[2].length)),o[0]=i[0]-t,o[1]=i[0]+t,o},tci:function(){var t,i=n.call(arguments),o=Array(2);return t=e.abs(4===i.length?r.studentt.inv(i[1]/2,i[3]-1)*i[2]/e.sqrt(i[3]):r.studentt.inv(i[1]/2,i[2].length-1)*r.stdev(i[2],!0)/e.sqrt(i[2].length)),o[0]=i[0]-t,o[1]=i[0]+t,o},significant:function(r,e){return e>r}}),r.extend(r.fn,{normalci:function(e,t){return r.normalci(e,t,this.toArray())},tci:function(e,t){return r.tci(e,t,this.toArray())}}),r.extend(r.fn,{oneSidedDifferenceOfProportions:function(e,n,i,o){var u=t(e,n,i,o);return r.ztest(u,1)},twoSidedDifferenceOfProportions:function(e,n,i,o){var u=t(e,n,i,o);return r.ztest(u,2)}})}(e,Math),e.models=function(){function r(r,e){return t(r,e)}function r(r){var n=r[0].length;return e.arange(n).map(function(i){var o=e.arange(n).filter(function(r){return r!==i});return t(e.col(r,i).map(function(r){return r[0]}),e.col(r,o))})}function t(r,t){var n=r.length,i=t[0].length-1,o=n-i-1,u=e.lstsq(t,r),a=e.multiply(t,u.map(function(r){return[r]})).map(function(r){return r[0]}),s=e.subtract(r,a),l=e.mean(r),f=e.sum(a.map(function(r){return Math.pow(r-l,2)})),c=e.sum(r.map(function(r,e){return Math.pow(r-a[e],2)})),d=f+c;return{exog:t,endog:r,nobs:n,df_model:i,df_resid:o,coef:u,predict:a,resid:s,ybar:l,SST:d,SSE:f,SSR:c,R2:f/d}}function n(t){var n=r(t.exog),i=Math.sqrt(t.SSR/t.df_resid),o=n.map(function(r){var e=r.SST,t=r.R2;return i/Math.sqrt(e*(1-t))}),u=t.coef.map(function(r,e){return(r-0)/o[e]}),a=u.map(function(r){var n=e.studentt.cdf(r,t.df_resid);return 2*(n>.5?1-n:n)}),s=e.studentt.inv(.975,t.df_resid),l=t.coef.map(function(r,e){var t=s*o[e];return[r-t,r+t]});return{se:o,t:u,p:a,sigmaHat:i,interval95:l}}function i(r){var t=r.R2/r.df_model/((1-r.R2)/r.df_resid);return{F_statistic:t,pvalue:1-function(r,t,n){return e.beta.cdf(r/(n/t+r),t/2,n/2)}(t,r.df_model,r.df_resid)}}function o(r,e){var o=t(r,e),u=n(o),a=i(o),s=1-(o.nobs-1)/o.df_resid*(1-o.rsquared);return o.t=u,o.f=a,o.adjust_R2=s,o}return{ols:o}}(),e.jStat=e,e})},function(r,e,t){var n=t(1),i=t(9),o=t(0);e.UNIQUE=function(){for(var r=[],e=0;arguments.length>e;++e){for(var t=!1,n=arguments[e],i=0;r.length>i&&!(t=r[i]===n);++i);t||r.push(n)}return r},e.FLATTEN=n.flatten,e.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},e.REFERENCE=function(r,e){if(!arguments.length)return o.error;try{for(var t=e.split("."),n=r,i=0;t.length>i;++i){var u=t[i];if("]"===u[u.length-1]){var a=u.indexOf("["),s=u.substring(a+1,u.length-1);n=n[u.substring(0,a)][s]}else n=n[u]}return n}catch(o){}},e.JOIN=function(r,e){return r.join(e)},e.NUMBERS=function(){return n.flatten(arguments).filter(function(r){return"number"==typeof r})},e.NUMERAL=function(r,e){return i(r).format(e)}},function(r,e,t){function n(r){return/^[01]{1,10}$/.test(r)}var i=t(0),o=t(11).jStat,u=t(6),a=t(1),s=t(88);e.BESSELI=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.besseli(r,e)},e.BESSELJ=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.besselj(r,e)},e.BESSELK=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.besselk(r,e)},e.BESSELY=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.bessely(r,e)},e.BIN2DEC=function(r){if(!n(r))return i.num;var e=parseInt(r,2),t=""+r;return 10===t.length&&"1"===t.substring(0,1)?parseInt(t.substring(1),2)-512:e},e.BIN2HEX=function(r,e){if(!n(r))return i.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(0xfffffffe00+parseInt(t.substring(1),2)).toString(16);var o=parseInt(r,2).toString(16);return e===undefined?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.BIN2OCT=function(r,e){if(!n(r))return i.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(1073741312+parseInt(t.substring(1),2)).toString(8);var o=parseInt(r,2).toString(8);return e===undefined?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.BITAND=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r||0>e?i.num:Math.floor(r)!==r||Math.floor(e)!==e?i.num:r>0xffffffffffff||e>0xffffffffffff?i.num:r&e},e.BITLSHIFT=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r?i.num:Math.floor(r)!==r?i.num:r>0xffffffffffff?i.num:Math.abs(e)>53?i.num:0>e?r>>-e:r<r||0>e?i.num:Math.floor(r)!==r||Math.floor(e)!==e?i.num:r>0xffffffffffff||e>0xffffffffffff?i.num:r|e},e.BITRSHIFT=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r?i.num:Math.floor(r)!==r?i.num:r>0xffffffffffff?i.num:Math.abs(e)>53?i.num:0>e?r<<-e:r>>e},e.BITXOR=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r||0>e?i.num:Math.floor(r)!==r||Math.floor(e)!==e?i.num:r>0xffffffffffff||e>0xffffffffffff?i.num:r^e},e.COMPLEX=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?r:"i"!==(t=t===undefined?"i":t)&&"j"!==t?i.value:0===r&&0===e?0:0===r?1===e?t:""+e+t:0===e?""+r:r+(e>0?"+":"")+(1===e?t:""+e+t)},e.CONVERT=function(r,e,t){if((r=a.parseNumber(r))instanceof Error)return r;for(var n,o=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],u={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},l=null,f=null,c=e,d=t,m=1,p=1,h=0;146>h;h++)n=null===o[h][2]?[]:o[h][2],o[h][1]!==c&&0>n.indexOf(c)||(l=o[h]),o[h][1]!==d&&0>n.indexOf(d)||(f=o[h]);if(null===l){var b=u[e.substring(0,2)],v=s[e.substring(0,1)];"da"===e.substring(0,2)&&(v=["dekao",10,"da"]),b?(m=b[2],c=e.substring(2)):v&&(m=v[1],c=e.substring(v[2].length));for(var g=0;146>g;g++)n=null===o[g][2]?[]:o[g][2],o[g][1]!==c&&0>n.indexOf(c)||(l=o[g])}if(null===f){var E=u[t.substring(0,2)],N=s[t.substring(0,1)];"da"===t.substring(0,2)&&(N=["dekao",10,"da"]),E?(p=E[2],d=t.substring(2)):N&&(p=N[1],d=t.substring(N[2].length));for(var y=0;146>y;y++)n=null===o[y][2]?[]:o[y][2],o[y][1]!==d&&0>n.indexOf(d)||(f=o[y])}return null===l||null===f?i.na:l[3]!==f[3]?i.na:r*l[6]*m/(f[6]*p)},e.DEC2BIN=function(r,e){if((r=a.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||-512>r||r>511)return i.num;if(0>r)return"1"+u.REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var t=parseInt(r,10).toString(2);return void 0===e?t:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),t.length>e?i.num:u.REPT("0",e-t.length)+t)},e.DEC2HEX=function(r,e){if((r=a.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||-549755813888>r||r>549755813887)return i.num;if(0>r)return(1099511627776+r).toString(16);var t=parseInt(r,10).toString(16);return void 0===e?t:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),t.length>e?i.num:u.REPT("0",e-t.length)+t)},e.DEC2OCT=function(r,e){if((r=a.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||-536870912>r||r>536870911)return i.num;if(0>r)return(1073741824+r).toString(8);var t=parseInt(r,10).toString(8);return void 0===e?t:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),t.length>e?i.num:u.REPT("0",e-t.length)+t)},e.DELTA=function(r,e){return e=e===undefined?0:e,r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:r===e?1:0},e.ERF=function(r,e){return e=e===undefined?0:e,r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:o.erf(r)},e.ERF.PRECISE=function(){throw Error("ERF.PRECISE is not implemented")},e.ERFC=function(r){return isNaN(r)?i.value:o.erfc(r)},e.ERFC.PRECISE=function(){throw Error("ERFC.PRECISE is not implemented")},e.GESTEP=function(r,e){return e=e||0,r=a.parseNumber(r),a.anyIsError(e,r)?r:e>r?0:1},e.HEX2BIN=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return i.num;var t=10===r.length&&"f"===r.substring(0,1).toLowerCase(),n=t?parseInt(r,16)-1099511627776:parseInt(r,16);if(-512>n||n>511)return i.num;if(t)return"1"+u.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var o=n.toString(2);return e===undefined?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return i.num;var e=parseInt(r,16);return 549755813888>e?e:e-1099511627776},e.HEX2OCT=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return i.num;var t=parseInt(r,16);if(t>536870911&&0xffe0000000>t)return i.num;if(t>=0xffe0000000)return(t-0xffc0000000).toString(8);var n=t.toString(8);return e===undefined?n:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),n.length>e?i.num:u.REPT("0",e-n.length)+n)},e.IMABS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))},e.IMAGINARY=function(r){if(r===undefined||!0===r||!1===r)return i.value;if(0===r||"0"===r)return 0;if(["i","j"].indexOf(r)>=0)return 1;r=r.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var e=r.indexOf("+"),t=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===t&&(t=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),o="i"===n||"j"===n;return 0>e&&0>t?o?isNaN(r.substring(0,r.length-1))?i.num:r.substring(0,r.length-1):isNaN(r)?i.num:0:o?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?i.num:-+r.substring(t+1,r.length-1):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?i.num:+r.substring(e+1,r.length-1):i.num},e.IMARGUMENT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:0===t&&0===n?i.div0:0===t&&n>0?Math.PI/2:0===t&&0>n?-Math.PI/2:0===n&&t>0?0:0===n&&0>t?-Math.PI:t>0?Math.atan(n/t):0>t&&n>=0?Math.atan(n/t)+Math.PI:Math.atan(n/t)-Math.PI},e.IMCONJUGATE=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",0!==n?e.COMPLEX(t,-n,o):r},e.IMCOS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,o)},e.IMCOSH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,o)},e.IMCOT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:e.IMDIV(e.IMCOS(r),e.IMSIN(r))},e.IMDIV=function(r,t){var n=e.IMREAL(r),o=e.IMAGINARY(r),u=e.IMREAL(t),s=e.IMAGINARY(t);if(a.anyIsError(n,o,u,s))return i.value;var l=r.substring(r.length-1),f=t.substring(t.length-1),c="i";if("j"===l?c="j":"j"===f&&(c="j"),0===u&&0===s)return i.num;var d=u*u+s*s;return e.COMPLEX((n*u+o*s)/d,(o*u-n*s)/d,c)},e.IMEXP=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);o="i"===o||"j"===o?o:"i";var u=Math.exp(t);return e.COMPLEX(u*Math.cos(n),u*Math.sin(n),o)},e.IMLN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),o)},e.IMLOG10=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),o)},e.IMLOG2=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),o)},e.IMPOWER=function(r,t){t=a.parseNumber(t);var n=e.IMREAL(r),o=e.IMAGINARY(r);if(a.anyIsError(t,n,o))return i.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var s=Math.pow(e.IMABS(r),t),l=e.IMARGUMENT(r);return e.COMPLEX(s*Math.cos(t*l),s*Math.sin(t*l),u)},e.IMPRODUCT=function(){var r=arguments[0];if(!arguments.length)return i.value;for(var t=1;arguments.length>t;t++){var n=e.IMREAL(r),o=e.IMAGINARY(r),u=e.IMREAL(arguments[t]),s=e.IMAGINARY(arguments[t]);if(a.anyIsError(n,o,u,s))return i.value;r=e.COMPLEX(n*u-o*s,n*s+o*u)}return r},e.IMREAL=function(r){if(r===undefined||!0===r||!1===r)return i.value;if(0===r||"0"===r)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(r)>=0)return 0;var e=r.indexOf("+"),t=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===t&&(t=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),o="i"===n||"j"===n;return 0>e&&0>t?o?isNaN(r.substring(0,r.length-1))?i.num:0:isNaN(r)?i.num:r:o?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?i.num:+r.substring(0,t):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?i.num:+r.substring(0,e):i.num},e.IMSEC=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:e.IMDIV("1",e.IMCOS(r))},e.IMSECH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:e.IMDIV("1",e.IMCOSH(r))},e.IMSIN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,o)},e.IMSINH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,o)},e.IMSQRT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);o="i"===o||"j"===o?o:"i";var u=Math.sqrt(e.IMABS(r)),s=e.IMARGUMENT(r);return e.COMPLEX(u*Math.cos(s/2),u*Math.sin(s/2),o)},e.IMCSC=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.num:e.IMDIV("1",e.IMSIN(r))},e.IMCSCH=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.num:e.IMDIV("1",e.IMSINH(r))},e.IMSUB=function(r,e){var t=this.IMREAL(r),n=this.IMAGINARY(r),o=this.IMREAL(e),u=this.IMAGINARY(e);if(a.anyIsError(t,n,o,u))return i.value;var s=r.substring(r.length-1),l=e.substring(e.length-1),f="i";return"j"===s?f="j":"j"===l&&(f="j"),this.COMPLEX(t-o,n-u,f)},e.IMSUM=function(){if(!arguments.length)return i.value;for(var r=a.flatten(arguments),e=r[0],t=1;r.length>t;t++){var n=this.IMREAL(e),o=this.IMAGINARY(e),u=this.IMREAL(r[t]),s=this.IMAGINARY(r[t]);if(a.anyIsError(n,o,u,s))return i.value;e=this.COMPLEX(n+u,o+s)}return e},e.IMTAN=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:this.IMDIV(this.IMSIN(r),this.IMCOS(r))},e.OCT2BIN=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return i.num;var t=10===r.length&&"7"===r.substring(0,1),n=t?parseInt(r,8)-1073741824:parseInt(r,8);if(-512>n||n>511)return i.num;if(t)return"1"+u.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var o=n.toString(2);return void 0===e?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return i.num;var e=parseInt(r,8);return 536870912>e?e:e-1073741824},e.OCT2HEX=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return i.num;var t=parseInt(r,8);if(t>=536870912)return"ff"+(t+3221225472).toString(16);var n=t.toString(16);return e===undefined?n:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),n.length>e?i.num:u.REPT("0",e-n.length)+n)}},function(r,e,t){"use strict";e.__esModule=!0,e["default"]=["ABS","ACCRINT","ACOS","ACOSH","ACOT","ACOTH","ADD","AGGREGATE","AND","ARABIC","ARGS2ARRAY","ASIN","ASINH","ATAN","ATAN2","ATANH","AVEDEV","AVERAGE","AVERAGEA","AVERAGEIF","AVERAGEIFS","BASE","BESSELI","BESSELJ","BESSELK","BESSELY","BETA.DIST","BETA.INV","BETADIST","BETAINV","BIN2DEC","BIN2HEX","BIN2OCT","BINOM.DIST","BINOM.DIST.RANGE","BINOM.INV","BINOMDIST","BITAND","BITLSHIFT","BITOR","BITRSHIFT","BITXOR","CEILING","CEILINGMATH","CEILINGPRECISE","CHAR","CHISQ.DIST","CHISQ.DIST.RT","CHISQ.INV","CHISQ.INV.RT","CHOOSE","CHOOSE","CLEAN","CODE","COLUMN","COLUMNS","COMBIN","COMBINA","COMPLEX","CONCATENATE","CONFIDENCE","CONFIDENCE.NORM","CONFIDENCE.T","CONVERT","CORREL","COS","COSH","COT","COTH","COUNT","COUNTA","COUNTBLANK","COUNTIF","COUNTIFS","COUNTIN","COUNTUNIQUE","COVARIANCE.P","COVARIANCE.S","CSC","CSCH","CUMIPMT","CUMPRINC","DATE","DATEVALUE","DAY","DAYS","DAYS360","DB","DDB","DEC2BIN","DEC2HEX","DEC2OCT","DECIMAL","DEGREES","DELTA","DEVSQ","DIVIDE","DOLLAR","DOLLARDE","DOLLARFR","E","EDATE","EFFECT","EOMONTH","EQ","ERF","ERFC","EVEN","EXACT","EXP","EXPON.DIST","EXPONDIST","F.DIST","F.DIST.RT","F.INV","F.INV.RT","FACT","FACTDOUBLE","FALSE","FDIST","FDISTRT","FIND","FINV","FINVRT","FISHER","FISHERINV","FIXED","FLATTEN","FLOOR","FORECAST","FREQUENCY","FV","FVSCHEDULE","GAMMA","GAMMA.DIST","GAMMA.INV","GAMMADIST","GAMMAINV","GAMMALN","GAMMALN.PRECISE","GAUSS","GCD","GEOMEAN","GESTEP","GROWTH","GTE","HARMEAN","HEX2BIN","HEX2DEC","HEX2OCT","HOUR","HTML2TEXT","HYPGEOM.DIST","HYPGEOMDIST","IF","IMABS","IMAGINARY","IMARGUMENT","IMCONJUGATE","IMCOS","IMCOSH","IMCOT","IMCSC","IMCSCH","IMDIV","IMEXP","IMLN","IMLOG10","IMLOG2","IMPOWER","IMPRODUCT","IMREAL","IMSEC","IMSECH","IMSIN","IMSINH","IMSQRT","IMSUB","IMSUM","IMTAN","INT","INTERCEPT","INTERVAL","IPMT","IRR","ISBINARY","ISBLANK","ISEVEN","ISLOGICAL","ISNONTEXT","ISNUMBER","ISODD","ISODD","ISOWEEKNUM","ISPMT","ISTEXT","JOIN","KURT","LARGE","LCM","LEFT","LEN","LINEST","LN","LOG","LOG10","LOGEST","LOGNORM.DIST","LOGNORM.INV","LOGNORMDIST","LOGNORMINV","LOWER","LT","LTE","MATCH","MAX","MAXA","MEDIAN","MID","MIN","MINA","MINUS","MINUTE","MIRR","MOD","MODE.MULT","MODE.SNGL","MODEMULT","MODESNGL","MONTH","MROUND","MULTINOMIAL","MULTIPLY","NE","NEGBINOM.DIST","NEGBINOMDIST","NETWORKDAYS","NOMINAL","NORM.DIST","NORM.INV","NORM.S.DIST","NORM.S.INV","NORMDIST","NORMINV","NORMSDIST","NORMSINV","NOT","NOW","NPER","NPV","NUMBERS","NUMERAL","OCT2BIN","OCT2DEC","OCT2HEX","ODD","OR","PDURATION","PEARSON","PERCENTILEEXC","PERCENTILEINC","PERCENTRANKEXC","PERCENTRANKINC","PERMUT","PERMUTATIONA","PHI","PI","PMT","POISSON.DIST","POISSONDIST","POW","POWER","PPMT","PROB","PRODUCT","PROPER","PV","QUARTILE.EXC","QUARTILE.INC","QUARTILEEXC","QUARTILEINC","QUOTIENT","RADIANS","RAND","RANDBETWEEN","RANK.AVG","RANK.EQ","RANKAVG","RANKEQ","RATE","REFERENCE","REGEXEXTRACT","REGEXMATCH","REGEXREPLACE","REPLACE","REPT","RIGHT","ROMAN","ROUND","ROUNDDOWN","ROUNDUP","ROW","ROWS","RRI","RSQ","SEARCH","SEC","SECH","SECOND","SERIESSUM","SIGN","SIN","SINH","SKEW","SKEW.P","SKEWP","SLN","SLOPE","SMALL","SPLIT","SPLIT","SQRT","SQRTPI","STANDARDIZE","STDEV.P","STDEV.S","STDEVA","STDEVP","STDEVPA","STDEVS","STEYX","SUBSTITUTE","SUBTOTAL","SUM","SUMIF","SUMIFS","SUMPRODUCT","SUMSQ","SUMX2MY2","SUMX2PY2","SUMXMY2","SWITCH","SYD","T","T.DIST","T.DIST.2T","T.DIST.RT","T.INV","T.INV.2T","TAN","TANH","TBILLEQ","TBILLPRICE","TBILLYIELD","TDIST","TDIST2T","TDISTRT","TEXT","TIME","TIMEVALUE","TINV","TINV2T","TODAY","TRANSPOSE","TREND","TRIM","TRIMMEAN","TRUE","TRUNC","UNICHAR","UNICODE","UNIQUE","UPPER","VALUE","VAR.P","VAR.S","VARA","VARP","VARPA","VARS","WEEKDAY","WEEKNUM","WEIBULL.DIST","WEIBULLDIST","WORKDAY","XIRR","XNPV","XOR","YEAR","YEARFRAC"]},function(r,e,t){"use strict";function n(r){var e=parseInt(r,10);return e=isNaN(e)?-1:Math.max(e-1,-1)}function i(r){var e="";return 0>r||(e=""+(r+1)),e}function o(r){var e=0;if("string"==typeof r){r=r.toUpperCase();for(var t=0,n=r.length-1;r.length>t;t+=1,n-=1)e+=Math.pow(f,n)*(l.indexOf(r[t])+1)}return--e}function u(r){for(var e="";r>=0;)e=String.fromCharCode(r%f+97)+e,r=Math.floor(r/f)-1;return e.toUpperCase()}function a(r){if("string"!=typeof r||!c.test(r))return[];var e=r.toUpperCase().match(c),t=e[1],i=e[2],u=e[3],a=e[4];return[{index:n(a),label:a,isAbsolute:"$"===u},{index:o(i),label:i,isAbsolute:"$"===t}]}function s(r,e){var t=(r.isAbsolute?"$":"")+i(r.index);return(e.isAbsolute?"$":"")+u(e.index)+t}e.__esModule=!0,e.rowLabelToIndex=n,e.rowIndexToLabel=i,e.columnLabelToIndex=o,e.columnIndexToLabel=u,e.extractLabel=a,e.toLabel=s;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZ",f=l.length,c=/^([$])?([A-Za-z]+)([$])?([0-9]+)$/},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}e.__esModule=!0,e.rowLabelToIndex=e.rowIndexToLabel=e.columnLabelToIndex=e.columnIndexToLabel=e.toLabel=e.extractLabel=e.error=e.Parser=e.ERROR_VALUE=e.ERROR_REF=e.ERROR_NUM=e.ERROR_NULL=e.ERROR_NOT_AVAILABLE=e.ERROR_NAME=e.ERROR_DIV_ZERO=e.ERROR=e.SUPPORTED_FORMULAS=undefined;var i=t(17),o=n(i),u=t(14),a=n(u),s=t(2),l=n(s),f=t(15);e.SUPPORTED_FORMULAS=a["default"],e.ERROR=s.ERROR,e.ERROR_DIV_ZERO=s.ERROR_DIV_ZERO,e.ERROR_NAME=s.ERROR_NAME,e.ERROR_NOT_AVAILABLE=s.ERROR_NOT_AVAILABLE,e.ERROR_NULL=s.ERROR_NULL,e.ERROR_NUM=s.ERROR_NUM,e.ERROR_REF=s.ERROR_REF,e.ERROR_VALUE=s.ERROR_VALUE,e.Parser=o["default"],e.error=l["default"],e.extractLabel=f.extractLabel,e.toLabel=f.toLabel,e.columnIndexToLabel=f.columnIndexToLabel,e.columnLabelToIndex=f.columnLabelToIndex,e.rowIndexToLabel=f.rowIndexToLabel,e.rowLabelToIndex=f.rowLabelToIndex},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function i(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function o(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?r:e}function u(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}e.__esModule=!0;var a=t(18),s=n(a),l=t(19),f=n(l),c=t(101),d=t(103),m=t(3),p=t(2),h=n(p),b=t(15);e["default"]=function(r){function e(){i(this,e);var t=o(this,r.call(this));return t.parser=new c.Parser,t.parser.yy={toNumber:m.toNumber,trimEdges:d.trimEdges,invertNumber:m.invertNumber,throwError:function(r){return t._throwError(r)},callVariable:function(r){return t._callVariable(r)},evaluateByOperator:f["default"],callFunction:f["default"],cellValue:function(r){return t._callCellValue(r)},rangeValue:function(r,e){return t._callRangeValue(r,e)}},t.variables=Object.create(null),t.setVariable("TRUE",!0).setVariable("FALSE",!1).setVariable("NULL",null),t}return u(e,r),e.prototype.parse=function(r){var e=null,t=null;try{e=""===r?"":this.parser.parse(r)}catch(i){var n=(0,h["default"])(i.message);t=n||(0,h["default"])(p.ERROR)}return e instanceof Error&&(t=(0,h["default"])(e.message)||(0,h["default"])(p.ERROR),e=null),{error:t,result:e}},e.prototype.setVariable=function(r,e){return this.variables[r]=e,this},e.prototype.getVariable=function(r){return this.variables[r]},e.prototype._callVariable=function(r){var e=this.getVariable(r);if(this.emit("callVariable",r,function(r){void 0!==r&&(e=r)}),void 0===e)throw Error(p.ERROR_NAME);return e},e.prototype._callCellValue=function(r){r=r.toUpperCase();var e=(0,b.extractLabel)(r),t=e[0],n=e[1],i=void 0;return this.emit("callCellValue",{label:r,row:t,column:n},function(r){i=r}),i},e.prototype._callRangeValue=function(r,e){r=r.toUpperCase(),e=e.toUpperCase();var t=(0,b.extractLabel)(r),n=t[0],i=t[1],o=(0,b.extractLabel)(e),u=o[0],a=o[1],s={},l={};n.index>u.index?(s.row=u,l.row=n):(s.row=n,l.row=u),i.index>a.index?(s.column=a,l.column=i):(s.column=i,l.column=a),s.label=(0,b.toLabel)(s.row,s.column),l.label=(0,b.toLabel)(l.row,l.column);var f=[];return this.emit("callRangeValue",s,l,function(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];f=r}),f},e.prototype._throwError=function(r){if((0,p.isValidStrict)(r))throw Error(r);throw Error(p.ERROR)},e}(s["default"])},function(r,e){function t(){}t.prototype={on:function(r,e,t){var n=this.e||(this.e={});return(n[r]||(n[r]=[])).push({fn:e,ctx:t}),this},once:function(r,e,t){function n(){i.off(r,n),e.apply(t,arguments)}var i=this;return n._=e,this.on(r,n,t)},emit:function(r){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[r]||[]).slice(),n=0,i=t.length;for(n;i>n;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(r,e){var t=this.e||(this.e={}),n=t[r],i=[];if(n&&e)for(var o=0,u=n.length;u>o;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?t[r]=i:delete t[r],this}},r.exports=t},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function i(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(r=r.toUpperCase(),!D[r])throw Error(O.ERROR_NAME);return D[r].apply(D,e)}function o(r,e){Array.isArray(r)||(r=[r.toUpperCase()]),r.forEach(function(r){D[r]=e.isFactory?e(r):e})}e.__esModule=!0,e["default"]=i,e.registerOperation=o;var u=t(20),a=n(u),s=t(21),l=n(s),f=t(22),c=n(f),d=t(23),m=n(d),p=t(24),h=n(p),b=t(93),v=n(b),g=t(94),E=n(g),N=t(95),y=n(N),w=t(96),I=n(w),M=t(97),x=n(M),A=t(98),R=n(A),T=t(99),C=n(T),S=t(100),$=n(S),O=t(2),D=Object.create(null);o(a["default"].SYMBOL,a["default"]),o(l["default"].SYMBOL,l["default"]),o(c["default"].SYMBOL,c["default"]),o(m["default"].SYMBOL,m["default"]),o($["default"].SYMBOL,$["default"]),o(h["default"].SYMBOL,h["default"]),o(v["default"].SYMBOL,v["default"]),o(E["default"].SYMBOL,E["default"]),o(y["default"].SYMBOL,y["default"]),o(I["default"].SYMBOL,I["default"]),o(R["default"].SYMBOL,R["default"]),o(C["default"].SYMBOL,C["default"]),o(x["default"].SYMBOL,x["default"])},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r+(0,i.toNumber)(e)},(0,i.toNumber)(r));if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="+"},function(r,e,t){"use strict";function n(){for(var r=arguments.length,e=Array(r),t=0;r>t;t++)e[t]=arguments[t];return e.reduce(function(r,e){return r+""+e},"")}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="&"},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r/(0,i.toNumber)(e)},(0,i.toNumber)(r));if(u===Infinity)throw Error(o.ERROR_DIV_ZERO);if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="/"},function(r,e,t){"use strict";function n(r,e){return r===e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="="},function(r,e,t){"use strict";function n(r){return function(){r=r.toUpperCase();var e=r.split("."),t=!1,n=void 0;if(1===e.length)o[e[0]]&&(t=!0,n=o[e[0]].apply(o,arguments));else{for(var i=e.length,u=0,a=o;i>u;)if(a=a[e[u]],u++,!a){a=null;break}a&&(t=!0,n=a.apply(undefined,arguments))}if(!t)throw Error(s.ERROR_NAME);return n}}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(25),o=function(r){if(r&&r.__esModule)return r;var e={};if(null!=r)for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e["default"]=r,e}(i),u=t(14),a=function(r){return r&&r.__esModule?r:{"default":r}}(u),s=t(2),l=e.SYMBOL=a["default"];n.isFactory=!0,n.SYMBOL=l},function(r,e,t){var n=[t(26),t(89),t(13),t(90),t(4),t(6),t(8),t(91),t(7),t(92),t(5),t(12)];for(var i in n){var o=n[i];for(var u in o)e[u]=e[u]||o[u]}},function(r,e,t){function n(r,e){if(e)for(var t in e)r[t]=e[t];return r}var i=t(4),o=t(5),u=t(13),a=t(8);e.BETADIST=o.BETA.DIST,e.BETAINV=o.BETA.INV,e.BINOMDIST=o.BINOM.DIST,e.CEILING=e.ISOCEILING=n(i.CEILING.MATH,i.CEILING),e.CEILINGMATH=i.CEILING.MATH,e.CEILINGPRECISE=i.CEILING.PRECISE,e.CHIDIST=o.CHISQ.DIST,e.CHIDISTRT=o.CHISQ.DIST.RT,e.CHIINV=o.CHISQ.INV,e.CHIINVRT=o.CHISQ.INV.RT,e.CHITEST=o.CHISQ.TEST,e.CONFIDENCE=n(o.CONFIDENCE.NORM,o.CONFIDENCE),e.COVAR=o.COVARIANCE.P,e.COVARIANCEP=o.COVARIANCE.P,e.COVARIANCES=o.COVARIANCE.S,e.CRITBINOM=o.BINOM.INV,e.EXPONDIST=o.EXPON.DIST,e.ERFCPRECISE=u.ERFC.PRECISE,e.ERFPRECISE=u.ERF.PRECISE,e.FDIST=o.F.DIST,e.FDISTRT=o.F.DIST.RT,e.FINVRT=o.F.INV.RT,e.FINV=o.F.INV,e.FLOOR=n(i.FLOOR.MATH,i.FLOOR),e.FLOORMATH=i.FLOOR.MATH,e.FLOORPRECISE=i.FLOOR.PRECISE,e.FTEST=o.F.TEST,e.GAMMADIST=o.GAMMA.DIST,e.GAMMAINV=o.GAMMA.INV,e.GAMMALNPRECISE=o.GAMMALN.PRECISE,e.HYPGEOMDIST=o.HYPGEOM.DIST,e.LOGINV=o.LOGNORM.INV,e.LOGNORMINV=o.LOGNORM.INV,e.LOGNORMDIST=o.LOGNORM.DIST,e.MODE=n(o.MODE.SNGL,o.MODE),e.MODEMULT=o.MODE.MULT,e.MODESNGL=o.MODE.SNGL,e.NEGBINOMDIST=o.NEGBINOM.DIST,e.NETWORKDAYSINTL=a.NETWORKDAYS.INTL,e.NORMDIST=o.NORM.DIST,e.NORMINV=o.NORM.INV,e.NORMSDIST=o.NORM.S.DIST,e.NORMSINV=o.NORM.S.INV,e.PERCENTILE=n(o.PERCENTILE.EXC,o.PERCENTILE),e.PERCENTILEEXC=o.PERCENTILE.EXC,e.PERCENTILEINC=o.PERCENTILE.INC,e.PERCENTRANK=n(o.PERCENTRANK.INC,o.PERCENTRANK),e.PERCENTRANKEXC=o.PERCENTRANK.EXC,e.PERCENTRANKINC=o.PERCENTRANK.INC,e.POISSON=n(o.POISSON.DIST,o.POISSON),e.POISSONDIST=o.POISSON.DIST,e.QUARTILE=n(o.QUARTILE.INC,o.QUARTILE),e.QUARTILEEXC=o.QUARTILE.EXC,e.QUARTILEINC=o.QUARTILE.INC,e.RANK=n(o.RANK.EQ,o.RANK),e.RANKAVG=o.RANK.AVG,e.RANKEQ=o.RANK.EQ,e.SKEWP=o.SKEW.P,e.STDEV=n(o.STDEV.S,o.STDEV),e.STDEVP=o.STDEV.P,e.STDEVS=o.STDEV.S,e.TDIST=o.T.DIST,e.TDISTRT=o.T.DIST.RT,e.TINV=o.T.INV,e.TTEST=o.T.TEST,e.VAR=n(o.VAR.S,o.VAR),e.VARP=o.VAR.P,e.VARS=o.VAR.S,e.WEIBULL=n(o.WEIBULL.DIST,o.WEIBULL),e.WEIBULLDIST=o.WEIBULL.DIST,e.WORKDAYINTL=a.WORKDAY.INTL,e.ZTEST=o.Z.TEST},function(r,e,t){e.bg=t(28),e["cs-CZ"]=t(29),e["da-DK"]=t(30),e["de-AT"]=t(31),e["de-CH"]=t(32),e["de-DE"]=t(33),e["de-LI"]=t(34),e.el=t(35),e["en-AU"]=t(36),e["en-GB"]=t(37),e["en-IE"]=t(38),e["en-NZ"]=t(39),e["en-ZA"]=t(40),e["es-AR"]=t(41),e["es-CL"]=t(42),e["es-CO"]=t(43),e["es-CR"]=t(44),e["es-ES"]=t(45),e["es-NI"]=t(46),e["es-PE"]=t(47),e["es-PR"]=t(48),e["es-SV"]=t(49),e["et-EE"]=t(50),e["fa-IR"]=t(51),e["fi-FI"]=t(52),e["fil-PH"]=t(53),e["fr-CA"]=t(54),e["fr-CH"]=t(55),e["fr-FR"]=t(56),e["he-IL"]=t(57),e["hu-HU"]=t(58),e.id=t(59),e["it-CH"]=t(60),e["it-IT"]=t(61),e["ja-JP"]=t(62),e["ko-KR"]=t(63),e["lv-LV"]=t(64),e["nb-NO"]=t(65),e.nb=t(66),e["nl-BE"]=t(67),e["nl-NL"]=t(68),e.nn=t(69),e["pl-PL"]=t(70),e["pt-BR"]=t(71),e["pt-PT"]=t(72),e["ro-RO"]=t(73),e.ro=t(74),e["ru-RU"]=t(75),e["ru-UA"]=t(76),e["sk-SK"]=t(77),e.sl=t(78),e["sr-Cyrl-RS"]=t(79),e["sv-SE"]=t(80),e["th-TH"]=t(81),e["tr-TR"]=t(82),e["uk-UA"]=t(83),e["zh-CN"]=t(84),e["zh-MO"]=t(85),e["zh-SG"]=t(86),e["zh-TW"]=t(87)},function(r,e){/*! +(function(){"use strict";function u(r){this._value=r}function a(r){return 0===r?1:Math.floor(Math.log(Math.abs(r))/Math.LN10)+1}function s(r){var e,t="";for(e=0;r>e;e++)t+="0";return t}function l(r,e){var t,n,i,o,u,a,l,f;return f=""+r,t=f.split("e")[0],o=f.split("e")[1],n=t.split(".")[0],i=t.split(".")[1]||"",+o>0?f=n+i+s(o-i.length):(u=0>+n?"-0":"0",e>0&&(u+="."),l=s(-1*o-1),a=(l+Math.abs(n)+i).substr(0,e),f=u+a),+o>0&&e>0&&(f+="."+s(e)),f}function f(r,e,t,n){var i,o,u=Math.pow(10,e);return(""+r).indexOf("e")>-1?(o=l(r,e),"-"!==o.charAt(0)||0>+o||(o=o.substr(1))):o=(t(r+"e+"+e)/u).toFixed(e),n&&(i=RegExp("0{1,"+n+"}$"),o=o.replace(i,"")),o}function c(r,e,t){var n=e.replace(/\{[^\{\}]*\}/g,"");return n.indexOf("$")>-1?p(r,C[$].currency.symbol,e,t):n.indexOf("%")>-1?h(r,e,t):n.indexOf(":")>-1?b(r):E(r._value,e,t)}function d(r,e){var t,n,i,o,u,a=e,s=!1;if(e.indexOf(":")>-1)r._value=v(e);else if(e===O)r._value=0;else{for("."!==C[$].delimiters.decimal&&(e=e.replace(/\./g,"").replace(C[$].delimiters.decimal,".")),t=RegExp("[^a-zA-Z]"+C[$].abbreviations.thousand+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),n=RegExp("[^a-zA-Z]"+C[$].abbreviations.million+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),i=RegExp("[^a-zA-Z]"+C[$].abbreviations.billion+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),o=RegExp("[^a-zA-Z]"+C[$].abbreviations.trillion+"(?:\\)|(\\"+C[$].currency.symbol+")?(?:\\))?)?$"),u=1;x.length>u&&!s;++u)e.indexOf(x[u])>-1?s=Math.pow(1024,u):e.indexOf(A[u])>-1&&(s=Math.pow(1e3,u));var l=e.replace(/[^0-9\.]+/g,"");""===l?r._value=NaN:(r._value=(s||1)*(a.match(t)?Math.pow(10,3):1)*(a.match(n)?Math.pow(10,6):1)*(a.match(i)?Math.pow(10,9):1)*(a.match(o)?Math.pow(10,12):1)*(e.indexOf("%")>-1?.01:1)*((e.split("-").length+Math.min(e.split("(").length-1,e.split(")").length-1))%2?1:-1)*+l,r._value=s?Math.ceil(r._value):r._value)}return r._value}function p(r,e,t,n){var i,o,u=t,a=u.indexOf("$"),s=u.indexOf("("),l=u.indexOf("+"),f=u.indexOf("-"),c="",d="";if(-1===u.indexOf("$")?"infix"===C[$].currency.position?(d=e,C[$].currency.spaceSeparated&&(d=" "+d+" ")):C[$].currency.spaceSeparated&&(c=" "):u.indexOf(" $")>-1?(c=" ",u=u.replace(" $","")):u.indexOf("$ ")>-1?(c=" ",u=u.replace("$ ","")):u=u.replace("$",""),o=E(r._value,u,n,d),-1===t.indexOf("$"))switch(C[$].currency.position){case"postfix":o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,c+e),o=o.join("")):o=o+c+e;break;case"infix":break;case"prefix":o.indexOf("(")>-1||o.indexOf("-")>-1?(o=o.split(""),i=Math.max(s,f)+1,o.splice(i,0,e+c),o=o.join("")):o=e+c+o;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else a>1?o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,c+e),o=o.join("")):o=o+c+e:o.indexOf("(")>-1||o.indexOf("+")>-1||o.indexOf("-")>-1?(o=o.split(""),i=1,(s>a||l>a||f>a)&&(i=0),o.splice(i,0,e+c),o=o.join("")):o=e+c+o;return o}function m(r,e,t,n){return p(r,e,t,n)}function h(r,e,t){var n,i="",o=100*r._value;return e.indexOf(" %")>-1?(i=" ",e=e.replace(" %","")):e=e.replace("%",""),n=E(o,e,t),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,i+"%"),n=n.join("")):n=n+i+"%",n}function b(r){var e=Math.floor(r._value/60/60),t=Math.floor((r._value-60*e*60)/60),n=Math.round(r._value-60*e*60-60*t);return e+":"+(10>t?"0"+t:t)+":"+(10>n?"0"+n:n)}function v(r){var e=r.split(":"),t=0;return 3===e.length?(t+=60*+e[0]*60,t+=60*+e[1],t+=+e[2]):2===e.length&&(t+=60*+e[0],t+=+e[1]),+t}function g(r,e,t){var n,i,o,u=e[0],a=Math.abs(r);if(a>=t){for(n=1;e.length>n;++n)if(i=Math.pow(t,n),o=Math.pow(t,n+1),a>=i&&o>a){u=e[n],r/=i;break}u===e[0]&&(r/=Math.pow(t,e.length-1),u=e[e.length-1])}return{value:r,suffix:u}}function E(r,e,t,n){var i,o,u,l,c,d,p,m,h,b,v,E,N,y,w,I,M=!1,x=!1,A=!1,R="",S=!1,D=!1,V=!1,L=!1,_=!1,P="",U="",F=Math.abs(r),k="",B=!1,G=!1,j="";if(0===r&&null!==O)return O;if(!isFinite(r))return""+r;if(0===e.indexOf("{")){var W=e.indexOf("}");if(-1===W)throw Error('Format should also contain a "}"');b=e.slice(1,W),e=e.slice(W+1)}else b="";if(e.indexOf("}")===e.length-1&&e.length){var Y=e.indexOf("{");if(-1===Y)throw Error('Format should also contain a "{"');v=e.slice(Y+1,-1),e=e.slice(0,Y+1)}else v="";var H;for(H=e.match(-1===e.indexOf(".")?/([0-9]+).*/:/([0-9]+)\..*/),w=null===H?-1:H[1].length,-1!==e.indexOf("-")&&(B=!0),e.indexOf("(")>-1?(M=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(x=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1&&(m=e.split(".")[0].match(/[0-9]+/g)||["0"],m=parseInt(m[0],10),S=e.indexOf("aK")>=0,D=e.indexOf("aM")>=0,V=e.indexOf("aB")>=0,L=e.indexOf("aT")>=0,_=S||D||V||L,e.indexOf(" a")>-1?(R=" ",e=e.replace(" a","")):e=e.replace("a",""),u=a(r),c=u%3,c=0===c?3:c,m&&0!==F&&(d=3*~~((Math.min(m,u)-c)/3),F/=Math.pow(10,d)),u!==m&&(F>=Math.pow(10,12)&&!_||L?(R+=C[$].abbreviations.trillion,r/=Math.pow(10,12)):F=Math.pow(10,9)&&!_||V?(R+=C[$].abbreviations.billion,r/=Math.pow(10,9)):F=Math.pow(10,6)&&!_||D?(R+=C[$].abbreviations.million,r/=Math.pow(10,6)):(F=Math.pow(10,3)&&!_||S)&&(R+=C[$].abbreviations.thousand,r/=Math.pow(10,3))),l=a(r),m&&m>l&&-1===e.indexOf(".")&&(e+="[.]",e+=s(m-l))),I=0;T.length>I;++I)if(i=T[I],e.indexOf(i.marker)>-1){e.indexOf(" "+i.marker)>-1&&(P=" "),e=e.replace(P+i.marker,""),o=g(r,i.suffixes,i.scale),r=o.value,P+=o.suffix;break}if(e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(U=" ",e=e.replace(" o","")):e=e.replace("o",""),C[$].ordinal&&(U+=C[$].ordinal(r))),e.indexOf("[.]")>-1&&(A=!0,e=e.replace("[.]",".")),h=e.split(".")[1],E=e.indexOf(","),h){var q=[];if(-1!==h.indexOf("*")?(k=""+r,q=k.split("."),q.length>1&&(k=f(r,q[1].length,t))):h.indexOf("[")>-1?(h=h.replace("]",""),h=h.split("["),k=f(r,h[0].length+h[1].length,t,h[1].length)):k=f(r,h.length,t),q=k.split("."),p=q[0],q.length>1&&q[1].length){k=(n?R+n:C[$].delimiters.decimal)+q[1]}else k="";A&&0==+k.slice(1)&&(k="")}else p=f(r,0,t);return p.indexOf("-")>-1&&(p=p.slice(1),G=!0),w>p.length&&(p=s(w-p.length)+p),E>-1&&(p=(""+p).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+C[$].delimiters.thousands)),0===e.indexOf(".")&&(p=""),N=e.indexOf("("),y=e.indexOf("-"),j=y>N?(M&&G?"(":"")+(B&&G||!M&&G?"-":""):(B&&G||!M&&G?"-":"")+(M&&G?"(":""),b+j+(!G&&x&&0!==r?"+":"")+p+k+(U||"")+(R&&!n?R:"")+(P||"")+(M&&G?")":"")+v}function N(r,e){C[r]=e}function y(r){$=r;var e=C[r].defaults;e&&e.format&&M.defaultFormat(e.format),e&&e.currencyFormat&&M.defaultCurrencyFormat(e.currencyFormat)}function w(r){var e=(""+r).split(".");return 2>e.length?1:Math.pow(10,e[1].length)}function I(){return Array.prototype.slice.call(arguments).reduce(function(r,e){var t=w(r),n=w(e);return t>n?t:n},-Infinity)}var M,x=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],A=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],R={general:{scale:1024,suffixes:A,marker:"bd"},binary:{scale:1024,suffixes:x,marker:"b"},decimal:{scale:1e3,suffixes:A,marker:"d"}},T=[R.general,R.binary,R.decimal],C={},S=C,$="en-US",O=null,D="0,0",V="0$",L=void 0!==r&&r.exports,_={delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(r){var e=r%10;return 1==~~(r%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$",position:"prefix"},defaults:{currencyFormat:",0000 a"},formats:{fourDigits:"0000 a",fullWithTwoDecimals:"$ ,0.00",fullWithTwoDecimalsNoCurrency:",0.00"}};M=function(r){return r=M.isNumbro(r)?r.value():"string"==typeof r||"number"==typeof r?M.fn.unformat(r):NaN,new u(+r)},M.version="1.11.0",M.isNumbro=function(r){return r instanceof u},M.setLanguage=function(r,e){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var t=r,n=r.split("-")[0],i=null;S[t]||(Object.keys(S).forEach(function(r){i||r.split("-")[0]!==n||(i=r)}),t=i||e||"en-US"),y(t)},M.setCulture=function(r,e){var t=r,n=r.split("-")[1],i=null;C[t]||(n&&Object.keys(C).forEach(function(r){i||r.split("-")[1]!==n||(i=r)}),t=i||e||"en-US"),y(t)},M.language=function(r,e){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!r)return $;if(r&&!e){if(!S[r])throw Error("Unknown language : "+r);y(r)}return!e&&S[r]||N(r,e),M},M.culture=function(r,e){if(!r)return $;if(r&&!e){if(!C[r])throw Error("Unknown culture : "+r);y(r)}return!e&&C[r]||N(r,e),M},M.languageData=function(r){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!r)return S[$];if(!S[r])throw Error("Unknown language : "+r);return S[r]},M.cultureData=function(r){if(!r)return C[$];if(!C[r])throw Error("Unknown culture : "+r);return C[r]},M.culture("en-US",_),M.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),S},M.cultures=function(){return C},M.zeroFormat=function(r){O="string"==typeof r?r:null},M.defaultFormat=function(r){D="string"==typeof r?r:"0.0"},M.defaultCurrencyFormat=function(r){V="string"==typeof r?r:"0$"},M.validate=function(r,e){var t,n,i,o,u,a,s,l;if("string"!=typeof r&&(r+="",console.warn&&console.warn("Numbro.js: Value is not string. It has been co-erced to: ",r)),r=r.trim(),r=r.replace(/^[+-]?/,""),r.match(/^\d+$/))return!0;if(""===r)return!1;try{s=M.cultureData(e)}catch(f){s=M.cultureData(M.culture())}return i=s.currency.symbol,u=s.abbreviations,t=s.delimiters.decimal,n="."===s.delimiters.thousands?"\\.":s.delimiters.thousands,(null===(l=r.match(/^[^\d\.\,]+/))||(r=r.substr(1),l[0]===i))&&((null===(l=r.match(/[^\d]+$/))||(r=r.slice(0,-1),l[0]===u.thousand||l[0]===u.million||l[0]===u.billion||l[0]===u.trillion))&&(a=RegExp(n+"{2}"),!r.match(/[^\d.,]/g)&&(o=r.split(t),2>=o.length&&(2>o.length?!!o[0].match(/^\d+.*\d$/)&&!o[0].match(a):""===o[0]?!o[0].match(a)&&!!o[1].match(/^\d+$/):1===o[0].length?!!o[0].match(/^\d+$/)&&!o[0].match(a)&&!!o[1].match(/^\d+$/):!!o[0].match(/^\d+.*\d$/)&&!o[0].match(a)&&!!o[1].match(/^\d+$/)))))},M.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),M.loadCulturesInNode()},M.loadCulturesInNode=function(){var r=t(27);for(var e in r)e&&M.culture(e,r[e])},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(r,e){if(null===this||void 0===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof r)throw new TypeError(r+" is not a function");var t,n,i=this.length>>>0,o=!1;for(arguments.length>1&&(n=e,o=!0),t=0;i>t;++t)this.hasOwnProperty(t)&&(o?n=r(n,this[t],t,this):(n=this[t],o=!0));if(!o)throw new TypeError("Reduce of empty array with no initial value");return n}),M.fn=u.prototype={clone:function(){return M(this)},format:function(r,e){return c(this,r||D,e!==undefined?e:Math.round)},formatCurrency:function(r,e){return p(this,C[$].currency.symbol,r||V,e!==undefined?e:Math.round)},formatForeignCurrency:function(r,e,t){return m(this,r,e||V,t!==undefined?t:Math.round)},unformat:function(r){if("number"==typeof r)return r;if("string"==typeof r){var e=d(this,r);return isNaN(e)?undefined:e}return undefined},binaryByteUnits:function(){return g(this._value,R.binary.suffixes,R.binary.scale).suffix},byteUnits:function(){return g(this._value,R.general.suffixes,R.general.scale).suffix},decimalByteUnits:function(){return g(this._value,R.decimal.suffixes,R.decimal.scale).suffix},value:function(){return this._value},valueOf:function(){return this._value},set:function(r){return this._value=+r,this},add:function(r){function e(r,e){return r+t*e}var t=I.call(null,this._value,r);return this._value=[this._value,r].reduce(e,0)/t,this},subtract:function(r){function e(r,e){return r-t*e}var t=I.call(null,this._value,r);return this._value=[r].reduce(e,this._value*t)/t,this},multiply:function(r){function e(r,e){var t=I(r,e),n=r*t;return n*=e*t,n/=t*t}return this._value=[this._value,r].reduce(e,1),this},divide:function(r){function e(r,e){var t=I(r,e);return r*t/(e*t)}return this._value=[this._value,r].reduce(e),this},difference:function(r){return Math.abs(M(this._value).subtract(r).value())}},function(){return void 0!==n&&n.browser===undefined&&n.title&&(-1!==n.title.indexOf("node")||n.title.indexOf("meteor-tool")>0||"grunt"===n.title||"gulp"===n.title)&&!0}()&&M.loadCulturesInNode(),L?r.exports=M:("undefined"==typeof ender&&(this.numbro=M),i=[],(o=function(){return M}.apply(e,i))!==undefined&&(r.exports=o))}).call("undefined"==typeof window?this:window)}).call(e,t(10))},function(r,e){function t(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function i(r){if(f===setTimeout)return setTimeout(r,0);if((f===t||!f)&&setTimeout)return f=setTimeout,setTimeout(r,0);try{return f(r,0)}catch(e){try{return f.call(null,r,0)}catch(e){return f.call(this,r,0)}}}function o(r){if(c===clearTimeout)return clearTimeout(r);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(r);try{return c(r)}catch(e){try{return c.call(null,r)}catch(e){return c.call(this,r)}}}function u(){h&&p&&(h=!1,p.length?m=p.concat(m):b=-1,m.length&&a())}function a(){if(!h){var r=i(u);h=!0;for(var e=m.length;e;){for(p=m,m=[];++b1)for(var t=1;arguments.length>t;t++)e[t-1]=arguments[t];m.push(new s(r,e)),1!==m.length||h||i(a)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=l,d.addListener=l,d.once=l,d.off=l,d.removeListener=l,d.removeAllListeners=l,d.emit=l,d.binding=function(r){throw Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(r){throw Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,n){!function(r,t){e.exports=t()}(0,function(){var e=function(r,e){function t(e,t){var n=e>t?e:t;return r.pow(10,17-~~(r.log(n>0?n:-n)*r.LOG10E))}function n(r){return"[object Function]"===p.call(r)}function o(r){return"number"==typeof r&&r===r}function u(r){return c.apply([],r)}function a(){return new a._init(arguments)}function s(){return 0}function l(){return 1}function f(r,e){return r===e?1:0}var c=Array.prototype.concat,d=Array.prototype.slice,p=Object.prototype.toString,m=Array.isArray||function(r){return"[object Array]"===p.call(r)};a.fn=a.prototype,a._init=function(r){var e;if(m(r[0]))if(m(r[0][0])){n(r[1])&&(r[0]=a.map(r[0],r[1]));for(var e=0;r[0].length>e;e++)this[e]=r[0][e];this.length=r[0].length}else this[0]=n(r[1])?a.map(r[0],r[1]):r[0],this.length=1;else if(o(r[0]))this[0]=a.seq.apply(null,r),this.length=1;else{if(r[0]instanceof a)return a(r[0].toArray());this[0]=[],this.length=1}return this},a._init.prototype=a.prototype,a._init.constructor=a,a.utils={calcRdx:t,isArray:m,isFunction:n,isNumber:o,toVector:u},a.extend=function(r){var e,t;if(1===arguments.length){for(t in r)a[t]=r[t];return this}for(var e=1;arguments.length>e;e++)for(t in arguments[e])r[t]=arguments[e][t];return r},a.rows=function(r){return r.length||1},a.cols=function(r){return r[0].length||1},a.dimensions=function(r){return{rows:a.rows(r),cols:a.cols(r)}},a.row=function(r,e){return m(e)?e.map(function(e){return a.row(r,e)}):r[e]},a.rowa=function(r,e){return a.row(r,e)},a.col=function(r,e){if(m(e)){var t=a.arange(r.length).map(function(r){return Array(e.length)});return e.forEach(function(e,n){a.arange(r.length).forEach(function(i){t[i][n]=r[i][e]})}),t}for(var n=Array(r.length),i=0;r.length>i;i++)n[i]=[r[i][e]];return n},a.cola=function(r,e){return a.col(r,e).map(function(r){return r[0]})},a.diag=function(r){for(var e=a.rows(r),t=Array(e),n=0;e>n;n++)t[n]=[r[n][n]];return t},a.antidiag=function(r){for(var e=a.rows(r)-1,t=Array(e),n=0;e>=0;e--,n++)t[n]=[r[n][e]];return t},a.transpose=function(r){var e,t,n,i,o,u=[];m(r[0])||(r=[r]),t=r.length,n=r[0].length;for(var o=0;n>o;o++){for(e=Array(t),i=0;t>i;i++)e[i]=r[i][o];u.push(e)}return 1===u.length?u[0]:u},a.map=function(r,e,t){var n,i,o,u,a;for(m(r[0])||(r=[r]),i=r.length,o=r[0].length,u=t?r:Array(i),n=0;i>n;n++)for(u[n]||(u[n]=Array(o)),a=0;o>a;a++)u[n][a]=e(r[n][a],n,a);return 1===u.length?u[0]:u},a.cumreduce=function(r,e,t){var n,i,o,u,a;for(m(r[0])||(r=[r]),i=r.length,o=r[0].length,u=t?r:Array(i),n=0;i>n;n++)for(u[n]||(u[n]=Array(o)),o>0&&(u[n][0]=r[n][0]),a=1;o>a;a++)u[n][a]=e(u[n][a-1],r[n][a]);return 1===u.length?u[0]:u},a.alter=function(r,e){return a.map(r,e,!0)},a.create=function(r,e,t){var i,o,u=Array(r);n(e)&&(t=e,e=r);for(var i=0;r>i;i++)for(u[i]=Array(e),o=0;e>o;o++)u[i][o]=t(i,o);return u},a.zeros=function(r,e){return o(e)||(e=r),a.create(r,e,s)},a.ones=function(r,e){return o(e)||(e=r),a.create(r,e,l)},a.rand=function(e,t){return o(t)||(t=e),a.create(e,t,r.random)},a.identity=function(r,e){return o(e)||(e=r),a.create(r,e,f)},a.symmetric=function(r){var e,t,n=r.length;if(r.length!==r[0].length)return!1;for(e=0;n>e;e++)for(t=0;n>t;t++)if(r[t][e]!==r[e][t])return!1;return!0},a.clear=function(r){return a.alter(r,s)},a.seq=function(r,e,i,o){n(o)||(o=!1);var u,a=[],s=t(r,e),l=(e*s-r*s)/((i-1)*s),f=r;for(u=0;e>=f&&i>u;u++,f=(r*s+l*s*u)/s)a.push(o?o(f,u):f);return a},a.arange=function(r,t,n){var o=[];if(n=n||1,t===e&&(t=r,r=0),r===t||0===n)return[];if(t>r&&0>n)return[];if(r>t&&n>0)return[];if(n>0)for(i=r;it;i+=n)o.push(i);return o},a.slice=function(){function r(r,t,n,i){var o,u=[],s=r.length;if(t===e&&n===e&&i===e)return a.copy(r);if(t=t||0,n=n||r.length,t=0>t?s+t:t,n=0>n?s+n:n,i=i||1,t===n||0===i)return[];if(n>t&&0>i)return[];if(t>n&&i>0)return[];if(i>0)for(o=t;n>o;o+=i)u.push(r[o]);else for(o=t;o>n;o+=i)u.push(r[o]);return u}function t(e,t){if(t=t||{},o(t.row)){if(o(t.col))return e[t.row][t.col];var n=a.rowa(e,t.row),i=t.col||{};return r(n,i.start,i.end,i.step)}if(o(t.col)){var u=a.cola(e,t.col),s=t.row||{};return r(u,s.start,s.end,s.step)}var s=t.row||{},i=t.col||{};return r(e,s.start,s.end,s.step).map(function(e){return r(e,i.start,i.end,i.step)})}return t}(),a.sliceAssign=function(t,n,i){if(o(n.row)){if(o(n.col))return t[n.row][n.col]=i;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||t[0].length,n.col.step=n.col.step||1;var u=a.arange(n.col.start,r.min(t.length,n.col.end),n.col.step),s=n.row;return u.forEach(function(r,e){t[s][r]=i[e]}),t}if(o(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||t.length,n.row.step=n.row.step||1;var l=a.arange(n.row.start,r.min(t[0].length,n.row.end),n.row.step),f=n.col;return l.forEach(function(r,e){t[r][f]=i[e]}),t}i[0].length===e&&(i=[i]),n.row.start=n.row.start||0,n.row.end=n.row.end||t.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||t[0].length,n.col.step=n.col.step||1;var l=a.arange(n.row.start,r.min(t.length,n.row.end),n.row.step),u=a.arange(n.col.start,r.min(t[0].length,n.col.end),n.col.step);return l.forEach(function(r,e){u.forEach(function(n,o){t[r][n]=i[e][o]})}),t},a.diagonal=function(r){var e=a.zeros(r.length,r.length);return r.forEach(function(r,t){e[t][t]=r}),e},a.copy=function(r){return r.map(function(r){return o(r)?r:r.map(function(r){return r})})};var h=a.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?d.call(this):d.call(this)[0]},h.map=function(r,e){return a(a.map(this,r,e))},h.cumreduce=function(r,e){return a(a.cumreduce(this,r,e))},h.alter=function(r){return a.alter(this,r),this},function(r){for(var e=0;r.length>e;e++)!function(r){h[r]=function(e){var t,n=this;return e?(setTimeout(function(){e.call(n,h[r].call(n))}),this):(t=a[r](this),m(t)?a(t):t)}}(r[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){h[r]=function(e,t){var n=this;return t?(setTimeout(function(){t.call(n,h[r].call(n,e))}),this):a(a[r](this,e))}}(r[e])}("row col".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){h[r]=Function("return jStat(jStat."+r+".apply(null, arguments));")}(r[e])}("create zeros ones rand identity".split(" ")),a}(Math);return function(r,e){function t(r,e){return r-e}function n(r,t,n){return e.max(t,e.min(r,n))}var i=r.utils.isFunction;r.sum=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},r.sumsqrd=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t]*r[t];return e},r.sumsqerr=function(e){for(var t,n=r.mean(e),i=0,o=e.length;--o>=0;)t=e[o]-n,i+=t*t;return i},r.sumrow=function(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},r.product=function(r){for(var e=1,t=r.length;--t>=0;)e*=r[t];return e},r.min=function(r){for(var e=r[0],t=0;++tr[t]&&(e=r[t]);return e},r.max=function(r){for(var e=r[0],t=0;++te&&(e=r[t]);return e},r.unique=function(r){for(var e={},t=[],n=0;r.length>n;n++)e[r[n]]||(e[r[n]]=!0,t.push(r[n]));return t},r.mean=function(e){return r.sum(e)/e.length},r.meansqerr=function(e){return r.sumsqerr(e)/e.length},r.geomean=function(t){return e.pow(r.product(t),1/t.length)},r.median=function(r){var e=r.length,n=r.slice().sort(t);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},r.cumsum=function(e){return r.cumreduce(e,function(r,e){return r+e})},r.cumprod=function(e){return r.cumreduce(e,function(r,e){return r*e})},r.diff=function(r){for(var e,t=[],n=r.length,e=1;n>e;e++)t.push(r[e]-r[e-1]);return t},r.rank=function(r){for(var e=r.length,n=r.slice().sort(t),i=Array(e),o=0;e>o;o++){var u=n.indexOf(r[o]),a=n.lastIndexOf(r[o]);if(u===a)var s=u;else var s=(u+a)/2;i[o]=s+1}return i},r.mode=function(r){for(var e,n=r.length,i=r.slice().sort(t),o=1,u=0,a=0,s=[],e=0;n>e;e++)i[e]===i[e+1]?o++:(o>u?(s=[i[e]],u=o,a=0):o===u&&(s.push(i[e]),a++),o=1);return 0===a?s[0]:s},r.range=function(e){return r.max(e)-r.min(e)},r.variance=function(e,t){return r.sumsqerr(e)/(e.length-(t?1:0))},r.pooledvariance=function(e){return e.reduce(function(e,t){return e+r.sumsqerr(t)},0)/(e.reduce(function(r,e){return r+e.length},0)-e.length)},r.deviation=function(e){for(var t=r.mean(e),n=e.length,i=Array(n),o=0;n>o;o++)i[o]=e[o]-t;return i},r.stdev=function(t,n){return e.sqrt(r.variance(t,n))},r.pooledstdev=function(t){return e.sqrt(r.pooledvariance(t))},r.meandev=function(t){for(var n=r.mean(t),i=[],o=t.length-1;o>=0;o--)i.push(e.abs(t[o]-n));return r.mean(i)},r.meddev=function(t){for(var n=r.median(t),i=[],o=t.length-1;o>=0;o--)i.push(e.abs(t[o]-n));return r.median(i)},r.coeffvar=function(e){return r.stdev(e)/r.mean(e)},r.quartiles=function(r){var n=r.length,i=r.slice().sort(t);return[i[e.round(n/4)-1],i[e.round(n/2)-1],i[e.round(3*n/4)-1]]},r.quantiles=function(r,i,o,u){var a,s,l,f,c,d,p=r.slice().sort(t),m=[i.length],h=r.length;void 0===o&&(o=3/8),void 0===u&&(u=3/8);for(var a=0;i.length>a;a++)s=i[a],l=o+s*(1-o-u),f=h*s+l,c=e.floor(n(f,1,h-1)),d=n(f-c,0,1),m[a]=(1-d)*p[c-1]+d*p[c];return m},r.percentile=function(r,e){var n=r.slice().sort(t),i=e*(n.length-1),o=parseInt(i),u=i-o;return n.length>o+1?n[o]*(1-u)+n[o+1]*u:n[o]},r.percentileOfScore=function(r,e,t){var n,i,o=0,u=r.length,a=!1;"strict"===t&&(a=!0);for(var i=0;u>i;i++)n=r[i],(a&&e>n||!a&&e>=n)&&o++;return o/u},r.histogram=function(t,n){for(var i,o=r.min(t),u=n||4,a=(r.max(t)-o)/u,s=t.length,n=[],i=0;u>i;i++)n[i]=0;for(var i=0;s>i;i++)n[e.min(e.floor((t[i]-o)/a),u-1)]+=1;return n},r.covariance=function(e,t){for(var n,i=r.mean(e),o=r.mean(t),u=e.length,a=Array(u),n=0;u>n;n++)a[n]=(e[n]-i)*(t[n]-o);return r.sum(a)/(u-1)},r.corrcoeff=function(e,t){return r.covariance(e,t)/r.stdev(e,1)/r.stdev(t,1)},r.spearmancoeff=function(e,t){return e=r.rank(e),t=r.rank(t),r.corrcoeff(e,t)},r.stanMoment=function(t,n){for(var i=r.mean(t),o=r.stdev(t),u=t.length,a=0,s=0;u>s;s++)a+=e.pow((t[s]-i)/o,n);return a/t.length},r.skewness=function(e){return r.stanMoment(e,3)},r.kurtosis=function(e){return r.stanMoment(e,4)-3};var o=r.prototype;!function(e){for(var t=0;e.length>t;t++)!function(e){o[e]=function(t,n){var u=[],a=0,s=this;if(i(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,o[e].call(s,t))}),this;if(this.length>1){for(s=!0===t?this:this.transpose();s.length>a;a++)u[a]=r[e](s[a]);return u}return r[e](this[0],t)}}(e[t])}("cumsum cumprod".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){o[e]=function(t,n){var u=[],a=0,s=this;if(i(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,o[e].call(s,t))}),this;if(this.length>1){for("sumrow"!==e&&(s=!0===t?this:this.transpose());s.length>a;a++)u[a]=r[e](s[a]);return!0===t?r[e](r.utils.toVector(u)):u}return r[e](this[0],t)}}(e[t])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){o[e]=function(){var t=[],n=0,u=this,a=Array.prototype.slice.call(arguments);if(i(a[a.length-1])){var s=a[a.length-1],l=a.slice(0,a.length-1);return setTimeout(function(){s.call(u,o[e].apply(u,l))}),this}var s=undefined,f=function(t){return r[e].apply(u,[t].concat(a))};if(this.length>1){for(u=u.transpose();u.length>n;n++)t[n]=f(u[n]);return t}return f(this[0])}}(e[t])}("quantiles percentileOfScore".split(" "))}(e,Math),function(r,e){r.gammaln=function(r){var t,n,i,o=0,u=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(i=(n=t=r)+5.5,i-=(t+.5)*e.log(i);6>o;o++)a+=u[o]/++n;return e.log(2.5066282746310007*a/t)-i},r.gammafn=function(r){var t,n,i,o,u=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,d=r;if(0>=d){if(!(o=d%1+3.6e-16))return Infinity;s=(1&d?-1:1)*e.PI/e.sin(e.PI*o),d=1-d}i=d,n=1>d?d++:(d-=l=(0|d)-1)-1;for(var t=0;8>t;++t)c=(c+u[t])*n,f=f*n+a[t];if(o=c/f+1,d>i)o/=i;else if(i>d)for(var t=0;l>t;++t)o*=d,d++;return s&&(o=s/o),o},r.gammap=function(e,t){return r.lowRegGamma(e,t)*r.gammafn(e)},r.lowRegGamma=function(t,n){var i,o=r.gammaln(t),u=t,a=1/t,s=a,l=n+1-t,f=1/1e-30,c=1/l,d=c,p=1,m=-~(8.5*e.log(1>t?1/t:t)+.4*t+17);if(0>n||0>=t)return NaN;if(t+1>n){for(;m>=p;p++)a+=s*=n/++u;return a*e.exp(-n+t*e.log(n)-o)}for(;m>=p;p++)i=-p*(p-t),l+=2,c=i*c+l,f=l+i/f,c=1/c,d*=c*f;return 1-d*e.exp(-n+t*e.log(n)-o)},r.factorialln=function(e){return 0>e?NaN:r.gammaln(e+1)},r.factorial=function(e){return 0>e?NaN:r.gammafn(e+1)},r.combination=function(t,n){return t>170||n>170?e.exp(r.combinationln(t,n)):r.factorial(t)/r.factorial(n)/r.factorial(t-n)},r.combinationln=function(e,t){return r.factorialln(e)-r.factorialln(t)-r.factorialln(e-t)},r.permutation=function(e,t){return r.factorial(e)/r.factorial(e-t)},r.betafn=function(t,n){return t>0&&n>0?t+n>170?e.exp(r.betaln(t,n)):r.gammafn(t)*r.gammafn(n)/r.gammafn(t+n):undefined},r.betaln=function(e,t){return r.gammaln(e)+r.gammaln(t)-r.gammaln(e+t)},r.betacf=function(r,t,n){var i,o,u,a,s=1,l=t+n,f=t+1,c=t-1,d=1,p=1-l*r/f;for(1e-30>e.abs(p)&&(p=1e-30),p=1/p,a=p;100>=s&&(i=2*s,o=s*(n-s)*r/((c+i)*(t+i)),p=1+o*p,1e-30>e.abs(p)&&(p=1e-30),d=1+o/d,1e-30>e.abs(d)&&(d=1e-30),p=1/p,a*=p*d,o=-(t+s)*(l+s)*r/((t+i)*(f+i)),p=1+o*p,1e-30>e.abs(p)&&(p=1e-30),d=1+o/d,1e-30>e.abs(d)&&(d=1e-30),p=1/p,u=p*d,a*=u,3e-7<=e.abs(u-1));s++);return a},r.gammapinv=function(t,n){var i,o,u,a,s,l,f,c=0,d=n-1,p=r.gammaln(n);if(t>=1)return e.max(100,n+100*e.sqrt(n));if(0>=t)return 0;for(n>1?(l=e.log(d),f=e.exp(d*(l-1)-p),s=.5>t?t:1-t,u=e.sqrt(-2*e.log(s)),i=(2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u,.5>t&&(i=-i),i=e.max(.001,n*e.pow(1-1/(9*n)-i/(3*e.sqrt(n)),3))):(u=1-n*(.253+.12*n),i=u>t?e.pow(t/u,1/n):1-e.log(1-(t-u)/(1-u)));12>c;c++){if(0>=i)return 0;if(o=r.lowRegGamma(n,i)-t,u=n>1?f*e.exp(-(i-d)+d*(e.log(i)-l)):e.exp(-i+d*e.log(i)-p),a=o/u,i-=u=a/(1-.5*e.min(1,a*((n-1)/i-1))),i>0||(i=.5*(i+u)),e.abs(u)<1e-8*i)break}return i},r.erf=function(r){var t,n,i,o,u=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,3.81e-16,7.106e-15,-1.523e-15,-9.4e-17,1.21e-16,-2.8e-17],a=27,s=!1,l=0,f=0;for(0>r&&(r=-r,s=!0),t=2/(2+r),n=4*t-2;a>0;a--)i=l,l=n*l-f+u[a],f=i;return o=t*e.exp(-r*r+.5*(u[0]+n*l)-f),s?o-1:1-o},r.erfc=function(e){return 1-r.erf(e)},r.erfcinv=function(t){var n,i,o,u,a=0;if(t>=2)return-100;if(0>=t)return 100;for(u=1>t?t:2-t,o=e.sqrt(-2*e.log(u/2)),n=-.70711*((2.30753+.27061*o)/(1+o*(.99229+.04481*o))-o);2>a;a++)i=r.erfc(n)-u,n+=i/(1.1283791670955126*e.exp(-n*n)-n*i);return 1>t?n:-n},r.ibetainv=function(t,n,i){var o,u,a,s,l,f,c,d,p,m,h,b=n-1,v=i-1,g=0;if(0>=t)return 0;if(t>=1)return 1;for(1>n||1>i?(o=e.log(n/(n+i)),u=e.log(i/(n+i)),s=e.exp(n*o)/n,l=e.exp(i*u)/i,m=s+l,c=s/m>t?e.pow(n*m*t,1/n):1-e.pow(i*m*(1-t),1/i)):(a=.5>t?t:1-t,s=e.sqrt(-2*e.log(a)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,.5>t&&(c=-c),d=(c*c-3)/6,p=2/(1/(2*n-1)+1/(2*i-1)),m=c*e.sqrt(d+p)/p-(1/(2*i-1)-1/(2*n-1))*(d+5/6-2/(3*p)),c=n/(n+i*e.exp(2*m))),h=-r.gammaln(n)-r.gammaln(i)+r.gammaln(n+i);10>g;g++){if(0===c||1===c)return c;if(f=r.ibeta(c,n,i)-t,s=e.exp(b*e.log(c)+v*e.log(1-c)+h),l=f/s,c-=s=l/(1-.5*e.min(1,l*(b/c-v/(1-c)))),c>0||(c=.5*(c+s)),1>c||(c=.5*(c+s+1)),e.abs(s)<1e-8*c&&g>0)break}return c},r.ibeta=function(t,n,i){var o=0===t||1===t?0:e.exp(r.gammaln(n+i)-r.gammaln(n)-r.gammaln(i)+n*e.log(t)+i*e.log(1-t));return t>=0&&1>=t&&((n+1)/(n+i+2)>t?o*r.betacf(t,n,i)/n:1-o*r.betacf(1-t,i,n)/i)},r.randn=function(t,n){var i,o,u,a,s;if(n||(n=t),t)return r.create(t,n,function(){return r.randn()});do{i=e.random(),o=1.7156*(e.random()-.5),u=i-.449871,a=e.abs(o)+.386595,s=u*u+a*(.196*a-.25472*u)}while(s>.27597&&(s>.27846||o*o>-4*e.log(i)*i*i));return o/i},r.randg=function(t,n,i){var o,u,a,s,l,f,c=t;if(i||(i=n),t||(t=1),n)return f=r.zeros(n,i),f.alter(function(){return r.randg(t)}),f;1>t&&(t+=1),o=t-1/3,u=1/e.sqrt(9*o);do{do{l=r.randn(),s=1+u*l}while(0>=s);s*=s*s,a=e.random()}while(a>1-.331*e.pow(l,4)&&e.log(a)>.5*l*l+o*(1-s+e.log(s)));if(t==c)return o*s;do{a=e.random()}while(0===a);return e.pow(a,1/c)*o*s},function(e){for(var t=0;e.length>t;t++)!function(e){r.fn[e]=function(){return r(r.map(this,function(t){return r[e](t)}))}}(e[t])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){r.fn[e]=function(){return r(r[e].apply(null,arguments))}}(e[t])}("randn".split(" "))}(e,Math),function(r,e){function t(r){return r/e.abs(r)}function n(t,n,i){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],u=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*t;if(a>=8)return 1;var s=2*r.normal.cdf(a,0,1,1,0)-1;s=s3?2:3;for(var f=a,c=(8-a)/l,d=f+c,p=0,m=i-1,h=1;l>=h;h++){for(var b=0,v=.5*(d+f),g=.5*(d-f),E=1;12>=E;E++){var N,y;E>6?(N=12-E+1,y=o[N-1]):(N=E,y=-o[N-1]);var w=g*y,I=v+w,M=I*I;if(M>60)break;var x=2*r.normal.cdf(I,0,1,1,0),A=2*r.normal.cdf(I,t,1,1,0),R=.5*x-.5*A;Re.exp(-30/n)?(s=e.pow(s,n),1>s?s:1):0}function i(r,t,n){var i=.5-.5*r,o=e.sqrt(e.log(1/(i*i))),u=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);120>n&&(u+=(u*u*u+u)/n/4);var a=.8832-.2368*u;return 120>n&&(a+=-1.214/n+1.208*u/n),u*(a*e.log(t-1)+1.4142)}!function(e){for(var t=0;e.length>t;t++)!function(e){r[e]=function(r,e,t){return this instanceof arguments.callee?(this._a=r,this._b=e,this._c=t,this):new arguments.callee(r,e,t)},r.fn[e]=function(t,n,i){var o=r[e](t,n,i);return o.data=this,o},r[e].prototype.sample=function(t){var n=this._a,i=this._b,o=this._c;return t?r.alter(t,function(){return r[e].sample(n,i,o)}):r[e].sample(n,i,o)},function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(n){var i=this._a,o=this._b,u=this._c;return n||0===n||(n=this.data),"number"!=typeof n?r.fn.map.call(n,function(n){return r[e][t](n,i,o,u)}):r[e][t](n,i,o,u)}}(t[n])}("pdf cdf inv".split(" ")),function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(){return r[e][t](this._a,this._b,this._c)}}(t[n])}("mean median mode variance".split(" "))}(e[t])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),r.extend(r.beta,{pdf:function(t,n,i){return t>1||0>t?0:1==n&&1==i?1:512>n&&512>i?e.pow(t,n-1)*e.pow(1-t,i-1)/r.betafn(n,i):e.exp((n-1)*e.log(t)+(i-1)*e.log(1-t)-r.betaln(n,i))},cdf:function(e,t,n){return e>1||0>e?1*(e>1):r.ibeta(e,t,n)},inv:function(e,t,n){return r.ibetainv(e,t,n)},mean:function(r,e){return r/(r+e)},median:function(e,t){return r.ibetainv(.5,e,t)},mode:function(r,e){return(r-1)/(r+e-2)},sample:function(e,t){var n=r.randg(e);return n/(n+r.randg(t))},variance:function(r,t){return r*t/(e.pow(r+t,2)*(r+t+1))}}),r.extend(r.centralF,{pdf:function(t,n,i){var o,u;return 0>t?0:n>2?(o=n*t/(i+t*n),u=i/(i+t*n),n*u/2*r.binomial.pdf((n-2)/2,(n+i-2)/2,o)):0===t&&2>n?Infinity:0===t&&2===n?1:1/r.betafn(n/2,i/2)*e.pow(n/i,n/2)*e.pow(t,n/2-1)*e.pow(1+n/i*t,-(n+i)/2)},cdf:function(e,t,n){return 0>e?0:r.ibeta(t*e/(t*e+n),t/2,n/2)},inv:function(e,t,n){return n/(t*(1/r.ibetainv(e,t/2,n/2)-1))},mean:function(r,e){return e>2?e/(e-2):undefined},mode:function(r,e){return r>2?e*(r-2)/(r*(e+2)):undefined},sample:function(e,t){return 2*r.randg(e/2)/e/(2*r.randg(t/2)/t)},variance:function(r,e){return e>4?2*e*e*(r+e-2)/(r*(e-2)*(e-2)*(e-4)):undefined}}),r.extend(r.cauchy,{pdf:function(r,t,n){return 0>n?0:n/(e.pow(r-t,2)+e.pow(n,2))/e.PI},cdf:function(r,t,n){return e.atan((r-t)/n)/e.PI+.5},inv:function(r,t,n){return t+n*e.tan(e.PI*(r-.5))},median:function(r,e){return r},mode:function(r,e){return r},sample:function(t,n){return r.randn()*e.sqrt(1/(2*r.randg(.5)))*n+t}}),r.extend(r.chisquare,{pdf:function(t,n){return 0>t?0:0===t&&2===n?.5:e.exp((n/2-1)*e.log(t)-t/2-n/2*e.log(2)-r.gammaln(n/2))},cdf:function(e,t){return 0>e?0:r.lowRegGamma(t/2,e/2)},inv:function(e,t){return 2*r.gammapinv(e,.5*t)},mean:function(r){return r},median:function(r){return r*e.pow(1-2/(9*r),3)},mode:function(r){return r-2>0?r-2:0},sample:function(e){return 2*r.randg(e/2)},variance:function(r){return 2*r}}),r.extend(r.exponential,{pdf:function(r,t){return 0>r?0:t*e.exp(-t*r)},cdf:function(r,t){return 0>r?0:1-e.exp(-t*r)},inv:function(r,t){return-e.log(1-r)/t},mean:function(r){return 1/r},median:function(r){return 1/r*e.log(2)},mode:function(r){return 0},sample:function(r){return-1/r*e.log(e.random())},variance:function(r){return e.pow(r,-2)}}),r.extend(r.gamma,{pdf:function(t,n,i){return 0>t?0:0===t&&1===n?1/i:e.exp((n-1)*e.log(t)-t/i-r.gammaln(n)-n*e.log(i))},cdf:function(e,t,n){return 0>e?0:r.lowRegGamma(t,e/n)},inv:function(e,t,n){return r.gammapinv(e,t)*n},mean:function(r,e){return r*e},mode:function(r,e){return r>1?(r-1)*e:undefined},sample:function(e,t){return r.randg(e)*t},variance:function(r,e){return r*e*e}}),r.extend(r.invgamma,{pdf:function(t,n,i){return t>0?e.exp(-(n+1)*e.log(t)-i/t-r.gammaln(n)+n*e.log(i)):0},cdf:function(e,t,n){return e>0?1-r.lowRegGamma(t,n/e):0},inv:function(e,t,n){return n/r.gammapinv(1-e,t)},mean:function(r,e){return r>1?e/(r-1):undefined},mode:function(r,e){return e/(r+1)},sample:function(e,t){return t/r.randg(e)},variance:function(r,e){return r>2?e*e/((r-1)*(r-1)*(r-2)):undefined}}),r.extend(r.kumaraswamy,{pdf:function(r,t,n){return 0===r&&1===t?n:1===r&&1===n?t:e.exp(e.log(t)+e.log(n)+(t-1)*e.log(r)+(n-1)*e.log(1-e.pow(r,t)))},cdf:function(r,t,n){return 0>r?0:r>1?1:1-e.pow(1-e.pow(r,t),n)},inv:function(r,t,n){return e.pow(1-e.pow(1-r,1/n),1/t)},mean:function(e,t){return t*r.gammafn(1+1/e)*r.gammafn(t)/r.gammafn(1+1/e+t)},median:function(r,t){return e.pow(1-e.pow(2,-1/t),1/r)},mode:function(r,t){return 1>r||1>t||1===r||1===t?undefined:e.pow((r-1)/(r*t-1),1/r)},variance:function(r,e){throw Error("variance not yet implemented")}}),r.extend(r.lognormal,{pdf:function(r,t,n){return r>0?e.exp(-e.log(r)-.5*e.log(2*e.PI)-e.log(n)-e.pow(e.log(r)-t,2)/(2*n*n)):0},cdf:function(t,n,i){return 0>t?0:.5+.5*r.erf((e.log(t)-n)/e.sqrt(2*i*i))},inv:function(t,n,i){return e.exp(-1.4142135623730951*i*r.erfcinv(2*t)+n)},mean:function(r,t){return e.exp(r+t*t/2)},median:function(r,t){return e.exp(r)},mode:function(r,t){return e.exp(r-t*t)},sample:function(t,n){return e.exp(r.randn()*n+t)},variance:function(r,t){return(e.exp(t*t)-1)*e.exp(2*r+t*t)}}),r.extend(r.noncentralt,{pdf:function(t,n,i){return 1e-14>e.abs(i)?r.studentt.pdf(t,n):1e-14>e.abs(t)?e.exp(r.gammaln((n+1)/2)-i*i/2-.5*e.log(e.PI*n)-r.gammaln(n/2)):n/t*(r.noncentralt.cdf(t*e.sqrt(1+2/n),n+2,i)-r.noncentralt.cdf(t,n,i))},cdf:function(t,n,i){if(1e-14>e.abs(i))return r.studentt.cdf(t,n);var o=!1;0>t&&(o=!0,i=-i);for(var u=r.normal.cdf(-i,0,1),a=1e-14+1,s=a,l=t*t/(t*t+n),f=0,c=e.exp(-i*i/2),d=e.exp(-i*i/2-.5*e.log(2)-r.gammaln(1.5))*i;200>f||s>1e-14||a>1e-14;)s=a,f>0&&(c*=i*i/(2*f),d*=i*i/(2*(f+.5))),a=c*r.beta.cdf(l,f+.5,n/2)+d*r.beta.cdf(l,f+1,n/2),u+=.5*a,f++;return o?1-u:u}}),r.extend(r.normal,{pdf:function(r,t,n){return e.exp(-.5*e.log(2*e.PI)-e.log(n)-e.pow(r-t,2)/(2*n*n))},cdf:function(t,n,i){return.5*(1+r.erf((t-n)/e.sqrt(2*i*i)))},inv:function(e,t,n){return-1.4142135623730951*n*r.erfcinv(2*e)+t},mean:function(r,e){return r},median:function(r,e){return r},mode:function(r,e){return r},sample:function(e,t){return r.randn()*t+e},variance:function(r,e){return e*e}}),r.extend(r.pareto,{pdf:function(r,t,n){return t>r?0:n*e.pow(t,n)/e.pow(r,n+1)},cdf:function(r,t,n){return t>r?0:1-e.pow(t/r,n)},inv:function(r,t,n){return t/e.pow(1-r,1/n)},mean:function(r,t){return t>1?t*e.pow(r,t)/(t-1):undefined},median:function(r,t){return r*(t*e.SQRT2)},mode:function(r,e){return r},variance:function(r,t){return t>2?r*r*t/(e.pow(t-1,2)*(t-2)):undefined}}),r.extend(r.studentt,{pdf:function(t,n){return n=n>1e100?1e100:n,1/(e.sqrt(n)*r.betafn(.5,n/2))*e.pow(1+t*t/n,-(n+1)/2)},cdf:function(t,n){var i=n/2;return r.ibeta((t+e.sqrt(t*t+n))/(2*e.sqrt(t*t+n)),i,i)},inv:function(t,n){var i=r.ibetainv(2*e.min(t,1-t),.5*n,.5);return i=e.sqrt(n*(1-i)/i),t>.5?i:-i},mean:function(r){return r>1?0:undefined},median:function(r){return 0},mode:function(r){return 0},sample:function(t){return r.randn()*e.sqrt(t/(2*r.randg(t/2)))},variance:function(r){return r>2?r/(r-2):r>1?Infinity:undefined}}),r.extend(r.weibull,{pdf:function(r,t,n){return 0>r||0>t||0>n?0:n/t*e.pow(r/t,n-1)*e.exp(-e.pow(r/t,n))},cdf:function(r,t,n){return 0>r?0:1-e.exp(-e.pow(r/t,n))},inv:function(r,t,n){return t*e.pow(-e.log(1-r),1/n)},mean:function(e,t){return e*r.gammafn(1+1/t)},median:function(r,t){return r*e.pow(e.log(2),1/t)},mode:function(r,t){return t>1?r*e.pow((t-1)/t,1/t):0},sample:function(r,t){return r*e.pow(-e.log(e.random()),1/t)},variance:function(t,n){return t*t*r.gammafn(1+2/n)-e.pow(r.weibull.mean(t,n),2)}}),r.extend(r.uniform,{pdf:function(r,e,t){return e>r||r>t?0:1/(t-e)},cdf:function(r,e,t){return e>r?0:t>r?(r-e)/(t-e):1},inv:function(r,e,t){return e+r*(t-e)},mean:function(r,e){return.5*(r+e)},median:function(e,t){return r.mean(e,t)},mode:function(r,e){throw Error("mode is not yet implemented")},sample:function(r,t){return r/2+t/2+(t/2-r/2)*(2*e.random()-1)},variance:function(r,t){return e.pow(t-r,2)/12}}),r.extend(r.binomial,{pdf:function(t,n,i){return 0===i||1===i?n*i===t?1:0:r.combination(n,t)*e.pow(i,t)*e.pow(1-i,n-t)},cdf:function(e,t,n){var i=[],o=0;if(0>e)return 0;if(t>e){for(;e>=o;o++)i[o]=r.binomial.pdf(o,t,n);return r.sum(i)}return 1}}),r.extend(r.negbin,{pdf:function(t,n,i){return t===t>>>0&&(0>t?0:r.combination(t+n-1,n-1)*e.pow(1-i,t)*e.pow(i,n))},cdf:function(e,t,n){var i=0,o=0;if(0>e)return 0;for(;e>=o;o++)i+=r.negbin.pdf(o,t,n);return i}}),r.extend(r.hypgeom,{pdf:function(t,n,i,o){if(t!==t|0)return!1;if(0>t||i-(n-o)>t)return 0;if(t>o||t>i)return 0;if(2*i>n)return 2*o>n?r.hypgeom.pdf(n-i-o+t,n,n-i,n-o):r.hypgeom.pdf(o-t,n,n-i,o);if(2*o>n)return r.hypgeom.pdf(i-t,n,i,n-o);if(o>i)return r.hypgeom.pdf(t,n,o,i);for(var u=1,a=0,s=0;t>s;s++){for(;u>1&&o>a;)u*=1-i/(n-a),a++;u*=(o-s)*(i-s)/((s+1)*(n-i-o+s+1))}for(;o>a;a++)u*=1-i/(n-a);return e.min(1,e.max(0,u))},cdf:function(t,n,i,o){if(0>t||i-(n-o)>t)return 0;if(o>t&&i>t){if(2*i>n)return 2*o>n?r.hypgeom.cdf(n-i-o+t,n,n-i,n-o):1-r.hypgeom.cdf(o-t-1,n,n-i,o);if(2*o>n)return 1-r.hypgeom.cdf(i-t-1,n,i,n-o);if(o>i)return r.hypgeom.cdf(t,n,o,i);for(var u=1,a=1,s=0,l=0;t>l;l++){for(;u>1&&o>s;){var f=1-i/(n-s);a*=f,u*=f,s++}a*=(o-l)*(i-l)/((l+1)*(n-i-o+l+1)),u+=a}for(;o>s;s++)u*=1-i/(n-s);return e.min(1,e.max(0,u))}return 1}}),r.extend(r.poisson,{pdf:function(t,n){return 0>n||t%1!=0||0>t?0:e.pow(n,t)*e.exp(-n)/r.factorial(t)},cdf:function(e,t){var n=[],i=0;if(0>e)return 0;for(;e>=i;i++)n.push(r.poisson.pdf(i,t));return r.sum(n)},mean:function(r){return r},variance:function(r){return r},sample:function(r){var t=1,n=0,i=e.exp(-r);do{n++,t*=e.random()}while(t>i);return n-1}}),r.extend(r.triangular,{pdf:function(r,e,t,n){return e>=t||e>n||n>t?NaN:e>r||r>t?0:n>r?2*(r-e)/((t-e)*(n-e)):r===n?2/(t-e):2*(t-r)/((t-e)*(t-n))},cdf:function(r,t,n,i){return t>=n||t>i||i>n?NaN:r>t?n>r?r>i?1-e.pow(n-r,2)/((n-t)*(n-i)):e.pow(r-t,2)/((n-t)*(i-t)):1:0},inv:function(r,t,n,i){return t>=n||t>i||i>n?NaN:r>(i-t)/(n-t)?t+(n-t)*(1-e.sqrt((1-r)*(1-(i-t)/(n-t)))):t+(n-t)*e.sqrt(r*((i-t)/(n-t)))},mean:function(r,e,t){return(r+e+t)/3},median:function(r,t,n){return n>(r+t)/2?n>(r+t)/2?r+e.sqrt((t-r)*(n-r))/e.sqrt(2):void 0:t-e.sqrt((t-r)*(t-n))/e.sqrt(2)},mode:function(r,e,t){return t},sample:function(r,t,n){var i=e.random();return(n-r)/(t-r)>i?r+e.sqrt(i*(t-r)*(n-r)):t-e.sqrt((1-i)*(t-r)*(t-n))},variance:function(r,e,t){return(r*r+e*e+t*t-r*e-r*t-e*t)/18}}),r.extend(r.arcsine,{pdf:function(r,t,n){return n>t?r>t&&n>r?2/e.PI*e.pow(e.pow(n-t,2)-e.pow(2*r-t-n,2),-.5):0:NaN},cdf:function(r,t,n){return t>r?0:n>r?2/e.PI*e.asin(e.sqrt((r-t)/(n-t))):1},inv:function(r,t,n){return t+(.5-.5*e.cos(e.PI*r))*(n-t)},mean:function(r,e){return e>r?(r+e)/2:NaN},median:function(r,e){return e>r?(r+e)/2:NaN},mode:function(r,e){throw Error("mode is not yet implemented")},sample:function(t,n){return(t+n)/2+(n-t)/2*e.sin(2*e.PI*r.uniform.sample(0,1))},variance:function(r,t){return t>r?e.pow(t-r,2)/8:NaN}}),r.extend(r.laplace,{pdf:function(r,t,n){return n>0?e.exp(-e.abs(r-t)/n)/(2*n):0},cdf:function(r,t,n){return n>0?t>r?.5*e.exp((r-t)/n):1-.5*e.exp(-(r-t)/n):0},mean:function(r,e){return r},median:function(r,e){return r},mode:function(r,e){return r},variance:function(r,e){return 2*e*e},sample:function(r,n){var i=e.random()-.5;return r-n*t(i)*e.log(1-2*e.abs(i))}}),r.extend(r.tukey,{cdf:function(t,i,o){var u=i,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(0>=t)return 0;if(2>o||2>u)return NaN;if(!Number.isFinite(t))return 1;if(o>25e3)return n(t,1,u);var l,f=.5*o,c=f*e.log(o)-o*e.log(2)-r.gammaln(f),d=f-1,p=.25*o;l=o>100?o>800?o>5e3?.125:.25:.5:1,c+=e.log(l);for(var m=0,h=1;50>=h;h++){for(var b=0,v=(2*h-1)*l,g=1;16>=g;g++){var E,N;g>8?(E=g-8-1,N=c+d*e.log(v+a[E]*l)-(a[E]*l+v)*p):(E=g-1,N=c+d*e.log(v-a[E]*l)+(a[E]*l-v)*p);var y;if(N>=-30){y=g>8?t*e.sqrt(.5*(a[E]*l+v)):t*e.sqrt(.5*(-a[E]*l+v));b+=n(y,1,u)*s[E]*e.exp(N)}}if(h*l>=1&&1e-14>=b)break;m+=b}if(b>1e-14)throw Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(t,n,o){var u=n;if(2>o||2>u)return NaN;if(0>t||t>1)return NaN;if(0===t)return 0;if(1===t)return Infinity;var a,s=i(t,u,o),l=r.tukey.cdf(s,n,o)-t;a=l>0?e.max(0,s-1):s+1;for(var f,c=r.tukey.cdf(a,n,o)-t,d=1;50>d;d++){f=a-c*(a-s)/(c-l),l=c,s=a,0>f&&(f=0,c=-t),c=r.tukey.cdf(f,n,o)-t,a=f;if(1e-4>e.abs(a-s))return f}throw Error("tukey.inv failed to converge")}})}(e,Math),function(e,t){function n(r){return u(r)||r instanceof e}var o=Array.prototype.push,u=e.utils.isArray;e.extend({add:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(r,e,n){return r+t[e][n]})):e.map(r,function(r){return r+t})},subtract:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(r,e,n){return r-t[e][n]||0})):e.map(r,function(r){return r-t})},divide:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.multiply(r,e.inv(t))):e.map(r,function(r){return r/t})},multiply:function(r,t){var i,o,u,a,s,l,f,c;if(r.length===undefined&&t.length===undefined)return r*t;if(s=r.length,l=r[0].length,f=e.zeros(s,u=n(t)?t[0].length:l),c=0,n(t)){for(;u>c;c++)for(i=0;s>i;i++){for(a=0,o=0;l>o;o++)a+=r[i][o]*t[o][c];f[i][c]=a}return 1===s&&1===c?f[0][0]:f}return e.map(r,function(r){return r*t})},outer:function(r,t){return e.multiply(r.map(function(r){return[r]}),[t])},outer:function(r,t){return e.multiply(r.map(function(r){return[r]}),[t])},dot:function(r,t){n(r[0])||(r=[r]),n(t[0])||(t=[t]);for(var i,o,u=1===r[0].length&&1!==r.length?e.transpose(r):r,a=1===t[0].length&&1!==t.length?e.transpose(t):t,s=[],l=0,f=u.length,c=u[0].length;f>l;l++){for(s[l]=[],i=0,o=0;c>o;o++)i+=u[l][o]*a[l][o];s[l]=i}return 1===s.length?s[0]:s},pow:function(r,n){return e.map(r,function(r){return t.pow(r,n)})},exp:function(r){return e.map(r,function(r){return t.exp(r)})},log:function(r){return e.map(r,function(r){return t.log(r)})},abs:function(r){return e.map(r,function(r){return t.abs(r)})},norm:function(r,e){var i=0,o=0;for(isNaN(e)&&(e=2),n(r[0])&&(r=r[0]);r.length>o;o++)i+=t.pow(t.abs(r[o]),e);return t.pow(i,1/e)},angle:function(r,n){return t.acos(e.dot(r,n)/(e.norm(r)*e.norm(n)))},aug:function(r,e){for(var t=[],n=0;r.length>n;n++)t.push(r[n].slice());for(var n=0;t.length>n;n++)o.apply(t[n],e[n]);return t},inv:function(r){for(var t,n=r.length,i=r[0].length,o=e.identity(n,i),u=e.gauss_jordan(r,o),a=[],s=0;n>s;s++)for(a[s]=[],t=i;u[0].length>t;t++)a[s][t-i]=u[s][t];return a},det:function(r){var e,t=r.length,n=2*t,i=Array(n),o=t-1,u=n-1,a=o-t+1,s=u,l=0,f=0;if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(;n>l;l++)i[l]=1;for(var l=0;t>l;l++){for(e=0;t>e;e++)i[0>a?a+t:a]*=r[l][e],i[t>s?s+t:s]*=r[l][e],a++,s--;a=--o-t+1,s=--u}for(var l=0;t>l;l++)f+=i[l];for(;n>l;l++)f-=i[l];return f},gauss_elimination:function(r,n){var i,o,u,a,s=0,l=0,f=r.length,c=r[0].length,d=1,p=0,m=[];r=e.aug(r,n),i=r[0].length;for(var s=0;f>s;s++){for(o=r[s][s],l=s,a=s+1;c>a;a++)oa;a++)u=r[s][a],r[s][a]=r[l][a],r[l][a]=u;for(l=s+1;f>l;l++)for(d=r[l][s]/r[s][s],a=s;i>a;a++)r[l][a]=r[l][a]-d*r[s][a]}for(var s=f-1;s>=0;s--){for(p=0,l=s+1;f-1>=l;l++)p+=m[l]*r[s][l];m[s]=(r[s][i-1]-p)/r[s][s]}return m},gauss_jordan:function(r,n){for(var i=e.aug(r,n),o=i.length,u=i[0].length,a=0,s=0;o>s;s++){for(var l=s,f=s+1;o>f;f++)t.abs(i[f][s])>t.abs(i[l][s])&&(l=f);var c=i[s];i[s]=i[l],i[l]=c;for(var f=s+1;o>f;f++){a=i[f][s]/i[s][s];for(var d=s;u>d;d++)i[f][d]-=i[s][d]*a}}for(var s=o-1;s>=0;s--){a=i[s][s];for(var f=0;s>f;f++)for(var d=u-1;d>s-1;d--)i[f][d]-=i[s][d]*i[f][s]/a;i[s][s]/=a;for(var d=o;u>d;d++)i[s][d]/=a}return i},triaUpSolve:function(r,t){var n,i=r[0].length,o=e.zeros(1,i)[0],u=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),u=!0),e.arange(i-1,-1,-1).forEach(function(u){n=e.arange(u+1,i).map(function(e){return o[e]*r[u][e]}),o[u]=(t[u]-e.sum(n))/r[u][u]}),u?o.map(function(r){return[r]}):o},triaLowSolve:function(r,t){var n,i=r[0].length,o=e.zeros(1,i)[0],u=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),u=!0),e.arange(i).forEach(function(i){n=e.arange(i).map(function(e){return r[i][e]*o[e]}),o[i]=(t[i]-e.sum(n))/r[i][i]}),u?o.map(function(r){return[r]}):o},lu:function(r){var t,n=r.length,o=e.identity(n),u=e.zeros(r.length,r[0].length);return e.arange(n).forEach(function(e){u[0][e]=r[0][e]}),e.arange(1,n).forEach(function(a){e.arange(a).forEach(function(n){t=e.arange(n).map(function(r){return o[a][r]*u[r][n]}),o[a][n]=(r[a][n]-e.sum(t))/u[n][n]}),e.arange(a,n).forEach(function(n){t=e.arange(a).map(function(r){return o[a][r]*u[r][n]}),u[a][n]=r[i][n]-e.sum(t)})}),[o,u]},cholesky:function(r){var n,i=r.length,o=e.zeros(r.length,r[0].length);return e.arange(i).forEach(function(u){n=e.arange(u).map(function(r){return t.pow(o[u][r],2)}),o[u][u]=t.sqrt(r[u][u]-e.sum(n)),e.arange(u+1,i).forEach(function(t){n=e.arange(u).map(function(r){return o[u][r]*o[t][r]}),o[t][u]=(r[u][t]-e.sum(n))/o[u][u]})}),o},gauss_jacobi:function(r,n,i,o){for(var u,a,s,l,f=0,c=0,d=r.length,p=[],m=[],h=[];d>f;f++)for(p[f]=[],m[f]=[],h[f]=[],c=0;d>c;c++)f>c?(p[f][c]=r[f][c],m[f][c]=h[f][c]=0):c>f?(m[f][c]=r[f][c],p[f][c]=h[f][c]=0):(h[f][c]=r[f][c],p[f][c]=m[f][c]=0);for(s=e.multiply(e.multiply(e.inv(h),e.add(p,m)),-1),a=e.multiply(e.inv(h),n),u=i,l=e.add(e.multiply(s,i),a),f=2;t.abs(e.norm(e.subtract(l,u)))>o;)u=l,l=e.add(e.multiply(s,u),a),f++;return l},gauss_seidel:function(r,n,i,o){for(var u,a,s,l,f,c=0,d=r.length,p=[],m=[],h=[];d>c;c++)for(p[c]=[],m[c]=[],h[c]=[],u=0;d>u;u++)c>u?(p[c][u]=r[c][u],m[c][u]=h[c][u]=0):u>c?(m[c][u]=r[c][u],p[c][u]=h[c][u]=0):(h[c][u]=r[c][u],p[c][u]=m[c][u]=0);for(l=e.multiply(e.multiply(e.inv(e.add(h,p)),m),-1),s=e.multiply(e.inv(e.add(h,p)),n),a=i,f=e.add(e.multiply(l,i),s),c=2;t.abs(e.norm(e.subtract(f,a)))>o;)a=f,f=e.add(e.multiply(l,a),s),c+=1;return f},SOR:function(r,n,i,o,u){for(var a,s,l,f,c,d=0,p=r.length,m=[],h=[],b=[];p>d;d++)for(m[d]=[],h[d]=[],b[d]=[],a=0;p>a;a++)d>a?(m[d][a]=r[d][a],h[d][a]=b[d][a]=0):a>d?(h[d][a]=r[d][a],m[d][a]=b[d][a]=0):(b[d][a]=r[d][a],m[d][a]=h[d][a]=0);for(f=e.multiply(e.inv(e.add(b,e.multiply(m,u))),e.subtract(e.multiply(b,1-u),e.multiply(h,u))),l=e.multiply(e.multiply(e.inv(e.add(b,e.multiply(m,u))),n),u),s=i,c=e.add(e.multiply(f,i),l),d=2;t.abs(e.norm(e.subtract(c,s)))>o;)s=c,c=e.add(e.multiply(f,s),l),d++;return c},householder:function(r){for(var n,i,o,u,a,s=r.length,l=r[0].length,f=0,c=[],d=[];s-1>f;f++){for(n=0,u=f+1;l>u;u++)n+=r[u][f]*r[u][f];for(a=r[f+1][f]>0?-1:1,n=a*t.sqrt(n),i=t.sqrt((n*n-r[f+1][f]*n)/2),c=e.zeros(s,1),c[f+1][0]=(r[f+1][f]-n)/(2*i),o=f+2;s>o;o++)c[o][0]=r[o][f]/(2*i);d=e.subtract(e.identity(s,l),e.multiply(e.multiply(c,e.transpose(c)),2)),r=e.multiply(d,e.multiply(r,d))}return r},QR:function(){function n(n){var u=n.length,a=n[0].length;n=e.copy(n),r=e.zeros(a,a);var s,l,f;for(l=0;a>l;l++){for(r[l][l]=t.sqrt(i(o(u).map(function(r){return n[r][l]*n[r][l]}))),s=0;u>s;s++)n[s][l]=n[s][l]/r[l][l];for(f=l+1;a>f;f++)for(r[l][f]=i(o(u).map(function(r){return n[r][l]*n[r][f]})),s=0;u>s;s++)n[s][f]=n[s][f]-n[s][l]*r[l][f]}return[n,r]}var i=e.sum,o=e.arange;return n}(),lstsq:function(r,t){function n(r){r=e.copy(r);var t=r.length,n=e.identity(t);return e.arange(t-1,-1,-1).forEach(function(t){e.sliceAssign(n,{row:t},e.divide(e.slice(n,{row:t}),r[t][t])),e.sliceAssign(r,{row:t},e.divide(e.slice(r,{row:t}),r[t][t])),e.arange(t).forEach(function(i){var o=e.multiply(r[i][t],-1),u=e.slice(r,{row:i}),a=e.multiply(e.slice(r,{row:t}),o);e.sliceAssign(r,{row:i},e.add(u,a));var s=e.slice(n,{row:i}),l=e.multiply(e.slice(n,{row:t}),o);e.sliceAssign(n,{row:i},e.add(s,l))})}),n}function i(r,t){var i=!1;t[0].length===undefined&&(t=t.map(function(r){return[r]}),i=!0);var o=e.QR(r),u=o[0],a=o[1],s=r[0].length,l=e.slice(u,{col:{end:s}}),f=e.slice(a,{row:{end:s}}),c=n(f),d=e.transpose(l);d[0].length===undefined&&(d=[d]);var p=e.multiply(e.multiply(c,d),t);return p.length===undefined&&(p=[[p]]),i?p.map(function(r){return r[0]}):p}return i}(),jacobi:function(r){for(var n,i,o,u,a,s,l,f,c=1,d=0,p=r.length,m=e.identity(p,p),h=[];1===c;){d++,s=r[0][1],u=0,a=1;for(var i=0;p>i;i++)for(o=0;p>o;o++)i!=o&&s0?t.PI/4:-t.PI/4:t.atan(2*r[u][a]/(r[u][u]-r[a][a]))/2,f=e.identity(p,p),f[u][u]=t.cos(l),f[u][a]=-t.sin(l),f[a][u]=t.sin(l),f[a][a]=t.cos(l),m=e.multiply(m,f),n=e.multiply(e.multiply(e.inv(f),r),f),r=n,c=0;for(var i=1;p>i;i++)for(o=1;p>o;o++)i!=o&&t.abs(r[i][o])>.001&&(c=1)}for(var i=0;p>i;i++)h.push(r[i][i]);return[m,h]},rungekutta:function(r,e,t,n,i,o){var u,a,s,l,f;if(2===o)for(;t>=n;)u=e*r(n,i),a=e*r(n+e,i+u),s=i+(u+a)/2,i=s,n+=e;if(4===o)for(;t>=n;)u=e*r(n,i),a=e*r(n+e/2,i+u/2),l=e*r(n+e/2,i+a/2),f=e*r(n+e,i+l),s=i+(u+2*a+2*l+f)/6,i=s,n+=e;return i},romberg:function(r,e,n,i){for(var o,u,a,s,l,f=0,c=(n-e)/2,d=[],p=[],m=[];i/2>f;){for(l=r(e),a=e,s=0;n>=a;a+=c,s++)d[s]=a;for(o=d.length,a=1;o-1>a;a++)l+=(a%2!=0?4:2)*r(d[a]);l=c/3*(l+r(n)),m[f]=l,c/=2,f++}for(u=m.length,o=1;1!==u;){for(a=0;u-1>a;a++)p[a]=(t.pow(4,o)*m[a+1]-m[a])/(t.pow(4,o)-1);u=p.length,m=p,p=[],o++}return m},richardson:function(r,e,n,i){function o(r,e){for(var t,n=0,i=r.length;i>n;n++)r[n]===e&&(t=n);return t}for(var u,a,s,l,f,c=t.abs(n-r[o(r,n)+1]),d=0,p=[],m=[];i>=c;)u=o(r,n+i),a=o(r,n),p[d]=(e[u]-2*e[a]+e[2*a-u])/(i*i),i/=2,d++;for(l=p.length,s=1;1!=l;){for(f=0;l-1>f;f++)m[f]=(t.pow(4,s)*p[f+1]-p[f])/(t.pow(4,s)-1);l=m.length,p=m,m=[],s++}return p},simpson:function(r,e,t,n){for(var i,o=(t-e)/n,u=r(e),a=[],s=e,l=0,f=1;t>=s;s+=o,l++)a[l]=s;for(i=a.length;i-1>f;f++)u+=(f%2!=0?4:2)*r(a[f]);return o/3*(u+r(t))},hermite:function(r,e,t,n){for(var i,o=r.length,u=0,a=0,s=[],l=[],f=[],c=[];o>a;a++){for(s[a]=1,i=0;o>i;i++)a!=i&&(s[a]*=(n-r[i])/(r[a]-r[i]));for(l[a]=0,i=0;o>i;i++)a!=i&&(l[a]+=1/(r[a]-r[i]));f[a]=s[a]*s[a]*(1-2*(n-r[a])*l[a]),c[a]=s[a]*s[a]*(n-r[a]),u+=f[a]*e[a]+c[a]*t[a]}return u},lagrange:function(r,e,t){for(var n,i,o=0,u=0,a=r.length;a>u;u++){for(i=e[u],n=0;a>n;n++)u!=n&&(i*=(t-r[n])/(r[u]-r[n]));o+=i}return o},cubic_spline:function(r,t,n){for(var i,o=r.length,u=0,a=[],s=[],l=[],f=[],c=[],d=[],p=[];o-1>u;u++)c[u]=r[u+1]-r[u];l[0]=0;for(var u=1;o-1>u;u++)l[u]=3/c[u]*(t[u+1]-t[u])-3/c[u-1]*(t[u]-t[u-1]);for(var u=1;o-1>u;u++)a[u]=[],s[u]=[],a[u][u-1]=c[u-1],a[u][u]=2*(c[u-1]+c[u]),a[u][u+1]=c[u],s[u][0]=l[u];for(f=e.multiply(e.inv(a),s),i=0;o-1>i;i++)d[i]=(t[i+1]-t[i])/c[i]-c[i]*(f[i+1][0]+2*f[i][0])/3,p[i]=(f[i+1][0]-f[i][0])/(3*c[i]);for(i=0;o>i&&r[i]<=n;i++);return i-=1,t[i]+(n-r[i])*d[i]+e.sq(n-r[i])*f[i]+(n-r[i])*e.sq(n-r[i])*p[i]},gauss_quadrature:function(){throw Error("gauss_quadrature not yet implemented")},PCA:function(r){for(var t,n,i=r.length,o=r[0].length,u=0,a=[],s=[],l=[],f=[],c=[],d=[],p=[],m=[],h=[],b=[],u=0;i>u;u++)a[u]=e.sum(r[u])/o;for(var u=0;o>u;u++)for(p[u]=[],t=0;i>t;t++)p[u][t]=r[t][u]-a[t];p=e.transpose(p);for(var u=0;i>u;u++)for(m[u]=[],t=0;i>t;t++)m[u][t]=e.dot([p[u]],[p[t]])/(o-1);l=e.jacobi(m),h=l[0],s=l[1],b=e.transpose(h);for(var u=0;s.length>u;u++)for(t=u;s.length>t;t++)s[t]>s[u]&&(n=s[u],s[u]=s[t],s[t]=n,f=b[u],b[u]=b[t],b[t]=f);d=e.transpose(p);for(var u=0;i>u;u++)for(c[u]=[],t=0;d.length>t;t++)c[u][t]=e.dot([b[u]],[d[t]]);return[r,s,b,c]}}),function(r){for(var t=0;r.length>t;t++)!function(r){e.fn[r]=function(t,n){var i=this;return n?(setTimeout(function(){n.call(i,e.fn[r].call(i,t))},15),this):"number"==typeof e[r](this,t)?e[r](this,t):e(e[r](this,t))}}(r[t])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(r,e){function t(r,t,n,i){if(r>1||n>1||0>=r||0>=n)throw Error("Proportions should be greater than 0 and less than 1");var o=(r*t+n*i)/(t+i);return(r-n)/e.sqrt(o*(1-o)*(1/t+1/i))}var n=[].slice,i=r.utils.isNumber,o=r.utils.isArray;r.extend({zscore:function(){var e=n.call(arguments);return i(e[1])?(e[0]-e[1])/e[2]:(e[0]-r.mean(e[1]))/r.stdev(e[1],e[2])},ztest:function(){var t,i=n.call(arguments);return o(i[1])?(t=r.zscore(i[0],i[1],i[3]),1===i[2]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):i.length>2?(t=r.zscore(i[0],i[1],i[2]),1===i[3]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):(t=i[0],1===i[1]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1))}}),r.extend(r.fn,{zscore:function(r,e){return(r-this.mean())/this.stdev(e)},ztest:function(t,n,i){var o=e.abs(this.zscore(t,i));return 1===n?r.normal.cdf(-o,0,1):2*r.normal.cdf(-o,0,1)}}),r.extend({tscore:function(){var t=n.call(arguments);return 4===t.length?(t[0]-t[1])/(t[2]/e.sqrt(t[3])):(t[0]-r.mean(t[1]))/(r.stdev(t[1],!0)/e.sqrt(t[1].length))},ttest:function(){var t,o=n.call(arguments);return 5===o.length?(t=e.abs(r.tscore(o[0],o[1],o[2],o[3])),1===o[4]?r.studentt.cdf(-t,o[3]-1):2*r.studentt.cdf(-t,o[3]-1)):i(o[1])?(t=e.abs(o[0]),1==o[2]?r.studentt.cdf(-t,o[1]-1):2*r.studentt.cdf(-t,o[1]-1)):(t=e.abs(r.tscore(o[0],o[1])),1==o[2]?r.studentt.cdf(-t,o[1].length-1):2*r.studentt.cdf(-t,o[1].length-1))}}),r.extend(r.fn,{tscore:function(r){return(r-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(t,n){return 1===n?1-r.studentt.cdf(e.abs(this.tscore(t)),this.cols()-1):2*r.studentt.cdf(-e.abs(this.tscore(t)),this.cols()-1)}}),r.extend({anovafscore:function(){var t,i,o,u,a,s,l,f,c=n.call(arguments);if(1===c.length){a=Array(c[0].length);for(var l=0;c[0].length>l;l++)a[l]=c[0][l];c=a}if(2===c.length)return r.variance(c[0])/r.variance(c[1]);i=[];for(var l=0;c.length>l;l++)i=i.concat(c[l]);o=r.mean(i),t=0;for(var l=0;c.length>l;l++)t+=c[l].length*e.pow(r.mean(c[l])-o,2);t/=c.length-1,s=0;for(var l=0;c.length>l;l++)for(u=r.mean(c[l]),f=0;c[l].length>f;f++)s+=e.pow(c[l][f]-u,2);return s/=i.length-c.length,t/s},anovaftest:function(){var e,t,o,u,a=n.call(arguments);if(i(a[0]))return 1-r.centralF.cdf(a[0],a[1],a[2]);anovafscore=r.anovafscore(a),e=a.length-1,o=0;for(var u=0;a.length>u;u++)o+=a[u].length;return t=o-e-1,1-r.centralF.cdf(anovafscore,e,t)},ftest:function(e,t,n){return 1-r.centralF.cdf(e,t,n)}}),r.extend(r.fn,{anovafscore:function(){return r.anovafscore(this.toArray())},anovaftes:function(){for(var e,t=0,e=0;this.length>e;e++)t+=this[e].length;return r.ftest(this.anovafscore(),this.length-1,t-this.length)}}),r.extend({qscore:function(){var t,o,u,a,s,l=n.call(arguments);return i(l[0])?(t=l[0],o=l[1],u=l[2],a=l[3],s=l[4]):(t=r.mean(l[0]),o=r.mean(l[1]),u=l[0].length,a=l[1].length,s=l[2]),e.abs(t-o)/(s*e.sqrt((1/u+1/a)/2))},qtest:function(){var e,t=n.call(arguments);3===t.length?(e=t[0],t=t.slice(1)):7===t.length?(e=r.qscore(t[0],t[1],t[2],t[3],t[4]),t=t.slice(5)):(e=r.qscore(t[0],t[1],t[2]),t=t.slice(3));var i=t[0],o=t[1];return 1-r.tukey.cdf(e,o,i-o)},tukeyhsd:function(e){for(var t=r.pooledstdev(e),n=e.map(function(e){return r.mean(e)}),i=e.reduce(function(r,e){return r+e.length},0),o=[],u=0;e.length>u;++u)for(var a=u+1;e.length>a;++a){var s=r.qtest(n[u],n[a],e[u].length,e[a].length,t,i,e.length);o.push([[u,a],s])}return o}}),r.extend({normalci:function(){var t,i=n.call(arguments),o=Array(2);return t=e.abs(4===i.length?r.normal.inv(i[1]/2,0,1)*i[2]/e.sqrt(i[3]):r.normal.inv(i[1]/2,0,1)*r.stdev(i[2])/e.sqrt(i[2].length)),o[0]=i[0]-t,o[1]=i[0]+t,o},tci:function(){var t,i=n.call(arguments),o=Array(2);return t=e.abs(4===i.length?r.studentt.inv(i[1]/2,i[3]-1)*i[2]/e.sqrt(i[3]):r.studentt.inv(i[1]/2,i[2].length-1)*r.stdev(i[2],!0)/e.sqrt(i[2].length)),o[0]=i[0]-t,o[1]=i[0]+t,o},significant:function(r,e){return e>r}}),r.extend(r.fn,{normalci:function(e,t){return r.normalci(e,t,this.toArray())},tci:function(e,t){return r.tci(e,t,this.toArray())}}),r.extend(r.fn,{oneSidedDifferenceOfProportions:function(e,n,i,o){var u=t(e,n,i,o);return r.ztest(u,1)},twoSidedDifferenceOfProportions:function(e,n,i,o){var u=t(e,n,i,o);return r.ztest(u,2)}})}(e,Math),e.models=function(){function r(r,e){return t(r,e)}function r(r){var n=r[0].length;return e.arange(n).map(function(i){var o=e.arange(n).filter(function(r){return r!==i});return t(e.col(r,i).map(function(r){return r[0]}),e.col(r,o))})}function t(r,t){var n=r.length,i=t[0].length-1,o=n-i-1,u=e.lstsq(t,r),a=e.multiply(t,u.map(function(r){return[r]})).map(function(r){return r[0]}),s=e.subtract(r,a),l=e.mean(r),f=e.sum(a.map(function(r){return Math.pow(r-l,2)})),c=e.sum(r.map(function(r,e){return Math.pow(r-a[e],2)})),d=f+c;return{exog:t,endog:r,nobs:n,df_model:i,df_resid:o,coef:u,predict:a,resid:s,ybar:l,SST:d,SSE:f,SSR:c,R2:f/d}}function n(t){var n=r(t.exog),i=Math.sqrt(t.SSR/t.df_resid),o=n.map(function(r){var e=r.SST,t=r.R2;return i/Math.sqrt(e*(1-t))}),u=t.coef.map(function(r,e){return(r-0)/o[e]}),a=u.map(function(r){var n=e.studentt.cdf(r,t.df_resid);return 2*(n>.5?1-n:n)}),s=e.studentt.inv(.975,t.df_resid),l=t.coef.map(function(r,e){var t=s*o[e];return[r-t,r+t]});return{se:o,t:u,p:a,sigmaHat:i,interval95:l}}function i(r){var t=r.R2/r.df_model/((1-r.R2)/r.df_resid);return{F_statistic:t,pvalue:1-function(r,t,n){return e.beta.cdf(r/(n/t+r),t/2,n/2)}(t,r.df_model,r.df_resid)}}function o(r,e){var o=t(r,e),u=n(o),a=i(o),s=1-(o.nobs-1)/o.df_resid*(1-o.rsquared);return o.t=u,o.f=a,o.adjust_R2=s,o}return{ols:o}}(),e.jStat=e,e})},function(r,e,t){var n=t(1),i=t(9),o=t(0);e.UNIQUE=function(){for(var r=[],e=0;arguments.length>e;++e){for(var t=!1,n=arguments[e],i=0;r.length>i&&!(t=r[i]===n);++i);t||r.push(n)}return r},e.FLATTEN=n.flatten,e.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},e.REFERENCE=function(r,e){if(!arguments.length)return o.error;try{for(var t=e.split("."),n=r,i=0;t.length>i;++i){var u=t[i];if("]"===u[u.length-1]){var a=u.indexOf("["),s=u.substring(a+1,u.length-1);n=n[u.substring(0,a)][s]}else n=n[u]}return n}catch(o){}},e.JOIN=function(r,e){return r.join(e)},e.NUMBERS=function(){return n.flatten(arguments).filter(function(r){return"number"==typeof r})},e.NUMERAL=function(r,e){return i(r).format(e)}},function(r,e,t){function n(r){return/^[01]{1,10}$/.test(r)}var i=t(0),o=t(11).jStat,u=t(6),a=t(1),s=t(88);e.BESSELI=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.besseli(r,e)},e.BESSELJ=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.besselj(r,e)},e.BESSELK=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.besselk(r,e)},e.BESSELY=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:s.bessely(r,e)},e.BIN2DEC=function(r){if(!n(r))return i.num;var e=parseInt(r,2),t=""+r;return 10===t.length&&"1"===t.substring(0,1)?parseInt(t.substring(1),2)-512:e},e.BIN2HEX=function(r,e){if(!n(r))return i.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(0xfffffffe00+parseInt(t.substring(1),2)).toString(16);var o=parseInt(r,2).toString(16);return e===undefined?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.BIN2OCT=function(r,e){if(!n(r))return i.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(1073741312+parseInt(t.substring(1),2)).toString(8);var o=parseInt(r,2).toString(8);return e===undefined?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.BITAND=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r||0>e?i.num:Math.floor(r)!==r||Math.floor(e)!==e?i.num:r>0xffffffffffff||e>0xffffffffffff?i.num:r&e},e.BITLSHIFT=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r?i.num:Math.floor(r)!==r?i.num:r>0xffffffffffff?i.num:Math.abs(e)>53?i.num:0>e?r>>-e:r<r||0>e?i.num:Math.floor(r)!==r||Math.floor(e)!==e?i.num:r>0xffffffffffff||e>0xffffffffffff?i.num:r|e},e.BITRSHIFT=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r?i.num:Math.floor(r)!==r?i.num:r>0xffffffffffff?i.num:Math.abs(e)>53?i.num:0>e?r<<-e:r>>e},e.BITXOR=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:0>r||0>e?i.num:Math.floor(r)!==r||Math.floor(e)!==e?i.num:r>0xffffffffffff||e>0xffffffffffff?i.num:r^e},e.COMPLEX=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?r:"i"!==(t=t===undefined?"i":t)&&"j"!==t?i.value:0===r&&0===e?0:0===r?1===e?t:""+e+t:0===e?""+r:r+(e>0?"+":"")+(1===e?t:""+e+t)},e.CONVERT=function(r,e,t){if((r=a.parseNumber(r))instanceof Error)return r;for(var n,o=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],u={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},l=null,f=null,c=e,d=t,p=1,m=1,h=0;146>h;h++)n=null===o[h][2]?[]:o[h][2],o[h][1]!==c&&0>n.indexOf(c)||(l=o[h]),o[h][1]!==d&&0>n.indexOf(d)||(f=o[h]);if(null===l){var b=u[e.substring(0,2)],v=s[e.substring(0,1)];"da"===e.substring(0,2)&&(v=["dekao",10,"da"]),b?(p=b[2],c=e.substring(2)):v&&(p=v[1],c=e.substring(v[2].length));for(var g=0;146>g;g++)n=null===o[g][2]?[]:o[g][2],o[g][1]!==c&&0>n.indexOf(c)||(l=o[g])}if(null===f){var E=u[t.substring(0,2)],N=s[t.substring(0,1)];"da"===t.substring(0,2)&&(N=["dekao",10,"da"]),E?(m=E[2],d=t.substring(2)):N&&(m=N[1],d=t.substring(N[2].length));for(var y=0;146>y;y++)n=null===o[y][2]?[]:o[y][2],o[y][1]!==d&&0>n.indexOf(d)||(f=o[y])}return null===l||null===f?i.na:l[3]!==f[3]?i.na:r*l[6]*p/(f[6]*m)},e.DEC2BIN=function(r,e){if((r=a.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||-512>r||r>511)return i.num;if(0>r)return"1"+u.REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var t=parseInt(r,10).toString(2);return void 0===e?t:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),t.length>e?i.num:u.REPT("0",e-t.length)+t)},e.DEC2HEX=function(r,e){if((r=a.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||-549755813888>r||r>549755813887)return i.num;if(0>r)return(1099511627776+r).toString(16);var t=parseInt(r,10).toString(16);return void 0===e?t:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),t.length>e?i.num:u.REPT("0",e-t.length)+t)},e.DEC2OCT=function(r,e){if((r=a.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||-536870912>r||r>536870911)return i.num;if(0>r)return(1073741824+r).toString(8);var t=parseInt(r,10).toString(8);return void 0===e?t:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),t.length>e?i.num:u.REPT("0",e-t.length)+t)},e.DELTA=function(r,e){return e=e===undefined?0:e,r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:r===e?1:0},e.ERF=function(r,e){return e=e===undefined?0:e,r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?i.value:o.erf(r)},e.ERF.PRECISE=function(){throw Error("ERF.PRECISE is not implemented")},e.ERFC=function(r){return isNaN(r)?i.value:o.erfc(r)},e.ERFC.PRECISE=function(){throw Error("ERFC.PRECISE is not implemented")},e.GESTEP=function(r,e){return e=e||0,r=a.parseNumber(r),a.anyIsError(e,r)?r:e>r?0:1},e.HEX2BIN=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return i.num;var t=10===r.length&&"f"===r.substring(0,1).toLowerCase(),n=t?parseInt(r,16)-1099511627776:parseInt(r,16);if(-512>n||n>511)return i.num;if(t)return"1"+u.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var o=n.toString(2);return e===undefined?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return i.num;var e=parseInt(r,16);return 549755813888>e?e:e-1099511627776},e.HEX2OCT=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return i.num;var t=parseInt(r,16);if(t>536870911&&0xffe0000000>t)return i.num;if(t>=0xffe0000000)return(t-0xffc0000000).toString(8);var n=t.toString(8);return e===undefined?n:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),n.length>e?i.num:u.REPT("0",e-n.length)+n)},e.IMABS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))},e.IMAGINARY=function(r){if(r===undefined||!0===r||!1===r)return i.value;if(0===r||"0"===r)return 0;if(["i","j"].indexOf(r)>=0)return 1;r=r.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var e=r.indexOf("+"),t=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===t&&(t=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),o="i"===n||"j"===n;return 0>e&&0>t?o?isNaN(r.substring(0,r.length-1))?i.num:r.substring(0,r.length-1):isNaN(r)?i.num:0:o?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?i.num:-+r.substring(t+1,r.length-1):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?i.num:+r.substring(e+1,r.length-1):i.num},e.IMARGUMENT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:0===t&&0===n?i.div0:0===t&&n>0?Math.PI/2:0===t&&0>n?-Math.PI/2:0===n&&t>0?0:0===n&&0>t?-Math.PI:t>0?Math.atan(n/t):0>t&&n>=0?Math.atan(n/t)+Math.PI:Math.atan(n/t)-Math.PI},e.IMCONJUGATE=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",0!==n?e.COMPLEX(t,-n,o):r},e.IMCOS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,o)},e.IMCOSH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,o)},e.IMCOT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:e.IMDIV(e.IMCOS(r),e.IMSIN(r))},e.IMDIV=function(r,t){var n=e.IMREAL(r),o=e.IMAGINARY(r),u=e.IMREAL(t),s=e.IMAGINARY(t);if(a.anyIsError(n,o,u,s))return i.value;var l=r.substring(r.length-1),f=t.substring(t.length-1),c="i";if("j"===l?c="j":"j"===f&&(c="j"),0===u&&0===s)return i.num;var d=u*u+s*s;return e.COMPLEX((n*u+o*s)/d,(o*u-n*s)/d,c)},e.IMEXP=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);o="i"===o||"j"===o?o:"i";var u=Math.exp(t);return e.COMPLEX(u*Math.cos(n),u*Math.sin(n),o)},e.IMLN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),o)},e.IMLOG10=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),o)},e.IMLOG2=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),o)},e.IMPOWER=function(r,t){t=a.parseNumber(t);var n=e.IMREAL(r),o=e.IMAGINARY(r);if(a.anyIsError(t,n,o))return i.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var s=Math.pow(e.IMABS(r),t),l=e.IMARGUMENT(r);return e.COMPLEX(s*Math.cos(t*l),s*Math.sin(t*l),u)},e.IMPRODUCT=function(){var r=arguments[0];if(!arguments.length)return i.value;for(var t=1;arguments.length>t;t++){var n=e.IMREAL(r),o=e.IMAGINARY(r),u=e.IMREAL(arguments[t]),s=e.IMAGINARY(arguments[t]);if(a.anyIsError(n,o,u,s))return i.value;r=e.COMPLEX(n*u-o*s,n*s+o*u)}return r},e.IMREAL=function(r){if(r===undefined||!0===r||!1===r)return i.value;if(0===r||"0"===r)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(r)>=0)return 0;var e=r.indexOf("+"),t=r.indexOf("-");0===e&&(e=r.indexOf("+",1)),0===t&&(t=r.indexOf("-",1));var n=r.substring(r.length-1,r.length),o="i"===n||"j"===n;return 0>e&&0>t?o?isNaN(r.substring(0,r.length-1))?i.num:0:isNaN(r)?i.num:r:o?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?i.num:+r.substring(0,t):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?i.num:+r.substring(0,e):i.num},e.IMSEC=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:e.IMDIV("1",e.IMCOS(r))},e.IMSECH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:e.IMDIV("1",e.IMCOSH(r))},e.IMSIN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,o)},e.IMSINH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);return o="i"===o||"j"===o?o:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,o)},e.IMSQRT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(a.anyIsError(t,n))return i.value;var o=r.substring(r.length-1);o="i"===o||"j"===o?o:"i";var u=Math.sqrt(e.IMABS(r)),s=e.IMARGUMENT(r);return e.COMPLEX(u*Math.cos(s/2),u*Math.sin(s/2),o)},e.IMCSC=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.num:e.IMDIV("1",e.IMSIN(r))},e.IMCSCH=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.num:e.IMDIV("1",e.IMSINH(r))},e.IMSUB=function(r,e){var t=this.IMREAL(r),n=this.IMAGINARY(r),o=this.IMREAL(e),u=this.IMAGINARY(e);if(a.anyIsError(t,n,o,u))return i.value;var s=r.substring(r.length-1),l=e.substring(e.length-1),f="i";return"j"===s?f="j":"j"===l&&(f="j"),this.COMPLEX(t-o,n-u,f)},e.IMSUM=function(){if(!arguments.length)return i.value;for(var r=a.flatten(arguments),e=r[0],t=1;r.length>t;t++){var n=this.IMREAL(e),o=this.IMAGINARY(e),u=this.IMREAL(r[t]),s=this.IMAGINARY(r[t]);if(a.anyIsError(n,o,u,s))return i.value;e=this.COMPLEX(n+u,o+s)}return e},e.IMTAN=function(r){if(!0===r||!1===r)return i.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return a.anyIsError(t,n)?i.value:this.IMDIV(this.IMSIN(r),this.IMCOS(r))},e.OCT2BIN=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return i.num;var t=10===r.length&&"7"===r.substring(0,1),n=t?parseInt(r,8)-1073741824:parseInt(r,8);if(-512>n||n>511)return i.num;if(t)return"1"+u.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var o=n.toString(2);return void 0===e?o:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),o.length>e?i.num:u.REPT("0",e-o.length)+o)},e.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return i.num;var e=parseInt(r,8);return 536870912>e?e:e-1073741824},e.OCT2HEX=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return i.num;var t=parseInt(r,8);if(t>=536870912)return"ff"+(t+3221225472).toString(16);var n=t.toString(16);return e===undefined?n:isNaN(e)?i.value:0>e?i.num:(e=Math.floor(e),n.length>e?i.num:u.REPT("0",e-n.length)+n)}},function(r,e,t){"use strict";e.__esModule=!0,e["default"]=["ABS","ACCRINT","ACOS","ACOSH","ACOT","ACOTH","ADD","AGGREGATE","AND","ARABIC","ARGS2ARRAY","ASIN","ASINH","ATAN","ATAN2","ATANH","AVEDEV","AVERAGE","AVERAGEA","AVERAGEIF","AVERAGEIFS","BASE","BESSELI","BESSELJ","BESSELK","BESSELY","BETA.DIST","BETA.INV","BETADIST","BETAINV","BIN2DEC","BIN2HEX","BIN2OCT","BINOM.DIST","BINOM.DIST.RANGE","BINOM.INV","BINOMDIST","BITAND","BITLSHIFT","BITOR","BITRSHIFT","BITXOR","CEILING","CEILINGMATH","CEILINGPRECISE","CHAR","CHISQ.DIST","CHISQ.DIST.RT","CHISQ.INV","CHISQ.INV.RT","CHOOSE","CHOOSE","CLEAN","CODE","COLUMN","COLUMNS","COMBIN","COMBINA","COMPLEX","CONCATENATE","CONFIDENCE","CONFIDENCE.NORM","CONFIDENCE.T","CONVERT","CORREL","COS","COSH","COT","COTH","COUNT","COUNTA","COUNTBLANK","COUNTIF","COUNTIFS","COUNTIN","COUNTUNIQUE","COVARIANCE.P","COVARIANCE.S","CSC","CSCH","CUMIPMT","CUMPRINC","DATE","DATEVALUE","DAY","DAYS","DAYS360","DB","DDB","DEC2BIN","DEC2HEX","DEC2OCT","DECIMAL","DEGREES","DELTA","DEVSQ","DIVIDE","DOLLAR","DOLLARDE","DOLLARFR","E","EDATE","EFFECT","EOMONTH","EQ","ERF","ERFC","EVEN","EXACT","EXP","EXPON.DIST","EXPONDIST","F.DIST","F.DIST.RT","F.INV","F.INV.RT","FACT","FACTDOUBLE","FALSE","FDIST","FDISTRT","FIND","FINV","FINVRT","FISHER","FISHERINV","FIXED","FLATTEN","FLOOR","FORECAST","FREQUENCY","FV","FVSCHEDULE","GAMMA","GAMMA.DIST","GAMMA.INV","GAMMADIST","GAMMAINV","GAMMALN","GAMMALN.PRECISE","GAUSS","GCD","GEOMEAN","GESTEP","GROWTH","GTE","HARMEAN","HEX2BIN","HEX2DEC","HEX2OCT","HOUR","HTML2TEXT","HYPGEOM.DIST","HYPGEOMDIST","IF","IMABS","IMAGINARY","IMARGUMENT","IMCONJUGATE","IMCOS","IMCOSH","IMCOT","IMCSC","IMCSCH","IMDIV","IMEXP","IMLN","IMLOG10","IMLOG2","IMPOWER","IMPRODUCT","IMREAL","IMSEC","IMSECH","IMSIN","IMSINH","IMSQRT","IMSUB","IMSUM","IMTAN","INT","INTERCEPT","INTERVAL","IPMT","IRR","ISBINARY","ISBLANK","ISEVEN","ISLOGICAL","ISNONTEXT","ISNUMBER","ISODD","ISODD","ISOWEEKNUM","ISPMT","ISTEXT","JOIN","KURT","LARGE","LCM","LEFT","LEN","LINEST","LN","LOG","LOG10","LOGEST","LOGNORM.DIST","LOGNORM.INV","LOGNORMDIST","LOGNORMINV","LOWER","LT","LTE","MATCH","MAX","MAXA","MEDIAN","MID","MIN","MINA","MINUS","MINUTE","MIRR","MOD","MODE.MULT","MODE.SNGL","MODEMULT","MODESNGL","MONTH","MROUND","MULTINOMIAL","MULTIPLY","NE","NEGBINOM.DIST","NEGBINOMDIST","NETWORKDAYS","NOMINAL","NORM.DIST","NORM.INV","NORM.S.DIST","NORM.S.INV","NORMDIST","NORMINV","NORMSDIST","NORMSINV","NOT","NOW","NPER","NPV","NUMBERS","NUMERAL","OCT2BIN","OCT2DEC","OCT2HEX","ODD","OR","PDURATION","PEARSON","PERCENTILEEXC","PERCENTILEINC","PERCENTRANKEXC","PERCENTRANKINC","PERMUT","PERMUTATIONA","PHI","PI","PMT","POISSON.DIST","POISSONDIST","POW","POWER","PPMT","PROB","PRODUCT","PROPER","PV","QUARTILE.EXC","QUARTILE.INC","QUARTILEEXC","QUARTILEINC","QUOTIENT","RADIANS","RAND","RANDBETWEEN","RANK.AVG","RANK.EQ","RANKAVG","RANKEQ","RATE","REFERENCE","REGEXEXTRACT","REGEXMATCH","REGEXREPLACE","REPLACE","REPT","RIGHT","ROMAN","ROUND","ROUNDDOWN","ROUNDUP","ROW","ROWS","RRI","RSQ","SEARCH","SEC","SECH","SECOND","SERIESSUM","SIGN","SIN","SINH","SKEW","SKEW.P","SKEWP","SLN","SLOPE","SMALL","SPLIT","SPLIT","SQRT","SQRTPI","STANDARDIZE","STDEV.P","STDEV.S","STDEVA","STDEVP","STDEVPA","STDEVS","STEYX","SUBSTITUTE","SUBTOTAL","SUM","SUMIF","SUMIFS","SUMPRODUCT","SUMSQ","SUMX2MY2","SUMX2PY2","SUMXMY2","SWITCH","SYD","T","T.DIST","T.DIST.2T","T.DIST.RT","T.INV","T.INV.2T","TAN","TANH","TBILLEQ","TBILLPRICE","TBILLYIELD","TDIST","TDIST2T","TDISTRT","TEXT","TIME","TIMEVALUE","TINV","TINV2T","TODAY","TRANSPOSE","TREND","TRIM","TRIMMEAN","TRUE","TRUNC","UNICHAR","UNICODE","UNIQUE","UPPER","VALUE","VAR.P","VAR.S","VARA","VARP","VARPA","VARS","WEEKDAY","WEEKNUM","WEIBULL.DIST","WEIBULLDIST","WORKDAY","XIRR","XNPV","XOR","YEAR","YEARFRAC"]},function(r,e,t){"use strict";function n(r){var e=parseInt(r,10);return e=isNaN(e)?-1:Math.max(e-1,-1)}function i(r){var e="";return 0>r||(e=""+(r+1)),e}function o(r){var e=0;if("string"==typeof r){r=r.toUpperCase();for(var t=0,n=r.length-1;r.length>t;t+=1,n-=1)e+=Math.pow(f,n)*(l.indexOf(r[t])+1)}return--e}function u(r){for(var e="";r>=0;)e=String.fromCharCode(r%f+97)+e,r=Math.floor(r/f)-1;return e.toUpperCase()}function a(r){if("string"!=typeof r||!c.test(r))return[];var e=r.toUpperCase().match(c),t=e[1],i=e[2],u=e[3],a=e[4];return[{index:n(a),label:a,isAbsolute:"$"===u},{index:o(i),label:i,isAbsolute:"$"===t}]}function s(r,e){var t=(r.isAbsolute?"$":"")+i(r.index);return(e.isAbsolute?"$":"")+u(e.index)+t}e.__esModule=!0,e.rowLabelToIndex=n,e.rowIndexToLabel=i,e.columnLabelToIndex=o,e.columnIndexToLabel=u,e.extractLabel=a,e.toLabel=s;var l="ABCDEFGHIJKLMNOPQRSTUVWXYZ",f=l.length,c=/^([$])?([A-Za-z]+)([$])?([0-9]+)$/},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}e.__esModule=!0,e.rowLabelToIndex=e.rowIndexToLabel=e.columnLabelToIndex=e.columnIndexToLabel=e.toLabel=e.extractLabel=e.error=e.Parser=e.ERROR_VALUE=e.ERROR_REF=e.ERROR_NUM=e.ERROR_NULL=e.ERROR_NOT_AVAILABLE=e.ERROR_NAME=e.ERROR_DIV_ZERO=e.ERROR=e.SUPPORTED_FORMULAS=undefined;var i=t(17),o=n(i),u=t(14),a=n(u),s=t(2),l=n(s),f=t(15);e.SUPPORTED_FORMULAS=a["default"],e.ERROR=s.ERROR,e.ERROR_DIV_ZERO=s.ERROR_DIV_ZERO,e.ERROR_NAME=s.ERROR_NAME,e.ERROR_NOT_AVAILABLE=s.ERROR_NOT_AVAILABLE,e.ERROR_NULL=s.ERROR_NULL,e.ERROR_NUM=s.ERROR_NUM,e.ERROR_REF=s.ERROR_REF,e.ERROR_VALUE=s.ERROR_VALUE,e.Parser=o["default"],e.error=l["default"],e.extractLabel=f.extractLabel,e.toLabel=f.toLabel,e.columnIndexToLabel=f.columnIndexToLabel,e.columnLabelToIndex=f.columnLabelToIndex,e.rowIndexToLabel=f.rowIndexToLabel,e.rowLabelToIndex=f.rowLabelToIndex},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function i(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function o(r,e){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?r:e}function u(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(r,e):r.__proto__=e)}e.__esModule=!0;var a=t(18),s=n(a),l=t(19),f=n(l),c=t(101),d=t(103),p=t(3),m=t(2),h=n(m),b=t(15);e["default"]=function(r){function e(){i(this,e);var t=o(this,r.call(this));return t.parser=new c.Parser,t.parser.yy={toNumber:p.toNumber,trimEdges:d.trimEdges,invertNumber:p.invertNumber,throwError:function(r){return t._throwError(r)},callVariable:function(r){return t._callVariable(r)},evaluateByOperator:f["default"],callFunction:function(r,e){return t._callFunction(r,e)},cellValue:function(r){return t._callCellValue(r)},rangeValue:function(r,e){return t._callRangeValue(r,e)}},t.variables=Object.create(null),t.functions=Object.create(null),t.setVariable("TRUE",!0).setVariable("FALSE",!1).setVariable("NULL",null),t}return u(e,r),e.prototype.parse=function(r){var e=null,t=null;try{e=""===r?"":this.parser.parse(r)}catch(i){var n=(0,h["default"])(i.message);t=n||(0,h["default"])(m.ERROR)}return e instanceof Error&&(t=(0,h["default"])(e.message)||(0,h["default"])(m.ERROR),e=null),{error:t,result:e}},e.prototype.setVariable=function(r,e){return this.variables[r]=e,this},e.prototype.getVariable=function(r){return this.variables[r]},e.prototype._callVariable=function(r){var e=this.getVariable(r);if(this.emit("callVariable",r,function(r){void 0!==r&&(e=r)}),void 0===e)throw Error(m.ERROR_NAME);return e},e.prototype.setFunction=function(r,e){return this.functions[r]=e,this},e.prototype.getFunction=function(r){return this.functions[r]},e.prototype._callFunction=function(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[],t=this.getFunction(r),n=void 0;return t&&(n=t(e)),this.emit("callFunction",r,e,function(r){void 0!==r&&(n=r)}),void 0===n?(0,f["default"])(r,e):n},e.prototype._callCellValue=function(r){r=r.toUpperCase();var e=(0,b.extractLabel)(r),t=e[0],n=e[1],i=void 0;return this.emit("callCellValue",{label:r,row:t,column:n},function(r){i=r}),i},e.prototype._callRangeValue=function(r,e){r=r.toUpperCase(),e=e.toUpperCase();var t=(0,b.extractLabel)(r),n=t[0],i=t[1],o=(0,b.extractLabel)(e),u=o[0],a=o[1],s={},l={};n.index>u.index?(s.row=u,l.row=n):(s.row=n,l.row=u),i.index>a.index?(s.column=a,l.column=i):(s.column=i,l.column=a),s.label=(0,b.toLabel)(s.row,s.column),l.label=(0,b.toLabel)(l.row,l.column);var f=[];return this.emit("callRangeValue",s,l,function(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];f=r}),f},e.prototype._throwError=function(r){if((0,m.isValidStrict)(r))throw Error(r);throw Error(m.ERROR)},e}(s["default"])},function(r,e){function t(){}t.prototype={on:function(r,e,t){var n=this.e||(this.e={});return(n[r]||(n[r]=[])).push({fn:e,ctx:t}),this},once:function(r,e,t){function n(){i.off(r,n),e.apply(t,arguments)}var i=this;return n._=e,this.on(r,n,t)},emit:function(r){var e=[].slice.call(arguments,1),t=((this.e||(this.e={}))[r]||[]).slice(),n=0,i=t.length;for(n;i>n;n++)t[n].fn.apply(t[n].ctx,e);return this},off:function(r,e){var t=this.e||(this.e={}),n=t[r],i=[];if(n&&e)for(var o=0,u=n.length;u>o;o++)n[o].fn!==e&&n[o].fn._!==e&&i.push(n[o]);return i.length?t[r]=i:delete t[r],this}},r.exports=t},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function i(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(r=r.toUpperCase(),!D[r])throw Error(O.ERROR_NAME);return D[r].apply(D,e)}function o(r,e){Array.isArray(r)||(r=[r.toUpperCase()]),r.forEach(function(r){D[r]=e.isFactory?e(r):e})}e.__esModule=!0,e["default"]=i,e.registerOperation=o;var u=t(20),a=n(u),s=t(21),l=n(s),f=t(22),c=n(f),d=t(23),p=n(d),m=t(24),h=n(m),b=t(93),v=n(b),g=t(94),E=n(g),N=t(95),y=n(N),w=t(96),I=n(w),M=t(97),x=n(M),A=t(98),R=n(A),T=t(99),C=n(T),S=t(100),$=n(S),O=t(2),D=Object.create(null);o(a["default"].SYMBOL,a["default"]),o(l["default"].SYMBOL,l["default"]),o(c["default"].SYMBOL,c["default"]),o(p["default"].SYMBOL,p["default"]),o($["default"].SYMBOL,$["default"]),o(h["default"].SYMBOL,h["default"]),o(v["default"].SYMBOL,v["default"]),o(E["default"].SYMBOL,E["default"]),o(y["default"].SYMBOL,y["default"]),o(I["default"].SYMBOL,I["default"]),o(R["default"].SYMBOL,R["default"]),o(C["default"].SYMBOL,C["default"]),o(x["default"].SYMBOL,x["default"])},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r+(0,i.toNumber)(e)},(0,i.toNumber)(r));if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="+"},function(r,e,t){"use strict";function n(){for(var r=arguments.length,e=Array(r),t=0;r>t;t++)e[t]=arguments[t];return e.reduce(function(r,e){return r+""+e},"")}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="&"},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r/(0,i.toNumber)(e)},(0,i.toNumber)(r));if(u===Infinity)throw Error(o.ERROR_DIV_ZERO);if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="/"},function(r,e,t){"use strict";function n(r,e){return r===e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="="},function(r,e,t){"use strict";function n(r){return function(){r=r.toUpperCase();var e=r.split("."),t=!1,n=void 0;if(1===e.length)o[e[0]]&&(t=!0,n=o[e[0]].apply(o,arguments));else{for(var i=e.length,u=0,a=o;i>u;)if(a=a[e[u]],u++,!a){a=null;break}a&&(t=!0,n=a.apply(undefined,arguments))}if(!t)throw Error(s.ERROR_NAME);return n}}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(25),o=function(r){if(r&&r.__esModule)return r;var e={};if(null!=r)for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e["default"]=r,e}(i),u=t(14),a=function(r){return r&&r.__esModule?r:{"default":r}}(u),s=t(2),l=e.SYMBOL=a["default"];n.isFactory=!0,n.SYMBOL=l},function(r,e,t){var n=[t(26),t(89),t(13),t(90),t(4),t(6),t(8),t(91),t(7),t(92),t(5),t(12)];for(var i in n){var o=n[i];for(var u in o)e[u]=e[u]||o[u]}},function(r,e,t){function n(r,e){if(e)for(var t in e)r[t]=e[t];return r}var i=t(4),o=t(5),u=t(13),a=t(8);e.BETADIST=o.BETA.DIST,e.BETAINV=o.BETA.INV,e.BINOMDIST=o.BINOM.DIST,e.CEILING=e.ISOCEILING=n(i.CEILING.MATH,i.CEILING),e.CEILINGMATH=i.CEILING.MATH,e.CEILINGPRECISE=i.CEILING.PRECISE,e.CHIDIST=o.CHISQ.DIST,e.CHIDISTRT=o.CHISQ.DIST.RT,e.CHIINV=o.CHISQ.INV,e.CHIINVRT=o.CHISQ.INV.RT,e.CHITEST=o.CHISQ.TEST,e.CONFIDENCE=n(o.CONFIDENCE.NORM,o.CONFIDENCE),e.COVAR=o.COVARIANCE.P,e.COVARIANCEP=o.COVARIANCE.P,e.COVARIANCES=o.COVARIANCE.S,e.CRITBINOM=o.BINOM.INV,e.EXPONDIST=o.EXPON.DIST,e.ERFCPRECISE=u.ERFC.PRECISE,e.ERFPRECISE=u.ERF.PRECISE,e.FDIST=o.F.DIST,e.FDISTRT=o.F.DIST.RT,e.FINVRT=o.F.INV.RT,e.FINV=o.F.INV,e.FLOOR=n(i.FLOOR.MATH,i.FLOOR),e.FLOORMATH=i.FLOOR.MATH,e.FLOORPRECISE=i.FLOOR.PRECISE,e.FTEST=o.F.TEST,e.GAMMADIST=o.GAMMA.DIST,e.GAMMAINV=o.GAMMA.INV,e.GAMMALNPRECISE=o.GAMMALN.PRECISE,e.HYPGEOMDIST=o.HYPGEOM.DIST,e.LOGINV=o.LOGNORM.INV,e.LOGNORMINV=o.LOGNORM.INV,e.LOGNORMDIST=o.LOGNORM.DIST,e.MODE=n(o.MODE.SNGL,o.MODE),e.MODEMULT=o.MODE.MULT,e.MODESNGL=o.MODE.SNGL,e.NEGBINOMDIST=o.NEGBINOM.DIST,e.NETWORKDAYSINTL=a.NETWORKDAYS.INTL,e.NORMDIST=o.NORM.DIST,e.NORMINV=o.NORM.INV,e.NORMSDIST=o.NORM.S.DIST,e.NORMSINV=o.NORM.S.INV,e.PERCENTILE=n(o.PERCENTILE.EXC,o.PERCENTILE),e.PERCENTILEEXC=o.PERCENTILE.EXC,e.PERCENTILEINC=o.PERCENTILE.INC,e.PERCENTRANK=n(o.PERCENTRANK.INC,o.PERCENTRANK),e.PERCENTRANKEXC=o.PERCENTRANK.EXC,e.PERCENTRANKINC=o.PERCENTRANK.INC,e.POISSON=n(o.POISSON.DIST,o.POISSON),e.POISSONDIST=o.POISSON.DIST,e.QUARTILE=n(o.QUARTILE.INC,o.QUARTILE),e.QUARTILEEXC=o.QUARTILE.EXC,e.QUARTILEINC=o.QUARTILE.INC,e.RANK=n(o.RANK.EQ,o.RANK),e.RANKAVG=o.RANK.AVG,e.RANKEQ=o.RANK.EQ,e.SKEWP=o.SKEW.P,e.STDEV=n(o.STDEV.S,o.STDEV),e.STDEVP=o.STDEV.P,e.STDEVS=o.STDEV.S,e.TDIST=o.T.DIST,e.TDISTRT=o.T.DIST.RT,e.TINV=o.T.INV,e.TTEST=o.T.TEST,e.VAR=n(o.VAR.S,o.VAR),e.VARP=o.VAR.P,e.VARS=o.VAR.S,e.WEIBULL=n(o.WEIBULL.DIST,o.WEIBULL),e.WEIBULLDIST=o.WEIBULL.DIST,e.WORKDAYINTL=a.WORKDAY.INTL,e.ZTEST=o.Z.TEST},function(r,e,t){e.bg=t(28),e["cs-CZ"]=t(29),e["da-DK"]=t(30),e["de-AT"]=t(31),e["de-CH"]=t(32),e["de-DE"]=t(33),e["de-LI"]=t(34),e.el=t(35),e["en-AU"]=t(36),e["en-GB"]=t(37),e["en-IE"]=t(38),e["en-NZ"]=t(39),e["en-ZA"]=t(40),e["es-AR"]=t(41),e["es-CL"]=t(42),e["es-CO"]=t(43),e["es-CR"]=t(44),e["es-ES"]=t(45),e["es-NI"]=t(46),e["es-PE"]=t(47),e["es-PR"]=t(48),e["es-SV"]=t(49),e["et-EE"]=t(50),e["fa-IR"]=t(51),e["fi-FI"]=t(52),e["fil-PH"]=t(53),e["fr-CA"]=t(54),e["fr-CH"]=t(55),e["fr-FR"]=t(56),e["he-IL"]=t(57),e["hu-HU"]=t(58),e.id=t(59),e["it-CH"]=t(60),e["it-IT"]=t(61),e["ja-JP"]=t(62),e["ko-KR"]=t(63),e["lv-LV"]=t(64),e["nb-NO"]=t(65),e.nb=t(66),e["nl-BE"]=t(67),e["nl-NL"]=t(68),e.nn=t(69),e["pl-PL"]=t(70),e["pt-BR"]=t(71),e["pt-PT"]=t(72),e["ro-RO"]=t(73),e.ro=t(74),e["ru-RU"]=t(75),e["ru-UA"]=t(76),e["sk-SK"]=t(77),e.sl=t(78),e["sr-Cyrl-RS"]=t(79),e["sv-SE"]=t(80),e["th-TH"]=t(81),e["tr-TR"]=t(82),e["uk-UA"]=t(83),e["zh-CN"]=t(84),e["zh-MO"]=t(85),e["zh-SG"]=t(86),e["zh-TW"]=t(87)},function(r,e){/*! * numbro.js language configuration * language : Bulgarian * author : Tim McIntosh (StayinFront NZ) @@ -365,4 +365,4 @@ * author (numbro.js Version): Randy Wilander : https://github.com/rocketedaway * author (numeral.js Version) : Rich Daley : https://github.com/pedantic-git */ -(function(){"use strict";var e={langLocaleCode:"zh-TW",cultureCode:"zh-TW",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"千",million:"百萬",billion:"十億",trillion:"兆"},ordinal:function(){return"第"},currency:{symbol:"NT$"}};void 0!==r&&r.exports&&(r.exports=e),"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(e.cultureCode,e)}).call("undefined"==typeof window?this:window)},function(r,e,t){function n(r,e){return r.reduce(function(r,t){return e*r+t},0)}function i(r,e,t,n,i){i||(i=-1);var o,u=2/r;if(0===e)return t;if(1===e)return n;for(var a=1;a!=e;++a)o=n*a*u+i*t,t=n,n=o;return n}function o(r,e,t,n,o){return function(u,a){if(0===a)return r(u);if(1===a)return e(u);if(0>a)throw t+": Order ("+a+") must be nonnegative";if(1==n&&0===u)throw t+": Undefined when x == 0";if(2==n&&0>=u)throw t+": Undefined when x <= 0";return i(u,a,r(u),e(u),o)}}var u=Math,a=function(){function r(r){var e,i,f,c=r*r,d=u.abs(r)-.785398164;return 8>u.abs(r)?(i=n(t,c),f=n(o,c),e=i/f):(c=64/c,i=n(a,c),f=n(s,c),e=u.sqrt(l/u.abs(r))*(u.cos(d)*i-u.sin(d)*f*8/u.abs(r))),e}function e(r){var e,t,i,o=r*r,a=u.abs(r)-2.356194491;return 8>Math.abs(r)?(t=r*n(f,o),i=n(c,o),e=t/i):(o=64/o,t=n(d,o),i=n(m,o),e=u.sqrt(l/u.abs(r))*(u.cos(a)*t-u.sin(a)*i*8/u.abs(r)),0>r&&(e=-e)),e}var t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),o=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),a=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),l=.636619772,f=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),c=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),d=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(t,n){if(0===(n=Math.round(n)))return r(u.abs(t));if(1===n)return e(u.abs(t));if(0>n)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===u.abs(t))return 0;var o,a,s,l,f,c,d,m,p=2/u.abs(t);if(u.abs(t)>n)o=i(t,n,r(u.abs(t)),e(u.abs(t)),-1);else{for(s=2*u.floor((n+u.floor(u.sqrt(40*n)))/2),l=0,c=o=f=0,d=1,a=s;a>0;a--)m=a*p*d-c,c=d,d=m,u.abs(d)>1e10&&(d*=1e-10,c*=1e-10,o*=1e-10,f*=1e-10),l&&(f+=d),l=!l,a==n&&(o=c);f=2*f-d,o/=f}return 0>t&&n%2?-o:o}}(),s=function(){function r(r){var e,o,c,d=r*r,m=r-.785398164;return 8>r?(o=n(t,d),c=n(i,d),e=o/c+f*a(r,0)*u.log(r)):(d=64/d,o=n(s,d),c=n(l,d),e=u.sqrt(f/r)*(u.sin(m)*o+u.cos(m)*c*8/r)),e}function e(r){var e,t,i,o=r*r,s=r-2.356194491;return 8>r?(t=r*n(c,o),i=n(d,o),e=t/i+f*(a(r,1)*u.log(r)-1/r)):(o=64/o,t=n(m,o),i=n(p,o),e=u.sqrt(f/r)*(u.sin(s)*t+u.cos(s)*i*8/r)),e}var t=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),i=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),l=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),f=.636619772,c=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),d=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),m=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),p=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return o(r,e,"BESSELY",1,-1)}(),l=function(){function r(r){return r>3.75?u.exp(u.abs(r))/u.sqrt(u.abs(r))*n(i,3.75/u.abs(r)):n(t,r*r/14.0625)}function e(r){return 3.75>r?r*n(o,r*r/14.0625):(0>r?-1:1)*u.exp(u.abs(r))/u.sqrt(u.abs(r))*n(a,3.75/u.abs(r))}var t=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),i=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),o=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),a=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function s(t,n){if(0===(n=Math.round(n)))return r(t);if(1==n)return e(t);if(0>n)throw"BESSELI Order ("+n+") must be nonnegative";if(0===u.abs(t))return 0;var i,o,a,l,f,c,d=2/u.abs(t);for(a=2*u.round((n+u.round(u.sqrt(40*n)))/2),l=i=0,f=1,o=a;o>0;o--)c=o*d*f+l,l=f,f=c,u.abs(f)>1e10&&(f*=1e-10,l*=1e-10,i*=1e-10),o==n&&(i=l);return i*=s(t,0)/f,0>t&&n%2?-i:i}}(),f=function(){function r(r){return r>2?u.exp(-r)/u.sqrt(r)*n(i,2/r):-u.log(r/2)*l(r,0)+n(t,r*r/4)}function e(r){return r>2?u.exp(-r)/u.sqrt(r)*n(s,2/r):u.log(r/2)*l(r,1)+1/r*n(a,r*r/4)}var t=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),i=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),a=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return o(r,e,"BESSELK",2,1)}();e.besselj=a,e.bessely=s,e.besseli=l,e.besselk=f},function(module,exports,__webpack_require__){function compact(r){var e=[];return utils.arrayEach(r,function(r){r&&e.push(r)}),e}function findResultIndex(database,criterias){for(var matches={},i=1;database[0].length>i;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;criterias.length>i;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;database.length>k;++k)for(var l=1;database[k].length>l;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;criterias.length>j;++j){var criteria=criterias[j];if(criteria.length>=maxCriteriaLength){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;criteria.length>p;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&¤tCriteriaResult)}for(var result=[],n=0;database[0].length>n;++n)matches[n]&&result.push(n-1);return result}var error=__webpack_require__(0),stats=__webpack_require__(5),maths=__webpack_require__(4),utils=__webpack_require__(1);exports.FINDFIELD=function(r,e){var t=null;return utils.arrayEach(r,function(r,n){if(r[0]===e)return t=n,!1}),null==t?error.value:t},exports.DAVERAGE=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=0;return utils.arrayEach(n,function(r){u+=i[r]}),0===n.length?error.div0:u/n.length},exports.DCOUNT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.COUNT(u)},exports.DCOUNTA=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.COUNTA(u)},exports.DGET=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);return 0===n.length?error.value:n.length>1?error.num:i[n[0]]},exports.DMAX=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=i[n[0]];return utils.arrayEach(n,function(r){i[r]>u&&(u=i[r])}),u},exports.DMIN=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=i[n[0]];return utils.arrayEach(n,function(r){u>i[r]&&(u=i[r])}),u},exports.DPRODUCT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];utils.arrayEach(n,function(r){u.push(i[r])}),u=compact(u);var a=1;return utils.arrayEach(u,function(r){a*=r}),a},exports.DSTDEV=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),u=compact(u),stats.STDEV.S(u)},exports.DSTDEVP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),u=compact(u),stats.STDEV.P(u)},exports.DSUM=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),maths.SUM(u)},exports.DVAR=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.VAR.S(u)},exports.DVARP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.VAR.P(u)}},function(r,e,t){var n=t(0),i=t(1),o=t(7);e.AND=function(){for(var r=i.flatten(arguments),e=!0,t=0;r.length>t;t++)r[t]||(e=!1);return e},e.CHOOSE=function(){if(2>arguments.length)return n.na;var r=arguments[0];return 1>r||r>254?n.value:r+1>arguments.length?n.value:arguments[r]},e.FALSE=function(){return!1},e.IF=function(r,e,t){return r?e:t},e.IFERROR=function(r,e){return o.ISERROR(r)?e:r},e.IFNA=function(r,e){return r===n.na?e:r},e.NOT=function(r){return!r},e.OR=function(){for(var r=i.flatten(arguments),e=!1,t=0;r.length>t;t++)r[t]&&(e=!0);return e},e.TRUE=function(){return!0},e.XOR=function(){for(var r=i.flatten(arguments),e=0,t=0;r.length>t;t++)r[t]&&e++;return!!(1&Math.floor(Math.abs(e)))},e.SWITCH=function(){var r;if(arguments.length>0){var e=arguments[0],t=arguments.length-1,i=Math.floor(t/2),o=!1,u=t%2!=0,a=t%2==0?null:arguments[arguments.length-1];if(i)for(var s=0;i>s;s++)if(e===arguments[2*s+1]){r=arguments[2*s+2],o=!0;break}o||(r=u?a:n.na)}else r=n.value;return r}},function(r,e,t){function n(r){return r&&r.getTime&&!isNaN(r.getTime())}function i(r){return r instanceof Date?r:new Date(r)}var o=t(0),u=t(8),a=t(1);e.ACCRINT=function(r,e,t,a,s,l,f){return r=i(r),e=i(e),t=i(t),n(r)&&n(e)&&n(t)?a>0&&s>0?-1===[1,2,4].indexOf(l)?o.num:-1===[0,1,2,3,4].indexOf(f)?o.num:t>r?(s=s||0,f=f||0,s*a*u.YEARFRAC(r,t,f)):o.num:o.num:o.value},e.ACCRINTM=function(){throw Error("ACCRINTM is not implemented")},e.AMORDEGRC=function(){throw Error("AMORDEGRC is not implemented")},e.AMORLINC=function(){throw Error("AMORLINC is not implemented")},e.COUPDAYBS=function(){throw Error("COUPDAYBS is not implemented")},e.COUPDAYS=function(){throw Error("COUPDAYS is not implemented")},e.COUPDAYSNC=function(){throw Error("COUPDAYSNC is not implemented")},e.COUPNCD=function(){throw Error("COUPNCD is not implemented")},e.COUPNUM=function(){throw Error("COUPNUM is not implemented")},e.COUPPCD=function(){throw Error("COUPPCD is not implemented")},e.CUMIPMT=function(r,t,n,i,u,s){if(r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,t,n))return o.value;if(0>=r||0>=t||0>=n)return o.num;if(1>i||1>u||i>u)return o.num;if(0!==s&&1!==s)return o.num;var l=e.PMT(r,t,n,0,s),f=0;1===i&&0===s&&(f=-n,i++);for(var c=i;u>=c;c++)f+=1===s?e.FV(r,c-2,l,n,1)-l:e.FV(r,c-1,l,n,0);return f*=r},e.CUMPRINC=function(r,t,n,i,u,s){if(r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,t,n))return o.value;if(0>=r||0>=t||0>=n)return o.num;if(1>i||1>u||i>u)return o.num;if(0!==s&&1!==s)return o.num;var l=e.PMT(r,t,n,0,s),f=0;1===i&&(f=0===s?l+n*r:l,i++);for(var c=i;u>=c;c++)f+=s>0?l-(e.FV(r,c-2,l,n,1)-l)*r:l-e.FV(r,c-1,l,n,0)*r;return f},e.DB=function(r,e,t,n,i){if(i=i===undefined?12:i,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;if(0>r||0>e||0>t||0>n)return o.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(i))return o.num;if(n>t)return o.num;if(e>=r)return 0;for(var u=(1-Math.pow(e/r,1/t)).toFixed(3),s=r*u*i/12,l=s,f=0,c=n===t?t-1:n,d=2;c>=d;d++)f=(r-l)*u,l+=f;return 1===n?s:n===t?(r-l)*u:f},e.DDB=function(r,e,t,n,i){if(i=i===undefined?2:i,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;if(0>r||0>e||0>t||0>n||0>=i)return o.num;if(n>t)return o.num;if(e>=r)return 0;for(var u=0,s=0,l=1;n>=l;l++)s=Math.min(i/t*(r-u),r-e-u),u+=s;return s},e.DISC=function(){throw Error("DISC is not implemented")},e.DOLLARDE=function(r,e){if(r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e))return o.value;if(0>e)return o.num;if(e>=0&&1>e)return o.div0;e=parseInt(e,10);var t=parseInt(r,10);t+=r%1*Math.pow(10,Math.ceil(Math.log(e)/Math.LN10))/e;var n=Math.pow(10,Math.ceil(Math.log(e)/Math.LN2)+1);return t=Math.round(t*n)/n},e.DOLLARFR=function(r,e){if(r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e))return o.value;if(0>e)return o.num;if(e>=0&&1>e)return o.div0;e=parseInt(e,10);var t=parseInt(r,10);return t+=r%1*Math.pow(10,-Math.ceil(Math.log(e)/Math.LN10))*e},e.DURATION=function(){throw Error("DURATION is not implemented")},e.EFFECT=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?o.value:0>=r||1>e?o.num:(e=parseInt(e,10),Math.pow(1+r/e,e)-1)},e.FV=function(r,e,t,n,i){if(n=n||0,i=i||0,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;var u;if(0===r)u=n+t*e;else{var s=Math.pow(1+r,e);u=1===i?n*s+t*(1+r)*(s-1)/r:n*s+t*(s-1)/r}return-u},e.FVSCHEDULE=function(r,e){if(r=a.parseNumber(r),e=a.parseNumberArray(a.flatten(e)),a.anyIsError(r,e))return o.value;for(var t=e.length,n=r,i=0;t>i;i++)n*=1+e[i];return n},e.INTRATE=function(){throw Error("INTRATE is not implemented")},e.IPMT=function(r,t,n,i,u,s){if(u=u||0,s=s||0,r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),u=a.parseNumber(u),s=a.parseNumber(s),a.anyIsError(r,t,n,i,u,s))return o.value;var l=e.PMT(r,n,i,u,s);return(1===t?1===s?0:-i:1===s?e.FV(r,t-2,l,i,1)-l:e.FV(r,t-1,l,i,0))*r},e.IRR=function(r,e){if(e=e||0,r=a.parseNumberArray(a.flatten(r)),e=a.parseNumber(e),a.anyIsError(r,e))return o.value;for(var t=[],n=!1,i=!1,u=0;r.length>u;u++)t[u]=0===u?0:t[u-1]+365,r[u]>0&&(n=!0),0>r[u]&&(i=!0);if(!n||!i)return o.num;e=e===undefined?.1:e;var s,l,f,c=e,d=!0;do{f=function(r,e,t){for(var n=t+1,i=r[0],o=1;r.length>o;o++)i+=r[o]/Math.pow(n,(e[o]-e[0])/365);return i}(r,t,c),s=c-f/function(r,e,t){for(var n=t+1,i=0,o=1;r.length>o;o++){var u=(e[o]-e[0])/365;i-=u*r[o]/Math.pow(n,u+1)}return i}(r,t,c),l=Math.abs(s-c),c=s,d=l>1e-10&&Math.abs(f)>1e-10}while(d);return c},e.ISPMT=function(r,e,t,n){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,e,t,n)?o.value:n*r*(e/t-1)},e.MDURATION=function(){throw Error("MDURATION is not implemented")},e.MIRR=function(r,t,n){if(r=a.parseNumberArray(a.flatten(r)),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,t,n))return o.value;for(var i=r.length,u=[],s=[],l=0;i>l;l++)0>r[l]?u.push(r[l]):s.push(r[l]);var f=-e.NPV(n,s)*Math.pow(1+n,i-1),c=e.NPV(t,u)*(1+t);return Math.pow(f/c,1/(i-1))-1},e.NOMINAL=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?o.value:0>=r||1>e?o.num:(e=parseInt(e,10),(Math.pow(r+1,1/e)-1)*e)},e.NPER=function(r,e,t,n,i){if(i=i===undefined?0:i,n=n===undefined?0:n,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;var u=e*(1+r*i)-n*r,s=t*r+e*(1+r*i);return Math.log(u/s)/Math.log(1+r)},e.NPV=function(){var r=a.parseNumberArray(a.flatten(arguments));if(r instanceof Error)return r;for(var e=r[0],t=0,n=1;r.length>n;n++)t+=r[n]/Math.pow(1+e,n);return t},e.ODDFPRICE=function(){throw Error("ODDFPRICE is not implemented")},e.ODDFYIELD=function(){throw Error("ODDFYIELD is not implemented")},e.ODDLPRICE=function(){throw Error("ODDLPRICE is not implemented")},e.ODDLYIELD=function(){throw Error("ODDLYIELD is not implemented")},e.PDURATION=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:r>0?(Math.log(t)-Math.log(e))/Math.log(1+r):o.num},e.PMT=function(r,e,t,n,i){if(n=n||0,i=i||0,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;var u;if(0===r)u=(t+n)/e;else{var s=Math.pow(1+r,e);u=1===i?(n*r/(s-1)+t*r/(1-1/s))/(1+r):n*r/(s-1)+t*r/(1-1/s)}return-u},e.PPMT=function(r,t,n,i,u,s){return u=u||0,s=s||0,r=a.parseNumber(r),n=a.parseNumber(n),i=a.parseNumber(i),u=a.parseNumber(u),s=a.parseNumber(s),a.anyIsError(r,n,i,u,s)?o.value:e.PMT(r,n,i,u,s)-e.IPMT(r,t,n,i,u,s)},e.PRICE=function(){throw Error("PRICE is not implemented")},e.PRICEDISC=function(){throw Error("PRICEDISC is not implemented")},e.PRICEMAT=function(){throw Error("PRICEMAT is not implemented")},e.PV=function(r,e,t,n,i){return n=n||0,i=i||0,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i)?o.value:0===r?-t*e-n:((1-Math.pow(1+r,e))/r*t*(1+r*i)-n)/Math.pow(1+r,e)},e.RATE=function(r,e,t,n,i,u){if(u=u===undefined?.01:u,n=n===undefined?0:n,i=i===undefined?0:i,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),u=a.parseNumber(u),a.anyIsError(r,e,t,n,i,u))return o.value;var s,l,f,c,d=0,m=0,p=0,h=u;for(1e-10>Math.abs(h)?s=t*(1+r*h)+e*(1+h*i)*r+n:(m=Math.exp(r*Math.log(1+h)),s=t*m+e*(1/h+i)*(m-1)+n),l=t+e*r+n,f=t*m+e*(1/h+i)*(m-1)+n,p=c=0,d=h;Math.abs(l-f)>1e-10&&50>p;)h=(f*c-l*d)/(f-l),c=d,d=h,1e-10>Math.abs(h)?s=t*(1+r*h)+e*(1+h*i)*r+n:(m=Math.exp(r*Math.log(1+h)),s=t*m+e*(1/h+i)*(m-1)+n),l=f,f=s,++p;return h},e.RECEIVED=function(){throw Error("RECEIVED is not implemented")},e.RRI=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:0===r||0===e?o.num:Math.pow(t/e,1/r)-1},e.SLN=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:0===t?o.num:(r-e)/t},e.SYD=function(r,e,t,n){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,e,t,n)?o.value:0===t?o.num:1>n||n>t?o.num:(n=parseInt(n,10),(r-e)*(t-n+1)*2/(t*(t+1)))},e.TBILLEQ=function(r,e,t){return r=a.parseDate(r),e=a.parseDate(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:t>0?r>e?o.num:e-r>31536e6?o.num:365*t/(360-t*u.DAYS360(r,e,!1)):o.num},e.TBILLPRICE=function(r,e,t){return r=a.parseDate(r),e=a.parseDate(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:t>0?r>e?o.num:e-r>31536e6?o.num:100*(1-t*u.DAYS360(r,e,!1)/360):o.num},e.TBILLYIELD=function(r,e,t){return r=a.parseDate(r),e=a.parseDate(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:t>0?r>e?o.num:e-r>31536e6?o.num:360*(100-t)/(t*u.DAYS360(r,e,!1)):o.num},e.VDB=function(){throw Error("VDB is not implemented")},e.XNPV=function(r,e,t){if(r=a.parseNumber(r),e=a.parseNumberArray(a.flatten(e)),t=a.parseDateArray(a.flatten(t)),a.anyIsError(r,e,t))return o.value;for(var n=0,i=0;e.length>i;i++)n+=e[i]/Math.pow(1+r,u.DAYS(t[i],t[0])/365);return n},e.YIELD=function(){throw Error("YIELD is not implemented")},e.YIELDDISC=function(){throw Error("YIELDDISC is not implemented")},e.YIELDMAT=function(){throw Error("YIELDMAT is not implemented")}},function(r,e,t){var n=t(0),i=t(1);e.MATCH=function(r,e,t){if(!r&&!e)return n.na;if(2===arguments.length&&(t=1),!(e instanceof Array))return n.na;if(-1!==t&&0!==t&&1!==t)return n.na;for(var i,o,u=0;e.length>u;u++)if(1===t){if(e[u]===r)return u+1;r>e[u]&&(o?e[u]>o&&(i=u+1,o=e[u]):(i=u+1,o=e[u]))}else if(0===t){if("string"==typeof r){if(r=r.replace(/\?/g,"."),e[u].toLowerCase().match(r.toLowerCase()))return u+1}else if(e[u]===r)return u+1}else if(-1===t){if(e[u]===r)return u+1;e[u]>r&&(o?o>e[u]&&(i=u+1,o=e[u]):(i=u+1,o=e[u]))}return i||n.na},e.VLOOKUP=function(r,e,t,i){if(!r||!e||!t)return n.na;i=i||!1;for(var o=0;e.length>o;o++){var u=e[o];if(!i&&u[0]===r||u[0]===r||i&&"string"==typeof u[0]&&-1!==u[0].toLowerCase().indexOf(r.toLowerCase()))return u.length+1>t?u[t-1]:n.ref}return n.na},e.HLOOKUP=function(r,e,t,o){if(!r||!e||!t)return n.na;o=o||!1;for(var u=i.transpose(e),a=0;u.length>a;a++){var s=u[a];if(!o&&s[0]===r||s[0]===r||o&&"string"==typeof s[0]&&-1!==s[0].toLowerCase().indexOf(r.toLowerCase()))return s.length+1>t?s[t-1]:n.ref}return n.na}},function(r,e,t){"use strict";function n(r,e){return r>e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL=">"},function(r,e,t){"use strict";function n(r,e){return r>=e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL=">="},function(r,e,t){"use strict";function n(r,e){return e>r}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<"},function(r,e,t){"use strict";function n(r,e){return e>=r}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<="},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r-(0,i.toNumber)(e)},(0,i.toNumber)(r));if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="-"},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r*(0,i.toNumber)(e)},(0,i.toNumber)(r));if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="*"},function(r,e,t){"use strict";function n(r,e){return r!==e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<>"},function(r,e,t){"use strict";function n(r,e){var t=Math.pow((0,i.toNumber)(r),(0,i.toNumber)(e));if(isNaN(t))throw Error(o.ERROR_VALUE);return t}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="^"},function(module,exports,__webpack_require__){(function(module,process){var grammarParser=function(){function Parser(){this.yy={}}var o=function(r,e,t,n){for(t=t||{},n=r.length;n--;t[r[n]]=e);return t},$V0=[1,5],$V1=[1,8],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,14],$V6=[1,15],$V7=[1,16],$V8=[1,12],$V9=[1,13],$Va=[1,17],$Vb=[1,19],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,24],$Vh=[1,25],$Vi=[1,26],$Vj=[1,27],$Vk=[1,28],$Vl=[5,9,10,11,13,14,15,16,17,18,19,20,29,30],$Vm=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,32],$Vn=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,34],$Vo=[5,10,11,13,14,15,16,17,29,30],$Vp=[5,10,13,14,15,16,29,30],$Vq=[5,10,11,13,14,15,16,17,18,19,29,30],$Vr=[13,29,30],parser={trace:function(){},yy:{},symbols_:{error:2,expressions:3,expression:4,EOF:5,variableSequence:6,number:7,STRING:8,"&":9,"=":10,"+":11,"(":12,")":13,"<":14,">":15,NOT:16,"-":17,"*":18,"/":19,"^":20,FUNCTION:21,expseq:22,cell:23,ABSOLUTE_CELL:24,RELATIVE_CELL:25,MIXED_CELL:26,":":27,ARRAY:28,";":29,",":30,VARIABLE:31,DECIMAL:32,NUMBER:33,"%":34,ERROR:35,$accept:0,$end:1},terminals_:{5:"EOF",8:"STRING",9:"&",10:"=",11:"+",12:"(",13:")",14:"<",15:">",16:"NOT",17:"-",18:"*",19:"/",20:"^",21:"FUNCTION",24:"ABSOLUTE_CELL",25:"RELATIVE_CELL",26:"MIXED_CELL",27:":",28:"ARRAY",29:";",30:",",31:"VARIABLE",32:"DECIMAL",33:"NUMBER",34:"%",35:"ERROR"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,3],[4,4],[4,1],[4,1],[4,2],[23,1],[23,1],[23,1],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[22,1],[22,1],[22,3],[22,3],[6,1],[6,3],[7,1],[7,3],[7,2],[2,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 2:this.$=yy.callVariable($$[$0][0]);break;case 3:this.$=yy.toNumber($$[$0]);break;case 4:this.$=yy.trimEdges($$[$0]);break;case 5:this.$=yy.evaluateByOperator("&",[$$[$0-2],$$[$0]]);break;case 6:this.$=yy.evaluateByOperator("=",[$$[$0-2],$$[$0]]);break;case 7:this.$=yy.evaluateByOperator("+",[$$[$0-2],$$[$0]]);break;case 8:this.$=$$[$0-1];break;case 9:this.$=yy.evaluateByOperator("<=",[$$[$0-3],$$[$0]]);break;case 10:this.$=yy.evaluateByOperator(">=",[$$[$0-3],$$[$0]]);break;case 11:this.$=yy.evaluateByOperator("<>",[$$[$0-3],$$[$0]]);break;case 12:this.$=yy.evaluateByOperator("NOT",[$$[$0-2],$$[$0]]);break;case 13:this.$=yy.evaluateByOperator(">",[$$[$0-2],$$[$0]]);break;case 14:this.$=yy.evaluateByOperator("<",[$$[$0-2],$$[$0]]);break;case 15:this.$=yy.evaluateByOperator("-",[$$[$0-2],$$[$0]]);break;case 16:this.$=yy.evaluateByOperator("*",[$$[$0-2],$$[$0]]);break;case 17:this.$=yy.evaluateByOperator("/",[$$[$0-2],$$[$0]]);break;case 18:this.$=yy.evaluateByOperator("^",[$$[$0-2],$$[$0]]);break;case 19:var n1=yy.invertNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 20:var n1=yy.toNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 21:this.$=yy.callFunction($$[$0-2]);break;case 22:this.$=yy.callFunction($$[$0-3],$$[$0-1]);break;case 26:case 27:case 28:this.$=yy.cellValue($$[$0]);break;case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:this.$=yy.rangeValue($$[$0-2],$$[$0]);break;case 38:case 42:this.$=[$$[$0]];break;case 39:var result=[],arr=eval("["+yytext+"]");arr.forEach(function(r){result.push(r)}),this.$=result;break;case 40:case 41:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 43:this.$=Array.isArray($$[$0-2])?$$[$0-2]:[$$[$0-2]],this.$.push($$[$0]);break;case 44:this.$=$$[$0];break;case 45:this.$=1*($$[$0-2]+"."+$$[$0]);break;case 46:this.$=.01*$$[$0-1];break;case 47:this.$=yy.throwError($$[$0])}},table:[{2:11,3:1,4:2,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{1:[3]},{5:[1,18],9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vl,[2,2],{32:[1,29]}),o($Vl,[2,3],{34:[1,30]}),o($Vl,[2,4]),{2:11,4:31,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:32,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:33,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{12:[1,34]},o($Vl,[2,23]),o($Vl,[2,24],{2:35,35:$Va}),o($Vm,[2,42]),o($Vn,[2,44],{32:[1,36]}),o($Vl,[2,26],{27:[1,37]}),o($Vl,[2,27],{27:[1,38]}),o($Vl,[2,28],{27:[1,39]}),o([5,9,10,11,13,14,15,16,17,18,19,20,29,30,35],[2,47]),{1:[2,1]},{2:11,4:40,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:41,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:42,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:45,6:3,7:4,8:$V0,10:[1,43],11:$V1,12:$V2,15:[1,44],17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:47,6:3,7:4,8:$V0,10:[1,46],11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:48,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:49,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:50,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:51,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:52,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{31:[1,53]},o($Vn,[2,46]),{9:$Vb,10:$Vc,11:$Vd,13:[1,54],14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vo,[2,19],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,20],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:57,6:3,7:4,8:$V0,11:$V1,12:$V2,13:[1,55],17:$V3,21:$V4,22:56,23:10,24:$V5,25:$V6,26:$V7,28:[1,58],31:$V8,33:$V9,35:$Va},o($Vl,[2,25]),{33:[1,59]},{24:[1,60],25:[1,61],26:[1,62]},{24:[1,63],25:[1,64],26:[1,65]},{24:[1,66],25:[1,67],26:[1,68]},o($Vl,[2,5]),o([5,10,13,29,30],[2,6],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,7],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:69,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:70,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,14],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:71,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,13],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o([5,10,13,16,29,30],[2,12],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,15],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vq,[2,16],{9:$Vb,20:$Vk}),o($Vq,[2,17],{9:$Vb,20:$Vk}),o([5,10,11,13,14,15,16,17,18,19,20,29,30],[2,18],{9:$Vb}),o($Vm,[2,43]),o($Vl,[2,8]),o($Vl,[2,21]),{13:[1,72],29:[1,73],30:[1,74]},o($Vr,[2,38],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,39]),o($Vn,[2,45]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),o($Vl,[2,37]),o($Vp,[2,9],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,11],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,10],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vl,[2,22]),{2:11,4:75,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:76,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vr,[2,40],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,41],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk})],defaultActions:{18:[2,1]},parseError:function(r,e){function t(r,e){this.message=r,this.hash=e}if(!e.recoverable)throw t.prototype=Error,new t(r,e);this.trace(r)},parse:function(r){function e(r){for(var e=n.length-1,t=0;;){if(""+c in u[r])return t;if(0===r||2>e)return!1;e-=2,r=n[e],++t}}var t=this,n=[0],i=[null],o=[],u=this.table,a="",s=0,l=0,f=0,c=2,d=o.slice.call(arguments,1),m=Object.create(this.lexer),p={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(p.yy[h]=this.yy[h]);m.setInput(r,p.yy),p.yy.lexer=m,p.yy.parser=this,"undefined"==typeof m.yylloc&&(m.yylloc={});var b=m.yylloc;o.push(b);var v=m.options&&m.options.ranges;this.parseError="function"==typeof p.yy.parseError?p.yy.parseError:Object.getPrototypeOf(this).parseError;for(var g,E,N,y,w,I,M,x,A,R=function(){var r;return r=m.lex()||1,"number"!=typeof r&&(r=t.symbols_[r]||r),r},T={};;){if(N=n[n.length-1],this.defaultActions[N]?y=this.defaultActions[N]:(null!==g&&void 0!==g||(g=R()),y=u[N]&&u[N][g]),void 0===y||!y.length||!y[0]){var C,S="";if(f)1!==E&&(C=e(N));else{C=e(N),A=[];for(I in u[N])this.terminals_[I]&&I>c&&A.push("'"+this.terminals_[I]+"'");S=m.showPosition?"Parse error on line "+(s+1)+":\n"+m.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(S,{text:m.match,token:this.terminals_[g]||g,line:m.yylineno,loc:b,expected:A,recoverable:!1!==C})}if(3==f){if(1===g||1===E)throw Error(S||"Parsing halted while starting to recover from another error.");l=m.yyleng,a=m.yytext,s=m.yylineno,b=m.yylloc,g=R()}if(!1===C)throw Error(S||"Parsing halted. No suitable error recovery rule available.");!function(r){n.length=n.length-2*r,i.length=i.length-r,o.length=o.length-r}(C),E=g==c?null:g,g=c,N=n[n.length-1],y=u[N]&&u[N][c],f=3}if(y[0]instanceof Array&&y.length>1)throw Error("Parse Error: multiple actions possible at state: "+N+", token: "+g);switch(y[0]){case 1:n.push(g),i.push(m.yytext),o.push(m.yylloc),n.push(y[1]),g=null,E?(g=E,E=null):(l=m.yyleng,a=m.yytext,s=m.yylineno,b=m.yylloc,f>0&&f--);break;case 2:if(M=this.productions_[y[1]][1],T.$=i[i.length-M],T._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},v&&(T._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),void 0!==(w=this.performAction.apply(T,[a,l,s,p.yy,y[1],i,o].concat(d))))return w;M&&(n=n.slice(0,-1*M*2),i=i.slice(0,-1*M),o=o.slice(0,-1*M)),n.push(this.productions_[y[1]][0]),i.push(T.$),o.push(T._$),x=u[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},lexer=function(){return{EOF:1,parseError:function(r,e){if(!this.yy.parser)throw Error(r);this.yy.parser.parseError(r,e)},setInput:function(r,e){return this.yy=e||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var e=r.length,t=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),t.length-1&&(this.yylineno-=t.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:t?(t.length===n.length?this.yylloc.first_column:0)+n[n.length-t.length].length-t[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return 20>r.length&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),e=Array(r.length+1).join("-");return r+this.upcomingInput()+"\n"+e+"^"},test_match:function(r,e){var t,n,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),n=r[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],t=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t)return t;if(this._backtrack){for(var o in i)this[o]=i[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,e,t,n;this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),o=0;i.length>o;o++)if((t=this._input.match(this.rules[i[o]]))&&(!e||t[0].length>e[0].length)){if(e=t,n=o,this.options.backtrack_lexer){if(!1!==(r=this.test_match(t,i[o])))return r;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(r=this.test_match(e,i[n]))&&r:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(r){this.conditionStack.push(r)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(r){return r=this.conditionStack.length-1-Math.abs(r||0),0>r?"INITIAL":this.conditionStack[r]},pushState:function(r){this.begin(r)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(r,e,t,n){switch(t){case 0:break;case 1:case 2:return 8;case 3:return 21;case 4:return 35;case 5:return 24;case 6:case 7:return 26;case 8:return 25;case 9:return 21;case 10:case 11:return 31;case 12:return 33;case 13:return 28;case 14:return 9;case 15:return" ";case 16:return 32;case 17:return 27;case 18:return 29;case 19:return 30;case 20:return 18;case 21:return 19;case 22:return 17;case 23:return 11;case 24:return 20;case 25:return 12;case 26:return 13;case 27:return 15;case 28:return 14;case 29:return 16;case 30:return'"';case 31:return"'";case 32:return"!";case 33:return 10;case 34:return 34;case 35:return"#";case 36:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9\.]+(?=[(]))/,/^(?:#[A-Z0-9\/]+(!|\?)?)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:\$[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z\.]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\[(.*)?\])/,/^(?:&)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,/^(?:=)/,/^(?:%)/,/^(?:[#])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],inclusive:!0}}}}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();exports.parser=grammarParser,exports.Parser=grammarParser.Parser,exports.parse=function(){return grammarParser.parse.apply(grammarParser,arguments)},void 0!==module&&__webpack_require__.c[__webpack_require__.s]===module&&exports.main(process.argv.slice(1))}).call(exports,__webpack_require__(102)(module),__webpack_require__(10))},function(r,e){r.exports=function(r){return r.webpackPolyfill||(r.deprecate=function(){},r.paths=[],r.children||(r.children=[]),Object.defineProperty(r,"loaded",{enumerable:!0,get:function(){return r.l}}),Object.defineProperty(r,"id",{enumerable:!0,get:function(){return r.i}}),r.webpackPolyfill=1),r}},function(r,e,t){"use strict";function n(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return r=r.substring(e,r.length-e)}e.__esModule=!0,e.trimEdges=n}])}); \ No newline at end of file +(function(){"use strict";var e={langLocaleCode:"zh-TW",cultureCode:"zh-TW",delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"千",million:"百萬",billion:"十億",trillion:"兆"},ordinal:function(){return"第"},currency:{symbol:"NT$"}};void 0!==r&&r.exports&&(r.exports=e),"undefined"!=typeof window&&window.numbro&&window.numbro.culture&&window.numbro.culture(e.cultureCode,e)}).call("undefined"==typeof window?this:window)},function(r,e,t){function n(r,e){return r.reduce(function(r,t){return e*r+t},0)}function i(r,e,t,n,i){i||(i=-1);var o,u=2/r;if(0===e)return t;if(1===e)return n;for(var a=1;a!=e;++a)o=n*a*u+i*t,t=n,n=o;return n}function o(r,e,t,n,o){return function(u,a){if(0===a)return r(u);if(1===a)return e(u);if(0>a)throw t+": Order ("+a+") must be nonnegative";if(1==n&&0===u)throw t+": Undefined when x == 0";if(2==n&&0>=u)throw t+": Undefined when x <= 0";return i(u,a,r(u),e(u),o)}}var u=Math,a=function(){function r(r){var e,i,f,c=r*r,d=u.abs(r)-.785398164;return 8>u.abs(r)?(i=n(t,c),f=n(o,c),e=i/f):(c=64/c,i=n(a,c),f=n(s,c),e=u.sqrt(l/u.abs(r))*(u.cos(d)*i-u.sin(d)*f*8/u.abs(r))),e}function e(r){var e,t,i,o=r*r,a=u.abs(r)-2.356194491;return 8>Math.abs(r)?(t=r*n(f,o),i=n(c,o),e=t/i):(o=64/o,t=n(d,o),i=n(p,o),e=u.sqrt(l/u.abs(r))*(u.cos(a)*t-u.sin(a)*i*8/u.abs(r)),0>r&&(e=-e)),e}var t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),o=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),a=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),l=.636619772,f=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),c=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),d=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),p=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(t,n){if(0===(n=Math.round(n)))return r(u.abs(t));if(1===n)return e(u.abs(t));if(0>n)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===u.abs(t))return 0;var o,a,s,l,f,c,d,p,m=2/u.abs(t);if(u.abs(t)>n)o=i(t,n,r(u.abs(t)),e(u.abs(t)),-1);else{for(s=2*u.floor((n+u.floor(u.sqrt(40*n)))/2),l=0,c=o=f=0,d=1,a=s;a>0;a--)p=a*m*d-c,c=d,d=p,u.abs(d)>1e10&&(d*=1e-10,c*=1e-10,o*=1e-10,f*=1e-10),l&&(f+=d),l=!l,a==n&&(o=c);f=2*f-d,o/=f}return 0>t&&n%2?-o:o}}(),s=function(){function r(r){var e,o,c,d=r*r,p=r-.785398164;return 8>r?(o=n(t,d),c=n(i,d),e=o/c+f*a(r,0)*u.log(r)):(d=64/d,o=n(s,d),c=n(l,d),e=u.sqrt(f/r)*(u.sin(p)*o+u.cos(p)*c*8/r)),e}function e(r){var e,t,i,o=r*r,s=r-2.356194491;return 8>r?(t=r*n(c,o),i=n(d,o),e=t/i+f*(a(r,1)*u.log(r)-1/r)):(o=64/o,t=n(p,o),i=n(m,o),e=u.sqrt(f/r)*(u.sin(s)*t+u.cos(s)*i*8/r)),e}var t=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),i=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),l=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),f=.636619772,c=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),d=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),p=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return o(r,e,"BESSELY",1,-1)}(),l=function(){function r(r){return r>3.75?u.exp(u.abs(r))/u.sqrt(u.abs(r))*n(i,3.75/u.abs(r)):n(t,r*r/14.0625)}function e(r){return 3.75>r?r*n(o,r*r/14.0625):(0>r?-1:1)*u.exp(u.abs(r))/u.sqrt(u.abs(r))*n(a,3.75/u.abs(r))}var t=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),i=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),o=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),a=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function s(t,n){if(0===(n=Math.round(n)))return r(t);if(1==n)return e(t);if(0>n)throw"BESSELI Order ("+n+") must be nonnegative";if(0===u.abs(t))return 0;var i,o,a,l,f,c,d=2/u.abs(t);for(a=2*u.round((n+u.round(u.sqrt(40*n)))/2),l=i=0,f=1,o=a;o>0;o--)c=o*d*f+l,l=f,f=c,u.abs(f)>1e10&&(f*=1e-10,l*=1e-10,i*=1e-10),o==n&&(i=l);return i*=s(t,0)/f,0>t&&n%2?-i:i}}(),f=function(){function r(r){return r>2?u.exp(-r)/u.sqrt(r)*n(i,2/r):-u.log(r/2)*l(r,0)+n(t,r*r/4)}function e(r){return r>2?u.exp(-r)/u.sqrt(r)*n(s,2/r):u.log(r/2)*l(r,1)+1/r*n(a,r*r/4)}var t=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),i=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),a=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return o(r,e,"BESSELK",2,1)}();e.besselj=a,e.bessely=s,e.besseli=l,e.besselk=f},function(module,exports,__webpack_require__){function compact(r){var e=[];return utils.arrayEach(r,function(r){r&&e.push(r)}),e}function findResultIndex(database,criterias){for(var matches={},i=1;database[0].length>i;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;criterias.length>i;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;database.length>k;++k)for(var l=1;database[k].length>l;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;criterias.length>j;++j){var criteria=criterias[j];if(criteria.length>=maxCriteriaLength){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;criteria.length>p;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&¤tCriteriaResult)}for(var result=[],n=0;database[0].length>n;++n)matches[n]&&result.push(n-1);return result}var error=__webpack_require__(0),stats=__webpack_require__(5),maths=__webpack_require__(4),utils=__webpack_require__(1);exports.FINDFIELD=function(r,e){var t=null;return utils.arrayEach(r,function(r,n){if(r[0]===e)return t=n,!1}),null==t?error.value:t},exports.DAVERAGE=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=0;return utils.arrayEach(n,function(r){u+=i[r]}),0===n.length?error.div0:u/n.length},exports.DCOUNT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.COUNT(u)},exports.DCOUNTA=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.COUNTA(u)},exports.DGET=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);return 0===n.length?error.value:n.length>1?error.num:i[n[0]]},exports.DMAX=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=i[n[0]];return utils.arrayEach(n,function(r){i[r]>u&&(u=i[r])}),u},exports.DMIN=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=i[n[0]];return utils.arrayEach(n,function(r){u>i[r]&&(u=i[r])}),u},exports.DPRODUCT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];utils.arrayEach(n,function(r){u.push(i[r])}),u=compact(u);var a=1;return utils.arrayEach(u,function(r){a*=r}),a},exports.DSTDEV=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),u=compact(u),stats.STDEV.S(u)},exports.DSTDEVP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),u=compact(u),stats.STDEV.P(u)},exports.DSUM=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),maths.SUM(u)},exports.DVAR=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.VAR.S(u)},exports.DVARP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),i=[];if("string"==typeof e){var o=exports.FINDFIELD(r,e);i=utils.rest(r[o])}else i=utils.rest(r[e]);var u=[];return utils.arrayEach(n,function(r){u.push(i[r])}),stats.VAR.P(u)}},function(r,e,t){var n=t(0),i=t(1),o=t(7);e.AND=function(){for(var r=i.flatten(arguments),e=!0,t=0;r.length>t;t++)r[t]||(e=!1);return e},e.CHOOSE=function(){if(2>arguments.length)return n.na;var r=arguments[0];return 1>r||r>254?n.value:r+1>arguments.length?n.value:arguments[r]},e.FALSE=function(){return!1},e.IF=function(r,e,t){return r?e:t},e.IFERROR=function(r,e){return o.ISERROR(r)?e:r},e.IFNA=function(r,e){return r===n.na?e:r},e.NOT=function(r){return!r},e.OR=function(){for(var r=i.flatten(arguments),e=!1,t=0;r.length>t;t++)r[t]&&(e=!0);return e},e.TRUE=function(){return!0},e.XOR=function(){for(var r=i.flatten(arguments),e=0,t=0;r.length>t;t++)r[t]&&e++;return!!(1&Math.floor(Math.abs(e)))},e.SWITCH=function(){var r;if(arguments.length>0){var e=arguments[0],t=arguments.length-1,i=Math.floor(t/2),o=!1,u=t%2!=0,a=t%2==0?null:arguments[arguments.length-1];if(i)for(var s=0;i>s;s++)if(e===arguments[2*s+1]){r=arguments[2*s+2],o=!0;break}o||(r=u?a:n.na)}else r=n.value;return r}},function(r,e,t){function n(r){return r&&r.getTime&&!isNaN(r.getTime())}function i(r){return r instanceof Date?r:new Date(r)}var o=t(0),u=t(8),a=t(1);e.ACCRINT=function(r,e,t,a,s,l,f){return r=i(r),e=i(e),t=i(t),n(r)&&n(e)&&n(t)?a>0&&s>0?-1===[1,2,4].indexOf(l)?o.num:-1===[0,1,2,3,4].indexOf(f)?o.num:t>r?(s=s||0,f=f||0,s*a*u.YEARFRAC(r,t,f)):o.num:o.num:o.value},e.ACCRINTM=function(){throw Error("ACCRINTM is not implemented")},e.AMORDEGRC=function(){throw Error("AMORDEGRC is not implemented")},e.AMORLINC=function(){throw Error("AMORLINC is not implemented")},e.COUPDAYBS=function(){throw Error("COUPDAYBS is not implemented")},e.COUPDAYS=function(){throw Error("COUPDAYS is not implemented")},e.COUPDAYSNC=function(){throw Error("COUPDAYSNC is not implemented")},e.COUPNCD=function(){throw Error("COUPNCD is not implemented")},e.COUPNUM=function(){throw Error("COUPNUM is not implemented")},e.COUPPCD=function(){throw Error("COUPPCD is not implemented")},e.CUMIPMT=function(r,t,n,i,u,s){if(r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,t,n))return o.value;if(0>=r||0>=t||0>=n)return o.num;if(1>i||1>u||i>u)return o.num;if(0!==s&&1!==s)return o.num;var l=e.PMT(r,t,n,0,s),f=0;1===i&&0===s&&(f=-n,i++);for(var c=i;u>=c;c++)f+=1===s?e.FV(r,c-2,l,n,1)-l:e.FV(r,c-1,l,n,0);return f*=r},e.CUMPRINC=function(r,t,n,i,u,s){if(r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,t,n))return o.value;if(0>=r||0>=t||0>=n)return o.num;if(1>i||1>u||i>u)return o.num;if(0!==s&&1!==s)return o.num;var l=e.PMT(r,t,n,0,s),f=0;1===i&&(f=0===s?l+n*r:l,i++);for(var c=i;u>=c;c++)f+=s>0?l-(e.FV(r,c-2,l,n,1)-l)*r:l-e.FV(r,c-1,l,n,0)*r;return f},e.DB=function(r,e,t,n,i){if(i=i===undefined?12:i,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;if(0>r||0>e||0>t||0>n)return o.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(i))return o.num;if(n>t)return o.num;if(e>=r)return 0;for(var u=(1-Math.pow(e/r,1/t)).toFixed(3),s=r*u*i/12,l=s,f=0,c=n===t?t-1:n,d=2;c>=d;d++)f=(r-l)*u,l+=f;return 1===n?s:n===t?(r-l)*u:f},e.DDB=function(r,e,t,n,i){if(i=i===undefined?2:i,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;if(0>r||0>e||0>t||0>n||0>=i)return o.num;if(n>t)return o.num;if(e>=r)return 0;for(var u=0,s=0,l=1;n>=l;l++)s=Math.min(i/t*(r-u),r-e-u),u+=s;return s},e.DISC=function(){throw Error("DISC is not implemented")},e.DOLLARDE=function(r,e){if(r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e))return o.value;if(0>e)return o.num;if(e>=0&&1>e)return o.div0;e=parseInt(e,10);var t=parseInt(r,10);t+=r%1*Math.pow(10,Math.ceil(Math.log(e)/Math.LN10))/e;var n=Math.pow(10,Math.ceil(Math.log(e)/Math.LN2)+1);return t=Math.round(t*n)/n},e.DOLLARFR=function(r,e){if(r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e))return o.value;if(0>e)return o.num;if(e>=0&&1>e)return o.div0;e=parseInt(e,10);var t=parseInt(r,10);return t+=r%1*Math.pow(10,-Math.ceil(Math.log(e)/Math.LN10))*e},e.DURATION=function(){throw Error("DURATION is not implemented")},e.EFFECT=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?o.value:0>=r||1>e?o.num:(e=parseInt(e,10),Math.pow(1+r/e,e)-1)},e.FV=function(r,e,t,n,i){if(n=n||0,i=i||0,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;var u;if(0===r)u=n+t*e;else{var s=Math.pow(1+r,e);u=1===i?n*s+t*(1+r)*(s-1)/r:n*s+t*(s-1)/r}return-u},e.FVSCHEDULE=function(r,e){if(r=a.parseNumber(r),e=a.parseNumberArray(a.flatten(e)),a.anyIsError(r,e))return o.value;for(var t=e.length,n=r,i=0;t>i;i++)n*=1+e[i];return n},e.INTRATE=function(){throw Error("INTRATE is not implemented")},e.IPMT=function(r,t,n,i,u,s){if(u=u||0,s=s||0,r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),u=a.parseNumber(u),s=a.parseNumber(s),a.anyIsError(r,t,n,i,u,s))return o.value;var l=e.PMT(r,n,i,u,s);return(1===t?1===s?0:-i:1===s?e.FV(r,t-2,l,i,1)-l:e.FV(r,t-1,l,i,0))*r},e.IRR=function(r,e){if(e=e||0,r=a.parseNumberArray(a.flatten(r)),e=a.parseNumber(e),a.anyIsError(r,e))return o.value;for(var t=[],n=!1,i=!1,u=0;r.length>u;u++)t[u]=0===u?0:t[u-1]+365,r[u]>0&&(n=!0),0>r[u]&&(i=!0);if(!n||!i)return o.num;e=e===undefined?.1:e;var s,l,f,c=e,d=!0;do{f=function(r,e,t){for(var n=t+1,i=r[0],o=1;r.length>o;o++)i+=r[o]/Math.pow(n,(e[o]-e[0])/365);return i}(r,t,c),s=c-f/function(r,e,t){for(var n=t+1,i=0,o=1;r.length>o;o++){var u=(e[o]-e[0])/365;i-=u*r[o]/Math.pow(n,u+1)}return i}(r,t,c),l=Math.abs(s-c),c=s,d=l>1e-10&&Math.abs(f)>1e-10}while(d);return c},e.ISPMT=function(r,e,t,n){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,e,t,n)?o.value:n*r*(e/t-1)},e.MDURATION=function(){throw Error("MDURATION is not implemented")},e.MIRR=function(r,t,n){if(r=a.parseNumberArray(a.flatten(r)),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,t,n))return o.value;for(var i=r.length,u=[],s=[],l=0;i>l;l++)0>r[l]?u.push(r[l]):s.push(r[l]);var f=-e.NPV(n,s)*Math.pow(1+n,i-1),c=e.NPV(t,u)*(1+t);return Math.pow(f/c,1/(i-1))-1},e.NOMINAL=function(r,e){return r=a.parseNumber(r),e=a.parseNumber(e),a.anyIsError(r,e)?o.value:0>=r||1>e?o.num:(e=parseInt(e,10),(Math.pow(r+1,1/e)-1)*e)},e.NPER=function(r,e,t,n,i){if(i=i===undefined?0:i,n=n===undefined?0:n,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;var u=e*(1+r*i)-n*r,s=t*r+e*(1+r*i);return Math.log(u/s)/Math.log(1+r)},e.NPV=function(){var r=a.parseNumberArray(a.flatten(arguments));if(r instanceof Error)return r;for(var e=r[0],t=0,n=1;r.length>n;n++)t+=r[n]/Math.pow(1+e,n);return t},e.ODDFPRICE=function(){throw Error("ODDFPRICE is not implemented")},e.ODDFYIELD=function(){throw Error("ODDFYIELD is not implemented")},e.ODDLPRICE=function(){throw Error("ODDLPRICE is not implemented")},e.ODDLYIELD=function(){throw Error("ODDLYIELD is not implemented")},e.PDURATION=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:r>0?(Math.log(t)-Math.log(e))/Math.log(1+r):o.num},e.PMT=function(r,e,t,n,i){if(n=n||0,i=i||0,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i))return o.value;var u;if(0===r)u=(t+n)/e;else{var s=Math.pow(1+r,e);u=1===i?(n*r/(s-1)+t*r/(1-1/s))/(1+r):n*r/(s-1)+t*r/(1-1/s)}return-u},e.PPMT=function(r,t,n,i,u,s){return u=u||0,s=s||0,r=a.parseNumber(r),n=a.parseNumber(n),i=a.parseNumber(i),u=a.parseNumber(u),s=a.parseNumber(s),a.anyIsError(r,n,i,u,s)?o.value:e.PMT(r,n,i,u,s)-e.IPMT(r,t,n,i,u,s)},e.PRICE=function(){throw Error("PRICE is not implemented")},e.PRICEDISC=function(){throw Error("PRICEDISC is not implemented")},e.PRICEMAT=function(){throw Error("PRICEMAT is not implemented")},e.PV=function(r,e,t,n,i){return n=n||0,i=i||0,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(r,e,t,n,i)?o.value:0===r?-t*e-n:((1-Math.pow(1+r,e))/r*t*(1+r*i)-n)/Math.pow(1+r,e)},e.RATE=function(r,e,t,n,i,u){if(u=u===undefined?.01:u,n=n===undefined?0:n,i=i===undefined?0:i,r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),u=a.parseNumber(u),a.anyIsError(r,e,t,n,i,u))return o.value;var s,l,f,c,d=0,p=0,m=0,h=u;for(1e-10>Math.abs(h)?s=t*(1+r*h)+e*(1+h*i)*r+n:(p=Math.exp(r*Math.log(1+h)),s=t*p+e*(1/h+i)*(p-1)+n),l=t+e*r+n,f=t*p+e*(1/h+i)*(p-1)+n,m=c=0,d=h;Math.abs(l-f)>1e-10&&50>m;)h=(f*c-l*d)/(f-l),c=d,d=h,1e-10>Math.abs(h)?s=t*(1+r*h)+e*(1+h*i)*r+n:(p=Math.exp(r*Math.log(1+h)),s=t*p+e*(1/h+i)*(p-1)+n),l=f,f=s,++m;return h},e.RECEIVED=function(){throw Error("RECEIVED is not implemented")},e.RRI=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:0===r||0===e?o.num:Math.pow(t/e,1/r)-1},e.SLN=function(r,e,t){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:0===t?o.num:(r-e)/t},e.SYD=function(r,e,t,n){return r=a.parseNumber(r),e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(r,e,t,n)?o.value:0===t?o.num:1>n||n>t?o.num:(n=parseInt(n,10),(r-e)*(t-n+1)*2/(t*(t+1)))},e.TBILLEQ=function(r,e,t){return r=a.parseDate(r),e=a.parseDate(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:t>0?r>e?o.num:e-r>31536e6?o.num:365*t/(360-t*u.DAYS360(r,e,!1)):o.num},e.TBILLPRICE=function(r,e,t){return r=a.parseDate(r),e=a.parseDate(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:t>0?r>e?o.num:e-r>31536e6?o.num:100*(1-t*u.DAYS360(r,e,!1)/360):o.num},e.TBILLYIELD=function(r,e,t){return r=a.parseDate(r),e=a.parseDate(e),t=a.parseNumber(t),a.anyIsError(r,e,t)?o.value:t>0?r>e?o.num:e-r>31536e6?o.num:360*(100-t)/(t*u.DAYS360(r,e,!1)):o.num},e.VDB=function(){throw Error("VDB is not implemented")},e.XNPV=function(r,e,t){if(r=a.parseNumber(r),e=a.parseNumberArray(a.flatten(e)),t=a.parseDateArray(a.flatten(t)),a.anyIsError(r,e,t))return o.value;for(var n=0,i=0;e.length>i;i++)n+=e[i]/Math.pow(1+r,u.DAYS(t[i],t[0])/365);return n},e.YIELD=function(){throw Error("YIELD is not implemented")},e.YIELDDISC=function(){throw Error("YIELDDISC is not implemented")},e.YIELDMAT=function(){throw Error("YIELDMAT is not implemented")}},function(r,e,t){var n=t(0),i=t(1);e.MATCH=function(r,e,t){if(!r&&!e)return n.na;if(2===arguments.length&&(t=1),!(e instanceof Array))return n.na;if(-1!==t&&0!==t&&1!==t)return n.na;for(var i,o,u=0;e.length>u;u++)if(1===t){if(e[u]===r)return u+1;r>e[u]&&(o?e[u]>o&&(i=u+1,o=e[u]):(i=u+1,o=e[u]))}else if(0===t){if("string"==typeof r){if(r=r.replace(/\?/g,"."),e[u].toLowerCase().match(r.toLowerCase()))return u+1}else if(e[u]===r)return u+1}else if(-1===t){if(e[u]===r)return u+1;e[u]>r&&(o?o>e[u]&&(i=u+1,o=e[u]):(i=u+1,o=e[u]))}return i||n.na},e.VLOOKUP=function(r,e,t,i){if(!r||!e||!t)return n.na;i=i||!1;for(var o=0;e.length>o;o++){var u=e[o];if(!i&&u[0]===r||u[0]===r||i&&"string"==typeof u[0]&&-1!==u[0].toLowerCase().indexOf(r.toLowerCase()))return u.length+1>t?u[t-1]:n.ref}return n.na},e.HLOOKUP=function(r,e,t,o){if(!r||!e||!t)return n.na;o=o||!1;for(var u=i.transpose(e),a=0;u.length>a;a++){var s=u[a];if(!o&&s[0]===r||s[0]===r||o&&"string"==typeof s[0]&&-1!==s[0].toLowerCase().indexOf(r.toLowerCase()))return s.length+1>t?s[t-1]:n.ref}return n.na}},function(r,e,t){"use strict";function n(r,e){return r>e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL=">"},function(r,e,t){"use strict";function n(r,e){return r>=e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL=">="},function(r,e,t){"use strict";function n(r,e){return e>r}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<"},function(r,e,t){"use strict";function n(r,e){return e>=r}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<="},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r-(0,i.toNumber)(e)},(0,i.toNumber)(r));if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="-"},function(r,e,t){"use strict";function n(r){for(var e=arguments.length,t=Array(e>1?e-1:0),n=1;e>n;n++)t[n-1]=arguments[n];var u=t.reduce(function(r,e){return r*(0,i.toNumber)(e)},(0,i.toNumber)(r));if(isNaN(u))throw Error(o.ERROR_VALUE);return u}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="*"},function(r,e,t){"use strict";function n(r,e){return r!==e}e.__esModule=!0,e["default"]=n,n.SYMBOL=e.SYMBOL="<>"},function(r,e,t){"use strict";function n(r,e){var t=Math.pow((0,i.toNumber)(r),(0,i.toNumber)(e));if(isNaN(t))throw Error(o.ERROR_VALUE);return t}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var i=t(3),o=t(2);n.SYMBOL=e.SYMBOL="^"},function(module,exports,__webpack_require__){(function(module,process){var grammarParser=function(){function Parser(){this.yy={}}var o=function(r,e,t,n){for(t=t||{},n=r.length;n--;t[r[n]]=e);return t},$V0=[1,5],$V1=[1,8],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,14],$V6=[1,15],$V7=[1,16],$V8=[1,12],$V9=[1,13],$Va=[1,17],$Vb=[1,19],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,24],$Vh=[1,25],$Vi=[1,26],$Vj=[1,27],$Vk=[1,28],$Vl=[5,9,10,11,13,14,15,16,17,18,19,20,29,30],$Vm=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,32],$Vn=[5,9,10,11,13,14,15,16,17,18,19,20,29,30,34],$Vo=[5,10,11,13,14,15,16,17,29,30],$Vp=[5,10,13,14,15,16,29,30],$Vq=[5,10,11,13,14,15,16,17,18,19,29,30],$Vr=[13,29,30],parser={trace:function(){},yy:{},symbols_:{error:2,expressions:3,expression:4,EOF:5,variableSequence:6,number:7,STRING:8,"&":9,"=":10,"+":11,"(":12,")":13,"<":14,">":15,NOT:16,"-":17,"*":18,"/":19,"^":20,FUNCTION:21,expseq:22,cell:23,ABSOLUTE_CELL:24,RELATIVE_CELL:25,MIXED_CELL:26,":":27,ARRAY:28,";":29,",":30,VARIABLE:31,DECIMAL:32,NUMBER:33,"%":34,ERROR:35,$accept:0,$end:1},terminals_:{5:"EOF",8:"STRING",9:"&",10:"=",11:"+",12:"(",13:")",14:"<",15:">",16:"NOT",17:"-",18:"*",19:"/",20:"^",21:"FUNCTION",24:"ABSOLUTE_CELL",25:"RELATIVE_CELL",26:"MIXED_CELL",27:":",28:"ARRAY",29:";",30:",",31:"VARIABLE",32:"DECIMAL",33:"NUMBER",34:"%",35:"ERROR"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,3],[4,4],[4,1],[4,1],[4,2],[23,1],[23,1],[23,1],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[22,1],[22,1],[22,3],[22,3],[6,1],[6,3],[7,1],[7,3],[7,2],[2,1]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 2:this.$=yy.callVariable($$[$0][0]);break;case 3:this.$=yy.toNumber($$[$0]);break;case 4:this.$=yy.trimEdges($$[$0]);break;case 5:this.$=yy.evaluateByOperator("&",[$$[$0-2],$$[$0]]);break;case 6:this.$=yy.evaluateByOperator("=",[$$[$0-2],$$[$0]]);break;case 7:this.$=yy.evaluateByOperator("+",[$$[$0-2],$$[$0]]);break;case 8:this.$=$$[$0-1];break;case 9:this.$=yy.evaluateByOperator("<=",[$$[$0-3],$$[$0]]);break;case 10:this.$=yy.evaluateByOperator(">=",[$$[$0-3],$$[$0]]);break;case 11:this.$=yy.evaluateByOperator("<>",[$$[$0-3],$$[$0]]);break;case 12:this.$=yy.evaluateByOperator("NOT",[$$[$0-2],$$[$0]]);break;case 13:this.$=yy.evaluateByOperator(">",[$$[$0-2],$$[$0]]);break;case 14:this.$=yy.evaluateByOperator("<",[$$[$0-2],$$[$0]]);break;case 15:this.$=yy.evaluateByOperator("-",[$$[$0-2],$$[$0]]);break;case 16:this.$=yy.evaluateByOperator("*",[$$[$0-2],$$[$0]]);break;case 17:this.$=yy.evaluateByOperator("/",[$$[$0-2],$$[$0]]);break;case 18:this.$=yy.evaluateByOperator("^",[$$[$0-2],$$[$0]]);break;case 19:var n1=yy.invertNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 20:var n1=yy.toNumber($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 21:this.$=yy.callFunction($$[$0-2]);break;case 22:this.$=yy.callFunction($$[$0-3],$$[$0-1]);break;case 26:case 27:case 28:this.$=yy.cellValue($$[$0]);break;case 29:case 30:case 31:case 32:case 33:case 34:case 35:case 36:case 37:this.$=yy.rangeValue($$[$0-2],$$[$0]);break;case 38:case 42:this.$=[$$[$0]];break;case 39:var result=[],arr=eval("["+yytext+"]");arr.forEach(function(r){result.push(r)}),this.$=result;break;case 40:case 41:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 43:this.$=Array.isArray($$[$0-2])?$$[$0-2]:[$$[$0-2]],this.$.push($$[$0]);break;case 44:this.$=$$[$0];break;case 45:this.$=1*($$[$0-2]+"."+$$[$0]);break;case 46:this.$=.01*$$[$0-1];break;case 47:this.$=yy.throwError($$[$0])}},table:[{2:11,3:1,4:2,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{1:[3]},{5:[1,18],9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vl,[2,2],{32:[1,29]}),o($Vl,[2,3],{34:[1,30]}),o($Vl,[2,4]),{2:11,4:31,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:32,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:33,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{12:[1,34]},o($Vl,[2,23]),o($Vl,[2,24],{2:35,35:$Va}),o($Vm,[2,42]),o($Vn,[2,44],{32:[1,36]}),o($Vl,[2,26],{27:[1,37]}),o($Vl,[2,27],{27:[1,38]}),o($Vl,[2,28],{27:[1,39]}),o([5,9,10,11,13,14,15,16,17,18,19,20,29,30,35],[2,47]),{1:[2,1]},{2:11,4:40,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:41,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:42,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:45,6:3,7:4,8:$V0,10:[1,43],11:$V1,12:$V2,15:[1,44],17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:47,6:3,7:4,8:$V0,10:[1,46],11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:48,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:49,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:50,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:51,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:52,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{31:[1,53]},o($Vn,[2,46]),{9:$Vb,10:$Vc,11:$Vd,13:[1,54],14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk},o($Vo,[2,19],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,20],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:57,6:3,7:4,8:$V0,11:$V1,12:$V2,13:[1,55],17:$V3,21:$V4,22:56,23:10,24:$V5,25:$V6,26:$V7,28:[1,58],31:$V8,33:$V9,35:$Va},o($Vl,[2,25]),{33:[1,59]},{24:[1,60],25:[1,61],26:[1,62]},{24:[1,63],25:[1,64],26:[1,65]},{24:[1,66],25:[1,67],26:[1,68]},o($Vl,[2,5]),o([5,10,13,29,30],[2,6],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,7],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:69,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:70,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,14],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),{2:11,4:71,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vp,[2,13],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o([5,10,13,16,29,30],[2,12],{9:$Vb,11:$Vd,14:$Ve,15:$Vf,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vo,[2,15],{9:$Vb,18:$Vi,19:$Vj,20:$Vk}),o($Vq,[2,16],{9:$Vb,20:$Vk}),o($Vq,[2,17],{9:$Vb,20:$Vk}),o([5,10,11,13,14,15,16,17,18,19,20,29,30],[2,18],{9:$Vb}),o($Vm,[2,43]),o($Vl,[2,8]),o($Vl,[2,21]),{13:[1,72],29:[1,73],30:[1,74]},o($Vr,[2,38],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,39]),o($Vn,[2,45]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),o($Vl,[2,37]),o($Vp,[2,9],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,11],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vp,[2,10],{9:$Vb,11:$Vd,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vl,[2,22]),{2:11,4:75,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},{2:11,4:76,6:3,7:4,8:$V0,11:$V1,12:$V2,17:$V3,21:$V4,23:10,24:$V5,25:$V6,26:$V7,31:$V8,33:$V9,35:$Va},o($Vr,[2,40],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk}),o($Vr,[2,41],{9:$Vb,10:$Vc,11:$Vd,14:$Ve,15:$Vf,16:$Vg,17:$Vh,18:$Vi,19:$Vj,20:$Vk})],defaultActions:{18:[2,1]},parseError:function(r,e){function t(r,e){this.message=r,this.hash=e}if(!e.recoverable)throw t.prototype=Error,new t(r,e);this.trace(r)},parse:function(r){function e(r){for(var e=n.length-1,t=0;;){if(""+c in u[r])return t;if(0===r||2>e)return!1;e-=2,r=n[e],++t}}var t=this,n=[0],i=[null],o=[],u=this.table,a="",s=0,l=0,f=0,c=2,d=o.slice.call(arguments,1),p=Object.create(this.lexer),m={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(m.yy[h]=this.yy[h]);p.setInput(r,m.yy),m.yy.lexer=p,m.yy.parser=this,"undefined"==typeof p.yylloc&&(p.yylloc={});var b=p.yylloc;o.push(b);var v=p.options&&p.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var g,E,N,y,w,I,M,x,A,R=function(){var r;return r=p.lex()||1,"number"!=typeof r&&(r=t.symbols_[r]||r),r},T={};;){if(N=n[n.length-1],this.defaultActions[N]?y=this.defaultActions[N]:(null!==g&&void 0!==g||(g=R()),y=u[N]&&u[N][g]),void 0===y||!y.length||!y[0]){var C,S="";if(f)1!==E&&(C=e(N));else{C=e(N),A=[];for(I in u[N])this.terminals_[I]&&I>c&&A.push("'"+this.terminals_[I]+"'");S=p.showPosition?"Parse error on line "+(s+1)+":\n"+p.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[g]||g)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==g?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(S,{text:p.match,token:this.terminals_[g]||g,line:p.yylineno,loc:b,expected:A,recoverable:!1!==C})}if(3==f){if(1===g||1===E)throw Error(S||"Parsing halted while starting to recover from another error.");l=p.yyleng,a=p.yytext,s=p.yylineno,b=p.yylloc,g=R()}if(!1===C)throw Error(S||"Parsing halted. No suitable error recovery rule available.");!function(r){n.length=n.length-2*r,i.length=i.length-r,o.length=o.length-r}(C),E=g==c?null:g,g=c,N=n[n.length-1],y=u[N]&&u[N][c],f=3}if(y[0]instanceof Array&&y.length>1)throw Error("Parse Error: multiple actions possible at state: "+N+", token: "+g);switch(y[0]){case 1:n.push(g),i.push(p.yytext),o.push(p.yylloc),n.push(y[1]),g=null,E?(g=E,E=null):(l=p.yyleng,a=p.yytext,s=p.yylineno,b=p.yylloc,f>0&&f--);break;case 2:if(M=this.productions_[y[1]][1],T.$=i[i.length-M],T._$={first_line:o[o.length-(M||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(M||1)].first_column,last_column:o[o.length-1].last_column},v&&(T._$.range=[o[o.length-(M||1)].range[0],o[o.length-1].range[1]]),void 0!==(w=this.performAction.apply(T,[a,l,s,m.yy,y[1],i,o].concat(d))))return w;M&&(n=n.slice(0,-1*M*2),i=i.slice(0,-1*M),o=o.slice(0,-1*M)),n.push(this.productions_[y[1]][0]),i.push(T.$),o.push(T._$),x=u[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},lexer=function(){return{EOF:1,parseError:function(r,e){if(!this.yy.parser)throw Error(r);this.yy.parser.parseError(r,e)},setInput:function(r,e){return this.yy=e||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var r=this._input[0];return this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r,r.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},unput:function(r){var e=r.length,t=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),t.length-1&&(this.yylineno-=t.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:t?(t.length===n.length?this.yylloc.first_column:0)+n[n.length-t.length].length-t[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(r){this.unput(this.match.slice(r))},pastInput:function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var r=this.match;return 20>r.length&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var r=this.pastInput(),e=Array(r.length+1).join("-");return r+this.upcomingInput()+"\n"+e+"^"},test_match:function(r,e){var t,n,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),n=r[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],t=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t)return t;if(this._backtrack){for(var o in i)this[o]=i[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,e,t,n;this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),o=0;i.length>o;o++)if((t=this._input.match(this.rules[i[o]]))&&(!e||t[0].length>e[0].length)){if(e=t,n=o,this.options.backtrack_lexer){if(!1!==(r=this.test_match(t,i[o])))return r;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(r=this.test_match(e,i[n]))&&r:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var r=this.next();return r||this.lex()},begin:function(r){this.conditionStack.push(r)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(r){return r=this.conditionStack.length-1-Math.abs(r||0),0>r?"INITIAL":this.conditionStack[r]},pushState:function(r){this.begin(r)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(r,e,t,n){switch(t){case 0:break;case 1:case 2:return 8;case 3:return 21;case 4:return 35;case 5:return 24;case 6:case 7:return 26;case 8:return 25;case 9:return 21;case 10:case 11:return 31;case 12:return 33;case 13:return 28;case 14:return 9;case 15:return" ";case 16:return 32;case 17:return 27;case 18:return 29;case 19:return 30;case 20:return 18;case 21:return 19;case 22:return 17;case 23:return 11;case 24:return 20;case 25:return 12;case 26:return 13;case 27:return 15;case 28:return 14;case 29:return 16;case 30:return'"';case 31:return"'";case 32:return"!";case 33:return 10;case 34:return 34;case 35:return"#";case 36:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9\.]+(?=[(]))/,/^(?:#[A-Z0-9\/]+(!|\?)?)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:\$[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z\.]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\[(.*)?\])/,/^(?:&)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,/^(?:=)/,/^(?:%)/,/^(?:[#])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],inclusive:!0}}}}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}();exports.parser=grammarParser,exports.Parser=grammarParser.Parser,exports.parse=function(){return grammarParser.parse.apply(grammarParser,arguments)},void 0!==module&&__webpack_require__.c[__webpack_require__.s]===module&&exports.main(process.argv.slice(1))}).call(exports,__webpack_require__(102)(module),__webpack_require__(10))},function(r,e){r.exports=function(r){return r.webpackPolyfill||(r.deprecate=function(){},r.paths=[],r.children||(r.children=[]),Object.defineProperty(r,"loaded",{enumerable:!0,get:function(){return r.l}}),Object.defineProperty(r,"id",{enumerable:!0,get:function(){return r.i}}),r.webpackPolyfill=1),r}},function(r,e,t){"use strict";function n(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return r=r.substring(e,r.length-e)}e.__esModule=!0,e.trimEdges=n}])}); \ No newline at end of file diff --git a/package.json b/package.json index c96c5436..efb03675 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hot-formula-parser", - "version": "2.2.0", + "version": "2.3.0", "description": "Formula parser", "browser": "dist/formula-parser.js", "main": "lib/index.js",