From 94a407d30391a07964c522cb96144dd5d5eb0a35 Mon Sep 17 00:00:00 2001 From: swistach Date: Fri, 16 Feb 2018 11:18:48 +0100 Subject: [PATCH] Release 2.3.2 --- dist/formula-parser.js | 54 +++++++++++++++++++------------------- dist/formula-parser.min.js | 6 ++--- package.json | 2 +- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/dist/formula-parser.js b/dist/formula-parser.js index cf7e55a7..b34ddf85 100644 --- a/dist/formula-parser.js +++ b/dist/formula-parser.js @@ -7,7 +7,7 @@ exports["formulaParser"] = factory(); else root["formulaParser"] = factory(); -})(this, function() { +})(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -4469,7 +4469,7 @@ function serial(date) { /* WEBPACK VAR INJECTION */(function(process) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! * numbro.js - * version : 1.11.0 + * version : 1.11.1 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se @@ -4483,7 +4483,7 @@ function serial(date) { ************************************/ var numbro, - VERSION = '1.11.0', + VERSION = '1.11.1', binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], bytes = { @@ -5753,9 +5753,9 @@ function serial(date) { /*global define:false */ if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { return numbro; - }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } } @@ -16383,28 +16383,28 @@ if (typeof module !== 'undefined' && __webpack_require__.c[__webpack_require__.s /* 42 */ /***/ (function(module, exports) { -module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; /***/ }), diff --git a/dist/formula-parser.min.js b/dist/formula-parser.min.js index 7403908f..2a5cad78 100644 --- a/dist/formula-parser.min.js +++ b/dist/formula-parser.min.js @@ -1,8 +1,8 @@ -!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 a=t[n]={i:n,l:!1,exports:{}};return r[n].call(a.exports,a,a.exports,e),a.l=!0,a.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 a;t--;){if((a=e.parseNumber(r[t]))===n.value)return a;r[t]=a}return r},e.parseMatrix=function(r){if(!r||0===r.length)return n.value;for(var t,a=0;r.length>a;a++)if(t=e.parseNumberArray(r[a]),r[a]=t,t instanceof Error)return t;return r};var a=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(a.getTime()+864e5*(e-2)):new Date(a.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 a(r){return-1*n(r)}e.__esModule=!0,e.toNumber=n,e.invertNumber=a},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,a=1;e>a;a++){for(var u=r[a],i=0>u?-u:u;n&&i;)n>i?n%=i:i%=n;n+=i}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,a,u=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);a=e>t?n:e}else a=2;for(n/=a,u*=a,e=r.length;e;r[--e]%a==0&&1==(r[e]/=a)&&r.splice(e,1));}return u},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="",a=3;a--;)n=(t[+e.pop()+10*a]||"")+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 a=n[0]*Math.pow(r,e),u=1;n.length>u;u++)a+=n[u]*Math.pow(r,e+u*t);return a},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,a=arguments.length+1,u=0,i=0;arguments[0].length>i;i++)if(arguments[0][i]instanceof Array)for(var o=0;arguments[0][i].length>o;o++){for(r=1,e=1;a>e;e++){if((n=utils.parseNumber(arguments[e-1][i][o]))instanceof Error)return n;r*=n}u+=r}else{for(r=1,e=1;a>e;e++){if((t=utils.parseNumber(arguments[e-1][i]))instanceof Error)return t;r*=t}u+=r}return u},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,a=0,u=0;t>u;u++)n+=e[u],a+=1;return r=n/a,isNaN(r)&&(r=error.num),r},exports.AVERAGEA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,a=0,u=0;t>u;u++){var i=e[u];"number"==typeof i&&(n+=i),!0===i&&n++,null!==i&&a++}return r=n/a,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,a,u){return 4>arguments.length?error.value:(a=a===undefined?0:a,u=u===undefined?1:u,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),a=utils.parseNumber(a),u=utils.parseNumber(u),utils.anyIsError(r,e,t,a,u)?error.value:(r=(r-a)/(u-a),n?jStat.beta.cdf(r,e,t):jStat.beta.pdf(r,e,t)))},exports.BETA.INV=function(r,e,t,n,a){return n=n===undefined?0:n,a=a===undefined?1:a,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),a=utils.parseNumber(a),utils.anyIsError(r,e,t,n,a)?error.value:jStat.beta.inv(r,e,t)*(a-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 a=0,u=t;n>=u;u++)a+=mathTrig.COMBIN(r,u)*Math.pow(e,u)*Math.pow(1-e,r-u);return a},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,a,u=r.length;for(n=0;u>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 i=r[0].length,o=1===i?u-1:(u-1)*(i-1),s=0,l=Math.PI;for(n=0;u>n;n++)for(a=0;i>a;a++)s+=Math.pow(r[n][a]-e[n][a],2)/e[n][a];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 a=t,u=e;a>1e-10*t;)u+=2,a=a*r/u,t+=a;return 1-t}(s,o))/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),a=0,u=r.length,i=0;u>i;i++)a+=(r[i]-t)*(e[i]-n);return a/u},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,a=mathTrig.SUM(e)/e.length;return t(r,n)/(r.length-1)/(t(e,a)/(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),a=jStat.mean(e),u=t.length,i=0,o=0,s=0;u>s;s++)i+=(t[s]-n)*(e[s]-a),o+=Math.pow(t[s]-n,2);var l=i/o;return a-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,a=[],u=0;n>=u;u++){a[u]=0;for(var i=0;t>i;i++)0===u?r[i]>e[0]||(a[0]+=1):n>u?r[i]>e[u-1]&&e[u]>=r[i]&&(a[u]+=1):u===n&&r[i]>e[n-1]&&(a[n]+=1)}return a},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 a;if(e===undefined)for(e=[],a=1;r.length>=a;a++)e.push(a);if(t===undefined)for(t=[],a=1;r.length>=a;a++)t.push(a);if(e=utils.parseNumberArray(e),t=utils.parseNumberArray(t),utils.anyIsError(e,t))return error.value;n===undefined&&(n=!0);var u=r.length,i=0,o=0,s=0,l=0;for(a=0;u>a;a++){var f=e[a],c=Math.log(r[a]);i+=f,o+=c,s+=f*c,l+=f*f}i/=u,o/=u,s/=u,l/=u;var p,h;n?(p=(s-i*o)/(l-i*i),h=o-p*i):(p=s/l,h=0);var m=[];for(a=0;t.length>a;a++)m.push(Math.exp(h+p*t[a]));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,a){function u(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:a?function(r,e,t,n){for(var a=0,i=0;r>=i;i++)a+=u(i,e,t,n);return a}(r,e,t,n):u(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,a=0;t>a;a++)n+=Math.pow(r[a]-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),a=e.length,u=0,i=0,o=0;a>o;o++)u+=(e[o]-n)*(r[o]-t),i+=Math.pow(e[o]-n,2);var s=u/i;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={},a=[],u=0,i=0;t>i;i++)e=r[i],n[e]=n[e]?n[e]+1:1,n[e]>u&&(u=n[e],a=[]),n[e]===u&&(a[a.length]=e);return a},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),a=r.length,u=0,i=0,o=0,s=0;a>s;s++)u+=(r[s]-t)*(e[s]-n),i+=Math.pow(r[s]-t,2),o+=Math.pow(e[s]-n,2);return u/Math.sqrt(i*o)},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,a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},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),a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},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),a=r.length,u=n.length,i=Math.pow(10,t),o=0,s=!1,l=0;!s&&u>l;)e===n[l]?(o=(r.indexOf(n[l])+1)/(a+1),s=!0):n[l]>e||e>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+1+(e-n[l])/(n[l+1]-n[l]))/(a+1),s=!0),l++;return Math.floor(o*i)/i},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),a=r.length,u=n.length,i=Math.pow(10,t),o=0,s=!1,l=0;!s&&u>l;)e===n[l]?(o=r.indexOf(n[l])/(a-1),s=!0):n[l]>e||e>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+(e-n[l])/(n[l+1]-n[l]))/(a-1),s=!0),l++;return Math.floor(o*i)/i},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 a=r.sort(function(r,e){return r-e}),u=a.length,i=0,o=0;u>o;o++)t>a[o]||a[o]>n||(i+=e[r.indexOf(a[o])]);return i},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,a=0,u=0;n>u;u++)e[u]===r&&a++;return a>1?(2*e.indexOf(r)+a+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,a=0;t>a;a++)n+=Math.pow(r[a]-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,a=0,u=0;t>u;u++)a+=Math.pow(r[u]-e,3),n+=Math.pow(r[u]-e,2);return a/=t,n/=t,a/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),a=e.length,u=0,i=0,o=0;a>o;o++)u+=(e[o]-t)*(r[o]-n),i+=Math.pow(e[o]-t,2);return u/i},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),a=e.length,u=0,i=0,o=0,s=0;a>s;s++)u+=Math.pow(r[s]-n,2),i+=(e[s]-t)*(r[s]-n),o+=Math.pow(e[s]-t,2);return Math.sqrt((u-i*i/o)/(a-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),a=jStat.mean(e),u=0,i=0;for(t=0;r.length>t;t++)u+=Math.pow(r[t]-n,2);for(t=0;e.length>t;t++)i+=Math.pow(e[t]-a,2);u/=r.length-1,i/=e.length-1;var o=Math.abs(n-a)/Math.sqrt(u/r.length+i/e.length);return exports.T.DIST["2T"](o,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),a=n[0],u=n[1],i=[];return t.forEach(function(r){i.push(a*r+u)}),i},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,a=exports.AVERAGE(e),u=0;t>u;u++)n+=Math.pow(e[u]-a,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),a=0;e>a;a++)t+=Math.pow(r[a]-n,2);return t/(e-1)},exports.VARA=function(){for(var r=utils.flatten(arguments),e=r.length,t=0,n=0,a=exports.AVERAGEA(r),u=0;e>u;u++){var i=r[u];t+="number"==typeof i?Math.pow(i-a,2):!0===i?Math.pow(1-a,2):Math.pow(0-a,2),null!==i&&n++}return t/(n-1)},exports.VARPA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,a=0,u=exports.AVERAGEA(e),i=0;t>i;i++){var o=e[i];n+="number"==typeof o?Math.pow(o-u,2):!0===o?Math.pow(1-u,2):Math.pow(0-u,2),null!==o&&a++}return r=n/a,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),a=t(0),u=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=a.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 a.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)"),u(r).format(t)},e.EXACT=function(r,e){return 2!==arguments.length?a.na:r===e},e.FIND=function(r,e,t){return 2>arguments.length?a.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 a.value;var i=t?"0":"0,0";return e>0?e>0&&(i+="."+Array(e+1).join("0")):r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),u(r).format(i)},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?a.value:r?r.substring(0,e):null},e.LEN=function(r){return 0===arguments.length?a.error:"string"==typeof r?r?r.length:0:r.length?r.length:a.value},e.LOWER=function(r){return"string"!=typeof r?a.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 a=e-1;return r.substring(a,a+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?a.value:(!0===r&&(r="TRUE"),!1===r&&(r="FALSE"),isNaN(r)&&"number"==typeof r?a.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 a.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 a.na;var n=r.match(RegExp(e));return t?n:!!n},e.REGEXREPLACE=function(r,e,t){return 3>arguments.length?a.na:r.replace(RegExp(e),t)},e.REPLACE=function(r,e,t,u){return e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r||"string"!=typeof u?a.value:r.substr(0,e-1)+u+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):a.na},e.SEARCH=function(r,e,t){var n;return"string"!=typeof r||"string"!=typeof e?a.value:(t=t===undefined?0:t,n=e.toLowerCase().indexOf(r.toLowerCase(),t-1)+1,0===n?a.value:n)},e.SPLIT=function(r,e){return r.split(e)},e.SUBSTITUTE=function(r,e,t,n){if(2>arguments.length)return a.na;if(!(r&&e&&t))return r;if(n===undefined)return r.replace(RegExp(e,"g"),t);for(var u=0,i=0;r.indexOf(e,u)>0;)if(u=r.indexOf(e,u+1),++i===n)return r.substring(0,u)+t+r.substring(u+e.length)},e.T=function(r){return"string"==typeof r?r:""},e.TEXT=function(r,e){return r=n.parseNumber(r),n.anyIsError(r)?a.na:u(r).format(e)},e.TRIM=function(r){return"string"!=typeof r?a.value:r.replace(/ +/g," ").trim()},e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(r){return"string"!=typeof r?a.value:r.toUpperCase()},e.VALUE=function(r){if("string"!=typeof r)return a.value;var e=u().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 a(r,e){return Math.ceil((e-r)/1e3/60/60/24)}function u(r){return(r-s)/864e5+(r>-22038912e5?2:1)}var i=t(0),o=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=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?i.value:0>r||0>e||0>t?i.num:new Date(r,e-1,t)},e.DATEVALUE=function(r){if("string"!=typeof r)return i.value;var e=Date.parse(r);return isNaN(e)?i.value:e>-22038912e5?(e-s)/864e5+2:(e-s)/864e5+1},e.DAY=function(r){var e=o.parseDate(r);return e instanceof Error?e:e.getDate()},e.DAYS=function(r,e){return r=o.parseDate(r),e=o.parseDate(e),r instanceof Error?r:e instanceof Error?e:u(r)-u(e)},e.DAYS360=function(r,e,t){if(t=o.parseBool(t),r=o.parseDate(r),e=o.parseDate(e),r instanceof Error)return r;if(e instanceof Error)return e;if(t instanceof Error)return t;var n,a,u=r.getMonth(),i=e.getMonth();if(t)n=31===r.getDate()?30:r.getDate(),a=31===e.getDate()?30:e.getDate();else{var s=new Date(r.getFullYear(),u+1,0).getDate(),l=new Date(e.getFullYear(),i+1,0).getDate();n=r.getDate()===s?30:r.getDate(),e.getDate()===l?30>n?(i++,a=1):a=30:a=e.getDate()}return 360*(e.getFullYear()-r.getFullYear())+30*(i-u)+(a-n)},e.EDATE=function(r,e){return(r=o.parseDate(r))instanceof Error?r:isNaN(e)?i.value:(e=parseInt(e,10),r.setMonth(r.getMonth()+e),u(r))},e.EOMONTH=function(r,e){return(r=o.parseDate(r))instanceof Error?r:isNaN(e)?i.value:(e=parseInt(e,10),u(new Date(r.getFullYear(),r.getMonth()+e+1,0)))},e.HOUR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getHours()},e.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return i.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 a=Math.floor(r/3600);r%=3600;var u=Math.floor(r/60);r%=60;var o=r;return e=e>0?e+"Y":"",t=t>0?t+"M":"",n=n>0?n+"D":"",a=a>0?a+"H":"",u=u>0?u+"M":"",o=o>0?o+"S":"","P"+e+t+n+"T"+a+u+o},e.ISOWEEKNUM=function(r){if((r=o.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=o.parseDate(r),r instanceof Error?r:r.getMinutes()},e.MONTH=function(r){return r=o.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=o.parseDate(r))instanceof Error)return r;if((e=o.parseDate(e))instanceof Error)return e;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}var s=(e-r)/864e5+1,l=s,f=r;for(a=0;s>a;a++){var p=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),h=!1;p!==t[0]&&p!==t[1]||(h=!0);for(var m=0;n.length>m;m++){var E=n[m];if(E.getDate()===f.getDate()&&E.getMonth()===f.getMonth()&&E.getFullYear()===f.getFullYear()){h=!0;break}}h&&l--,f.setDate(f.getDate()+1)}return l},e.NOW=function(){return new Date},e.SECOND=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getSeconds()},e.TIME=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?i.value:0>r||0>e||0>t?i.num:(3600*r+60*e+t)/86400},e.TIMEVALUE=function(r){return r=o.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=o.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=o.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),a=n.getDay()e)return i.num;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}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 p=n[f];if(p.getDate()===r.getDate()&&p.getMonth()===r.getMonth()&&p.getFullYear()===r.getFullYear()){s--;break}}s++}}return r},e.YEAR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getFullYear()},e.YEARFRAC=function(r,e,t){if((r=o.parseDate(r))instanceof Error)return r;if((e=o.parseDate(e))instanceof Error)return e;t=t||0;var u=r.getDate(),i=r.getMonth()+1,s=r.getFullYear(),l=e.getDate(),f=e.getMonth()+1,c=e.getFullYear();switch(t){case 0:return 31===u&&31===l?(u=30,l=30):31===u?u=30:30===u&&31===l&&(l=30),(l+30*f+360*c-(u+30*i+360*s))/360;case 1:var p=365;if(s===c||s+1===c&&(i>f||i===f&&u>=l))return(s===c&&n(s)||function(r,e){var t=r.getFullYear(),a=new Date(t,2,1);if(n(t)&&a>r&&e>=a)return!0;var u=e.getFullYear(),i=new Date(u,2,1);return n(u)&&e>=i&&i>r}(r,e)||1===f&&29===l)&&(p=366),a(r,e)/p;var h=c-s+1,m=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,E=m/h;return a(r,e)/E;case 2:return a(r,e)/360;case 3:return a(r,e)/365;case 4:return(l+30*f+360*c-(u+30*i+360*s))/360}}},function(r,e,t){(function(n){var a,u;/*! +!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()}("undefined"!=typeof self?self:this,function(){return function(r){function e(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return r[n].call(a.exports,a,a.exports,e),a.l=!0,a.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 a;t--;){if((a=e.parseNumber(r[t]))===n.value)return a;r[t]=a}return r},e.parseMatrix=function(r){if(!r||0===r.length)return n.value;for(var t,a=0;r.length>a;a++)if(t=e.parseNumberArray(r[a]),r[a]=t,t instanceof Error)return t;return r};var a=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(a.getTime()+864e5*(e-2)):new Date(a.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 a(r){return-1*n(r)}e.__esModule=!0,e.toNumber=n,e.invertNumber=a},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,a=1;e>a;a++){for(var u=r[a],i=0>u?-u:u;n&&i;)n>i?n%=i:i%=n;n+=i}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,a,u=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);a=e>t?n:e}else a=2;for(n/=a,u*=a,e=r.length;e;r[--e]%a==0&&1==(r[e]/=a)&&r.splice(e,1));}return u},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="",a=3;a--;)n=(t[+e.pop()+10*a]||"")+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 a=n[0]*Math.pow(r,e),u=1;n.length>u;u++)a+=n[u]*Math.pow(r,e+u*t);return a},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,a=arguments.length+1,u=0,i=0;arguments[0].length>i;i++)if(arguments[0][i]instanceof Array)for(var o=0;arguments[0][i].length>o;o++){for(r=1,e=1;a>e;e++){if((n=utils.parseNumber(arguments[e-1][i][o]))instanceof Error)return n;r*=n}u+=r}else{for(r=1,e=1;a>e;e++){if((t=utils.parseNumber(arguments[e-1][i]))instanceof Error)return t;r*=t}u+=r}return u},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,a=0,u=0;t>u;u++)n+=e[u],a+=1;return r=n/a,isNaN(r)&&(r=error.num),r},exports.AVERAGEA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,a=0,u=0;t>u;u++){var i=e[u];"number"==typeof i&&(n+=i),!0===i&&n++,null!==i&&a++}return r=n/a,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,a,u){return 4>arguments.length?error.value:(a=a===undefined?0:a,u=u===undefined?1:u,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),a=utils.parseNumber(a),u=utils.parseNumber(u),utils.anyIsError(r,e,t,a,u)?error.value:(r=(r-a)/(u-a),n?jStat.beta.cdf(r,e,t):jStat.beta.pdf(r,e,t)))},exports.BETA.INV=function(r,e,t,n,a){return n=n===undefined?0:n,a=a===undefined?1:a,r=utils.parseNumber(r),e=utils.parseNumber(e),t=utils.parseNumber(t),n=utils.parseNumber(n),a=utils.parseNumber(a),utils.anyIsError(r,e,t,n,a)?error.value:jStat.beta.inv(r,e,t)*(a-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 a=0,u=t;n>=u;u++)a+=mathTrig.COMBIN(r,u)*Math.pow(e,u)*Math.pow(1-e,r-u);return a},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,a,u=r.length;for(n=0;u>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 i=r[0].length,o=1===i?u-1:(u-1)*(i-1),s=0,l=Math.PI;for(n=0;u>n;n++)for(a=0;i>a;a++)s+=Math.pow(r[n][a]-e[n][a],2)/e[n][a];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 a=t,u=e;a>1e-10*t;)u+=2,a=a*r/u,t+=a;return 1-t}(s,o))/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),a=0,u=r.length,i=0;u>i;i++)a+=(r[i]-t)*(e[i]-n);return a/u},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,a=mathTrig.SUM(e)/e.length;return t(r,n)/(r.length-1)/(t(e,a)/(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),a=jStat.mean(e),u=t.length,i=0,o=0,s=0;u>s;s++)i+=(t[s]-n)*(e[s]-a),o+=Math.pow(t[s]-n,2);var l=i/o;return a-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,a=[],u=0;n>=u;u++){a[u]=0;for(var i=0;t>i;i++)0===u?r[i]>e[0]||(a[0]+=1):n>u?r[i]>e[u-1]&&e[u]>=r[i]&&(a[u]+=1):u===n&&r[i]>e[n-1]&&(a[n]+=1)}return a},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 a;if(e===undefined)for(e=[],a=1;r.length>=a;a++)e.push(a);if(t===undefined)for(t=[],a=1;r.length>=a;a++)t.push(a);if(e=utils.parseNumberArray(e),t=utils.parseNumberArray(t),utils.anyIsError(e,t))return error.value;n===undefined&&(n=!0);var u=r.length,i=0,o=0,s=0,l=0;for(a=0;u>a;a++){var f=e[a],c=Math.log(r[a]);i+=f,o+=c,s+=f*c,l+=f*f}i/=u,o/=u,s/=u,l/=u;var p,h;n?(p=(s-i*o)/(l-i*i),h=o-p*i):(p=s/l,h=0);var m=[];for(a=0;t.length>a;a++)m.push(Math.exp(h+p*t[a]));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,a){function u(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:a?function(r,e,t,n){for(var a=0,i=0;r>=i;i++)a+=u(i,e,t,n);return a}(r,e,t,n):u(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,a=0;t>a;a++)n+=Math.pow(r[a]-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),a=e.length,u=0,i=0,o=0;a>o;o++)u+=(e[o]-n)*(r[o]-t),i+=Math.pow(e[o]-n,2);var s=u/i;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={},a=[],u=0,i=0;t>i;i++)e=r[i],n[e]=n[e]?n[e]+1:1,n[e]>u&&(u=n[e],a=[]),n[e]===u&&(a[a.length]=e);return a},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),a=r.length,u=0,i=0,o=0,s=0;a>s;s++)u+=(r[s]-t)*(e[s]-n),i+=Math.pow(r[s]-t,2),o+=Math.pow(e[s]-n,2);return u/Math.sqrt(i*o)},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,a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},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),a=Math.floor(n);return utils.cleanFloat(n===a?r[n]:r[a]+(n-a)*(r[a+1]-r[a]))},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),a=r.length,u=n.length,i=Math.pow(10,t),o=0,s=!1,l=0;!s&&u>l;)e===n[l]?(o=(r.indexOf(n[l])+1)/(a+1),s=!0):n[l]>e||e>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+1+(e-n[l])/(n[l+1]-n[l]))/(a+1),s=!0),l++;return Math.floor(o*i)/i},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),a=r.length,u=n.length,i=Math.pow(10,t),o=0,s=!1,l=0;!s&&u>l;)e===n[l]?(o=r.indexOf(n[l])/(a-1),s=!0):n[l]>e||e>=n[l+1]&&l!==u-1||(o=(r.indexOf(n[l])+(e-n[l])/(n[l+1]-n[l]))/(a-1),s=!0),l++;return Math.floor(o*i)/i},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 a=r.sort(function(r,e){return r-e}),u=a.length,i=0,o=0;u>o;o++)t>a[o]||a[o]>n||(i+=e[r.indexOf(a[o])]);return i},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,a=0,u=0;n>u;u++)e[u]===r&&a++;return a>1?(2*e.indexOf(r)+a+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,a=0;t>a;a++)n+=Math.pow(r[a]-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,a=0,u=0;t>u;u++)a+=Math.pow(r[u]-e,3),n+=Math.pow(r[u]-e,2);return a/=t,n/=t,a/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),a=e.length,u=0,i=0,o=0;a>o;o++)u+=(e[o]-t)*(r[o]-n),i+=Math.pow(e[o]-t,2);return u/i},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),a=e.length,u=0,i=0,o=0,s=0;a>s;s++)u+=Math.pow(r[s]-n,2),i+=(e[s]-t)*(r[s]-n),o+=Math.pow(e[s]-t,2);return Math.sqrt((u-i*i/o)/(a-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),a=jStat.mean(e),u=0,i=0;for(t=0;r.length>t;t++)u+=Math.pow(r[t]-n,2);for(t=0;e.length>t;t++)i+=Math.pow(e[t]-a,2);u/=r.length-1,i/=e.length-1;var o=Math.abs(n-a)/Math.sqrt(u/r.length+i/e.length);return exports.T.DIST["2T"](o,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),a=n[0],u=n[1],i=[];return t.forEach(function(r){i.push(a*r+u)}),i},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,a=exports.AVERAGE(e),u=0;t>u;u++)n+=Math.pow(e[u]-a,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),a=0;e>a;a++)t+=Math.pow(r[a]-n,2);return t/(e-1)},exports.VARA=function(){for(var r=utils.flatten(arguments),e=r.length,t=0,n=0,a=exports.AVERAGEA(r),u=0;e>u;u++){var i=r[u];t+="number"==typeof i?Math.pow(i-a,2):!0===i?Math.pow(1-a,2):Math.pow(0-a,2),null!==i&&n++}return t/(n-1)},exports.VARPA=function(){for(var r,e=utils.flatten(arguments),t=e.length,n=0,a=0,u=exports.AVERAGEA(e),i=0;t>i;i++){var o=e[i];n+="number"==typeof o?Math.pow(o-u,2):!0===o?Math.pow(1-u,2):Math.pow(0-u,2),null!==o&&a++}return r=n/a,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),a=t(0),u=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=a.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 a.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)"),u(r).format(t)},e.EXACT=function(r,e){return 2!==arguments.length?a.na:r===e},e.FIND=function(r,e,t){return 2>arguments.length?a.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 a.value;var i=t?"0":"0,0";return e>0?e>0&&(i+="."+Array(e+1).join("0")):r=Math.round(r*Math.pow(10,e))/Math.pow(10,e),u(r).format(i)},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?a.value:r?r.substring(0,e):null},e.LEN=function(r){return 0===arguments.length?a.error:"string"==typeof r?r?r.length:0:r.length?r.length:a.value},e.LOWER=function(r){return"string"!=typeof r?a.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 a=e-1;return r.substring(a,a+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?a.value:(!0===r&&(r="TRUE"),!1===r&&(r="FALSE"),isNaN(r)&&"number"==typeof r?a.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 a.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 a.na;var n=r.match(RegExp(e));return t?n:!!n},e.REGEXREPLACE=function(r,e,t){return 3>arguments.length?a.na:r.replace(RegExp(e),t)},e.REPLACE=function(r,e,t,u){return e=n.parseNumber(e),t=n.parseNumber(t),n.anyIsError(e,t)||"string"!=typeof r||"string"!=typeof u?a.value:r.substr(0,e-1)+u+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):a.na},e.SEARCH=function(r,e,t){var n;return"string"!=typeof r||"string"!=typeof e?a.value:(t=t===undefined?0:t,n=e.toLowerCase().indexOf(r.toLowerCase(),t-1)+1,0===n?a.value:n)},e.SPLIT=function(r,e){return r.split(e)},e.SUBSTITUTE=function(r,e,t,n){if(2>arguments.length)return a.na;if(!(r&&e&&t))return r;if(n===undefined)return r.replace(RegExp(e,"g"),t);for(var u=0,i=0;r.indexOf(e,u)>0;)if(u=r.indexOf(e,u+1),++i===n)return r.substring(0,u)+t+r.substring(u+e.length)},e.T=function(r){return"string"==typeof r?r:""},e.TEXT=function(r,e){return r=n.parseNumber(r),n.anyIsError(r)?a.na:u(r).format(e)},e.TRIM=function(r){return"string"!=typeof r?a.value:r.replace(/ +/g," ").trim()},e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(r){return"string"!=typeof r?a.value:r.toUpperCase()},e.VALUE=function(r){if("string"!=typeof r)return a.value;var e=u().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 a(r,e){return Math.ceil((e-r)/1e3/60/60/24)}function u(r){return(r-s)/864e5+(r>-22038912e5?2:1)}var i=t(0),o=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=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?i.value:0>r||0>e||0>t?i.num:new Date(r,e-1,t)},e.DATEVALUE=function(r){if("string"!=typeof r)return i.value;var e=Date.parse(r);return isNaN(e)?i.value:e>-22038912e5?(e-s)/864e5+2:(e-s)/864e5+1},e.DAY=function(r){var e=o.parseDate(r);return e instanceof Error?e:e.getDate()},e.DAYS=function(r,e){return r=o.parseDate(r),e=o.parseDate(e),r instanceof Error?r:e instanceof Error?e:u(r)-u(e)},e.DAYS360=function(r,e,t){if(t=o.parseBool(t),r=o.parseDate(r),e=o.parseDate(e),r instanceof Error)return r;if(e instanceof Error)return e;if(t instanceof Error)return t;var n,a,u=r.getMonth(),i=e.getMonth();if(t)n=31===r.getDate()?30:r.getDate(),a=31===e.getDate()?30:e.getDate();else{var s=new Date(r.getFullYear(),u+1,0).getDate(),l=new Date(e.getFullYear(),i+1,0).getDate();n=r.getDate()===s?30:r.getDate(),e.getDate()===l?30>n?(i++,a=1):a=30:a=e.getDate()}return 360*(e.getFullYear()-r.getFullYear())+30*(i-u)+(a-n)},e.EDATE=function(r,e){return(r=o.parseDate(r))instanceof Error?r:isNaN(e)?i.value:(e=parseInt(e,10),r.setMonth(r.getMonth()+e),u(r))},e.EOMONTH=function(r,e){return(r=o.parseDate(r))instanceof Error?r:isNaN(e)?i.value:(e=parseInt(e,10),u(new Date(r.getFullYear(),r.getMonth()+e+1,0)))},e.HOUR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getHours()},e.INTERVAL=function(r){if("number"!=typeof r&&"string"!=typeof r)return i.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 a=Math.floor(r/3600);r%=3600;var u=Math.floor(r/60);r%=60;var o=r;return e=e>0?e+"Y":"",t=t>0?t+"M":"",n=n>0?n+"D":"",a=a>0?a+"H":"",u=u>0?u+"M":"",o=o>0?o+"S":"","P"+e+t+n+"T"+a+u+o},e.ISOWEEKNUM=function(r){if((r=o.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=o.parseDate(r),r instanceof Error?r:r.getMinutes()},e.MONTH=function(r){return r=o.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=o.parseDate(r))instanceof Error)return r;if((e=o.parseDate(e))instanceof Error)return e;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}var s=(e-r)/864e5+1,l=s,f=r;for(a=0;s>a;a++){var p=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),h=!1;p!==t[0]&&p!==t[1]||(h=!0);for(var m=0;n.length>m;m++){var E=n[m];if(E.getDate()===f.getDate()&&E.getMonth()===f.getMonth()&&E.getFullYear()===f.getFullYear()){h=!0;break}}h&&l--,f.setDate(f.getDate()+1)}return l},e.NOW=function(){return new Date},e.SECOND=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getSeconds()},e.TIME=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?i.value:0>r||0>e||0>t?i.num:(3600*r+60*e+t)/86400},e.TIMEVALUE=function(r){return r=o.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=o.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=o.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),a=n.getDay()e)return i.num;if(!((t=t===undefined?c[1]:c[t])instanceof Array))return i.value;n===undefined?n=[]:n instanceof Array||(n=[n]);for(var a=0;n.length>a;a++){var u=o.parseDate(n[a]);if(u instanceof Error)return u;n[a]=u}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 p=n[f];if(p.getDate()===r.getDate()&&p.getMonth()===r.getMonth()&&p.getFullYear()===r.getFullYear()){s--;break}}s++}}return r},e.YEAR=function(r){return r=o.parseDate(r),r instanceof Error?r:r.getFullYear()},e.YEARFRAC=function(r,e,t){if((r=o.parseDate(r))instanceof Error)return r;if((e=o.parseDate(e))instanceof Error)return e;t=t||0;var u=r.getDate(),i=r.getMonth()+1,s=r.getFullYear(),l=e.getDate(),f=e.getMonth()+1,c=e.getFullYear();switch(t){case 0:return 31===u&&31===l?(u=30,l=30):31===u?u=30:30===u&&31===l&&(l=30),(l+30*f+360*c-(u+30*i+360*s))/360;case 1:var p=365;if(s===c||s+1===c&&(i>f||i===f&&u>=l))return(s===c&&n(s)||function(r,e){var t=r.getFullYear(),a=new Date(t,2,1);if(n(t)&&a>r&&e>=a)return!0;var u=e.getFullYear(),i=new Date(u,2,1);return n(u)&&e>=i&&i>r}(r,e)||1===f&&29===l)&&(p=366),a(r,e)/p;var h=c-s+1,m=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,E=m/h;return a(r,e)/E;case 2:return a(r,e)/360;case 3:return a(r,e)/365;case 4:return(l+30*f+360*c-(u+30*i+360*s))/360}}},function(r,e,t){(function(n){var a,u;/*! * numbro.js - * version : 1.11.0 + * version : 1.11.1 * author : Företagsplatsen AB * license : MIT * http://www.foretagsplatsen.se */ -(function(){"use strict";function i(r){this._value=r}function o(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,a,u,i,o,l,f;return f=""+r,t=f.split("e")[0],u=f.split("e")[1],n=t.split(".")[0],a=t.split(".")[1]||"",+u>0?f=n+a+s(u-a.length):(i=0>+n?"-0":"0",e>0&&(i+="."),l=s(-1*u-1),o=(l+Math.abs(n)+a).substr(0,e),f=i+o),+u>0&&e>0&&(f+="."+s(e)),f}function f(r,e,t,n){var a,u,i=Math.pow(10,e);return(""+r).indexOf("e")>-1?(u=l(r,e),"-"!==u.charAt(0)||0>+u||(u=u.substr(1))):u=(t(r+"e+"+e)/i).toFixed(e),n&&(a=RegExp("0{1,"+n+"}$"),u=u.replace(a,"")),u}function c(r,e,t){var n=e.replace(/\{[^\{\}]*\}/g,"");return n.indexOf("$")>-1?h(r,x[$].currency.symbol,e,t):n.indexOf("%")>-1?E(r,e,t):n.indexOf(":")>-1?g(r):N(r._value,e,t)}function p(r,e){var t,n,a,u,i,o=e,s=!1;if(e.indexOf(":")>-1)r._value=d(e);else if(e===C)r._value=0;else{for("."!==x[$].delimiters.decimal&&(e=e.replace(/\./g,"").replace(x[$].delimiters.decimal,".")),t=RegExp("[^a-zA-Z]"+x[$].abbreviations.thousand+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),n=RegExp("[^a-zA-Z]"+x[$].abbreviations.million+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),a=RegExp("[^a-zA-Z]"+x[$].abbreviations.billion+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),u=RegExp("[^a-zA-Z]"+x[$].abbreviations.trillion+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),i=1;R.length>i&&!s;++i)e.indexOf(R[i])>-1?s=Math.pow(1024,i):e.indexOf(S[i])>-1&&(s=Math.pow(1e3,i));var l=e.replace(/[^0-9\.]+/g,"");""===l?r._value=NaN:(r._value=(s||1)*(o.match(t)?Math.pow(10,3):1)*(o.match(n)?Math.pow(10,6):1)*(o.match(a)?Math.pow(10,9):1)*(o.match(u)?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 h(r,e,t,n){var a,u,i=t,o=i.indexOf("$"),s=i.indexOf("("),l=i.indexOf("+"),f=i.indexOf("-"),c="",p="";if(-1===i.indexOf("$")?"infix"===x[$].currency.position?(p=e,x[$].currency.spaceSeparated&&(p=" "+p+" ")):x[$].currency.spaceSeparated&&(c=" "):i.indexOf(" $")>-1?(c=" ",i=i.replace(" $","")):i.indexOf("$ ")>-1?(c=" ",i=i.replace("$ ","")):i=i.replace("$",""),u=N(r._value,i,n,p),-1===t.indexOf("$"))switch(x[$].currency.position){case"postfix":u.indexOf(")")>-1?(u=u.split(""),u.splice(-1,0,c+e),u=u.join("")):u=u+c+e;break;case"infix":break;case"prefix":u.indexOf("(")>-1||u.indexOf("-")>-1?(u=u.split(""),a=Math.max(s,f)+1,u.splice(a,0,e+c),u=u.join("")):u=e+c+u;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else o>1?u.indexOf(")")>-1?(u=u.split(""),u.splice(-1,0,c+e),u=u.join("")):u=u+c+e:u.indexOf("(")>-1||u.indexOf("+")>-1||u.indexOf("-")>-1?(u=u.split(""),a=1,(s>o||l>o||f>o)&&(a=0),u.splice(a,0,e+c),u=u.join("")):u=e+c+u;return u}function m(r,e,t,n){return h(r,e,t,n)}function E(r,e,t){var n,a="",u=100*r._value;return e.indexOf(" %")>-1?(a=" ",e=e.replace(" %","")):e=e.replace("%",""),n=N(u,e,t),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,a+"%"),n=n.join("")):n=n+a+"%",n}function g(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 d(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 v(r,e,t){var n,a,u,i=e[0],o=Math.abs(r);if(o>=t){for(n=1;e.length>n;++n)if(a=Math.pow(t,n),u=Math.pow(t,n+1),o>=a&&u>o){i=e[n],r/=a;break}i===e[0]&&(r/=Math.pow(t,e.length-1),i=e[e.length-1])}return{value:r,suffix:i}}function N(r,e,t,n){var a,u,i,l,c,p,h,m,E,g,d,N,I,b,y,M,A=!1,R=!1,S=!1,T="",V=!1,L=!1,D=!1,w=!1,_=!1,P="",U="",F=Math.abs(r),B="",k=!1,j=!1,G="";if(0===r&&null!==C)return C;if(!isFinite(r))return""+r;if(0===e.indexOf("{")){var Y=e.indexOf("}");if(-1===Y)throw Error('Format should also contain a "}"');g=e.slice(1,Y),e=e.slice(Y+1)}else g="";if(e.indexOf("}")===e.length-1&&e.length){var q=e.indexOf("{");if(-1===q)throw Error('Format should also contain a "{"');d=e.slice(q+1,-1),e=e.slice(0,q+1)}else d="";var H;for(H=e.match(-1===e.indexOf(".")?/([0-9]+).*/:/([0-9]+)\..*/),y=null===H?-1:H[1].length,-1!==e.indexOf("-")&&(k=!0),e.indexOf("(")>-1?(A=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(R=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1&&(m=e.split(".")[0].match(/[0-9]+/g)||["0"],m=parseInt(m[0],10),V=e.indexOf("aK")>=0,L=e.indexOf("aM")>=0,D=e.indexOf("aB")>=0,w=e.indexOf("aT")>=0,_=V||L||D||w,e.indexOf(" a")>-1?(T=" ",e=e.replace(" a","")):e=e.replace("a",""),i=o(r),c=i%3,c=0===c?3:c,m&&0!==F&&(p=3*~~((Math.min(m,i)-c)/3),F/=Math.pow(10,p)),i!==m&&(F>=Math.pow(10,12)&&!_||w?(T+=x[$].abbreviations.trillion,r/=Math.pow(10,12)):F=Math.pow(10,9)&&!_||D?(T+=x[$].abbreviations.billion,r/=Math.pow(10,9)):F=Math.pow(10,6)&&!_||L?(T+=x[$].abbreviations.million,r/=Math.pow(10,6)):(F=Math.pow(10,3)&&!_||V)&&(T+=x[$].abbreviations.thousand,r/=Math.pow(10,3))),l=o(r),m&&m>l&&-1===e.indexOf(".")&&(e+="[.]",e+=s(m-l))),M=0;O.length>M;++M)if(a=O[M],e.indexOf(a.marker)>-1){e.indexOf(" "+a.marker)>-1&&(P=" "),e=e.replace(P+a.marker,""),u=v(r,a.suffixes,a.scale),r=u.value,P+=u.suffix;break}if(e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(U=" ",e=e.replace(" o","")):e=e.replace("o",""),x[$].ordinal&&(U+=x[$].ordinal(r))),e.indexOf("[.]")>-1&&(S=!0,e=e.replace("[.]",".")),E=e.split(".")[1],N=e.indexOf(","),E){var X=[];if(-1!==E.indexOf("*")?(B=""+r,X=B.split("."),X.length>1&&(B=f(r,X[1].length,t))):E.indexOf("[")>-1?(E=E.replace("]",""),E=E.split("["),B=f(r,E[0].length+E[1].length,t,E[1].length)):B=f(r,E.length,t),X=B.split("."),h=X[0],X.length>1&&X[1].length){B=(n?T+n:x[$].delimiters.decimal)+X[1]}else B="";S&&0==+B.slice(1)&&(B="")}else h=f(r,0,t);return h.indexOf("-")>-1&&(h=h.slice(1),j=!0),y>h.length&&(h=s(y-h.length)+h),N>-1&&(h=(""+h).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+x[$].delimiters.thousands)),0===e.indexOf(".")&&(h=""),I=e.indexOf("("),b=e.indexOf("-"),G=b>I?(A&&j?"(":"")+(k&&j||!A&&j?"-":""):(k&&j||!A&&j?"-":"")+(A&&j?"(":""),g+G+(!j&&R&&0!==r?"+":"")+h+B+(U||"")+(T&&!n?T:"")+(P||"")+(A&&j?")":"")+d}function I(r,e){x[r]=e}function b(r){$=r;var e=x[r].defaults;e&&e.format&&A.defaultFormat(e.format),e&&e.currencyFormat&&A.defaultCurrencyFormat(e.currencyFormat)}function y(r){var e=(""+r).split(".");return 2>e.length?1:Math.pow(10,e[1].length)}function M(){return Array.prototype.slice.call(arguments).reduce(function(r,e){var t=y(r),n=y(e);return t>n?t:n},-Infinity)}var A,R=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],S=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],T={general:{scale:1024,suffixes:S,marker:"bd"},binary:{scale:1024,suffixes:R,marker:"b"},decimal:{scale:1e3,suffixes:S,marker:"d"}},O=[T.general,T.binary,T.decimal],x={},V=x,$="en-US",C=null,L="0,0",D="0$",w=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"}};A=function(r){return r=A.isNumbro(r)?r.value():"string"==typeof r||"number"==typeof r?A.fn.unformat(r):NaN,new i(+r)},A.version="1.11.0",A.isNumbro=function(r){return r instanceof i},A.setLanguage=function(r,e){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var t=r,n=r.split("-")[0],a=null;V[t]||(Object.keys(V).forEach(function(r){a||r.split("-")[0]!==n||(a=r)}),t=a||e||"en-US"),b(t)},A.setCulture=function(r,e){var t=r,n=r.split("-")[1],a=null;x[t]||(n&&Object.keys(x).forEach(function(r){a||r.split("-")[1]!==n||(a=r)}),t=a||e||"en-US"),b(t)},A.language=function(r,e){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!r)return $;if(r&&!e){if(!V[r])throw Error("Unknown language : "+r);b(r)}return!e&&V[r]||I(r,e),A},A.culture=function(r,e){if(!r)return $;if(r&&!e){if(!x[r])throw Error("Unknown culture : "+r);b(r)}return!e&&x[r]||I(r,e),A},A.languageData=function(r){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!r)return V[$];if(!V[r])throw Error("Unknown language : "+r);return V[r]},A.cultureData=function(r){if(!r)return x[$];if(!x[r])throw Error("Unknown culture : "+r);return x[r]},A.culture("en-US",_),A.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),V},A.cultures=function(){return x},A.zeroFormat=function(r){C="string"==typeof r?r:null},A.defaultFormat=function(r){L="string"==typeof r?r:"0.0"},A.defaultCurrencyFormat=function(r){D="string"==typeof r?r:"0$"},A.validate=function(r,e){var t,n,a,u,i,o,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=A.cultureData(e)}catch(f){s=A.cultureData(A.culture())}return a=s.currency.symbol,i=s.abbreviations,t=s.delimiters.decimal,n="."===s.delimiters.thousands?"\\.":s.delimiters.thousands,(null===(l=r.match(/^[^\d\.\,]+/))||(r=r.substr(1),l[0]===a))&&((null===(l=r.match(/[^\d]+$/))||(r=r.slice(0,-1),l[0]===i.thousand||l[0]===i.million||l[0]===i.billion||l[0]===i.trillion))&&(o=RegExp(n+"{2}"),!r.match(/[^\d.,]/g)&&(u=r.split(t),2>=u.length&&(2>u.length?!!u[0].match(/^\d+.*\d$/)&&!u[0].match(o):""===u[0]?!u[0].match(o)&&!!u[1].match(/^\d+$/):1===u[0].length?!!u[0].match(/^\d+$/)&&!u[0].match(o)&&!!u[1].match(/^\d+$/):!!u[0].match(/^\d+.*\d$/)&&!u[0].match(o)&&!!u[1].match(/^\d+$/)))))},A.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),A.loadCulturesInNode()},A.loadCulturesInNode=function(){var r=t(27);for(var e in r)e&&A.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,a=this.length>>>0,u=!1;for(arguments.length>1&&(n=e,u=!0),t=0;a>t;++t)this.hasOwnProperty(t)&&(u?n=r(n,this[t],t,this):(n=this[t],u=!0));if(!u)throw new TypeError("Reduce of empty array with no initial value");return n}),A.fn=i.prototype={clone:function(){return A(this)},format:function(r,e){return c(this,r||L,e!==undefined?e:Math.round)},formatCurrency:function(r,e){return h(this,x[$].currency.symbol,r||D,e!==undefined?e:Math.round)},formatForeignCurrency:function(r,e,t){return m(this,r,e||D,t!==undefined?t:Math.round)},unformat:function(r){if("number"==typeof r)return r;if("string"==typeof r){var e=p(this,r);return isNaN(e)?undefined:e}return undefined},binaryByteUnits:function(){return v(this._value,T.binary.suffixes,T.binary.scale).suffix},byteUnits:function(){return v(this._value,T.general.suffixes,T.general.scale).suffix},decimalByteUnits:function(){return v(this._value,T.decimal.suffixes,T.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=M.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=M.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=M(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=M(r,e);return r*t/(e*t)}return this._value=[this._value,r].reduce(e),this},difference:function(r){return Math.abs(A(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}()&&A.loadCulturesInNode(),w?r.exports=A:("undefined"==typeof ender&&(this.numbro=A),a=[],(u=function(){return A}.apply(e,a))!==undefined&&(r.exports=u))}).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 a(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 u(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 i(){E&&h&&(E=!1,h.length?m=h.concat(m):g=-1,m.length&&o())}function o(){if(!E){var r=a(i);E=!0;for(var e=m.length;e;){for(h=m,m=[];++g1)for(var t=1;arguments.length>t;t++)e[t-1]=arguments[t];m.push(new s(r,e)),1!==m.length||E||a(o)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(r){return[]},p.binding=function(r){throw Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(r){throw Error("process.chdir is not supported")},p.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]"===h.call(r)}function a(r){return"number"==typeof r&&r===r}function u(r){return c.apply([],r)}function o(){return new o._init(arguments)}function s(){return 0}function l(){return 1}function f(r,e){return r===e?1:0}var c=Array.prototype.concat,p=Array.prototype.slice,h=Object.prototype.toString,m=Array.isArray||function(r){return"[object Array]"===h.call(r)};o.fn=o.prototype,o._init=function(r){var e;if(m(r[0]))if(m(r[0][0])){n(r[1])&&(r[0]=o.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])?o.map(r[0],r[1]):r[0],this.length=1;else if(a(r[0]))this[0]=o.seq.apply(null,r),this.length=1;else{if(r[0]instanceof o)return o(r[0].toArray());this[0]=[],this.length=1}return this},o._init.prototype=o.prototype,o._init.constructor=o,o.utils={calcRdx:t,isArray:m,isFunction:n,isNumber:a,toVector:u},o.extend=function(r){var e,t;if(1===arguments.length){for(t in r)o[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},o.rows=function(r){return r.length||1},o.cols=function(r){return r[0].length||1},o.dimensions=function(r){return{rows:o.rows(r),cols:o.cols(r)}},o.row=function(r,e){return m(e)?e.map(function(e){return o.row(r,e)}):r[e]},o.rowa=function(r,e){return o.row(r,e)},o.col=function(r,e){if(m(e)){var t=o.arange(r.length).map(function(r){return Array(e.length)});return e.forEach(function(e,n){o.arange(r.length).forEach(function(a){t[a][n]=r[a][e]})}),t}for(var n=Array(r.length),a=0;r.length>a;a++)n[a]=[r[a][e]];return n},o.cola=function(r,e){return o.col(r,e).map(function(r){return r[0]})},o.diag=function(r){for(var e=o.rows(r),t=Array(e),n=0;e>n;n++)t[n]=[r[n][n]];return t},o.antidiag=function(r){for(var e=o.rows(r)-1,t=Array(e),n=0;e>=0;e--,n++)t[n]=[r[n][e]];return t},o.transpose=function(r){var e,t,n,a,u,i=[];m(r[0])||(r=[r]),t=r.length,n=r[0].length;for(var u=0;n>u;u++){for(e=Array(t),a=0;t>a;a++)e[a]=r[a][u];i.push(e)}return 1===i.length?i[0]:i},o.map=function(r,e,t){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=t?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),o=0;u>o;o++)i[n][o]=e(r[n][o],n,o);return 1===i.length?i[0]:i},o.cumreduce=function(r,e,t){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=t?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),u>0&&(i[n][0]=r[n][0]),o=1;u>o;o++)i[n][o]=e(i[n][o-1],r[n][o]);return 1===i.length?i[0]:i},o.alter=function(r,e){return o.map(r,e,!0)},o.create=function(r,e,t){var a,u,i=Array(r);n(e)&&(t=e,e=r);for(var a=0;r>a;a++)for(i[a]=Array(e),u=0;e>u;u++)i[a][u]=t(a,u);return i},o.zeros=function(r,e){return a(e)||(e=r),o.create(r,e,s)},o.ones=function(r,e){return a(e)||(e=r),o.create(r,e,l)},o.rand=function(e,t){return a(t)||(t=e),o.create(e,t,r.random)},o.identity=function(r,e){return a(e)||(e=r),o.create(r,e,f)},o.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},o.clear=function(r){return o.alter(r,s)},o.seq=function(r,e,a,u){n(u)||(u=!1);var i,o=[],s=t(r,e),l=(e*s-r*s)/((a-1)*s),f=r;for(i=0;e>=f&&a>i;i++,f=(r*s+l*s*i)/s)o.push(u?u(f,i):f);return o},o.arange=function(r,t,n){var a=[];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)a.push(i);return a},o.slice=function(){function r(r,t,n,a){var u,i=[],s=r.length;if(t===e&&n===e&&a===e)return o.copy(r);if(t=t||0,n=n||r.length,t=0>t?s+t:t,n=0>n?s+n:n,a=a||1,t===n||0===a)return[];if(n>t&&0>a)return[];if(t>n&&a>0)return[];if(a>0)for(u=t;n>u;u+=a)i.push(r[u]);else for(u=t;u>n;u+=a)i.push(r[u]);return i}function t(e,t){if(t=t||{},a(t.row)){if(a(t.col))return e[t.row][t.col];var n=o.rowa(e,t.row),u=t.col||{};return r(n,u.start,u.end,u.step)}if(a(t.col)){var i=o.cola(e,t.col),s=t.row||{};return r(i,s.start,s.end,s.step)}var s=t.row||{},u=t.col||{};return r(e,s.start,s.end,s.step).map(function(e){return r(e,u.start,u.end,u.step)})}return t}(),o.sliceAssign=function(t,n,u){if(a(n.row)){if(a(n.col))return t[n.row][n.col]=u;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 i=o.arange(n.col.start,r.min(t.length,n.col.end),n.col.step),s=n.row;return i.forEach(function(r,e){t[s][r]=u[e]}),t}if(a(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=o.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]=u[e]}),t}u[0].length===e&&(u=[u]),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=o.arange(n.row.start,r.min(t.length,n.row.end),n.row.step),i=o.arange(n.col.start,r.min(t[0].length,n.col.end),n.col.step);return l.forEach(function(r,e){i.forEach(function(n,a){t[r][n]=u[e][a]})}),t},o.diagonal=function(r){var e=o.zeros(r.length,r.length);return r.forEach(function(r,t){e[t][t]=r}),e},o.copy=function(r){return r.map(function(r){return a(r)?r:r.map(function(r){return r})})};var E=o.prototype;return E.length=0,E.push=Array.prototype.push,E.sort=Array.prototype.sort,E.splice=Array.prototype.splice,E.slice=Array.prototype.slice,E.toArray=function(){return this.length>1?p.call(this):p.call(this)[0]},E.map=function(r,e){return o(o.map(this,r,e))},E.cumreduce=function(r,e){return o(o.cumreduce(this,r,e))},E.alter=function(r){return o.alter(this,r),this},function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=function(e){var t,n=this;return e?(setTimeout(function(){e.call(n,E[r].call(n))}),this):(t=o[r](this),m(t)?o(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){E[r]=function(e,t){var n=this;return t?(setTimeout(function(){t.call(n,E[r].call(n,e))}),this):o(o[r](this,e))}}(r[e])}("row col".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=Function("return jStat(jStat."+r+".apply(null, arguments));")}(r[e])}("create zeros ones rand identity".split(" ")),o}(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 a=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),a=0,u=e.length;--u>=0;)t=e[u]-n,a+=t*t;return a},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),a=Array(e),u=0;e>u;u++){var i=n.indexOf(r[u]),o=n.lastIndexOf(r[u]);if(i===o)var s=i;else var s=(i+o)/2;a[u]=s+1}return a},r.mode=function(r){for(var e,n=r.length,a=r.slice().sort(t),u=1,i=0,o=0,s=[],e=0;n>e;e++)a[e]===a[e+1]?u++:(u>i?(s=[a[e]],i=u,o=0):u===i&&(s.push(a[e]),o++),u=1);return 0===o?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,a=Array(n),u=0;n>u;u++)a[u]=e[u]-t;return a},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),a=[],u=t.length-1;u>=0;u--)a.push(e.abs(t[u]-n));return r.mean(a)},r.meddev=function(t){for(var n=r.median(t),a=[],u=t.length-1;u>=0;u--)a.push(e.abs(t[u]-n));return r.median(a)},r.coeffvar=function(e){return r.stdev(e)/r.mean(e)},r.quartiles=function(r){var n=r.length,a=r.slice().sort(t);return[a[e.round(n/4)-1],a[e.round(n/2)-1],a[e.round(3*n/4)-1]]},r.quantiles=function(r,a,u,i){var o,s,l,f,c,p,h=r.slice().sort(t),m=[a.length],E=r.length;void 0===u&&(u=3/8),void 0===i&&(i=3/8);for(var o=0;a.length>o;o++)s=a[o],l=u+s*(1-u-i),f=E*s+l,c=e.floor(n(f,1,E-1)),p=n(f-c,0,1),m[o]=(1-p)*h[c-1]+p*h[c];return m},r.percentile=function(r,e){var n=r.slice().sort(t),a=e*(n.length-1),u=parseInt(a),i=a-u;return n.length>u+1?n[u]*(1-i)+n[u+1]*i:n[u]},r.percentileOfScore=function(r,e,t){var n,a,u=0,i=r.length,o=!1;"strict"===t&&(o=!0);for(var a=0;i>a;a++)n=r[a],(o&&e>n||!o&&e>=n)&&u++;return u/i},r.histogram=function(t,n){for(var a,u=r.min(t),i=n||4,o=(r.max(t)-u)/i,s=t.length,n=[],a=0;i>a;a++)n[a]=0;for(var a=0;s>a;a++)n[e.min(e.floor((t[a]-u)/o),i-1)]+=1;return n},r.covariance=function(e,t){for(var n,a=r.mean(e),u=r.mean(t),i=e.length,o=Array(i),n=0;i>n;n++)o[n]=(e[n]-a)*(t[n]-u);return r.sum(o)/(i-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 a=r.mean(t),u=r.stdev(t),i=t.length,o=0,s=0;i>s;s++)o+=e.pow((t[s]-a)/u,n);return o/t.length},r.skewness=function(e){return r.stanMoment(e,3)},r.kurtosis=function(e){return r.stanMoment(e,4)-3};var u=r.prototype;!function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(t,n){var i=[],o=0,s=this;if(a(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[e].call(s,t))}),this;if(this.length>1){for(s=!0===t?this:this.transpose();s.length>o;o++)i[o]=r[e](s[o]);return i}return r[e](this[0],t)}}(e[t])}("cumsum cumprod".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(t,n){var i=[],o=0,s=this;if(a(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[e].call(s,t))}),this;if(this.length>1){for("sumrow"!==e&&(s=!0===t?this:this.transpose());s.length>o;o++)i[o]=r[e](s[o]);return!0===t?r[e](r.utils.toVector(i)):i}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){u[e]=function(){var t=[],n=0,i=this,o=Array.prototype.slice.call(arguments);if(a(o[o.length-1])){var s=o[o.length-1],l=o.slice(0,o.length-1);return setTimeout(function(){s.call(i,u[e].apply(i,l))}),this}var s=undefined,f=function(t){return r[e].apply(i,[t].concat(o))};if(this.length>1){for(i=i.transpose();i.length>n;n++)t[n]=f(i[n]);return t}return f(this[0])}}(e[t])}("quantiles percentileOfScore".split(" "))}(e,Math),function(r,e){r.gammaln=function(r){var t,n,a,u=0,i=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(a=(n=t=r)+5.5,a-=(t+.5)*e.log(a);6>u;u++)o+=i[u]/++n;return e.log(2.5066282746310007*o/t)-a},r.gammafn=function(r){var t,n,a,u,i=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,p=r;if(0>=p){if(!(u=p%1+3.6e-16))return Infinity;s=(1&p?-1:1)*e.PI/e.sin(e.PI*u),p=1-p}a=p,n=1>p?p++:(p-=l=(0|p)-1)-1;for(var t=0;8>t;++t)c=(c+i[t])*n,f=f*n+o[t];if(u=c/f+1,p>a)u/=a;else if(a>p)for(var t=0;l>t;++t)u*=p,p++;return s&&(u=s/u),u},r.gammap=function(e,t){return r.lowRegGamma(e,t)*r.gammafn(e)},r.lowRegGamma=function(t,n){var a,u=r.gammaln(t),i=t,o=1/t,s=o,l=n+1-t,f=1/1e-30,c=1/l,p=c,h=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>=h;h++)o+=s*=n/++i;return o*e.exp(-n+t*e.log(n)-u)}for(;m>=h;h++)a=-h*(h-t),l+=2,c=a*c+l,f=l+a/f,c=1/c,p*=c*f;return 1-p*e.exp(-n+t*e.log(n)-u)},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 a,u,i,o,s=1,l=t+n,f=t+1,c=t-1,p=1,h=1-l*r/f;for(1e-30>e.abs(h)&&(h=1e-30),h=1/h,o=h;100>=s&&(a=2*s,u=s*(n-s)*r/((c+a)*(t+a)),h=1+u*h,1e-30>e.abs(h)&&(h=1e-30),p=1+u/p,1e-30>e.abs(p)&&(p=1e-30),h=1/h,o*=h*p,u=-(t+s)*(l+s)*r/((t+a)*(f+a)),h=1+u*h,1e-30>e.abs(h)&&(h=1e-30),p=1+u/p,1e-30>e.abs(p)&&(p=1e-30),h=1/h,i=h*p,o*=i,3e-7<=e.abs(i-1));s++);return o},r.gammapinv=function(t,n){var a,u,i,o,s,l,f,c=0,p=n-1,h=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(p),f=e.exp(p*(l-1)-h),s=.5>t?t:1-t,i=e.sqrt(-2*e.log(s)),a=(2.30753+.27061*i)/(1+i*(.99229+.04481*i))-i,.5>t&&(a=-a),a=e.max(.001,n*e.pow(1-1/(9*n)-a/(3*e.sqrt(n)),3))):(i=1-n*(.253+.12*n),a=i>t?e.pow(t/i,1/n):1-e.log(1-(t-i)/(1-i)));12>c;c++){if(0>=a)return 0;if(u=r.lowRegGamma(n,a)-t,i=n>1?f*e.exp(-(a-p)+p*(e.log(a)-l)):e.exp(-a+p*e.log(a)-h),o=u/i,a-=i=o/(1-.5*e.min(1,o*((n-1)/a-1))),a>0||(a=.5*(a+i)),e.abs(i)<1e-8*a)break}return a},r.erf=function(r){var t,n,a,u,i=[-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],o=27,s=!1,l=0,f=0;for(0>r&&(r=-r,s=!0),t=2/(2+r),n=4*t-2;o>0;o--)a=l,l=n*l-f+i[o],f=a;return u=t*e.exp(-r*r+.5*(i[0]+n*l)-f),s?u-1:1-u},r.erfc=function(e){return 1-r.erf(e)},r.erfcinv=function(t){var n,a,u,i,o=0;if(t>=2)return-100;if(0>=t)return 100;for(i=1>t?t:2-t,u=e.sqrt(-2*e.log(i/2)),n=-.70711*((2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u);2>o;o++)a=r.erfc(n)-i,n+=a/(1.1283791670955126*e.exp(-n*n)-n*a);return 1>t?n:-n},r.ibetainv=function(t,n,a){var u,i,o,s,l,f,c,p,h,m,E,g=n-1,d=a-1,v=0;if(0>=t)return 0;if(t>=1)return 1;for(1>n||1>a?(u=e.log(n/(n+a)),i=e.log(a/(n+a)),s=e.exp(n*u)/n,l=e.exp(a*i)/a,m=s+l,c=s/m>t?e.pow(n*m*t,1/n):1-e.pow(a*m*(1-t),1/a)):(o=.5>t?t:1-t,s=e.sqrt(-2*e.log(o)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,.5>t&&(c=-c),p=(c*c-3)/6,h=2/(1/(2*n-1)+1/(2*a-1)),m=c*e.sqrt(p+h)/h-(1/(2*a-1)-1/(2*n-1))*(p+5/6-2/(3*h)),c=n/(n+a*e.exp(2*m))),E=-r.gammaln(n)-r.gammaln(a)+r.gammaln(n+a);10>v;v++){if(0===c||1===c)return c;if(f=r.ibeta(c,n,a)-t,s=e.exp(g*e.log(c)+d*e.log(1-c)+E),l=f/s,c-=s=l/(1-.5*e.min(1,l*(g/c-d/(1-c)))),c>0||(c=.5*(c+s)),1>c||(c=.5*(c+s+1)),e.abs(s)<1e-8*c&&v>0)break}return c},r.ibeta=function(t,n,a){var u=0===t||1===t?0:e.exp(r.gammaln(n+a)-r.gammaln(n)-r.gammaln(a)+n*e.log(t)+a*e.log(1-t));return t>=0&&1>=t&&((n+1)/(n+a+2)>t?u*r.betacf(t,n,a)/n:1-u*r.betacf(1-t,a,n)/a)},r.randn=function(t,n){var a,u,i,o,s;if(n||(n=t),t)return r.create(t,n,function(){return r.randn()});do{a=e.random(),u=1.7156*(e.random()-.5),i=a-.449871,o=e.abs(u)+.386595,s=i*i+o*(.196*o-.25472*i)}while(s>.27597&&(s>.27846||u*u>-4*e.log(a)*a*a));return u/a},r.randg=function(t,n,a){var u,i,o,s,l,f,c=t;if(a||(a=n),t||(t=1),n)return f=r.zeros(n,a),f.alter(function(){return r.randg(t)}),f;1>t&&(t+=1),u=t-1/3,i=1/e.sqrt(9*u);do{do{l=r.randn(),s=1+i*l}while(0>=s);s*=s*s,o=e.random()}while(o>1-.331*e.pow(l,4)&&e.log(o)>.5*l*l+u*(1-s+e.log(s)));if(t==c)return u*s;do{o=e.random()}while(0===o);return e.pow(o,1/c)*u*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,a){var u=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],i=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],o=.5*t;if(o>=8)return 1;var s=2*r.normal.cdf(o,0,1,1,0)-1;s=s3?2:3;for(var f=o,c=(8-o)/l,p=f+c,h=0,m=a-1,E=1;l>=E;E++){for(var g=0,d=.5*(p+f),v=.5*(p-f),N=1;12>=N;N++){var I,b;N>6?(I=12-N+1,b=u[I-1]):(I=N,b=-u[I-1]);var y=v*b,M=d+y,A=M*M;if(A>60)break;var R=2*r.normal.cdf(M,0,1,1,0),S=2*r.normal.cdf(M,t,1,1,0),T=.5*R-.5*S;Te.exp(-30/n)?(s=e.pow(s,n),1>s?s:1):0}function a(r,t,n){var a=.5-.5*r,u=e.sqrt(e.log(1/(a*a))),i=u+((((-453642210148e-16*u-.204231210125)*u-.342242088547)*u-1)*u+.322232421088)/((((.0038560700634*u+.10353775285)*u+.531103462366)*u+.588581570495)*u+.099348462606);120>n&&(i+=(i*i*i+i)/n/4);var o=.8832-.2368*i;return 120>n&&(o+=-1.214/n+1.208*i/n),i*(o*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,a){var u=r[e](t,n,a);return u.data=this,u},r[e].prototype.sample=function(t){var n=this._a,a=this._b,u=this._c;return t?r.alter(t,function(){return r[e].sample(n,a,u)}):r[e].sample(n,a,u)},function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(n){var a=this._a,u=this._b,i=this._c;return n||0===n||(n=this.data),"number"!=typeof n?r.fn.map.call(n,function(n){return r[e][t](n,a,u,i)}):r[e][t](n,a,u,i)}}(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,a){return t>1||0>t?0:1==n&&1==a?1:512>n&&512>a?e.pow(t,n-1)*e.pow(1-t,a-1)/r.betafn(n,a):e.exp((n-1)*e.log(t)+(a-1)*e.log(1-t)-r.betaln(n,a))},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,a){var u,i;return 0>t?0:n>2?(u=n*t/(a+t*n),i=a/(a+t*n),n*i/2*r.binomial.pdf((n-2)/2,(n+a-2)/2,u)):0===t&&2>n?Infinity:0===t&&2===n?1:1/r.betafn(n/2,a/2)*e.pow(n/a,n/2)*e.pow(t,n/2-1)*e.pow(1+n/a*t,-(n+a)/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,a){return 0>t?0:0===t&&1===n?1/a:e.exp((n-1)*e.log(t)-t/a-r.gammaln(n)-n*e.log(a))},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,a){return t>0?e.exp(-(n+1)*e.log(t)-a/t-r.gammaln(n)+n*e.log(a)):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,a){return 0>t?0:.5+.5*r.erf((e.log(t)-n)/e.sqrt(2*a*a))},inv:function(t,n,a){return e.exp(-1.4142135623730951*a*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,a){return 1e-14>e.abs(a)?r.studentt.pdf(t,n):1e-14>e.abs(t)?e.exp(r.gammaln((n+1)/2)-a*a/2-.5*e.log(e.PI*n)-r.gammaln(n/2)):n/t*(r.noncentralt.cdf(t*e.sqrt(1+2/n),n+2,a)-r.noncentralt.cdf(t,n,a))},cdf:function(t,n,a){if(1e-14>e.abs(a))return r.studentt.cdf(t,n);var u=!1;0>t&&(u=!0,a=-a);for(var i=r.normal.cdf(-a,0,1),o=1e-14+1,s=o,l=t*t/(t*t+n),f=0,c=e.exp(-a*a/2),p=e.exp(-a*a/2-.5*e.log(2)-r.gammaln(1.5))*a;200>f||s>1e-14||o>1e-14;)s=o,f>0&&(c*=a*a/(2*f),p*=a*a/(2*(f+.5))),o=c*r.beta.cdf(l,f+.5,n/2)+p*r.beta.cdf(l,f+1,n/2),i+=.5*o,f++;return u?1-i:i}}),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,a){return.5*(1+r.erf((t-n)/e.sqrt(2*a*a)))},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 a=n/2;return r.ibeta((t+e.sqrt(t*t+n))/(2*e.sqrt(t*t+n)),a,a)},inv:function(t,n){var a=r.ibetainv(2*e.min(t,1-t),.5*n,.5);return a=e.sqrt(n*(1-a)/a),t>.5?a:-a},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,a){return 0===a||1===a?n*a===t?1:0:r.combination(n,t)*e.pow(a,t)*e.pow(1-a,n-t)},cdf:function(e,t,n){var a=[],u=0;if(0>e)return 0;if(t>e){for(;e>=u;u++)a[u]=r.binomial.pdf(u,t,n);return r.sum(a)}return 1}}),r.extend(r.negbin,{pdf:function(t,n,a){return t===t>>>0&&(0>t?0:r.combination(t+n-1,n-1)*e.pow(1-a,t)*e.pow(a,n))},cdf:function(e,t,n){var a=0,u=0;if(0>e)return 0;for(;e>=u;u++)a+=r.negbin.pdf(u,t,n);return a}}),r.extend(r.hypgeom,{pdf:function(t,n,a,u){if(t!==t|0)return!1;if(0>t||a-(n-u)>t)return 0;if(t>u||t>a)return 0;if(2*a>n)return 2*u>n?r.hypgeom.pdf(n-a-u+t,n,n-a,n-u):r.hypgeom.pdf(u-t,n,n-a,u);if(2*u>n)return r.hypgeom.pdf(a-t,n,a,n-u);if(u>a)return r.hypgeom.pdf(t,n,u,a);for(var i=1,o=0,s=0;t>s;s++){for(;i>1&&u>o;)i*=1-a/(n-o),o++;i*=(u-s)*(a-s)/((s+1)*(n-a-u+s+1))}for(;u>o;o++)i*=1-a/(n-o);return e.min(1,e.max(0,i))},cdf:function(t,n,a,u){if(0>t||a-(n-u)>t)return 0;if(u>t&&a>t){if(2*a>n)return 2*u>n?r.hypgeom.cdf(n-a-u+t,n,n-a,n-u):1-r.hypgeom.cdf(u-t-1,n,n-a,u);if(2*u>n)return 1-r.hypgeom.cdf(a-t-1,n,a,n-u);if(u>a)return r.hypgeom.cdf(t,n,u,a);for(var i=1,o=1,s=0,l=0;t>l;l++){for(;i>1&&u>s;){var f=1-a/(n-s);o*=f,i*=f,s++}o*=(u-l)*(a-l)/((l+1)*(n-a-u+l+1)),i+=o}for(;u>s;s++)i*=1-a/(n-s);return e.min(1,e.max(0,i))}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=[],a=0;if(0>e)return 0;for(;e>=a;a++)n.push(r.poisson.pdf(a,t));return r.sum(n)},mean:function(r){return r},variance:function(r){return r},sample:function(r){var t=1,n=0,a=e.exp(-r);do{n++,t*=e.random()}while(t>a);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,a){return t>=n||t>a||a>n?NaN:r>t?n>r?r>a?1-e.pow(n-r,2)/((n-t)*(n-a)):e.pow(r-t,2)/((n-t)*(a-t)):1:0},inv:function(r,t,n,a){return t>=n||t>a||a>n?NaN:r>(a-t)/(n-t)?t+(n-t)*(1-e.sqrt((1-r)*(1-(a-t)/(n-t)))):t+(n-t)*e.sqrt(r*((a-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 a=e.random();return(n-r)/(t-r)>a?r+e.sqrt(a*(t-r)*(n-r)):t-e.sqrt((1-a)*(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 a=e.random()-.5;return r-n*t(a)*e.log(1-2*e.abs(a))}}),r.extend(r.tukey,{cdf:function(t,a,u){var i=a,o=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(0>=t)return 0;if(2>u||2>i)return NaN;if(!Number.isFinite(t))return 1;if(u>25e3)return n(t,1,i);var l,f=.5*u,c=f*e.log(u)-u*e.log(2)-r.gammaln(f),p=f-1,h=.25*u;l=u>100?u>800?u>5e3?.125:.25:.5:1,c+=e.log(l);for(var m=0,E=1;50>=E;E++){for(var g=0,d=(2*E-1)*l,v=1;16>=v;v++){var N,I;v>8?(N=v-8-1,I=c+p*e.log(d+o[N]*l)-(o[N]*l+d)*h):(N=v-1,I=c+p*e.log(d-o[N]*l)+(o[N]*l-d)*h);var b;if(I>=-30){b=v>8?t*e.sqrt(.5*(o[N]*l+d)):t*e.sqrt(.5*(-o[N]*l+d));g+=n(b,1,i)*s[N]*e.exp(I)}}if(E*l>=1&&1e-14>=g)break;m+=g}if(g>1e-14)throw Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(t,n,u){var i=n;if(2>u||2>i)return NaN;if(0>t||t>1)return NaN;if(0===t)return 0;if(1===t)return Infinity;var o,s=a(t,i,u),l=r.tukey.cdf(s,n,u)-t;o=l>0?e.max(0,s-1):s+1;for(var f,c=r.tukey.cdf(o,n,u)-t,p=1;50>p;p++){f=o-c*(o-s)/(c-l),l=c,s=o,0>f&&(f=0,c=-t),c=r.tukey.cdf(f,n,u)-t,o=f;if(1e-4>e.abs(o-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 a=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 a,u,i,o,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,i=n(t)?t[0].length:l),c=0,n(t)){for(;i>c;c++)for(a=0;s>a;a++){for(o=0,u=0;l>u;u++)o+=r[a][u]*t[u][c];f[a][c]=o}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])},dot:function(r,t){n(r[0])||(r=[r]),n(t[0])||(t=[t]);for(var a,u,i=1===r[0].length&&1!==r.length?e.transpose(r):r,o=1===t[0].length&&1!==t.length?e.transpose(t):t,s=[],l=0,f=i.length,c=i[0].length;f>l;l++){for(s[l]=[],a=0,u=0;c>u;u++)a+=i[l][u]*o[l][u];s[l]=a}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 a=0,u=0;for(isNaN(e)&&(e=2),n(r[0])&&(r=r[0]);r.length>u;u++)a+=t.pow(t.abs(r[u]),e);return t.pow(a,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++)a.apply(t[n],e[n]);return t},inv:function(r){for(var t,n=r.length,a=r[0].length,u=e.identity(n,a),i=e.gauss_jordan(r,u),o=[],s=0;n>s;s++)for(o[s]=[],t=a;i[0].length>t;t++)o[s][t-a]=i[s][t];return o},det:function(r){var e,t=r.length,n=2*t,a=Array(n),u=t-1,i=n-1,o=u-t+1,s=i,l=0,f=0;if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(;n>l;l++)a[l]=1;for(var l=0;t>l;l++){for(e=0;t>e;e++)a[0>o?o+t:o]*=r[l][e],a[t>s?s+t:s]*=r[l][e],o++,s--;o=--u-t+1,s=--i}for(var l=0;t>l;l++)f+=a[l];for(;n>l;l++)f-=a[l];return f},gauss_elimination:function(r,n){var a,u,i,o,s=0,l=0,f=r.length,c=r[0].length,p=1,h=0,m=[];r=e.aug(r,n),a=r[0].length;for(var s=0;f>s;s++){for(u=r[s][s],l=s,o=s+1;c>o;o++)uo;o++)i=r[s][o],r[s][o]=r[l][o],r[l][o]=i;for(l=s+1;f>l;l++)for(p=r[l][s]/r[s][s],o=s;a>o;o++)r[l][o]=r[l][o]-p*r[s][o]}for(var s=f-1;s>=0;s--){for(h=0,l=s+1;f-1>=l;l++)h+=m[l]*r[s][l];m[s]=(r[s][a-1]-h)/r[s][s]}return m},gauss_jordan:function(r,n){for(var a=e.aug(r,n),u=a.length,i=a[0].length,o=0,s=0;u>s;s++){for(var l=s,f=s+1;u>f;f++)t.abs(a[f][s])>t.abs(a[l][s])&&(l=f);var c=a[s];a[s]=a[l],a[l]=c;for(var f=s+1;u>f;f++){o=a[f][s]/a[s][s];for(var p=s;i>p;p++)a[f][p]-=a[s][p]*o}}for(var s=u-1;s>=0;s--){o=a[s][s];for(var f=0;s>f;f++)for(var p=i-1;p>s-1;p--)a[f][p]-=a[s][p]*a[f][s]/o;a[s][s]/=o;for(var p=u;i>p;p++)a[s][p]/=o}return a},triaUpSolve:function(r,t){var n,a=r[0].length,u=e.zeros(1,a)[0],i=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),i=!0),e.arange(a-1,-1,-1).forEach(function(i){n=e.arange(i+1,a).map(function(e){return u[e]*r[i][e]}),u[i]=(t[i]-e.sum(n))/r[i][i]}),i?u.map(function(r){return[r]}):u},triaLowSolve:function(r,t){var n,a=r[0].length,u=e.zeros(1,a)[0],i=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),i=!0),e.arange(a).forEach(function(a){n=e.arange(a).map(function(e){return r[a][e]*u[e]}),u[a]=(t[a]-e.sum(n))/r[a][a]}),i?u.map(function(r){return[r]}):u},lu:function(r){var t,n=r.length,a=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(o){e.arange(o).forEach(function(n){t=e.arange(n).map(function(r){return a[o][r]*u[r][n]}),a[o][n]=(r[o][n]-e.sum(t))/u[n][n]}),e.arange(o,n).forEach(function(n){t=e.arange(o).map(function(r){return a[o][r]*u[r][n]}),u[o][n]=r[i][n]-e.sum(t)})}),[a,u]},cholesky:function(r){var n,a=r.length,u=e.zeros(r.length,r[0].length);return e.arange(a).forEach(function(i){n=e.arange(i).map(function(r){return t.pow(u[i][r],2)}),u[i][i]=t.sqrt(r[i][i]-e.sum(n)),e.arange(i+1,a).forEach(function(t){n=e.arange(i).map(function(r){return u[i][r]*u[t][r]}),u[t][i]=(r[i][t]-e.sum(n))/u[i][i]})}),u},gauss_jacobi:function(r,n,a,u){for(var i,o,s,l,f=0,c=0,p=r.length,h=[],m=[],E=[];p>f;f++)for(h[f]=[],m[f]=[],E[f]=[],c=0;p>c;c++)f>c?(h[f][c]=r[f][c],m[f][c]=E[f][c]=0):c>f?(m[f][c]=r[f][c],h[f][c]=E[f][c]=0):(E[f][c]=r[f][c],h[f][c]=m[f][c]=0);for(s=e.multiply(e.multiply(e.inv(E),e.add(h,m)),-1),o=e.multiply(e.inv(E),n),i=a,l=e.add(e.multiply(s,a),o),f=2;t.abs(e.norm(e.subtract(l,i)))>u;)i=l,l=e.add(e.multiply(s,i),o),f++;return l},gauss_seidel:function(r,n,a,u){for(var i,o,s,l,f,c=0,p=r.length,h=[],m=[],E=[];p>c;c++)for(h[c]=[],m[c]=[],E[c]=[],i=0;p>i;i++)c>i?(h[c][i]=r[c][i],m[c][i]=E[c][i]=0):i>c?(m[c][i]=r[c][i],h[c][i]=E[c][i]=0):(E[c][i]=r[c][i],h[c][i]=m[c][i]=0);for(l=e.multiply(e.multiply(e.inv(e.add(E,h)),m),-1),s=e.multiply(e.inv(e.add(E,h)),n),o=a,f=e.add(e.multiply(l,a),s),c=2;t.abs(e.norm(e.subtract(f,o)))>u;)o=f,f=e.add(e.multiply(l,o),s),c+=1;return f},SOR:function(r,n,a,u,i){for(var o,s,l,f,c,p=0,h=r.length,m=[],E=[],g=[];h>p;p++)for(m[p]=[],E[p]=[],g[p]=[],o=0;h>o;o++)p>o?(m[p][o]=r[p][o],E[p][o]=g[p][o]=0):o>p?(E[p][o]=r[p][o],m[p][o]=g[p][o]=0):(g[p][o]=r[p][o],m[p][o]=E[p][o]=0);for(f=e.multiply(e.inv(e.add(g,e.multiply(m,i))),e.subtract(e.multiply(g,1-i),e.multiply(E,i))),l=e.multiply(e.multiply(e.inv(e.add(g,e.multiply(m,i))),n),i),s=a,c=e.add(e.multiply(f,a),l),p=2;t.abs(e.norm(e.subtract(c,s)))>u;)s=c,c=e.add(e.multiply(f,s),l),p++;return c},householder:function(r){for(var n,a,u,i,o,s=r.length,l=r[0].length,f=0,c=[],p=[];s-1>f;f++){for(n=0,i=f+1;l>i;i++)n+=r[i][f]*r[i][f];for(o=r[f+1][f]>0?-1:1,n=o*t.sqrt(n),a=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*a),u=f+2;s>u;u++)c[u][0]=r[u][f]/(2*a);p=e.subtract(e.identity(s,l),e.multiply(e.multiply(c,e.transpose(c)),2)),r=e.multiply(p,e.multiply(r,p))}return r},QR:function(){function n(n){var i=n.length,o=n[0].length;n=e.copy(n),r=e.zeros(o,o);var s,l,f;for(l=0;o>l;l++){for(r[l][l]=t.sqrt(a(u(i).map(function(r){return n[r][l]*n[r][l]}))),s=0;i>s;s++)n[s][l]=n[s][l]/r[l][l];for(f=l+1;o>f;f++)for(r[l][f]=a(u(i).map(function(r){return n[r][l]*n[r][f]})),s=0;i>s;s++)n[s][f]=n[s][f]-n[s][l]*r[l][f]}return[n,r]}var a=e.sum,u=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(a){var u=e.multiply(r[a][t],-1),i=e.slice(r,{row:a}),o=e.multiply(e.slice(r,{row:t}),u);e.sliceAssign(r,{row:a},e.add(i,o));var s=e.slice(n,{row:a}),l=e.multiply(e.slice(n,{row:t}),u);e.sliceAssign(n,{row:a},e.add(s,l))})}),n}function a(r,t){var a=!1;t[0].length===undefined&&(t=t.map(function(r){return[r]}),a=!0);var u=e.QR(r),i=u[0],o=u[1],s=r[0].length,l=e.slice(i,{col:{end:s}}),f=e.slice(o,{row:{end:s}}),c=n(f),p=e.transpose(l);p[0].length===undefined&&(p=[p]);var h=e.multiply(e.multiply(c,p),t);return h.length===undefined&&(h=[[h]]),a?h.map(function(r){return r[0]}):h}return a}(),jacobi:function(r){for(var n,a,u,i,o,s,l,f,c=1,p=0,h=r.length,m=e.identity(h,h),E=[];1===c;){p++,s=r[0][1],i=0,o=1;for(var a=0;h>a;a++)for(u=0;h>u;u++)a!=u&&s0?t.PI/4:-t.PI/4:t.atan(2*r[i][o]/(r[i][i]-r[o][o]))/2,f=e.identity(h,h),f[i][i]=t.cos(l),f[i][o]=-t.sin(l),f[o][i]=t.sin(l),f[o][o]=t.cos(l),m=e.multiply(m,f),n=e.multiply(e.multiply(e.inv(f),r),f),r=n,c=0;for(var a=1;h>a;a++)for(u=1;h>u;u++)a!=u&&t.abs(r[a][u])>.001&&(c=1)}for(var a=0;h>a;a++)E.push(r[a][a]);return[m,E]},rungekutta:function(r,e,t,n,a,u){var i,o,s,l,f;if(2===u)for(;t>=n;)i=e*r(n,a),o=e*r(n+e,a+i),s=a+(i+o)/2,a=s,n+=e;if(4===u)for(;t>=n;)i=e*r(n,a),o=e*r(n+e/2,a+i/2),l=e*r(n+e/2,a+o/2),f=e*r(n+e,a+l),s=a+(i+2*o+2*l+f)/6,a=s,n+=e;return a},romberg:function(r,e,n,a){for(var u,i,o,s,l,f=0,c=(n-e)/2,p=[],h=[],m=[];a/2>f;){for(l=r(e),o=e,s=0;n>=o;o+=c,s++)p[s]=o;for(u=p.length,o=1;u-1>o;o++)l+=(o%2!=0?4:2)*r(p[o]);l=c/3*(l+r(n)),m[f]=l,c/=2,f++}for(i=m.length,u=1;1!==i;){for(o=0;i-1>o;o++)h[o]=(t.pow(4,u)*m[o+1]-m[o])/(t.pow(4,u)-1);i=h.length,m=h,h=[],u++}return m},richardson:function(r,e,n,a){function u(r,e){for(var t,n=0,a=r.length;a>n;n++)r[n]===e&&(t=n);return t}for(var i,o,s,l,f,c=t.abs(n-r[u(r,n)+1]),p=0,h=[],m=[];a>=c;)i=u(r,n+a),o=u(r,n),h[p]=(e[i]-2*e[o]+e[2*o-i])/(a*a),a/=2,p++;for(l=h.length,s=1;1!=l;){for(f=0;l-1>f;f++)m[f]=(t.pow(4,s)*h[f+1]-h[f])/(t.pow(4,s)-1);l=m.length,h=m,m=[],s++}return h},simpson:function(r,e,t,n){for(var a,u=(t-e)/n,i=r(e),o=[],s=e,l=0,f=1;t>=s;s+=u,l++)o[l]=s;for(a=o.length;a-1>f;f++)i+=(f%2!=0?4:2)*r(o[f]);return u/3*(i+r(t))},hermite:function(r,e,t,n){for(var a,u=r.length,i=0,o=0,s=[],l=[],f=[],c=[];u>o;o++){for(s[o]=1,a=0;u>a;a++)o!=a&&(s[o]*=(n-r[a])/(r[o]-r[a]));for(l[o]=0,a=0;u>a;a++)o!=a&&(l[o]+=1/(r[o]-r[a]));f[o]=s[o]*s[o]*(1-2*(n-r[o])*l[o]),c[o]=s[o]*s[o]*(n-r[o]),i+=f[o]*e[o]+c[o]*t[o]}return i},lagrange:function(r,e,t){for(var n,a,u=0,i=0,o=r.length;o>i;i++){for(a=e[i],n=0;o>n;n++)i!=n&&(a*=(t-r[n])/(r[i]-r[n]));u+=a}return u},cubic_spline:function(r,t,n){for(var a,u=r.length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[];u-1>i;i++)c[i]=r[i+1]-r[i];l[0]=0;for(var i=1;u-1>i;i++)l[i]=3/c[i]*(t[i+1]-t[i])-3/c[i-1]*(t[i]-t[i-1]);for(var i=1;u-1>i;i++)o[i]=[],s[i]=[],o[i][i-1]=c[i-1],o[i][i]=2*(c[i-1]+c[i]),o[i][i+1]=c[i],s[i][0]=l[i];for(f=e.multiply(e.inv(o),s),a=0;u-1>a;a++)p[a]=(t[a+1]-t[a])/c[a]-c[a]*(f[a+1][0]+2*f[a][0])/3,h[a]=(f[a+1][0]-f[a][0])/(3*c[a]);for(a=0;u>a&&r[a]<=n;a++);return a-=1,t[a]+(n-r[a])*p[a]+e.sq(n-r[a])*f[a]+(n-r[a])*e.sq(n-r[a])*h[a]},gauss_quadrature:function(){throw Error("gauss_quadrature not yet implemented")},PCA:function(r){for(var t,n,a=r.length,u=r[0].length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[],m=[],E=[],g=[],i=0;a>i;i++)o[i]=e.sum(r[i])/u;for(var i=0;u>i;i++)for(h[i]=[],t=0;a>t;t++)h[i][t]=r[t][i]-o[t];h=e.transpose(h);for(var i=0;a>i;i++)for(m[i]=[],t=0;a>t;t++)m[i][t]=e.dot([h[i]],[h[t]])/(u-1);l=e.jacobi(m),E=l[0],s=l[1],g=e.transpose(E);for(var i=0;s.length>i;i++)for(t=i;s.length>t;t++)s[t]>s[i]&&(n=s[i],s[i]=s[t],s[t]=n,f=g[i],g[i]=g[t],g[t]=f);p=e.transpose(h);for(var i=0;a>i;i++)for(c[i]=[],t=0;p.length>t;t++)c[i][t]=e.dot([g[i]],[p[t]]);return[r,s,g,c]}}),function(r){for(var t=0;r.length>t;t++)!function(r){e.fn[r]=function(t,n){var a=this;return n?(setTimeout(function(){n.call(a,e.fn[r].call(a,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,a){if(r>1||n>1||0>=r||0>=n)throw Error("Proportions should be greater than 0 and less than 1");var u=(r*t+n*a)/(t+a);return(r-n)/e.sqrt(u*(1-u)*(1/t+1/a))}var n=[].slice,a=r.utils.isNumber,u=r.utils.isArray;r.extend({zscore:function(){var e=n.call(arguments);return a(e[1])?(e[0]-e[1])/e[2]:(e[0]-r.mean(e[1]))/r.stdev(e[1],e[2])},ztest:function(){var t,a=n.call(arguments);return u(a[1])?(t=r.zscore(a[0],a[1],a[3]),1===a[2]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):a.length>2?(t=r.zscore(a[0],a[1],a[2]),1===a[3]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):(t=a[0],1===a[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,a){var u=e.abs(this.zscore(t,a));return 1===n?r.normal.cdf(-u,0,1):2*r.normal.cdf(-u,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,u=n.call(arguments);return 5===u.length?(t=e.abs(r.tscore(u[0],u[1],u[2],u[3])),1===u[4]?r.studentt.cdf(-t,u[3]-1):2*r.studentt.cdf(-t,u[3]-1)):a(u[1])?(t=e.abs(u[0]),1==u[2]?r.studentt.cdf(-t,u[1]-1):2*r.studentt.cdf(-t,u[1]-1)):(t=e.abs(r.tscore(u[0],u[1])),1==u[2]?r.studentt.cdf(-t,u[1].length-1):2*r.studentt.cdf(-t,u[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,a,u,i,o,s,l,f,c=n.call(arguments);if(1===c.length){o=Array(c[0].length);for(var l=0;c[0].length>l;l++)o[l]=c[0][l];c=o}if(2===c.length)return r.variance(c[0])/r.variance(c[1]);a=[];for(var l=0;c.length>l;l++)a=a.concat(c[l]);u=r.mean(a),t=0;for(var l=0;c.length>l;l++)t+=c[l].length*e.pow(r.mean(c[l])-u,2);t/=c.length-1,s=0;for(var l=0;c.length>l;l++)for(i=r.mean(c[l]),f=0;c[l].length>f;f++)s+=e.pow(c[l][f]-i,2);return s/=a.length-c.length,t/s},anovaftest:function(){var e,t,u,i,o=n.call(arguments);if(a(o[0]))return 1-r.centralF.cdf(o[0],o[1],o[2]);anovafscore=r.anovafscore(o),e=o.length-1,u=0;for(var i=0;o.length>i;i++)u+=o[i].length;return t=u-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,u,i,o,s,l=n.call(arguments);return a(l[0])?(t=l[0],u=l[1],i=l[2],o=l[3],s=l[4]):(t=r.mean(l[0]),u=r.mean(l[1]),i=l[0].length,o=l[1].length,s=l[2]),e.abs(t-u)/(s*e.sqrt((1/i+1/o)/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 a=t[0],u=t[1];return 1-r.tukey.cdf(e,u,a-u)},tukeyhsd:function(e){for(var t=r.pooledstdev(e),n=e.map(function(e){return r.mean(e)}),a=e.reduce(function(r,e){return r+e.length},0),u=[],i=0;e.length>i;++i)for(var o=i+1;e.length>o;++o){var s=r.qtest(n[i],n[o],e[i].length,e[o].length,t,a,e.length);u.push([[i,o],s])}return u}}),r.extend({normalci:function(){var t,a=n.call(arguments),u=Array(2);return t=e.abs(4===a.length?r.normal.inv(a[1]/2,0,1)*a[2]/e.sqrt(a[3]):r.normal.inv(a[1]/2,0,1)*r.stdev(a[2])/e.sqrt(a[2].length)),u[0]=a[0]-t,u[1]=a[0]+t,u},tci:function(){var t,a=n.call(arguments),u=Array(2);return t=e.abs(4===a.length?r.studentt.inv(a[1]/2,a[3]-1)*a[2]/e.sqrt(a[3]):r.studentt.inv(a[1]/2,a[2].length-1)*r.stdev(a[2],!0)/e.sqrt(a[2].length)),u[0]=a[0]-t,u[1]=a[0]+t,u},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,a,u){var i=t(e,n,a,u);return r.ztest(i,1)},twoSidedDifferenceOfProportions:function(e,n,a,u){var i=t(e,n,a,u);return r.ztest(i,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(a){var u=e.arange(n).filter(function(r){return r!==a});return t(e.col(r,a).map(function(r){return r[0]}),e.col(r,u))})}function t(r,t){var n=r.length,a=t[0].length-1,u=n-a-1,i=e.lstsq(t,r),o=e.multiply(t,i.map(function(r){return[r]})).map(function(r){return r[0]}),s=e.subtract(r,o),l=e.mean(r),f=e.sum(o.map(function(r){return Math.pow(r-l,2)})),c=e.sum(r.map(function(r,e){return Math.pow(r-o[e],2)})),p=f+c;return{exog:t,endog:r,nobs:n,df_model:a,df_resid:u,coef:i,predict:o,resid:s,ybar:l,SST:p,SSE:f,SSR:c,R2:f/p}}function n(t){var n=r(t.exog),a=Math.sqrt(t.SSR/t.df_resid),u=n.map(function(r){var e=r.SST,t=r.R2;return a/Math.sqrt(e*(1-t))}),i=t.coef.map(function(r,e){return(r-0)/u[e]}),o=i.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*u[e];return[r-t,r+t]});return{se:u,t:i,p:o,sigmaHat:a,interval95:l}}function a(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 u(r,e){var u=t(r,e),i=n(u),o=a(u),s=1-(u.nobs-1)/u.df_resid*(1-u.R2);return u.t=i,u.f=o,u.adjust_R2=s,u}return{ols:u}}(),e.jStat=e,e})},function(r,e,t){var n=t(1),a=t(9),u=t(0);e.UNIQUE=function(){for(var r=[],e=0;arguments.length>e;++e){for(var t=!1,n=arguments[e],a=0;r.length>a&&!(t=r[a]===n);++a);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 u.error;try{for(var t=e.split("."),n=r,a=0;t.length>a;++a){var i=t[a];if("]"===i[i.length-1]){var o=i.indexOf("["),s=i.substring(o+1,i.length-1);n=n[i.substring(0,o)][s]}else n=n[i]}return n}catch(u){}},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 a(r).format(e)}},function(r,e,t){function n(r){return/^[01]{1,10}$/.test(r)}var a=t(0),u=t(11).jStat,i=t(6),o=t(1),s=t(28);e.BESSELI=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besseli(r,e)},e.BESSELJ=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besselj(r,e)},e.BESSELK=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besselk(r,e)},e.BESSELY=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.bessely(r,e)},e.BIN2DEC=function(r){if(!n(r))return a.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 a.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(0xfffffffe00+parseInt(t.substring(1),2)).toString(16);var u=parseInt(r,2).toString(16);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.BIN2OCT=function(r,e){if(!n(r))return a.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(1073741312+parseInt(t.substring(1),2)).toString(8);var u=parseInt(r,2).toString(8);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.BITAND=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r&e},e.BITLSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(e)>53?a.num:0>e?r>>-e:r<r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r|e},e.BITRSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(e)>53?a.num:0>e?r<<-e:r>>e},e.BITXOR=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r^e},e.COMPLEX=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?r:"i"!==(t=t===undefined?"i":t)&&"j"!==t?a.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=o.parseNumber(r))instanceof Error)return r;for(var n,u=[["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]],i={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,p=t,h=1,m=1,E=0;146>E;E++)n=null===u[E][2]?[]:u[E][2],u[E][1]!==c&&0>n.indexOf(c)||(l=u[E]),u[E][1]!==p&&0>n.indexOf(p)||(f=u[E]);if(null===l){var g=i[e.substring(0,2)],d=s[e.substring(0,1)];"da"===e.substring(0,2)&&(d=["dekao",10,"da"]),g?(h=g[2],c=e.substring(2)):d&&(h=d[1],c=e.substring(d[2].length));for(var v=0;146>v;v++)n=null===u[v][2]?[]:u[v][2],u[v][1]!==c&&0>n.indexOf(c)||(l=u[v])}if(null===f){var N=i[t.substring(0,2)],I=s[t.substring(0,1)];"da"===t.substring(0,2)&&(I=["dekao",10,"da"]),N?(m=N[2],p=t.substring(2)):I&&(m=I[1],p=t.substring(I[2].length));for(var b=0;146>b;b++)n=null===u[b][2]?[]:u[b][2],u[b][1]!==p&&0>n.indexOf(p)||(f=u[b])}return null===l||null===f?a.na:l[3]!==f[3]?a.na:r*l[6]*h/(f[6]*m)},e.DEC2BIN=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||-512>r||r>511)return a.num;if(0>r)return"1"+i.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)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DEC2HEX=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||-549755813888>r||r>549755813887)return a.num;if(0>r)return(1099511627776+r).toString(16);var t=parseInt(r,10).toString(16);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DEC2OCT=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||-536870912>r||r>536870911)return a.num;if(0>r)return(1073741824+r).toString(8);var t=parseInt(r,10).toString(8);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DELTA=function(r,e){return e=e===undefined?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:r===e?1:0},e.ERF=function(r,e){return e=e===undefined?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:u.erf(r)},e.ERF.PRECISE=function(){throw Error("ERF.PRECISE is not implemented")},e.ERFC=function(r){return isNaN(r)?a.value:u.erfc(r)},e.ERFC.PRECISE=function(){throw Error("ERFC.PRECISE is not implemented")},e.GESTEP=function(r,e){return e=e||0,r=o.parseNumber(r),o.anyIsError(e,r)?r:e>r?0:1},e.HEX2BIN=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.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 a.num;if(t)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.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 a.num;var t=parseInt(r,16);if(t>536870911&&0xffe0000000>t)return a.num;if(t>=0xffe0000000)return(t-0xffc0000000).toString(8);var n=t.toString(8);return e===undefined?n:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),n.length>e?a.num:i.REPT("0",e-n.length)+n)},e.IMABS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))},e.IMAGINARY=function(r){if(r===undefined||!0===r||!1===r)return a.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),u="i"===n||"j"===n;return 0>e&&0>t?u?isNaN(r.substring(0,r.length-1))?a.num:r.substring(0,r.length-1):isNaN(r)?a.num:0:u?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:-+r.substring(t+1,r.length-1):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(e+1,r.length-1):a.num},e.IMARGUMENT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:0===t&&0===n?a.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(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",0!==n?e.COMPLEX(t,-n,u):r},e.IMCOS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,u)},e.IMCOSH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,u)},e.IMCOT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV(e.IMCOS(r),e.IMSIN(r))},e.IMDIV=function(r,t){var n=e.IMREAL(r),u=e.IMAGINARY(r),i=e.IMREAL(t),s=e.IMAGINARY(t);if(o.anyIsError(n,u,i,s))return a.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===i&&0===s)return a.num;var p=i*i+s*s;return e.COMPLEX((n*i+u*s)/p,(u*i-n*s)/p,c)},e.IMEXP=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.exp(t);return e.COMPLEX(i*Math.cos(n),i*Math.sin(n),u)},e.IMLN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),u)},e.IMLOG10=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),u)},e.IMLOG2=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),u)},e.IMPOWER=function(r,t){t=o.parseNumber(t);var n=e.IMREAL(r),u=e.IMAGINARY(r);if(o.anyIsError(t,n,u))return a.value;var i=r.substring(r.length-1);i="i"===i||"j"===i?i:"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),i)},e.IMPRODUCT=function(){var r=arguments[0];if(!arguments.length)return a.value;for(var t=1;arguments.length>t;t++){var n=e.IMREAL(r),u=e.IMAGINARY(r),i=e.IMREAL(arguments[t]),s=e.IMAGINARY(arguments[t]);if(o.anyIsError(n,u,i,s))return a.value;r=e.COMPLEX(n*i-u*s,n*s+u*i)}return r},e.IMREAL=function(r){if(r===undefined||!0===r||!1===r)return a.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),u="i"===n||"j"===n;return 0>e&&0>t?u?isNaN(r.substring(0,r.length-1))?a.num:0:isNaN(r)?a.num:r:u?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:+r.substring(0,t):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(0,e):a.num},e.IMSEC=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV("1",e.IMCOS(r))},e.IMSECH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV("1",e.IMCOSH(r))},e.IMSIN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,u)},e.IMSINH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,u)},e.IMSQRT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.sqrt(e.IMABS(r)),s=e.IMARGUMENT(r);return e.COMPLEX(i*Math.cos(s/2),i*Math.sin(s/2),u)},e.IMCSC=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.num:e.IMDIV("1",e.IMSIN(r))},e.IMCSCH=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.num:e.IMDIV("1",e.IMSINH(r))},e.IMSUB=function(r,e){var t=this.IMREAL(r),n=this.IMAGINARY(r),u=this.IMREAL(e),i=this.IMAGINARY(e);if(o.anyIsError(t,n,u,i))return a.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-u,n-i,f)},e.IMSUM=function(){if(!arguments.length)return a.value;for(var r=o.flatten(arguments),e=r[0],t=1;r.length>t;t++){var n=this.IMREAL(e),u=this.IMAGINARY(e),i=this.IMREAL(r[t]),s=this.IMAGINARY(r[t]);if(o.anyIsError(n,u,i,s))return a.value;e=this.COMPLEX(n+i,u+s)}return e},e.IMTAN=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:this.IMDIV(this.IMSIN(r),this.IMCOS(r))},e.OCT2BIN=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return a.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 a.num;if(t)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return void 0===e?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return a.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 a.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)?a.value:0>e?a.num:(e=Math.floor(e),n.length>e?a.num:i.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 a(r){var e="";return 0>r||(e=""+(r+1)),e}function u(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 i(r){for(var e="";r>=0;)e=String.fromCharCode(r%f+97)+e,r=Math.floor(r/f)-1;return e.toUpperCase()}function o(r){if("string"!=typeof r||!c.test(r))return[];var e=r.toUpperCase().match(c),t=e[1],a=e[2],i=e[3],o=e[4];return[{index:n(o),label:o,isAbsolute:"$"===i},{index:u(a),label:a,isAbsolute:"$"===t}]}function s(r,e){var t=(r.isAbsolute?"$":"")+a(r.index);return(e.isAbsolute?"$":"")+i(e.index)+t}e.__esModule=!0,e.rowLabelToIndex=n,e.rowIndexToLabel=a,e.columnLabelToIndex=u,e.columnIndexToLabel=i,e.extractLabel=o,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 a=t(17),u=n(a),i=t(14),o=n(i),s=t(2),l=n(s),f=t(15);e.SUPPORTED_FORMULAS=o["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=u["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 a(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function u(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 i(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 o=t(18),s=n(o),l=t(19),f=n(l),c=t(41),p=t(43),h=t(3),m=t(2),E=n(m),g=t(15);e["default"]=function(r){function e(){a(this,e);var t=u(this,r.call(this));return t.parser=new c.Parser,t.parser.yy={toNumber:h.toNumber,trimEdges:p.trimEdges,invertNumber:h.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 i(e,r),e.prototype.parse=function(r){var e=null,t=null;try{e=""===r?"":this.parser.parse(r)}catch(a){var n=(0,E["default"])(a.message);t=n||(0,E["default"])(m.ERROR)}return e instanceof Error&&(t=(0,E["default"])(e.message)||(0,E["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,g.extractLabel)(r),t=e[0],n=e[1],a=void 0;return this.emit("callCellValue",{label:r,row:t,column:n},function(r){a=r}),a},e.prototype._callRangeValue=function(r,e){r=r.toUpperCase(),e=e.toUpperCase();var t=(0,g.extractLabel)(r),n=t[0],a=t[1],u=(0,g.extractLabel)(e),i=u[0],o=u[1],s={},l={};n.index>i.index?(s.row=i,l.row=n):(s.row=n,l.row=i),a.index>o.index?(s.column=o,l.column=a):(s.column=a,l.column=o),s.label=(0,g.toLabel)(s.row,s.column),l.label=(0,g.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(){a.off(r,n),e.apply(t,arguments)}var a=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,a=t.length;for(n;a>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],a=[];if(n&&e)for(var u=0,i=n.length;i>u;u++)n[u].fn!==e&&n[u].fn._!==e&&a.push(n[u]);return a.length?t[r]=a:delete t[r],this}},r.exports=t},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(r=r.toUpperCase(),!L[r])throw Error(C.ERROR_NAME);return L[r].apply(L,e)}function u(r,e){Array.isArray(r)||(r=[r.toUpperCase()]),r.forEach(function(r){L[r]=e.isFactory?e(r):e})}e.__esModule=!0,e["default"]=a,e.registerOperation=u;var i=t(20),o=n(i),s=t(21),l=n(s),f=t(22),c=n(f),p=t(23),h=n(p),m=t(24),E=n(m),g=t(33),d=n(g),v=t(34),N=n(v),I=t(35),b=n(I),y=t(36),M=n(y),A=t(37),R=n(A),S=t(38),T=n(S),O=t(39),x=n(O),V=t(40),$=n(V),C=t(2),L=Object.create(null);u(o["default"].SYMBOL,o["default"]),u(l["default"].SYMBOL,l["default"]),u(c["default"].SYMBOL,c["default"]),u(h["default"].SYMBOL,h["default"]),u($["default"].SYMBOL,$["default"]),u(E["default"].SYMBOL,E["default"]),u(d["default"].SYMBOL,d["default"]),u(N["default"].SYMBOL,N["default"]),u(b["default"].SYMBOL,b["default"]),u(M["default"].SYMBOL,M["default"]),u(T["default"].SYMBOL,T["default"]),u(x["default"].SYMBOL,x["default"]),u(R["default"].SYMBOL,R["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 i=t.reduce(function(r,e){return r+(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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 i=t.reduce(function(r,e){return r/(0,a.toNumber)(e)},(0,a.toNumber)(r));if(i===Infinity)throw Error(u.ERROR_DIV_ZERO);if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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)u[e[0]]&&(t=!0,n=u[e[0]].apply(u,arguments));else{for(var a=e.length,i=0,o=u;a>i;)if(o=o[e[i]],i++,!o){o=null;break}o&&(t=!0,n=o.apply(undefined,arguments))}if(!t)throw Error(s.ERROR_NAME);return n}}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(25),u=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}(a),i=t(14),o=function(r){return r&&r.__esModule?r:{"default":r}}(i),s=t(2),l=e.SYMBOL=o["default"];n.isFactory=!0,n.SYMBOL=l},function(r,e,t){var n=[t(26),t(29),t(13),t(30),t(4),t(6),t(8),t(31),t(7),t(32),t(5),t(12)];for(var a in n){var u=n[a];for(var i in u)e[i]=e[i]||u[i]}},function(r,e,t){function n(r,e){if(e)for(var t in e)r[t]=e[t];return r}var a=t(4),u=t(5),i=t(13),o=t(8);e.BETADIST=u.BETA.DIST,e.BETAINV=u.BETA.INV,e.BINOMDIST=u.BINOM.DIST,e.CEILING=e.ISOCEILING=n(a.CEILING.MATH,a.CEILING),e.CEILINGMATH=a.CEILING.MATH,e.CEILINGPRECISE=a.CEILING.PRECISE,e.CHIDIST=u.CHISQ.DIST,e.CHIDISTRT=u.CHISQ.DIST.RT,e.CHIINV=u.CHISQ.INV,e.CHIINVRT=u.CHISQ.INV.RT,e.CHITEST=u.CHISQ.TEST,e.CONFIDENCE=n(u.CONFIDENCE.NORM,u.CONFIDENCE),e.COVAR=u.COVARIANCE.P,e.COVARIANCEP=u.COVARIANCE.P,e.COVARIANCES=u.COVARIANCE.S,e.CRITBINOM=u.BINOM.INV,e.EXPONDIST=u.EXPON.DIST,e.ERFCPRECISE=i.ERFC.PRECISE,e.ERFPRECISE=i.ERF.PRECISE,e.FDIST=u.F.DIST,e.FDISTRT=u.F.DIST.RT,e.FINVRT=u.F.INV.RT,e.FINV=u.F.INV,e.FLOOR=n(a.FLOOR.MATH,a.FLOOR),e.FLOORMATH=a.FLOOR.MATH,e.FLOORPRECISE=a.FLOOR.PRECISE,e.FTEST=u.F.TEST,e.GAMMADIST=u.GAMMA.DIST,e.GAMMAINV=u.GAMMA.INV,e.GAMMALNPRECISE=u.GAMMALN.PRECISE,e.HYPGEOMDIST=u.HYPGEOM.DIST,e.LOGINV=u.LOGNORM.INV,e.LOGNORMINV=u.LOGNORM.INV,e.LOGNORMDIST=u.LOGNORM.DIST,e.MODE=n(u.MODE.SNGL,u.MODE),e.MODEMULT=u.MODE.MULT,e.MODESNGL=u.MODE.SNGL,e.NEGBINOMDIST=u.NEGBINOM.DIST,e.NETWORKDAYSINTL=o.NETWORKDAYS.INTL,e.NORMDIST=u.NORM.DIST,e.NORMINV=u.NORM.INV,e.NORMSDIST=u.NORM.S.DIST,e.NORMSINV=u.NORM.S.INV,e.PERCENTILE=n(u.PERCENTILE.EXC,u.PERCENTILE),e.PERCENTILEEXC=u.PERCENTILE.EXC,e.PERCENTILEINC=u.PERCENTILE.INC,e.PERCENTRANK=n(u.PERCENTRANK.INC,u.PERCENTRANK),e.PERCENTRANKEXC=u.PERCENTRANK.EXC,e.PERCENTRANKINC=u.PERCENTRANK.INC,e.POISSON=n(u.POISSON.DIST,u.POISSON),e.POISSONDIST=u.POISSON.DIST,e.QUARTILE=n(u.QUARTILE.INC,u.QUARTILE),e.QUARTILEEXC=u.QUARTILE.EXC,e.QUARTILEINC=u.QUARTILE.INC,e.RANK=n(u.RANK.EQ,u.RANK),e.RANKAVG=u.RANK.AVG,e.RANKEQ=u.RANK.EQ,e.SKEWP=u.SKEW.P,e.STDEV=n(u.STDEV.S,u.STDEV),e.STDEVP=u.STDEV.P,e.STDEVS=u.STDEV.S,e.TDIST=u.T.DIST,e.TDISTRT=u.T.DIST.RT,e.TINV=u.T.INV,e.TTEST=u.T.TEST,e.VAR=n(u.VAR.S,u.VAR),e.VARP=u.VAR.P,e.VARS=u.VAR.S,e.WEIBULL=n(u.WEIBULL.DIST,u.WEIBULL),e.WEIBULLDIST=u.WEIBULL.DIST,e.WORKDAYINTL=o.WORKDAY.INTL,e.ZTEST=u.Z.TEST},function(r,e){},function(r,e,t){function n(r,e){return r.reduce(function(r,t){return e*r+t},0)}function a(r,e,t,n,a){a||(a=-1);var u,i=2/r;if(0===e)return t;if(1===e)return n;for(var o=1;o!=e;++o)u=n*o*i+a*t,t=n,n=u;return n}function u(r,e,t,n,u){return function(i,o){if(0===o)return r(i);if(1===o)return e(i);if(0>o)throw t+": Order ("+o+") must be nonnegative";if(1==n&&0===i)throw t+": Undefined when x == 0";if(2==n&&0>=i)throw t+": Undefined when x <= 0";return a(i,o,r(i),e(i),u)}}var i=Math,o=function(){function r(r){var e,a,f,c=r*r,p=i.abs(r)-.785398164;return 8>i.abs(r)?(a=n(t,c),f=n(u,c),e=a/f):(c=64/c,a=n(o,c),f=n(s,c),e=i.sqrt(l/i.abs(r))*(i.cos(p)*a-i.sin(p)*f*8/i.abs(r))),e}function e(r){var e,t,a,u=r*r,o=i.abs(r)-2.356194491;return 8>Math.abs(r)?(t=r*n(f,u),a=n(c,u),e=t/a):(u=64/u,t=n(p,u),a=n(h,u),e=i.sqrt(l/i.abs(r))*(i.cos(o)*t-i.sin(o)*a*8/i.abs(r)),0>r&&(e=-e)),e}var t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),u=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),o=[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(),p=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),h=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(t,n){if(0===(n=Math.round(n)))return r(i.abs(t));if(1===n)return e(i.abs(t));if(0>n)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===i.abs(t))return 0;var u,o,s,l,f,c,p,h,m=2/i.abs(t);if(i.abs(t)>n)u=a(t,n,r(i.abs(t)),e(i.abs(t)),-1);else{for(s=2*i.floor((n+i.floor(i.sqrt(40*n)))/2),l=0,c=u=f=0,p=1,o=s;o>0;o--)h=o*m*p-c,c=p,p=h,i.abs(p)>1e10&&(p*=1e-10,c*=1e-10,u*=1e-10,f*=1e-10),l&&(f+=p),l=!l,o==n&&(u=c);f=2*f-p,u/=f}return 0>t&&n%2?-u:u}}(),s=function(){function r(r){var e,u,c,p=r*r,h=r-.785398164;return 8>r?(u=n(t,p),c=n(a,p),e=u/c+f*o(r,0)*i.log(r)):(p=64/p,u=n(s,p),c=n(l,p),e=i.sqrt(f/r)*(i.sin(h)*u+i.cos(h)*c*8/r)),e}function e(r){var e,t,a,u=r*r,s=r-2.356194491;return 8>r?(t=r*n(c,u),a=n(p,u),e=t/a+f*(o(r,1)*i.log(r)-1/r)):(u=64/u,t=n(h,u),a=n(m,u),e=i.sqrt(f/r)*(i.sin(s)*t+i.cos(s)*a*8/r)),e}var t=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),a=[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(),p=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),h=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return u(r,e,"BESSELY",1,-1)}(),l=function(){function r(r){return r>3.75?i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(a,3.75/i.abs(r)):n(t,r*r/14.0625)}function e(r){return 3.75>r?r*n(u,r*r/14.0625):(0>r?-1:1)*i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(o,3.75/i.abs(r))}var t=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),a=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),u=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),o=[.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===i.abs(t))return 0;var a,u,o,l,f,c,p=2/i.abs(t);for(o=2*i.round((n+i.round(i.sqrt(40*n)))/2),l=a=0,f=1,u=o;u>0;u--)c=u*p*f+l,l=f,f=c,i.abs(f)>1e10&&(f*=1e-10,l*=1e-10,a*=1e-10),u==n&&(a=l);return a*=s(t,0)/f,0>t&&n%2?-a:a}}(),f=function(){function r(r){return r>2?i.exp(-r)/i.sqrt(r)*n(a,2/r):-i.log(r/2)*l(r,0)+n(t,r*r/4)}function e(r){return r>2?i.exp(-r)/i.sqrt(r)*n(s,2/r):i.log(r/2)*l(r,1)+1/r*n(o,r*r/4)}var t=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),a=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),o=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return u(r,e,"BESSELK",2,1)}();e.besselj=o,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),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=0;return utils.arrayEach(n,function(r){i+=a[r]}),0===n.length?error.div0:i/n.length},exports.DCOUNT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNT(i)},exports.DCOUNTA=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNTA(i)},exports.DGET=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);return 0===n.length?error.value:n.length>1?error.num:a[n[0]]},exports.DMAX=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=a[n[0]];return utils.arrayEach(n,function(r){a[r]>i&&(i=a[r])}),i},exports.DMIN=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=a[n[0]];return utils.arrayEach(n,function(r){i>a[r]&&(i=a[r])}),i},exports.DPRODUCT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i);var o=1;return utils.arrayEach(i,function(r){o*=r}),o},exports.DSTDEV=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.S(i)},exports.DSTDEVP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.P(i)},exports.DSUM=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),maths.SUM(i)},exports.DVAR=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.S(i)},exports.DVARP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.P(i)}},function(r,e,t){var n=t(0),a=t(1),u=t(7);e.AND=function(){for(var r=a.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 u.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=a.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=a.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,a=Math.floor(t/2),u=!1,i=t%2!=0,o=t%2==0?null:arguments[arguments.length-1];if(a)for(var s=0;a>s;s++)if(e===arguments[2*s+1]){r=arguments[2*s+2],u=!0;break}u||(r=i?o:n.na)}else r=n.value;return r}},function(r,e,t){function n(r){return r&&r.getTime&&!isNaN(r.getTime())}function a(r){return r instanceof Date?r:new Date(r)}var u=t(0),i=t(8),o=t(1);e.ACCRINT=function(r,e,t,o,s,l,f){return r=a(r),e=a(e),t=a(t),n(r)&&n(e)&&n(t)?o>0&&s>0?-1===[1,2,4].indexOf(l)?u.num:-1===[0,1,2,3,4].indexOf(f)?u.num:t>r?(s=s||0,f=f||0,s*o*i.YEARFRAC(r,t,f)):u.num:u.num:u.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,a,i,s){if(r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;if(0>=r||0>=t||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=e.PMT(r,t,n,0,s),f=0;1===a&&0===s&&(f=-n,a++);for(var c=a;i>=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,a,i,s){if(r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;if(0>=r||0>=t||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=e.PMT(r,t,n,0,s),f=0;1===a&&(f=0===s?l+n*r:l,a++);for(var c=a;i>=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,a){if(a=a===undefined?12:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;if(0>r||0>e||0>t||0>n)return u.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(a))return u.num;if(n>t)return u.num;if(e>=r)return 0;for(var i=(1-Math.pow(e/r,1/t)).toFixed(3),s=r*i*a/12,l=s,f=0,c=n===t?t-1:n,p=2;c>=p;p++)f=(r-l)*i,l+=f;return 1===n?s:n===t?(r-l)*i:f},e.DDB=function(r,e,t,n,a){if(a=a===undefined?2:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;if(0>r||0>e||0>t||0>n||0>=a)return u.num;if(n>t)return u.num;if(e>=r)return 0;for(var i=0,s=0,l=1;n>=l;l++)s=Math.min(a/t*(r-i),r-e-i),i+=s;return s},e.DISC=function(){throw Error("DISC is not implemented")},e.DOLLARDE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;if(0>e)return u.num;if(e>=0&&1>e)return u.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=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;if(0>e)return u.num;if(e>=0&&1>e)return u.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=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:0>=r||1>e?u.num:(e=parseInt(e,10),Math.pow(1+r/e,e)-1)},e.FV=function(r,e,t,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i;if(0===r)i=n+t*e;else{var s=Math.pow(1+r,e);i=1===a?n*s+t*(1+r)*(s-1)/r:n*s+t*(s-1)/r}return-i},e.FVSCHEDULE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),o.anyIsError(r,e))return u.value;for(var t=e.length,n=r,a=0;t>a;a++)n*=1+e[a];return n},e.INTRATE=function(){throw Error("INTRATE is not implemented")},e.IPMT=function(r,t,n,a,i,s){if(i=i||0,s=s||0,r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,t,n,a,i,s))return u.value;var l=e.PMT(r,n,a,i,s);return(1===t?1===s?0:-a:1===s?e.FV(r,t-2,l,a,1)-l:e.FV(r,t-1,l,a,0))*r},e.IRR=function(r,e){if(e=e||0,r=o.parseNumberArray(o.flatten(r)),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;for(var t=[],n=!1,a=!1,i=0;r.length>i;i++)t[i]=0===i?0:t[i-1]+365,r[i]>0&&(n=!0),0>r[i]&&(a=!0);if(!n||!a)return u.num;e=e===undefined?.1:e;var s,l,f,c=e,p=!0;do{f=function(r,e,t){for(var n=t+1,a=r[0],u=1;r.length>u;u++)a+=r[u]/Math.pow(n,(e[u]-e[0])/365);return a}(r,t,c),s=c-f/function(r,e,t){for(var n=t+1,a=0,u=1;r.length>u;u++){var i=(e[u]-e[0])/365;a-=i*r[u]/Math.pow(n,i+1)}return a}(r,t,c),l=Math.abs(s-c),c=s,p=l>1e-10&&Math.abs(f)>1e-10}while(p);return c},e.ISPMT=function(r,e,t,n){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,e,t,n)?u.value:n*r*(e/t-1)},e.MDURATION=function(){throw Error("MDURATION is not implemented")},e.MIRR=function(r,t,n){if(r=o.parseNumberArray(o.flatten(r)),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;for(var a=r.length,i=[],s=[],l=0;a>l;l++)0>r[l]?i.push(r[l]):s.push(r[l]);var f=-e.NPV(n,s)*Math.pow(1+n,a-1),c=e.NPV(t,i)*(1+t);return Math.pow(f/c,1/(a-1))-1},e.NOMINAL=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:0>=r||1>e?u.num:(e=parseInt(e,10),(Math.pow(r+1,1/e)-1)*e)},e.NPER=function(r,e,t,n,a){if(a=a===undefined?0:a,n=n===undefined?0:n,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i=e*(1+r*a)-n*r,s=t*r+e*(1+r*a);return Math.log(i/s)/Math.log(1+r)},e.NPV=function(){var r=o.parseNumberArray(o.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=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:r>0?(Math.log(t)-Math.log(e))/Math.log(1+r):u.num},e.PMT=function(r,e,t,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i;if(0===r)i=(t+n)/e;else{var s=Math.pow(1+r,e);i=1===a?(n*r/(s-1)+t*r/(1-1/s))/(1+r):n*r/(s-1)+t*r/(1-1/s)}return-i},e.PPMT=function(r,t,n,a,i,s){return i=i||0,s=s||0,r=o.parseNumber(r),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,n,a,i,s)?u.value:e.PMT(r,n,a,i,s)-e.IPMT(r,t,n,a,i,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,a){return n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a)?u.value:0===r?-t*e-n:((1-Math.pow(1+r,e))/r*t*(1+r*a)-n)/Math.pow(1+r,e)},e.RATE=function(r,e,t,n,a,i){if(i=i===undefined?.01:i,n=n===undefined?0:n,a=a===undefined?0:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),o.anyIsError(r,e,t,n,a,i))return u.value;var s,l,f,c,p=0,h=0,m=0,E=i;for(1e-10>Math.abs(E)?s=t*(1+r*E)+e*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=t*h+e*(1/E+a)*(h-1)+n),l=t+e*r+n,f=t*h+e*(1/E+a)*(h-1)+n,m=c=0,p=E;Math.abs(l-f)>1e-10&&50>m;)E=(f*c-l*p)/(f-l),c=p,p=E,1e-10>Math.abs(E)?s=t*(1+r*E)+e*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=t*h+e*(1/E+a)*(h-1)+n),l=f,f=s,++m;return E},e.RECEIVED=function(){throw Error("RECEIVED is not implemented")},e.RRI=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:0===r||0===e?u.num:Math.pow(t/e,1/r)-1},e.SLN=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:0===t?u.num:(r-e)/t},e.SYD=function(r,e,t,n){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,e,t,n)?u.value:0===t?u.num:1>n||n>t?u.num:(n=parseInt(n,10),(r-e)*(t-n+1)*2/(t*(t+1)))},e.TBILLEQ=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:365*t/(360-t*i.DAYS360(r,e,!1)):u.num},e.TBILLPRICE=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:100*(1-t*i.DAYS360(r,e,!1)/360):u.num},e.TBILLYIELD=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:360*(100-t)/(t*i.DAYS360(r,e,!1)):u.num},e.VDB=function(){throw Error("VDB is not implemented")},e.XNPV=function(r,e,t){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),t=o.parseDateArray(o.flatten(t)),o.anyIsError(r,e,t))return u.value;for(var n=0,a=0;e.length>a;a++)n+=e[a]/Math.pow(1+r,i.DAYS(t[a],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),a=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 a,u,i=0;e.length>i;i++)if(1===t){if(e[i]===r)return i+1;r>e[i]&&(u?e[i]>u&&(a=i+1,u=e[i]):(a=i+1,u=e[i]))}else if(0===t){if("string"==typeof r){if(r=r.replace(/\?/g,"."),e[i].toLowerCase().match(r.toLowerCase()))return i+1}else if(e[i]===r)return i+1}else if(-1===t){if(e[i]===r)return i+1;e[i]>r&&(u?u>e[i]&&(a=i+1,u=e[i]):(a=i+1,u=e[i]))}return a||n.na},e.VLOOKUP=function(r,e,t,a){if(!r||!e||!t)return n.na;a=a||!1;for(var u=0;e.length>u;u++){var i=e[u];if(!a&&i[0]===r||i[0]===r||a&&"string"==typeof i[0]&&-1!==i[0].toLowerCase().indexOf(r.toLowerCase()))return i.length+1>t?i[t-1]:n.ref}return n.na},e.HLOOKUP=function(r,e,t,u){if(!r||!e||!t)return n.na;u=u||!1;for(var i=a.transpose(e),o=0;i.length>o;o++){var s=i[o];if(!u&&s[0]===r||s[0]===r||u&&"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 i=t.reduce(function(r,e){return r-(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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 i=t.reduce(function(r,e){return r*(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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,a.toNumber)(r),(0,a.toNumber)(e));if(isNaN(t))throw Error(u.ERROR_VALUE);return t}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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 i[r])return t;if(0===r||2>e)return!1;e-=2,r=n[e],++t}}var t=this,n=[0],a=[null],u=[],i=this.table,o="",s=0,l=0,f=0,c=2,p=u.slice.call(arguments,1),h=Object.create(this.lexer),m={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(m.yy[E]=this.yy[E]);h.setInput(r,m.yy),m.yy.lexer=h,m.yy.parser=this,"undefined"==typeof h.yylloc&&(h.yylloc={});var g=h.yylloc;u.push(g);var d=h.options&&h.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,N,I,b,y,M,A,R,S,T=function(){var r;return r=h.lex()||1,"number"!=typeof r&&(r=t.symbols_[r]||r),r},O={};;){if(I=n[n.length-1],this.defaultActions[I]?b=this.defaultActions[I]:(null!==v&&void 0!==v||(v=T()),b=i[I]&&i[I][v]),void 0===b||!b.length||!b[0]){var x,V="";if(f)1!==N&&(x=e(I));else{x=e(I),S=[];for(M in i[I])this.terminals_[M]&&M>c&&S.push("'"+this.terminals_[M]+"'");V=h.showPosition?"Parse error on line "+(s+1)+":\n"+h.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(V,{text:h.match,token:this.terminals_[v]||v,line:h.yylineno,loc:g,expected:S,recoverable:!1!==x})}if(3==f){if(1===v||1===N)throw Error(V||"Parsing halted while starting to recover from another error.");l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,v=T()}if(!1===x)throw Error(V||"Parsing halted. No suitable error recovery rule available.");!function(r){n.length=n.length-2*r,a.length=a.length-r,u.length=u.length-r}(x),N=v==c?null:v,v=c,I=n[n.length-1],b=i[I]&&i[I][c],f=3}if(b[0]instanceof Array&&b.length>1)throw Error("Parse Error: multiple actions possible at state: "+I+", token: "+v);switch(b[0]){case 1:n.push(v),a.push(h.yytext),u.push(h.yylloc),n.push(b[1]),v=null,N?(v=N,N=null):(l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,f>0&&f--);break;case 2:if(A=this.productions_[b[1]][1],O.$=a[a.length-A],O._$={first_line:u[u.length-(A||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(A||1)].first_column,last_column:u[u.length-1].last_column},d&&(O._$.range=[u[u.length-(A||1)].range[0],u[u.length-1].range[1]]),void 0!==(y=this.performAction.apply(O,[o,l,s,m.yy,b[1],a,u].concat(p))))return y;A&&(n=n.slice(0,-1*A*2),a=a.slice(0,-1*A),u=u.slice(0,-1*A)),n.push(this.productions_[b[1]][0]),a.push(O.$),u.push(O._$),R=i[n[n.length-2]][n[n.length-1]],n.push(R);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 a=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=[a[0],a[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,a;if(this.options.backtrack_lexer&&(a={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&&(a.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 u in a)this[u]=a[u];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 a=this._currentRules(),u=0;a.length>u;u++)if((t=this._input.match(this.rules[a[u]]))&&(!e||t[0].length>e[0].length)){if(e=t,n=u,this.options.backtrack_lexer){if(!1!==(r=this.test_match(t,a[u])))return r;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(r=this.test_match(e,a[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__(42)(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";function i(r){this._value=r}function o(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,a,u,i,o,l,f;return f=""+r,t=f.split("e")[0],u=f.split("e")[1],n=t.split(".")[0],a=t.split(".")[1]||"",+u>0?f=n+a+s(u-a.length):(i=0>+n?"-0":"0",e>0&&(i+="."),l=s(-1*u-1),o=(l+Math.abs(n)+a).substr(0,e),f=i+o),+u>0&&e>0&&(f+="."+s(e)),f}function f(r,e,t,n){var a,u,i=Math.pow(10,e);return(""+r).indexOf("e")>-1?(u=l(r,e),"-"!==u.charAt(0)||0>+u||(u=u.substr(1))):u=(t(r+"e+"+e)/i).toFixed(e),n&&(a=RegExp("0{1,"+n+"}$"),u=u.replace(a,"")),u}function c(r,e,t){var n=e.replace(/\{[^\{\}]*\}/g,"");return n.indexOf("$")>-1?h(r,x[$].currency.symbol,e,t):n.indexOf("%")>-1?E(r,e,t):n.indexOf(":")>-1?g(r):N(r._value,e,t)}function p(r,e){var t,n,a,u,i,o=e,s=!1;if(e.indexOf(":")>-1)r._value=d(e);else if(e===C)r._value=0;else{for("."!==x[$].delimiters.decimal&&(e=e.replace(/\./g,"").replace(x[$].delimiters.decimal,".")),t=RegExp("[^a-zA-Z]"+x[$].abbreviations.thousand+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),n=RegExp("[^a-zA-Z]"+x[$].abbreviations.million+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),a=RegExp("[^a-zA-Z]"+x[$].abbreviations.billion+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),u=RegExp("[^a-zA-Z]"+x[$].abbreviations.trillion+"(?:\\)|(\\"+x[$].currency.symbol+")?(?:\\))?)?$"),i=1;R.length>i&&!s;++i)e.indexOf(R[i])>-1?s=Math.pow(1024,i):e.indexOf(S[i])>-1&&(s=Math.pow(1e3,i));var l=e.replace(/[^0-9\.]+/g,"");""===l?r._value=NaN:(r._value=(s||1)*(o.match(t)?Math.pow(10,3):1)*(o.match(n)?Math.pow(10,6):1)*(o.match(a)?Math.pow(10,9):1)*(o.match(u)?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 h(r,e,t,n){var a,u,i=t,o=i.indexOf("$"),s=i.indexOf("("),l=i.indexOf("+"),f=i.indexOf("-"),c="",p="";if(-1===i.indexOf("$")?"infix"===x[$].currency.position?(p=e,x[$].currency.spaceSeparated&&(p=" "+p+" ")):x[$].currency.spaceSeparated&&(c=" "):i.indexOf(" $")>-1?(c=" ",i=i.replace(" $","")):i.indexOf("$ ")>-1?(c=" ",i=i.replace("$ ","")):i=i.replace("$",""),u=N(r._value,i,n,p),-1===t.indexOf("$"))switch(x[$].currency.position){case"postfix":u.indexOf(")")>-1?(u=u.split(""),u.splice(-1,0,c+e),u=u.join("")):u=u+c+e;break;case"infix":break;case"prefix":u.indexOf("(")>-1||u.indexOf("-")>-1?(u=u.split(""),a=Math.max(s,f)+1,u.splice(a,0,e+c),u=u.join("")):u=e+c+u;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else o>1?u.indexOf(")")>-1?(u=u.split(""),u.splice(-1,0,c+e),u=u.join("")):u=u+c+e:u.indexOf("(")>-1||u.indexOf("+")>-1||u.indexOf("-")>-1?(u=u.split(""),a=1,(s>o||l>o||f>o)&&(a=0),u.splice(a,0,e+c),u=u.join("")):u=e+c+u;return u}function m(r,e,t,n){return h(r,e,t,n)}function E(r,e,t){var n,a="",u=100*r._value;return e.indexOf(" %")>-1?(a=" ",e=e.replace(" %","")):e=e.replace("%",""),n=N(u,e,t),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,a+"%"),n=n.join("")):n=n+a+"%",n}function g(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 d(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 v(r,e,t){var n,a,u,i=e[0],o=Math.abs(r);if(o>=t){for(n=1;e.length>n;++n)if(a=Math.pow(t,n),u=Math.pow(t,n+1),o>=a&&u>o){i=e[n],r/=a;break}i===e[0]&&(r/=Math.pow(t,e.length-1),i=e[e.length-1])}return{value:r,suffix:i}}function N(r,e,t,n){var a,u,i,l,c,p,h,m,E,g,d,N,I,b,y,M,A=!1,R=!1,S=!1,T="",V=!1,L=!1,D=!1,w=!1,_=!1,P="",U="",F=Math.abs(r),B="",k=!1,j=!1,G="";if(0===r&&null!==C)return C;if(!isFinite(r))return""+r;if(0===e.indexOf("{")){var Y=e.indexOf("}");if(-1===Y)throw Error('Format should also contain a "}"');g=e.slice(1,Y),e=e.slice(Y+1)}else g="";if(e.indexOf("}")===e.length-1&&e.length){var q=e.indexOf("{");if(-1===q)throw Error('Format should also contain a "{"');d=e.slice(q+1,-1),e=e.slice(0,q+1)}else d="";var H;for(H=e.match(-1===e.indexOf(".")?/([0-9]+).*/:/([0-9]+)\..*/),y=null===H?-1:H[1].length,-1!==e.indexOf("-")&&(k=!0),e.indexOf("(")>-1?(A=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(R=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1&&(m=e.split(".")[0].match(/[0-9]+/g)||["0"],m=parseInt(m[0],10),V=e.indexOf("aK")>=0,L=e.indexOf("aM")>=0,D=e.indexOf("aB")>=0,w=e.indexOf("aT")>=0,_=V||L||D||w,e.indexOf(" a")>-1?(T=" ",e=e.replace(" a","")):e=e.replace("a",""),i=o(r),c=i%3,c=0===c?3:c,m&&0!==F&&(p=3*~~((Math.min(m,i)-c)/3),F/=Math.pow(10,p)),i!==m&&(F>=Math.pow(10,12)&&!_||w?(T+=x[$].abbreviations.trillion,r/=Math.pow(10,12)):F=Math.pow(10,9)&&!_||D?(T+=x[$].abbreviations.billion,r/=Math.pow(10,9)):F=Math.pow(10,6)&&!_||L?(T+=x[$].abbreviations.million,r/=Math.pow(10,6)):(F=Math.pow(10,3)&&!_||V)&&(T+=x[$].abbreviations.thousand,r/=Math.pow(10,3))),l=o(r),m&&m>l&&-1===e.indexOf(".")&&(e+="[.]",e+=s(m-l))),M=0;O.length>M;++M)if(a=O[M],e.indexOf(a.marker)>-1){e.indexOf(" "+a.marker)>-1&&(P=" "),e=e.replace(P+a.marker,""),u=v(r,a.suffixes,a.scale),r=u.value,P+=u.suffix;break}if(e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(U=" ",e=e.replace(" o","")):e=e.replace("o",""),x[$].ordinal&&(U+=x[$].ordinal(r))),e.indexOf("[.]")>-1&&(S=!0,e=e.replace("[.]",".")),E=e.split(".")[1],N=e.indexOf(","),E){var X=[];if(-1!==E.indexOf("*")?(B=""+r,X=B.split("."),X.length>1&&(B=f(r,X[1].length,t))):E.indexOf("[")>-1?(E=E.replace("]",""),E=E.split("["),B=f(r,E[0].length+E[1].length,t,E[1].length)):B=f(r,E.length,t),X=B.split("."),h=X[0],X.length>1&&X[1].length){B=(n?T+n:x[$].delimiters.decimal)+X[1]}else B="";S&&0==+B.slice(1)&&(B="")}else h=f(r,0,t);return h.indexOf("-")>-1&&(h=h.slice(1),j=!0),y>h.length&&(h=s(y-h.length)+h),N>-1&&(h=(""+h).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+x[$].delimiters.thousands)),0===e.indexOf(".")&&(h=""),I=e.indexOf("("),b=e.indexOf("-"),G=b>I?(A&&j?"(":"")+(k&&j||!A&&j?"-":""):(k&&j||!A&&j?"-":"")+(A&&j?"(":""),g+G+(!j&&R&&0!==r?"+":"")+h+B+(U||"")+(T&&!n?T:"")+(P||"")+(A&&j?")":"")+d}function I(r,e){x[r]=e}function b(r){$=r;var e=x[r].defaults;e&&e.format&&A.defaultFormat(e.format),e&&e.currencyFormat&&A.defaultCurrencyFormat(e.currencyFormat)}function y(r){var e=(""+r).split(".");return 2>e.length?1:Math.pow(10,e[1].length)}function M(){return Array.prototype.slice.call(arguments).reduce(function(r,e){var t=y(r),n=y(e);return t>n?t:n},-Infinity)}var A,R=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],S=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],T={general:{scale:1024,suffixes:S,marker:"bd"},binary:{scale:1024,suffixes:R,marker:"b"},decimal:{scale:1e3,suffixes:S,marker:"d"}},O=[T.general,T.binary,T.decimal],x={},V=x,$="en-US",C=null,L="0,0",D="0$",w=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"}};A=function(r){return r=A.isNumbro(r)?r.value():"string"==typeof r||"number"==typeof r?A.fn.unformat(r):NaN,new i(+r)},A.version="1.11.1",A.isNumbro=function(r){return r instanceof i},A.setLanguage=function(r,e){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var t=r,n=r.split("-")[0],a=null;V[t]||(Object.keys(V).forEach(function(r){a||r.split("-")[0]!==n||(a=r)}),t=a||e||"en-US"),b(t)},A.setCulture=function(r,e){var t=r,n=r.split("-")[1],a=null;x[t]||(n&&Object.keys(x).forEach(function(r){a||r.split("-")[1]!==n||(a=r)}),t=a||e||"en-US"),b(t)},A.language=function(r,e){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!r)return $;if(r&&!e){if(!V[r])throw Error("Unknown language : "+r);b(r)}return!e&&V[r]||I(r,e),A},A.culture=function(r,e){if(!r)return $;if(r&&!e){if(!x[r])throw Error("Unknown culture : "+r);b(r)}return!e&&x[r]||I(r,e),A},A.languageData=function(r){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!r)return V[$];if(!V[r])throw Error("Unknown language : "+r);return V[r]},A.cultureData=function(r){if(!r)return x[$];if(!x[r])throw Error("Unknown culture : "+r);return x[r]},A.culture("en-US",_),A.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),V},A.cultures=function(){return x},A.zeroFormat=function(r){C="string"==typeof r?r:null},A.defaultFormat=function(r){L="string"==typeof r?r:"0.0"},A.defaultCurrencyFormat=function(r){D="string"==typeof r?r:"0$"},A.validate=function(r,e){var t,n,a,u,i,o,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=A.cultureData(e)}catch(f){s=A.cultureData(A.culture())}return a=s.currency.symbol,i=s.abbreviations,t=s.delimiters.decimal,n="."===s.delimiters.thousands?"\\.":s.delimiters.thousands,(null===(l=r.match(/^[^\d\.\,]+/))||(r=r.substr(1),l[0]===a))&&((null===(l=r.match(/[^\d]+$/))||(r=r.slice(0,-1),l[0]===i.thousand||l[0]===i.million||l[0]===i.billion||l[0]===i.trillion))&&(o=RegExp(n+"{2}"),!r.match(/[^\d.,]/g)&&(u=r.split(t),2>=u.length&&(2>u.length?!!u[0].match(/^\d+.*\d$/)&&!u[0].match(o):""===u[0]?!u[0].match(o)&&!!u[1].match(/^\d+$/):1===u[0].length?!!u[0].match(/^\d+$/)&&!u[0].match(o)&&!!u[1].match(/^\d+$/):!!u[0].match(/^\d+.*\d$/)&&!u[0].match(o)&&!!u[1].match(/^\d+$/)))))},A.loadLanguagesInNode=function(){console.warn("`loadLanguagesInNode` is deprecated since version 1.6.0. Use `loadCulturesInNode` instead"),A.loadCulturesInNode()},A.loadCulturesInNode=function(){var r=t(27);for(var e in r)e&&A.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,a=this.length>>>0,u=!1;for(arguments.length>1&&(n=e,u=!0),t=0;a>t;++t)this.hasOwnProperty(t)&&(u?n=r(n,this[t],t,this):(n=this[t],u=!0));if(!u)throw new TypeError("Reduce of empty array with no initial value");return n}),A.fn=i.prototype={clone:function(){return A(this)},format:function(r,e){return c(this,r||L,e!==undefined?e:Math.round)},formatCurrency:function(r,e){return h(this,x[$].currency.symbol,r||D,e!==undefined?e:Math.round)},formatForeignCurrency:function(r,e,t){return m(this,r,e||D,t!==undefined?t:Math.round)},unformat:function(r){if("number"==typeof r)return r;if("string"==typeof r){var e=p(this,r);return isNaN(e)?undefined:e}return undefined},binaryByteUnits:function(){return v(this._value,T.binary.suffixes,T.binary.scale).suffix},byteUnits:function(){return v(this._value,T.general.suffixes,T.general.scale).suffix},decimalByteUnits:function(){return v(this._value,T.decimal.suffixes,T.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=M.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=M.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=M(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=M(r,e);return r*t/(e*t)}return this._value=[this._value,r].reduce(e),this},difference:function(r){return Math.abs(A(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}()&&A.loadCulturesInNode(),w?r.exports=A:("undefined"==typeof ender&&(this.numbro=A),a=[],(u=function(){return A}.apply(e,a))!==undefined&&(r.exports=u))}).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 a(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 u(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 i(){E&&h&&(E=!1,h.length?m=h.concat(m):g=-1,m.length&&o())}function o(){if(!E){var r=a(i);E=!0;for(var e=m.length;e;){for(h=m,m=[];++g1)for(var t=1;arguments.length>t;t++)e[t-1]=arguments[t];m.push(new s(r,e)),1!==m.length||E||a(o)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(r){return[]},p.binding=function(r){throw Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(r){throw Error("process.chdir is not supported")},p.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]"===h.call(r)}function a(r){return"number"==typeof r&&r===r}function u(r){return c.apply([],r)}function o(){return new o._init(arguments)}function s(){return 0}function l(){return 1}function f(r,e){return r===e?1:0}var c=Array.prototype.concat,p=Array.prototype.slice,h=Object.prototype.toString,m=Array.isArray||function(r){return"[object Array]"===h.call(r)};o.fn=o.prototype,o._init=function(r){var e;if(m(r[0]))if(m(r[0][0])){n(r[1])&&(r[0]=o.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])?o.map(r[0],r[1]):r[0],this.length=1;else if(a(r[0]))this[0]=o.seq.apply(null,r),this.length=1;else{if(r[0]instanceof o)return o(r[0].toArray());this[0]=[],this.length=1}return this},o._init.prototype=o.prototype,o._init.constructor=o,o.utils={calcRdx:t,isArray:m,isFunction:n,isNumber:a,toVector:u},o.extend=function(r){var e,t;if(1===arguments.length){for(t in r)o[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},o.rows=function(r){return r.length||1},o.cols=function(r){return r[0].length||1},o.dimensions=function(r){return{rows:o.rows(r),cols:o.cols(r)}},o.row=function(r,e){return m(e)?e.map(function(e){return o.row(r,e)}):r[e]},o.rowa=function(r,e){return o.row(r,e)},o.col=function(r,e){if(m(e)){var t=o.arange(r.length).map(function(r){return Array(e.length)});return e.forEach(function(e,n){o.arange(r.length).forEach(function(a){t[a][n]=r[a][e]})}),t}for(var n=Array(r.length),a=0;r.length>a;a++)n[a]=[r[a][e]];return n},o.cola=function(r,e){return o.col(r,e).map(function(r){return r[0]})},o.diag=function(r){for(var e=o.rows(r),t=Array(e),n=0;e>n;n++)t[n]=[r[n][n]];return t},o.antidiag=function(r){for(var e=o.rows(r)-1,t=Array(e),n=0;e>=0;e--,n++)t[n]=[r[n][e]];return t},o.transpose=function(r){var e,t,n,a,u,i=[];m(r[0])||(r=[r]),t=r.length,n=r[0].length;for(var u=0;n>u;u++){for(e=Array(t),a=0;t>a;a++)e[a]=r[a][u];i.push(e)}return 1===i.length?i[0]:i},o.map=function(r,e,t){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=t?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),o=0;u>o;o++)i[n][o]=e(r[n][o],n,o);return 1===i.length?i[0]:i},o.cumreduce=function(r,e,t){var n,a,u,i,o;for(m(r[0])||(r=[r]),a=r.length,u=r[0].length,i=t?r:Array(a),n=0;a>n;n++)for(i[n]||(i[n]=Array(u)),u>0&&(i[n][0]=r[n][0]),o=1;u>o;o++)i[n][o]=e(i[n][o-1],r[n][o]);return 1===i.length?i[0]:i},o.alter=function(r,e){return o.map(r,e,!0)},o.create=function(r,e,t){var a,u,i=Array(r);n(e)&&(t=e,e=r);for(var a=0;r>a;a++)for(i[a]=Array(e),u=0;e>u;u++)i[a][u]=t(a,u);return i},o.zeros=function(r,e){return a(e)||(e=r),o.create(r,e,s)},o.ones=function(r,e){return a(e)||(e=r),o.create(r,e,l)},o.rand=function(e,t){return a(t)||(t=e),o.create(e,t,r.random)},o.identity=function(r,e){return a(e)||(e=r),o.create(r,e,f)},o.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},o.clear=function(r){return o.alter(r,s)},o.seq=function(r,e,a,u){n(u)||(u=!1);var i,o=[],s=t(r,e),l=(e*s-r*s)/((a-1)*s),f=r;for(i=0;e>=f&&a>i;i++,f=(r*s+l*s*i)/s)o.push(u?u(f,i):f);return o},o.arange=function(r,t,n){var a=[];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)a.push(i);return a},o.slice=function(){function r(r,t,n,a){var u,i=[],s=r.length;if(t===e&&n===e&&a===e)return o.copy(r);if(t=t||0,n=n||r.length,t=0>t?s+t:t,n=0>n?s+n:n,a=a||1,t===n||0===a)return[];if(n>t&&0>a)return[];if(t>n&&a>0)return[];if(a>0)for(u=t;n>u;u+=a)i.push(r[u]);else for(u=t;u>n;u+=a)i.push(r[u]);return i}function t(e,t){if(t=t||{},a(t.row)){if(a(t.col))return e[t.row][t.col];var n=o.rowa(e,t.row),u=t.col||{};return r(n,u.start,u.end,u.step)}if(a(t.col)){var i=o.cola(e,t.col),s=t.row||{};return r(i,s.start,s.end,s.step)}var s=t.row||{},u=t.col||{};return r(e,s.start,s.end,s.step).map(function(e){return r(e,u.start,u.end,u.step)})}return t}(),o.sliceAssign=function(t,n,u){if(a(n.row)){if(a(n.col))return t[n.row][n.col]=u;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 i=o.arange(n.col.start,r.min(t.length,n.col.end),n.col.step),s=n.row;return i.forEach(function(r,e){t[s][r]=u[e]}),t}if(a(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=o.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]=u[e]}),t}u[0].length===e&&(u=[u]),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=o.arange(n.row.start,r.min(t.length,n.row.end),n.row.step),i=o.arange(n.col.start,r.min(t[0].length,n.col.end),n.col.step);return l.forEach(function(r,e){i.forEach(function(n,a){t[r][n]=u[e][a]})}),t},o.diagonal=function(r){var e=o.zeros(r.length,r.length);return r.forEach(function(r,t){e[t][t]=r}),e},o.copy=function(r){return r.map(function(r){return a(r)?r:r.map(function(r){return r})})};var E=o.prototype;return E.length=0,E.push=Array.prototype.push,E.sort=Array.prototype.sort,E.splice=Array.prototype.splice,E.slice=Array.prototype.slice,E.toArray=function(){return this.length>1?p.call(this):p.call(this)[0]},E.map=function(r,e){return o(o.map(this,r,e))},E.cumreduce=function(r,e){return o(o.cumreduce(this,r,e))},E.alter=function(r){return o.alter(this,r),this},function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=function(e){var t,n=this;return e?(setTimeout(function(){e.call(n,E[r].call(n))}),this):(t=o[r](this),m(t)?o(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){E[r]=function(e,t){var n=this;return t?(setTimeout(function(){t.call(n,E[r].call(n,e))}),this):o(o[r](this,e))}}(r[e])}("row col".split(" ")),function(r){for(var e=0;r.length>e;e++)!function(r){E[r]=Function("return jStat(jStat."+r+".apply(null, arguments));")}(r[e])}("create zeros ones rand identity".split(" ")),o}(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 a=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),a=0,u=e.length;--u>=0;)t=e[u]-n,a+=t*t;return a},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),a=Array(e),u=0;e>u;u++){var i=n.indexOf(r[u]),o=n.lastIndexOf(r[u]);if(i===o)var s=i;else var s=(i+o)/2;a[u]=s+1}return a},r.mode=function(r){for(var e,n=r.length,a=r.slice().sort(t),u=1,i=0,o=0,s=[],e=0;n>e;e++)a[e]===a[e+1]?u++:(u>i?(s=[a[e]],i=u,o=0):u===i&&(s.push(a[e]),o++),u=1);return 0===o?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,a=Array(n),u=0;n>u;u++)a[u]=e[u]-t;return a},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),a=[],u=t.length-1;u>=0;u--)a.push(e.abs(t[u]-n));return r.mean(a)},r.meddev=function(t){for(var n=r.median(t),a=[],u=t.length-1;u>=0;u--)a.push(e.abs(t[u]-n));return r.median(a)},r.coeffvar=function(e){return r.stdev(e)/r.mean(e)},r.quartiles=function(r){var n=r.length,a=r.slice().sort(t);return[a[e.round(n/4)-1],a[e.round(n/2)-1],a[e.round(3*n/4)-1]]},r.quantiles=function(r,a,u,i){var o,s,l,f,c,p,h=r.slice().sort(t),m=[a.length],E=r.length;void 0===u&&(u=3/8),void 0===i&&(i=3/8);for(var o=0;a.length>o;o++)s=a[o],l=u+s*(1-u-i),f=E*s+l,c=e.floor(n(f,1,E-1)),p=n(f-c,0,1),m[o]=(1-p)*h[c-1]+p*h[c];return m},r.percentile=function(r,e){var n=r.slice().sort(t),a=e*(n.length-1),u=parseInt(a),i=a-u;return n.length>u+1?n[u]*(1-i)+n[u+1]*i:n[u]},r.percentileOfScore=function(r,e,t){var n,a,u=0,i=r.length,o=!1;"strict"===t&&(o=!0);for(var a=0;i>a;a++)n=r[a],(o&&e>n||!o&&e>=n)&&u++;return u/i},r.histogram=function(t,n){for(var a,u=r.min(t),i=n||4,o=(r.max(t)-u)/i,s=t.length,n=[],a=0;i>a;a++)n[a]=0;for(var a=0;s>a;a++)n[e.min(e.floor((t[a]-u)/o),i-1)]+=1;return n},r.covariance=function(e,t){for(var n,a=r.mean(e),u=r.mean(t),i=e.length,o=Array(i),n=0;i>n;n++)o[n]=(e[n]-a)*(t[n]-u);return r.sum(o)/(i-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 a=r.mean(t),u=r.stdev(t),i=t.length,o=0,s=0;i>s;s++)o+=e.pow((t[s]-a)/u,n);return o/t.length},r.skewness=function(e){return r.stanMoment(e,3)},r.kurtosis=function(e){return r.stanMoment(e,4)-3};var u=r.prototype;!function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(t,n){var i=[],o=0,s=this;if(a(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[e].call(s,t))}),this;if(this.length>1){for(s=!0===t?this:this.transpose();s.length>o;o++)i[o]=r[e](s[o]);return i}return r[e](this[0],t)}}(e[t])}("cumsum cumprod".split(" ")),function(e){for(var t=0;e.length>t;t++)!function(e){u[e]=function(t,n){var i=[],o=0,s=this;if(a(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[e].call(s,t))}),this;if(this.length>1){for("sumrow"!==e&&(s=!0===t?this:this.transpose());s.length>o;o++)i[o]=r[e](s[o]);return!0===t?r[e](r.utils.toVector(i)):i}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){u[e]=function(){var t=[],n=0,i=this,o=Array.prototype.slice.call(arguments);if(a(o[o.length-1])){var s=o[o.length-1],l=o.slice(0,o.length-1);return setTimeout(function(){s.call(i,u[e].apply(i,l))}),this}var s=undefined,f=function(t){return r[e].apply(i,[t].concat(o))};if(this.length>1){for(i=i.transpose();i.length>n;n++)t[n]=f(i[n]);return t}return f(this[0])}}(e[t])}("quantiles percentileOfScore".split(" "))}(e,Math),function(r,e){r.gammaln=function(r){var t,n,a,u=0,i=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],o=1.000000000190015;for(a=(n=t=r)+5.5,a-=(t+.5)*e.log(a);6>u;u++)o+=i[u]/++n;return e.log(2.5066282746310007*o/t)-a},r.gammafn=function(r){var t,n,a,u,i=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],o=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,p=r;if(0>=p){if(!(u=p%1+3.6e-16))return Infinity;s=(1&p?-1:1)*e.PI/e.sin(e.PI*u),p=1-p}a=p,n=1>p?p++:(p-=l=(0|p)-1)-1;for(var t=0;8>t;++t)c=(c+i[t])*n,f=f*n+o[t];if(u=c/f+1,p>a)u/=a;else if(a>p)for(var t=0;l>t;++t)u*=p,p++;return s&&(u=s/u),u},r.gammap=function(e,t){return r.lowRegGamma(e,t)*r.gammafn(e)},r.lowRegGamma=function(t,n){var a,u=r.gammaln(t),i=t,o=1/t,s=o,l=n+1-t,f=1/1e-30,c=1/l,p=c,h=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>=h;h++)o+=s*=n/++i;return o*e.exp(-n+t*e.log(n)-u)}for(;m>=h;h++)a=-h*(h-t),l+=2,c=a*c+l,f=l+a/f,c=1/c,p*=c*f;return 1-p*e.exp(-n+t*e.log(n)-u)},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 a,u,i,o,s=1,l=t+n,f=t+1,c=t-1,p=1,h=1-l*r/f;for(1e-30>e.abs(h)&&(h=1e-30),h=1/h,o=h;100>=s&&(a=2*s,u=s*(n-s)*r/((c+a)*(t+a)),h=1+u*h,1e-30>e.abs(h)&&(h=1e-30),p=1+u/p,1e-30>e.abs(p)&&(p=1e-30),h=1/h,o*=h*p,u=-(t+s)*(l+s)*r/((t+a)*(f+a)),h=1+u*h,1e-30>e.abs(h)&&(h=1e-30),p=1+u/p,1e-30>e.abs(p)&&(p=1e-30),h=1/h,i=h*p,o*=i,3e-7<=e.abs(i-1));s++);return o},r.gammapinv=function(t,n){var a,u,i,o,s,l,f,c=0,p=n-1,h=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(p),f=e.exp(p*(l-1)-h),s=.5>t?t:1-t,i=e.sqrt(-2*e.log(s)),a=(2.30753+.27061*i)/(1+i*(.99229+.04481*i))-i,.5>t&&(a=-a),a=e.max(.001,n*e.pow(1-1/(9*n)-a/(3*e.sqrt(n)),3))):(i=1-n*(.253+.12*n),a=i>t?e.pow(t/i,1/n):1-e.log(1-(t-i)/(1-i)));12>c;c++){if(0>=a)return 0;if(u=r.lowRegGamma(n,a)-t,i=n>1?f*e.exp(-(a-p)+p*(e.log(a)-l)):e.exp(-a+p*e.log(a)-h),o=u/i,a-=i=o/(1-.5*e.min(1,o*((n-1)/a-1))),a>0||(a=.5*(a+i)),e.abs(i)<1e-8*a)break}return a},r.erf=function(r){var t,n,a,u,i=[-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],o=27,s=!1,l=0,f=0;for(0>r&&(r=-r,s=!0),t=2/(2+r),n=4*t-2;o>0;o--)a=l,l=n*l-f+i[o],f=a;return u=t*e.exp(-r*r+.5*(i[0]+n*l)-f),s?u-1:1-u},r.erfc=function(e){return 1-r.erf(e)},r.erfcinv=function(t){var n,a,u,i,o=0;if(t>=2)return-100;if(0>=t)return 100;for(i=1>t?t:2-t,u=e.sqrt(-2*e.log(i/2)),n=-.70711*((2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u);2>o;o++)a=r.erfc(n)-i,n+=a/(1.1283791670955126*e.exp(-n*n)-n*a);return 1>t?n:-n},r.ibetainv=function(t,n,a){var u,i,o,s,l,f,c,p,h,m,E,g=n-1,d=a-1,v=0;if(0>=t)return 0;if(t>=1)return 1;for(1>n||1>a?(u=e.log(n/(n+a)),i=e.log(a/(n+a)),s=e.exp(n*u)/n,l=e.exp(a*i)/a,m=s+l,c=s/m>t?e.pow(n*m*t,1/n):1-e.pow(a*m*(1-t),1/a)):(o=.5>t?t:1-t,s=e.sqrt(-2*e.log(o)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,.5>t&&(c=-c),p=(c*c-3)/6,h=2/(1/(2*n-1)+1/(2*a-1)),m=c*e.sqrt(p+h)/h-(1/(2*a-1)-1/(2*n-1))*(p+5/6-2/(3*h)),c=n/(n+a*e.exp(2*m))),E=-r.gammaln(n)-r.gammaln(a)+r.gammaln(n+a);10>v;v++){if(0===c||1===c)return c;if(f=r.ibeta(c,n,a)-t,s=e.exp(g*e.log(c)+d*e.log(1-c)+E),l=f/s,c-=s=l/(1-.5*e.min(1,l*(g/c-d/(1-c)))),c>0||(c=.5*(c+s)),1>c||(c=.5*(c+s+1)),e.abs(s)<1e-8*c&&v>0)break}return c},r.ibeta=function(t,n,a){var u=0===t||1===t?0:e.exp(r.gammaln(n+a)-r.gammaln(n)-r.gammaln(a)+n*e.log(t)+a*e.log(1-t));return t>=0&&1>=t&&((n+1)/(n+a+2)>t?u*r.betacf(t,n,a)/n:1-u*r.betacf(1-t,a,n)/a)},r.randn=function(t,n){var a,u,i,o,s;if(n||(n=t),t)return r.create(t,n,function(){return r.randn()});do{a=e.random(),u=1.7156*(e.random()-.5),i=a-.449871,o=e.abs(u)+.386595,s=i*i+o*(.196*o-.25472*i)}while(s>.27597&&(s>.27846||u*u>-4*e.log(a)*a*a));return u/a},r.randg=function(t,n,a){var u,i,o,s,l,f,c=t;if(a||(a=n),t||(t=1),n)return f=r.zeros(n,a),f.alter(function(){return r.randg(t)}),f;1>t&&(t+=1),u=t-1/3,i=1/e.sqrt(9*u);do{do{l=r.randn(),s=1+i*l}while(0>=s);s*=s*s,o=e.random()}while(o>1-.331*e.pow(l,4)&&e.log(o)>.5*l*l+u*(1-s+e.log(s)));if(t==c)return u*s;do{o=e.random()}while(0===o);return e.pow(o,1/c)*u*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,a){var u=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],i=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],o=.5*t;if(o>=8)return 1;var s=2*r.normal.cdf(o,0,1,1,0)-1;s=s3?2:3;for(var f=o,c=(8-o)/l,p=f+c,h=0,m=a-1,E=1;l>=E;E++){for(var g=0,d=.5*(p+f),v=.5*(p-f),N=1;12>=N;N++){var I,b;N>6?(I=12-N+1,b=u[I-1]):(I=N,b=-u[I-1]);var y=v*b,M=d+y,A=M*M;if(A>60)break;var R=2*r.normal.cdf(M,0,1,1,0),S=2*r.normal.cdf(M,t,1,1,0),T=.5*R-.5*S;Te.exp(-30/n)?(s=e.pow(s,n),1>s?s:1):0}function a(r,t,n){var a=.5-.5*r,u=e.sqrt(e.log(1/(a*a))),i=u+((((-453642210148e-16*u-.204231210125)*u-.342242088547)*u-1)*u+.322232421088)/((((.0038560700634*u+.10353775285)*u+.531103462366)*u+.588581570495)*u+.099348462606);120>n&&(i+=(i*i*i+i)/n/4);var o=.8832-.2368*i;return 120>n&&(o+=-1.214/n+1.208*i/n),i*(o*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,a){var u=r[e](t,n,a);return u.data=this,u},r[e].prototype.sample=function(t){var n=this._a,a=this._b,u=this._c;return t?r.alter(t,function(){return r[e].sample(n,a,u)}):r[e].sample(n,a,u)},function(t){for(var n=0;t.length>n;n++)!function(t){r[e].prototype[t]=function(n){var a=this._a,u=this._b,i=this._c;return n||0===n||(n=this.data),"number"!=typeof n?r.fn.map.call(n,function(n){return r[e][t](n,a,u,i)}):r[e][t](n,a,u,i)}}(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,a){return t>1||0>t?0:1==n&&1==a?1:512>n&&512>a?e.pow(t,n-1)*e.pow(1-t,a-1)/r.betafn(n,a):e.exp((n-1)*e.log(t)+(a-1)*e.log(1-t)-r.betaln(n,a))},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,a){var u,i;return 0>t?0:n>2?(u=n*t/(a+t*n),i=a/(a+t*n),n*i/2*r.binomial.pdf((n-2)/2,(n+a-2)/2,u)):0===t&&2>n?Infinity:0===t&&2===n?1:1/r.betafn(n/2,a/2)*e.pow(n/a,n/2)*e.pow(t,n/2-1)*e.pow(1+n/a*t,-(n+a)/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,a){return 0>t?0:0===t&&1===n?1/a:e.exp((n-1)*e.log(t)-t/a-r.gammaln(n)-n*e.log(a))},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,a){return t>0?e.exp(-(n+1)*e.log(t)-a/t-r.gammaln(n)+n*e.log(a)):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,a){return 0>t?0:.5+.5*r.erf((e.log(t)-n)/e.sqrt(2*a*a))},inv:function(t,n,a){return e.exp(-1.4142135623730951*a*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,a){return 1e-14>e.abs(a)?r.studentt.pdf(t,n):1e-14>e.abs(t)?e.exp(r.gammaln((n+1)/2)-a*a/2-.5*e.log(e.PI*n)-r.gammaln(n/2)):n/t*(r.noncentralt.cdf(t*e.sqrt(1+2/n),n+2,a)-r.noncentralt.cdf(t,n,a))},cdf:function(t,n,a){if(1e-14>e.abs(a))return r.studentt.cdf(t,n);var u=!1;0>t&&(u=!0,a=-a);for(var i=r.normal.cdf(-a,0,1),o=1e-14+1,s=o,l=t*t/(t*t+n),f=0,c=e.exp(-a*a/2),p=e.exp(-a*a/2-.5*e.log(2)-r.gammaln(1.5))*a;200>f||s>1e-14||o>1e-14;)s=o,f>0&&(c*=a*a/(2*f),p*=a*a/(2*(f+.5))),o=c*r.beta.cdf(l,f+.5,n/2)+p*r.beta.cdf(l,f+1,n/2),i+=.5*o,f++;return u?1-i:i}}),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,a){return.5*(1+r.erf((t-n)/e.sqrt(2*a*a)))},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 a=n/2;return r.ibeta((t+e.sqrt(t*t+n))/(2*e.sqrt(t*t+n)),a,a)},inv:function(t,n){var a=r.ibetainv(2*e.min(t,1-t),.5*n,.5);return a=e.sqrt(n*(1-a)/a),t>.5?a:-a},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,a){return 0===a||1===a?n*a===t?1:0:r.combination(n,t)*e.pow(a,t)*e.pow(1-a,n-t)},cdf:function(e,t,n){var a=[],u=0;if(0>e)return 0;if(t>e){for(;e>=u;u++)a[u]=r.binomial.pdf(u,t,n);return r.sum(a)}return 1}}),r.extend(r.negbin,{pdf:function(t,n,a){return t===t>>>0&&(0>t?0:r.combination(t+n-1,n-1)*e.pow(1-a,t)*e.pow(a,n))},cdf:function(e,t,n){var a=0,u=0;if(0>e)return 0;for(;e>=u;u++)a+=r.negbin.pdf(u,t,n);return a}}),r.extend(r.hypgeom,{pdf:function(t,n,a,u){if(t!==t|0)return!1;if(0>t||a-(n-u)>t)return 0;if(t>u||t>a)return 0;if(2*a>n)return 2*u>n?r.hypgeom.pdf(n-a-u+t,n,n-a,n-u):r.hypgeom.pdf(u-t,n,n-a,u);if(2*u>n)return r.hypgeom.pdf(a-t,n,a,n-u);if(u>a)return r.hypgeom.pdf(t,n,u,a);for(var i=1,o=0,s=0;t>s;s++){for(;i>1&&u>o;)i*=1-a/(n-o),o++;i*=(u-s)*(a-s)/((s+1)*(n-a-u+s+1))}for(;u>o;o++)i*=1-a/(n-o);return e.min(1,e.max(0,i))},cdf:function(t,n,a,u){if(0>t||a-(n-u)>t)return 0;if(u>t&&a>t){if(2*a>n)return 2*u>n?r.hypgeom.cdf(n-a-u+t,n,n-a,n-u):1-r.hypgeom.cdf(u-t-1,n,n-a,u);if(2*u>n)return 1-r.hypgeom.cdf(a-t-1,n,a,n-u);if(u>a)return r.hypgeom.cdf(t,n,u,a);for(var i=1,o=1,s=0,l=0;t>l;l++){for(;i>1&&u>s;){var f=1-a/(n-s);o*=f,i*=f,s++}o*=(u-l)*(a-l)/((l+1)*(n-a-u+l+1)),i+=o}for(;u>s;s++)i*=1-a/(n-s);return e.min(1,e.max(0,i))}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=[],a=0;if(0>e)return 0;for(;e>=a;a++)n.push(r.poisson.pdf(a,t));return r.sum(n)},mean:function(r){return r},variance:function(r){return r},sample:function(r){var t=1,n=0,a=e.exp(-r);do{n++,t*=e.random()}while(t>a);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,a){return t>=n||t>a||a>n?NaN:r>t?n>r?r>a?1-e.pow(n-r,2)/((n-t)*(n-a)):e.pow(r-t,2)/((n-t)*(a-t)):1:0},inv:function(r,t,n,a){return t>=n||t>a||a>n?NaN:r>(a-t)/(n-t)?t+(n-t)*(1-e.sqrt((1-r)*(1-(a-t)/(n-t)))):t+(n-t)*e.sqrt(r*((a-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 a=e.random();return(n-r)/(t-r)>a?r+e.sqrt(a*(t-r)*(n-r)):t-e.sqrt((1-a)*(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 a=e.random()-.5;return r-n*t(a)*e.log(1-2*e.abs(a))}}),r.extend(r.tukey,{cdf:function(t,a,u){var i=a,o=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(0>=t)return 0;if(2>u||2>i)return NaN;if(!Number.isFinite(t))return 1;if(u>25e3)return n(t,1,i);var l,f=.5*u,c=f*e.log(u)-u*e.log(2)-r.gammaln(f),p=f-1,h=.25*u;l=u>100?u>800?u>5e3?.125:.25:.5:1,c+=e.log(l);for(var m=0,E=1;50>=E;E++){for(var g=0,d=(2*E-1)*l,v=1;16>=v;v++){var N,I;v>8?(N=v-8-1,I=c+p*e.log(d+o[N]*l)-(o[N]*l+d)*h):(N=v-1,I=c+p*e.log(d-o[N]*l)+(o[N]*l-d)*h);var b;if(I>=-30){b=v>8?t*e.sqrt(.5*(o[N]*l+d)):t*e.sqrt(.5*(-o[N]*l+d));g+=n(b,1,i)*s[N]*e.exp(I)}}if(E*l>=1&&1e-14>=g)break;m+=g}if(g>1e-14)throw Error("tukey.cdf failed to converge");return m>1&&(m=1),m},inv:function(t,n,u){var i=n;if(2>u||2>i)return NaN;if(0>t||t>1)return NaN;if(0===t)return 0;if(1===t)return Infinity;var o,s=a(t,i,u),l=r.tukey.cdf(s,n,u)-t;o=l>0?e.max(0,s-1):s+1;for(var f,c=r.tukey.cdf(o,n,u)-t,p=1;50>p;p++){f=o-c*(o-s)/(c-l),l=c,s=o,0>f&&(f=0,c=-t),c=r.tukey.cdf(f,n,u)-t,o=f;if(1e-4>e.abs(o-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 a=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 a,u,i,o,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,i=n(t)?t[0].length:l),c=0,n(t)){for(;i>c;c++)for(a=0;s>a;a++){for(o=0,u=0;l>u;u++)o+=r[a][u]*t[u][c];f[a][c]=o}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])},dot:function(r,t){n(r[0])||(r=[r]),n(t[0])||(t=[t]);for(var a,u,i=1===r[0].length&&1!==r.length?e.transpose(r):r,o=1===t[0].length&&1!==t.length?e.transpose(t):t,s=[],l=0,f=i.length,c=i[0].length;f>l;l++){for(s[l]=[],a=0,u=0;c>u;u++)a+=i[l][u]*o[l][u];s[l]=a}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 a=0,u=0;for(isNaN(e)&&(e=2),n(r[0])&&(r=r[0]);r.length>u;u++)a+=t.pow(t.abs(r[u]),e);return t.pow(a,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++)a.apply(t[n],e[n]);return t},inv:function(r){for(var t,n=r.length,a=r[0].length,u=e.identity(n,a),i=e.gauss_jordan(r,u),o=[],s=0;n>s;s++)for(o[s]=[],t=a;i[0].length>t;t++)o[s][t-a]=i[s][t];return o},det:function(r){var e,t=r.length,n=2*t,a=Array(n),u=t-1,i=n-1,o=u-t+1,s=i,l=0,f=0;if(2===t)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(;n>l;l++)a[l]=1;for(var l=0;t>l;l++){for(e=0;t>e;e++)a[0>o?o+t:o]*=r[l][e],a[t>s?s+t:s]*=r[l][e],o++,s--;o=--u-t+1,s=--i}for(var l=0;t>l;l++)f+=a[l];for(;n>l;l++)f-=a[l];return f},gauss_elimination:function(r,n){var a,u,i,o,s=0,l=0,f=r.length,c=r[0].length,p=1,h=0,m=[];r=e.aug(r,n),a=r[0].length;for(var s=0;f>s;s++){for(u=r[s][s],l=s,o=s+1;c>o;o++)uo;o++)i=r[s][o],r[s][o]=r[l][o],r[l][o]=i;for(l=s+1;f>l;l++)for(p=r[l][s]/r[s][s],o=s;a>o;o++)r[l][o]=r[l][o]-p*r[s][o]}for(var s=f-1;s>=0;s--){for(h=0,l=s+1;f-1>=l;l++)h+=m[l]*r[s][l];m[s]=(r[s][a-1]-h)/r[s][s]}return m},gauss_jordan:function(r,n){for(var a=e.aug(r,n),u=a.length,i=a[0].length,o=0,s=0;u>s;s++){for(var l=s,f=s+1;u>f;f++)t.abs(a[f][s])>t.abs(a[l][s])&&(l=f);var c=a[s];a[s]=a[l],a[l]=c;for(var f=s+1;u>f;f++){o=a[f][s]/a[s][s];for(var p=s;i>p;p++)a[f][p]-=a[s][p]*o}}for(var s=u-1;s>=0;s--){o=a[s][s];for(var f=0;s>f;f++)for(var p=i-1;p>s-1;p--)a[f][p]-=a[s][p]*a[f][s]/o;a[s][s]/=o;for(var p=u;i>p;p++)a[s][p]/=o}return a},triaUpSolve:function(r,t){var n,a=r[0].length,u=e.zeros(1,a)[0],i=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),i=!0),e.arange(a-1,-1,-1).forEach(function(i){n=e.arange(i+1,a).map(function(e){return u[e]*r[i][e]}),u[i]=(t[i]-e.sum(n))/r[i][i]}),i?u.map(function(r){return[r]}):u},triaLowSolve:function(r,t){var n,a=r[0].length,u=e.zeros(1,a)[0],i=!1;return t[0].length!=undefined&&(t=t.map(function(r){return r[0]}),i=!0),e.arange(a).forEach(function(a){n=e.arange(a).map(function(e){return r[a][e]*u[e]}),u[a]=(t[a]-e.sum(n))/r[a][a]}),i?u.map(function(r){return[r]}):u},lu:function(r){var t,n=r.length,a=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(o){e.arange(o).forEach(function(n){t=e.arange(n).map(function(r){return a[o][r]*u[r][n]}),a[o][n]=(r[o][n]-e.sum(t))/u[n][n]}),e.arange(o,n).forEach(function(n){t=e.arange(o).map(function(r){return a[o][r]*u[r][n]}),u[o][n]=r[i][n]-e.sum(t)})}),[a,u]},cholesky:function(r){var n,a=r.length,u=e.zeros(r.length,r[0].length);return e.arange(a).forEach(function(i){n=e.arange(i).map(function(r){return t.pow(u[i][r],2)}),u[i][i]=t.sqrt(r[i][i]-e.sum(n)),e.arange(i+1,a).forEach(function(t){n=e.arange(i).map(function(r){return u[i][r]*u[t][r]}),u[t][i]=(r[i][t]-e.sum(n))/u[i][i]})}),u},gauss_jacobi:function(r,n,a,u){for(var i,o,s,l,f=0,c=0,p=r.length,h=[],m=[],E=[];p>f;f++)for(h[f]=[],m[f]=[],E[f]=[],c=0;p>c;c++)f>c?(h[f][c]=r[f][c],m[f][c]=E[f][c]=0):c>f?(m[f][c]=r[f][c],h[f][c]=E[f][c]=0):(E[f][c]=r[f][c],h[f][c]=m[f][c]=0);for(s=e.multiply(e.multiply(e.inv(E),e.add(h,m)),-1),o=e.multiply(e.inv(E),n),i=a,l=e.add(e.multiply(s,a),o),f=2;t.abs(e.norm(e.subtract(l,i)))>u;)i=l,l=e.add(e.multiply(s,i),o),f++;return l},gauss_seidel:function(r,n,a,u){for(var i,o,s,l,f,c=0,p=r.length,h=[],m=[],E=[];p>c;c++)for(h[c]=[],m[c]=[],E[c]=[],i=0;p>i;i++)c>i?(h[c][i]=r[c][i],m[c][i]=E[c][i]=0):i>c?(m[c][i]=r[c][i],h[c][i]=E[c][i]=0):(E[c][i]=r[c][i],h[c][i]=m[c][i]=0);for(l=e.multiply(e.multiply(e.inv(e.add(E,h)),m),-1),s=e.multiply(e.inv(e.add(E,h)),n),o=a,f=e.add(e.multiply(l,a),s),c=2;t.abs(e.norm(e.subtract(f,o)))>u;)o=f,f=e.add(e.multiply(l,o),s),c+=1;return f},SOR:function(r,n,a,u,i){for(var o,s,l,f,c,p=0,h=r.length,m=[],E=[],g=[];h>p;p++)for(m[p]=[],E[p]=[],g[p]=[],o=0;h>o;o++)p>o?(m[p][o]=r[p][o],E[p][o]=g[p][o]=0):o>p?(E[p][o]=r[p][o],m[p][o]=g[p][o]=0):(g[p][o]=r[p][o],m[p][o]=E[p][o]=0);for(f=e.multiply(e.inv(e.add(g,e.multiply(m,i))),e.subtract(e.multiply(g,1-i),e.multiply(E,i))),l=e.multiply(e.multiply(e.inv(e.add(g,e.multiply(m,i))),n),i),s=a,c=e.add(e.multiply(f,a),l),p=2;t.abs(e.norm(e.subtract(c,s)))>u;)s=c,c=e.add(e.multiply(f,s),l),p++;return c},householder:function(r){for(var n,a,u,i,o,s=r.length,l=r[0].length,f=0,c=[],p=[];s-1>f;f++){for(n=0,i=f+1;l>i;i++)n+=r[i][f]*r[i][f];for(o=r[f+1][f]>0?-1:1,n=o*t.sqrt(n),a=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*a),u=f+2;s>u;u++)c[u][0]=r[u][f]/(2*a);p=e.subtract(e.identity(s,l),e.multiply(e.multiply(c,e.transpose(c)),2)),r=e.multiply(p,e.multiply(r,p))}return r},QR:function(){function n(n){var i=n.length,o=n[0].length;n=e.copy(n),r=e.zeros(o,o);var s,l,f;for(l=0;o>l;l++){for(r[l][l]=t.sqrt(a(u(i).map(function(r){return n[r][l]*n[r][l]}))),s=0;i>s;s++)n[s][l]=n[s][l]/r[l][l];for(f=l+1;o>f;f++)for(r[l][f]=a(u(i).map(function(r){return n[r][l]*n[r][f]})),s=0;i>s;s++)n[s][f]=n[s][f]-n[s][l]*r[l][f]}return[n,r]}var a=e.sum,u=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(a){var u=e.multiply(r[a][t],-1),i=e.slice(r,{row:a}),o=e.multiply(e.slice(r,{row:t}),u);e.sliceAssign(r,{row:a},e.add(i,o));var s=e.slice(n,{row:a}),l=e.multiply(e.slice(n,{row:t}),u);e.sliceAssign(n,{row:a},e.add(s,l))})}),n}function a(r,t){var a=!1;t[0].length===undefined&&(t=t.map(function(r){return[r]}),a=!0);var u=e.QR(r),i=u[0],o=u[1],s=r[0].length,l=e.slice(i,{col:{end:s}}),f=e.slice(o,{row:{end:s}}),c=n(f),p=e.transpose(l);p[0].length===undefined&&(p=[p]);var h=e.multiply(e.multiply(c,p),t);return h.length===undefined&&(h=[[h]]),a?h.map(function(r){return r[0]}):h}return a}(),jacobi:function(r){for(var n,a,u,i,o,s,l,f,c=1,p=0,h=r.length,m=e.identity(h,h),E=[];1===c;){p++,s=r[0][1],i=0,o=1;for(var a=0;h>a;a++)for(u=0;h>u;u++)a!=u&&s0?t.PI/4:-t.PI/4:t.atan(2*r[i][o]/(r[i][i]-r[o][o]))/2,f=e.identity(h,h),f[i][i]=t.cos(l),f[i][o]=-t.sin(l),f[o][i]=t.sin(l),f[o][o]=t.cos(l),m=e.multiply(m,f),n=e.multiply(e.multiply(e.inv(f),r),f),r=n,c=0;for(var a=1;h>a;a++)for(u=1;h>u;u++)a!=u&&t.abs(r[a][u])>.001&&(c=1)}for(var a=0;h>a;a++)E.push(r[a][a]);return[m,E]},rungekutta:function(r,e,t,n,a,u){var i,o,s,l,f;if(2===u)for(;t>=n;)i=e*r(n,a),o=e*r(n+e,a+i),s=a+(i+o)/2,a=s,n+=e;if(4===u)for(;t>=n;)i=e*r(n,a),o=e*r(n+e/2,a+i/2),l=e*r(n+e/2,a+o/2),f=e*r(n+e,a+l),s=a+(i+2*o+2*l+f)/6,a=s,n+=e;return a},romberg:function(r,e,n,a){for(var u,i,o,s,l,f=0,c=(n-e)/2,p=[],h=[],m=[];a/2>f;){for(l=r(e),o=e,s=0;n>=o;o+=c,s++)p[s]=o;for(u=p.length,o=1;u-1>o;o++)l+=(o%2!=0?4:2)*r(p[o]);l=c/3*(l+r(n)),m[f]=l,c/=2,f++}for(i=m.length,u=1;1!==i;){for(o=0;i-1>o;o++)h[o]=(t.pow(4,u)*m[o+1]-m[o])/(t.pow(4,u)-1);i=h.length,m=h,h=[],u++}return m},richardson:function(r,e,n,a){function u(r,e){for(var t,n=0,a=r.length;a>n;n++)r[n]===e&&(t=n);return t}for(var i,o,s,l,f,c=t.abs(n-r[u(r,n)+1]),p=0,h=[],m=[];a>=c;)i=u(r,n+a),o=u(r,n),h[p]=(e[i]-2*e[o]+e[2*o-i])/(a*a),a/=2,p++;for(l=h.length,s=1;1!=l;){for(f=0;l-1>f;f++)m[f]=(t.pow(4,s)*h[f+1]-h[f])/(t.pow(4,s)-1);l=m.length,h=m,m=[],s++}return h},simpson:function(r,e,t,n){for(var a,u=(t-e)/n,i=r(e),o=[],s=e,l=0,f=1;t>=s;s+=u,l++)o[l]=s;for(a=o.length;a-1>f;f++)i+=(f%2!=0?4:2)*r(o[f]);return u/3*(i+r(t))},hermite:function(r,e,t,n){for(var a,u=r.length,i=0,o=0,s=[],l=[],f=[],c=[];u>o;o++){for(s[o]=1,a=0;u>a;a++)o!=a&&(s[o]*=(n-r[a])/(r[o]-r[a]));for(l[o]=0,a=0;u>a;a++)o!=a&&(l[o]+=1/(r[o]-r[a]));f[o]=s[o]*s[o]*(1-2*(n-r[o])*l[o]),c[o]=s[o]*s[o]*(n-r[o]),i+=f[o]*e[o]+c[o]*t[o]}return i},lagrange:function(r,e,t){for(var n,a,u=0,i=0,o=r.length;o>i;i++){for(a=e[i],n=0;o>n;n++)i!=n&&(a*=(t-r[n])/(r[i]-r[n]));u+=a}return u},cubic_spline:function(r,t,n){for(var a,u=r.length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[];u-1>i;i++)c[i]=r[i+1]-r[i];l[0]=0;for(var i=1;u-1>i;i++)l[i]=3/c[i]*(t[i+1]-t[i])-3/c[i-1]*(t[i]-t[i-1]);for(var i=1;u-1>i;i++)o[i]=[],s[i]=[],o[i][i-1]=c[i-1],o[i][i]=2*(c[i-1]+c[i]),o[i][i+1]=c[i],s[i][0]=l[i];for(f=e.multiply(e.inv(o),s),a=0;u-1>a;a++)p[a]=(t[a+1]-t[a])/c[a]-c[a]*(f[a+1][0]+2*f[a][0])/3,h[a]=(f[a+1][0]-f[a][0])/(3*c[a]);for(a=0;u>a&&r[a]<=n;a++);return a-=1,t[a]+(n-r[a])*p[a]+e.sq(n-r[a])*f[a]+(n-r[a])*e.sq(n-r[a])*h[a]},gauss_quadrature:function(){throw Error("gauss_quadrature not yet implemented")},PCA:function(r){for(var t,n,a=r.length,u=r[0].length,i=0,o=[],s=[],l=[],f=[],c=[],p=[],h=[],m=[],E=[],g=[],i=0;a>i;i++)o[i]=e.sum(r[i])/u;for(var i=0;u>i;i++)for(h[i]=[],t=0;a>t;t++)h[i][t]=r[t][i]-o[t];h=e.transpose(h);for(var i=0;a>i;i++)for(m[i]=[],t=0;a>t;t++)m[i][t]=e.dot([h[i]],[h[t]])/(u-1);l=e.jacobi(m),E=l[0],s=l[1],g=e.transpose(E);for(var i=0;s.length>i;i++)for(t=i;s.length>t;t++)s[t]>s[i]&&(n=s[i],s[i]=s[t],s[t]=n,f=g[i],g[i]=g[t],g[t]=f);p=e.transpose(h);for(var i=0;a>i;i++)for(c[i]=[],t=0;p.length>t;t++)c[i][t]=e.dot([g[i]],[p[t]]);return[r,s,g,c]}}),function(r){for(var t=0;r.length>t;t++)!function(r){e.fn[r]=function(t,n){var a=this;return n?(setTimeout(function(){n.call(a,e.fn[r].call(a,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,a){if(r>1||n>1||0>=r||0>=n)throw Error("Proportions should be greater than 0 and less than 1");var u=(r*t+n*a)/(t+a);return(r-n)/e.sqrt(u*(1-u)*(1/t+1/a))}var n=[].slice,a=r.utils.isNumber,u=r.utils.isArray;r.extend({zscore:function(){var e=n.call(arguments);return a(e[1])?(e[0]-e[1])/e[2]:(e[0]-r.mean(e[1]))/r.stdev(e[1],e[2])},ztest:function(){var t,a=n.call(arguments);return u(a[1])?(t=r.zscore(a[0],a[1],a[3]),1===a[2]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):a.length>2?(t=r.zscore(a[0],a[1],a[2]),1===a[3]?r.normal.cdf(-e.abs(t),0,1):2*r.normal.cdf(-e.abs(t),0,1)):(t=a[0],1===a[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,a){var u=e.abs(this.zscore(t,a));return 1===n?r.normal.cdf(-u,0,1):2*r.normal.cdf(-u,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,u=n.call(arguments);return 5===u.length?(t=e.abs(r.tscore(u[0],u[1],u[2],u[3])),1===u[4]?r.studentt.cdf(-t,u[3]-1):2*r.studentt.cdf(-t,u[3]-1)):a(u[1])?(t=e.abs(u[0]),1==u[2]?r.studentt.cdf(-t,u[1]-1):2*r.studentt.cdf(-t,u[1]-1)):(t=e.abs(r.tscore(u[0],u[1])),1==u[2]?r.studentt.cdf(-t,u[1].length-1):2*r.studentt.cdf(-t,u[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,a,u,i,o,s,l,f,c=n.call(arguments);if(1===c.length){o=Array(c[0].length);for(var l=0;c[0].length>l;l++)o[l]=c[0][l];c=o}if(2===c.length)return r.variance(c[0])/r.variance(c[1]);a=[];for(var l=0;c.length>l;l++)a=a.concat(c[l]);u=r.mean(a),t=0;for(var l=0;c.length>l;l++)t+=c[l].length*e.pow(r.mean(c[l])-u,2);t/=c.length-1,s=0;for(var l=0;c.length>l;l++)for(i=r.mean(c[l]),f=0;c[l].length>f;f++)s+=e.pow(c[l][f]-i,2);return s/=a.length-c.length,t/s},anovaftest:function(){var e,t,u,i,o=n.call(arguments);if(a(o[0]))return 1-r.centralF.cdf(o[0],o[1],o[2]);anovafscore=r.anovafscore(o),e=o.length-1,u=0;for(var i=0;o.length>i;i++)u+=o[i].length;return t=u-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,u,i,o,s,l=n.call(arguments);return a(l[0])?(t=l[0],u=l[1],i=l[2],o=l[3],s=l[4]):(t=r.mean(l[0]),u=r.mean(l[1]),i=l[0].length,o=l[1].length,s=l[2]),e.abs(t-u)/(s*e.sqrt((1/i+1/o)/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 a=t[0],u=t[1];return 1-r.tukey.cdf(e,u,a-u)},tukeyhsd:function(e){for(var t=r.pooledstdev(e),n=e.map(function(e){return r.mean(e)}),a=e.reduce(function(r,e){return r+e.length},0),u=[],i=0;e.length>i;++i)for(var o=i+1;e.length>o;++o){var s=r.qtest(n[i],n[o],e[i].length,e[o].length,t,a,e.length);u.push([[i,o],s])}return u}}),r.extend({normalci:function(){var t,a=n.call(arguments),u=Array(2);return t=e.abs(4===a.length?r.normal.inv(a[1]/2,0,1)*a[2]/e.sqrt(a[3]):r.normal.inv(a[1]/2,0,1)*r.stdev(a[2])/e.sqrt(a[2].length)),u[0]=a[0]-t,u[1]=a[0]+t,u},tci:function(){var t,a=n.call(arguments),u=Array(2);return t=e.abs(4===a.length?r.studentt.inv(a[1]/2,a[3]-1)*a[2]/e.sqrt(a[3]):r.studentt.inv(a[1]/2,a[2].length-1)*r.stdev(a[2],!0)/e.sqrt(a[2].length)),u[0]=a[0]-t,u[1]=a[0]+t,u},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,a,u){var i=t(e,n,a,u);return r.ztest(i,1)},twoSidedDifferenceOfProportions:function(e,n,a,u){var i=t(e,n,a,u);return r.ztest(i,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(a){var u=e.arange(n).filter(function(r){return r!==a});return t(e.col(r,a).map(function(r){return r[0]}),e.col(r,u))})}function t(r,t){var n=r.length,a=t[0].length-1,u=n-a-1,i=e.lstsq(t,r),o=e.multiply(t,i.map(function(r){return[r]})).map(function(r){return r[0]}),s=e.subtract(r,o),l=e.mean(r),f=e.sum(o.map(function(r){return Math.pow(r-l,2)})),c=e.sum(r.map(function(r,e){return Math.pow(r-o[e],2)})),p=f+c;return{exog:t,endog:r,nobs:n,df_model:a,df_resid:u,coef:i,predict:o,resid:s,ybar:l,SST:p,SSE:f,SSR:c,R2:f/p}}function n(t){var n=r(t.exog),a=Math.sqrt(t.SSR/t.df_resid),u=n.map(function(r){var e=r.SST,t=r.R2;return a/Math.sqrt(e*(1-t))}),i=t.coef.map(function(r,e){return(r-0)/u[e]}),o=i.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*u[e];return[r-t,r+t]});return{se:u,t:i,p:o,sigmaHat:a,interval95:l}}function a(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 u(r,e){var u=t(r,e),i=n(u),o=a(u),s=1-(u.nobs-1)/u.df_resid*(1-u.R2);return u.t=i,u.f=o,u.adjust_R2=s,u}return{ols:u}}(),e.jStat=e,e})},function(r,e,t){var n=t(1),a=t(9),u=t(0);e.UNIQUE=function(){for(var r=[],e=0;arguments.length>e;++e){for(var t=!1,n=arguments[e],a=0;r.length>a&&!(t=r[a]===n);++a);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 u.error;try{for(var t=e.split("."),n=r,a=0;t.length>a;++a){var i=t[a];if("]"===i[i.length-1]){var o=i.indexOf("["),s=i.substring(o+1,i.length-1);n=n[i.substring(0,o)][s]}else n=n[i]}return n}catch(u){}},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 a(r).format(e)}},function(r,e,t){function n(r){return/^[01]{1,10}$/.test(r)}var a=t(0),u=t(11).jStat,i=t(6),o=t(1),s=t(28);e.BESSELI=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besseli(r,e)},e.BESSELJ=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besselj(r,e)},e.BESSELK=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.besselk(r,e)},e.BESSELY=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:s.bessely(r,e)},e.BIN2DEC=function(r){if(!n(r))return a.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 a.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(0xfffffffe00+parseInt(t.substring(1),2)).toString(16);var u=parseInt(r,2).toString(16);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.BIN2OCT=function(r,e){if(!n(r))return a.num;var t=""+r;if(10===t.length&&"1"===t.substring(0,1))return(1073741312+parseInt(t.substring(1),2)).toString(8);var u=parseInt(r,2).toString(8);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.BITAND=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r&e},e.BITLSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(e)>53?a.num:0>e?r>>-e:r<r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r|e},e.BITRSHIFT=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r?a.num:Math.floor(r)!==r?a.num:r>0xffffffffffff?a.num:Math.abs(e)>53?a.num:0>e?r<<-e:r>>e},e.BITXOR=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:0>r||0>e?a.num:Math.floor(r)!==r||Math.floor(e)!==e?a.num:r>0xffffffffffff||e>0xffffffffffff?a.num:r^e},e.COMPLEX=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?r:"i"!==(t=t===undefined?"i":t)&&"j"!==t?a.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=o.parseNumber(r))instanceof Error)return r;for(var n,u=[["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]],i={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,p=t,h=1,m=1,E=0;146>E;E++)n=null===u[E][2]?[]:u[E][2],u[E][1]!==c&&0>n.indexOf(c)||(l=u[E]),u[E][1]!==p&&0>n.indexOf(p)||(f=u[E]);if(null===l){var g=i[e.substring(0,2)],d=s[e.substring(0,1)];"da"===e.substring(0,2)&&(d=["dekao",10,"da"]),g?(h=g[2],c=e.substring(2)):d&&(h=d[1],c=e.substring(d[2].length));for(var v=0;146>v;v++)n=null===u[v][2]?[]:u[v][2],u[v][1]!==c&&0>n.indexOf(c)||(l=u[v])}if(null===f){var N=i[t.substring(0,2)],I=s[t.substring(0,1)];"da"===t.substring(0,2)&&(I=["dekao",10,"da"]),N?(m=N[2],p=t.substring(2)):I&&(m=I[1],p=t.substring(I[2].length));for(var b=0;146>b;b++)n=null===u[b][2]?[]:u[b][2],u[b][1]!==p&&0>n.indexOf(p)||(f=u[b])}return null===l||null===f?a.na:l[3]!==f[3]?a.na:r*l[6]*h/(f[6]*m)},e.DEC2BIN=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,3}$/.test(r)||-512>r||r>511)return a.num;if(0>r)return"1"+i.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)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DEC2HEX=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,12}$/.test(r)||-549755813888>r||r>549755813887)return a.num;if(0>r)return(1099511627776+r).toString(16);var t=parseInt(r,10).toString(16);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DEC2OCT=function(r,e){if((r=o.parseNumber(r))instanceof Error)return r;if(!/^-?[0-9]{1,9}$/.test(r)||-536870912>r||r>536870911)return a.num;if(0>r)return(1073741824+r).toString(8);var t=parseInt(r,10).toString(8);return void 0===e?t:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),t.length>e?a.num:i.REPT("0",e-t.length)+t)},e.DELTA=function(r,e){return e=e===undefined?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:r===e?1:0},e.ERF=function(r,e){return e=e===undefined?0:e,r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?a.value:u.erf(r)},e.ERF.PRECISE=function(){throw Error("ERF.PRECISE is not implemented")},e.ERFC=function(r){return isNaN(r)?a.value:u.erfc(r)},e.ERFC.PRECISE=function(){throw Error("ERFC.PRECISE is not implemented")},e.GESTEP=function(r,e){return e=e||0,r=o.parseNumber(r),o.anyIsError(e,r)?r:e>r?0:1},e.HEX2BIN=function(r,e){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.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 a.num;if(t)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return e===undefined?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.HEX2DEC=function(r){if(!/^[0-9A-Fa-f]{1,10}$/.test(r))return a.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 a.num;var t=parseInt(r,16);if(t>536870911&&0xffe0000000>t)return a.num;if(t>=0xffe0000000)return(t-0xffc0000000).toString(8);var n=t.toString(8);return e===undefined?n:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),n.length>e?a.num:i.REPT("0",e-n.length)+n)},e.IMABS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))},e.IMAGINARY=function(r){if(r===undefined||!0===r||!1===r)return a.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),u="i"===n||"j"===n;return 0>e&&0>t?u?isNaN(r.substring(0,r.length-1))?a.num:r.substring(0,r.length-1):isNaN(r)?a.num:0:u?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:-+r.substring(t+1,r.length-1):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(e+1,r.length-1):a.num},e.IMARGUMENT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:0===t&&0===n?a.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(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",0!==n?e.COMPLEX(t,-n,u):r},e.IMCOS=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,u)},e.IMCOSH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,u)},e.IMCOT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV(e.IMCOS(r),e.IMSIN(r))},e.IMDIV=function(r,t){var n=e.IMREAL(r),u=e.IMAGINARY(r),i=e.IMREAL(t),s=e.IMAGINARY(t);if(o.anyIsError(n,u,i,s))return a.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===i&&0===s)return a.num;var p=i*i+s*s;return e.COMPLEX((n*i+u*s)/p,(u*i-n*s)/p,c)},e.IMEXP=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.exp(t);return e.COMPLEX(i*Math.cos(n),i*Math.sin(n),u)},e.IMLN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),u)},e.IMLOG10=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),u)},e.IMLOG2=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),u)},e.IMPOWER=function(r,t){t=o.parseNumber(t);var n=e.IMREAL(r),u=e.IMAGINARY(r);if(o.anyIsError(t,n,u))return a.value;var i=r.substring(r.length-1);i="i"===i||"j"===i?i:"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),i)},e.IMPRODUCT=function(){var r=arguments[0];if(!arguments.length)return a.value;for(var t=1;arguments.length>t;t++){var n=e.IMREAL(r),u=e.IMAGINARY(r),i=e.IMREAL(arguments[t]),s=e.IMAGINARY(arguments[t]);if(o.anyIsError(n,u,i,s))return a.value;r=e.COMPLEX(n*i-u*s,n*s+u*i)}return r},e.IMREAL=function(r){if(r===undefined||!0===r||!1===r)return a.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),u="i"===n||"j"===n;return 0>e&&0>t?u?isNaN(r.substring(0,r.length-1))?a.num:0:isNaN(r)?a.num:r:u?0>e?isNaN(r.substring(0,t))||isNaN(r.substring(t+1,r.length-1))?a.num:+r.substring(0,t):isNaN(r.substring(0,e))||isNaN(r.substring(e+1,r.length-1))?a.num:+r.substring(0,e):a.num},e.IMSEC=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV("1",e.IMCOS(r))},e.IMSECH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:e.IMDIV("1",e.IMCOSH(r))},e.IMSIN=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,u)},e.IMSINH=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);return u="i"===u||"j"===u?u:"i",e.COMPLEX(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,u)},e.IMSQRT=function(r){var t=e.IMREAL(r),n=e.IMAGINARY(r);if(o.anyIsError(t,n))return a.value;var u=r.substring(r.length-1);u="i"===u||"j"===u?u:"i";var i=Math.sqrt(e.IMABS(r)),s=e.IMARGUMENT(r);return e.COMPLEX(i*Math.cos(s/2),i*Math.sin(s/2),u)},e.IMCSC=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.num:e.IMDIV("1",e.IMSIN(r))},e.IMCSCH=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.num:e.IMDIV("1",e.IMSINH(r))},e.IMSUB=function(r,e){var t=this.IMREAL(r),n=this.IMAGINARY(r),u=this.IMREAL(e),i=this.IMAGINARY(e);if(o.anyIsError(t,n,u,i))return a.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-u,n-i,f)},e.IMSUM=function(){if(!arguments.length)return a.value;for(var r=o.flatten(arguments),e=r[0],t=1;r.length>t;t++){var n=this.IMREAL(e),u=this.IMAGINARY(e),i=this.IMREAL(r[t]),s=this.IMAGINARY(r[t]);if(o.anyIsError(n,u,i,s))return a.value;e=this.COMPLEX(n+i,u+s)}return e},e.IMTAN=function(r){if(!0===r||!1===r)return a.value;var t=e.IMREAL(r),n=e.IMAGINARY(r);return o.anyIsError(t,n)?a.value:this.IMDIV(this.IMSIN(r),this.IMCOS(r))},e.OCT2BIN=function(r,e){if(!/^[0-7]{1,10}$/.test(r))return a.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 a.num;if(t)return"1"+i.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return void 0===e?u:isNaN(e)?a.value:0>e?a.num:(e=Math.floor(e),u.length>e?a.num:i.REPT("0",e-u.length)+u)},e.OCT2DEC=function(r){if(!/^[0-7]{1,10}$/.test(r))return a.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 a.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)?a.value:0>e?a.num:(e=Math.floor(e),n.length>e?a.num:i.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 a(r){var e="";return 0>r||(e=""+(r+1)),e}function u(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 i(r){for(var e="";r>=0;)e=String.fromCharCode(r%f+97)+e,r=Math.floor(r/f)-1;return e.toUpperCase()}function o(r){if("string"!=typeof r||!c.test(r))return[];var e=r.toUpperCase().match(c),t=e[1],a=e[2],i=e[3],o=e[4];return[{index:n(o),label:o,isAbsolute:"$"===i},{index:u(a),label:a,isAbsolute:"$"===t}]}function s(r,e){var t=(r.isAbsolute?"$":"")+a(r.index);return(e.isAbsolute?"$":"")+i(e.index)+t}e.__esModule=!0,e.rowLabelToIndex=n,e.rowIndexToLabel=a,e.columnLabelToIndex=u,e.columnIndexToLabel=i,e.extractLabel=o,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 a=t(17),u=n(a),i=t(14),o=n(i),s=t(2),l=n(s),f=t(15);e.SUPPORTED_FORMULAS=o["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=u["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 a(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function u(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 i(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 o=t(18),s=n(o),l=t(19),f=n(l),c=t(41),p=t(43),h=t(3),m=t(2),E=n(m),g=t(15);e["default"]=function(r){function e(){a(this,e);var t=u(this,r.call(this));return t.parser=new c.Parser,t.parser.yy={toNumber:h.toNumber,trimEdges:p.trimEdges,invertNumber:h.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 i(e,r),e.prototype.parse=function(r){var e=null,t=null;try{e=""===r?"":this.parser.parse(r)}catch(a){var n=(0,E["default"])(a.message);t=n||(0,E["default"])(m.ERROR)}return e instanceof Error&&(t=(0,E["default"])(e.message)||(0,E["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,g.extractLabel)(r),t=e[0],n=e[1],a=void 0;return this.emit("callCellValue",{label:r,row:t,column:n},function(r){a=r}),a},e.prototype._callRangeValue=function(r,e){r=r.toUpperCase(),e=e.toUpperCase();var t=(0,g.extractLabel)(r),n=t[0],a=t[1],u=(0,g.extractLabel)(e),i=u[0],o=u[1],s={},l={};n.index>i.index?(s.row=i,l.row=n):(s.row=n,l.row=i),a.index>o.index?(s.column=o,l.column=a):(s.column=a,l.column=o),s.label=(0,g.toLabel)(s.row,s.column),l.label=(0,g.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(){a.off(r,n),e.apply(t,arguments)}var a=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,a=t.length;for(n;a>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],a=[];if(n&&e)for(var u=0,i=n.length;i>u;u++)n[u].fn!==e&&n[u].fn._!==e&&a.push(n[u]);return a.length?t[r]=a:delete t[r],this}},r.exports=t},function(r,e,t){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];if(r=r.toUpperCase(),!L[r])throw Error(C.ERROR_NAME);return L[r].apply(L,e)}function u(r,e){Array.isArray(r)||(r=[r.toUpperCase()]),r.forEach(function(r){L[r]=e.isFactory?e(r):e})}e.__esModule=!0,e["default"]=a,e.registerOperation=u;var i=t(20),o=n(i),s=t(21),l=n(s),f=t(22),c=n(f),p=t(23),h=n(p),m=t(24),E=n(m),g=t(33),d=n(g),v=t(34),N=n(v),I=t(35),b=n(I),y=t(36),M=n(y),A=t(37),R=n(A),S=t(38),T=n(S),O=t(39),x=n(O),V=t(40),$=n(V),C=t(2),L=Object.create(null);u(o["default"].SYMBOL,o["default"]),u(l["default"].SYMBOL,l["default"]),u(c["default"].SYMBOL,c["default"]),u(h["default"].SYMBOL,h["default"]),u($["default"].SYMBOL,$["default"]),u(E["default"].SYMBOL,E["default"]),u(d["default"].SYMBOL,d["default"]),u(N["default"].SYMBOL,N["default"]),u(b["default"].SYMBOL,b["default"]),u(M["default"].SYMBOL,M["default"]),u(T["default"].SYMBOL,T["default"]),u(x["default"].SYMBOL,x["default"]),u(R["default"].SYMBOL,R["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 i=t.reduce(function(r,e){return r+(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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 i=t.reduce(function(r,e){return r/(0,a.toNumber)(e)},(0,a.toNumber)(r));if(i===Infinity)throw Error(u.ERROR_DIV_ZERO);if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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)u[e[0]]&&(t=!0,n=u[e[0]].apply(u,arguments));else{for(var a=e.length,i=0,o=u;a>i;)if(o=o[e[i]],i++,!o){o=null;break}o&&(t=!0,n=o.apply(undefined,arguments))}if(!t)throw Error(s.ERROR_NAME);return n}}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(25),u=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}(a),i=t(14),o=function(r){return r&&r.__esModule?r:{"default":r}}(i),s=t(2),l=e.SYMBOL=o["default"];n.isFactory=!0,n.SYMBOL=l},function(r,e,t){var n=[t(26),t(29),t(13),t(30),t(4),t(6),t(8),t(31),t(7),t(32),t(5),t(12)];for(var a in n){var u=n[a];for(var i in u)e[i]=e[i]||u[i]}},function(r,e,t){function n(r,e){if(e)for(var t in e)r[t]=e[t];return r}var a=t(4),u=t(5),i=t(13),o=t(8);e.BETADIST=u.BETA.DIST,e.BETAINV=u.BETA.INV,e.BINOMDIST=u.BINOM.DIST,e.CEILING=e.ISOCEILING=n(a.CEILING.MATH,a.CEILING),e.CEILINGMATH=a.CEILING.MATH,e.CEILINGPRECISE=a.CEILING.PRECISE,e.CHIDIST=u.CHISQ.DIST,e.CHIDISTRT=u.CHISQ.DIST.RT,e.CHIINV=u.CHISQ.INV,e.CHIINVRT=u.CHISQ.INV.RT,e.CHITEST=u.CHISQ.TEST,e.CONFIDENCE=n(u.CONFIDENCE.NORM,u.CONFIDENCE),e.COVAR=u.COVARIANCE.P,e.COVARIANCEP=u.COVARIANCE.P,e.COVARIANCES=u.COVARIANCE.S,e.CRITBINOM=u.BINOM.INV,e.EXPONDIST=u.EXPON.DIST,e.ERFCPRECISE=i.ERFC.PRECISE,e.ERFPRECISE=i.ERF.PRECISE,e.FDIST=u.F.DIST,e.FDISTRT=u.F.DIST.RT,e.FINVRT=u.F.INV.RT,e.FINV=u.F.INV,e.FLOOR=n(a.FLOOR.MATH,a.FLOOR),e.FLOORMATH=a.FLOOR.MATH,e.FLOORPRECISE=a.FLOOR.PRECISE,e.FTEST=u.F.TEST,e.GAMMADIST=u.GAMMA.DIST,e.GAMMAINV=u.GAMMA.INV,e.GAMMALNPRECISE=u.GAMMALN.PRECISE,e.HYPGEOMDIST=u.HYPGEOM.DIST,e.LOGINV=u.LOGNORM.INV,e.LOGNORMINV=u.LOGNORM.INV,e.LOGNORMDIST=u.LOGNORM.DIST,e.MODE=n(u.MODE.SNGL,u.MODE),e.MODEMULT=u.MODE.MULT,e.MODESNGL=u.MODE.SNGL,e.NEGBINOMDIST=u.NEGBINOM.DIST,e.NETWORKDAYSINTL=o.NETWORKDAYS.INTL,e.NORMDIST=u.NORM.DIST,e.NORMINV=u.NORM.INV,e.NORMSDIST=u.NORM.S.DIST,e.NORMSINV=u.NORM.S.INV,e.PERCENTILE=n(u.PERCENTILE.EXC,u.PERCENTILE),e.PERCENTILEEXC=u.PERCENTILE.EXC,e.PERCENTILEINC=u.PERCENTILE.INC,e.PERCENTRANK=n(u.PERCENTRANK.INC,u.PERCENTRANK),e.PERCENTRANKEXC=u.PERCENTRANK.EXC,e.PERCENTRANKINC=u.PERCENTRANK.INC,e.POISSON=n(u.POISSON.DIST,u.POISSON),e.POISSONDIST=u.POISSON.DIST,e.QUARTILE=n(u.QUARTILE.INC,u.QUARTILE),e.QUARTILEEXC=u.QUARTILE.EXC,e.QUARTILEINC=u.QUARTILE.INC,e.RANK=n(u.RANK.EQ,u.RANK),e.RANKAVG=u.RANK.AVG,e.RANKEQ=u.RANK.EQ,e.SKEWP=u.SKEW.P,e.STDEV=n(u.STDEV.S,u.STDEV),e.STDEVP=u.STDEV.P,e.STDEVS=u.STDEV.S,e.TDIST=u.T.DIST,e.TDISTRT=u.T.DIST.RT,e.TINV=u.T.INV,e.TTEST=u.T.TEST,e.VAR=n(u.VAR.S,u.VAR),e.VARP=u.VAR.P,e.VARS=u.VAR.S,e.WEIBULL=n(u.WEIBULL.DIST,u.WEIBULL),e.WEIBULLDIST=u.WEIBULL.DIST,e.WORKDAYINTL=o.WORKDAY.INTL,e.ZTEST=u.Z.TEST},function(r,e){},function(r,e,t){function n(r,e){return r.reduce(function(r,t){return e*r+t},0)}function a(r,e,t,n,a){a||(a=-1);var u,i=2/r;if(0===e)return t;if(1===e)return n;for(var o=1;o!=e;++o)u=n*o*i+a*t,t=n,n=u;return n}function u(r,e,t,n,u){return function(i,o){if(0===o)return r(i);if(1===o)return e(i);if(0>o)throw t+": Order ("+o+") must be nonnegative";if(1==n&&0===i)throw t+": Undefined when x == 0";if(2==n&&0>=i)throw t+": Undefined when x <= 0";return a(i,o,r(i),e(i),u)}}var i=Math,o=function(){function r(r){var e,a,f,c=r*r,p=i.abs(r)-.785398164;return 8>i.abs(r)?(a=n(t,c),f=n(u,c),e=a/f):(c=64/c,a=n(o,c),f=n(s,c),e=i.sqrt(l/i.abs(r))*(i.cos(p)*a-i.sin(p)*f*8/i.abs(r))),e}function e(r){var e,t,a,u=r*r,o=i.abs(r)-2.356194491;return 8>Math.abs(r)?(t=r*n(f,u),a=n(c,u),e=t/a):(u=64/u,t=n(p,u),a=n(h,u),e=i.sqrt(l/i.abs(r))*(i.cos(o)*t-i.sin(o)*a*8/i.abs(r)),0>r&&(e=-e)),e}var t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),u=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),o=[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(),p=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),h=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(t,n){if(0===(n=Math.round(n)))return r(i.abs(t));if(1===n)return e(i.abs(t));if(0>n)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===i.abs(t))return 0;var u,o,s,l,f,c,p,h,m=2/i.abs(t);if(i.abs(t)>n)u=a(t,n,r(i.abs(t)),e(i.abs(t)),-1);else{for(s=2*i.floor((n+i.floor(i.sqrt(40*n)))/2),l=0,c=u=f=0,p=1,o=s;o>0;o--)h=o*m*p-c,c=p,p=h,i.abs(p)>1e10&&(p*=1e-10,c*=1e-10,u*=1e-10,f*=1e-10),l&&(f+=p),l=!l,o==n&&(u=c);f=2*f-p,u/=f}return 0>t&&n%2?-u:u}}(),s=function(){function r(r){var e,u,c,p=r*r,h=r-.785398164;return 8>r?(u=n(t,p),c=n(a,p),e=u/c+f*o(r,0)*i.log(r)):(p=64/p,u=n(s,p),c=n(l,p),e=i.sqrt(f/r)*(i.sin(h)*u+i.cos(h)*c*8/r)),e}function e(r){var e,t,a,u=r*r,s=r-2.356194491;return 8>r?(t=r*n(c,u),a=n(p,u),e=t/a+f*(o(r,1)*i.log(r)-1/r)):(u=64/u,t=n(h,u),a=n(m,u),e=i.sqrt(f/r)*(i.sin(s)*t+i.cos(s)*a*8/r)),e}var t=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),a=[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(),p=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),h=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return u(r,e,"BESSELY",1,-1)}(),l=function(){function r(r){return r>3.75?i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(a,3.75/i.abs(r)):n(t,r*r/14.0625)}function e(r){return 3.75>r?r*n(u,r*r/14.0625):(0>r?-1:1)*i.exp(i.abs(r))/i.sqrt(i.abs(r))*n(o,3.75/i.abs(r))}var t=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),a=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),u=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),o=[.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===i.abs(t))return 0;var a,u,o,l,f,c,p=2/i.abs(t);for(o=2*i.round((n+i.round(i.sqrt(40*n)))/2),l=a=0,f=1,u=o;u>0;u--)c=u*p*f+l,l=f,f=c,i.abs(f)>1e10&&(f*=1e-10,l*=1e-10,a*=1e-10),u==n&&(a=l);return a*=s(t,0)/f,0>t&&n%2?-a:a}}(),f=function(){function r(r){return r>2?i.exp(-r)/i.sqrt(r)*n(a,2/r):-i.log(r/2)*l(r,0)+n(t,r*r/4)}function e(r){return r>2?i.exp(-r)/i.sqrt(r)*n(s,2/r):i.log(r/2)*l(r,1)+1/r*n(o,r*r/4)}var t=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),a=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),o=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return u(r,e,"BESSELK",2,1)}();e.besselj=o,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),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=0;return utils.arrayEach(n,function(r){i+=a[r]}),0===n.length?error.div0:i/n.length},exports.DCOUNT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNT(i)},exports.DCOUNTA=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.COUNTA(i)},exports.DGET=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);return 0===n.length?error.value:n.length>1?error.num:a[n[0]]},exports.DMAX=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=a[n[0]];return utils.arrayEach(n,function(r){a[r]>i&&(i=a[r])}),i},exports.DMIN=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=a[n[0]];return utils.arrayEach(n,function(r){i>a[r]&&(i=a[r])}),i},exports.DPRODUCT=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i);var o=1;return utils.arrayEach(i,function(r){o*=r}),o},exports.DSTDEV=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.S(i)},exports.DSTDEVP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),i=compact(i),stats.STDEV.P(i)},exports.DSUM=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),maths.SUM(i)},exports.DVAR=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.S(i)},exports.DVARP=function(r,e,t){if(isNaN(e)&&"string"!=typeof e)return error.value;var n=findResultIndex(r,t),a=[];if("string"==typeof e){var u=exports.FINDFIELD(r,e);a=utils.rest(r[u])}else a=utils.rest(r[e]);var i=[];return utils.arrayEach(n,function(r){i.push(a[r])}),stats.VAR.P(i)}},function(r,e,t){var n=t(0),a=t(1),u=t(7);e.AND=function(){for(var r=a.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 u.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=a.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=a.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,a=Math.floor(t/2),u=!1,i=t%2!=0,o=t%2==0?null:arguments[arguments.length-1];if(a)for(var s=0;a>s;s++)if(e===arguments[2*s+1]){r=arguments[2*s+2],u=!0;break}u||(r=i?o:n.na)}else r=n.value;return r}},function(r,e,t){function n(r){return r&&r.getTime&&!isNaN(r.getTime())}function a(r){return r instanceof Date?r:new Date(r)}var u=t(0),i=t(8),o=t(1);e.ACCRINT=function(r,e,t,o,s,l,f){return r=a(r),e=a(e),t=a(t),n(r)&&n(e)&&n(t)?o>0&&s>0?-1===[1,2,4].indexOf(l)?u.num:-1===[0,1,2,3,4].indexOf(f)?u.num:t>r?(s=s||0,f=f||0,s*o*i.YEARFRAC(r,t,f)):u.num:u.num:u.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,a,i,s){if(r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;if(0>=r||0>=t||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=e.PMT(r,t,n,0,s),f=0;1===a&&0===s&&(f=-n,a++);for(var c=a;i>=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,a,i,s){if(r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;if(0>=r||0>=t||0>=n)return u.num;if(1>a||1>i||a>i)return u.num;if(0!==s&&1!==s)return u.num;var l=e.PMT(r,t,n,0,s),f=0;1===a&&(f=0===s?l+n*r:l,a++);for(var c=a;i>=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,a){if(a=a===undefined?12:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;if(0>r||0>e||0>t||0>n)return u.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(a))return u.num;if(n>t)return u.num;if(e>=r)return 0;for(var i=(1-Math.pow(e/r,1/t)).toFixed(3),s=r*i*a/12,l=s,f=0,c=n===t?t-1:n,p=2;c>=p;p++)f=(r-l)*i,l+=f;return 1===n?s:n===t?(r-l)*i:f},e.DDB=function(r,e,t,n,a){if(a=a===undefined?2:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;if(0>r||0>e||0>t||0>n||0>=a)return u.num;if(n>t)return u.num;if(e>=r)return 0;for(var i=0,s=0,l=1;n>=l;l++)s=Math.min(a/t*(r-i),r-e-i),i+=s;return s},e.DISC=function(){throw Error("DISC is not implemented")},e.DOLLARDE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;if(0>e)return u.num;if(e>=0&&1>e)return u.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=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;if(0>e)return u.num;if(e>=0&&1>e)return u.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=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:0>=r||1>e?u.num:(e=parseInt(e,10),Math.pow(1+r/e,e)-1)},e.FV=function(r,e,t,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i;if(0===r)i=n+t*e;else{var s=Math.pow(1+r,e);i=1===a?n*s+t*(1+r)*(s-1)/r:n*s+t*(s-1)/r}return-i},e.FVSCHEDULE=function(r,e){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),o.anyIsError(r,e))return u.value;for(var t=e.length,n=r,a=0;t>a;a++)n*=1+e[a];return n},e.INTRATE=function(){throw Error("INTRATE is not implemented")},e.IPMT=function(r,t,n,a,i,s){if(i=i||0,s=s||0,r=o.parseNumber(r),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,t,n,a,i,s))return u.value;var l=e.PMT(r,n,a,i,s);return(1===t?1===s?0:-a:1===s?e.FV(r,t-2,l,a,1)-l:e.FV(r,t-1,l,a,0))*r},e.IRR=function(r,e){if(e=e||0,r=o.parseNumberArray(o.flatten(r)),e=o.parseNumber(e),o.anyIsError(r,e))return u.value;for(var t=[],n=!1,a=!1,i=0;r.length>i;i++)t[i]=0===i?0:t[i-1]+365,r[i]>0&&(n=!0),0>r[i]&&(a=!0);if(!n||!a)return u.num;e=e===undefined?.1:e;var s,l,f,c=e,p=!0;do{f=function(r,e,t){for(var n=t+1,a=r[0],u=1;r.length>u;u++)a+=r[u]/Math.pow(n,(e[u]-e[0])/365);return a}(r,t,c),s=c-f/function(r,e,t){for(var n=t+1,a=0,u=1;r.length>u;u++){var i=(e[u]-e[0])/365;a-=i*r[u]/Math.pow(n,i+1)}return a}(r,t,c),l=Math.abs(s-c),c=s,p=l>1e-10&&Math.abs(f)>1e-10}while(p);return c},e.ISPMT=function(r,e,t,n){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,e,t,n)?u.value:n*r*(e/t-1)},e.MDURATION=function(){throw Error("MDURATION is not implemented")},e.MIRR=function(r,t,n){if(r=o.parseNumberArray(o.flatten(r)),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,t,n))return u.value;for(var a=r.length,i=[],s=[],l=0;a>l;l++)0>r[l]?i.push(r[l]):s.push(r[l]);var f=-e.NPV(n,s)*Math.pow(1+n,a-1),c=e.NPV(t,i)*(1+t);return Math.pow(f/c,1/(a-1))-1},e.NOMINAL=function(r,e){return r=o.parseNumber(r),e=o.parseNumber(e),o.anyIsError(r,e)?u.value:0>=r||1>e?u.num:(e=parseInt(e,10),(Math.pow(r+1,1/e)-1)*e)},e.NPER=function(r,e,t,n,a){if(a=a===undefined?0:a,n=n===undefined?0:n,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i=e*(1+r*a)-n*r,s=t*r+e*(1+r*a);return Math.log(i/s)/Math.log(1+r)},e.NPV=function(){var r=o.parseNumberArray(o.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=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:r>0?(Math.log(t)-Math.log(e))/Math.log(1+r):u.num},e.PMT=function(r,e,t,n,a){if(n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a))return u.value;var i;if(0===r)i=(t+n)/e;else{var s=Math.pow(1+r,e);i=1===a?(n*r/(s-1)+t*r/(1-1/s))/(1+r):n*r/(s-1)+t*r/(1-1/s)}return-i},e.PPMT=function(r,t,n,a,i,s){return i=i||0,s=s||0,r=o.parseNumber(r),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),s=o.parseNumber(s),o.anyIsError(r,n,a,i,s)?u.value:e.PMT(r,n,a,i,s)-e.IPMT(r,t,n,a,i,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,a){return n=n||0,a=a||0,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),o.anyIsError(r,e,t,n,a)?u.value:0===r?-t*e-n:((1-Math.pow(1+r,e))/r*t*(1+r*a)-n)/Math.pow(1+r,e)},e.RATE=function(r,e,t,n,a,i){if(i=i===undefined?.01:i,n=n===undefined?0:n,a=a===undefined?0:a,r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),a=o.parseNumber(a),i=o.parseNumber(i),o.anyIsError(r,e,t,n,a,i))return u.value;var s,l,f,c,p=0,h=0,m=0,E=i;for(1e-10>Math.abs(E)?s=t*(1+r*E)+e*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=t*h+e*(1/E+a)*(h-1)+n),l=t+e*r+n,f=t*h+e*(1/E+a)*(h-1)+n,m=c=0,p=E;Math.abs(l-f)>1e-10&&50>m;)E=(f*c-l*p)/(f-l),c=p,p=E,1e-10>Math.abs(E)?s=t*(1+r*E)+e*(1+E*a)*r+n:(h=Math.exp(r*Math.log(1+E)),s=t*h+e*(1/E+a)*(h-1)+n),l=f,f=s,++m;return E},e.RECEIVED=function(){throw Error("RECEIVED is not implemented")},e.RRI=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:0===r||0===e?u.num:Math.pow(t/e,1/r)-1},e.SLN=function(r,e,t){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:0===t?u.num:(r-e)/t},e.SYD=function(r,e,t,n){return r=o.parseNumber(r),e=o.parseNumber(e),t=o.parseNumber(t),n=o.parseNumber(n),o.anyIsError(r,e,t,n)?u.value:0===t?u.num:1>n||n>t?u.num:(n=parseInt(n,10),(r-e)*(t-n+1)*2/(t*(t+1)))},e.TBILLEQ=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:365*t/(360-t*i.DAYS360(r,e,!1)):u.num},e.TBILLPRICE=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:100*(1-t*i.DAYS360(r,e,!1)/360):u.num},e.TBILLYIELD=function(r,e,t){return r=o.parseDate(r),e=o.parseDate(e),t=o.parseNumber(t),o.anyIsError(r,e,t)?u.value:t>0?r>e?u.num:e-r>31536e6?u.num:360*(100-t)/(t*i.DAYS360(r,e,!1)):u.num},e.VDB=function(){throw Error("VDB is not implemented")},e.XNPV=function(r,e,t){if(r=o.parseNumber(r),e=o.parseNumberArray(o.flatten(e)),t=o.parseDateArray(o.flatten(t)),o.anyIsError(r,e,t))return u.value;for(var n=0,a=0;e.length>a;a++)n+=e[a]/Math.pow(1+r,i.DAYS(t[a],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),a=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 a,u,i=0;e.length>i;i++)if(1===t){if(e[i]===r)return i+1;r>e[i]&&(u?e[i]>u&&(a=i+1,u=e[i]):(a=i+1,u=e[i]))}else if(0===t){if("string"==typeof r){if(r=r.replace(/\?/g,"."),e[i].toLowerCase().match(r.toLowerCase()))return i+1}else if(e[i]===r)return i+1}else if(-1===t){if(e[i]===r)return i+1;e[i]>r&&(u?u>e[i]&&(a=i+1,u=e[i]):(a=i+1,u=e[i]))}return a||n.na},e.VLOOKUP=function(r,e,t,a){if(!r||!e||!t)return n.na;a=a||!1;for(var u=0;e.length>u;u++){var i=e[u];if(!a&&i[0]===r||i[0]===r||a&&"string"==typeof i[0]&&-1!==i[0].toLowerCase().indexOf(r.toLowerCase()))return i.length+1>t?i[t-1]:n.ref}return n.na},e.HLOOKUP=function(r,e,t,u){if(!r||!e||!t)return n.na;u=u||!1;for(var i=a.transpose(e),o=0;i.length>o;o++){var s=i[o];if(!u&&s[0]===r||s[0]===r||u&&"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 i=t.reduce(function(r,e){return r-(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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 i=t.reduce(function(r,e){return r*(0,a.toNumber)(e)},(0,a.toNumber)(r));if(isNaN(i))throw Error(u.ERROR_VALUE);return i}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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,a.toNumber)(r),(0,a.toNumber)(e));if(isNaN(t))throw Error(u.ERROR_VALUE);return t}e.__esModule=!0,e.SYMBOL=undefined,e["default"]=n;var a=t(3),u=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 i[r])return t;if(0===r||2>e)return!1;e-=2,r=n[e],++t}}var t=this,n=[0],a=[null],u=[],i=this.table,o="",s=0,l=0,f=0,c=2,p=u.slice.call(arguments,1),h=Object.create(this.lexer),m={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(m.yy[E]=this.yy[E]);h.setInput(r,m.yy),m.yy.lexer=h,m.yy.parser=this,"undefined"==typeof h.yylloc&&(h.yylloc={});var g=h.yylloc;u.push(g);var d=h.options&&h.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,N,I,b,y,M,A,R,S,T=function(){var r;return r=h.lex()||1,"number"!=typeof r&&(r=t.symbols_[r]||r),r},O={};;){if(I=n[n.length-1],this.defaultActions[I]?b=this.defaultActions[I]:(null!==v&&void 0!==v||(v=T()),b=i[I]&&i[I][v]),void 0===b||!b.length||!b[0]){var x,V="";if(f)1!==N&&(x=e(I));else{x=e(I),S=[];for(M in i[I])this.terminals_[M]&&M>c&&S.push("'"+this.terminals_[M]+"'");V=h.showPosition?"Parse error on line "+(s+1)+":\n"+h.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(V,{text:h.match,token:this.terminals_[v]||v,line:h.yylineno,loc:g,expected:S,recoverable:!1!==x})}if(3==f){if(1===v||1===N)throw Error(V||"Parsing halted while starting to recover from another error.");l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,v=T()}if(!1===x)throw Error(V||"Parsing halted. No suitable error recovery rule available.");!function(r){n.length=n.length-2*r,a.length=a.length-r,u.length=u.length-r}(x),N=v==c?null:v,v=c,I=n[n.length-1],b=i[I]&&i[I][c],f=3}if(b[0]instanceof Array&&b.length>1)throw Error("Parse Error: multiple actions possible at state: "+I+", token: "+v);switch(b[0]){case 1:n.push(v),a.push(h.yytext),u.push(h.yylloc),n.push(b[1]),v=null,N?(v=N,N=null):(l=h.yyleng,o=h.yytext,s=h.yylineno,g=h.yylloc,f>0&&f--);break;case 2:if(A=this.productions_[b[1]][1],O.$=a[a.length-A],O._$={first_line:u[u.length-(A||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(A||1)].first_column,last_column:u[u.length-1].last_column},d&&(O._$.range=[u[u.length-(A||1)].range[0],u[u.length-1].range[1]]),void 0!==(y=this.performAction.apply(O,[o,l,s,m.yy,b[1],a,u].concat(p))))return y;A&&(n=n.slice(0,-1*A*2),a=a.slice(0,-1*A),u=u.slice(0,-1*A)),n.push(this.productions_[b[1]][0]),a.push(O.$),u.push(O._$),R=i[n[n.length-2]][n[n.length-1]],n.push(R);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 a=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=[a[0],a[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,a;if(this.options.backtrack_lexer&&(a={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&&(a.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 u in a)this[u]=a[u];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 a=this._currentRules(),u=0;a.length>u;u++)if((t=this._input.match(this.rules[a[u]]))&&(!e||t[0].length>e[0].length)){if(e=t,n=u,this.options.backtrack_lexer){if(!1!==(r=this.test_match(t,a[u])))return r;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(r=this.test_match(e,a[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__(42)(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 ee9ed6c9..5a05ff8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hot-formula-parser", - "version": "2.3.1", + "version": "2.3.2", "description": "Formula parser", "browser": "dist/formula-parser.js", "main": "lib/index.js",