forked from WebSheets/websheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
websheet.min.js
15 lines (15 loc) · 277 KB
/
websheet.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var WebSheet=function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="/",r(0)}(function(e){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r))switch(typeof e[r]){case"function":break;case"object":e[r]=function(r){var t=r.slice(1),n=e[r[0]];return function(e,r,i){n.apply(this,[e,r,i].concat(t))}}(e[r]);break;default:e[r]=e[e[r]]}return e}([function(e,r,t){e.exports=t(1)},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.WebSheetContext=r.parseExpression=r.HeadlessWebSheet=r.getCellPos=r.getCellid=r.Emitter=void 0;var i=t(2),u=t(45),o=n(u);r=e.exports=o.default,r.default=o.default,r.Emitter=i.Emitter,r.getCellid=i.getCellid,r.getCellPos=i.getCellPos,r.HeadlessWebSheet=i.WebSheet,r.parseExpression=i.parseExpression,r.WebSheetContext=i.WebSheetContext},[49,3],function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.WebSheetContext=r.parseExpression=r.getCellPos=r.getCellID=r.Emitter=void 0;var i=t(4),u=n(i),o=t(5),a=t(6),s=n(a),l=t(42),f=n(l),c=t(44),p=n(c);r.default=f.default,r.Emitter=u.default,r.getCellID=o.getCellID,r.getCellPos=o.getCellPos,r.parseExpression=s.default,r.WebSheetContext=p.default},function(e,r){"use strict";function t(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)}function n(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),u=function(){function e(){n(this,e),this.listeners={},this.allListeners=[]}return i(e,[{key:"fire",value:function(e){var r;for(r=0;r<this.allListeners.length;r++){var n;(n=this.allListeners)[r].apply(n,arguments)}if(e in this.listeners){var i=Array.prototype.slice.call(arguments,1);for(r=0;r<this.listeners[e].length;r++){var u;(u=this.listeners[e])[r].apply(u,t(i))}}}},{key:"on",value:function(e,r){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(r)}},{key:"onAll",value:function(e){this.allListeners.push(e)}},{key:"off",value:function(e,r){if(e in this.listeners){var t=this.listeners[e].indexOf(r);t!==-1&&this.listeners[e].splice(t,1)}}},{key:"offAll",value:function(e){var r=this.allListeners.indexOf(e);r!==-1&&this.allListeners[name].splice(r,1)}}]),e}();r.default=u},function(e,r){"use strict";function t(e,r){var t="";e+=1;do{var n=r%26;r-=n,r/=26,t=String.fromCharCode(n+65)+t}while(r);return t+e}function n(e){if(e=e.toUpperCase(),e in u)return u[e];for(var r=/^([a-z]+)([0-9]+)$/i.exec(e),t=r[1],n=0;t;){var o=t.charCodeAt(0)-65;n*=26,n+=o,t=t.substr(1)}var a=new i(n,r[2]-1);return u[e]=a,a}function i(e,r){this.col=e,this.row=r}Object.defineProperty(r,"__esModule",{value:!0}),r.getCellID=t,r.getCellPos=n;var u={}},[49,7],function(e,r,t){"use strict";function n(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function i(e){return e&&e.__esModule?e:{default:e}}function u(e){function r(){var t=e.substr(G);if(!t)return"EOF";var n=void 0,i=void 0;if(n=S.exec(t))return G+=n[0].length,r();if(n=c.exec(t))i=new a.default("boolean",n[0].toLowerCase());else if(n=p.exec(t))i=new a.default("string",JSON.parse(n[0]));else if(n=m.exec(t))i=new a.default("number",n[0]);else if(n=b.exec(t))i=new a.default("funcopen",n[1]);else if(n=E.exec(t))i=new a.default("sheetref",n[1]);else if(n=h.exec(t))i=new a.default("ident",n[0].toUpperCase());else if(n=N.exec(t))i=new a.default("rparen",")");else if(n=w.exec(t))i=new a.default("lparen","(");else if(n=d.exec(t))i=new a.default("binop_expon",n[0]);else if(n=v.exec(t))i=new a.default("binop_times",n[0]);else if(n=g.exec(t))i=new a.default("binop_add",n[0]);else if(n=y.exec(t))i=new a.default("binop_comp",n[0]);else if(n=x.exec(t))i=new a.default("comma",",");else if(n=I.exec(t))i=new a.default("percent","%");else if(n=A.exec(t))i=new a.default("cbopen","{");else if(n=O.exec(t))i=new a.default("cbclose","}");else if(n=_.exec(t))i=new a.default("semi",";");else{if(!(n=M.exec(t)))throw new SyntaxError("Unknown token: "+t);i=new a.default("colon",":")}return n&&(G+=n[0].length),i}function t(){return X=X||r()}function n(){var e=X||r();return X=null,e}function i(e){var r=t();return r&&r.type===e?n():null}function u(e){var r=n();if(r.type!==e)throw new SyntaxError("Expected "+e+", got "+r.type);return r}function o(){var e=void 0,r=t();if(r&&"-"===r.value?(r=!0,n()):r=!1,e=i("boolean"))return new l.LiteralBoolean("true"===e.value);if(e=i("number")){var u=e.value,o=parseFloat(e.value);return i("percent")&&(u+="%",o/=100),new l.LiteralNumber(o,u)}if(e=i("string"))return new l.LiteralString(e.value);if(e=i("ident"))return s(e);if(e=i("cbopen"))return f();throw new SyntaxError("Unrecognized primitive value: "+t())}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e||(e=u("ident"));var r=h.exec(e.value);return new l.Identifier(r[2]+r[4],"$"===r[3],"$"===r[1],e.value)}function f(){var e=[[]];do e[e.length-1].push(q()),i("comma")||i("semi")&&e.push([]);while(!i("cbclose"));var r=e[0].length;if(!e.every(function(e){return e.length===r}))throw new SyntaxError("Array has invalid size");return new l.ArrayConstant(e)}function P(){var e=o();if(!(e&&e instanceof l.Identifier))return e;if(i("colon")){var r=u("ident");return new l.Range(e,s(r))}return e}function D(){var e=i("binop_add");if(!e)return j();if("-"===e.value)return new l.UnaryMinus(j());if("+"===e.value)return new l.UnaryPlus(j());throw new Error('Unrecognized unary operator "'+e.value+'"')}function j(){if(!i("lparen"))return k();var e=q();return u("rparen"),e}function k(){var e=i("funcopen");if(!e)return L();for(var r=[];t()&&!i("rparen");)r.length&&u("comma"),r.push(q());return new l.Function(e.value,r)}function L(){var e=i("sheetref");return e?new l.SheetLookup(e.value,P()):P()}function U(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D(),r=i("binop_expon");return r?U(new l.BinopExpon(e,D())):e}function V(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:U(),r=i("binop_times");if(!r)return e;switch(r.value){case"*":return V(new l.BinopMult(e,U()));case"/":return V(new l.BinopDiv(e,U()))}throw new SyntaxError('Unrecognized operator "'+r.value+'"')}function F(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V(),r=i("binop_add");if(!r)return e;switch(r.value){case"+":return F(new l.BinopAdd(e,V()));case"&":return F(new l.BinopConcat(e,V()));case"-":return F(new l.BinopSub(e,V()))}throw new SyntaxError('Unrecognized operator "'+r.value+'"')}function B(){var e=F(),r=i("binop_comp");if(!r)return e;switch(r.value){case"<":return new l.BinopCompLT(e,B());case"<=":return new l.BinopCompLTE(e,B());case">":return new l.BinopCompGT(e,B());case">=":return new l.BinopCompGTE(e,B());case"=":return new l.BinopCompEQ(e,B());case"<>":return new l.BinopCompNEQ(e,B())}throw new SyntaxError('Unrecognized operator "'+r.value+'"')}function q(){return B()}if(e in R)return R[e].clone();var G=0,X=void 0,Y=new l.Root(q());return e in C?(C[e]++,C[e]>=T&&(R[e]=Y)):C[e]=1,Y}Object.defineProperty(r,"__esModule",{value:!0}),r.getCellPos=r.getCellID=r.TOKEN_WS=r.TOKEN_SEMI=r.TOKEN_CB_CLOSE=r.TOKEN_CB_OPEN=r.TOKEN_PERCENT=r.TOKEN_COLON=r.TOKEN_COMMA=r.TOKEN_LPAREN=r.TOKEN_RPAREN=r.TOKEN_XSOPEN=r.TOKEN_FOPEN=r.TOKEN_BINOP_COMP=r.TOKEN_BINOP_ADD=r.TOKEN_BINOP_EXP=r.TOKEN_BINOP_TIMES=r.TOKEN_NUM=r.TOKEN_CELL_ID=r.TOKEN_STRING=r.TOKEN_BOOL=void 0,r.default=u;var o=t(8),a=i(o),s=t(9),l=n(s),f=t(20),c=r.TOKEN_BOOL=/^(true|false)/i,p=r.TOKEN_STRING=/^"([^\\]|\\.)*"/i,h=r.TOKEN_CELL_ID=/^(\$?)(\w+)(\$?)(\d+)/i,m=r.TOKEN_NUM=/^((([1-9][0-9]*\.|0\.)[0-9]+)|([1-9][0-9]*)|0)/,v=r.TOKEN_BINOP_TIMES=/^(\/|\*)/,d=r.TOKEN_BINOP_EXP=/^(\^)/,g=r.TOKEN_BINOP_ADD=/^(\+|\-|&)/,y=r.TOKEN_BINOP_COMP=/^(<>|=|>=|<=|<|>)/,b=r.TOKEN_FOPEN=/^(\w+)\(/,E=r.TOKEN_XSOPEN=/^(\w+)!/,N=r.TOKEN_RPAREN=/^\)/,w=r.TOKEN_LPAREN=/^\(/,x=r.TOKEN_COMMA=/^,/,M=r.TOKEN_COLON=/^:/,I=r.TOKEN_PERCENT=/^%/,A=r.TOKEN_CB_OPEN=/^\{/,O=r.TOKEN_CB_CLOSE=/^\}/,_=r.TOKEN_SEMI=/^;/,S=r.TOKEN_WS=/^\s+/,T=10,C={},R={};r.getCellID=f.getCellID,r.getCellPos=f.getCellPos},function(e,r){"use strict";function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),i=function(){function e(r,n){t(this,e),this.type=r,this.value=n}return n(e,[{key:"toString",value:function(){return"[token "+this.value+"]"}}]),e}();r.default=i},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.UnaryPlus=r.UnaryMinus=r.SheetLookup=r.Root=r.Range=r.LiteralString=r.LiteralNumber=r.LiteralBoolean=r.Identifier=r.Function=r.BinopSub=r.BinopMult=r.BinopExpon=r.BinopDiv=r.BinopConcat=r.BinopCompNEQ=r.BinopCompLTE=r.BinopCompLT=r.BinopCompGTE=r.BinopCompGT=r.BinopCompEQ=r.BinopAdd=r.ArrayConstant=void 0;var i=t(10),u=n(i),o=t(12),a=n(o),s=t(21),l=n(s),f=t(22),c=n(f),p=t(23),h=n(p),m=t(24),v=n(m),d=t(25),g=n(d),y=t(26),b=n(y),E=t(27),N=n(E),w=t(28),x=n(w),M=t(29),I=n(M),A=t(30),O=n(A),_=t(31),S=n(_),T=t(32),C=n(T),R=t(33),P=n(R),D=t(34),j=n(D),k=t(35),L=n(k),U=t(36),V=n(U),F=t(37),B=n(F),q=t(38),G=n(q),X=t(39),Y=n(X),H=t(40),K=n(H),W=t(41),Q=n(W);r.ArrayConstant=u.default,r.BinopAdd=a.default,r.BinopCompEQ=l.default,r.BinopCompGT=c.default,r.BinopCompGTE=h.default,r.BinopCompLT=v.default,r.BinopCompLTE=g.default,r.BinopCompNEQ=b.default,r.BinopConcat=N.default,r.BinopDiv=x.default,r.BinopExpon=I.default,r.BinopMult=O.default,r.BinopSub=S.default,r.Function=C.default,r.Identifier=P.default,r.LiteralBoolean=j.default,r.LiteralNumber=L.default,r.LiteralString=V.default,r.Range=B.default,r.Root=G.default,r.SheetLookup=Y.default,r.UnaryMinus=K.default,r.UnaryPlus=Q.default},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=function(e){function r(e){i(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.body=e,t}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.body.map(function(e){return e.map(function(e){return e.clone()})}))}},{key:"shallowWalk",value:function(e){for(var r=0;r<this.body.length;r++)for(var t=0;t<this.body[r].length;t++)e(this.body[r][t])}},{key:"run",value:function(e){return this.body.map(function(r){return r.map(function(r){return r.run(e)})})}},{key:"toString",value:function(){return"{"+this.body.map(function(e){return e.map(function(e){return e.toString()}).join(",")}).join(";")+"}"}}]),r}(l.default);r.default=f},function(e,r){"use strict";function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),i=function(){function e(){t(this,e)}return n(e,[{key:"adjust",value:function(e,r){this.shallowWalk(function(t){t.adjust(e,r)})}},{key:"findCellDependencies",value:function(e){this.shallowWalk(function(r){return r.findCellDependencies(e)})}},{key:"findSheetDependencies",value:function(e){this.shallowWalk(function(r){return r.findSheetDependencies(e)})}},{key:"clone",value:function(){throw new Error("Not Implemented")}},{key:"shallowWalk",value:function(){}},{key:"walk",value:function(e){e(this),this.shallowWalk(function(r){return r.walk(e)})}},{key:"run",value:function(){throw new Error("Not Implemented")}},{key:"toString",value:function(){throw new Error("Not Implemented")}}]),e}();r.default=i},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(13),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"runNumericOperation",value:function(e,r){return e+r}},{key:"toString",value:function(){return"("+this.left+" + "+this.right+")"}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(){return i(this,r),u(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return o(r,e),a(r,[{key:"run",value:function(e){var r=this,t=this.left.run(e),n=this.right.run(e),i=function e(t,n){var i=Array.isArray(t),u=Array.isArray(n);if(i&&u){for(var o=[],a=Math.max(t.length,n.length),s=0;s<a;s++)o.push(e(t[s],n[s]));return o}var l=(0,f.parseNumAlways)(t),c=(0,f.parseNumAlways)(n);return i?t.map(function(r){return e(r,c)}):u?n.map(function(r){return e(l,r)}):r.runNumericOperation(l,c)};return i(t,n)}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function i(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)}function u(e,r){if("OFFSET"===e)return c.OFFSET.apply(c,i(r));if(!(e in c))throw new Error("#NAME?");var t=o(r);return c[e].apply(c,i(t))}function o(e){return e instanceof f.CellReference?o(e.run()):Array.isArray(e)?e.map(function(e){return e instanceof f.CellReference?o(e.run()):Array.isArray(e)?o(e):e}):e}function a(e){if(e===!0)return 1;if(e===!1)return 0;if(e instanceof f.CellReference)return a(e.run());if(Array.isArray(e))return a(e[0]);var r=parseFloat(e);return isNaN(r)?e?1:0:r}Object.defineProperty(r,"__esModule",{value:!0}),r.default=u,r.flattenCellReferences=o,r.parseNumAlways=a;var s=t(15),l=n(s),f=t(19),c={AND:function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.every(a)},ISBLANK:function(e){return""===e||null===e},NOT:function(e){return!a(e)},OR:function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.some(a)},PI:function(){return Math.PI},OFFSET:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(!(e instanceof f.CellReference))throw new Error("OFFSET() called with a non-cell reference");return e.adjust(r,t,n,i)}};for(var p in l)"function"==typeof l[p]&&(p in c||(c[p.toUpperCase()]=l[p]))},function(module,exports,__webpack_require__){!function(e,r){module.exports=r(__webpack_require__(16),__webpack_require__(17),__webpack_require__(18))}(this,function(__WEBPACK_EXTERNAL_MODULE_3__,__WEBPACK_EXTERNAL_MODULE_8__,__WEBPACK_EXTERNAL_MODULE_9__){return function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){var n=[t(1),t(15),t(12),t(16),t(2),t(7),t(14),t(17),t(11),t(18),t(6),t(10)];for(var i in n){var u=n[i];for(var o in u)r[o]=r[o]||u[o]}},function(e,r,t){function n(e,r){if(r)for(var t in r)e[t]=r[t];return e}var i=t(2),u=t(6),o=t(12),a=t(14);r.BETADIST=u.BETA.DIST,r.BETAINV=u.BETA.INV,r.BINOMDIST=u.BINOM.DIST,r.CEILING=r.ISOCEILING=n(i.CEILING.MATH,i.CEILING),r.CEILINGMATH=i.CEILING.MATH,r.CEILINGPRECISE=i.CEILING.PRECISE,r.CHIDIST=u.CHISQ.DIST,r.CHIDISTRT=u.CHISQ.DIST.RT,r.CHIINV=u.CHISQ.INV,r.CHIINVRT=u.CHISQ.INV.RT,r.CHITEST=u.CHISQ.TEST,r.CONFIDENCE=n(u.CONFIDENCE.NORM,u.CONFIDENCE),r.COVAR=u.COVARIANCE.P,r.COVARIANCEP=u.COVARIANCE.P,r.COVARIANCES=u.COVARIANCE.S,r.CRITBINOM=u.BINOM.INV,r.EXPONDIST=u.EXPON.DIST,r.ERFCPRECISE=o.ERFC.PRECISE,r.ERFPRECISE=o.ERF.PRECISE,r.FDIST=u.F.DIST,r.FDISTRT=u.F.DIST.RT,r.FINVRT=u.F.INV.RT,r.FINV=u.F.INV,r.FLOOR=n(i.FLOOR.MATH,i.FLOOR),r.FLOORMATH=i.FLOOR.MATH,r.FLOORPRECISE=i.FLOOR.PRECISE,r.FTEST=u.F.TEST,r.GAMMADIST=u.GAMMA.DIST,r.GAMMAINV=u.GAMMA.INV,r.GAMMALNPRECISE=u.GAMMALN.PRECISE,r.HYPGEOMDIST=u.HYPGEOM.DIST,r.LOGINV=u.LOGNORM.INV,r.LOGNORMINV=u.LOGNORM.INV,r.LOGNORMDIST=u.LOGNORM.DIST,r.MODE=n(u.MODE.SNGL,u.MODE),r.MODEMULT=u.MODE.MULT,r.MODESNGL=u.MODE.SNGL,r.NEGBINOMDIST=u.NEGBINOM.DIST,r.NETWORKDAYSINTL=a.NETWORKDAYS.INTL,r.NORMDIST=u.NORM.DIST,r.NORMINV=u.NORM.INV,r.NORMSDIST=u.NORM.S.DIST,r.NORMSINV=u.NORM.S.INV,r.PERCENTILE=n(u.PERCENTILE.EXC,u.PERCENTILE),r.PERCENTILEEXC=u.PERCENTILE.EXC,r.PERCENTILEINC=u.PERCENTILE.INC,r.PERCENTRANK=n(u.PERCENTRANK.INC,u.PERCENTRANK),r.PERCENTRANKEXC=u.PERCENTRANK.EXC,r.PERCENTRANKINC=u.PERCENTRANK.INC,r.POISSON=n(u.POISSON.DIST,u.POISSON),r.POISSONDIST=u.POISSON.DIST,r.QUARTILE=n(u.QUARTILE.INC,u.QUARTILE),r.QUARTILEEXC=u.QUARTILE.EXC,r.QUARTILEINC=u.QUARTILE.INC,r.RANK=n(u.RANK.EQ,u.RANK),r.RANKAVG=u.RANK.AVG,r.RANKEQ=u.RANK.EQ,r.SKEWP=u.SKEW.P,r.STDEV=n(u.STDEV.S,u.STDEV),r.STDEVP=u.STDEV.P,r.STDEVS=u.STDEV.S,r.TDIST=u.T.DIST,r.TDISTRT=u.T.DIST.RT,r.TINV=u.T.INV,r.TTEST=u.T.TEST,r.VAR=n(u.VAR.S,u.VAR),r.VARP=u.VAR.P,r.VARS=u.VAR.S,r.WEIBULL=n(u.WEIBULL.DIST,u.WEIBULL),r.WEIBULLDIST=u.WEIBULL.DIST,r.WORKDAYINTL=a.WORKDAY.INTL,r.ZTEST=u.Z.TEST},function(module,exports,__webpack_require__){var numeric=__webpack_require__(3),utils=__webpack_require__(4),error=__webpack_require__(5),statistical=__webpack_require__(6),information=__webpack_require__(11);exports.ABS=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.abs(utils.parseNumber(e))},exports.ACOS=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.acos(e)},exports.ACOSH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.log(e+Math.sqrt(e*e-1))},exports.ACOT=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.atan(1/e)},exports.ACOTH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:.5*Math.log((e+1)/(e-1))},exports.AGGREGATE=function(e,r,t,n){if(e=utils.parseNumber(e),r=utils.parseNumber(e),utils.anyIsError(e,r))return error.value;switch(e){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(e){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(e))return error.value;var r=0;return e.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(e){r+={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}[e]}),r},exports.ASIN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.asin(e)},exports.ASINH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.log(e+Math.sqrt(e*e+1))},exports.ATAN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.atan(e)},exports.ATAN2=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:Math.atan2(e,r)},exports.ATANH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.log((1+e)/(1-e))/2},exports.BASE=function(e,r,t){if(t=t||0,e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t))return error.value;t=void 0===t?0:t;var n=e.toString(r);return new Array(Math.max(t+1-n.length,0)).join("0")+n},exports.CEILING=function(e,r,t){if(r=void 0===r?1:Math.abs(r),t=t||0,e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t))return error.value;if(0===r)return 0;var n=-Math.floor(Math.log(r)/Math.log(10));return e>=0?exports.ROUND(Math.ceil(e/r)*r,n):0===t?-exports.ROUND(Math.floor(Math.abs(e)/r)*r,n):-exports.ROUND(Math.ceil(Math.abs(e)/r)*r,n)},exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:exports.FACT(e)/(exports.FACT(r)*exports.FACT(e-r))},exports.COMBINA=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:0===e&&0===r?1:exports.COMBIN(e+r-1,e-1)},exports.COS=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.cos(e)},exports.COSH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:(Math.exp(e)+Math.exp(-e))/2},exports.COT=function(e){return e=utils.parseNumber(e),e instanceof Error?e:1/Math.tan(e)},exports.COTH=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;var r=Math.exp(2*e);return(r+1)/(r-1)},exports.CSC=function(e){return e=utils.parseNumber(e),e instanceof Error?e:1/Math.sin(e)},exports.CSCH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:2/(Math.exp(e)-Math.exp(-e))},exports.DECIMAL=function(e,r){return arguments.length<1?error.value:parseInt(e,r)},exports.DEGREES=function(e){return e=utils.parseNumber(e),e instanceof Error?e:180*e/Math.PI},exports.EVEN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:exports.CEILING(e,-2,-1)},exports.EXP=Math.exp;var MEMOIZED_FACT=[];exports.FACT=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;var r=Math.floor(e);return 0===r||1===r?1:MEMOIZED_FACT[r]>0?MEMOIZED_FACT[r]:(MEMOIZED_FACT[r]=exports.FACT(r-1)*r,MEMOIZED_FACT[r])},exports.FACTDOUBLE=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;var r=Math.floor(e);return r<=0?1:r*exports.FACTDOUBLE(r-2)},exports.FLOOR=function(e,r){if(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;if(0===r)return 0;if(!(e>0&&r>0||e<0&&r<0))return error.num;r=Math.abs(r);var t=-Math.floor(Math.log(r)/Math.log(10));return e>=0?exports.ROUND(Math.floor(e/r)*r,t):-exports.ROUND(Math.ceil(Math.abs(e)/r),t)},exports.FLOOR.MATH=function(e,r,t){if(r=void 0===r?1:r,t=void 0===t?0:t,e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t))return error.value;if(0===r)return 0;r=r?Math.abs(r):1;var n=-Math.floor(Math.log(r)/Math.log(10));return e>=0?exports.ROUND(Math.floor(e/r)*r,n):0===t||void 0===t?-exports.ROUND(Math.ceil(Math.abs(e)/r)*r,n):-exports.ROUND(Math.floor(Math.abs(e)/r)*r,n)},exports.FLOOR.PRECISE=exports.FLOOR.MATH,exports.GCD=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=e.length,t=e[0],n=t<0?-t:t,i=1;i<r;i++){for(var u=e[i],o=u<0?-u:u;n&&o;)n>o?n%=o:o%=n;n+=o}return n},exports.INT=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.floor(e)},exports.ISO={CEILING:exports.CEILING},exports.LCM=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r,t,n,i,u=1;void 0!==(n=e.pop());)for(;n>1;){if(n%2){for(r=3,t=Math.floor(Math.sqrt(n));r<=t&&n%r;r+=2);i=r<=t?r:n}else i=2;for(n/=i,u*=i,r=e.length;r;e[--r]%i===0&&1===(e[r]/=i)&&e.splice(r,1));}return u},exports.LN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.log(e)},exports.LOG=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:(r=void 0===r?10:r,Math.log(e)/Math.log(r))},exports.LOG10=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.log(e)/Math.log(10)},exports.MDETERM=function(e){return e=utils.parseMatrix(e),e instanceof Error?e:numeric.det(e)},exports.MINVERSE=function(e){return e=utils.parseMatrix(e),e instanceof Error?e:numeric.inv(e)},exports.MMULT=function(e,r){return e=utils.parseMatrix(e),r=utils.parseMatrix(r),utils.anyIsError(e,r)?error.value:numeric.dot(e,r)},exports.MOD=function(e,r){if(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;if(0===r)return error.div0;var t=Math.abs(e%r);return r>0?t:-t},exports.MROUND=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:e*r<0?error.num:Math.round(e/r)*r},exports.MULTINOMIAL=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=0,t=1,n=0;n<e.length;n++)r+=e[n],t*=exports.FACT(e[n]);return exports.FACT(r)/t},exports.MUNIT=function(e){return e=utils.parseNumber(e),e instanceof Error?e:numeric.identity(e)},exports.ODD=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;var r=Math.ceil(Math.abs(e));return r=1&r?r:r+1,e>0?r:-r},exports.PI=function(){return Math.PI},exports.POWER=function(e,r){if(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;var t=Math.pow(e,r);return isNaN(t)?error.num:t},exports.PRODUCT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=1,t=0;t<e.length;t++)r*=e[t];return r},exports.QUOTIENT=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:parseInt(e/r,10)},exports.RADIANS=function(e){return e=utils.parseNumber(e),e instanceof Error?e:e*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:e+Math.ceil((r-e+1)*Math.random())-1},exports.ROMAN=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;for(var r=String(e).split(""),t=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],n="",i=3;i--;)n=(t[+r.pop()+10*i]||"")+n;return new Array(+r.join("")+1).join("M")+n},exports.ROUND=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:Math.round(e*Math.pow(10,r))/Math.pow(10,r)},exports.ROUNDDOWN=function(e,r){if(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;var t=e>0?1:-1;return t*Math.floor(Math.abs(e)*Math.pow(10,r))/Math.pow(10,r)},exports.ROUNDUP=function(e,r){if(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;var t=e>0?1:-1;return t*Math.ceil(Math.abs(e)*Math.pow(10,r))/Math.pow(10,r)},exports.SEC=function(e){return e=utils.parseNumber(e),e instanceof Error?e:1/Math.cos(e)},exports.SECH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:2/(Math.exp(e)+Math.exp(-e))},exports.SERIESSUM=function(e,r,t,n){if(e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),n=utils.parseNumberArray(n),utils.anyIsError(e,r,t,n))return error.value;for(var i=n[0]*Math.pow(e,r),u=1;u<n.length;u++)i+=n[u]*Math.pow(e,r+u*t);return i},exports.SIGN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:e<0?-1:0===e?0:1},exports.SIN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.sin(e)},exports.SINH=function(e){return e=utils.parseNumber(e),e instanceof Error?e:(Math.exp(e)-Math.exp(-e))/2},exports.SQRT=function(e){return e=utils.parseNumber(e),e instanceof Error?e:e<0?error.num:Math.sqrt(e)},exports.SQRTPI=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.sqrt(e*Math.PI)},exports.SUBTOTAL=function(e,r){if(e=utils.parseNumber(e),e instanceof Error)return e;switch(e){case 1:return statistical.AVERAGE(r);case 2:return statistical.COUNT(r);case 3:return statistical.COUNTA(r);case 4:return statistical.MAX(r);case 5:return statistical.MIN(r);case 6:return exports.PRODUCT(r);case 7:return statistical.STDEV.S(r);case 8:return statistical.STDEV.P(r);case 9:return exports.SUM(r);case 10:return statistical.VAR.S(r);case 11:return statistical.VAR.P(r);case 101:return statistical.AVERAGE(r);case 102:return statistical.COUNT(r);case 103:return statistical.COUNTA(r);case 104:return statistical.MAX(r);case 105:return statistical.MIN(r);case 106:return exports.PRODUCT(r);case 107:return statistical.STDEV.S(r);case 108:return statistical.STDEV.P(r);case 109:return exports.SUM(r);case 110:return statistical.VAR.S(r);case 111:return statistical.VAR.P(r)}},exports.ADD=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:e+r)},exports.MINUS=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:e-r);
},exports.DIVIDE=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:0===r?error.div0:e/r)},exports.MULTIPLY=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:e*r)},exports.GTE=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.error:e>=r)},exports.LT=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.error:e<r)},exports.LTE=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.error:e<=r)},exports.EQ=function(e,r){return 2!==arguments.length?error.na:e===r},exports.NE=function(e,r){return 2!==arguments.length?error.na:e!==r},exports.POW=function(e,r){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.error:exports.POWER(e,r))},exports.SUM=function(){for(var e=0,r=Object.keys(arguments),t=0;t<r.length;++t){var n=arguments[r[t]];if("number"==typeof n)e+=n;else if("string"==typeof n){var i=parseFloat(n);!isNaN(i)&&(e+=i)}else Array.isArray(n)&&(e+=exports.SUM.apply(null,n))}return e},exports.SUMIF=function(range,criteria){if(range=utils.parseNumberArray(utils.flatten(range)),range instanceof Error)return range;for(var result=0,i=0;i<range.length;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;i<n_range_elements;i++){for(var el=range[i],condition="",c=0;c<n_criterias;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 e,r,t,n,i=arguments.length+1,u=0,o=0;o<arguments[0].length;o++)if(arguments[0][o]instanceof Array)for(var a=0;a<arguments[0][o].length;a++){for(e=1,r=1;r<i;r++){if(n=utils.parseNumber(arguments[r-1][o][a]),n instanceof Error)return n;e*=n}u+=e}else{for(e=1,r=1;r<i;r++){if(t=utils.parseNumber(arguments[r-1][o]),t instanceof Error)return t;e*=t}u+=e}return u},exports.SUMSQ=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=0,t=e.length,n=0;n<t;n++)r+=information.ISNUMBER(e[n])?e[n]*e[n]:0;return r},exports.SUMX2MY2=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=0,n=0;n<e.length;n++)t+=e[n]*e[n]-r[n]*r[n];return t},exports.SUMX2PY2=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;var t=0;e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r));for(var n=0;n<e.length;n++)t+=e[n]*e[n]+r[n]*r[n];return t},exports.SUMXMY2=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;var t=0;e=utils.flatten(e),r=utils.flatten(r);for(var n=0;n<e.length;n++)t+=Math.pow(e[n]-r[n],2);return t},exports.TAN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.tan(e)},exports.TANH=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;var r=Math.exp(2*e);return(r-1)/(r+1)},exports.TRUNC=function(e,r){if(r=void 0===r?0:r,e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;var t=e>0?1:-1;return t*Math.floor(Math.abs(e)*Math.pow(10,r))/Math.pow(10,r)}},function(e,r){e.exports=__WEBPACK_EXTERNAL_MODULE_3__},function(e,r,t){function n(e){return e&&e.reduce?e.reduce(function(e,r){var t=Array.isArray(e),n=Array.isArray(r);return t&&n?e.concat(r):t?(e.push(r),e):n?[e].concat(r):[e,r]}):e}function i(e){if(!e)return!1;for(var r=0;r<e.length;++r)if(Array.isArray(e[r]))return!1;return!0}var u=t(5);r.flatten=function(){for(var e=r.argsToArray.apply(null,arguments);!i(e);)e=n(e);return e},r.argsToArray=function(e){return Array.prototype.slice.call(e,0)},r.numbers=function(){var e=this.flatten.apply(null,arguments);return e.filter(function(e){return"number"==typeof e})},r.cleanFloat=function(e){var r=1e14;return Math.round(e*r)/r},r.parseBool=function(e){if("boolean"==typeof e)return e;if(e instanceof Error)return e;if("number"==typeof e)return 0!==e;if("string"==typeof e){var r=e.toUpperCase();if("TRUE"===r)return!0;if("FALSE"===r)return!1}return e instanceof Date&&!isNaN(e)||u.value},r.parseNumber=function(e){return void 0===e||""===e?u.value:isNaN(e)?u.value:parseFloat(e)},r.parseNumberArray=function(e){var t;if(!e||0===(t=e.length))return u.value;for(var n;t--;){if(n=r.parseNumber(e[t]),n===u.value)return n;e[t]=n}return e},r.parseMatrix=function(e){var t;if(!e||0===(t=e.length))return u.value;for(var n,i=0;i<e.length;i++)if(n=r.parseNumberArray(e[i]),e[i]=n,n instanceof Error)return n;return e};var o=new Date(1900,0,1);r.parseDate=function(e){if(!isNaN(e)){if(e instanceof Date)return new Date(e);var r=parseInt(e,10);return r<0?u.num:r<=60?new Date(o.getTime()+864e5*(r-1)):new Date(o.getTime()+864e5*(r-2))}return"string"!=typeof e||(e=new Date(e),isNaN(e))?u.value:e},r.parseDateArray=function(e){for(var r,t=e.length;t--;){if(r=this.parseDate(e[t]),r===u.value)return r;e[t]=r}return e},r.anyIsError=function(){for(var e=arguments.length;e--;)if(arguments[e]instanceof Error)return!0;return!1},r.arrayValuesToNumbers=function(e){for(var r,t=e.length;t--;)if(r=e[t],"number"!=typeof r)if(r!==!0)if(r!==!1){if("string"==typeof r){var n=this.parseNumber(r);n instanceof Error?e[t]=0:e[t]=n}}else e[t]=0;else e[t]=1;return e},r.rest=function(e,r){return r=r||1,e&&"function"==typeof e.slice?e.slice(r):e},r.initial=function(e,r){return r=r||1,e&&"function"==typeof e.slice?e.slice(0,e.length-r):e}},function(e,r){r.nil=new Error("#NULL!"),r.div0=new Error("#DIV/0!"),r.value=new Error("#VALUE?"),r.ref=new Error("#REF!"),r.name=new Error("#NAME?"),r.num=new Error("#NUM!"),r.na=new Error("#N/A"),r.error=new Error("#ERROR!"),r.data=new Error("#GETTING_DATA")},function(module,exports,__webpack_require__){var mathTrig=__webpack_require__(2),text=__webpack_require__(7),jStat=__webpack_require__(9).jStat,utils=__webpack_require__(4),error=__webpack_require__(5),misc=__webpack_require__(10),SQRT2PI=2.5066282746310002;exports.AVEDEV=function(){var e=utils.parseNumberArray(utils.flatten(arguments));return e instanceof Error?e:jStat.sum(jStat(e).subtract(jStat.mean(e)).abs()[0])/e.length},exports.AVERAGE=function(){for(var e=utils.numbers(utils.flatten(arguments)),r=e.length,t=0,n=0,i=0;i<r;i++)t+=e[i],n+=1;return t/n},exports.AVERAGEA=function(){for(var e=utils.flatten(arguments),r=e.length,t=0,n=0,i=0;i<r;i++){var u=e[i];"number"==typeof u&&(t+=u),u===!0&&t++,null!==u&&n++}return t/n},exports.AVERAGEIF=function(range,criteria,average_range){if(average_range=average_range||range,range=utils.flatten(range),average_range=utils.parseNumberArray(utils.flatten(average_range)),average_range instanceof Error)return average_range;for(var average_count=0,result=0,i=0;i<range.length;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;i<range.length;i++){for(var condition="",j=0;j<criteria;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(e,r,t,n,i,u){return arguments.length<4?error.value:(i=void 0===i?0:i,u=void 0===u?1:u,e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),i=utils.parseNumber(i),u=utils.parseNumber(u),utils.anyIsError(e,r,t,i,u)?error.value:(e=(e-i)/(u-i),n?jStat.beta.cdf(e,r,t):jStat.beta.pdf(e,r,t)))},exports.BETA.INV=function(e,r,t,n,i){return n=void 0===n?0:n,i=void 0===i?1:i,e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),n=utils.parseNumber(n),i=utils.parseNumber(i),utils.anyIsError(e,r,t,n,i)?error.value:jStat.beta.inv(e,r,t)*(i-n)+n},exports.BINOM={},exports.BINOM.DIST=function(e,r,t,n){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(e,r,t,n)?error.value:n?jStat.binomial.cdf(e,r,t):jStat.binomial.pdf(e,r,t)},exports.BINOM.DIST.RANGE=function(e,r,t,n){if(n=void 0===n?t:n,e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(e,r,t,n))return error.value;for(var i=0,u=t;u<=n;u++)i+=mathTrig.COMBIN(e,u)*Math.pow(r,u)*Math.pow(1-r,e-u);return i},exports.BINOM.INV=function(e,r,t){if(e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t))return error.value;for(var n=0;n<=e;){if(jStat.binomial.cdf(n,e,r)>=t)return n;n++}},exports.CHISQ={},exports.CHISQ.DIST=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:t?jStat.chisquare.cdf(e,r):jStat.chisquare.pdf(e,r)},exports.CHISQ.DIST.RT=function(e,r){return!e|!r?error.na:e<1||r>Math.pow(10,10)?error.num:"number"!=typeof e||"number"!=typeof r?error.value:1-jStat.chisquare.cdf(e,r)},exports.CHISQ.INV=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:jStat.chisquare.inv(e,r)},exports.CHISQ.INV.RT=function(e,r){return!e|!r?error.na:e<0||e>1||r<1||r>Math.pow(10,10)?error.num:"number"!=typeof e||"number"!=typeof r?error.value:jStat.chisquare.inv(1-e,r)},exports.CHISQ.TEST=function(e,r){function t(e,r){var t=Math.exp(-.5*e);r%2===1&&(t*=Math.sqrt(2*e/f));for(var n=r;n>=2;)t=t*e/n,n-=2;for(var i=t,u=r;i>1e-10*t;)u+=2,i=i*e/u,t+=i;return 1-t}if(2!==arguments.length)return error.na;if(!(e instanceof Array&&r instanceof Array))return error.value;if(e.length!==r.length)return error.value;if(e[0]&&r[0]&&e[0].length!==r[0].length)return error.value;var n,i,u,o=e.length;for(i=0;i<o;i++)e[i]instanceof Array||(n=e[i],e[i]=[],e[i].push(n)),r[i]instanceof Array||(n=r[i],r[i]=[],r[i].push(n));var a=e[0].length,s=1===a?o-1:(o-1)*(a-1),l=0,f=Math.PI;for(i=0;i<o;i++)for(u=0;u<a;u++)l+=Math.pow(e[i][u]-r[i][u],2)/r[i][u];return Math.round(1e6*t(l,s))/1e6},exports.COLUMN=function(e,r){if(2!==arguments.length)return error.na;if(r<0)return error.num;if(!(e instanceof Array)||"number"!=typeof r)return error.value;if(0!==e.length)return jStat.col(e,r)},exports.COLUMNS=function(e){return 1!==arguments.length?error.na:e instanceof Array?0===e.length?0:jStat.cols(e):error.value},exports.CONFIDENCE={},exports.CONFIDENCE.NORM=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:jStat.normalci(1,e,r,t)[1]-1},exports.CONFIDENCE.T=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:jStat.tci(1,e,r,t)[1]-1},exports.CORREL=function(e,r){return e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r)?error.value:jStat.corrcoeff(e,r)},exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var e=utils.flatten(arguments);return e.length-exports.COUNTBLANK(e)},exports.COUNTIN=function(e,r){for(var t=0,n=0;n<e.length;n++)e[n]===r&&t++;return t},exports.COUNTBLANK=function(){for(var e,r=utils.flatten(arguments),t=0,n=0;n<r.length;n++)e=r[n],null!==e&&""!==e||t++;return t},exports.COUNTIF=function(range,criteria){range=utils.flatten(range),/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;i<range.length;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=new Array(utils.flatten(args[0]).length),i=0;i<results.length;i++)results[i]=!0;for(i=0;i<args.length;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;j<range.length;j++)"string"!=typeof range[j]?results[j]=results[j]&&eval(range[j]+criteria):results[j]=results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;i<results.length;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return misc.UNIQUE.apply(null,utils.flatten(arguments)).length},exports.COVARIANCE={},exports.COVARIANCE.P=function(e,r){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(e),n=jStat.mean(r),i=0,u=e.length,o=0;o<u;o++)i+=(e[o]-t)*(r[o]-n);return i/u},exports.COVARIANCE.S=function(e,r){return e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r)?error.value:jStat.covariance(e,r)},exports.DEVSQ=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=jStat.mean(e),t=0,n=0;n<e.length;n++)t+=Math.pow(e[n]-r,2);return t},exports.EXPON={},exports.EXPON.DIST=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:t?jStat.exponential.cdf(e,r):jStat.exponential.pdf(e,r)},exports.F={},exports.F.DIST=function(e,r,t,n){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:n?jStat.centralF.cdf(e,r,t):jStat.centralF.pdf(e,r,t)},exports.F.DIST.RT=function(e,r,t){return 3!==arguments.length?error.na:e<0||r<1||t<1?error.num:"number"!=typeof e||"number"!=typeof r||"number"!=typeof t?error.value:1-jStat.centralF.cdf(e,r,t)},exports.F.INV=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:e<=0||e>1?error.num:jStat.centralF.inv(e,r,t)},exports.F.INV.RT=function(e,r,t){return 3!==arguments.length?error.na:e<0||e>1||r<1||r>Math.pow(10,10)||t<1||t>Math.pow(10,10)?error.num:"number"!=typeof e||"number"!=typeof r||"number"!=typeof t?error.value:jStat.centralF.inv(1-e,r,t)},exports.F.TEST=function(e,r){if(!e||!r)return error.na;if(!(e instanceof Array&&r instanceof Array))return error.na;if(e.length<2||r.length<2)return error.div0;var t=function(e,r){for(var t=0,n=0;n<e.length;n++)t+=Math.pow(e[n]-r,2);return t},n=mathTrig.SUM(e)/e.length,i=mathTrig.SUM(r)/r.length,u=t(e,n)/(e.length-1),o=t(r,i)/(r.length-1);return u/o},exports.FISHER=function(e){return e=utils.parseNumber(e),e instanceof Error?e:Math.log((1+e)/(1-e))/2},exports.FISHERINV=function(e){if(e=utils.parseNumber(e),e instanceof Error)return e;var r=Math.exp(2*e);return(r-1)/(r+1)},exports.FORECAST=function(e,r,t){if(e=utils.parseNumber(e),r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,r,t))return error.value;for(var n=jStat.mean(t),i=jStat.mean(r),u=t.length,o=0,a=0,s=0;s<u;s++)o+=(t[s]-n)*(r[s]-i),a+=Math.pow(t[s]-n,2);var l=o/a,f=i-l*n;return f+l*e},exports.FREQUENCY=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=e.length,n=r.length,i=[],u=0;u<=n;u++){i[u]=0;for(var o=0;o<t;o++)0===u?e[o]<=r[0]&&(i[0]+=1):u<n?e[o]>r[u-1]&&e[o]<=r[u]&&(i[u]+=1):u===n&&e[o]>r[n-1]&&(i[n]+=1)}return i},exports.GAMMA=function(e){return e=utils.parseNumber(e),e instanceof Error?e:0===e?error.num:parseInt(e,10)===e&&e<0?error.num:jStat.gammafn(e)},exports.GAMMA.DIST=function(e,r,t,n){return 4!==arguments.length?error.na:e<0||r<=0||t<=0?error.value:"number"!=typeof e||"number"!=typeof r||"number"!=typeof t?error.value:n?jStat.gamma.cdf(e,r,t,!0):jStat.gamma.pdf(e,r,t,!1)},exports.GAMMA.INV=function(e,r,t){return 3!==arguments.length?error.na:e<0||e>1||r<=0||t<=0?error.num:"number"!=typeof e||"number"!=typeof r||"number"!=typeof t?error.value:jStat.gamma.inv(e,r,t)},exports.GAMMALN=function(e){return e=utils.parseNumber(e),e instanceof Error?e:jStat.gammaln(e)},exports.GAMMALN.PRECISE=function(e){return 1!==arguments.length?error.na:e<=0?error.num:"number"!=typeof e?error.value:jStat.gammaln(e)},exports.GAUSS=function(e){return e=utils.parseNumber(e),e instanceof Error?e:jStat.normal.cdf(e,0,1)-.5},exports.GEOMEAN=function(){var e=utils.parseNumberArray(utils.flatten(arguments));return e instanceof Error?e:jStat.geomean(e)},exports.GROWTH=function(e,r,t,n){if(e=utils.parseNumberArray(e),e instanceof Error)return e;var i;if(void 0===r)for(r=[],i=1;i<=e.length;i++)r.push(i);if(void 0===t)for(t=[],i=1;i<=e.length;i++)t.push(i);if(r=utils.parseNumberArray(r),t=utils.parseNumberArray(t),utils.anyIsError(r,t))return error.value;void 0===n&&(n=!0);var u=e.length,o=0,a=0,s=0,l=0;for(i=0;i<u;i++){var f=r[i],c=Math.log(e[i]);o+=f,a+=c,s+=f*c,l+=f*f}o/=u,a/=u,s/=u,l/=u;var p,h;n?(p=(s-o*a)/(l-o*o),h=a-p*o):(p=s/l,h=0);var m=[];for(i=0;i<t.length;i++)m.push(Math.exp(h+p*t[i]));return m},exports.HARMEAN=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=e.length,t=0,n=0;n<r;n++)t+=1/e[n];return r/t},exports.HYPGEOM={},exports.HYPGEOM.DIST=function(e,r,t,n,i){function u(e,r,t,n){return mathTrig.COMBIN(t,e)*mathTrig.COMBIN(n-t,r-e)/mathTrig.COMBIN(n,r)}function o(e,r,t,n){for(var i=0,o=0;o<=e;o++)i+=u(o,r,t,n);return i}return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(e,r,t,n)?error.value:i?o(e,r,t,n):u(e,r,t,n)},exports.INTERCEPT=function(e,r){return e=utils.parseNumberArray(e),r=utils.parseNumberArray(r),utils.anyIsError(e,r)?error.value:e.length!==r.length?error.na:exports.FORECAST(0,e,r)},exports.KURT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=jStat.mean(e),t=e.length,n=0,i=0;i<t;i++)n+=Math.pow(e[i]-r,4);return n/=Math.pow(jStat.stdev(e,!0),4),t*(t+1)/((t-1)*(t-2)*(t-3))*n-3*(t-1)*(t-1)/((t-2)*(t-3))},exports.LARGE=function(e,r){return e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r)?e:e.sort(function(e,r){return r-e})[r-1]},exports.LINEST=function(e,r){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(e),n=jStat.mean(r),i=r.length,u=0,o=0,a=0;a<i;a++)u+=(r[a]-n)*(e[a]-t),o+=Math.pow(r[a]-n,2);var s=u/o,l=t-s*n;return[s,l]},exports.LOGEST=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=0;t<e.length;t++)e[t]=Math.log(e[t]);var n=exports.LINEST(e,r);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(e,r,t,n){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:n?jStat.lognormal.cdf(e,r,t):jStat.lognormal.pdf(e,r,t)},exports.LOGNORM.INV=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:jStat.lognormal.inv(e,r,t)},exports.MAX=function(){var e=utils.numbers(utils.flatten(arguments));return 0===e.length?0:Math.max.apply(Math,e)},exports.MAXA=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===e.length?0:Math.max.apply(Math,e)},exports.MEDIAN=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return jStat.median(e)},exports.MIN=function(){var e=utils.numbers(utils.flatten(arguments));return 0===e.length?0:Math.min.apply(Math,e)},exports.MINA=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===e.length?0:Math.min.apply(Math,e)},exports.MODE={},exports.MODE.MULT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r,t=e.length,n={},i=[],u=0,o=0;o<t;o++)r=e[o],n[r]=n[r]?n[r]+1:1,n[r]>u&&(u=n[r],i=[]),n[r]===u&&(i[i.length]=r);return i},exports.MODE.SNGL=function(){var e=utils.parseNumberArray(utils.flatten(arguments));return e instanceof Error?e:exports.MODE.MULT(e).sort(function(e,r){return e-r})[0]},exports.NEGBINOM={},exports.NEGBINOM.DIST=function(e,r,t,n){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:n?jStat.negbin.cdf(e,r,t):jStat.negbin.pdf(e,r,t)},exports.NORM={},exports.NORM.DIST=function(e,r,t,n){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:t<=0?error.num:n?jStat.normal.cdf(e,r,t):jStat.normal.pdf(e,r,t)},exports.NORM.INV=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:jStat.normal.inv(e,r,t)},exports.NORM.S={},exports.NORM.S.DIST=function(e,r){return e=utils.parseNumber(e),e instanceof Error?error.value:r?jStat.normal.cdf(e,0,1):jStat.normal.pdf(e,0,1)},exports.NORM.S.INV=function(e){return e=utils.parseNumber(e),e instanceof Error?error.value:jStat.normal.inv(e,0,1)},exports.PEARSON=function(e,r){if(r=utils.parseNumberArray(utils.flatten(r)),e=utils.parseNumberArray(utils.flatten(e)),utils.anyIsError(r,e))return error.value;for(var t=jStat.mean(e),n=jStat.mean(r),i=e.length,u=0,o=0,a=0,s=0;s<i;s++)u+=(e[s]-t)*(r[s]-n),o+=Math.pow(e[s]-t,2),a+=Math.pow(r[s]-n,2);return u/Math.sqrt(o*a)},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;e=e.sort(function(e,r){return e-r});var t=e.length;if(r<1/(t+1)||r>1-1/(t+1))return error.num;var n=r*(t+1)-1,i=Math.floor(n);return utils.cleanFloat(n===i?e[n]:e[i]+(n-i)*(e[i+1]-e[i]))},exports.PERCENTILE.INC=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;e=e.sort(function(e,r){return e-r});var t=e.length,n=r*(t-1),i=Math.floor(n);return utils.cleanFloat(n===i?e[n]:e[i]+(n-i)*(e[i+1]-e[i]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(e,r,t){if(t=void 0===t?3:t,e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t))return error.value;e=e.sort(function(e,r){return e-r});for(var n=misc.UNIQUE.apply(null,e),i=e.length,u=n.length,o=Math.pow(10,t),a=0,s=!1,l=0;!s&&l<u;)r===n[l]?(a=(e.indexOf(n[l])+1)/(i+1),s=!0):r>=n[l]&&(r<n[l+1]||l===u-1)&&(a=(e.indexOf(n[l])+1+(r-n[l])/(n[l+1]-n[l]))/(i+1),s=!0),l++;return Math.floor(a*o)/o},exports.PERCENTRANK.INC=function(e,r,t){if(t=void 0===t?3:t,e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t))return error.value;e=e.sort(function(e,r){return e-r});for(var n=misc.UNIQUE.apply(null,e),i=e.length,u=n.length,o=Math.pow(10,t),a=0,s=!1,l=0;!s&&l<u;)r===n[l]?(a=e.indexOf(n[l])/(i-1),s=!0):r>=n[l]&&(r<n[l+1]||l===u-1)&&(a=(e.indexOf(n[l])+(r-n[l])/(n[l+1]-n[l]))/(i-1),s=!0),l++;return Math.floor(a*o)/o},exports.PERMUT=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:mathTrig.FACT(e)/mathTrig.FACT(e-r)},exports.PERMUTATIONA=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:Math.pow(e,r)},exports.PHI=function(e){return e=utils.parseNumber(e),e instanceof Error?error.value:Math.exp(-.5*e*e)/SQRT2PI},exports.POISSON={},exports.POISSON.DIST=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:t?jStat.poisson.cdf(e,r):jStat.poisson.pdf(e,r)},exports.PROB=function(e,r,t,n){if(void 0===t)return 0;if(n=void 0===n?t:n,e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumber(t),n=utils.parseNumber(n),utils.anyIsError(e,r,t,n))return error.value;if(t===n)return e.indexOf(t)>=0?r[e.indexOf(t)]:0;for(var i=e.sort(function(e,r){return e-r}),u=i.length,o=0,a=0;a<u;a++)i[a]>=t&&i[a]<=n&&(o+=r[e.indexOf(i[a])]);return o},exports.QUARTILE={},exports.QUARTILE.EXC=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;switch(r){case 1:return exports.PERCENTILE.EXC(e,.25);case 2:return exports.PERCENTILE.EXC(e,.5);case 3:return exports.PERCENTILE.EXC(e,.75);default:return error.num}},exports.QUARTILE.INC=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;switch(r){case 1:return exports.PERCENTILE.INC(e,.25);case 2:return exports.PERCENTILE.INC(e,.5);case 3:return exports.PERCENTILE.INC(e,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(e,r,t){if(e=utils.parseNumber(e),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;r=utils.flatten(r),t=t||!1;var n=t?function(e,r){return e-r}:function(e,r){return r-e};r=r.sort(n);for(var i=r.length,u=0,o=0;o<i;o++)r[o]===e&&u++;return u>1?(2*r.indexOf(e)+u+1)/2:r.indexOf(e)+1},exports.RANK.EQ=function(e,r,t){if(e=utils.parseNumber(e),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;t=t||!1;var n=t?function(e,r){return e-r}:function(e,r){return r-e};return r=r.sort(n),r.indexOf(e)+1},exports.ROW=function(e,r){if(2!==arguments.length)return error.na;if(r<0)return error.num;if(!(e instanceof Array)||"number"!=typeof r)return error.value;if(0!==e.length)return jStat.row(e,r)},exports.ROWS=function(e){return 1!==arguments.length?error.na:e instanceof Array?0===e.length?0:jStat.rows(e):error.value},exports.RSQ=function(e,r){return e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r)?error.value:Math.pow(exports.PEARSON(e,r),2)},exports.SKEW=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=jStat.mean(e),t=e.length,n=0,i=0;i<t;i++)n+=Math.pow(e[i]-r,3);return t*n/((t-1)*(t-2)*Math.pow(jStat.stdev(e,!0),3))},exports.SKEW.P=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var r=jStat.mean(e),t=e.length,n=0,i=0,u=0;u<t;u++)i+=Math.pow(e[u]-r,3),n+=Math.pow(e[u]-r,2);return i/=t,n/=t,i/Math.pow(n,1.5)},exports.SLOPE=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=r.length,u=0,o=0,a=0;a<i;a++)u+=(r[a]-t)*(e[a]-n),o+=Math.pow(r[a]-t,2);return u/o},exports.SMALL=function(e,r){return e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r)?e:e.sort(function(e,r){return e-r})[r-1]},exports.STANDARDIZE=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:(e-r)/t},exports.STDEV={},exports.STDEV.P=function(){var e=exports.VAR.P.apply(this,arguments);return Math.sqrt(e)},exports.STDEV.S=function(){var e=exports.VAR.S.apply(this,arguments);return Math.sqrt(e)},exports.STDEVA=function(){var e=exports.VARA.apply(this,arguments);return Math.sqrt(e)},exports.STDEVPA=function(){var e=exports.VARPA.apply(this,arguments);return Math.sqrt(e)},exports.STEYX=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;for(var t=jStat.mean(r),n=jStat.mean(e),i=r.length,u=0,o=0,a=0,s=0;s<i;s++)u+=Math.pow(e[s]-n,2),o+=(r[s]-t)*(e[s]-n),a+=Math.pow(r[s]-t,2);return Math.sqrt((u-o*o/a)/(i-2))},exports.TRANSPOSE=function(e){return e?jStat.transpose(e):error.na},exports.T=text.T,exports.T.DIST=function(e,r,t){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:t?jStat.studentt.cdf(e,r):jStat.studentt.pdf(e,r)},exports.T.DIST["2T"]=function(e,r){return 2!==arguments.length?error.na:e<0||r<1?error.num:"number"!=typeof e||"number"!=typeof r?error.value:2*(1-jStat.studentt.cdf(e,r))},exports.T.DIST.RT=function(e,r){return 2!==arguments.length?error.na:e<0||r<1?error.num:"number"!=typeof e||"number"!=typeof r?error.value:1-jStat.studentt.cdf(e,r)},exports.T.INV=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),utils.anyIsError(e,r)?error.value:jStat.studentt.inv(e,r)},exports.T.INV["2T"]=function(e,r){return e=utils.parseNumber(e),r=utils.parseNumber(r),e<=0||e>1||r<1?error.num:utils.anyIsError(e,r)?error.value:Math.abs(jStat.studentt.inv(e/2,r))},exports.T.TEST=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),utils.anyIsError(e,r))return error.value;var t,n=jStat.mean(e),i=jStat.mean(r),u=0,o=0;for(t=0;t<e.length;t++)u+=Math.pow(e[t]-n,2);for(t=0;t<r.length;t++)o+=Math.pow(r[t]-i,2);u/=e.length-1,o/=r.length-1;var a=Math.abs(n-i)/Math.sqrt(u/e.length+o/r.length);return exports.T.DIST["2T"](a,e.length+r.length-2)},exports.TREND=function(e,r,t){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumberArray(utils.flatten(r)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,r,t))return error.value;var n=exports.LINEST(e,r),i=n[0],u=n[1],o=[];return t.forEach(function(e){o.push(i*e+u)}),o},exports.TRIMMEAN=function(e,r){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;var t=mathTrig.FLOOR(e.length*r,2)/2;return jStat.mean(utils.initial(utils.rest(e.sort(function(e,r){return e-r}),t),t))},exports.VAR={},exports.VAR.P=function(){for(var e=utils.numbers(utils.flatten(arguments)),r=e.length,t=0,n=exports.AVERAGE(e),i=0;i<r;i++)t+=Math.pow(e[i]-n,2);return t/r},exports.VAR.S=function(){for(var e=utils.numbers(utils.flatten(arguments)),r=e.length,t=0,n=exports.AVERAGE(e),i=0;i<r;i++)t+=Math.pow(e[i]-n,2);return t/(r-1)},exports.VARA=function(){for(var e=utils.flatten(arguments),r=e.length,t=0,n=0,i=exports.AVERAGEA(e),u=0;u<r;u++){var o=e[u];t+="number"==typeof o?Math.pow(o-i,2):o===!0?Math.pow(1-i,2):Math.pow(0-i,2),null!==o&&n++}return t/(n-1)},exports.VARPA=function(){for(var e=utils.flatten(arguments),r=e.length,t=0,n=0,i=exports.AVERAGEA(e),u=0;u<r;u++){var o=e[u];t+="number"==typeof o?Math.pow(o-i,2):o===!0?Math.pow(1-i,2):Math.pow(0-i,2),null!==o&&n++}return t/n},exports.WEIBULL={},exports.WEIBULL.DIST=function(e,r,t,n){return e=utils.parseNumber(e),r=utils.parseNumber(r),t=utils.parseNumber(t),utils.anyIsError(e,r,t)?error.value:n?1-Math.exp(-Math.pow(e/t,r)):Math.pow(e,r-1)*Math.exp(-Math.pow(e/t,r))*r/Math.pow(t,r)},exports.Z={},exports.Z.TEST=function(e,r,t){if(e=utils.parseNumberArray(utils.flatten(e)),r=utils.parseNumber(r),utils.anyIsError(e,r))return error.value;t=t||exports.STDEV.S(e);var n=e.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(e)-r)/(t/Math.sqrt(n)),!0)}},function(e,r,t){var n=t(4),i=t(5),u=t(8);r.ASC=function(){throw new Error("ASC is not implemented")},r.BAHTTEXT=function(){throw new Error("BAHTTEXT is not implemented")},r.CHAR=function(e){return e=n.parseNumber(e),e instanceof Error?e:String.fromCharCode(e)},r.CLEAN=function(e){e=e||"";var r=/[\0-\x1F]/g;return e.replace(r,"")},r.CODE=function(e){return e=e||"",e.charCodeAt(0)},r.CONCATENATE=function(){for(var e=n.flatten(arguments),r=0;(r=e.indexOf(!0))>-1;)e[r]="TRUE";for(var t=0;(t=e.indexOf(!1))>-1;)e[t]="FALSE";return e.join("")},r.DBCS=function(){throw new Error("DBCS is not implemented")},r.DOLLAR=function(e,r){if(r=void 0===r?2:r,e=n.parseNumber(e),r=n.parseNumber(r),n.anyIsError(e,r))return i.value;
var t="";return r<=0?(e=Math.round(e*Math.pow(10,r))/Math.pow(10,r),t="($0,0)"):r>0&&(t="($0,0."+new Array(r+1).join("0")+")"),u(e).format(t)},r.EXACT=function(e,r){return e===r},r.FIND=function(e,r,t){return t=void 0===t?0:t,r?r.indexOf(e,t-1)+1:null},r.FIXED=function(e,r,t){if(r=void 0===r?2:r,t=void 0!==t&&t,e=n.parseNumber(e),r=n.parseNumber(r),n.anyIsError(e,r))return i.value;var o=t?"0":"0,0";return r<=0?e=Math.round(e*Math.pow(10,r))/Math.pow(10,r):r>0&&(o+="."+new Array(r+1).join("0")),u(e).format(o)},r.HTML2TEXT=function(e){var r="";return e&&(e instanceof Array?e.forEach(function(e){""!==r&&(r+="\n"),r+=e.replace(/<(?:.|\n)*?>/gm,"")}):r=e.replace(/<(?:.|\n)*?>/gm,"")),r},r.LEFT=function(e,r){return r=void 0===r?1:r,r=n.parseNumber(r),r instanceof Error||"string"!=typeof e?i.value:e?e.substring(0,r):null},r.LEN=function(e){return 0===arguments.length?i.error:"string"==typeof e?e?e.length:0:e.length?e.length:i.value},r.LOWER=function(e){return"string"!=typeof e?i.value:e?e.toLowerCase():e},r.MID=function(e,r,t){if(r=n.parseNumber(r),t=n.parseNumber(t),n.anyIsError(r,t)||"string"!=typeof e)return t;var i=r-1,u=i+t;return e.substring(i,u)},r.NUMBERVALUE=function(e,r,t){return r="undefined"==typeof r?".":r,t="undefined"==typeof t?",":t,Number(e.replace(r,".").replace(t,""))},r.PRONETIC=function(){throw new Error("PRONETIC is not implemented")},r.PROPER=function(e){return void 0===e||0===e.length?i.value:(e===!0&&(e="TRUE"),e===!1&&(e="FALSE"),isNaN(e)&&"number"==typeof e?i.value:("number"==typeof e&&(e=""+e),e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})))},r.REGEXEXTRACT=function(e,r){var t=e.match(new RegExp(r));return t?t[t.length>1?t.length-1:0]:null},r.REGEXMATCH=function(e,r,t){var n=e.match(new RegExp(r));return t?n:!!n},r.REGEXREPLACE=function(e,r,t){return e.replace(new RegExp(r),t)},r.REPLACE=function(e,r,t,u){return r=n.parseNumber(r),t=n.parseNumber(t),n.anyIsError(r,t)||"string"!=typeof e||"string"!=typeof u?i.value:e.substr(0,r-1)+u+e.substr(r-1+t)},r.REPT=function(e,r){return r=n.parseNumber(r),r instanceof Error?r:new Array(r+1).join(e)},r.RIGHT=function(e,r){return r=void 0===r?1:r,r=n.parseNumber(r),r instanceof Error?r:e?e.substring(e.length-r):null},r.SEARCH=function(e,r,t){var n;return"string"!=typeof e||"string"!=typeof r?i.value:(t=void 0===t?0:t,n=r.toLowerCase().indexOf(e.toLowerCase(),t-1)+1,0===n?i.value:n)},r.SPLIT=function(e,r){return e.split(r)},r.SUBSTITUTE=function(e,r,t,n){if(!(e&&r&&t))return e;if(void 0===n)return e.replace(new RegExp(r,"g"),t);for(var i=0,u=0;e.indexOf(r,i)>0;)if(i=e.indexOf(r,i+1),u++,u===n)return e.substring(0,i)+t+e.substring(i+r.length)},r.T=function(e){return"string"==typeof e?e:""},r.TEXT=function(e,r){return e=n.parseNumber(e),n.anyIsError(e)?i.na:u(e).format(r)},r.TRIM=function(e){return"string"!=typeof e?i.value:e.replace(/ +/g," ").trim()},r.UNICHAR=this.CHAR,r.UNICODE=this.CODE,r.UPPER=function(e){return"string"!=typeof e?i.value:e.toUpperCase()},r.VALUE=function(e){return"string"!=typeof e?i.value:u().unformat(e)}},function(e,r){e.exports=__WEBPACK_EXTERNAL_MODULE_8__},function(e,r){e.exports=__WEBPACK_EXTERNAL_MODULE_9__},function(e,r,t){var n=t(4),i=t(8);r.UNIQUE=function(){for(var e=[],r=0;r<arguments.length;++r){for(var t=!1,n=arguments[r],i=0;i<e.length&&!(t=e[i]===n);++i);t||e.push(n)}return e},r.FLATTEN=n.flatten,r.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},r.REFERENCE=function(e,r){try{for(var t=r.split("."),n=e,i=0;i<t.length;++i){var u=t[i];if("]"===u[u.length-1]){var o=u.indexOf("["),a=u.substring(o+1,u.length-1);n=n[u.substring(0,o)][a]}else n=n[u]}return n}catch(e){}},r.JOIN=function(e,r){return e.join(r)},r.NUMBERS=function(){var e=n.flatten(arguments);return e.filter(function(e){return"number"==typeof e})},r.NUMERAL=function(e,r){return i(e).format(r)}},function(e,r,t){var n=t(5);r.CELL=function(){throw new Error("CELL is not implemented")},r.ERROR={},r.ERROR.TYPE=function(e){switch(e){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},r.INFO=function(){throw new Error("INFO is not implemented")},r.ISBLANK=function(e){return null===e},r.ISBINARY=function(e){return/^[01]{1,10}$/.test(e)},r.ISERR=function(e){return[n.value,n.ref,n.div0,n.num,n.name,n.nil].indexOf(e)>=0||"number"==typeof e&&(isNaN(e)||!isFinite(e))},r.ISERROR=function(e){return r.ISERR(e)||e===n.na},r.ISEVEN=function(e){return!(1&Math.floor(Math.abs(e)))},r.ISFORMULA=function(){throw new Error("ISFORMULA is not implemented")},r.ISLOGICAL=function(e){return e===!0||e===!1},r.ISNA=function(e){return e===n.na},r.ISNONTEXT=function(e){return"string"!=typeof e},r.ISNUMBER=function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)},r.ISODD=function(e){return!!(1&Math.floor(Math.abs(e)))},r.ISREF=function(){throw new Error("ISREF is not implemented")},r.ISTEXT=function(e){return"string"==typeof e},r.N=function(e){return this.ISNUMBER(e)?e:e instanceof Date?e.getTime():e===!0?1:e===!1?0:this.ISERROR(e)?e:0},r.NA=function(){return n.na},r.SHEET=function(){throw new Error("SHEET is not implemented")},r.SHEETS=function(){throw new Error("SHEETS is not implemented")},r.TYPE=function(e){return this.ISNUMBER(e)?1:this.ISTEXT(e)?2:this.ISLOGICAL(e)?4:this.ISERROR(e)?16:Array.isArray(e)?64:void 0}},function(e,r,t){function n(e){return/^[01]{1,10}$/.test(e)}var i=t(5),u=t(9).jStat,o=t(7),a=t(4),s=t(13);r.BESSELI=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:s.besseli(e,r)},r.BESSELJ=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:s.besselj(e,r)},r.BESSELK=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:s.besselk(e,r)},r.BESSELY=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:s.bessely(e,r)},r.BIN2DEC=function(e){if(!n(e))return i.num;var r=parseInt(e,2),t=e.toString();return 10===t.length&&"1"===t.substring(0,1)?parseInt(t.substring(1),2)-512:r},r.BIN2HEX=function(e,r){if(!n(e))return i.num;var t=e.toString();if(10===t.length&&"1"===t.substring(0,1))return(0xfffffffe00+parseInt(t.substring(1),2)).toString(16);var u=parseInt(e,2).toString(16);return void 0===r?u:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=u.length?o.REPT("0",r-u.length)+u:i.num)},r.BIN2OCT=function(e,r){if(!n(e))return i.num;var t=e.toString();if(10===t.length&&"1"===t.substring(0,1))return(1073741312+parseInt(t.substring(1),2)).toString(8);var u=parseInt(e,2).toString(8);return void 0===r?u:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=u.length?o.REPT("0",r-u.length)+u:i.num)},r.BITAND=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:e<0||r<0?i.num:Math.floor(e)!==e||Math.floor(r)!==r?i.num:e>0xffffffffffff||r>0xffffffffffff?i.num:e&r},r.BITLSHIFT=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:e<0?i.num:Math.floor(e)!==e?i.num:e>0xffffffffffff?i.num:Math.abs(r)>53?i.num:r>=0?e<<r:e>>-r},r.BITOR=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:e<0||r<0?i.num:Math.floor(e)!==e||Math.floor(r)!==r?i.num:e>0xffffffffffff||r>0xffffffffffff?i.num:e|r},r.BITRSHIFT=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:e<0?i.num:Math.floor(e)!==e?i.num:e>0xffffffffffff?i.num:Math.abs(r)>53?i.num:r>=0?e>>r:e<<-r},r.BITXOR=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:e<0||r<0?i.num:Math.floor(e)!==e||Math.floor(r)!==r?i.num:e>0xffffffffffff||r>0xffffffffffff?i.num:e^r},r.COMPLEX=function(e,r,t){if(e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r))return e;if(t=void 0===t?"i":t,"i"!==t&&"j"!==t)return i.value;if(0===e&&0===r)return 0;if(0===e)return 1===r?t:r.toString()+t;if(0===r)return e.toString();var n=r>0?"+":"";return e.toString()+n+(1===r?t:r.toString()+t)},r.CONVERT=function(e,r,t){if(e=a.parseNumber(e),e instanceof Error)return e;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]],o={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=r,p=t,h=1,m=1,v=0;v<u.length;v++)n=null===u[v][2]?[]:u[v][2],(u[v][1]===c||n.indexOf(c)>=0)&&(l=u[v]),(u[v][1]===p||n.indexOf(p)>=0)&&(f=u[v]);if(null===l){var d=o[r.substring(0,2)],g=s[r.substring(0,1)];"da"===r.substring(0,2)&&(g=["dekao",10,"da"]),d?(h=d[2],c=r.substring(2)):g&&(h=g[1],c=r.substring(g[2].length));for(var y=0;y<u.length;y++)n=null===u[y][2]?[]:u[y][2],(u[y][1]===c||n.indexOf(c)>=0)&&(l=u[y])}if(null===f){var b=o[t.substring(0,2)],E=s[t.substring(0,1)];"da"===t.substring(0,2)&&(E=["dekao",10,"da"]),b?(m=b[2],p=t.substring(2)):E&&(m=E[1],p=t.substring(E[2].length));for(var N=0;N<u.length;N++)n=null===u[N][2]?[]:u[N][2],(u[N][1]===p||n.indexOf(p)>=0)&&(f=u[N])}return null===l||null===f?i.na:l[3]!==f[3]?i.na:e*l[6]*h/(f[6]*m)},r.DEC2BIN=function(e,r){if(e=a.parseNumber(e),e instanceof Error)return e;if(!/^-?[0-9]{1,3}$/.test(e)||e<-512||e>511)return i.num;if(e<0)return"1"+o.REPT("0",9-(512+e).toString(2).length)+(512+e).toString(2);var t=parseInt(e,10).toString(2);return"undefined"==typeof r?t:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=t.length?o.REPT("0",r-t.length)+t:i.num)},r.DEC2HEX=function(e,r){if(e=a.parseNumber(e),e instanceof Error)return e;if(!/^-?[0-9]{1,12}$/.test(e)||e<-549755813888||e>549755813887)return i.num;if(e<0)return(1099511627776+e).toString(16);var t=parseInt(e,10).toString(16);return"undefined"==typeof r?t:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=t.length?o.REPT("0",r-t.length)+t:i.num)},r.DEC2OCT=function(e,r){if(e=a.parseNumber(e),e instanceof Error)return e;if(!/^-?[0-9]{1,9}$/.test(e)||e<-536870912||e>536870911)return i.num;if(e<0)return(1073741824+e).toString(8);var t=parseInt(e,10).toString(8);return"undefined"==typeof r?t:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=t.length?o.REPT("0",r-t.length)+t:i.num)},r.DELTA=function(e,r){return r=void 0===r?0:r,e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:e===r?1:0},r.ERF=function(e,r){return r=void 0===r?0:r,e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?i.value:u.erf(e)},r.ERF.PRECISE=function(){throw new Error("ERF.PRECISE is not implemented")},r.ERFC=function(e){return isNaN(e)?i.value:u.erfc(e)},r.ERFC.PRECISE=function(){throw new Error("ERFC.PRECISE is not implemented")},r.GESTEP=function(e,r){return r=r||0,e=a.parseNumber(e),a.anyIsError(r,e)?e:e>=r?1:0},r.HEX2BIN=function(e,r){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return i.num;var t=10===e.length&&"f"===e.substring(0,1).toLowerCase(),n=t?parseInt(e,16)-1099511627776:parseInt(e,16);if(n<-512||n>511)return i.num;if(t)return"1"+o.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return void 0===r?u:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=u.length?o.REPT("0",r-u.length)+u:i.num)},r.HEX2DEC=function(e){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return i.num;var r=parseInt(e,16);return r>=549755813888?r-1099511627776:r},r.HEX2OCT=function(e,r){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return i.num;var t=parseInt(e,16);if(t>536870911&&t<0xffe0000000)return i.num;if(t>=0xffe0000000)return(t-0xffc0000000).toString(8);var n=t.toString(8);return void 0===r?n:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=n.length?o.REPT("0",r-n.length)+n:i.num)},r.IMABS=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.value:Math.sqrt(Math.pow(t,2)+Math.pow(n,2))},r.IMAGINARY=function(e){if(void 0===e||e===!0||e===!1)return i.value;if(0===e||"0"===e)return 0;if(["i","j"].indexOf(e)>=0)return 1;e=e.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var r=e.indexOf("+"),t=e.indexOf("-");0===r&&(r=e.indexOf("+",1)),0===t&&(t=e.indexOf("-",1));var n=e.substring(e.length-1,e.length),u="i"===n||"j"===n;return r>=0||t>=0?u?r>=0?isNaN(e.substring(0,r))||isNaN(e.substring(r+1,e.length-1))?i.num:Number(e.substring(r+1,e.length-1)):isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?i.num:-Number(e.substring(t+1,e.length-1)):i.num:u?isNaN(e.substring(0,e.length-1))?i.num:e.substring(0,e.length-1):isNaN(e)?i.num:0},r.IMARGUMENT=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.value:0===t&&0===n?i.div0:0===t&&n>0?Math.PI/2:0===t&&n<0?-Math.PI/2:0===n&&t>0?0:0===n&&t<0?-Math.PI:t>0?Math.atan(n/t):t<0&&n>=0?Math.atan(n/t)+Math.PI:Math.atan(n/t)-Math.PI},r.IMCONJUGATE=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",0!==n?r.COMPLEX(t,-n,u):e},r.IMCOS=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.cos(t)*(Math.exp(n)+Math.exp(-n))/2,-Math.sin(t)*(Math.exp(n)-Math.exp(-n))/2,u)},r.IMCOSH=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.cos(n)*(Math.exp(t)+Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)-Math.exp(-t))/2,u)},r.IMCOT=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.value:r.IMDIV(r.IMCOS(e),r.IMSIN(e))},r.IMDIV=function(e,t){var n=r.IMREAL(e),u=r.IMAGINARY(e),o=r.IMREAL(t),s=r.IMAGINARY(t);if(a.anyIsError(n,u,o,s))return i.value;var l=e.substring(e.length-1),f=t.substring(t.length-1),c="i";if("j"===l?c="j":"j"===f&&(c="j"),0===o&&0===s)return i.num;var p=o*o+s*s;return r.COMPLEX((n*o+u*s)/p,(u*o-n*s)/p,c)},r.IMEXP=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);u="i"===u||"j"===u?u:"i";var o=Math.exp(t);return r.COMPLEX(o*Math.cos(n),o*Math.sin(n),u)},r.IMLN=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.log(Math.sqrt(t*t+n*n)),Math.atan(n/t),u)},r.IMLOG10=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(10),Math.atan(n/t)/Math.log(10),u)},r.IMLOG2=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.log(Math.sqrt(t*t+n*n))/Math.log(2),Math.atan(n/t)/Math.log(2),u)},r.IMPOWER=function(e,t){t=a.parseNumber(t);var n=r.IMREAL(e),u=r.IMAGINARY(e);if(a.anyIsError(t,n,u))return i.value;var o=e.substring(e.length-1);o="i"===o||"j"===o?o:"i";var s=Math.pow(r.IMABS(e),t),l=r.IMARGUMENT(e);return r.COMPLEX(s*Math.cos(t*l),s*Math.sin(t*l),o)},r.IMPRODUCT=function(){for(var e=arguments[0],t=1;t<arguments.length;t++){var n=r.IMREAL(e),u=r.IMAGINARY(e),o=r.IMREAL(arguments[t]),s=r.IMAGINARY(arguments[t]);if(a.anyIsError(n,u,o,s))return i.value;e=r.COMPLEX(n*o-u*s,n*s+u*o)}return e},r.IMREAL=function(e){if(void 0===e||e===!0||e===!1)return i.value;if(0===e||"0"===e)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(e)>=0)return 0;var r=e.indexOf("+"),t=e.indexOf("-");0===r&&(r=e.indexOf("+",1)),0===t&&(t=e.indexOf("-",1));var n=e.substring(e.length-1,e.length),u="i"===n||"j"===n;return r>=0||t>=0?u?r>=0?isNaN(e.substring(0,r))||isNaN(e.substring(r+1,e.length-1))?i.num:Number(e.substring(0,r)):isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?i.num:Number(e.substring(0,t)):i.num:u?isNaN(e.substring(0,e.length-1))?i.num:0:isNaN(e)?i.num:e},r.IMSEC=function(e){if(e===!0||e===!1)return i.value;var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.value:r.IMDIV("1",r.IMCOS(e))},r.IMSECH=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.value:r.IMDIV("1",r.IMCOSH(e))},r.IMSIN=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.sin(t)*(Math.exp(n)+Math.exp(-n))/2,Math.cos(t)*(Math.exp(n)-Math.exp(-n))/2,u)},r.IMSINH=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);return u="i"===u||"j"===u?u:"i",r.COMPLEX(Math.cos(n)*(Math.exp(t)-Math.exp(-t))/2,Math.sin(n)*(Math.exp(t)+Math.exp(-t))/2,u)},r.IMSQRT=function(e){var t=r.IMREAL(e),n=r.IMAGINARY(e);if(a.anyIsError(t,n))return i.value;var u=e.substring(e.length-1);u="i"===u||"j"===u?u:"i";var o=Math.sqrt(r.IMABS(e)),s=r.IMARGUMENT(e);return r.COMPLEX(o*Math.cos(s/2),o*Math.sin(s/2),u)},r.IMCSC=function(e){if(e===!0||e===!1)return i.value;var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.num:r.IMDIV("1",r.IMSIN(e))},r.IMCSCH=function(e){if(e===!0||e===!1)return i.value;var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.num:r.IMDIV("1",r.IMSINH(e))},r.IMSUB=function(e,r){var t=this.IMREAL(e),n=this.IMAGINARY(e),u=this.IMREAL(r),o=this.IMAGINARY(r);if(a.anyIsError(t,n,u,o))return i.value;var s=e.substring(e.length-1),l=r.substring(r.length-1),f="i";return"j"===s?f="j":"j"===l&&(f="j"),this.COMPLEX(t-u,n-o,f)},r.IMSUM=function(){for(var e=a.flatten(arguments),r=e[0],t=1;t<e.length;t++){var n=this.IMREAL(r),u=this.IMAGINARY(r),o=this.IMREAL(e[t]),s=this.IMAGINARY(e[t]);if(a.anyIsError(n,u,o,s))return i.value;r=this.COMPLEX(n+o,u+s)}return r},r.IMTAN=function(e){if(e===!0||e===!1)return i.value;var t=r.IMREAL(e),n=r.IMAGINARY(e);return a.anyIsError(t,n)?i.value:this.IMDIV(this.IMSIN(e),this.IMCOS(e))},r.OCT2BIN=function(e,r){if(!/^[0-7]{1,10}$/.test(e))return i.num;var t=10===e.length&&"7"===e.substring(0,1),n=t?parseInt(e,8)-1073741824:parseInt(e,8);if(n<-512||n>511)return i.num;if(t)return"1"+o.REPT("0",9-(512+n).toString(2).length)+(512+n).toString(2);var u=n.toString(2);return"undefined"==typeof r?u:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=u.length?o.REPT("0",r-u.length)+u:i.num)},r.OCT2DEC=function(e){if(!/^[0-7]{1,10}$/.test(e))return i.num;var r=parseInt(e,8);return r>=536870912?r-1073741824:r},r.OCT2HEX=function(e,r){if(!/^[0-7]{1,10}$/.test(e))return i.num;var t=parseInt(e,8);if(t>=536870912)return"ff"+(t+3221225472).toString(16);var n=t.toString(16);return void 0===r?n:isNaN(r)?i.value:r<0?i.num:(r=Math.floor(r),r>=n.length?o.REPT("0",r-n.length)+n:i.num)}},function(e,r,t){function n(e,r){return e.reduce(function(e,t){return r*e+t},0)}function i(e,r,t,n,i){i||(i=-1);var u,o=2/e;if(0===r)return t;if(1===r)return n;for(var a=1;a!=r;++a)u=n*a*o+i*t,t=n,n=u;return n}function u(e,r,t,n,u){return function(o,a){if(0===a)return e(o);if(1===a)return r(o);if(a<0)throw t+": Order ("+a+") must be nonnegative";if(1==n&&0===o)throw t+": Undefined when x == 0";if(2==n&&o<=0)throw t+": Undefined when x <= 0";var s=e(o),l=r(o);return i(o,a,s,l,u)}}var o=Math,a=function(){function e(e){var r,i,f,c=e*e,p=o.abs(e)-.785398164;return o.abs(e)<8?(i=n(t,c),f=n(u,c),r=i/f):(c=64/c,i=n(a,c),f=n(s,c),r=o.sqrt(l/o.abs(e))*(o.cos(p)*i-o.sin(p)*f*8/o.abs(e))),r}function r(e){var r,t,i,u=e*e,a=o.abs(e)-2.356194491;return Math.abs(e)<8?(t=e*n(f,u),i=n(c,u),r=t/i):(u=64/u,t=n(p,u),i=n(h,u),r=o.sqrt(l/o.abs(e))*(o.cos(a)*t-o.sin(a)*i*8/o.abs(e)),e<0&&(r=-r)),r}var t=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),u=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),a=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),s=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),l=.636619772,f=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),c=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),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(n=Math.round(n),0===n)return e(o.abs(t));if(1===n)return r(o.abs(t));if(n<0)throw"BESSELJ: Order ("+n+") must be nonnegative";if(0===o.abs(t))return 0;var u,a,s,l,f,c,p,h,m=2/o.abs(t);if(o.abs(t)>n)u=i(t,n,e(o.abs(t)),r(o.abs(t)),-1);else{for(s=2*o.floor((n+o.floor(o.sqrt(40*n)))/2),l=0,c=u=f=0,p=1,a=s;a>0;a--)h=a*m*p-c,c=p,p=h,o.abs(p)>1e10&&(p*=1e-10,c*=1e-10,u*=1e-10,f*=1e-10),l&&(f+=p),l=!l,a==n&&(u=c);f=2*f-p,u/=f}return t<0&&n%2?-u:u}}(),s=function(){function e(e){var r,u,c,p=e*e,h=e-.785398164;return e<8?(u=n(t,p),c=n(i,p),r=u/c+f*a(e,0)*o.log(e)):(p=64/p,u=n(s,p),c=n(l,p),r=o.sqrt(f/e)*(o.sin(h)*u+o.cos(h)*c*8/e)),r}function r(e){var r,t,i,u=e*e,s=e-2.356194491;return e<8?(t=e*n(c,u),i=n(p,u),r=t/i+f*(a(e,1)*o.log(e)-1/e)):(u=64/u,t=n(h,u),i=n(m,u),r=o.sqrt(f/e)*(o.sin(s)*t+o.cos(s)*i*8/e)),r}var t=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),i=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),s=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),l=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),f=.636619772,c=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),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(e,r,"BESSELY",1,-1)}(),l=function(){function e(e){return e<=3.75?n(t,e*e/14.0625):o.exp(o.abs(e))/o.sqrt(o.abs(e))*n(i,3.75/o.abs(e))}function r(e){return e<3.75?e*n(u,e*e/14.0625):(e<0?-1:1)*o.exp(o.abs(e))/o.sqrt(o.abs(e))*n(a,3.75/o.abs(e))}var t=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),i=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),u=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),a=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function t(n,i){if(i=Math.round(i),0===i)return e(n);if(1==i)return r(n);if(i<0)throw"BESSELI Order ("+i+") must be nonnegative";if(0===o.abs(n))return 0;var u,a,s,l,f,c,p=2/o.abs(n);for(s=2*o.round((i+o.round(o.sqrt(40*i)))/2),l=u=0,f=1,a=s;a>0;a--)c=a*p*f+l,l=f,f=c,o.abs(f)>1e10&&(f*=1e-10,l*=1e-10,u*=1e-10),a==i&&(u=l);return u*=t(n,0)/f,n<0&&i%2?-u:u}}(),f=function(){function e(e){return e<=2?-o.log(e/2)*l(e,0)+n(t,e*e/4):o.exp(-e)/o.sqrt(e)*n(i,2/e)}function r(e){return e<=2?o.log(e/2)*l(e,1)+1/e*n(a,e*e/4):o.exp(-e)/o.sqrt(e)*n(s,2/e)}var t=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),i=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),a=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),s=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return u(e,r,"BESSELK",2,1)}();r.besselj=a,r.bessely=s,r.besseli=l,r.besselk=f},function(e,r,t){function n(e){return 1===new Date(e,1,29).getMonth()}function i(e,r){return Math.ceil((r-e)/1e3/60/60/24)}function u(e){var r=e>-22038912e5?2:1;return(e-s)/864e5+r}var o=t(5),a=t(4),s=new Date(1900,0,1),l=[void 0,0,1,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,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],void 0,void 0,void 0,[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6]];
r.DATE=function(e,r,t){if(e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),a.anyIsError(e,r,t))return o.value;if(e<0||r<0||t<0)return o.num;var n=new Date(e,r-1,t);return n},r.DATEVALUE=function(e){if("string"!=typeof e)return o.value;var r=Date.parse(e);return isNaN(r)?o.value:r<=-22038912e5?(r-s)/864e5+1:(r-s)/864e5+2},r.DAY=function(e){var r=a.parseDate(e);return r instanceof Error?r:r.getDate()},r.DAYS=function(e,r){return e=a.parseDate(e),r=a.parseDate(r),e instanceof Error?e:r instanceof Error?r:u(e)-u(r)},r.DAYS360=function(e,r,t){if(t=a.parseBool(t),e=a.parseDate(e),r=a.parseDate(r),e instanceof Error)return e;if(r instanceof Error)return r;if(t instanceof Error)return t;var n,i,u=e.getMonth(),o=r.getMonth();if(t)n=31===e.getDate()?30:e.getDate(),i=31===r.getDate()?30:r.getDate();else{var s=new Date(e.getFullYear(),u+1,0).getDate(),l=new Date(r.getFullYear(),o+1,0).getDate();n=e.getDate()===s?30:e.getDate(),r.getDate()===l?n<30?(o++,i=1):i=30:i=r.getDate()}return 360*(r.getFullYear()-e.getFullYear())+30*(o-u)+(i-n)},r.EDATE=function(e,r){return e=a.parseDate(e),e instanceof Error?e:isNaN(r)?o.value:(r=parseInt(r,10),e.setMonth(e.getMonth()+r),u(e))},r.EOMONTH=function(e,r){return e=a.parseDate(e),e instanceof Error?e:isNaN(r)?o.value:(r=parseInt(r,10),u(new Date(e.getFullYear(),e.getMonth()+r+1,0)))},r.HOUR=function(e){return e=a.parseDate(e),e instanceof Error?e:e.getHours()},r.INTERVAL=function(e){if("number"!=typeof e&&"string"!=typeof e)return o.value;e=parseInt(e,10);var r=Math.floor(e/94608e4);e%=94608e4;var t=Math.floor(e/2592e3);e%=2592e3;var n=Math.floor(e/86400);e%=86400;var i=Math.floor(e/3600);e%=3600;var u=Math.floor(e/60);e%=60;var a=e;return r=r>0?r+"Y":"",t=t>0?t+"M":"",n=n>0?n+"D":"",i=i>0?i+"H":"",u=u>0?u+"M":"",a=a>0?a+"S":"","P"+r+t+n+"T"+i+u+a},r.ISOWEEKNUM=function(e){if(e=a.parseDate(e),e instanceof Error)return e;e.setHours(0,0,0),e.setDate(e.getDate()+4-(e.getDay()||7));var r=new Date(e.getFullYear(),0,1);return Math.ceil(((e-r)/864e5+1)/7)},r.MINUTE=function(e){return e=a.parseDate(e),e instanceof Error?e:e.getMinutes()},r.MONTH=function(e){return e=a.parseDate(e),e instanceof Error?e:e.getMonth()+1},r.NETWORKDAYS=function(e,r,t){return this.NETWORKDAYS.INTL(e,r,1,t)},r.NETWORKDAYS.INTL=function(e,r,t,n){if(e=a.parseDate(e),e instanceof Error)return e;if(r=a.parseDate(r),r instanceof Error)return r;if(t=void 0===t?c[1]:c[t],!(t instanceof Array))return o.value;void 0===n?n=[]:n instanceof Array||(n=[n]);for(var i=0;i<n.length;i++){var u=a.parseDate(n[i]);if(u instanceof Error)return u;n[i]=u}var s=(r-e)/864e5+1,l=s,f=e;for(i=0;i<s;i++){var p=(new Date).getTimezoneOffset()>0?f.getUTCDay():f.getDay(),h=!1;p!==t[0]&&p!==t[1]||(h=!0);for(var m=0;m<n.length;m++){var v=n[m];if(v.getDate()===f.getDate()&&v.getMonth()===f.getMonth()&&v.getFullYear()===f.getFullYear()){h=!0;break}}h&&l--,f.setDate(f.getDate()+1)}return l},r.NOW=function(){return new Date},r.SECOND=function(e){return e=a.parseDate(e),e instanceof Error?e:e.getSeconds()},r.TIME=function(e,r,t){return e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?o.value:e<0||r<0||t<0?o.num:(3600*e+60*r+t)/86400},r.TIMEVALUE=function(e){return e=a.parseDate(e),e instanceof Error?e:(3600*e.getHours()+60*e.getMinutes()+e.getSeconds())/86400},r.TODAY=function(){return new Date},r.WEEKDAY=function(e,r){if(e=a.parseDate(e),e instanceof Error)return e;void 0===r&&(r=1);var t=e.getDay();return f[r][t]},r.WEEKNUM=function(e,r){if(e=a.parseDate(e),e instanceof Error)return e;if(void 0===r&&(r=1),21===r)return this.ISOWEEKNUM(e);var t=l[r],n=new Date(e.getFullYear(),0,1),i=n.getDay()<t?1:0;return n-=24*Math.abs(n.getDay()-t)*60*60*1e3,Math.floor((e-n)/864e5/7+1)+i},r.WORKDAY=function(e,r,t){return this.WORKDAY.INTL(e,r,1,t)},r.WORKDAY.INTL=function(e,r,t,n){if(e=a.parseDate(e),e instanceof Error)return e;if(r=a.parseNumber(r),r instanceof Error)return r;if(r<0)return o.num;if(t=void 0===t?c[1]:c[t],!(t instanceof Array))return o.value;void 0===n?n=[]:n instanceof Array||(n=[n]);for(var i=0;i<n.length;i++){var u=a.parseDate(n[i]);if(u instanceof Error)return u;n[i]=u}for(var s=0;s<r;){e.setDate(e.getDate()+1);var l=e.getDay();if(l!==t[0]&&l!==t[1]){for(var f=0;f<n.length;f++){var p=n[f];if(p.getDate()===e.getDate()&&p.getMonth()===e.getMonth()&&p.getFullYear()===e.getFullYear()){s--;break}}s++}}return e},r.YEAR=function(e){return e=a.parseDate(e),e instanceof Error?e:e.getFullYear()},r.YEARFRAC=function(e,r,t){if(e=a.parseDate(e),e instanceof Error)return e;if(r=a.parseDate(r),r instanceof Error)return r;t=t||0;var u=e.getDate(),o=e.getMonth()+1,s=e.getFullYear(),l=r.getDate(),f=r.getMonth()+1,c=r.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*o+360*s))/360;case 1:var p=function(e,r){var t=e.getFullYear(),i=new Date(t,2,1);if(n(t)&&e<i&&r>=i)return!0;var u=r.getFullYear(),o=new Date(u,2,1);return n(u)&&r>=o&&e<o},h=365;if(s===c||s+1===c&&(o>f||o===f&&u>=l))return(s===c&&n(s)||p(e,r)||1===f&&29===l)&&(h=366),i(e,r)/h;var m=c-s+1,v=(new Date(c+1,0,1)-new Date(s,0,1))/1e3/60/60/24,d=v/m;return i(e,r)/d;case 2:return i(e,r)/360;case 3:return i(e,r)/365;case 4:return(l+30*f+360*c-(u+30*o+360*s))/360}}},function(module,exports,__webpack_require__){function compact(e){if(!e)return e;for(var r=[],t=0;t<e.length;++t)e[t]&&r.push(e[t]);return r}function findResultIndex(database,criterias){for(var matches={},i=1;i<database[0].length;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;i<criterias.length;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;k<database.length;++k)for(var l=1;l<database[k].length;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;j<criterias.length;++j){var criteria=criterias[j];if(!(criteria.length<maxCriteriaLength)){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;p<criteria.length;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&¤tCriteriaResult)}for(var result=[],n=0;n<database[0].length;++n)matches[n]&&result.push(n-1);return result}var error=__webpack_require__(5),stats=__webpack_require__(6),maths=__webpack_require__(2),utils=__webpack_require__(4);exports.FINDFIELD=function(e,r){for(var t=null,n=0;n<e.length;n++)if(e[n][0]===r){t=n;break}return null==t?error.value:t},exports.DAVERAGE=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=0,a=0;a<n.length;a++)o+=i[n[a]];return 0===n.length?error.div0:o/n.length},exports.DCOUNT=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return stats.COUNT(o)},exports.DCOUNTA=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return stats.COUNTA(o)},exports.DGET=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);return 0===n.length?error.value:n.length>1?error.num:i[n[0]]},exports.DMAX=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=i[n[0]],a=1;a<n.length;a++)o<i[n[a]]&&(o=i[n[a]]);return o},exports.DMIN=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=i[n[0]],a=1;a<n.length;a++)o>i[n[a]]&&(o=i[n[a]]);return o},exports.DPRODUCT=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];o=compact(o);var s=1;for(a=0;a<o.length;a++)s*=o[a];return s},exports.DSTDEV=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return o=compact(o),stats.STDEV.S(o)},exports.DSTDEVP=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return o=compact(o),stats.STDEV.P(o)},exports.DSUM=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return maths.SUM(o)},exports.DVAR=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return stats.VAR.S(o)},exports.DVARP=function(e,r,t){if(isNaN(r)&&"string"!=typeof r)return error.value;var n=findResultIndex(e,t),i=[];if("string"==typeof r){var u=exports.FINDFIELD(e,r);i=utils.rest(e[u])}else i=utils.rest(e[r]);for(var o=[],a=0;a<n.length;a++)o[a]=i[n[a]];return stats.VAR.P(o)}},function(e,r,t){var n=t(5),i=t(4),u=t(11);r.AND=function(){for(var e=i.flatten(arguments),r=!0,t=0;t<e.length;t++)e[t]||(r=!1);return r},r.CHOOSE=function(){if(arguments.length<2)return n.na;var e=arguments[0];return e<1||e>254?n.value:arguments.length<e+1?n.value:arguments[e]},r.FALSE=function(){return!1},r.IF=function(e,r,t){return e?r:t},r.IFERROR=function(e,r){return u.ISERROR(e)?r:e},r.IFNA=function(e,r){return e===n.na?r:e},r.NOT=function(e){return!e},r.OR=function(){for(var e=i.flatten(arguments),r=!1,t=0;t<e.length;t++)e[t]&&(r=!0);return r},r.TRUE=function(){return!0},r.XOR=function(){for(var e=i.flatten(arguments),r=0,t=0;t<e.length;t++)e[t]&&r++;return!!(1&Math.floor(Math.abs(r)))},r.SWITCH=function(){var e;if(arguments.length>0){var r=arguments[0],t=arguments.length-1,n=Math.floor(t/2),i=!1,u=t%2===0?null:arguments[arguments.length-1];if(n)for(var o=0;o<n;o++)if(r===arguments[2*o+1]){e=arguments[2*o+2],i=!0;break}!i&&u&&(e=u)}return e}},function(e,r,t){function n(e){return e&&e.getTime&&!isNaN(e.getTime())}function i(e){return e instanceof Date?e:new Date(e)}var u=t(5),o=t(14),a=t(4);r.ACCRINT=function(e,r,t,u,a,s,l){return e=i(e),r=i(r),t=i(t),n(e)&&n(r)&&n(t)?u<=0||a<=0?"#NUM!":[1,2,4].indexOf(s)===-1?"#NUM!":[0,1,2,3,4].indexOf(l)===-1?"#NUM!":t<=e?"#NUM!":(a=a||0,l=l||0,a*u*o.YEARFRAC(e,t,l)):"#VALUE!"},r.ACCRINTM=function(){throw new Error("ACCRINTM is not implemented")},r.AMORDEGRC=function(){throw new Error("AMORDEGRC is not implemented")},r.AMORLINC=function(){throw new Error("AMORLINC is not implemented")},r.COUPDAYBS=function(){throw new Error("COUPDAYBS is not implemented")},r.COUPDAYS=function(){throw new Error("COUPDAYS is not implemented")},r.COUPDAYSNC=function(){throw new Error("COUPDAYSNC is not implemented")},r.COUPNCD=function(){throw new Error("COUPNCD is not implemented")},r.COUPNUM=function(){throw new Error("COUPNUM is not implemented")},r.COUPPCD=function(){throw new Error("COUPPCD is not implemented")},r.CUMIPMT=function(e,t,n,i,o,s){if(e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(e,t,n))return u.value;if(e<=0||t<=0||n<=0)return u.num;if(i<1||o<1||i>o)return u.num;if(0!==s&&1!==s)return u.num;var l=r.PMT(e,t,n,0,s),f=0;1===i&&0===s&&(f=-n,i++);for(var c=i;c<=o;c++)f+=1===s?r.FV(e,c-2,l,n,1)-l:r.FV(e,c-1,l,n,0);return f*=e},r.CUMPRINC=function(e,t,n,i,o,s){if(e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(e,t,n))return u.value;if(e<=0||t<=0||n<=0)return u.num;if(i<1||o<1||i>o)return u.num;if(0!==s&&1!==s)return u.num;var l=r.PMT(e,t,n,0,s),f=0;1===i&&(f=0===s?l+n*e:l,i++);for(var c=i;c<=o;c++)f+=s>0?l-(r.FV(e,c-2,l,n,1)-l)*e:l-r.FV(e,c-1,l,n,0)*e;return f},r.DB=function(e,r,t,n,i){if(i=void 0===i?12:i,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(e,r,t,n,i))return u.value;if(e<0||r<0||t<0||n<0)return u.num;if([1,2,3,4,5,6,7,8,9,10,11,12].indexOf(i)===-1)return u.num;if(n>t)return u.num;if(r>=e)return 0;for(var o=(1-Math.pow(r/e,1/t)).toFixed(3),s=e*o*i/12,l=s,f=0,c=n===t?t-1:n,p=2;p<=c;p++)f=(e-l)*o,l+=f;return 1===n?s:n===t?(e-l)*o:f},r.DDB=function(e,r,t,n,i){if(i=void 0===i?2:i,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(e,r,t,n,i))return u.value;if(e<0||r<0||t<0||n<0||i<=0)return u.num;if(n>t)return u.num;if(r>=e)return 0;for(var o=0,s=0,l=1;l<=n;l++)s=Math.min((e-o)*(i/t),e-r-o),o+=s;return s},r.DISC=function(){throw new Error("DISC is not implemented")},r.DOLLARDE=function(e,r){if(e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r))return u.value;if(r<0)return u.num;if(r>=0&&r<1)return u.div0;r=parseInt(r,10);var t=parseInt(e,10);t+=e%1*Math.pow(10,Math.ceil(Math.log(r)/Math.LN10))/r;var n=Math.pow(10,Math.ceil(Math.log(r)/Math.LN2)+1);return t=Math.round(t*n)/n},r.DOLLARFR=function(e,r){if(e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r))return u.value;if(r<0)return u.num;if(r>=0&&r<1)return u.div0;r=parseInt(r,10);var t=parseInt(e,10);return t+=e%1*Math.pow(10,-Math.ceil(Math.log(r)/Math.LN10))*r},r.DURATION=function(){throw new Error("DURATION is not implemented")},r.EFFECT=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?u.value:e<=0||r<1?u.num:(r=parseInt(r,10),Math.pow(1+e/r,r)-1)},r.FV=function(e,r,t,n,i){if(n=n||0,i=i||0,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(e,r,t,n,i))return u.value;var o;if(0===e)o=n+t*r;else{var s=Math.pow(1+e,r);o=1===i?n*s+t*(1+e)*(s-1)/e:n*s+t*(s-1)/e}return-o},r.FVSCHEDULE=function(e,r){if(e=a.parseNumber(e),r=a.parseNumberArray(a.flatten(r)),a.anyIsError(e,r))return u.value;for(var t=r.length,n=e,i=0;i<t;i++)n*=1+r[i];return n},r.INTRATE=function(){throw new Error("INTRATE is not implemented")},r.IPMT=function(e,t,n,i,o,s){if(o=o||0,s=s||0,e=a.parseNumber(e),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),o=a.parseNumber(o),s=a.parseNumber(s),a.anyIsError(e,t,n,i,o,s))return u.value;var l,f=r.PMT(e,n,i,o,s);return l=1===t?1===s?0:-i:1===s?r.FV(e,t-2,f,i,1)-f:r.FV(e,t-1,f,i,0),l*e},r.IRR=function(e,r){if(r=r||0,e=a.parseNumberArray(a.flatten(e)),r=a.parseNumber(r),a.anyIsError(e,r))return u.value;for(var t=function(e,r,t){for(var n=t+1,i=e[0],u=1;u<e.length;u++)i+=e[u]/Math.pow(n,(r[u]-r[0])/365);return i},n=function(e,r,t){for(var n=t+1,i=0,u=1;u<e.length;u++){var o=(r[u]-r[0])/365;i-=o*e[u]/Math.pow(n,o+1)}return i},i=[],o=!1,s=!1,l=0;l<e.length;l++)i[l]=0===l?0:i[l-1]+365,e[l]>0&&(o=!0),e[l]<0&&(s=!0);if(!o||!s)return u.num;r=void 0===r?.1:r;var f,c,p,h=r,m=1e-10,v=!0;do p=t(e,i,h),f=h-p/n(e,i,h),c=Math.abs(f-h),h=f,v=c>m&&Math.abs(p)>m;while(v);return h},r.ISPMT=function(e,r,t,n){return e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(e,r,t,n)?u.value:n*e*(r/t-1)},r.MDURATION=function(){throw new Error("MDURATION is not implemented")},r.MIRR=function(e,t,n){if(e=a.parseNumberArray(a.flatten(e)),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(e,t,n))return u.value;for(var i=e.length,o=[],s=[],l=0;l<i;l++)e[l]<0?o.push(e[l]):s.push(e[l]);var f=-r.NPV(n,s)*Math.pow(1+n,i-1),c=r.NPV(t,o)*(1+t);return Math.pow(f/c,1/(i-1))-1},r.NOMINAL=function(e,r){return e=a.parseNumber(e),r=a.parseNumber(r),a.anyIsError(e,r)?u.value:e<=0||r<1?u.num:(r=parseInt(r,10),(Math.pow(e+1,1/r)-1)*r)},r.NPER=function(e,r,t,n,i){if(i=void 0===i?0:i,n=void 0===n?0:n,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(e,r,t,n,i))return u.value;var o=r*(1+e*i)-n*e,s=t*e+r*(1+e*i);return Math.log(o/s)/Math.log(1+e)},r.NPV=function(){var e=a.parseNumberArray(a.flatten(arguments));if(e instanceof Error)return e;for(var r=e[0],t=0,n=1;n<e.length;n++)t+=e[n]/Math.pow(1+r,n);return t},r.ODDFPRICE=function(){throw new Error("ODDFPRICE is not implemented")},r.ODDFYIELD=function(){throw new Error("ODDFYIELD is not implemented")},r.ODDLPRICE=function(){throw new Error("ODDLPRICE is not implemented")},r.ODDLYIELD=function(){throw new Error("ODDLYIELD is not implemented")},r.PDURATION=function(e,r,t){return e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?u.value:e<=0?u.num:(Math.log(t)-Math.log(r))/Math.log(1+e)},r.PMT=function(e,r,t,n,i){if(n=n||0,i=i||0,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(e,r,t,n,i))return u.value;var o;if(0===e)o=(t+n)/r;else{var s=Math.pow(1+e,r);o=1===i?(n*e/(s-1)+t*e/(1-1/s))/(1+e):n*e/(s-1)+t*e/(1-1/s)}return-o},r.PPMT=function(e,t,n,i,o,s){return o=o||0,s=s||0,e=a.parseNumber(e),n=a.parseNumber(n),i=a.parseNumber(i),o=a.parseNumber(o),s=a.parseNumber(s),a.anyIsError(e,n,i,o,s)?u.value:r.PMT(e,n,i,o,s)-r.IPMT(e,t,n,i,o,s)},r.PRICE=function(){throw new Error("PRICE is not implemented")},r.PRICEDISC=function(){throw new Error("PRICEDISC is not implemented")},r.PRICEMAT=function(){throw new Error("PRICEMAT is not implemented")},r.PV=function(e,r,t,n,i){return n=n||0,i=i||0,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),a.anyIsError(e,r,t,n,i)?u.value:0===e?-t*r-n:((1-Math.pow(1+e,r))/e*t*(1+e*i)-n)/Math.pow(1+e,r)},r.RATE=function(e,r,t,n,i,o){if(o=void 0===o?.01:o,n=void 0===n?0:n,i=void 0===i?0:i,e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),i=a.parseNumber(i),o=a.parseNumber(o),a.anyIsError(e,r,t,n,i,o))return u.value;for(var s=1e-6,l=100,f=0,c=!1,p=o;f<l&&!c;){var h=Math.pow(p+1,e),m=Math.pow(p+1,e-1),v=n+h*t+r*(h-1)*(p*i+1)/p,d=e*m*t-r*(h-1)*(p*i+1)/Math.pow(p,2),g=e*r*m*(p*i+1)/p+r*(h-1)*i/p,y=p-v/(d+g);Math.abs(y-p)<s&&(c=!0),f++,p=y}return c?p:Number.NaN+p},r.RECEIVED=function(){throw new Error("RECEIVED is not implemented")},r.RRI=function(e,r,t){return e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?u.value:0===e||0===r?u.num:Math.pow(t/r,1/e)-1},r.SLN=function(e,r,t){return e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?u.value:0===t?u.num:(e-r)/t},r.SYD=function(e,r,t,n){return e=a.parseNumber(e),r=a.parseNumber(r),t=a.parseNumber(t),n=a.parseNumber(n),a.anyIsError(e,r,t,n)?u.value:0===t?u.num:n<1||n>t?u.num:(n=parseInt(n,10),(e-r)*(t-n+1)*2/(t*(t+1)))},r.TBILLEQ=function(e,r,t){return e=a.parseDate(e),r=a.parseDate(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?u.value:t<=0?u.num:e>r?u.num:r-e>31536e6?u.num:365*t/(360-t*o.DAYS360(e,r,!1))},r.TBILLPRICE=function(e,r,t){return e=a.parseDate(e),r=a.parseDate(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?u.value:t<=0?u.num:e>r?u.num:r-e>31536e6?u.num:100*(1-t*o.DAYS360(e,r,!1)/360)},r.TBILLYIELD=function(e,r,t){return e=a.parseDate(e),r=a.parseDate(r),t=a.parseNumber(t),a.anyIsError(e,r,t)?u.value:t<=0?u.num:e>r?u.num:r-e>31536e6?u.num:360*(100-t)/(t*o.DAYS360(e,r,!1))},r.VDB=function(){throw new Error("VDB is not implemented")},r.XIRR=function(e,r,t){if(e=a.parseNumberArray(a.flatten(e)),r=a.parseDateArray(a.flatten(r)),t=a.parseNumber(t),a.anyIsError(e,r,t))return u.value;for(var n=function(e,r,t){for(var n=t+1,i=e[0],u=1;u<e.length;u++)i+=e[u]/Math.pow(n,o.DAYS(r[u],r[0])/365);return i},i=function(e,r,t){for(var n=t+1,i=0,u=1;u<e.length;u++){var a=o.DAYS(r[u],r[0])/365;i-=a*e[u]/Math.pow(n,a+1)}return i},s=!1,l=!1,f=0;f<e.length;f++)e[f]>0&&(s=!0),e[f]<0&&(l=!0);if(!s||!l)return u.num;t=t||.1;var c,p,h,m=t,v=1e-10,d=!0;do h=n(e,r,m),c=m-h/i(e,r,m),p=Math.abs(c-m),m=c,d=p>v&&Math.abs(h)>v;while(d);return m},r.XNPV=function(e,r,t){if(e=a.parseNumber(e),r=a.parseNumberArray(a.flatten(r)),t=a.parseDateArray(a.flatten(t)),a.anyIsError(e,r,t))return u.value;for(var n=0,i=0;i<r.length;i++)n+=r[i]/Math.pow(1+e,o.DAYS(t[i],t[0])/365);return n},r.YIELD=function(){throw new Error("YIELD is not implemented")},r.YIELDDISC=function(){throw new Error("YIELDDISC is not implemented")},r.YIELDMAT=function(){throw new Error("YIELDMAT is not implemented")}},function(e,r,t){var n=t(5);r.MATCH=function(e,r,t){if(!e&&!r)return n.na;if(2===arguments.length&&(t=1),!(r instanceof Array))return n.na;if(t!==-1&&0!==t&&1!==t)return n.na;for(var i,u,o=0;o<r.length;o++)if(1===t){if(r[o]===e)return o+1;r[o]<e&&(u?r[o]>u&&(i=o+1,u=r[o]):(i=o+1,u=r[o]))}else if(0===t){if("string"==typeof e){if(e=e.replace(/\?/g,"."),r[o].toLowerCase().match(e.toLowerCase()))return o+1}else if(r[o]===e)return o+1}else if(t===-1){if(r[o]===e)return o+1;r[o]>e&&(u?r[o]<u&&(i=o+1,u=r[o]):(i=o+1,u=r[o]))}return i?i:n.na}}])})},function(module,exports,__webpack_require__){(function(global){"use strict";var numeric=exports;"undefined"!=typeof global&&(global.numeric=numeric),numeric.version="1.2.6",numeric.bench=function(e,r){var t,n,i,u;for("undefined"==typeof r&&(r=15),i=.5,t=new Date;;){for(i*=2,u=i;u>3;u-=4)e(),e(),e(),e();for(;u>0;)e(),u--;if(n=new Date,n-t>r)break}for(u=i;u>3;u-=4)e(),e(),e(),e();for(;u>0;)e(),u--;return n=new Date,1e3*(3*i-1)/(n-t)},numeric._myIndexOf=function(e){var r,t=this.length;for(r=0;r<t;++r)if(this[r]===e)return r;return-1},numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf,numeric.Function=Function,numeric.precision=4,numeric.largeArray=50,numeric.prettyPrint=function(e){function r(e){if(0===e)return"0";if(isNaN(e))return"NaN";if(e<0)return"-"+r(-e);if(isFinite(e)){var t=Math.floor(Math.log(e)/Math.log(10)),n=e/Math.pow(10,t),i=n.toPrecision(numeric.precision);return 10===parseFloat(i)&&(t++,n=1,i=n.toPrecision(numeric.precision)),parseFloat(i).toString()+"e"+t.toString()}return"Infinity"}function t(e){var i;if("undefined"==typeof e)return n.push(Array(numeric.precision+8).join(" ")),!1;if("string"==typeof e)return n.push('"'+e+'"'),!1;if("boolean"==typeof e)return n.push(e.toString()),!1;if("number"==typeof e){var u=r(e),o=e.toPrecision(numeric.precision),a=parseFloat(e.toString()).toString(),s=[u,o,a,parseFloat(o).toString(),parseFloat(a).toString()];for(i=1;i<s.length;i++)s[i].length<u.length&&(u=s[i]);return n.push(Array(numeric.precision+8-u.length).join(" ")+u),!1}if(null===e)return n.push("null"),!1;if("function"==typeof e){n.push(e.toString());var l=!1;for(i in e)e.hasOwnProperty(i)&&(l?n.push(",\n"):n.push("\n{"),l=!0,n.push(i),n.push(": \n"),t(e[i]));return l&&n.push("}\n"),!0}if(e instanceof Array){if(e.length>numeric.largeArray)return n.push("...Large Array..."),!0;var l=!1;for(n.push("["),i=0;i<e.length;i++)i>0&&(n.push(","),l&&n.push("\n ")),l=t(e[i]);return n.push("]"),!0}n.push("{");var l=!1;for(i in e)e.hasOwnProperty(i)&&(l&&n.push(",\n"),l=!0,n.push(i),n.push(": \n"),t(e[i]));return n.push("}"),!0}var n=[];return t(e),n.join("")},numeric.parseDate=function(e){function r(e){if("string"==typeof e)return Date.parse(e.replace(/-/g,"/"));if(!(e instanceof Array))throw new Error("parseDate: parameter must be arrays of strings");var t,n=[];for(t=0;t<e.length;t++)n[t]=r(e[t]);return n}return r(e)},numeric.parseFloat=function(e){function r(e){if("string"==typeof e)return parseFloat(e);if(!(e instanceof Array))throw new Error("parseFloat: parameter must be arrays of strings");var t,n=[];for(t=0;t<e.length;t++)n[t]=r(e[t]);return n}return r(e)},numeric.parseCSV=function(e){var r,t,n=e.split("\n"),i=[],u=/(([^'",]*)|('[^']*')|("[^"]*")),/g,o=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/,a=function(e){return e.substr(0,e.length-1)},s=0;for(t=0;t<n.length;t++){var l,f=(n[t]+",").match(u);if(f.length>0){for(i[s]=[],r=0;r<f.length;r++)l=a(f[r]),o.test(l)?i[s][r]=parseFloat(l):i[s][r]=l;s++}}return i},numeric.toCSV=function(e){var r,t,n,i,u,o,a=numeric.dim(e);for(n=a[0],i=a[1],o=[],r=0;r<n;r++){for(u=[],t=0;t<n;t++)u[t]=e[r][t].toString();o[r]=u.join(", ")}return o.join("\n")+"\n"},numeric.getURL=function(e){var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(),r},numeric.imageURL=function(e){function r(e){var r,t,n,i,u,o,a,s,l=e.length,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="";for(r=0;r<l;r+=3)t=e[r],n=e[r+1],i=e[r+2],u=t>>2,o=((3&t)<<4)+(n>>4),a=((15&n)<<2)+(i>>6),s=63&i,r+1>=l?a=s=64:r+2>=l&&(s=64),c+=f.charAt(u)+f.charAt(o)+f.charAt(a)+f.charAt(s);return c}function t(e,r,t){"undefined"==typeof r&&(r=0),"undefined"==typeof t&&(t=e.length);var n,i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],u=-1,o=0;e.length;for(n=r;n<t;n++)o=255&(u^e[n]),u=u>>>8^i[o];return u^-1}var n,i,u,o,a,s,l,f,c,p,h=e[0].length,m=e[0][0].length,v=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,m>>24&255,m>>16&255,m>>8&255,255&m,h>>24&255,h>>16&255,h>>8&255,255&h,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(p=t(v,12,29),v[29]=p>>24&255,v[30]=p>>16&255,v[31]=p>>8&255,v[32]=255&p,n=1,i=0,l=0;l<h;l++){for(l<h-1?v.push(0):v.push(1),a=3*m+1+(0===l)&255,s=3*m+1+(0===l)>>8&255,v.push(a),v.push(s),v.push(255&~a),v.push(255&~s),0===l&&v.push(0),f=0;f<m;f++)for(u=0;u<3;u++)a=e[u][l][f],a=a>255?255:a<0?0:Math.round(a),n=(n+a)%65521,i=(i+n)%65521,v.push(a);v.push(0)}return c=(i<<16)+n,v.push(c>>24&255),v.push(c>>16&255),v.push(c>>8&255),v.push(255&c),o=v.length-41,v[33]=o>>24&255,v[34]=o>>16&255,v[35]=o>>8&255,v[36]=255&o,p=t(v,37),v.push(p>>24&255),v.push(p>>16&255),v.push(p>>8&255),v.push(255&p),v.push(0),v.push(0),v.push(0),v.push(0),v.push(73),v.push(69),v.push(78),v.push(68),v.push(174),v.push(66),v.push(96),v.push(130),"data:image/png;base64,"+r(v)},numeric._dim=function(e){for(var r=[];"object"==typeof e;)r.push(e.length),e=e[0];return r},numeric.dim=function(e){var r,t;return"object"==typeof e?(r=e[0],"object"==typeof r?(t=r[0],"object"==typeof t?numeric._dim(e):[e.length,r.length]):[e.length]):[]},numeric.mapreduce=function(e,r){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+r+';\nif(typeof x === "number") { var xi = x; '+e+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+e+";\n xi = x[i-1];\n "+e+";\n}\nif(i === 0) {\n xi = x[i];\n "+e+"\n}\nreturn accum;")},numeric.mapreduce2=function(e,r){return Function("x","var n = x.length;\nvar i,xi;\n"+r+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+e+";\n}\nreturn accum;")},numeric.same=function e(r,t){var n,i;if(!(r instanceof Array&&t instanceof Array))return!1;if(i=r.length,i!==t.length)return!1;for(n=0;n<i;n++)if(r[n]!==t[n]){if("object"!=typeof r[n])return!1;if(!e(r[n],t[n]))return!1}return!0},numeric.rep=function(e,r,t){"undefined"==typeof t&&(t=0);var n,i=e[t],u=Array(i);if(t===e.length-1){for(n=i-2;n>=0;n-=2)u[n+1]=r,u[n]=r;return n===-1&&(u[0]=r),u}for(n=i-1;n>=0;n--)u[n]=numeric.rep(e,r,t+1);return u},numeric.dotMMsmall=function(e,r){var t,n,i,u,o,a,s,l,f,c,p;for(u=e.length,o=r.length,a=r[0].length,s=Array(u),t=u-1;t>=0;t--){for(l=Array(a),f=e[t],i=a-1;i>=0;i--){for(c=f[o-1]*r[o-1][i],n=o-2;n>=1;n-=2)p=n-1,c+=f[n]*r[n][i]+f[p]*r[p][i];0===n&&(c+=f[0]*r[0][i]),l[i]=c}s[t]=l}return s},numeric._getCol=function(e,r,t){var n,i=e.length;for(n=i-1;n>0;--n)t[n]=e[n][r],--n,t[n]=e[n][r];0===n&&(t[0]=e[0][r])},numeric.dotMMbig=function(e,r){var t,n,i,u,o=numeric._getCol,a=r.length,s=Array(a),l=e.length,f=r[0].length,c=new Array(l),p=numeric.dotVV;for(--a,--l,n=l;n!==-1;--n)c[n]=Array(f);for(--f,n=f;n!==-1;--n)for(o(r,n,s),i=l;i!==-1;--i)u=0,t=e[i],c[i][n]=p(t,s);return c},numeric.dotMV=function(e,r){var t,n=e.length,i=(r.length,Array(n)),u=numeric.dotVV;for(t=n-1;t>=0;t--)i[t]=u(e[t],r);return i},numeric.dotVM=function(e,r){var t,n,i,u,o,a,s;for(i=e.length,u=r[0].length,o=Array(u),n=u-1;n>=0;n--){for(a=e[i-1]*r[i-1][n],t=i-2;t>=1;t-=2)s=t-1,a+=e[t]*r[t][n]+e[s]*r[s][n];0===t&&(a+=e[0]*r[0][n]),o[n]=a}return o},numeric.dotVV=function(e,r){var t,n,i=e.length,u=e[i-1]*r[i-1];for(t=i-2;t>=1;t-=2)n=t-1,u+=e[t]*r[t]+e[n]*r[n];return 0===t&&(u+=e[0]*r[0]),u},numeric.dot=function(e,r){var t=numeric.dim;switch(1e3*t(e).length+t(r).length){case 2002:return r.length<10?numeric.dotMMsmall(e,r):numeric.dotMMbig(e,r);case 2001:return numeric.dotMV(e,r);case 1002:return numeric.dotVM(e,r);case 1001:return numeric.dotVV(e,r);case 1e3:return numeric.mulVS(e,r);case 1:return numeric.mulSV(e,r);case 0:return e*r;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(e){
var r,t,n,i,u=e.length,o=Array(u);for(r=u-1;r>=0;r--){for(i=Array(u),t=r+2,n=u-1;n>=t;n-=2)i[n]=0,i[n-1]=0;for(n>r&&(i[n]=0),i[r]=e[r],n=r-1;n>=1;n-=2)i[n]=0,i[n-1]=0;0===n&&(i[0]=0),o[r]=i}return o},numeric.getDiag=function(e){var r,t=Math.min(e.length,e[0].length),n=Array(t);for(r=t-1;r>=1;--r)n[r]=e[r][r],--r,n[r]=e[r][r];return 0===r&&(n[0]=e[0][0]),n},numeric.identity=function(e){return numeric.diag(numeric.rep([e],1))},numeric.pointwise=function(e,r,t){"undefined"==typeof t&&(t="");var n,i,u=[],o=/\[i\]$/,a="",s=!1;for(n=0;n<e.length;n++)o.test(e[n])?(i=e[n].substring(0,e[n].length-3),a=i):i=e[n],"ret"===i&&(s=!0),u.push(i);return u[e.length]="_s",u[e.length+1]="_k",u[e.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+a+');\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i'+(s?"":", ret = Array(_n)")+";\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+e.join(",")+",_s,_k+1);\n return ret;\n}\n"+t+"\nfor(i=_n-1;i!==-1;--i) {\n "+r+"\n}\nreturn ret;",Function.apply(null,u)},numeric.pointwise2=function(e,r,t){"undefined"==typeof t&&(t="");var n,i,u=[],o=/\[i\]$/,a="",s=!1;for(n=0;n<e.length;n++)o.test(e[n])?(i=e[n].substring(0,e[n].length-3),a=i):i=e[n],"ret"===i&&(s=!0),u.push(i);return u[e.length]="var _n = "+a+".length;\nvar i"+(s?"":", ret = Array(_n)")+";\n"+t+"\nfor(i=_n-1;i!==-1;--i) {\n"+r+"\n}\nreturn ret;",Function.apply(null,u)},numeric._biforeach=function e(r,t,n,i,u){if(i===n.length-1)return void u(r,t);var o,a=n[i];for(o=a-1;o>=0;o--)e("object"==typeof r?r[o]:r,"object"==typeof t?t[o]:t,n,i+1,u)},numeric._biforeach2=function e(r,t,n,i,u){if(i===n.length-1)return u(r,t);var o,a=n[i],s=Array(a);for(o=a-1;o>=0;--o)s[o]=e("object"==typeof r?r[o]:r,"object"==typeof t?t[o]:t,n,i+1,u);return s},numeric._foreach=function e(r,t,n,i){if(n===t.length-1)return void i(r);var u,o=t[n];for(u=o-1;u>=0;u--)e(r[u],t,n+1,i)},numeric._foreach2=function e(r,t,n,i){if(n===t.length-1)return i(r);var u,o=t[n],a=Array(o);for(u=o-1;u>=0;u--)a[u]=e(r[u],t,n+1,i);return a},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var e,r;for(e=0;e<numeric.mathfuns2.length;++e)r=numeric.mathfuns2[e],numeric.ops2[r]=r;for(e in numeric.ops2)if(numeric.ops2.hasOwnProperty(e)){r=numeric.ops2[e];var t,n,i="";numeric.myIndexOf.call(numeric.mathfuns2,e)!==-1?(i="var "+r+" = Math."+r+";\n",t=function(e,t,n){return e+" = "+r+"("+t+","+n+")"},n=function(e,t){return e+" = "+r+"("+e+","+t+")"}):(t=function(e,t,n){return e+" = "+t+" "+r+" "+n},n=numeric.opseq.hasOwnProperty(e+"eq")?function(e,t){return e+" "+r+"= "+t}:function(e,t){return e+" = "+e+" "+r+" "+t}),numeric[e+"VV"]=numeric.pointwise2(["x[i]","y[i]"],t("ret[i]","x[i]","y[i]"),i),numeric[e+"SV"]=numeric.pointwise2(["x","y[i]"],t("ret[i]","x","y[i]"),i),numeric[e+"VS"]=numeric.pointwise2(["x[i]","y"],t("ret[i]","x[i]","y"),i),numeric[e]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar VV = numeric."+e+"VV, VS = numeric."+e+"VS, SV = numeric."+e+'SV;\nvar dim = numeric.dim;\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof x === "object") {\n if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n else x = numeric._biforeach2(x,y,dim(x),0,VS);\n } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n else '+n("x","y")+"\n}\nreturn x;\n"),numeric[r]=numeric[e],numeric[e+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],n("ret[i]","x[i]"),i),numeric[e+"eqS"]=numeric.pointwise2(["ret[i]","x"],n("ret[i]","x"),i),numeric[e+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar V = numeric."+e+"eqV, S = numeric."+e+'eqS\nvar s = numeric.dim(x);\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n else numeric._biforeach(x,y,s,0,S);\n}\nreturn x;\n')}for(e=0;e<numeric.mathfuns2.length;++e)r=numeric.mathfuns2[e],delete numeric.ops2[r];for(e=0;e<numeric.mathfuns.length;++e)r=numeric.mathfuns[e],numeric.ops1[r]=r;for(e in numeric.ops1)numeric.ops1.hasOwnProperty(e)&&(i="",r=numeric.ops1[e],numeric.myIndexOf.call(numeric.mathfuns,e)!==-1&&Math.hasOwnProperty(r)&&(i="var "+r+" = Math."+r+";\n"),numeric[e+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+r+"(ret[i]);",i),numeric[e+"eq"]=Function("x",'if(typeof x !== "object") return '+r+"x\nvar i;\nvar V = numeric."+e+"eqV;\nvar s = numeric.dim(x);\nnumeric._foreach(x,s,0,V);\nreturn x;\n"),numeric[e+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+r+"(x[i]);",i),numeric[e]=Function("x",'if(typeof x !== "object") return '+r+"(x)\nvar i;\nvar V = numeric."+e+"V;\nvar s = numeric.dim(x);\nreturn numeric._foreach2(x,s,0,V);\n"));for(e=0;e<numeric.mathfuns.length;++e)r=numeric.mathfuns[e],delete numeric.ops1[r];for(e in numeric.mapreducers)numeric.mapreducers.hasOwnProperty(e)&&(r=numeric.mapreducers[e],numeric[e+"V"]=numeric.mapreduce2(r[0],r[1]),numeric[e]=Function("x","s","k",r[1]+'if(typeof x !== "object") { xi = x;\n'+r[0]+';\n return accum;\n}if(typeof s === "undefined") s = numeric.dim(x);\nif(typeof k === "undefined") k = 0;\nif(k === s.length-1) return numeric.'+e+"V(x);\nvar xi;\nvar n = x.length, i;\nfor(i=n-1;i!==-1;--i) {\n xi = arguments.callee(x[i]);\n"+r[0]+";\n}\nreturn accum;\n"))}(),numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;"),numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;"),numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;"),numeric.trunc=function(e,r){return"object"==typeof e?"object"==typeof r?numeric.truncVV(e,r):numeric.truncVS(e,r):"object"==typeof r?numeric.truncSV(e,r):Math.round(e/r)*r},numeric.inv=function(e){var r,t,n,i,u,o,a,e,s=numeric.dim(e),l=Math.abs,f=s[0],c=s[1],p=numeric.clone(e),h=numeric.identity(f);for(o=0;o<c;++o){var m=-1,v=-1;for(u=o;u!==f;++u)a=l(p[u][o]),a>v&&(m=u,v=a);for(t=p[m],p[m]=p[o],p[o]=t,i=h[m],h[m]=h[o],h[o]=i,e=t[o],a=o;a!==c;++a)t[a]/=e;for(a=c-1;a!==-1;--a)i[a]/=e;for(u=f-1;u!==-1;--u)if(u!==o){for(r=p[u],n=h[u],e=r[o],a=o+1;a!==c;++a)r[a]-=t[a]*e;for(a=c-1;a>0;--a)n[a]-=i[a]*e,--a,n[a]-=i[a]*e;0===a&&(n[0]-=i[0]*e)}}return h},numeric.det=function(e){var r=numeric.dim(e);if(2!==r.length||r[0]!==r[1])throw new Error("numeric: det() only works on square matrices");var t,n,i,u,o,a,s,l,f=r[0],c=1,p=numeric.clone(e);for(n=0;n<f-1;n++){for(i=n,t=n+1;t<f;t++)Math.abs(p[t][n])>Math.abs(p[i][n])&&(i=t);for(i!==n&&(s=p[i],p[i]=p[n],p[n]=s,c*=-1),u=p[n],t=n+1;t<f;t++){for(o=p[t],a=o[n]/u[n],i=n+1;i<f-1;i+=2)l=i+1,o[i]-=u[i]*a,o[l]-=u[l]*a;i!==f&&(o[i]-=u[i]*a)}if(0===u[n])return 0;c*=u[n]}return c*p[n][n]},numeric.transpose=function(e){var r,t,n,i,u,o=e.length,a=e[0].length,s=Array(a);for(t=0;t<a;t++)s[t]=Array(o);for(r=o-1;r>=1;r-=2){for(i=e[r],n=e[r-1],t=a-1;t>=1;--t)u=s[t],u[r]=i[t],u[r-1]=n[t],--t,u=s[t],u[r]=i[t],u[r-1]=n[t];0===t&&(u=s[0],u[r]=i[0],u[r-1]=n[0])}if(0===r){for(n=e[0],t=a-1;t>=1;--t)s[t][0]=n[t],--t,s[t][0]=n[t];0===t&&(s[0][0]=n[0])}return s},numeric.negtranspose=function(e){var r,t,n,i,u,o=e.length,a=e[0].length,s=Array(a);for(t=0;t<a;t++)s[t]=Array(o);for(r=o-1;r>=1;r-=2){for(i=e[r],n=e[r-1],t=a-1;t>=1;--t)u=s[t],u[r]=-i[t],u[r-1]=-n[t],--t,u=s[t],u[r]=-i[t],u[r-1]=-n[t];0===t&&(u=s[0],u[r]=-i[0],u[r-1]=-n[0])}if(0===r){for(n=e[0],t=a-1;t>=1;--t)s[t][0]=-n[t],--t,s[t][0]=-n[t];0===t&&(s[0][0]=-n[0])}return s},numeric._random=function e(r,t){var n,i,u=r[t],o=Array(u);if(t===r.length-1){for(i=Math.random,n=u-1;n>=1;n-=2)o[n]=i(),o[n-1]=i();return 0===n&&(o[0]=i()),o}for(n=u-1;n>=0;n--)o[n]=e(r,t+1);return o},numeric.random=function(e){return numeric._random(e,0)},numeric.norm2=function(e){return Math.sqrt(numeric.norm2Squared(e))},numeric.linspace=function(e,r,t){if("undefined"==typeof t&&(t=Math.max(Math.round(r-e)+1,1)),t<2)return 1===t?[e]:[];var n,i=Array(t);for(t--,n=t;n>=0;n--)i[n]=(n*r+(t-n)*e)/t;return i},numeric.getBlock=function(e,r,t){function n(e,u){var o,a=r[u],s=t[u]-a,l=Array(s);if(u===i.length-1){for(o=s;o>=0;o--)l[o]=e[o+a];return l}for(o=s;o>=0;o--)l[o]=n(e[o+a],u+1);return l}var i=numeric.dim(e);return n(e,0)},numeric.setBlock=function(e,r,t,n){function i(e,n,o){var a,s=r[o],l=t[o]-s;if(o===u.length-1)for(a=l;a>=0;a--)e[a+s]=n[a];for(a=l;a>=0;a--)i(e[a+s],n[a],o+1)}var u=numeric.dim(e);return i(e,n,0),e},numeric.getRange=function(e,r,t){var n,i,u,o,a=r.length,s=t.length,l=Array(a);for(n=a-1;n!==-1;--n)for(l[n]=Array(s),u=l[n],o=e[r[n]],i=s-1;i!==-1;--i)u[i]=o[t[i]];return l},numeric.blockMatrix=function(e){var r=numeric.dim(e);if(r.length<4)return numeric.blockMatrix([e]);var t,n,i,u,o,a=r[0],s=r[1];for(t=0,n=0,i=0;i<a;++i)t+=e[i][0].length;for(u=0;u<s;++u)n+=e[0][u][0].length;var l=Array(t);for(i=0;i<t;++i)l[i]=Array(n);var f,c,p,h,m,v=0;for(i=0;i<a;++i){for(f=n,u=s-1;u!==-1;--u)for(o=e[i][u],f-=o[0].length,p=o.length-1;p!==-1;--p)for(m=o[p],c=l[v+p],h=m.length-1;h!==-1;--h)c[f+h]=m[h];v+=e[i][0].length}return l},numeric.tensor=function(e,r){if("number"==typeof e||"number"==typeof r)return numeric.mul(e,r);var t=numeric.dim(e),n=numeric.dim(r);if(1!==t.length||1!==n.length)throw new Error("numeric: tensor product is only defined for vectors");var i,u,o,a,s=t[0],l=n[0],f=Array(s);for(u=s-1;u>=0;u--){for(i=Array(l),a=e[u],o=l-1;o>=3;--o)i[o]=a*r[o],--o,i[o]=a*r[o],--o,i[o]=a*r[o],--o,i[o]=a*r[o];for(;o>=0;)i[o]=a*r[o],--o;f[u]=i}return f},numeric.T=function(e,r){this.x=e,this.y=r},numeric.t=function(e,r){return new numeric.T(e,r)},numeric.Tbinop=function(e,r,t,n,i){numeric.indexOf;if("string"!=typeof i){var u;i="";for(u in numeric)numeric.hasOwnProperty(u)&&(e.indexOf(u)>=0||r.indexOf(u)>=0||t.indexOf(u)>=0||n.indexOf(u)>=0)&&u.length>1&&(i+="var "+u+" = numeric."+u+";\n")}return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+i+"\nif(x.y) { if(y.y) { return new numeric.T("+n+");\n }\n return new numeric.T("+t+");\n}\nif(y.y) {\n return new numeric.T("+r+");\n}\nreturn new numeric.T("+e+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var e=numeric.mul,r=numeric.div;if(this.y){var t=numeric.add(e(this.x,this.x),e(this.y,this.y));return new numeric.T(r(this.x,t),r(numeric.neg(this.y),t))}return new T(r(1,this.x))},numeric.T.prototype.div=function e(r){if(r instanceof numeric.T||(r=new numeric.T(r)),r.y)return this.mul(r.reciprocal());var e=numeric.div;return this.y?new numeric.T(e(this.x,r.x),e(this.y,r.x)):new numeric.T(e(this.x,r.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var e=numeric.transpose,r=this.x,t=this.y;return t?new numeric.T(e(r),e(t)):new numeric.T(e(r))},numeric.T.prototype.transjugate=function(){var e=numeric.transpose,r=this.x,t=this.y;return t?new numeric.T(e(r),numeric.negtranspose(t)):new numeric.T(e(r))},numeric.Tunop=function(e,r,t){return"string"!=typeof t&&(t=""),Function("var x = this;\n"+t+"\nif(x.y) { "+r+";\n}\n"+e+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var e=this;if("undefined"==typeof e.y)return new numeric.T(numeric.inv(e.x));var r,t,n,i,u,o,a,s,l,f,c,r,t,n,p,h,m,v,d,g,y,b=e.x.length,E=numeric.identity(b),N=numeric.rep([b,b],0),w=numeric.clone(e.x),x=numeric.clone(e.y);for(r=0;r<b;r++){for(m=w[r][r],v=x[r][r],p=m*m+v*v,n=r,t=r+1;t<b;t++)m=w[t][r],v=x[t][r],h=m*m+v*v,h>p&&(n=t,p=h);for(n!==r&&(y=w[r],w[r]=w[n],w[n]=y,y=x[r],x[r]=x[n],x[n]=y,y=E[r],E[r]=E[n],E[n]=y,y=N[r],N[r]=N[n],N[n]=y),i=w[r],u=x[r],s=E[r],l=N[r],m=i[r],v=u[r],t=r+1;t<b;t++)d=i[t],g=u[t],i[t]=(d*m+g*v)/p,u[t]=(g*m-d*v)/p;for(t=0;t<b;t++)d=s[t],g=l[t],s[t]=(d*m+g*v)/p,l[t]=(g*m-d*v)/p;for(t=r+1;t<b;t++){for(o=w[t],a=x[t],f=E[t],c=N[t],m=o[r],v=a[r],n=r+1;n<b;n++)d=i[n],g=u[n],o[n]-=d*m-g*v,a[n]-=g*m+d*v;for(n=0;n<b;n++)d=s[n],g=l[n],f[n]-=d*m-g*v,c[n]-=g*m+d*v}}for(r=b-1;r>0;r--)for(s=E[r],l=N[r],t=r-1;t>=0;t--)for(f=E[t],c=N[t],m=w[t][r],v=x[t][r],n=b-1;n>=0;n--)d=s[n],g=l[n],f[n]-=m*d-v*g,c[n]-=m*g+v*d;return new numeric.T(E,N)},numeric.T.prototype.get=function(e){var r,t=this.x,n=this.y,i=0,u=e.length;if(n){for(;i<u;)r=e[i],t=t[r],n=n[r],i++;return new numeric.T(t,n)}for(;i<u;)r=e[i],t=t[r],i++;return new numeric.T(t)},numeric.T.prototype.set=function(e,r){var t,n=this.x,i=this.y,u=0,o=e.length,a=r.x,s=r.y;if(0===o)return s?this.y=s:i&&(this.y=void 0),this.x=n,this;if(s){for(i||(i=numeric.rep(numeric.dim(n),0),this.y=i);u<o-1;)t=e[u],n=n[t],i=i[t],u++;return t=e[u],n[t]=a,i[t]=s,this}if(i){for(;u<o-1;)t=e[u],n=n[t],i=i[t],u++;return t=e[u],n[t]=a,a instanceof Array?i[t]=numeric.rep(numeric.dim(a),0):i[t]=0,this}for(;u<o-1;)t=e[u],n=n[t],u++;return t=e[u],n[t]=a,this},numeric.T.prototype.getRows=function(e,r){var t,n,i=r-e+1,u=Array(i),o=this.x,a=this.y;for(t=e;t<=r;t++)u[t-e]=o[t];if(a){for(n=Array(i),t=e;t<=r;t++)n[t-e]=a[t];return new numeric.T(u,n)}return new numeric.T(u)},numeric.T.prototype.setRows=function(e,r,t){var n,i=this.x,u=this.y,o=t.x,a=t.y;for(n=e;n<=r;n++)i[n]=o[n-e];if(a)for(u||(u=numeric.rep(numeric.dim(i),0),this.y=u),n=e;n<=r;n++)u[n]=a[n-e];else if(u)for(n=e;n<=r;n++)u[n]=numeric.rep([o[n-e].length],0);return this},numeric.T.prototype.getRow=function(e){var r=this.x,t=this.y;return t?new numeric.T(r[e],t[e]):new numeric.T(r[e])},numeric.T.prototype.setRow=function(e,r){var t=this.x,n=this.y,i=r.x,u=r.y;return t[e]=i,u?(n||(n=numeric.rep(numeric.dim(t),0),this.y=n),n[e]=u):n&&(n=numeric.rep([i.length],0)),this},numeric.T.prototype.getBlock=function(e,r){var t=this.x,n=this.y,i=numeric.getBlock;return n?new numeric.T(i(t,e,r),i(n,e,r)):new numeric.T(i(t,e,r))},numeric.T.prototype.setBlock=function(e,r,t){t instanceof numeric.T||(t=new numeric.T(t));var n=this.x,i=this.y,u=numeric.setBlock,o=t.x,a=t.y;return a?(i||(this.y=numeric.rep(numeric.dim(this),0),i=this.y),u(n,e,r,o),u(i,e,r,a),this):(u(n,e,r,o),void(i&&u(i,e,r,numeric.rep(numeric.dim(o),0))))},numeric.T.rep=function(e,r){var t=numeric.T;r instanceof t||(r=new t(r));var n=r.x,i=r.y,u=numeric.rep;return i?new t(u(e,n),u(e,i)):new t(u(e,n))},numeric.T.diag=function e(r){r instanceof numeric.T||(r=new numeric.T(r));var t=r.x,n=r.y,e=numeric.diag;return n?new numeric.T(e(t),e(n)):new numeric.T(e(t))},numeric.T.eig=function(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)},numeric.T.identity=function(e){return new numeric.T(numeric.identity(e))},numeric.T.prototype.getDiag=function(){var e=numeric,r=this.x,t=this.y;return t?new e.T(e.getDiag(r),e.getDiag(t)):new e.T(e.getDiag(r))},numeric.house=function(e){var r=numeric.clone(e),t=e[0]>=0?1:-1,n=t*numeric.norm2(e);r[0]+=n;var i=numeric.norm2(r);if(0===i)throw new Error("eig: internal error");return numeric.div(r,i)},numeric.toUpperHessenberg=function(e){var r=numeric.dim(e);if(2!==r.length||r[0]!==r[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var t,n,i,u,o,a,s,l,f,c,p=r[0],h=numeric.clone(e),m=numeric.identity(p);for(n=0;n<p-2;n++){for(u=Array(p-n-1),t=n+1;t<p;t++)u[t-n-1]=h[t][n];if(numeric.norm2(u)>0){for(o=numeric.house(u),a=numeric.getBlock(h,[n+1,n],[p-1,p-1]),s=numeric.tensor(o,numeric.dot(o,a)),t=n+1;t<p;t++)for(l=h[t],f=s[t-n-1],i=n;i<p;i++)l[i]-=2*f[i-n];for(a=numeric.getBlock(h,[0,n+1],[p-1,p-1]),s=numeric.tensor(numeric.dot(a,o),o),t=0;t<p;t++)for(l=h[t],f=s[t],i=n+1;i<p;i++)l[i]-=2*f[i-n-1];for(a=Array(p-n-1),t=n+1;t<p;t++)a[t-n-1]=m[t];for(s=numeric.tensor(o,numeric.dot(o,a)),t=n+1;t<p;t++)for(c=m[t],f=s[t-n-1],i=0;i<p;i++)c[i]-=2*f[i]}}return{H:h,Q:m}},numeric.epsilon=2.220446049250313e-16,numeric.QRFrancis=function(e,r){"undefined"==typeof r&&(r=1e4),e=numeric.clone(e);var t,n,i,u,o,a,s,l,f,c,p,h,m,v,d,g,y,b,E=(numeric.clone(e),numeric.dim(e)),N=E[0],w=numeric.identity(N);if(N<3)return{Q:w,B:[[0,N-1]]};var x=numeric.epsilon;for(b=0;b<r;b++){for(g=0;g<N-1;g++)if(Math.abs(e[g+1][g])<x*(Math.abs(e[g][g])+Math.abs(e[g+1][g+1]))){var M=numeric.QRFrancis(numeric.getBlock(e,[0,0],[g,g]),r),I=numeric.QRFrancis(numeric.getBlock(e,[g+1,g+1],[N-1,N-1]),r);for(h=Array(g+1),d=0;d<=g;d++)h[d]=w[d];for(m=numeric.dot(M.Q,h),d=0;d<=g;d++)w[d]=m[d];for(h=Array(N-g-1),d=g+1;d<N;d++)h[d-g-1]=w[d];for(m=numeric.dot(I.Q,h),d=g+1;d<N;d++)w[d]=m[d-g-1];return{Q:w,B:M.B.concat(numeric.add(I.B,g+1))}}if(i=e[N-2][N-2],u=e[N-2][N-1],o=e[N-1][N-2],a=e[N-1][N-1],l=i+a,s=i*a-u*o,f=numeric.getBlock(e,[0,0],[2,2]),l*l>=4*s){var A,O;A=.5*(l+Math.sqrt(l*l-4*s)),O=.5*(l-Math.sqrt(l*l-4*s)),f=numeric.add(numeric.sub(numeric.dot(f,f),numeric.mul(f,A+O)),numeric.diag(numeric.rep([3],A*O)))}else f=numeric.add(numeric.sub(numeric.dot(f,f),numeric.mul(f,l)),numeric.diag(numeric.rep([3],s)));for(t=[f[0][0],f[1][0],f[2][0]],n=numeric.house(t),h=[e[0],e[1],e[2]],m=numeric.tensor(n,numeric.dot(n,h)),d=0;d<3;d++)for(p=e[d],v=m[d],y=0;y<N;y++)p[y]-=2*v[y];for(h=numeric.getBlock(e,[0,0],[N-1,2]),m=numeric.tensor(numeric.dot(h,n),n),d=0;d<N;d++)for(p=e[d],v=m[d],y=0;y<3;y++)p[y]-=2*v[y];for(h=[w[0],w[1],w[2]],m=numeric.tensor(n,numeric.dot(n,h)),d=0;d<3;d++)for(c=w[d],v=m[d],y=0;y<N;y++)c[y]-=2*v[y];var _;for(g=0;g<N-2;g++){for(y=g;y<=g+1;y++)if(Math.abs(e[y+1][y])<x*(Math.abs(e[y][y])+Math.abs(e[y+1][y+1]))){var M=numeric.QRFrancis(numeric.getBlock(e,[0,0],[y,y]),r),I=numeric.QRFrancis(numeric.getBlock(e,[y+1,y+1],[N-1,N-1]),r);for(h=Array(y+1),d=0;d<=y;d++)h[d]=w[d];for(m=numeric.dot(M.Q,h),d=0;d<=y;d++)w[d]=m[d];for(h=Array(N-y-1),d=y+1;d<N;d++)h[d-y-1]=w[d];for(m=numeric.dot(I.Q,h),d=y+1;d<N;d++)w[d]=m[d-y-1];return{Q:w,B:M.B.concat(numeric.add(I.B,y+1))}}for(_=Math.min(N-1,g+3),t=Array(_-g),d=g+1;d<=_;d++)t[d-g-1]=e[d][g];for(n=numeric.house(t),h=numeric.getBlock(e,[g+1,g],[_,N-1]),m=numeric.tensor(n,numeric.dot(n,h)),d=g+1;d<=_;d++)for(p=e[d],v=m[d-g-1],y=g;y<N;y++)p[y]-=2*v[y-g];for(h=numeric.getBlock(e,[0,g+1],[N-1,_]),m=numeric.tensor(numeric.dot(h,n),n),d=0;d<N;d++)for(p=e[d],v=m[d],y=g+1;y<=_;y++)p[y]-=2*v[y-g-1];for(h=Array(_-g),d=g+1;d<=_;d++)h[d-g-1]=w[d];for(m=numeric.tensor(n,numeric.dot(n,h)),d=g+1;d<=_;d++)for(c=w[d],v=m[d-g-1],y=0;y<N;y++)c[y]-=2*v[y]}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")},numeric.eig=function(e,r){var t,n,i,u,o,a,s,l,f,c,p,h,m,v,d,g,y,b=numeric.toUpperHessenberg(e),E=numeric.QRFrancis(b.H,r),N=numeric.T,w=e.length,x=E.B,M=numeric.dot(E.Q,numeric.dot(b.H,numeric.transpose(E.Q))),I=new N(numeric.dot(E.Q,b.Q)),A=x.length,O=Math.sqrt;for(n=0;n<A;n++)if(t=x[n][0],t===x[n][1]);else{if(u=t+1,o=M[t][t],a=M[t][u],s=M[u][t],l=M[u][u],0===a&&0===s)continue;f=-o-l,c=o*l-a*s,p=f*f-4*c,p>=0?(h=f<0?-.5*(f-O(p)):-.5*(f+O(p)),g=(o-h)*(o-h)+a*a,y=s*s+(l-h)*(l-h),g>y?(g=O(g),v=(o-h)/g,d=a/g):(y=O(y),v=s/y,d=(l-h)/y),i=new N([[d,-v],[v,d]]),I.setRows(t,u,i.dot(I.getRows(t,u)))):(h=-.5*f,m=.5*O(-p),g=(o-h)*(o-h)+a*a,y=s*s+(l-h)*(l-h),g>y?(g=O(g+m*m),v=(o-h)/g,d=a/g,h=0,m/=g):(y=O(y+m*m),v=s/y,d=(l-h)/y,h=m/y,m=0),i=new N([[d,-v],[v,d]],[[h,m],[m,-h]]),I.setRows(t,u,i.dot(I.getRows(t,u))))}var _=I.dot(e).dot(I.transjugate()),w=e.length,S=numeric.T.identity(w);for(u=0;u<w;u++)if(u>0)for(n=u-1;n>=0;n--){var T=_.get([n,n]),C=_.get([u,u]);numeric.neq(T.x,C.x)||numeric.neq(T.y,C.y)?(h=_.getRow(n).getBlock([n],[u-1]),m=S.getRow(u).getBlock([n],[u-1]),S.set([u,n],_.get([n,u]).neg().sub(h.dot(m)).div(T.sub(C)))):S.setRow(u,S.getRow(n))}for(u=0;u<w;u++)h=S.getRow(u),S.setRow(u,h.div(h.norm2()));return S=S.transpose(),S=I.transjugate().dot(S),{lambda:_.getDiag(),E:S}},numeric.ccsSparse=function(e){var r,t,n,i,u=e.length,o=[];for(n=u-1;n!==-1;--n){t=e[n];for(i in t){for(i=parseInt(i);i>=o.length;)o[o.length]=0;0!==t[i]&&o[i]++}}var r=o.length,a=Array(r+1);for(a[0]=0,n=0;n<r;++n)a[n+1]=a[n]+o[n];var s=Array(a[r]),l=Array(a[r]);for(n=u-1;n!==-1;--n){t=e[n];for(i in t)0!==t[i]&&(o[i]--,s[a[i]+o[i]]=n,l[a[i]+o[i]]=t[i])}return[a,s,l]},numeric.ccsFull=function(e){var r,t,n,i,u=e[0],o=e[1],a=e[2],s=numeric.ccsDim(e),l=s[0],f=s[1],c=numeric.rep([l,f],0);for(r=0;r<f;r++)for(n=u[r],i=u[r+1],t=n;t<i;++t)c[o[t]][r]=a[t];return c},numeric.ccsTSolve=function(e,r,t,n,i){function u(e){var r;if(0===t[e]){for(t[e]=1,r=o[e];r<o[e+1];++r)u(a[r]);i[c]=e,++c}}var o=e[0],a=e[1],s=e[2],l=o.length-1,f=Math.max,c=0;"undefined"==typeof n&&(t=numeric.rep([l],0)),"undefined"==typeof n&&(n=numeric.linspace(0,t.length-1)),"undefined"==typeof i&&(i=[]);var p,h,m,v,d,g,y;for(p=n.length-1;p!==-1;--p)u(n[p]);for(i.length=c,p=i.length-1;p!==-1;--p)t[i[p]]=0;for(p=n.length-1;p!==-1;--p)h=n[p],t[h]=r[h];for(p=i.length-1;p!==-1;--p){for(h=i[p],m=o[h],v=f(o[h+1],m),d=m;d!==v;++d)if(a[d]===h){t[h]/=s[d];break}for(y=t[h],d=m;d!==v;++d)g=a[d],g!==h&&(t[g]-=y*s[d])}return t},numeric.ccsDFS=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS.prototype.dfs=function(e,r,t,n,i,u){var o,a,s,l=0,f=i.length,c=this.k,p=this.k1,h=this.j;if(0===n[e])for(n[e]=1,h[0]=e,c[0]=a=r[e],p[0]=s=r[e+1];;)if(a>=s){if(i[f]=h[l],0===l)return;++f,--l,a=c[l],s=p[l]}else o=u[t[a]],0===n[o]?(n[o]=1,c[l]=a,++l,h[l]=o,a=r[o],p[l]=s=r[o+1]):++a},numeric.ccsLPSolve=function(e,r,t,n,i,u,o){var a,s,l,f,c,p,h,m,v,d=e[0],g=e[1],y=e[2],b=(d.length-1,r[0]),E=r[1],N=r[2];for(s=b[i],l=b[i+1],n.length=0,a=s;a<l;++a)o.dfs(u[E[a]],d,g,t,n,u);for(a=n.length-1;a!==-1;--a)t[n[a]]=0;for(a=s;a!==l;++a)f=u[E[a]],t[f]=N[a];for(a=n.length-1;a!==-1;--a){for(f=n[a],c=d[f],p=d[f+1],h=c;h<p;++h)if(u[g[h]]===f){t[f]/=y[h];break}for(v=t[f],h=c;h<p;++h)m=u[g[h]],m!==f&&(t[m]-=v*y[h])}return t},numeric.ccsLUP1=function(e,r){var t,n,i,u,o,a,s,l=e[0].length-1,f=[numeric.rep([l+1],0),[],[]],c=[numeric.rep([l+1],0),[],[]],p=f[0],h=f[1],m=f[2],v=c[0],d=c[1],g=c[2],y=numeric.rep([l],0),b=numeric.rep([l],0),E=numeric.ccsLPSolve,N=(Math.max,Math.abs),w=numeric.linspace(0,l-1),x=numeric.linspace(0,l-1),M=new numeric.ccsDFS(l);for("undefined"==typeof r&&(r=1),t=0;t<l;++t){for(E(f,e,y,b,t,x,M),u=-1,o=-1,n=b.length-1;n!==-1;--n)i=b[n],i<=t||(a=N(y[i]),a>u&&(o=i,u=a));for(N(y[t])<r*u&&(n=w[t],u=w[o],w[t]=u,x[u]=t,w[o]=n,x[n]=o,u=y[t],y[t]=y[o],y[o]=u),u=p[t],o=v[t],s=y[t],h[u]=w[t],m[u]=1,++u,n=b.length-1;n!==-1;--n)i=b[n],a=y[i],b[n]=0,y[i]=0,i<=t?(d[o]=i,g[o]=a,++o):(h[u]=w[i],m[u]=a/s,++u);p[t+1]=u,v[t+1]=o}for(n=h.length-1;n!==-1;--n)h[n]=x[h[n]];return{L:f,U:c,P:w,Pinv:x}},numeric.ccsDFS0=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS0.prototype.dfs=function(e,r,t,n,i,u,o){var a,s,l,f=0,c=i.length,p=this.k,h=this.k1,m=this.j;if(0===n[e])for(n[e]=1,m[0]=e,p[0]=s=r[u[e]],h[0]=l=r[u[e]+1];;){if(isNaN(s))throw new Error("Ow!");if(s>=l){if(i[c]=u[m[f]],0===f)return;++c,--f,s=p[f],l=h[f]}else a=t[s],0===n[a]?(n[a]=1,p[f]=s,++f,m[f]=a,a=u[a],s=r[a],h[f]=l=r[a+1]):++s}},numeric.ccsLPSolve0=function(e,r,t,n,i,u,o,a){var s,l,f,c,p,h,m,v,d,g=e[0],y=e[1],b=e[2],E=(g.length-1,r[0]),N=r[1],w=r[2];for(l=E[i],f=E[i+1],n.length=0,s=l;s<f;++s)a.dfs(N[s],g,y,t,n,u,o);for(s=n.length-1;s!==-1;--s)c=n[s],t[o[c]]=0;for(s=l;s!==f;++s)c=N[s],t[c]=w[s];for(s=n.length-1;s!==-1;--s){for(c=n[s],v=o[c],p=g[c],h=g[c+1],m=p;m<h;++m)if(y[m]===v){t[v]/=b[m];break}for(d=t[v],m=p;m<h;++m)t[y[m]]-=d*b[m];t[v]=d}},numeric.ccsLUP0=function(e,r){var t,n,i,u,o,a,s,l=e[0].length-1,f=[numeric.rep([l+1],0),[],[]],c=[numeric.rep([l+1],0),[],[]],p=f[0],h=f[1],m=f[2],v=c[0],d=c[1],g=c[2],y=numeric.rep([l],0),b=numeric.rep([l],0),E=numeric.ccsLPSolve0,N=(Math.max,Math.abs),w=numeric.linspace(0,l-1),x=numeric.linspace(0,l-1),M=new numeric.ccsDFS0(l);for("undefined"==typeof r&&(r=1),t=0;t<l;++t){for(E(f,e,y,b,t,x,w,M),u=-1,o=-1,n=b.length-1;n!==-1;--n)i=b[n],i<=t||(a=N(y[w[i]]),a>u&&(o=i,u=a));for(N(y[w[t]])<r*u&&(n=w[t],u=w[o],w[t]=u,x[u]=t,w[o]=n,x[n]=o),u=p[t],o=v[t],s=y[w[t]],h[u]=w[t],m[u]=1,++u,n=b.length-1;n!==-1;--n)i=b[n],a=y[w[i]],b[n]=0,y[w[i]]=0,i<=t?(d[o]=i,g[o]=a,++o):(h[u]=w[i],m[u]=a/s,++u);p[t+1]=u,v[t+1]=o}for(n=h.length-1;n!==-1;--n)h[n]=x[h[n]];return{L:f,U:c,P:w,Pinv:x}},numeric.ccsLUP=numeric.ccsLUP0,numeric.ccsDim=function(e){return[numeric.sup(e[1])+1,e[0].length-1]},numeric.ccsGetBlock=function(e,r,t){var n=numeric.ccsDim(e),i=n[0],u=n[1];"undefined"==typeof r?r=numeric.linspace(0,i-1):"number"==typeof r&&(r=[r]),"undefined"==typeof t?t=numeric.linspace(0,u-1):"number"==typeof t&&(t=[t]);var o,a,s,l,f,c=r.length,p=t.length,h=numeric.rep([u],0),m=[],v=[],d=[h,m,v],g=e[0],y=e[1],b=e[2],E=numeric.rep([i],0),N=0,w=numeric.rep([i],0);for(a=0;a<p;++a){l=t[a];var x=g[l],M=g[l+1];for(o=x;o<M;++o)s=y[o],w[s]=1,E[s]=b[o];for(o=0;o<c;++o)f=r[o],w[f]&&(m[N]=o,v[N]=E[r[o]],++N);for(o=x;o<M;++o)s=y[o],w[s]=0;h[a+1]=N}return d},numeric.ccsDot=function(e,r){var t,n,i,u,o,a,s,l,f,c,p,h=e[0],m=e[1],v=e[2],d=r[0],g=r[1],y=r[2],b=numeric.ccsDim(e),E=numeric.ccsDim(r),N=b[0],w=(b[1],E[1]),x=numeric.rep([N],0),M=numeric.rep([N],0),I=Array(N),A=numeric.rep([w],0),O=[],_=[],S=[A,O,_];for(i=0;i!==w;++i){for(u=d[i],o=d[i+1],f=0,n=u;n<o;++n)for(c=g[n],p=y[n],a=h[c],s=h[c+1],t=a;t<s;++t)l=m[t],0===M[l]&&(I[f]=l,M[l]=1,f+=1),x[l]=x[l]+v[t]*p;for(u=A[i],o=u+f,A[i+1]=o,n=f-1;n!==-1;--n)p=u+n,t=I[n],O[p]=t,_[p]=x[t],M[t]=0,x[t]=0;A[i+1]=A[i]+f}return S},numeric.ccsLUPSolve=function(e,r){var t=e.L,n=e.U,i=(e.P,r[0]),u=!1;"object"!=typeof i&&(r=[[0,r.length],numeric.linspace(0,r.length-1),r],i=r[0],u=!0);var o,a,s,l,f,c,p=r[1],h=r[2],m=t[0].length-1,v=i.length-1,d=numeric.rep([m],0),g=Array(m),y=numeric.rep([m],0),b=Array(m),E=numeric.rep([v+1],0),N=[],w=[],x=numeric.ccsTSolve,M=0;for(o=0;o<v;++o){for(f=0,s=i[o],l=i[o+1],a=s;a<l;++a)c=e.Pinv[p[a]],b[f]=c,y[c]=h[a],++f;for(b.length=f,x(t,y,d,b,g),a=b.length-1;a!==-1;--a)y[b[a]]=0;if(x(n,d,y,g,b),u)return y;for(a=g.length-1;a!==-1;--a)d[g[a]]=0;for(a=b.length-1;a!==-1;--a)c=b[a],N[M]=c,w[M]=y[c],y[c]=0,++M;E[o+1]=M}return[E,N,w]},numeric.ccsbinop=function(e,r){return"undefined"==typeof r&&(r=""),Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\nvar Yi = Y[0], Yj = Y[1], Yv = Y[2];\nvar n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\nvar Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\nvar x = numeric.rep([m],0),y = numeric.rep([m],0);\nvar xk,yk,zk;\nvar i,j,j0,j1,k,p=0;\n"+r+"for(i=0;i<n;++i) {\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Xj[j];\n x[k] = 1;\n Zj[p] = k;\n ++p;\n }\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Yj[j];\n y[k] = Yv[j];\n if(x[k] === 0) {\n Zj[p] = k;\n ++p;\n }\n }\n Zi[i+1] = p;\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n j0 = Zi[i]; j1 = Zi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Zj[j];\n xk = x[k];\n yk = y[k];\n"+e+"\n Zv[j] = zk;\n }\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n}\nreturn [Zi,Zj,Zv];")},function(){var k,A,B,C;for(k in numeric.ops2)A=isFinite(eval("1"+numeric.ops2[k]+"0"))?"[Y[0],Y[1],numeric."+k+"(X,Y[2])]":"NaN",B=isFinite(eval("0"+numeric.ops2[k]+"1"))?"[X[0],X[1],numeric."+k+"(X[2],Y)]":"NaN",C=isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1"))?"numeric.ccs"+k+"MM(X,Y)":"NaN",numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;"),numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+';\nif(typeof Y === "number") return '+B+";\nreturn "+C+";\n")}(),numeric.ccsScatter=function(e){var r,t=e[0],n=e[1],i=e[2],u=numeric.sup(n)+1,o=t.length,a=numeric.rep([u],0),s=Array(o),l=Array(o),f=numeric.rep([u],0);for(r=0;r<o;++r)f[n[r]]++;for(r=0;r<u;++r)a[r+1]=a[r]+f[r];var c,p,h=a.slice(0);for(r=0;r<o;++r)p=n[r],c=h[p],s[c]=t[r],l[c]=i[r],h[p]=h[p]+1;return[a,s,l]},numeric.ccsGather=function(e){var r,t,n,i,u,o=e[0],a=e[1],s=e[2],l=o.length-1,f=a.length,c=Array(f),p=Array(f),h=Array(f);for(u=0,r=0;r<l;++r)for(n=o[r],i=o[r+1],t=n;t!==i;++t)p[u]=r,c[u]=a[t],h[u]=s[t],++u;return[c,p,h]},numeric.sdim=function e(r,t,n){if("undefined"==typeof t&&(t=[]),"object"!=typeof r)return t;"undefined"==typeof n&&(n=0),n in t||(t[n]=0),r.length>t[n]&&(t[n]=r.length);var i;for(i in r)r.hasOwnProperty(i)&&e(r[i],t,n+1);return t},numeric.sclone=function e(r,t,n){"undefined"==typeof t&&(t=0),"undefined"==typeof n&&(n=numeric.sdim(r).length);var i,u=Array(r.length);if(t===n-1){for(i in r)r.hasOwnProperty(i)&&(u[i]=r[i]);return u}for(i in r)r.hasOwnProperty(i)&&(u[i]=e(r[i],t+1,n));return u},numeric.sdiag=function(e){var r,t,n=e.length,i=Array(n);for(r=n-1;r>=1;r-=2)t=r-1,i[r]=[],i[r][r]=e[r],i[t]=[],i[t][t]=e[t];return 0===r&&(i[0]=[],i[0][0]=e[r]),i},numeric.sidentity=function(e){return numeric.sdiag(numeric.rep([e],1))},numeric.stranspose=function(e){var r,t,n,i=[];e.length;for(r in e)if(e.hasOwnProperty(r)){n=e[r];for(t in n)n.hasOwnProperty(t)&&("object"!=typeof i[t]&&(i[t]=[]),i[t][r]=n[t])}return i},numeric.sLUP=function(e,r){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(e,r){var t,n,i,u,o,a,s,l=e.length,f=(r.length,numeric.stranspose(r)),c=f.length,p=Array(l);for(i=l-1;i>=0;i--){for(s=[],t=e[i],o=c-1;o>=0;o--){a=0,n=f[o];for(u in t)t.hasOwnProperty(u)&&u in n&&(a+=t[u]*n[u]);a&&(s[o]=a)}p[i]=s}return p},numeric.sdotMV=function(e,r){var t,n,i,u,o=e.length,a=Array(o);for(n=o-1;n>=0;n--){
t=e[n],u=0;for(i in t)t.hasOwnProperty(i)&&r[i]&&(u+=t[i]*r[i]);u&&(a[n]=u)}return a},numeric.sdotVM=function(e,r){var t,n,i,u,o=[];for(t in e)if(e.hasOwnProperty(t)){i=r[t],u=e[t];for(n in i)i.hasOwnProperty(n)&&(o[n]||(o[n]=0),o[n]+=u*i[n])}return o},numeric.sdotVV=function(e,r){var t,n=0;for(t in e)e[t]&&r[t]&&(n+=e[t]*r[t]);return n},numeric.sdot=function(e,r){var t=numeric.sdim(e).length,n=numeric.sdim(r).length,i=1e3*t+n;switch(i){case 0:return e*r;case 1001:return numeric.sdotVV(e,r);case 2001:return numeric.sdotMV(e,r);case 1002:return numeric.sdotVM(e,r);case 2002:return numeric.sdotMM(e,r);default:throw new Error("numeric.sdot not implemented for tensors of order "+t+" and "+n)}},numeric.sscatter=function(e){var r,t,n,i,u=e[0].length,o=e.length,a=[];for(t=u-1;t>=0;--t)if(e[o-1][t]){for(i=a,n=0;n<o-2;n++)r=e[n][t],i[r]||(i[r]=[]),i=i[r];i[e[n][t]]=e[n+1][t]}return a},numeric.sgather=function e(r,t,n){"undefined"==typeof t&&(t=[]),"undefined"==typeof n&&(n=[]);var i,u,o;i=n.length;for(u in r)if(r.hasOwnProperty(u))if(n[i]=parseInt(u),o=r[u],"number"==typeof o){if(o){if(0===t.length)for(u=i+1;u>=0;--u)t[u]=[];for(u=i;u>=0;--u)t[u].push(n[u]);t[i+1].push(o)}}else e(o,t,n);return n.length>i&&n.pop(),t},numeric.cLU=function(e){var r,t,n,i,u,o,a=e[0],s=e[1],l=e[2],f=a.length,c=0;for(r=0;r<f;r++)a[r]>c&&(c=a[r]);c++;var p,h,m,v=Array(c),d=Array(c),g=numeric.rep([c],1/0),y=numeric.rep([c],-(1/0));for(n=0;n<f;n++)r=a[n],t=s[n],t<g[r]&&(g[r]=t),t>y[r]&&(y[r]=t);for(r=0;r<c-1;r++)y[r]>y[r+1]&&(y[r+1]=y[r]);for(r=c-1;r>=1;r--)g[r]<g[r-1]&&(g[r-1]=g[r]);var b=0,E=0;for(r=0;r<c;r++)d[r]=numeric.rep([y[r]-g[r]+1],0),v[r]=numeric.rep([r-g[r]],0),b+=r-g[r]+1,E+=y[r]-r+1;for(n=0;n<f;n++)r=a[n],d[r][s[n]-g[r]]=l[n];for(r=0;r<c-1;r++)for(i=r-g[r],p=d[r],t=r+1;g[t]<=r&&t<c;t++)if(u=r-g[t],o=y[r]-r,h=d[t],m=h[u]/p[i]){for(n=1;n<=o;n++)h[n+u]-=m*p[n+i];v[t][r-g[t]]=m}var f,N,w,p=[],h=[],x=[],M=[],I=[],A=[];for(f=0,N=0,r=0;r<c;r++){for(i=g[r],u=y[r],w=d[r],t=r;t<=u;t++)w[t-i]&&(p[f]=r,h[f]=t,x[f]=w[t-i],f++);for(w=v[r],t=i;t<r;t++)w[t-i]&&(M[N]=r,I[N]=t,A[N]=w[t-i],N++);M[N]=r,I[N]=r,A[N]=1,N++}return{U:[p,h,x],L:[M,I,A]}},numeric.cLUsolve=function(e,r){var t,n,i=e.L,u=e.U,o=numeric.clone(r),a=i[0],s=i[1],l=i[2],f=u[0],c=u[1],p=u[2],h=f.length,m=(a.length,o.length);for(n=0,t=0;t<m;t++){for(;s[n]<t;)o[t]-=l[n]*o[s[n]],n++;n++}for(n=h-1,t=m-1;t>=0;t--){for(;c[n]>t;)o[t]-=p[n]*o[c[n]],n--;o[t]/=p[n],n--}return o},numeric.cgrid=function(e,r){"number"==typeof e&&(e=[e,e]);var t,n,i,u=numeric.rep(e,-1);if("function"!=typeof r)switch(r){case"L":r=function(r,t){return r>=e[0]/2||t<e[1]/2};break;default:r=function(e,r){return!0}}for(i=0,t=1;t<e[0]-1;t++)for(n=1;n<e[1]-1;n++)r(t,n)&&(u[t][n]=i,i++);return u},numeric.cdelsq=function(e){var r,t,n,i,u,o=[[-1,0],[0,-1],[0,1],[1,0]],a=numeric.dim(e),s=a[0],l=a[1],f=[],c=[],p=[];for(r=1;r<s-1;r++)for(t=1;t<l-1;t++)if(!(e[r][t]<0)){for(n=0;n<4;n++)i=r+o[n][0],u=t+o[n][1],e[i][u]<0||(f.push(e[r][t]),c.push(e[i][u]),p.push(-1));f.push(e[r][t]),c.push(e[r][t]),p.push(4)}return[f,c,p]},numeric.cdotMV=function(e,r){var t,n,i,u=e[0],o=e[1],a=e[2],s=u.length;for(i=0,n=0;n<s;n++)u[n]>i&&(i=u[n]);for(i++,t=numeric.rep([i],0),n=0;n<s;n++)t[u[n]]+=a[n]*r[o[n]];return t},numeric.Spline=function(e,r,t,n,i){this.x=e,this.yl=r,this.yr=t,this.kl=n,this.kr=i},numeric.Spline.prototype._at=function(e,r){var e,t,n,i,u=this.x,o=this.yl,a=this.yr,s=this.kl,l=this.kr,f=numeric.add,c=numeric.sub,p=numeric.mul;t=c(p(s[r],u[r+1]-u[r]),c(a[r+1],o[r])),n=f(p(l[r+1],u[r]-u[r+1]),c(a[r+1],o[r])),i=(e-u[r])/(u[r+1]-u[r]);var h=i*(1-i);return f(f(f(p(1-i,o[r]),p(i,a[r+1])),p(t,h*(1-i))),p(n,h*i))},numeric.Spline.prototype.at=function(e){if("number"==typeof e){var r,t,n,i=this.x,u=i.length,o=Math.floor;for(r=0,t=u-1;t-r>1;)n=o((r+t)/2),i[n]<=e?r=n:t=n;return this._at(e,r)}var a,u=e.length,s=Array(u);for(a=u-1;a!==-1;--a)s[a]=this.at(e[a]);return s},numeric.Spline.prototype.diff=function(){var e,r,t,n=this.x,i=this.yl,u=this.yr,o=this.kl,a=this.kr,s=i.length,l=o,f=a,c=Array(s),p=Array(s),h=numeric.add,m=numeric.mul,v=numeric.div,d=numeric.sub;for(e=s-1;e!==-1;--e)r=n[e+1]-n[e],t=d(u[e+1],i[e]),c[e]=v(h(m(t,6),m(o[e],-4*r),m(a[e+1],-2*r)),r*r),p[e+1]=v(h(m(t,-6),m(o[e],2*r),m(a[e+1],4*r)),r*r);return new numeric.Spline(n,l,f,c,p)},numeric.Spline.prototype.roots=function(){function e(e){return e*e}var r=[],t=this.x,n=this.yl,i=this.yr,u=this.kl,o=this.kr;"number"==typeof n[0]&&(n=[n],i=[i],u=[u],o=[o]);var a,s,l,f,c,p,h,m,v,d,g,y,b,E,N,w,x,M,I,A,O,_,S,T,C=n.length,R=t.length-1,r=Array(C),P=Math.sqrt;for(a=0;a!==C;++a){for(f=n[a],c=i[a],p=u[a],h=o[a],m=[],s=0;s!==R;s++){for(s>0&&c[s]*f[s]<0&&m.push(t[s]),w=t[s+1]-t[s],x=t[s],g=f[s],y=c[s+1],v=p[s]/w,d=h[s+1]/w,N=e(v-d+3*(g-y))+12*d*g,b=d+3*g+2*v-3*y,E=3*(d+v+2*(g-y)),N<=0?(I=b/E,M=I>t[s]&&I<t[s+1]?[t[s],I,t[s+1]]:[t[s],t[s+1]]):(I=(b-P(N))/E,A=(b+P(N))/E,M=[t[s]],I>t[s]&&I<t[s+1]&&M.push(I),A>t[s]&&A<t[s+1]&&M.push(A),M.push(t[s+1])),_=M[0],I=this._at(_,s),l=0;l<M.length-1;l++)if(S=M[l+1],A=this._at(S,s),0!==I)if(0===A||I*A>0)_=S,I=A;else{for(var D=0;;){if(T=(I*S-A*_)/(I-A),T<=_||T>=S)break;if(O=this._at(T,s),O*A>0)S=T,A=O,D===-1&&(I*=.5),D=-1;else{if(!(O*I>0))break;_=T,I=O,1===D&&(A*=.5),D=1}}m.push(T),_=M[l+1],I=this._at(_,s)}else m.push(_),_=S,I=A;0===A&&m.push(S)}r[a]=m}return"number"==typeof this.yl[0]?r[0]:r},numeric.spline=function(e,r,t,n){var i,u=e.length,o=[],a=[],s=[],l=numeric.sub,f=numeric.mul,c=numeric.add;for(i=u-2;i>=0;i--)a[i]=e[i+1]-e[i],s[i]=l(r[i+1],r[i]);"string"!=typeof t&&"string"!=typeof n||(t=n="periodic");var p=[[],[],[]];switch(typeof t){case"undefined":o[0]=f(3/(a[0]*a[0]),s[0]),p[0].push(0,0),p[1].push(0,1),p[2].push(2/a[0],1/a[0]);break;case"string":o[0]=c(f(3/(a[u-2]*a[u-2]),s[u-2]),f(3/(a[0]*a[0]),s[0])),p[0].push(0,0,0),p[1].push(u-2,0,1),p[2].push(1/a[u-2],2/a[u-2]+2/a[0],1/a[0]);break;default:o[0]=t,p[0].push(0),p[1].push(0),p[2].push(1)}for(i=1;i<u-1;i++)o[i]=c(f(3/(a[i-1]*a[i-1]),s[i-1]),f(3/(a[i]*a[i]),s[i])),p[0].push(i,i,i),p[1].push(i-1,i,i+1),p[2].push(1/a[i-1],2/a[i-1]+2/a[i],1/a[i]);switch(typeof n){case"undefined":o[u-1]=f(3/(a[u-2]*a[u-2]),s[u-2]),p[0].push(u-1,u-1),p[1].push(u-2,u-1),p[2].push(1/a[u-2],2/a[u-2]);break;case"string":p[1][p[1].length-1]=0;break;default:o[u-1]=n,p[0].push(u-1),p[1].push(u-1),p[2].push(1)}o="number"!=typeof o[0]?numeric.transpose(o):[o];var h=Array(o.length);if("string"==typeof t)for(i=h.length-1;i!==-1;--i)h[i]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(p)),o[i]),h[i][u-1]=h[i][0];else for(i=h.length-1;i!==-1;--i)h[i]=numeric.cLUsolve(numeric.cLU(p),o[i]);return h="number"==typeof r[0]?h[0]:numeric.transpose(h),new numeric.Spline(e,r,r,h,h)},numeric.fftpow2=function e(r,t){var n=r.length;if(1!==n){var i,u,o=Math.cos,a=Math.sin,s=Array(n/2),l=Array(n/2),f=Array(n/2),c=Array(n/2);for(u=n/2,i=n-1;i!==-1;--i)--u,f[u]=r[i],c[u]=t[i],--i,s[u]=r[i],l[u]=t[i];e(s,l),e(f,c),u=n/2;var p,h,m,v=-6.283185307179586/n;for(i=n-1;i!==-1;--i)--u,u===-1&&(u=n/2-1),p=v*i,h=o(p),m=a(p),r[i]=s[u]+h*f[u]-m*c[u],t[i]=l[u]+h*c[u]+m*f[u]}},numeric._ifftpow2=function e(r,t){var n=r.length;if(1!==n){var i,u,o=Math.cos,a=Math.sin,s=Array(n/2),l=Array(n/2),f=Array(n/2),c=Array(n/2);for(u=n/2,i=n-1;i!==-1;--i)--u,f[u]=r[i],c[u]=t[i],--i,s[u]=r[i],l[u]=t[i];e(s,l),e(f,c),u=n/2;var p,h,m,v=6.283185307179586/n;for(i=n-1;i!==-1;--i)--u,u===-1&&(u=n/2-1),p=v*i,h=o(p),m=a(p),r[i]=s[u]+h*f[u]-m*c[u],t[i]=l[u]+h*c[u]+m*f[u]}},numeric.ifftpow2=function(e,r){numeric._ifftpow2(e,r),numeric.diveq(e,e.length),numeric.diveq(r,r.length)},numeric.convpow2=function(e,r,t,n){numeric.fftpow2(e,r),numeric.fftpow2(t,n);var i,u,o,a,s,l=e.length;for(i=l-1;i!==-1;--i)u=e[i],a=r[i],o=t[i],s=n[i],e[i]=u*o-a*s,r[i]=u*s+a*o;numeric.ifftpow2(e,r)},numeric.T.prototype.fft=function(){var e,r,t=this.x,n=this.y,i=t.length,u=Math.log,o=u(2),a=Math.ceil(u(2*i-1)/o),s=Math.pow(2,a),l=numeric.rep([s],0),f=numeric.rep([s],0),c=Math.cos,p=Math.sin,h=-3.141592653589793/i,m=numeric.rep([s],0),v=numeric.rep([s],0);Math.floor(i/2);for(e=0;e<i;e++)m[e]=t[e];if("undefined"!=typeof n)for(e=0;e<i;e++)v[e]=n[e];for(l[0]=1,e=1;e<=s/2;e++)r=h*e*e,l[e]=c(r),f[e]=p(r),l[s-e]=c(r),f[s-e]=p(r);var d=new numeric.T(m,v),g=new numeric.T(l,f);return d=d.mul(g),numeric.convpow2(d.x,d.y,numeric.clone(g.x),numeric.neg(g.y)),d=d.mul(g),d.x.length=i,d.y.length=i,d},numeric.T.prototype.ifft=function(){var e,r,t=this.x,n=this.y,i=t.length,u=Math.log,o=u(2),a=Math.ceil(u(2*i-1)/o),s=Math.pow(2,a),l=numeric.rep([s],0),f=numeric.rep([s],0),c=Math.cos,p=Math.sin,h=3.141592653589793/i,m=numeric.rep([s],0),v=numeric.rep([s],0);Math.floor(i/2);for(e=0;e<i;e++)m[e]=t[e];if("undefined"!=typeof n)for(e=0;e<i;e++)v[e]=n[e];for(l[0]=1,e=1;e<=s/2;e++)r=h*e*e,l[e]=c(r),f[e]=p(r),l[s-e]=c(r),f[s-e]=p(r);var d=new numeric.T(m,v),g=new numeric.T(l,f);return d=d.mul(g),numeric.convpow2(d.x,d.y,numeric.clone(g.x),numeric.neg(g.y)),d=d.mul(g),d.x.length=i,d.y.length=i,d.div(i)},numeric.gradient=function(e,r){var t=r.length,n=e(r);if(isNaN(n))throw new Error("gradient: f(x) is a NaN!");var i,u,o,a,s,l,f,c,p,h,m=Math.max,v=numeric.clone(r),d=Array(t),m=(numeric.div,numeric.sub,Math.max),g=.001,y=Math.abs,b=Math.min,E=0;for(i=0;i<t;i++)for(var N=m(1e-6*n,1e-8);;){if(++E,E>20)throw new Error("Numerical gradient fails");if(v[i]=r[i]+N,u=e(v),v[i]=r[i]-N,o=e(v),v[i]=r[i],isNaN(u)||isNaN(o))N/=16;else{if(d[i]=(u-o)/(2*N),s=r[i]-N,l=r[i],f=r[i]+N,c=(u-n)/N,p=(n-o)/N,h=m(y(d[i]),y(n),y(u),y(o),y(s),y(l),y(f),1e-8),a=b(m(y(c-d[i]),y(p-d[i]),y(c-p))/h,N/h),!(a>g))break;N/=16}}return d},numeric.uncmin=function(e,r,t,n,i,u,o){var a=numeric.gradient;"undefined"==typeof o&&(o={}),"undefined"==typeof t&&(t=1e-8),"undefined"==typeof n&&(n=function(r){return a(e,r)}),"undefined"==typeof i&&(i=1e3),r=numeric.clone(r);var s,l,f=r.length,c=e(r);if(isNaN(c))throw new Error("uncmin: f(x0) is a NaN!");var p=Math.max,h=numeric.norm2;t=p(t,numeric.epsilon);var m,v,d,g,y,b,E,N,w,x,M=o.Hinv||numeric.identity(f),I=numeric.dot,A=(numeric.inv,numeric.sub),O=numeric.add,_=numeric.tensor,S=numeric.div,T=numeric.mul,C=numeric.all,R=numeric.isFinite,P=numeric.neg,D=0,j="";for(v=n(r);D<i;){if("function"==typeof u&&u(D,r,c,v,M)){j="Callback returned true";break}if(!C(R(v))){j="Gradient has Infinity or NaN";break}if(m=P(I(M,v)),!C(R(m))){j="Search direction has Infinity or NaN";break}if(x=h(m),x<t){j="Newton step smaller than tol";break}for(w=1,l=I(v,m),y=r;D<i&&!(w*x<t)&&(g=T(m,w),y=O(r,g),s=e(y),s-c>=.1*w*l||isNaN(s));)w*=.5,++D;if(w*x<t){j="Line search step size smaller than tol";break}if(D===i){j="maxit reached during line search";break}d=n(y),b=A(d,v),N=I(b,g),E=I(M,b),M=A(O(M,T((N+I(b,E))/(N*N),_(g,g))),S(O(_(E,g),_(g,E)),N)),r=y,c=s,v=d,++D}return{solution:r,f:c,gradient:v,invHessian:M,iterations:D,message:j}},numeric.Dopri=function(e,r,t,n,i,u,o){this.x=e,this.y=r,this.f=t,this.ymid=n,this.iterations=i,this.events=o,this.message=u},numeric.Dopri.prototype._at=function(e,r){function t(e){return e*e}var n,i,u,o,a,s,e,l,f,c,p,h=this,m=h.x,v=h.y,d=h.f,g=h.ymid,y=(m.length,Math.floor,.5),b=numeric.add,E=numeric.mul,N=numeric.sub;return n=m[r],i=m[r+1],o=v[r],a=v[r+1],l=i-n,u=n+y*l,s=g[r],f=N(d[r],E(o,1/(n-u)+2/(n-i))),c=N(d[r+1],E(a,1/(i-u)+2/(i-n))),p=[t(e-i)*(e-u)/t(n-i)/(n-u),t(e-n)*t(e-i)/t(n-u)/t(i-u),t(e-n)*(e-u)/t(i-n)/(i-u),(e-n)*t(e-i)*(e-u)/t(n-i)/(n-u),(e-i)*t(e-n)*(e-u)/t(n-i)/(i-u)],b(b(b(b(E(o,p[0]),E(s,p[1])),E(a,p[2])),E(f,p[3])),E(c,p[4]))},numeric.Dopri.prototype.at=function(e){var r,t,n,i=Math.floor;if("number"!=typeof e){var u=e.length,o=Array(u);for(r=u-1;r!==-1;--r)o[r]=this.at(e[r]);return o}var a=this.x;for(r=0,t=a.length-1;t-r>1;)n=i(.5*(r+t)),a[n]<=e?r=n:t=n;return this._at(e,r)},numeric.dopri=function(e,r,t,n,i,u,o){"undefined"==typeof i&&(i=1e-6),"undefined"==typeof u&&(u=1e3);var a,s,l,f,c,p,h,m,v,d,g,y,b,E=[e],N=[t],w=[n(e,t)],x=[],M=.2,I=[.075,.225],A=[44/45,-56/15,32/9],O=[19372/6561,-25360/2187,64448/6561,-212/729],_=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],S=[35/384,0,500/1113,125/192,-2187/6784,11/84],T=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,.023904308236133973],C=[.2,.3,.8,8/9,1,1],R=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,.025],P=0,D=(r-e)/10,j=0,k=numeric.add,L=numeric.mul,U=(Math.max,Math.min),V=Math.abs,F=numeric.norminf,B=Math.pow,q=numeric.any,G=numeric.lt,X=numeric.and,Y=(numeric.sub,new numeric.Dopri(E,N,w,x,-1,""));for("function"==typeof o&&(g=o(e,t));e<r&&j<u;)if(++j,e+D>r&&(D=r-e),a=n(e+C[0]*D,k(t,L(M*D,w[P]))),s=n(e+C[1]*D,k(k(t,L(I[0]*D,w[P])),L(I[1]*D,a))),l=n(e+C[2]*D,k(k(k(t,L(A[0]*D,w[P])),L(A[1]*D,a)),L(A[2]*D,s))),f=n(e+C[3]*D,k(k(k(k(t,L(O[0]*D,w[P])),L(O[1]*D,a)),L(O[2]*D,s)),L(O[3]*D,l))),c=n(e+C[4]*D,k(k(k(k(k(t,L(_[0]*D,w[P])),L(_[1]*D,a)),L(_[2]*D,s)),L(_[3]*D,l)),L(_[4]*D,f))),v=k(k(k(k(k(t,L(w[P],D*S[0])),L(s,D*S[2])),L(l,D*S[3])),L(f,D*S[4])),L(c,D*S[5])),p=n(e+D,v),h=k(k(k(k(k(L(w[P],D*R[0]),L(s,D*R[2])),L(l,D*R[3])),L(f,D*R[4])),L(c,D*R[5])),L(p,D*R[6])),d="number"==typeof h?V(h):F(h),d>i){if(D=.2*D*B(i/d,.25),e+D===e){Y.msg="Step size became too small";break}}else{if(x[P]=k(k(k(k(k(k(t,L(w[P],D*T[0])),L(s,D*T[2])),L(l,D*T[3])),L(f,D*T[4])),L(c,D*T[5])),L(p,D*T[6])),++P,E[P]=e+D,N[P]=v,w[P]=p,"function"==typeof o){var H,K,W=e,Q=e+.5*D;if(y=o(Q,x[P-1]),b=X(G(g,0),G(0,y)),q(b)||(W=Q,Q=e+D,g=y,y=o(Q,v),b=X(G(g,0),G(0,y))),q(b)){for(var z,$,Z=0,J=1,ee=1;;){if("number"==typeof g)K=(ee*y*W-J*g*Q)/(ee*y-J*g);else for(K=Q,m=g.length-1;m!==-1;--m)g[m]<0&&y[m]>0&&(K=U(K,(ee*y[m]*W-J*g[m]*Q)/(ee*y[m]-J*g[m])));if(K<=W||K>=Q)break;H=Y._at(K,P-1),$=o(K,H),z=X(G(g,0),G(0,$)),q(z)?(Q=K,y=$,b=z,ee=1,Z===-1?J*=.5:J=1,Z=-1):(W=K,g=$,J=1,1===Z?ee*=.5:ee=1,Z=1)}return v=Y._at(.5*(e+K),P-1),Y.f[P]=n(K,H),Y.x[P]=K,Y.y[P]=H,Y.ymid[P-1]=v,Y.events=b,Y.iterations=j,Y}}e+=D,t=v,g=y,D=U(.8*D*B(i/d,.25),4*D)}return Y.iterations=j,Y},numeric.LU=function(e,r){r=r||!1;var t,n,i,u,o,a,s,l,f,c=Math.abs,p=e.length,h=p-1,m=new Array(p);for(r||(e=numeric.clone(e)),i=0;i<p;++i){for(s=i,a=e[i],f=c(a[i]),n=i+1;n<p;++n)u=c(e[n][i]),f<u&&(f=u,s=n);for(m[i]=s,s!=i&&(e[i]=e[s],e[s]=a,a=e[i]),o=a[i],t=i+1;t<p;++t)e[t][i]/=o;for(t=i+1;t<p;++t){for(l=e[t],n=i+1;n<h;++n)l[n]-=l[i]*a[n],++n,l[n]-=l[i]*a[n];n===h&&(l[n]-=l[i]*a[n])}}return{LU:e,P:m}},numeric.LUsolve=function(e,r){var t,n,i,u,o,a=e.LU,s=a.length,l=numeric.clone(r),f=e.P;for(t=s-1;t!==-1;--t)l[t]=r[t];for(t=0;t<s;++t)for(i=f[t],f[t]!==t&&(o=l[t],l[t]=l[i],l[i]=o),u=a[t],n=0;n<t;++n)l[t]-=l[n]*u[n];for(t=s-1;t>=0;--t){for(u=a[t],n=t+1;n<s;++n)l[t]-=l[n]*u[n];l[t]/=u[t]}return l},numeric.solve=function(e,r,t){return numeric.LUsolve(numeric.LU(e,t),r)},numeric.echelonize=function(e){var r,t,n,i,u,o,a,s,l=numeric.dim(e),f=l[0],c=l[1],p=numeric.identity(f),h=Array(f),m=Math.abs,v=numeric.diveq;for(e=numeric.clone(e),r=0;r<f;++r){for(n=0,u=e[r],o=p[r],t=1;t<c;++t)m(u[n])<m(u[t])&&(n=t);for(h[r]=n,v(o,u[n]),v(u,u[n]),t=0;t<f;++t)if(t!==r){for(a=e[t],s=a[n],i=c-1;i!==-1;--i)a[i]-=u[i]*s;for(a=p[t],i=f-1;i!==-1;--i)a[i]-=o[i]*s}}return{I:p,A:e,P:h}},numeric.__solveLP=function(e,r,t,n,i,u,o){var a,s,l,f,c=numeric.sum,p=(numeric.log,numeric.mul),h=numeric.sub,m=numeric.dot,v=numeric.div,d=numeric.add,g=e.length,y=t.length,b=!1,E=0,N=1,w=(numeric.transpose(r),numeric.svd,numeric.transpose),x=(numeric.leq,Math.sqrt),M=Math.abs,I=(numeric.muleq,numeric.norminf,numeric.any,Math.min),A=numeric.all,O=numeric.gt,_=Array(g),S=Array(y),T=(numeric.rep([y],1),numeric.solve),C=h(t,m(r,u)),R=m(e,e);for(l=E;l<i;++l){var P,D;for(P=y-1;P!==-1;--P)S[P]=v(r[P],C[P]);var j=w(S);for(P=g-1;P!==-1;--P)_[P]=c(j[P]);N=.25*M(R/m(e,_));var k=100*x(R/m(_,_));for((!isFinite(N)||N>k)&&(N=k),f=d(e,p(N,_)),s=m(j,S),P=g-1;P!==-1;--P)s[P][P]+=1;D=T(s,v(f,N),!0);var L=v(C,m(r,D)),U=1;for(P=y-1;P!==-1;--P)L[P]<0&&(U=I(U,-.999*L[P]));if(a=h(u,p(D,U)),C=h(t,m(r,a)),!A(O(C,0)))return{solution:u,message:"",iterations:l};if(u=a,N<n)return{solution:a,message:"",iterations:l};if(o){var V=m(e,f),F=m(r,f);for(b=!0,P=y-1;P!==-1;--P)if(V*F[P]<0){b=!1;break}}else b=!(u[g-1]>=0);if(b)return{solution:a,message:"Unbounded",iterations:l}}return{solution:u,message:"maximum iteration count exceeded",iterations:l}},numeric._solveLP=function(e,r,t,n,i){var u,o=e.length,a=t.length,s=(numeric.sum,numeric.log,numeric.mul,numeric.sub),l=numeric.dot,f=(numeric.div,numeric.add,numeric.rep([o],0).concat([1])),c=numeric.rep([a,1],-1),p=numeric.blockMatrix([[r,c]]),h=t,u=numeric.rep([o],0).concat(Math.max(0,numeric.sup(numeric.neg(t)))+1),m=numeric.__solveLP(f,p,h,n,i,u,!1),v=numeric.clone(m.solution);v.length=o;var d=numeric.inf(s(t,l(r,v)));if(d<0)return{solution:NaN,message:"Infeasible",iterations:m.iterations};var g=numeric.__solveLP(e,r,t,n,i-m.iterations,v,!0);return g.iterations+=m.iterations,g},numeric.solveLP=function(e,r,t,n,i,u,o){if("undefined"==typeof o&&(o=1e3),"undefined"==typeof u&&(u=numeric.epsilon),"undefined"==typeof n)return numeric._solveLP(e,r,t,u,o);var a,s=n.length,l=n[0].length,f=r.length,c=numeric.echelonize(n),p=numeric.rep([l],0),h=c.P,m=[];for(a=h.length-1;a!==-1;--a)p[h[a]]=1;for(a=l-1;a!==-1;--a)0===p[a]&&m.push(a);var v=numeric.getRange,d=numeric.linspace(0,s-1),g=numeric.linspace(0,f-1),y=v(n,d,m),b=v(r,g,h),E=v(r,g,m),N=numeric.dot,w=numeric.sub,x=N(b,c.I),M=w(E,N(x,y)),I=w(t,N(x,i)),A=Array(h.length),O=Array(m.length);for(a=h.length-1;a!==-1;--a)A[a]=e[h[a]];for(a=m.length-1;a!==-1;--a)O[a]=e[m[a]];var _=w(O,N(A,N(c.I,y))),S=numeric._solveLP(_,M,I,u,o),T=S.solution;if(T!==T)return S;var C=N(c.I,w(i,N(y,T))),R=Array(e.length);for(a=h.length-1;a!==-1;--a)R[h[a]]=C[a];for(a=m.length-1;a!==-1;--a)R[m[a]]=T[a];return{solution:R,message:S.message,iterations:S.iterations}},numeric.MPStoLP=function(e){function r(r){throw new Error("MPStoLP: "+r+"\nLine "+t+": "+e[t]+"\nCurrent state: "+a[o]+"\n")}e instanceof String&&e.split("\n");var t,n,i,u,o=0,a=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],s=e.length,l=0,f={},c=[],p=0,h={},m=0,v=[],d=[],g=[];for(t=0;t<s;++t){i=e[t];var y=i.match(/\S*/g),b=[];for(n=0;n<y.length;++n)""!==y[n]&&b.push(y[n]);if(0!==b.length){for(n=0;n<a.length&&i.substr(0,a[n].length)!==a[n];++n);if(n<a.length){if(o=n,1===n&&(u=b[1]),6===n)return{name:u,c:v,A:numeric.transpose(d),b:g,rows:f,vars:h}}else switch(o){case 0:case 1:r("Unexpected line");case 2:switch(b[0]){case"N":0===l?l=b[1]:r("Two or more N rows");break;case"L":f[b[1]]=p,c[p]=1,g[p]=0,++p;break;case"G":f[b[1]]=p,c[p]=-1,g[p]=0,++p;break;case"E":f[b[1]]=p,c[p]=0,g[p]=0,++p;break;default:r("Parse error "+numeric.prettyPrint(b))}break;case 3:h.hasOwnProperty(b[0])||(h[b[0]]=m,v[m]=0,d[m]=numeric.rep([p],0),++m);var E=h[b[0]];for(n=1;n<b.length;n+=2)if(b[n]!==l){var N=f[b[n]];d[E][N]=(c[N]<0?-1:1)*parseFloat(b[n+1])}else v[E]=parseFloat(b[n+1]);break;case 4:for(n=1;n<b.length;n+=2)g[f[b[n]]]=(c[f[b[n]]]<0?-1:1)*parseFloat(b[n+1]);break;case 5:break;case 6:r("Internal error")}}}r("Reached end of file without ENDATA")},numeric.seedrandom={pow:Math.pow,random:Math.random},function(e,r,t,n,i,u,o){function a(e){var r,n,i=this,u=e.length,o=0,a=i.i=i.j=i.m=0;for(i.S=[],i.c=[],u||(e=[u++]);o<t;)i.S[o]=o++;for(o=0;o<t;o++)r=i.S[o],a=f(a+r+e[o%u]),n=i.S[a],i.S[o]=n,i.S[a]=r;i.g=function(e){var r=i.S,n=f(i.i+1),u=r[n],o=f(i.j+u),a=r[o];r[n]=a,r[o]=u;for(var s=r[f(u+a)];--e;)n=f(n+1),u=r[n],o=f(o+u),a=r[o],r[n]=a,r[o]=u,s=s*t+r[f(u+a)];return i.i=n,i.j=o,s},i.g(t)}function s(e,r,t,n,i){if(t=[],i=typeof e,r&&"object"==i)for(n in e)if(n.indexOf("S")<5)try{t.push(s(e[n],r-1))}catch(e){}return t.length?t:e+("string"!=i?"\0":"")}function l(e,r,t,n){for(e+="",t=0,n=0;n<e.length;n++)r[f(n)]=f((t^=19*r[f(n)])+e.charCodeAt(n));e="";for(n in r)e+=String.fromCharCode(r[n]);return e}function f(e){return e&t-1}r.seedrandom=function(f,c){var p,h=[];return f=l(s(c?[f,e]:arguments.length?f:[(new Date).getTime(),e,window],3),h),p=new a(h),l(p.S,e),r.random=function(){for(var e=p.g(n),r=o,a=0;e<i;)e=(e+a)*t,r*=t,a=p.g(1);for(;e>=u;)e/=2,r/=2,a>>>=1;return(e+a)/r},f},o=r.pow(t,n),i=r.pow(2,i),u=2*i,l(r.random(),e)}([],numeric.seedrandom,256,6,52),function(e){function r(e){if("object"!=typeof e)return e;var t,n=[],i=e.length;for(t=0;t<i;t++)n[t+1]=r(e[t]);return n}function t(e){if("object"!=typeof e)return e;var r,n=[],i=e.length;for(r=1;r<i;r++)n[r-1]=t(e[r]);return n}function n(e,r,t){var n,i,u,o,a;for(u=1;u<=t;u+=1){for(e[u][u]=1/e[u][u],a=-e[u][u],n=1;n<u;n+=1)e[n][u]=a*e[n][u];if(o=u+1,t<o)break;for(i=o;i<=t;i+=1)for(a=e[u][i],e[u][i]=0,n=1;n<=u;n+=1)e[n][i]=e[n][i]+a*e[n][u]}}function i(e,r,t,n){var i,u,o,a;for(u=1;u<=t;u+=1){for(a=0,i=1;i<u;i+=1)a+=e[i][u]*n[i];n[u]=(n[u]-a)/e[u][u]}for(o=1;o<=t;o+=1)for(u=t+1-o,n[u]=n[u]/e[u][u],a=-n[u],i=1;i<u;i+=1)n[i]=n[i]+a*e[i][u]}function u(e,r,t,n){var i,u,o,a,s,l;for(u=1;u<=t;u+=1){if(n[1]=u,l=0,o=u-1,o<1){if(l=e[u][u]-l,l<=0)break;e[u][u]=Math.sqrt(l)}else{for(a=1;a<=o;a+=1){for(s=e[a][u],i=1;i<a;i+=1)s-=e[i][u]*e[i][a];s/=e[a][a],e[a][u]=s,l+=s*s}if(l=e[u][u]-l,l<=0)break;e[u][u]=Math.sqrt(l)}n[1]=0}}function o(e,r,t,o,a,s,l,f,c,p,h,m,v,d,g,y){function b(){for(d[1]=d[1]+1,A=P,M=1;M<=p;M+=1){for(A+=1,V=-f[M],I=1;I<=o;I+=1)V+=l[I][M]*a[I];if(Math.abs(V)<K&&(V=0),M>h)g[A]=V;else if(g[A]=-Math.abs(V),V>0){for(I=1;I<=o;I+=1)l[I][M]=-l[I][M];f[M]=-f[M]}}for(M=1;M<=v;M+=1)g[P+m[M]]=0;for(j=0,U=0,M=1;M<=p;M+=1)g[P+M]<U*g[L+M]&&(j=M,U=g[P+M]/g[L+M]);return 0===j?999:0}function E(){for(M=1;M<=o;M+=1){for(V=0,I=1;I<=o;I+=1)V+=e[I][M]*l[I][j];g[M]=V}for(O=T,M=1;M<=o;M+=1)g[O+M]=0;for(I=v+1;I<=o;I+=1)for(M=1;M<=o;M+=1)g[O+M]=g[O+M]+e[M][I]*g[I];for(Y=!0,M=v;M>=1;M-=1){for(V=g[M],A=R+M*(M+3)/2,O=A-M,I=M+1;I<=v;I+=1)V-=g[A]*g[C+I],A+=I;if(V/=g[O],g[C+M]=V,m[M]<h)break;if(V<0)break;Y=!1,S=M}if(!Y)for(F=g[D+S]/g[C+S],M=1;M<=v&&!(m[M]<h)&&!(g[C+M]<0);M+=1)U=g[D+M]/g[C+M],U<F&&(F=U,S=M);for(V=0,M=T+1;M<=T+o;M+=1)V+=g[M]*g[M];if(Math.abs(V)<=K){if(Y)return y[1]=1,999;for(M=1;M<=v;M+=1)g[D+M]=g[D+M]-F*g[C+M];return g[D+v+1]=g[D+v+1]+F,700}for(V=0,M=1;M<=o;M+=1)V+=g[T+M]*l[M][j];for(B=-g[P+j]/V,H=!0,Y||F<B&&(B=F,H=!1),M=1;M<=o;M+=1)a[M]=a[M]+B*g[T+M],Math.abs(a[M])<K&&(a[M]=0);for(s[1]=s[1]+B*V*(B/2+g[D+v+1]),M=1;M<=v;M+=1)g[D+M]=g[D+M]-B*g[C+M];if(g[D+v+1]=g[D+v+1]+B,!H){for(V=-f[j],I=1;I<=o;I+=1)V+=a[I]*l[I][j];if(j>h)g[P+j]=V;else if(g[P+j]=-Math.abs(V),V>0){for(I=1;I<=o;I+=1)l[I][j]=-l[I][j];f[j]=-f[j]}return 700}for(v+=1,m[v]=j,A=R+(v-1)*v/2+1,M=1;M<=v-1;M+=1)g[A]=g[M],A+=1;if(v===o)g[A]=g[o];else{for(M=o;M>=v+1&&0!==g[M]&&(q=Math.max(Math.abs(g[M-1]),Math.abs(g[M])),G=Math.min(Math.abs(g[M-1]),Math.abs(g[M])),U=g[M-1]>=0?Math.abs(q*Math.sqrt(1+G*G/(q*q))):-Math.abs(q*Math.sqrt(1+G*G/(q*q))),q=g[M-1]/U,G=g[M]/U,1!==q);M-=1)if(0===q)for(g[M-1]=G*U,I=1;I<=o;I+=1)U=e[I][M-1],e[I][M-1]=e[I][M],e[I][M]=U;else for(g[M-1]=U,X=G/(1+q),I=1;I<=o;I+=1)U=q*e[I][M-1]+G*e[I][M],e[I][M]=X*(e[I][M-1]+U)-e[I][M],e[I][M-1]=U;g[A]=g[v]}return 0}function N(){if(A=R+S*(S+1)/2+1,O=A+S,0===g[O])return 798;if(q=Math.max(Math.abs(g[O-1]),Math.abs(g[O])),G=Math.min(Math.abs(g[O-1]),Math.abs(g[O])),U=g[O-1]>=0?Math.abs(q*Math.sqrt(1+G*G/(q*q))):-Math.abs(q*Math.sqrt(1+G*G/(q*q))),q=g[O-1]/U,G=g[O]/U,1===q)return 798;if(0===q){for(M=S+1;M<=v;M+=1)U=g[O-1],g[O-1]=g[O],g[O]=U,O+=M;for(M=1;M<=o;M+=1)U=e[M][S],e[M][S]=e[M][S+1],e[M][S+1]=U}else{for(X=G/(1+q),M=S+1;M<=v;M+=1)U=q*g[O-1]+G*g[O],g[O]=X*(g[O-1]+U)-g[O],g[O-1]=U,O+=M;for(M=1;M<=o;M+=1)U=q*e[M][S]+G*e[M][S+1],e[M][S+1]=X*(e[M][S]+U)-e[M][S+1],e[M][S]=U}return 0}function w(){for(O=A-S,M=1;M<=S;M+=1)g[O]=g[A],A+=1,O+=1;return g[D+S]=g[D+S+1],m[S]=m[S+1],S+=1,S<v?797:0}function x(){return g[D+v]=g[D+v+1],g[D+v+1]=0,m[v]=0,v-=1,d[2]=d[2]+1,0}var M,I,A,O,_,S,T,C,R,P,D,j,k,L,U,V,F,B,q,G,X,Y,H,K,W,Q,z;k=Math.min(o,p),A=2*o+k*(k+5)/2+2*p+1,K=1e-60;do K+=K,W=1+.1*K,Q=1+.2*K;while(W<=1||Q<=1);for(M=1;M<=o;M+=1)g[M]=r[M];for(M=o+1;M<=A;M+=1)g[M]=0;for(M=1;M<=p;M+=1)m[M]=0;if(_=[],0===y[1]){if(u(e,t,o,_),0!==_[1])return void(y[1]=2);i(e,t,o,r),n(e,t,o)}else{for(I=1;I<=o;I+=1)for(a[I]=0,M=1;M<=I;M+=1)a[I]=a[I]+e[M][I]*r[M];for(I=1;I<=o;I+=1)for(r[I]=0,M=I;M<=o;M+=1)r[I]=r[I]+e[I][M]*a[M]}for(s[1]=0,I=1;I<=o;I+=1)for(a[I]=r[I],s[1]=s[1]+g[I]*a[I],g[I]=0,M=I+1;M<=o;M+=1)e[M][I]=0;for(s[1]=-s[1]/2,y[1]=0,T=o,C=T+o,D=C+k,R=D+k+1,P=R+k*(k+1)/2,L=P+p,M=1;M<=p;M+=1){for(V=0,I=1;I<=o;I+=1)V+=l[I][M]*l[I][M];g[L+M]=Math.sqrt(V)}for(v=0,d[1]=0,d[2]=0,z=0;;){if(z=b(),999===z)return;for(;;){if(z=E(),0===z)break;if(999===z)return;if(700===z)if(S===v)x();else{for(;;)if(N(),z=w(),797!==z)break;x()}}}}function a(e,n,i,u,a,s){e=r(e),n=r(n),i=r(i);var l,f,c,p,h,m,v=[],d=[],g=[],y=[],b=[];if(a=a||0,s=s?r(s):[void 0,0],u=u?r(u):[],f=e.length-1,c=i[1].length-1,!u)for(l=1;l<=c;l+=1)u[l]=0;for(l=1;l<=c;l+=1)d[l]=0;for(p=0,h=Math.min(f,c),l=1;l<=f;l+=1)g[l]=0;for(v[1]=0,l=1;l<=2*f+h*(h+5)/2+2*c+1;l+=1)y[l]=0;for(l=1;l<=2;l+=1)b[l]=0;return o(e,n,f,f,g,v,i,u,f,c,a,d,p,b,y,s),m="",1===s[1]&&(m="constraints are inconsistent, no solution!"),2===s[1]&&(m="matrix D in quadratic function is not positive definite!"),{solution:t(g),value:t(v),unconstrained_solution:t(n),iterations:t(b),iact:t(d),message:m}}e.solveQP=a}(numeric),numeric.svd=function(e){function r(e,r){return e=Math.abs(e),r=Math.abs(r),e>r?e*Math.sqrt(1+r*r/e/e):0==r?e:r*Math.sqrt(1+e*e/r/r)}var t,n=numeric.epsilon,i=1e-64/n,u=50,o=0,a=0,s=0,l=0,f=0,c=numeric.clone(e),p=c.length,h=c[0].length;if(p<h)throw"Need more rows than columns";var m=new Array(h),v=new Array(h);for(a=0;a<h;a++)m[a]=v[a]=0;var d=numeric.rep([h,h],0),g=0,y=0,b=0,E=0,N=0,w=0,x=0;for(a=0;a<h;a++){for(m[a]=y,x=0,f=a+1,s=a;s<p;s++)x+=c[s][a]*c[s][a];if(x<=i)y=0;else for(g=c[a][a],y=Math.sqrt(x),g>=0&&(y=-y),b=g*y-x,c[a][a]=g-y,s=f;s<h;s++){for(x=0,l=a;l<p;l++)x+=c[l][a]*c[l][s];for(g=x/b,l=a;l<p;l++)c[l][s]+=g*c[l][a]}for(v[a]=y,x=0,s=f;s<h;s++)x+=c[a][s]*c[a][s];if(x<=i)y=0;else{for(g=c[a][a+1],y=Math.sqrt(x),g>=0&&(y=-y),b=g*y-x,c[a][a+1]=g-y,s=f;s<h;s++)m[s]=c[a][s]/b;for(s=f;s<p;s++){for(x=0,l=f;l<h;l++)x+=c[s][l]*c[a][l];for(l=f;l<h;l++)c[s][l]+=x*m[l]}}N=Math.abs(v[a])+Math.abs(m[a]),N>E&&(E=N)}for(a=h-1;a!=-1;a+=-1){if(0!=y){for(b=y*c[a][a+1],s=f;s<h;s++)d[s][a]=c[a][s]/b;for(s=f;s<h;s++){for(x=0,l=f;l<h;l++)x+=c[a][l]*d[l][s];for(l=f;l<h;l++)d[l][s]+=x*d[l][a]}}for(s=f;s<h;s++)d[a][s]=0,d[s][a]=0;d[a][a]=1,y=m[a],f=a}for(a=h-1;a!=-1;a+=-1){for(f=a+1,y=v[a],s=f;s<h;s++)c[a][s]=0;if(0!=y){for(b=c[a][a]*y,s=f;s<h;s++){for(x=0,l=f;l<p;l++)x+=c[l][a]*c[l][s];for(g=x/b,l=a;l<p;l++)c[l][s]+=g*c[l][a]}for(s=a;s<p;s++)c[s][a]=c[s][a]/y}else for(s=a;s<p;s++)c[s][a]=0;c[a][a]+=1}for(n*=E,l=h-1;l!=-1;l+=-1)for(var M=0;M<u;M++){var I=!1;for(f=l;f!=-1;f+=-1){if(Math.abs(m[f])<=n){I=!0;break}if(Math.abs(v[f-1])<=n)break}if(!I){o=0,x=1;var A=f-1;for(a=f;a<l+1&&(g=x*m[a],m[a]=o*m[a],!(Math.abs(g)<=n));a++)for(y=v[a],b=r(g,y),v[a]=b,o=y/b,x=-g/b,s=0;s<p;s++)N=c[s][A],w=c[s][a],c[s][A]=N*o+w*x,c[s][a]=-N*x+w*o}if(w=v[l],f==l){if(w<0)for(v[l]=-w,s=0;s<h;s++)d[s][l]=-d[s][l];break}if(M>=u-1)throw"Error: no convergence.";for(E=v[f],N=v[l-1],y=m[l-1],b=m[l],g=((N-w)*(N+w)+(y-b)*(y+b))/(2*b*N),y=r(g,1),g=g<0?((E-w)*(E+w)+b*(N/(g-y)-b))/E:((E-w)*(E+w)+b*(N/(g+y)-b))/E,o=1,x=1,a=f+1;a<l+1;a++){for(y=m[a],N=v[a],b=x*y,y*=o,w=r(g,b),m[a-1]=w,o=g/w,x=b/w,g=E*o+y*x,y=-E*x+y*o,b=N*x,N*=o,s=0;s<h;s++)E=d[s][a-1],w=d[s][a],d[s][a-1]=E*o+w*x,d[s][a]=-E*x+w*o;for(w=r(g,b),v[a-1]=w,o=g/w,x=b/w,g=o*y+x*N,E=-x*y+o*N,s=0;s<p;s++)N=c[s][a-1],w=c[s][a],c[s][a-1]=N*o+w*x,c[s][a]=-N*x+w*o}m[f]=0,m[l]=g,v[l]=E}for(a=0;a<v.length;a++)v[a]<n&&(v[a]=0);for(a=0;a<h;a++)for(s=a-1;s>=0;s--)if(v[s]<v[a]){for(o=v[s],v[s]=v[a],v[a]=o,l=0;l<c.length;l++)t=c[l][a],c[l][a]=c[l][s],c[l][s]=t;for(l=0;l<d.length;l++)t=d[l][a],d[l][a]=d[l][s],d[l][s]=t;a=s}return{U:c,S:v,V:d}}}).call(exports,function(){return this}())},function(e,r,t){var n,i;/*!
* numeral.js
* version : 1.5.3
* author : Adam Draper
* license : MIT
* http://adamwdraper.github.com/Numeral-js/
*/
(function(){function t(e){this._value=e}function u(e,r,t,n){var i,u,o=Math.pow(10,r);return u=(t(e*o)/o).toFixed(r),n&&(i=new RegExp("0{1,"+n+"}$"),u=u.replace(i,"")),u}function o(e,r,t){var n;return n=r.indexOf("$")>-1?s(e,r,t):r.indexOf("%")>-1?l(e,r,t):r.indexOf(":")>-1?f(e,r):p(e._value,r,t)}function a(e,r){var t,n,i,u,o,a=r,s=["KB","MB","GB","TB","PB","EB","ZB","YB"],l=!1;if(r.indexOf(":")>-1)e._value=c(r);else if(r===E)e._value=0;else{for("."!==y[b].delimiters.decimal&&(r=r.replace(/\./g,"").replace(y[b].delimiters.decimal,".")),t=new RegExp("[^a-zA-Z]"+y[b].abbreviations.thousand+"(?:\\)|(\\"+y[b].currency.symbol+")?(?:\\))?)?$"),n=new RegExp("[^a-zA-Z]"+y[b].abbreviations.million+"(?:\\)|(\\"+y[b].currency.symbol+")?(?:\\))?)?$"),i=new RegExp("[^a-zA-Z]"+y[b].abbreviations.billion+"(?:\\)|(\\"+y[b].currency.symbol+")?(?:\\))?)?$"),u=new RegExp("[^a-zA-Z]"+y[b].abbreviations.trillion+"(?:\\)|(\\"+y[b].currency.symbol+")?(?:\\))?)?$"),o=0;o<=s.length&&!(l=r.indexOf(s[o])>-1&&Math.pow(1024,o+1));o++);e._value=(l?l:1)*(a.match(t)?Math.pow(10,3):1)*(a.match(n)?Math.pow(10,6):1)*(a.match(i)?Math.pow(10,9):1)*(a.match(u)?Math.pow(10,12):1)*(r.indexOf("%")>-1?.01:1)*((r.split("-").length+Math.min(r.split("(").length-1,r.split(")").length-1))%2?1:-1)*Number(r.replace(/[^0-9\.]+/g,"")),e._value=l?Math.ceil(e._value):e._value}return e._value}function s(e,r,t){var n,i,u=r.indexOf("$"),o=r.indexOf("("),a=r.indexOf("-"),s="";return r.indexOf(" $")>-1?(s=" ",r=r.replace(" $","")):r.indexOf("$ ")>-1?(s=" ",r=r.replace("$ ","")):r=r.replace("$",""),i=p(e._value,r,t),u<=1?i.indexOf("(")>-1||i.indexOf("-")>-1?(i=i.split(""),n=1,(u<o||u<a)&&(n=0),i.splice(n,0,y[b].currency.symbol+s),i=i.join("")):i=y[b].currency.symbol+s+i:i.indexOf(")")>-1?(i=i.split(""),i.splice(-1,0,s+y[b].currency.symbol),i=i.join("")):i=i+s+y[b].currency.symbol,i}function l(e,r,t){var n,i="",u=100*e._value;return r.indexOf(" %")>-1?(i=" ",r=r.replace(" %","")):r=r.replace("%",""),n=p(u,r,t),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,i+"%"),n=n.join("")):n=n+i+"%",n}function f(e){var r=Math.floor(e._value/60/60),t=Math.floor((e._value-60*r*60)/60),n=Math.round(e._value-60*r*60-60*t);return r+":"+(t<10?"0"+t:t)+":"+(n<10?"0"+n:n)}function c(e){var r=e.split(":"),t=0;return 3===r.length?(t+=60*Number(r[0])*60,t+=60*Number(r[1]),t+=Number(r[2])):2===r.length&&(t+=60*Number(r[0]),t+=Number(r[1])),Number(t)}function p(e,r,t){var n,i,o,a,s,l,f=!1,c=!1,p=!1,h="",m=!1,v=!1,d=!1,g=!1,N=!1,w="",x="",M=Math.abs(e),I=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],A="",O=!1;if(0===e&&null!==E)return E;if(r.indexOf("(")>-1?(f=!0,r=r.slice(1,-1)):r.indexOf("+")>-1&&(c=!0,r=r.replace(/\+/g,"")),r.indexOf("a")>-1&&(m=r.indexOf("aK")>=0,v=r.indexOf("aM")>=0,d=r.indexOf("aB")>=0,g=r.indexOf("aT")>=0,N=m||v||d||g,r.indexOf(" a")>-1?(h=" ",r=r.replace(" a","")):r=r.replace("a",""),M>=Math.pow(10,12)&&!N||g?(h+=y[b].abbreviations.trillion,e/=Math.pow(10,12)):M<Math.pow(10,12)&&M>=Math.pow(10,9)&&!N||d?(h+=y[b].abbreviations.billion,e/=Math.pow(10,9)):M<Math.pow(10,9)&&M>=Math.pow(10,6)&&!N||v?(h+=y[b].abbreviations.million,e/=Math.pow(10,6)):(M<Math.pow(10,6)&&M>=Math.pow(10,3)&&!N||m)&&(h+=y[b].abbreviations.thousand,e/=Math.pow(10,3))),r.indexOf("b")>-1)for(r.indexOf(" b")>-1?(w=" ",r=r.replace(" b","")):r=r.replace("b",""),o=0;o<=I.length;o++)if(n=Math.pow(1024,o),i=Math.pow(1024,o+1),e>=n&&e<i){w+=I[o],n>0&&(e/=n);break}return r.indexOf("o")>-1&&(r.indexOf(" o")>-1?(x=" ",r=r.replace(" o","")):r=r.replace("o",""),x+=y[b].ordinal(e)),r.indexOf("[.]")>-1&&(p=!0,r=r.replace("[.]",".")),a=e.toString().split(".")[0],s=r.split(".")[1],l=r.indexOf(","),s?(s.indexOf("[")>-1?(s=s.replace("]",""),s=s.split("["),A=u(e,s[0].length+s[1].length,t,s[1].length)):A=u(e,s.length,t),a=A.split(".")[0],A=A.split(".")[1].length?y[b].delimiters.decimal+A.split(".")[1]:"",p&&0===Number(A.slice(1))&&(A="")):a=u(e,null,t),a.indexOf("-")>-1&&(a=a.slice(1),O=!0),l>-1&&(a=a.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+y[b].delimiters.thousands)),0===r.indexOf(".")&&(a=""),(f&&O?"(":"")+(!f&&O?"-":"")+(!O&&c?"+":"")+a+A+(x?x:"")+(h?h:"")+(w?w:"")+(f&&O?")":"")}function h(e,r){y[e]=r}function m(e){var r=e.toString().split(".");return r.length<2?1:Math.pow(10,r[1].length)}function v(){var e=Array.prototype.slice.call(arguments);return e.reduce(function(e,r){var t=m(e),n=m(r);return t>n?t:n},-(1/0))}var d,g="1.5.3",y={},b="en",E=null,N="0,0",w="undefined"!=typeof e&&e.exports;d=function(e){return d.isNumeral(e)?e=e.value():0===e||"undefined"==typeof e?e=0:Number(e)||(e=d.fn.unformat(e)),new t(Number(e))},d.version=g,d.isNumeral=function(e){return e instanceof t},d.language=function(e,r){if(!e)return b;if(e&&!r){if(!y[e])throw new Error("Unknown language : "+e);b=e}return!r&&y[e]||h(e,r),d},d.languageData=function(e){if(!e)return y[b];if(!y[e])throw new Error("Unknown language : "+e);return y[e]},d.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(e){var r=e%10;return 1===~~(e%100/10)?"th":1===r?"st":2===r?"nd":3===r?"rd":"th"},currency:{symbol:"$"}}),d.zeroFormat=function(e){E="string"==typeof e?e:null},d.defaultFormat=function(e){N="string"==typeof e?e:"0.0"},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(e,r){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof e)throw new TypeError(e+" is not a function");var t,n,i=this.length>>>0,u=!1;for(1<arguments.length&&(n=r,u=!0),t=0;i>t;++t)this.hasOwnProperty(t)&&(u?n=e(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}),d.fn=t.prototype={clone:function(){return d(this)},format:function(e,r){return o(this,e?e:N,void 0!==r?r:Math.round)},unformat:function(e){return"[object Number]"===Object.prototype.toString.call(e)?e:a(this,e?e:N)},value:function(){return this._value},valueOf:function(){return this._value},set:function(e){return this._value=Number(e),this},add:function(e){function r(e,r,n,i){return e+t*r}var t=v.call(null,this._value,e);return this._value=[this._value,e].reduce(r,0)/t,this},subtract:function(e){function r(e,r,n,i){return e-t*r}var t=v.call(null,this._value,e);return this._value=[e].reduce(r,this._value*t)/t,this},multiply:function(e){function r(e,r,t,n){var i=v(e,r);return e*i*(r*i)/(i*i)}return this._value=[this._value,e].reduce(r,1),this},divide:function(e){function r(e,r,t,n){var i=v(e,r);return e*i/(r*i)}return this._value=[this._value,e].reduce(r),this},difference:function(e){return Math.abs(d(this._value).subtract(e).value())}},w&&(e.exports=d),"undefined"==typeof ender&&(this.numeral=d),n=[],i=function(){return d}.apply(r,n),!(void 0!==i&&(e.exports=i))}).call(this)},function(e,r){this.j$=this.jStat=function(e,r){function t(r,t){var n=r>t?r:t;return e.pow(10,17-~~(e.log(n>0?n:-n)*e.LOG10E))}function n(e){return"[object Function]"===p.call(e)}function i(e){return"number"==typeof e&&e===e}function u(e){return f.apply([],e)}function o(){return new o._init(arguments)}function a(){return 0}function s(){return 1}function l(e,r){return e===r?1:0}var f=Array.prototype.concat,c=Array.prototype.slice,p=Object.prototype.toString,h=Array.isArray||function(e){return"[object Array]"===p.call(e)};o.fn=o.prototype,o._init=function(e){var r;if(h(e[0]))if(h(e[0][0])){for(n(e[1])&&(e[0]=o.map(e[0],e[1])),r=0;r<e[0].length;r++)this[r]=e[0][r];this.length=e[0].length}else this[0]=n(e[1])?o.map(e[0],e[1]):e[0],this.length=1;else if(i(e[0]))this[0]=o.seq.apply(null,e),this.length=1;else{if(e[0]instanceof o)return o(e[0].toArray());this[0]=[],this.length=1}return this},o._init.prototype=o.prototype,o._init.constructor=o,o.utils={calcRdx:t,isArray:h,isFunction:n,isNumber:i,toVector:u},o.extend=function(e){var r,t;if(1===arguments.length){for(t in e)o[t]=e[t];return this}for(r=1;r<arguments.length;r++)for(t in arguments[r])e[t]=arguments[r][t];return e},o.rows=function(e){return e.length||1},o.cols=function(e){return e[0].length||1},o.dimensions=function(e){return{rows:o.rows(e),cols:o.cols(e)}},o.row=function(e,r){return e[r]},o.col=function(e,r){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=[e[n][r]];return t},o.diag=function(e){for(var r=o.rows(e),t=new Array(r),n=0;n<r;n++)t[n]=[e[n][n]];return t},o.antidiag=function(e){for(var r=o.rows(e)-1,t=new Array(r),n=0;r>=0;r--,n++)t[n]=[e[n][r]];return t},o.transpose=function(e){var r,t,n,i,u,o=[];for(h(e[0])||(e=[e]),t=e.length,n=e[0].length,u=0;u<n;u++){for(r=new Array(t),i=0;i<t;i++)r[i]=e[i][u];o.push(r)}return 1===o.length?o[0]:o},o.map=function(e,r,t){var n,i,u,o,a;for(h(e[0])||(e=[e]),i=e.length,u=e[0].length,o=t?e:new Array(i),n=0;n<i;n++)for(o[n]||(o[n]=new Array(u)),a=0;a<u;a++)o[n][a]=r(e[n][a],n,a);return 1===o.length?o[0]:o},o.alter=function(e,r){return o.map(e,r,!0)},o.create=function(e,r,t){var i,u,o=new Array(e);for(n(r)&&(t=r,r=e),i=0;i<e;i++)for(o[i]=new Array(r),u=0;u<r;u++)o[i][u]=t(i,u);return o},o.zeros=function(e,r){return i(r)||(r=e),o.create(e,r,a)},o.ones=function(e,r){return i(r)||(r=e),o.create(e,r,s)},o.rand=function(r,t){return i(t)||(t=r),o.create(r,t,e.random)},o.identity=function(e,r){return i(r)||(r=e),o.create(e,r,l)},o.symmetric=function(e){var r,t,n=e.length;if(e.length!==e[0].length)return!1;for(r=0;r<n;r++)for(t=0;t<n;t++)if(e[t][r]!==e[r][t])return!1;return!0},o.clear=function(e){return o.alter(e,a)},o.seq=function(e,r,i,u){n(u)||(u=!1);var o,a=[],s=t(e,r),l=(r*s-e*s)/((i-1)*s),f=e;for(o=0;f<=r;o++,f=(e*s+l*s*o)/s)a.push(u?u(f,o):f);return a};var m=o.prototype;return m.length=0,m.push=Array.prototype.push,m.sort=Array.prototype.sort,m.splice=Array.prototype.splice,m.slice=Array.prototype.slice,m.toArray=function(){return this.length>1?c.call(this):c.call(this)[0]},m.map=function(e,r){return o(o.map(this,e,r))},m.alter=function(e){return o.alter(this,e),this},function(e){for(var r=0;r<e.length;r++)(function(e){m[e]=function(r){var t,n=this;return r?(setTimeout(function(){r.call(n,m[e].call(n))}),this):(t=o[e](this),h(t)?o(t):t)}})(e[r])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(e){for(var r=0;r<e.length;r++)(function(e){m[e]=function(r,t){var n=this;return t?(setTimeout(function(){t.call(n,m[e].call(n,r))}),this):o(o[e](this,r))}})(e[r])}("row col".split(" ")),function(e){for(var r=0;r<e.length;r++)(function(e){m[e]=new Function("return jStat(jStat."+e+".apply(null, arguments));")})(e[r])}("create zeros ones rand identity".split(" ")),o}(Math),function(e,r){function t(e,r){return e-r}function n(e,t,n){return r.max(t,r.min(e,n))}var i=e.utils.isFunction;e.sum=function e(r){for(var e=0,t=r.length;--t>=0;)e+=r[t];return e},e.sumsqrd=function(e){for(var r=0,t=e.length;--t>=0;)r+=e[t]*e[t];return r},e.sumsqerr=function(r){for(var t,n=e.mean(r),i=0,u=r.length;--u>=0;)t=r[u]-n,i+=t*t;return i},e.product=function(e){for(var r=1,t=e.length;--t>=0;)r*=e[t];return r},e.min=function(e){for(var r=e[0],t=0;++t<e.length;)e[t]<r&&(r=e[t]);return r},e.max=function(e){for(var r=e[0],t=0;++t<e.length;)e[t]>r&&(r=e[t]);return r},e.mean=function(r){return e.sum(r)/r.length},e.meansqerr=function(r){return e.sumsqerr(r)/r.length},e.geomean=function(t){return r.pow(e.product(t),1/t.length)},e.median=function(e){var r=e.length,n=e.slice().sort(t);return 1&r?n[r/2|0]:(n[r/2-1]+n[r/2])/2},e.cumsum=function(e){var r,t=e.length,n=new Array(t);for(n[0]=e[0],r=1;r<t;r++)n[r]=n[r-1]+e[r];return n},e.diff=function(e){var r,t=[],n=e.length;for(r=1;r<n;r++)t.push(e[r]-e[r-1]);return t},e.mode=function(e){var r,n=e.length,i=e.slice().sort(t),u=1,o=0,a=0,s=[];for(r=0;r<n;r++)i[r]===i[r+1]?u++:(u>o?(s=[i[r]],o=u,a=0):u===o&&(s.push(i[r]),a++),u=1);return 0===a?s[0]:s},e.range=function(r){return e.max(r)-e.min(r)},e.variance=function(r,t){return e.sumsqerr(r)/(r.length-(t?1:0))},e.stdev=function(t,n){return r.sqrt(e.variance(t,n))},e.meandev=function(t){var n,i=0,u=e.mean(t);for(n=t.length-1;n>=0;n--)i+=r.abs(t[n]-u);return i/t.length},e.meddev=function(t){var n,i=0,u=e.median(t);for(n=t.length-1;n>=0;n--)i+=r.abs(t[n]-u);return i/t.length},e.coeffvar=function(r){return e.stdev(r)/e.mean(r)},e.quartiles=function(e){var n=e.length,i=e.slice().sort(t);return[i[r.round(n/4)-1],i[r.round(n/2)-1],i[r.round(3*n/4)-1]]},e.quantiles=function(e,i,u,o){var a,s,l,f,c,p,h=e.slice().sort(t),m=[i.length],v=e.length;for("undefined"==typeof u&&(u=3/8),"undefined"==typeof o&&(o=3/8),a=0;a<i.length;a++)s=i[a],l=u+s*(1-u-o),f=v*s+l,c=r.floor(n(f,1,v-1)),p=n(f-c,0,1),m[a]=(1-p)*h[c-1]+p*h[c];return m},e.percentileOfScore=function(e,r,t){var n,i,u=0,o=e.length,a=!1;for("strict"===t&&(a=!0),i=0;i<o;i++)n=e[i],(a&&n<r||!a&&n<=r)&&u++;return u/o},e.covariance=function(r,t){var n,i=e.mean(r),u=e.mean(t),o=r.length,a=new Array(o);for(n=0;n<o;n++)a[n]=(r[n]-i)*(t[n]-u);return e.sum(a)/(o-1)},e.corrcoeff=function(r,t){return e.covariance(r,t)/e.stdev(r,1)/e.stdev(t,1)};var u=e.prototype;u.cumsum=function(r,t){var n=[],o=0,a=this;if(i(r)&&(t=r,r=!1),t)return setTimeout(function(){t.call(a,u.cumsum.call(a,r))}),this;if(this.length>1){for(a=r===!0?this:this.transpose();o<a.length;o++)n[o]=e.cumsum(a[o]);return n}return e.cumsum(this[0],r)},function(r){for(var t=0;t<r.length;t++)(function(r){u[r]=function(t,n){var o=[],a=0,s=this;if(i(t)&&(n=t,t=!1),n)return setTimeout(function(){n.call(s,u[r].call(s,t))}),this;if(this.length>1){for(s=t===!0?this:this.transpose();a<s.length;a++)o[a]=e[r](s[a]);return t===!0?e[r](e.utils.toVector(o)):o}return e[r](this[0],t)}})(r[t])}("sum sumsqrd sumsqerr product min max mean meansqerr geomean median diff mode range variance stdev meandev meddev coeffvar quartiles".split(" ")),function(r){for(var t=0;t<r.length;t++)(function(r){u[r]=function(){var t=[],n=0,o=this,a=Array.prototype.slice.call(arguments);if(i(a[a.length-1])){var s=a[a.length-1],l=a.slice(0,a.length-1);return setTimeout(function(){s.call(o,u[r].apply(o,l))}),this}var s=void 0,f=function(t){return e[r].apply(o,[t].concat(a))};if(this.length>1){for(o=o.transpose();n<o.length;n++)t[n]=f(o[n]);return t}return f(this[0])}})(r[t])}("quantiles percentileOfScore".split(" "))}(this.jStat,Math),function(e,r){e.gammaln=function(e){var t,n,i,u=0,o=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(i=(n=t=e)+5.5,i-=(t+.5)*r.log(i);u<6;u++)a+=o[u]/++n;return r.log(2.5066282746310007*a/t)-i},e.gammafn=function(e){var t,n,i,u,o=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,l=0,f=0,c=0,p=e;if(p<=0){if(u=p%1+3.6e-16,!u)return 1/0;s=(1&p?-1:1)*r.PI/r.sin(r.PI*u),p=1-p}for(i=p,n=p<1?p++:(p-=l=(0|p)-1)-1,t=0;t<8;++t)c=(c+o[t])*n,f=f*n+a[t];if(u=c/f+1,i<p)u/=i;else if(i>p)for(t=0;t<l;++t)u*=p,p++;return s&&(u=s/u),u},e.gammap=function(t,n){var i,u=e.gammaln(t),o=t,a=1/t,s=a,l=n+1-t,f=1/1e-30,c=1/l,p=c,h=1,m=-~(8.5*r.log(t>=1?t:1/t)+.4*t+17);if(n<0||t<=0)return NaN;if(n<t+1){for(;h<=m;h++)a+=s*=n/++o;return a*r.exp(-n+t*r.log(n)-u)}for(;h<=m;h++)i=-h*(h-t),l+=2,c=i*c+l,f=l+i/f,c=1/c,p*=c*f;return 1-p*r.exp(-n+t*r.log(n)-u)},e.factorialln=function(r){return r<0?NaN:e.gammaln(r+1)},e.factorial=function(r){return r<0?NaN:e.gammafn(r+1)},e.combination=function(t,n){return t>170||n>170?r.exp(e.combinationln(t,n)):e.factorial(t)/e.factorial(n)/e.factorial(t-n)},e.combinationln=function(r,t){return e.factorialln(r)-e.factorialln(t)-e.factorialln(r-t)},e.permutation=function(r,t){return e.factorial(r)/e.factorial(r-t)},e.betafn=function(t,n){if(!(t<=0||n<=0))return t+n>170?r.exp(e.betaln(t,n)):e.gammafn(t)*e.gammafn(n)/e.gammafn(t+n)},e.betaln=function(r,t){return e.gammaln(r)+e.gammaln(t)-e.gammaln(r+t)},e.betacf=function(e,t,n){var i,u,o,a,s=1e-30,l=1,f=t+n,c=t+1,p=t-1,h=1,m=1-f*e/c;for(r.abs(m)<s&&(m=s),m=1/m,a=m;l<=100&&(i=2*l,u=l*(n-l)*e/((p+i)*(t+i)),m=1+u*m,r.abs(m)<s&&(m=s),h=1+u/h,r.abs(h)<s&&(h=s),m=1/m,a*=m*h,u=-(t+l)*(f+l)*e/((t+i)*(c+i)),m=1+u*m,r.abs(m)<s&&(m=s),h=1+u/h,r.abs(h)<s&&(h=s),m=1/m,o=m*h,a*=o,!(r.abs(o-1)<3e-7));l++);return a},e.gammapinv=function(t,n){var i,u,o,a,s,l,f,c=0,p=n-1,h=1e-8,m=e.gammaln(n);if(t>=1)return r.max(100,n+100*r.sqrt(n));if(t<=0)return 0;for(n>1?(l=r.log(p),f=r.exp(p*(l-1)-m),s=t<.5?t:1-t,o=r.sqrt(-2*r.log(s)),i=(2.30753+.27061*o)/(1+o*(.99229+.04481*o))-o,t<.5&&(i=-i),i=r.max(.001,n*r.pow(1-1/(9*n)-i/(3*r.sqrt(n)),3))):(o=1-n*(.253+.12*n),i=t<o?r.pow(t/o,1/n):1-r.log(1-(t-o)/(1-o)));c<12;c++){if(i<=0)return 0;if(u=e.gammap(n,i)-t,o=n>1?f*r.exp(-(i-p)+p*(r.log(i)-l)):r.exp(-i+p*r.log(i)-m),a=u/o,i-=o=a/(1-.5*r.min(1,a*((n-1)/i-1))),i<=0&&(i=.5*(i+o)),r.abs(o)<h*i)break}return i},e.erf=function(e){var t,n,i,u,o=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,3.81e-16,7.106e-15,-1.523e-15,-9.4e-17,1.21e-16,-2.8e-17],a=o.length-1,s=!1,l=0,f=0;for(e<0&&(e=-e,s=!0),t=2/(2+e),n=4*t-2;a>0;a--)i=l,l=n*l-f+o[a],f=i;return u=t*r.exp(-e*e+.5*(o[0]+n*l)-f),s?u-1:1-u},e.erfc=function(r){return 1-e.erf(r)},e.erfcinv=function(t){var n,i,u,o,a=0;if(t>=2)return-100;if(t<=0)return 100;for(o=t<1?t:2-t,u=r.sqrt(-2*r.log(o/2)),n=-.70711*((2.30753+.27061*u)/(1+u*(.99229+.04481*u))-u);a<2;a++)i=e.erfc(n)-o,n+=i/(1.1283791670955126*r.exp(-n*n)-n*i);return t<1?n:-n},e.ibetainv=function(t,n,i){var u,o,a,s,l,f,c,p,h,m,v,d=1e-8,g=n-1,y=i-1,b=0;if(t<=0)return 0;if(t>=1)return 1;for(n>=1&&i>=1?(a=t<.5?t:1-t,s=r.sqrt(-2*r.log(a)),c=(2.30753+.27061*s)/(1+s*(.99229+.04481*s))-s,t<.5&&(c=-c),p=(c*c-3)/6,h=2/(1/(2*n-1)+1/(2*i-1)),m=c*r.sqrt(p+h)/h-(1/(2*i-1)-1/(2*n-1))*(p+5/6-2/(3*h)),c=n/(n+i*r.exp(2*m))):(u=r.log(n/(n+i)),o=r.log(i/(n+i)),s=r.exp(n*u)/n,l=r.exp(i*o)/i,m=s+l,c=t<s/m?r.pow(n*m*t,1/n):1-r.pow(i*m*(1-t),1/i)),v=-e.gammaln(n)-e.gammaln(i)+e.gammaln(n+i);b<10;b++){if(0===c||1===c)return c;if(f=e.ibeta(c,n,i)-t,s=r.exp(g*r.log(c)+y*r.log(1-c)+v),l=f/s,c-=s=l/(1-.5*r.min(1,l*(g/c-y/(1-c)))),c<=0&&(c=.5*(c+s)),c>=1&&(c=.5*(c+s+1)),r.abs(s)<d*c&&b>0)break}return c},e.ibeta=function(t,n,i){var u=0===t||1===t?0:r.exp(e.gammaln(n+i)-e.gammaln(n)-e.gammaln(i)+n*r.log(t)+i*r.log(1-t));return!(t<0||t>1)&&(t<(n+1)/(n+i+2)?u*e.betacf(t,n,i)/n:1-u*e.betacf(1-t,i,n)/i)},e.randn=function(t,n){var i,u,o,a,s;if(n||(n=t),t)return e.create(t,n,function(){return e.randn()});do i=r.random(),u=1.7156*(r.random()-.5),o=i-.449871,a=r.abs(u)+.386595,s=o*o+a*(.196*a-.25472*o);while(s>.27597&&(s>.27846||u*u>-4*r.log(i)*i*i));return u/i},e.randg=function(t,n,i){var u,o,a,s,l,f,c=t;if(i||(i=n),t||(t=1),n)return f=e.zeros(n,i),f.alter(function(){return e.randg(t)}),f;t<1&&(t+=1),u=t-1/3,o=1/r.sqrt(9*u);do{do l=e.randn(),s=1+o*l;while(s<=0);s*=s*s,a=r.random()}while(a>1-.331*r.pow(l,4)&&r.log(a)>.5*l*l+u*(1-s+r.log(s)));if(t==c)return u*s;do a=r.random();while(0===a);return r.pow(a,1/c)*u*s},function(r){for(var t=0;t<r.length;t++)(function(r){e.fn[r]=function(){return e(e.map(this,function(t){return e[r](t)}))}})(r[t])}("gammaln gammafn factorial factorialln".split(" ")),function(r){for(var t=0;t<r.length;t++)(function(r){e.fn[r]=function(){return e(e[r].apply(null,arguments))}})(r[t])}("randn".split(" "))}(this.jStat,Math),function(e,r){!function(r){for(var t=0;t<r.length;t++)(function(r){e[r]=function(e,r,t){return this instanceof arguments.callee?(this._a=e,this._b=r,this._c=t,this):new arguments.callee(e,r,t)},e.fn[r]=function(t,n,i){var u=e[r](t,n,i);return u.data=this,u},e[r].prototype.sample=function(t){var n=this._a,i=this._b,u=this._c;return t?e.alter(t,function(){return e[r].sample(n,i,u)}):e[r].sample(n,i,u)},function(t){for(var n=0;n<t.length;n++)(function(t){e[r].prototype[t]=function(n){var i=this._a,u=this._b,o=this._c;return n||0===n||(n=this.data),"number"!=typeof n?e.fn.map.call(n,function(n){return e[r][t](n,i,u,o)}):e[r][t](n,i,u,o)}})(t[n])}("pdf cdf inv".split(" ")),function(t){for(var n=0;n<t.length;n++)(function(t){e[r].prototype[t]=function(){return e[r][t](this._a,this._b,this._c)}})(t[n])}("mean median mode variance".split(" "))})(r[t])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy lognormal normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular".split(" ")),e.extend(e.beta,{pdf:function(t,n,i){return t>1||t<0?0:1==n&&1==i?1:n<512||i<512?r.pow(t,n-1)*r.pow(1-t,i-1)/e.betafn(n,i):r.exp((n-1)*r.log(t)+(i-1)*r.log(1-t)-e.betaln(n,i))},cdf:function(r,t,n){return r>1||r<0?1*(r>1):e.ibeta(r,t,n)},inv:function(r,t,n){return e.ibetainv(r,t,n)},mean:function(e,r){return e/(e+r)},median:function(e,r){throw new Error("median not yet implemented")},mode:function(e,t){return e*t/(r.pow(e+t,2)*(e+t+1))},sample:function(r,t){var n=e.randg(r);return n/(n+e.randg(t))},variance:function(e,t){return e*t/(r.pow(e+t,2)*(e+t+1))}}),e.extend(e.centralF,{pdf:function(t,n,i){if(!(t<0))return r.sqrt(r.pow(n*t,n)*r.pow(i,i)/r.pow(n*t+i,n+i))/(t*e.betafn(n/2,i/2))},cdf:function(r,t,n){return e.ibeta(t*r/(t*r+n),t/2,n/2)},inv:function(r,t,n){return n/(t*(1/e.ibetainv(r,t/2,n/2)-1))},mean:function(e,r){return r>2?r/(r-2):void 0},mode:function(e,r){return e>2?r*(e-2)/(e*(r+2)):void 0},sample:function(r,t){var n=2*e.randg(r/2),i=2*e.randg(t/2);return n/r/(i/t)},variance:function(e,r){if(!(r<=4))return 2*r*r*(e+r-2)/(e*(r-2)*(r-2)*(r-4))}}),e.extend(e.cauchy,{pdf:function(e,t,n){return n/(r.pow(e-t,2)+r.pow(n,2))/r.PI},cdf:function(e,t,n){return r.atan((e-t)/n)/r.PI+.5},inv:function(e,t,n){return t+n*r.tan(r.PI*(e-.5))},median:function(e,r){return e},mode:function(e,r){return e},sample:function(t,n){return e.randn()*r.sqrt(1/(2*e.randg(.5)))*n+t}}),e.extend(e.chisquare,{pdf:function(t,n){return r.exp((n/2-1)*r.log(t)-t/2-n/2*r.log(2)-e.gammaln(n/2))},cdf:function(r,t){return e.gammap(t/2,r/2)},inv:function(r,t){return 2*e.gammapinv(r,.5*t)},mean:function(e){return e},median:function(e){return e*r.pow(1-2/(9*e),3)},mode:function(e){return e-2>0?e-2:0},sample:function(r){return 2*e.randg(r/2)},variance:function(e){return 2*e}}),e.extend(e.exponential,{pdf:function(e,t){return e<0?0:t*r.exp(-t*e)},cdf:function(e,t){return e<0?0:1-r.exp(-t*e)},inv:function(e,t){return-r.log(1-e)/t},mean:function(e){return 1/e},median:function(e){return 1/e*r.log(2)},mode:function(e){return 0},sample:function(e){return-1/e*r.log(r.random())},variance:function(e){return r.pow(e,-2)}}),e.extend(e.gamma,{pdf:function(t,n,i){return r.exp((n-1)*r.log(t)-t/i-e.gammaln(n)-n*r.log(i))},cdf:function(r,t,n){return e.gammap(t,r/n)},inv:function(r,t,n){return e.gammapinv(r,t)*n},mean:function(e,r){return e*r},mode:function(e,r){if(e>1)return(e-1)*r},sample:function(r,t){return e.randg(r)*t},variance:function(e,r){return e*r*r}}),e.extend(e.invgamma,{pdf:function(t,n,i){return r.exp(-(n+1)*r.log(t)-i/t-e.gammaln(n)+n*r.log(i))},cdf:function(r,t,n){return 1-e.gammap(t,n/r)},inv:function(r,t,n){return n/e.gammapinv(1-r,t)},mean:function(e,r){return e>1?r/(e-1):void 0},mode:function(e,r){return r/(e+1)},sample:function(r,t){return t/e.randg(r)},variance:function(e,r){if(!(e<=2))return r*r/((e-1)*(e-1)*(e-2))}}),e.extend(e.kumaraswamy,{pdf:function(e,t,n){return r.exp(r.log(t)+r.log(n)+(t-1)*r.log(e)+(n-1)*r.log(1-r.pow(e,t)))},cdf:function(e,t,n){return 1-r.pow(1-r.pow(e,t),n)},mean:function(r,t){return t*e.gammafn(1+1/r)*e.gammafn(t)/e.gammafn(1+1/r+t)},median:function(e,t){return r.pow(1-r.pow(2,-1/t),1/e)},mode:function(e,t){if(e>=1&&t>=1&&1!==e&&1!==t)return r.pow((e-1)/(e*t-1),1/e)},variance:function(e,r){throw new Error("variance not yet implemented")}}),e.extend(e.lognormal,{pdf:function(e,t,n){return r.exp(-r.log(e)-.5*r.log(2*r.PI)-r.log(n)-r.pow(r.log(e)-t,2)/(2*n*n))},cdf:function(t,n,i){return.5+.5*e.erf((r.log(t)-n)/r.sqrt(2*i*i))},inv:function(t,n,i){return r.exp(-1.4142135623730951*i*e.erfcinv(2*t)+n)},mean:function(e,t){return r.exp(e+t*t/2)},median:function(e,t){return r.exp(e)},mode:function(e,t){return r.exp(e-t*t)},sample:function(t,n){return r.exp(e.randn()*n+t)},variance:function(e,t){return(r.exp(t*t)-1)*r.exp(2*e+t*t)}}),e.extend(e.normal,{pdf:function(e,t,n){return r.exp(-.5*r.log(2*r.PI)-r.log(n)-r.pow(e-t,2)/(2*n*n))},cdf:function(t,n,i){return.5*(1+e.erf((t-n)/r.sqrt(2*i*i)))},inv:function(r,t,n){return-1.4142135623730951*n*e.erfcinv(2*r)+t},mean:function(e,r){return e},median:function(e,r){return e},mode:function(e,r){return e},sample:function(r,t){return e.randn()*t+r},variance:function(e,r){return r*r}}),e.extend(e.pareto,{pdf:function(e,t,n){if(!(e<=t))return n*r.pow(t,n)/r.pow(e,n+1)},cdf:function(e,t,n){return 1-r.pow(t/e,n)},mean:function(e,t){if(!(t<=1))return t*r.pow(e,t)/(t-1)},median:function(e,t){return e*(t*r.SQRT2)},mode:function(e,r){return e},variance:function(e,t){if(!(t<=2))return e*e*t/(r.pow(t-1,2)*(t-2))}}),e.extend(e.studentt,{pdf:function(t,n){return e.gammafn((n+1)/2)/(r.sqrt(n*r.PI)*e.gammafn(n/2))*r.pow(1+t*t/n,-((n+1)/2))},cdf:function(t,n){var i=n/2;return e.ibeta((t+r.sqrt(t*t+n))/(2*r.sqrt(t*t+n)),i,i)},inv:function(t,n){var i=e.ibetainv(2*r.min(t,1-t),.5*n,.5);return i=r.sqrt(n*(1-i)/i),t>.5?i:-i},mean:function(e){return e>1?0:void 0},median:function(e){return 0},mode:function(e){return 0},sample:function(t){return e.randn()*r.sqrt(t/(2*e.randg(t/2)))},variance:function(e){return e>2?e/(e-2):e>1?1/0:void 0}}),e.extend(e.weibull,{pdf:function(e,t,n){return e<0?0:n/t*r.pow(e/t,n-1)*r.exp(-r.pow(e/t,n))},cdf:function(e,t,n){return e<0?0:1-r.exp(-r.pow(e/t,n))},inv:function(e,t,n){return t*r.pow(-r.log(1-e),1/n)},mean:function(r,t){return r*e.gammafn(1+1/t)},median:function(e,t){return e*r.pow(r.log(2),1/t)},mode:function(e,t){if(!(t<=1))return e*r.pow((t-1)/t,1/t)},sample:function(e,t){return e*r.pow(-r.log(r.random()),1/t)},variance:function(t,n){return t*t*e.gammafn(1+2/n)-r.pow(this.mean(t,n),2)}}),e.extend(e.uniform,{pdf:function(e,r,t){return e<r||e>t?0:1/(t-r)},cdf:function(e,r,t){return e<r?0:e<t?(e-r)/(t-r):1},mean:function(e,r){return.5*(e+r)},median:function(r,t){return e.mean(r,t)},mode:function(e,r){throw new Error("mode is not yet implemented")},sample:function(e,t){return e/2+t/2+(t/2-e/2)*(2*r.random()-1)},variance:function(e,t){return r.pow(t-e,2)/12}}),e.extend(e.binomial,{pdf:function(t,n,i){return 0===i||1===i?n*i===t?1:0:e.combination(n,t)*r.pow(i,t)*r.pow(1-i,n-t)},cdf:function(r,t,n){var i=[],u=0;if(r<0)return 0;if(r<t){for(;u<=r;u++)i[u]=e.binomial.pdf(u,t,n);return e.sum(i)}return 1}}),e.extend(e.negbin,{pdf:function(t,n,i){return!(t!==t|0)&&(t<0?0:e.combination(t+n-1,n-1)*r.pow(1-i,t)*r.pow(i,n))},cdf:function(r,t,n){var i=0,u=0;if(r<0)return 0;for(;u<=r;u++)i+=e.negbin.pdf(u,t,n);return i}}),e.extend(e.hypgeom,{pdf:function(t,n,i,u){if(t!==t|0)return!1;if(t<0||t<i-(n-u))return 0;if(t>u||t>i)return 0;if(2*i>n)return 2*u>n?e.hypgeom.pdf(n-i-u+t,n,n-i,n-u):e.hypgeom.pdf(u-t,n,n-i,u);if(2*u>n)return e.hypgeom.pdf(i-t,n,i,n-u);if(i<u)return e.hypgeom.pdf(t,n,u,i);for(var o=1,a=0,s=0;s<t;s++){for(;o>1&&a<u;)o*=1-i/(n-a),a++;o*=(u-s)*(i-s)/((s+1)*(n-i-u+s+1))}for(;a<u;a++)o*=1-i/(n-a);return r.min(1,r.max(0,o))},cdf:function(t,n,i,u){if(t<0||t<i-(n-u))return 0;if(t>=u||t>=i)return 1;if(2*i>n)return 2*u>n?e.hypgeom.cdf(n-i-u+t,n,n-i,n-u):1-e.hypgeom.cdf(u-t-1,n,n-i,u);if(2*u>n)return 1-e.hypgeom.cdf(i-t-1,n,i,n-u);if(i<u)return e.hypgeom.cdf(t,n,u,i);for(var o=1,a=1,s=0,l=0;l<t;l++){for(;o>1&&s<u;){var f=1-i/(n-s);a*=f,o*=f,s++}a*=(u-l)*(i-l)/((l+1)*(n-i-u+l+1)),o+=a}for(;s<u;s++)o*=1-i/(n-s);return r.min(1,r.max(0,o))}}),e.extend(e.poisson,{pdf:function(t,n){return r.pow(n,t)*r.exp(-n)/e.factorial(t)},cdf:function(r,t){var n=[],i=0;if(r<0)return 0;for(;i<=r;i++)n.push(e.poisson.pdf(i,t));return e.sum(n)},mean:function(e){return e},variance:function(e){return e},sample:function(e){var t=1,n=0,i=r.exp(-e);do n++,t*=r.random();while(t>i);return n-1}}),e.extend(e.triangular,{pdf:function(e,r,t,n){return t<=r||n<r||n>t?void 0:e<r||e>t?0:e<=n?2*(e-r)/((t-r)*(n-r)):2*(t-e)/((t-r)*(t-n))},cdf:function(e,t,n,i){if(!(n<=t||i<t||i>n))return e<t?0:e<=i?r.pow(e-t,2)/((n-t)*(i-t)):1-r.pow(n-e,2)/((n-t)*(n-i))},mean:function(e,r,t){return(e+r+t)/3},median:function(e,t,n){return n<=(e+t)/2?t-r.sqrt((t-e)*(t-n))/r.sqrt(2):n>(e+t)/2?e+r.sqrt((t-e)*(n-e))/r.sqrt(2):void 0},mode:function(e,r,t){return t},sample:function(e,t,n){var i=r.random();return i<(n-e)/(t-e)?e+r.sqrt(i*(t-e)*(n-e)):t-r.sqrt((1-i)*(t-e)*(t-n))},variance:function(e,r,t){return(e*e+r*r+t*t-e*r-e*t-r*t)/18}})}(this.jStat,Math),function(e,r){var t=Array.prototype.push,n=e.utils.isArray;e.extend({add:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(e,r,n){return e+t[r][n]})):e.map(r,function(e){return e+t})},subtract:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.map(r,function(e,r,n){return e-t[r][n]||0})):e.map(r,function(e){return e-t})},divide:function(r,t){return n(t)?(n(t[0])||(t=[t]),e.multiply(r,e.inv(t))):e.map(r,function(e){return e/t})},multiply:function(r,t){var i,u,o,a,s=r.length,l=r[0].length,f=e.zeros(s,o=n(t)?t[0].length:l),c=0;if(n(t)){for(;c<o;c++)for(i=0;i<s;i++){for(a=0,u=0;u<l;u++)a+=r[i][u]*t[u][c];f[i][c]=a}return 1===s&&1===c?f[0][0]:f}return e.map(r,function(e){return e*t})},dot:function(r,t){n(r[0])||(r=[r]),n(t[0])||(t=[t]);for(var i,u,o=1===r[0].length&&1!==r.length?e.transpose(r):r,a=1===t[0].length&&1!==t.length?e.transpose(t):t,s=[],l=0,f=o.length,c=o[0].length;l<f;l++){for(s[l]=[],i=0,u=0;u<c;u++)i+=o[l][u]*a[l][u];s[l]=i}return 1===s.length?s[0]:s},pow:function(t,n){return e.map(t,function(e){return r.pow(e,n)})},abs:function(t){return e.map(t,function(e){return r.abs(e)})},norm:function(e,t){var i=0,u=0;for(isNaN(t)&&(t=2),n(e[0])&&(e=e[0]);u<e.length;u++)i+=r.pow(r.abs(e[u]),t);return r.pow(i,1/t)},angle:function(t,n){return r.acos(e.dot(t,n)/(e.norm(t)*e.norm(n)))},aug:function(e,r){for(var n=e.slice(),i=0;i<n.length;i++)t.apply(n[i],r[i]);return n},inv:function(r){for(var t,n=r.length,i=r[0].length,u=e.identity(n,i),o=e.gauss_jordan(r,u),a=[],s=0;s<n;s++)for(a[s]=[],t=i-1;t<o[0].length;t++)a[s][t-i]=o[s][t];return a},det:function(e){var r,t=e.length,n=2*t,i=new Array(n),u=t-1,o=n-1,a=u-t+1,s=o,l=0,f=0;if(2===t)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(;l<n;l++)i[l]=1;for(l=0;l<t;l++){for(r=0;r<t;r++)i[a<0?a+t:a]*=e[l][r],i[s<t?s+t:s]*=e[l][r],a++,s--;a=--u-t+1,s=--o}for(l=0;l<t;l++)f+=i[l];for(;l<n;l++)f-=i[l];return f},gauss_elimination:function(t,n){var i,u,o,a,s=0,l=0,f=t.length,c=t[0].length,p=1,h=0,m=[];for(t=e.aug(t,n),i=t[0].length;s<f;s++){for(u=t[s][s],l=s,a=s+1;a<c;a++)u<r.abs(t[a][s])&&(u=t[a][s],l=a);if(l!=s)for(a=0;a<i;a++)o=t[s][a],t[s][a]=t[l][a],t[l][a]=o;for(l=s+1;l<f;l++)for(p=t[l][s]/t[s][s],a=s;a<i;a++)t[l][a]=t[l][a]-p*t[s][a]}for(s=f-1;s>=0;s--){for(h=0,l=s+1;l<=f-1;l++)h=m[l]*t[s][l];m[s]=(t[s][i-1]-h)/t[s][s]}return m},gauss_jordan:function(t,n){for(var i=e.aug(t,n),u=i.length,o=i[0].length,a=0;a<u;a++){for(var s=a,l=a+1;l<u;l++)r.abs(i[l][a])>r.abs(i[s][a])&&(s=l);var f=i[a];i[a]=i[s],i[s]=f;for(var l=a+1;l<u;l++){c=i[l][a]/i[a][a];for(var p=a;p<o;p++)i[l][p]-=i[a][p]*c}}for(var a=u-1;a>=0;a--){c=i[a][a];for(var l=0;l<a;l++)for(var p=o-1;p>a-1;p--)i[l][p]-=i[a][p]*i[l][a]/c;i[a][a]/=c;for(var p=u;p<o;p++)i[a][p]/=c}return i},lu:function(e,r){throw new Error("lu not yet implemented")},cholesky:function(e,r){throw new Error("cholesky not yet implemented")},gauss_jacobi:function(t,n,i,u){for(var o,a,s,l,f=0,c=0,p=t.length,h=[],m=[],v=[];f<p;f++)for(h[f]=[],m[f]=[],v[f]=[],c=0;c<p;c++)f>c?(h[f][c]=t[f][c],m[f][c]=v[f][c]=0):f<c?(m[f][c]=t[f][c],h[f][c]=v[f][c]=0):(v[f][c]=t[f][c],
h[f][c]=m[f][c]=0);for(s=e.multiply(e.multiply(e.inv(v),e.add(h,m)),-1),a=e.multiply(e.inv(v),n),o=i,l=e.add(e.multiply(s,i),a),f=2;r.abs(e.norm(e.subtract(l,o)))>u;)o=l,l=e.add(e.multiply(s,o),a),f++;return l},gauss_seidel:function(t,n,i,u){for(var o,a,s,l,f,c=0,p=t.length,h=[],m=[],v=[];c<p;c++)for(h[c]=[],m[c]=[],v[c]=[],o=0;o<p;o++)c>o?(h[c][o]=t[c][o],m[c][o]=v[c][o]=0):c<o?(m[c][o]=t[c][o],h[c][o]=v[c][o]=0):(v[c][o]=t[c][o],h[c][o]=m[c][o]=0);for(l=e.multiply(e.multiply(e.inv(e.add(v,h)),m),-1),s=e.multiply(e.inv(e.add(v,h)),n),a=i,f=e.add(e.multiply(l,i),s),c=2;r.abs(e.norm(e.subtract(f,a)))>u;)a=f,f=e.add(e.multiply(l,a),s),c+=1;return f},SOR:function(t,n,i,u,o){for(var a,s,l,f,c,p=0,h=t.length,m=[],v=[],d=[];p<h;p++)for(m[p]=[],v[p]=[],d[p]=[],a=0;a<h;a++)p>a?(m[p][a]=t[p][a],v[p][a]=d[p][a]=0):p<a?(v[p][a]=t[p][a],m[p][a]=d[p][a]=0):(d[p][a]=t[p][a],m[p][a]=v[p][a]=0);for(f=e.multiply(e.inv(e.add(d,e.multiply(m,o))),e.subtract(e.multiply(d,1-o),e.multiply(v,o))),l=e.multiply(e.multiply(e.inv(e.add(d,e.multiply(m,o))),n),o),s=i,c=e.add(e.multiply(f,i),l),p=2;r.abs(e.norm(e.subtract(c,s)))>u;)s=c,c=e.add(e.multiply(f,s),l),p++;return c},householder:function(t){for(var n,i,u,o,a,s=t.length,l=t[0].length,f=0,c=[],p=[];f<s-1;f++){for(n=0,o=f+1;o<l;o++)n+=t[o][f]*t[o][f];for(a=t[f+1][f]>0?-1:1,n=a*r.sqrt(n),i=r.sqrt((n*n-t[f+1][f]*n)/2),c=e.zeros(s,1),c[f+1][0]=(t[f+1][f]-n)/(2*i),u=f+2;u<s;u++)c[u][0]=t[u][f]/(2*i);p=e.subtract(e.identity(s,l),e.multiply(e.multiply(c,e.transpose(c)),2)),t=e.multiply(p,e.multiply(t,p))}return t},QR:function(t,n){for(var i,u,o,a,s,l,f=t.length,c=t[0].length,p=0,h=[],m=[],v=[];p<f-1;p++){for(u=0,i=p+1;i<c;i++)u+=t[i][p]*t[i][p];for(s=t[p+1][p]>0?-1:1,u=s*r.sqrt(u),o=r.sqrt((u*u-t[p+1][p]*u)/2),h=e.zeros(f,1),h[p+1][0]=(t[p+1][p]-u)/(2*o),a=p+2;a<f;a++)h[a][0]=t[a][p]/(2*o);m=e.subtract(e.identity(f,c),e.multiply(e.multiply(h,e.transpose(h)),2)),t=e.multiply(m,t),n=e.multiply(m,n)}for(p=f-1;p>=0;p--){for(l=0,i=p+1;i<=c-1;i++)l=v[i]*t[p][i];v[p]=n[p][0]/t[p][p]}return v},jacobi:function(t){for(var n,i,u,o,a,s,l,f,c=1,p=0,h=t.length,m=e.identity(h,h),v=[];1===c;){for(p++,s=t[0][1],o=0,a=1,i=0;i<h;i++)for(u=0;u<h;u++)i!=u&&s<r.abs(t[i][u])&&(s=r.abs(t[i][u]),o=i,a=u);for(l=t[o][o]===t[a][a]?t[o][a]>0?r.PI/4:-r.PI/4:r.atan(2*t[o][a]/(t[o][o]-t[a][a]))/2,f=e.identity(h,h),f[o][o]=r.cos(l),f[o][a]=-r.sin(l),f[a][o]=r.sin(l),f[a][a]=r.cos(l),m=e.multiply(m,f),n=e.multiply(e.multiply(e.inv(f),t),f),t=n,c=0,i=1;i<h;i++)for(u=1;u<h;u++)i!=u&&r.abs(t[i][u])>.001&&(c=1)}for(i=0;i<h;i++)v.push(t[i][i]);return[m,v]},rungekutta:function(e,r,t,n,i,u){var o,a,s,l,f;if(2===u)for(;n<=t;)o=r*e(n,i),a=r*e(n+r,i+o),s=i+(o+a)/2,i=s,n+=r;if(4===u)for(;n<=t;)o=r*e(n,i),a=r*e(n+r/2,i+o/2),l=r*e(n+r/2,i+a/2),f=r*e(n+r,i+l),s=i+(o+2*a+2*l+f)/6,i=s,n+=r;return i},romberg:function(e,t,n,i){for(var u,o,a,s,l,f=0,c=(n-t)/2,p=[],h=[],m=[];f<i/2;){for(l=e(t),a=t,s=0;a<=n;a+=c,s++)p[s]=a;for(u=p.length,a=1;a<u-1;a++)l+=(a%2!==0?4:2)*e(p[a]);l=c/3*(l+e(n)),m[f]=l,c/=2,f++}for(o=m.length,u=1;1!==o;){for(a=0;a<o-1;a++)h[a]=(r.pow(4,u)*m[a+1]-m[a])/(r.pow(4,u)-1);o=h.length,m=h,h=[],u++}return m},richardson:function(e,t,n,i){function u(e,r){for(var t,n=0,i=e.length;n<i;n++)e[n]===r&&(t=n);return t}for(var o,a,s,l,f,c=(e.length,r.abs(n-e[u(e,n)+1])),p=0,h=[],m=[];i>=c;)o=u(e,n+i),a=u(e,n),h[p]=(t[o]-2*t[a]+t[2*a-o])/(i*i),i/=2,p++;for(l=h.length,s=1;1!=l;){for(f=0;f<l-1;f++)m[f]=(r.pow(4,s)*h[f+1]-h[f])/(r.pow(4,s)-1);l=m.length,h=m,m=[],s++}return h},simpson:function(e,r,t,n){for(var i,u=(t-r)/n,o=e(r),a=[],s=r,l=0,f=1;s<=t;s+=u,l++)a[l]=s;for(i=a.length;f<i-1;f++)o+=(f%2!==0?4:2)*e(a[f]);return u/3*(o+e(t))},hermite:function(e,r,t,n){for(var i,u=e.length,o=0,a=0,s=[],l=[],f=[],c=[];a<u;a++){for(s[a]=1,i=0;i<u;i++)a!=i&&(s[a]*=(n-e[i])/(e[a]-e[i]));for(l[a]=0,i=0;i<u;i++)a!=i&&(l[a]+=1/(e[a]-e[i]));f[a]=(1-2*(n-e[a])*l[a])*(s[a]*s[a]),c[a]=(n-e[a])*(s[a]*s[a]),o+=f[a]*r[a]+c[a]*t[a]}return o},lagrange:function(e,r,t){for(var n,i,u=0,o=0,a=e.length;o<a;o++){for(i=r[o],n=0;n<a;n++)o!=n&&(i*=(t-e[n])/(e[o]-e[n]));u+=i}return u},cubic_spline:function(r,t,n){for(var i,u=r.length,o=0,a=[],s=[],l=[],f=[],c=[],p=[],h=[];o<u-1;o++)c[o]=r[o+1]-r[o];for(l[0]=0,o=1;o<u-1;o++)l[o]=3/c[o]*(t[o+1]-t[o])-3/c[o-1]*(t[o]-t[o-1]);for(o=1;o<u-1;o++)a[o]=[],s[o]=[],a[o][o-1]=c[o-1],a[o][o]=2*(c[o-1]+c[o]),a[o][o+1]=c[o],s[o][0]=l[o];for(f=e.multiply(e.inv(a),s),i=0;i<u-1;i++)p[i]=(t[i+1]-t[i])/c[i]-c[i]*(f[i+1][0]+2*f[i][0])/3,h[i]=(f[i+1][0]-f[i][0])/(3*c[i]);for(i=0;i<u&&!(r[i]>n);i++);return i-=1,t[i]+(n-r[i])*p[i]+e.sq(n-r[i])*f[i]+(n-r[i])*e.sq(n-r[i])*h[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(r){var t,n,i=r.length,u=r[0].length,o=0,a=[],s=[],l=[],f=[],c=[],p=[],h=[],m=[],v=[],d=[];for(o=0;o<i;o++)a[o]=e.sum(r[o])/u;for(o=0;o<u;o++)for(h[o]=[],t=0;t<i;t++)h[o][t]=r[t][o]-a[t];for(h=e.transpose(h),o=0;o<i;o++)for(m[o]=[],t=0;t<i;t++)m[o][t]=e.dot([h[o]],[h[t]])/(u-1);for(l=e.jacobi(m),v=l[0],s=l[1],d=e.transpose(v),o=0;o<s.length;o++)for(t=o;t<s.length;t++)s[o]<s[t]&&(n=s[o],s[o]=s[t],s[t]=n,f=d[o],d[o]=d[t],d[t]=f);for(p=e.transpose(h),o=0;o<i;o++)for(c[o]=[],t=0;t<p.length;t++)c[o][t]=e.dot([d[o]],[p[t]]);return[r,s,d,c]}}),function(r){for(var t=0;t<r.length;t++)(function(r){e.fn[r]=function(t,n){var i=this;return n?(setTimeout(function(){n.call(i,e.fn[r].call(i,t))},15),this):"number"==typeof e[r](this,t)?e[r](this,t):e(e[r](this,t))}})(r[t])}("add divide multiply subtract dot pow abs norm angle".split(" "))}(this.jStat,Math),function(e,r){var t=[].slice,n=e.utils.isNumber;e.extend({zscore:function(){var r=t.call(arguments);return n(r[1])?(r[0]-r[1])/r[2]:(r[0]-e.mean(r[1]))/e.stdev(r[1],r[2])},ztest:function(){var i=t.call(arguments);if(4===i.length){if(n(i[1])){var u=e.zscore(i[0],i[1],i[2]);return 1===i[3]?e.normal.cdf(-r.abs(u),0,1):2*e.normal.cdf(-r.abs(u),0,1)}var u=i[0];return 1===i[2]?e.normal.cdf(-r.abs(u),0,1):2*e.normal.cdf(-r.abs(u),0,1)}var u=e.zscore(i[0],i[1],i[3]);return 1===i[1]?e.normal.cdf(-r.abs(u),0,1):2*e.normal.cdf(-r.abs(u),0,1)}}),e.extend(e.fn,{zscore:function(e,r){return(e-this.mean())/this.stdev(r)},ztest:function(t,n,i){var u=r.abs(this.zscore(t,i));return 1===n?e.normal.cdf(-u,0,1):2*e.normal.cdf(-u,0,1)}}),e.extend({tscore:function(){var n=t.call(arguments);return 4===n.length?(n[0]-n[1])/(n[2]/r.sqrt(n[3])):(n[0]-e.mean(n[1]))/(e.stdev(n[1],!0)/r.sqrt(n[1].length))},ttest:function(){var i,u=t.call(arguments);return 5===u.length?(i=r.abs(e.tscore(u[0],u[1],u[2],u[3])),1===u[4]?e.studentt.cdf(-i,u[3]-1):2*e.studentt.cdf(-i,u[3]-1)):n(u[1])?(i=r.abs(u[0]),1==u[2]?e.studentt.cdf(-i,u[1]-1):2*e.studentt.cdf(-i,u[1]-1)):(i=r.abs(e.tscore(u[0],u[1])),1==u[2]?e.studentt.cdf(-i,u[1].length-1):2*e.studentt.cdf(-i,u[1].length-1))}}),e.extend(e.fn,{tscore:function(e){return(e-this.mean())/(this.stdev(!0)/r.sqrt(this.cols()))},ttest:function(t,n){return 1===n?1-e.studentt.cdf(r.abs(this.tscore(t)),this.cols()-1):2*e.studentt.cdf(-r.abs(this.tscore(t)),this.cols()-1)}}),e.extend({anovafscore:function(){var n,i,u,o,a,s,l,f,c=t.call(arguments);if(1===c.length){for(a=new Array(c[0].length),l=0;l<c[0].length;l++)a[l]=c[0][l];c=a}if(2===c.length)return e.variance(c[0])/e.variance(c[1]);for(i=new Array,l=0;l<c.length;l++)i=i.concat(c[l]);for(u=e.mean(i),n=0,l=0;l<c.length;l++)n+=c[l].length*r.pow(e.mean(c[l])-u,2);for(n/=c.length-1,s=0,l=0;l<c.length;l++)for(o=e.mean(c[l]),f=0;f<c[l].length;f++)s+=r.pow(c[l][f]-o,2);return s/=i.length-c.length,n/s},anovaftest:function(){var r,i,u,o,a=t.call(arguments);if(n(a[0]))return 1-e.centralF.cdf(a[0],a[1],a[2]);for(anovafscore=e.anovafscore(a),r=a.length-1,u=0,o=0;o<a.length;o++)u+=a[o].length;return i=u-r-1,1-e.centralF.cdf(anovafscore,r,i)},ftest:function(r,t,n){return 1-e.centralF.cdf(r,t,n)}}),e.extend(e.fn,{anovafscore:function(){return e.anovafscore(this.toArray())},anovaftes:function(){var r,t=0;for(r=0;r<this.length;r++)t+=this[r].length;return e.ftest(this.anovafscore(),this.length-1,t-this.length)}}),e.extend({normalci:function(){var n,i=t.call(arguments),u=new Array(2);return n=4===i.length?r.abs(e.normal.inv(i[1]/2,0,1)*i[2]/r.sqrt(i[3])):r.abs(e.normal.inv(i[1]/2,0,1)*e.stdev(i[2])/r.sqrt(i[2].length)),u[0]=i[0]-n,u[1]=i[0]+n,u},tci:function(){var n,i=t.call(arguments),u=new Array(2);return n=4===i.length?r.abs(e.studentt.inv(i[1]/2,i[3]-1)*i[2]/r.sqrt(i[3])):r.abs(e.studentt.inv(i[1]/2,i[2].length-1)*e.stdev(i[2],!0)/r.sqrt(i[2].length)),u[0]=i[0]-n,u[1]=i[0]+n,u},significant:function(e,r){return e<r}}),e.extend(e.fn,{normalci:function(r,t){return e.normalci(r,t,this.toArray())},tci:function(r,t){return e.tci(r,t,this.toArray())}})}(this.jStat,Math)},function(e,r,t){"use strict";function n(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function i(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}function u(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.CellRange=r.CellReference=void 0;var o=function e(r,t,n){null===r&&(r=Function.prototype);var i=Object.getOwnPropertyDescriptor(r,t);if(void 0===i){var u=Object.getPrototypeOf(r);return null===u?void 0:e(u,t,n)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(n)},a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(20),l=r.CellReference=function(){function e(r,t){u(this,e),this.cellID=r,this.sheet=t}return a(e,[{key:"run",value:function(){return this.sheet.getCalculatedValueAtID(this.cellID)}},{key:"adjust",value:function(r,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=(0,s.adjustCellID)(this.cellID,r,t,this.pinRow,this.pinCol),a=o.cellID;o.rawCellID;if(1!==n||1!==i||u){var l=(0,s.adjustCellID)(a,n-1,i-1),c=l.cellID;return new f(a,c,this.sheet)}return new e(a,this.sheet)}},{key:"toString",value:function(){return this.cellID}}]),e}(),f=r.CellRange=function(e){function r(e,t,i){u(this,r);var o=n(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e,i));o.endCellID=t;var a=(0,s.getCellPos)(e),l=a.row,f=a.col,c=(0,s.getCellPos)(t),p=c.row,h=c.col;return o.width=Math.abs(h-f),o.height=Math.abs(p-l),o}return i(r,e),a(r,[{key:"run",value:function(){for(var e=(0,s.getCellPos)(this.cellID),r=(0,s.getCellPos)(this.endCellID),t=Math.min(e.row,r.row),n=Math.max(e.row,r.row),i=Math.min(e.col,r.col),u=Math.max(e.col,r.col),o=[],a=t;a<=n;a++){for(var l=[],f=i;f<=u;f++)l.push(this.sheet.getCalculatedValueAtPos(a,f));o.push(l)}return o}},{key:"adjust",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.height,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.width;o(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"adjust",this).call(this,e,t,n,i,!0)}},{key:"toString",value:function(){return this.cellID+":"+this.endCellID}}]),r}(l)},function(e,r,t){"use strict";function n(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){var t="";e+=1,r+=1;do{r-=1;var n=r%26;r-=n,r/=26,t=String.fromCharCode(n+65)+t}while(r);return t+e}function u(e){if(e=e.toUpperCase(),e in s)return s[e];for(var r=/^([a-z]+)([0-9]+)$/i.exec(e),t=r[1],n=0;t;){var i=t.charCodeAt(0)-64;n*=26,n+=i,t=t.substr(1)}n-=1;var u=new l(n,r[2]-1);return s[e]=u,u}function o(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=u(e),l=s.row+(n?0:r),f=s.col+(o?0:t),c=i(l,f),p=a.TOKEN_CELL_ID.exec(c),h=(o?"$":"")+p[2]+(n?"$":"")+p[4];return{cellID:c,rawCellID:h}}Object.defineProperty(r,"__esModule",{value:!0}),r.getCellID=i,r.getCellPos=u,r.adjustCellID=o;var a=t(7),s={},l=function e(r,t){n(this,e),this.col=r,this.row=t}},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){return(0,f.parseNumAlways)(this.left.run(e))===(0,f.parseNumAlways)(this.right.run(e))}},{key:"toString",value:function(){return"("+this.left+" = "+this.right+")"}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){return(0,f.parseNumAlways)(this.left.run(e))>(0,f.parseNumAlways)(this.right.run(e))}},{key:"toString",value:function(){return"("+this.left+" > "+this.right+")"}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){return(0,f.parseNumAlways)(this.left.run(e))>=(0,f.parseNumAlways)(this.right.run(e))}},{key:"toString",value:function(){return"("+this.left+" >= "+this.right+")"}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){return(0,f.parseNumAlways)(this.left.run(e))<(0,f.parseNumAlways)(this.right.run(e))}},{key:"toString",value:function(){return"("+this.left+" < "+this.right+")"}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){return(0,f.parseNumAlways)(this.left.run(e))<=(0,f.parseNumAlways)(this.right.run(e))}},{key:"toString",value:function(){return"("+this.left+" <= "+this.right+")"}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){return(0,f.parseNumAlways)(this.left.run(e))!==(0,f.parseNumAlways)(this.right.run(e))}},{key:"toString",value:function(){return"("+this.left+" <> "+this.right+")"}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=(t(14),function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"run",value:function(e){var r=this.left.run(e);if(r instanceof Error)return r;var t=this.right.run(e);return t instanceof Error?t:r.toString()+t.toString()}},{key:"toString",value:function(){return"("+this.left+" & "+this.right+")"}}]),r}(l.default));r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(13),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"runNumericOperation",value:function(e,r){return e/r}},{key:"toString",value:function(){return"("+this.left+" / "+this.right+")"}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(13),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"runNumericOperation",value:function(e,r){return Math.pow(e,r)}},{key:"toString",value:function(){return"("+this.left+" ^ "+this.right+")"}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(13),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"runNumericOperation",value:function(e,r){return e*r}},{key:"toString",value:function(){return"("+this.left+" * "+this.right+")"}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(13),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.left=e,n.right=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.left.clone(),this.right.clone())}},{key:"shallowWalk",value:function(e){e(this.left),e(this.right)}},{key:"runNumericOperation",value:function(e,r){return e-r}},{key:"toString",value:function(){return"("+this.left+" - "+this.right+")"}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=n(f),p=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.name=e,n.args=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.name,this.args.map(function(e){return e.clone()}))}},{key:"run",value:function(e){return(0,c.default)(this.name.toUpperCase(),this.args.map(function(r){return r.run(e)}),e)}},{key:"toString",value:function(){return this.name+"("+this.args.map(function(e){return e.toString()}).join(", ")+")"}}]),r}(l.default);r.default=p},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(19),c=t(20),p=function(e){function r(e,t,n,o){i(this,r);var a=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return a.value=e,a.pinRow=t,a.pinCol=n,a.raw=o,a}return o(r,e),a(r,[{key:"adjust",value:function(e,r){var t=(0,c.adjustCellID)(this.value,e,r,this.pinRow,this.pinCol),n=t.cellID,i=t.rawCellID;this.value=n,this.raw=i}},{key:"findCellDependencies",value:function(e){e(this.value)}},{key:"clone",value:function(){return new r(this.value,this.pinRow,this.pinCol,this.raw)}},{key:"run",value:function(e){return new f.CellReference(this.value,e)}},{key:"toString",value:function(){return this.raw.toUpperCase()}}]),r}(l.default);r.default=p},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=function(e){function r(e){i(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.value=e,t}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.value)}},{key:"run",value:function(){return this.value}},{key:"toString",value:function(){return this.value?"true":"false"}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.value=e,n.raw=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.value)}},{key:"run",value:function(){return this.value}},{key:"toString",value:function(){return this.raw.toString()}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=function(e){function r(e){i(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.value=e,t}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.value)}},{key:"run",value:function(){return this.value.toString()}},{key:"toString",value:function(){return JSON.stringify(this.value)}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(19),c=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.start=e,n.end=t,n}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.start.clone(),this.end.clone())}},{key:"shallowWalk",value:function(e){e(this.start),e(this.end)}},{key:"run",value:function(e){return new f.CellRange(this.start.value,this.end.value,e)}},{key:"toString",value:function(){return this.start+":"+this.end}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e){i(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.base=e,t}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.base.clone())}},{key:"run",value:function(e){var r=this.base.run(e);return(0,f.flattenCellReferences)(r)}},{key:"shallowWalk",value:function(e){e(this.base)}},{key:"toString",value:function(){return this.base.toString()}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=function(e){function r(e,t){i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n.sheet=e,n.base=t,n}return o(r,e),a(r,[{key:"findSheetDependencies",value:function(e){var r=this;this.findCellDependnecies(function(t){e(r.sheet,t)})}},{key:"clone",value:function(){return new r(this.sheet,this.base.clone())}},{key:"run",value:function(e){return this.base.run(e.getSheet(e))}},{key:"toString",value:function(){return this.sheet+"!"+this.base}}]),r}(l.default);r.default=f},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e){i(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.base=e,t}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.base.clone())}},{key:"shallowWalk",value:function(e){e(this.base)}},{key:"run",value:function(e){var r=function e(r){return Array.isArray(r)?r.map(e):-1*(0,f.parseNumAlways)(r)};return r(this.base.run(e))}},{key:"toString",value:function(){return"-"+this.base}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=t(11),l=n(s),f=t(14),c=function(e){function r(e){i(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t.base=e,t}return o(r,e),a(r,[{key:"clone",value:function(){return new r(this.base.clone())}},{key:"shallowWalk",value:function(e){e(this.base)}},{key:"run",value:function(e){var r=function e(r){return Array.isArray(r)?r.map(e):(0,f.parseNumAlways)(r)};return r(this.base.run(e))}},{key:"toString",value:function(){return"+"+this.base}}]),r}(l.default);r.default=c},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)}function u(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),l=t(4),f=n(l),c=t(5),p=t(6),h=n(p),m=t(43),v={context:null,immutable:!1,name:null,height:6,width:6,iterate:!0,maxIterations:1e3,iterationEpsilon:.001},d=(Symbol("window.onmouseup"),function(){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o(this,e),Object.assign(this,v,r),this.data=[],this.calculated=[],this.calculationSemaphore=null,this.calculationSourceGraph=null,this.depUpdateQueue=null,this.dependencies={},this.dependants={},this.valueUpdates=new f.default,this.calculatedUpdates=new f.default,this.console=new f.default}return s(e,[{key:"addColumn",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.width+=1,e&&this.forceRerender()}},{key:"addRow",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.height+=1,this.data.push(new Array(this.width)),this.calculated.push(new Array(this.width)),e&&this.forceRerender()}},{key:"calculateValueAtPosition",value:function(e,r,t){var n=this;if(t){var i=(0,c.getCellID)(e,r),u=void 0;if(this.calculationSemaphore)if(i in this.calculationSemaphore){if(this.calculationSemaphore[i]>this.maxIterations)return void this.console.fire("warn","Circular reference hit max iteration limit");this.calculationSemaphore[i]++}else this.calculationSemaphore[i]=1;var o=(0,h.default)(t);try{u=o.run(this)}catch(e){u=new Error("#ERROR!")}this.calculated[e]=this.calculated[e]||[];var a=this.calculated[e][r],s=a!==u||Math.abs(a-u)>this.iterationEpsilon;if(s){this.calculated[e][r]=u;var l=[];if(o&&(o.findCellDependencies(function(e){if(l.indexOf(e)===-1){if(l.push(e),!(e in n.dependencies))return void(n.dependencies[e]=[i]);var r=n.dependencies[e];r&&r.indexOf(i)===-1&&r.push(i)}}),this.context)){this.context.clearDependencies(this,i);var f=[];o.findSheetDependencies(function(u,o){if(n.context.sheets[u.toUpperCase()]){var a=u+"!"+o;f.indexOf(a)===-1&&(f.push(a),n.context.setDependency(n,i,u,o,function(){n.calculateValueAtPosition(e,r,t)}))}})}return this.dependants[i]=l,this.updateDependencies(i),this.calculatedUpdates.fire(i,u),this.formatValue(i,u)}}}},{key:"forceRerender",value:function(){this.console.fire("log","Rerender ignored in headless websheet")}},{key:"clearCell",value:function(e,r){var t=(0,c.getCellID)(e,r);e in this.data&&delete this.data[e][r],e in this.calculated&&delete this.calculated[e][r],this.clearDependants(t),this.dependants[t]=[]}},{key:"clearDependants",value:function(e){var r=this.dependants[e];if(r){for(var t=0;t<r.length;t++){var n=this.dependencies[r[t]];if(n){var i=n.indexOf(e);i!==-1&&n.splice(i,1)}}this.context&&this.context.clearDependencies(this,e)}}},{key:"formatValue",value:function(e,r){switch("undefined"==typeof r?"undefined":a(r)){case"string":break;case"number":if(r===1/0||r===-1*(1/0))return"#DIV/0!";if(isNaN(r))return"#VALUE!";r=r.toString();break;case"boolean":r=r?"TRUE":"FALSE";break;default:if(r instanceof Date){r=r.toLocaleString();break}return r instanceof Error?r.message:"#VALUE!"}return r}},{key:"getCalculatedValueAtID",value:function(e){var r=(0,c.getCellPos)(e),t=r.row,n=r.col;return this.getCalculatedValueAtPos(t,n)}},{key:"getCalculatedValueAtPos",value:function(e,r){if(e in this.calculated){var t=this.calculated[e][r];if(null!==t&&"undefined"!=typeof t)return(0,m.parseNumMaybe)(t)}if(e in this.data){var n=this.data[e][r];if(null!==n&&"undefined"!=typeof n)return(0,m.parseNumMaybe)(n)}return 0}},{key:"getSheet",value:function(e){if(!this.context)throw new Error("No context to extract sheet from");if(e=e.toUpperCase(),!(e in this.context.sheets))throw new Error("Undefined sheet requested");return this.context.sheets[e]}},{key:"getValueAtPos",value:function(e,r){return(this.data[e]||[])[r]||null}},{key:"insertColumnBefore",value:function(e){this.width+=1;for(var r=0;r<this.height;r++)this.data[r]&&this.data[r].splice(e,0,null),this.calculated[r]&&this.calculated[r].splice(e,0,null);this.forceRerender()}},{key:"insertRowBefore",value:function(e){this.height+=1,this.data.splice(e,0,new Array(this.width)),this.calculated.splice(e,0,new Array(this.width)),this.forceRerender()}},{key:"loadData",value:function(e){for(;this.height<e.length;)this.addRow(!1);for(;this.width<e[0].length;)this.addColumn(!1);for(var r=0;r<e.length;r++){this.data[r]=this.data[r]||[];for(var t=0;t<e[r].length;t++)this.setValueAtPosition(r,t,e[r][t],!0)}this.forceRerender()}},{key:"popColumn",value:function(){if(this.width<2)throw new Error("Cannot make spreadsheet that small");this.width-=1;for(var e=0;e<this.height;e++)this.data[e]&&this.data[e].length>this.width&&this.data[e].pop(),this.calculated[e]&&this.calculated[e].length>this.width&&this.calculated[e].pop();this.forceRerender()}},{key:"popRow",value:function(){if(this.height<2)throw new Error("Cannot make spreadsheet that small");this.height-=1,this.data.pop(),this.calculated.pop(),this.forceRerender()}},{key:"removeColumn",value:function(e){if(this.width<2)throw new Error("Cannot make spreadsheet that small");if(e<0||e>=this.width)throw new Error("Removing cells that do not exist");this.width-=1;for(var r=0;r<this.height;r++)this.data[r]&&this.data[r].splice(e,1),this.calculated[r]&&this.calculated[r].splice(e,1);this.forceRerender()}},{key:"removeRow",value:function(e){if(this.height<2)throw new Error("Cannot make spreadsheet that small");if(e<0||e>=this.width)throw new Error("Removing cells that do not exist");this.height-=1,this.data.splice(e,1),this.calculated.splice(e,1),this.forceRerender()}},{key:"setValueAtPosition",value:function(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=(0,c.getCellID)(e,r);return this.data[e]=this.data[e]||[],!(this.data[e][r]===t&&!n)&&(this.data[e][r]=t,this.calculated[e]&&delete this.calculated[e][r],this.clearDependants(i),this.valueUpdates.fire(i,t),"="===t[0]?this.calculateValueAtPosition(e,r,t.substr(1)):this.updateDependencies(i),!0)}},{key:"updateDependencies",value:function(e){var r=this.dependencies[e];if(r)if(this.depUpdateQueue){var t=!0,n=!1,o=void 0;try{for(var a,s=r[Symbol.iterator]();!(t=(a=s.next()).done);t=!0){var l=a.value;if(this.calculationSourceGraph)if(l in this.calculationSourceGraph){if(!this.iterate&&this.calculationSourceGraph[l].indexOf(e)!==-1){this.console.fire("error","Cyclic reference banned at "+e+" -> "+l);continue}this.calculationSourceGraph[l].push(e)}else this.calculationSourceGraph[l]=[e];this.depUpdateQueue.indexOf(l)===-1&&this.depUpdateQueue.push(l)}}catch(e){n=!0,o=e}finally{try{!t&&s.return&&s.return()}finally{if(n)throw o}}}else{for(this.iterate||(this.calculationSourceGraph={}),this.calculationSemaphore=u({},e,1),this.depUpdateQueue=[].concat(i(r));this.depUpdateQueue.length;){var f=this.depUpdateQueue.shift(),p=(0,c.getCellPos)(f),h=p.row,m=p.col;this.calculateValueAtPosition(h,m,this.data[h][m].substr(1))}this.calculationSourceGraph=null,this.calculationSemaphore=null,this.depUpdateQueue=null}}}]),e}());r.default=d},function(e,r){"use strict";function t(e){if(e===!0)return 1;if(e===!1)return 0;var r=parseFloat(e);return isNaN(r)?e:r}Object.defineProperty(r,"__esModule",{value:!0}),r.parseNumMaybe=t},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function e(e,r){var t=[],n=!0,i=!1,u=void 0;try{for(var o,a=e[Symbol.iterator]();!(n=(o=a.next()).done)&&(t.push(o.value),!r||t.length!==r);n=!0);}catch(e){i=!0,u=e}finally{try{!n&&a.return&&a.return()}finally{if(i)throw u}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),a=t(4),s=n(a),l=function(){function e(){i(this,e),this.sheets={},this.dependencies={},this.events=new s.default}return o(e,[{key:"register",value:function(e,r){var t=this;this.sheets[r.toUpperCase()]=e,e.name=r,e.valueUpdates.onAll(function(e,n){t.events.fire("value",r,e,n)}),e.calculatedUpdates.onAll(function(e,n){t.events.fire("calculated",r,e,n)})}},{key:"unregister",value:function(e,r){var t=this;if(this.sheets[r]!==e)throw new Error("Unxpected unregistration");delete this.sheets[r],Object.keys(this.dependencies).forEach(function(e){var n=e.split(/!/),i=u(n,2),o=i[0],a=i[1];if(o===r)return t.clearDependencies(r,a),void delete t.dependencies[e]})}},{key:"getSheet",value:function(e){return e=e.toUpperCase(),this.sheets.hasOwnProperty(e)?this.sheets[e]:null}},{key:"lookup",value:function(e,r){return e=e.toUpperCase(),this.sheets.hasOwnProperty(e)?this.sheets[e].getCalculatedValueAtID(r):null}},{key:"setDependency",value:function(e,r,t,n,i){if(t=t.toUpperCase(),this.sheets.hasOwnProperty(t)){var u=e.name.toUpperCase()+"!"+r;this.dependencies[u]=this.dependencies[u]||[];var o=function(e,r){"value"===r&&"="===e[0]||i(e)};this.dependencies[u].push([t,n,o]),this.sheets[t].valueUpdates.on(n,o),this.sheets[t].calculatedUpdates.on(n,o)}}},{key:"clearDependencies",value:function(e,r){var t=this,n=e.name.toUpperCase()+"!"+r;this.dependencies.hasOwnProperty(n)&&(this.dependencies[n].forEach(function(e){t.sheets[e[0]].valueUpdates.off(e[1],e[2]),t.sheets[e[0]].calculatedUpdates.off(e[1],e[2])}),this.dependencies[n]=[])}}]),e}();r.default=l},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!r||"object"!=typeof r&&"function"!=typeof r?e:r}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(e,r):e.__proto__=r)}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(r,t,n){return t&&e(r.prototype,t),n&&e(r,n),r}}(),s=function e(r,t,n){null===r&&(r=Function.prototype);var i=Object.getOwnPropertyDescriptor(r,t);if(void 0===i){var u=Object.getPrototypeOf(r);return null===u?void 0:e(u,t,n)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(n)},l=t(2),f=n(l),c=t(46),p=t(47),h=t(48),m=120,v=1,d={noBrowser:!1},g=Symbol("window.onmouseup"),y=function(e){function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,r);var n=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,Object.assign({},d,t)));n.elem=e,n.elem.className="websheet",n.columnWidths=[];for(var o=0;o<n.width;o++)n.columnWidths.push(m);return n.cellCache={},n.dragType=c.DRAG_NONE,n.dragSource=null,n.noBrowser||n.immutable?u(n):((0,h.listen)(window,"mouseup",n[g]=function(e){n.dragType!==c.DRAG_NONE&&(n.dragType=c.DRAG_NONE,n.dragSource=null,n.elem.className="websheet")}),n)}return o(r,e),a(r,[{key:"destroy",value:function(){(0,h.unlisten)(window,"mouseup",this[g]),(0,p.unbindEvents)(this)}},{key:"addColumn",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.columnWidths.push(m),s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"addColumn",this).call(this,e)}},{key:"calculateValueAtPosition",value:function(e,t,n){var i=s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"calculateValueAtPosition",this).call(this,e,t,n);if("undefined"!=typeof i){var u=(0,l.getCellID)(e,t),o=this.getCell(u);o&&(o.value=this.formatValue(u,i))}}},{key:"clearCell",value:function(e,t){s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"clearCell",this).call(this,e,t);var n=(0,l.getCellID)(e,t),i=this.getCell(n);i&&(i.value="")}},{key:"forceRerender",value:function(){if(!this.noBrowser){var e=this.columnWidths.reduce(function(e,r){return e+r});for(e+=v,this.elem.style.width=e+"px";this.elem.childNodes.length;)this.elem.removeChild(this.elem.firstChild);this.cellCache={};for(var r=[],t=0;t<this.height;t++){var n=document.createElement("div");n.style.width=e+"px",n.className="websheet-row",this.elem.appendChild(n);for(var i=this.data[t]||[],u=this.calculated[t]||[],o=0;o<this.width;o++){var a=(0,l.getCellID)(t,o),s=document.createElement("input");s.className="websheet-cell",this.immutable&&(s.readOnly=!0);var f=document.createElement("div");f.className="websheet-cell-wrapper",f.style.width=this.columnWidths[o]-1+"px",f.appendChild(s),n.appendChild(f);var c=null;o in u&&null!==u[o]&&"undefined"!=typeof u[o]?c=u[o]:o in i&&null!==i[o]&&"undefined"!=typeof i[o]&&(c=i[o]),null!==c&&(s.value=this.formatValue(a,c)),s.title=a,s.setAttribute("data-id",a),s.setAttribute("data-id-prev-col",(0,l.getCellID)(t,o-1)),s.setAttribute("data-id-prev-row",(0,l.getCellID)(t-1,o)),s.setAttribute("data-id-next-col",(0,l.getCellID)(t,o+1)),s.setAttribute("data-id-next-row",(0,l.getCellID)(t+1,o)),s.setAttribute("data-row",t),s.setAttribute("data-col",o),"="===s.value[0]&&r.push(this.setValueAtPosition.bind(this,t,o,s.value,!0))}}this.immutable&&!this.noBrowser||(0,p.initEvents)(this),r.forEach(function(e){return e()})}}},{key:"getCell",value:function(e){return this.noBrowser?null:e in this.cellCache?this.cellCache[e]:this.cellCache[e]=this.elem.querySelector('[data-id="'+e+'"]')}},{key:"insertColumnBefore",value:function(e){this.columnWidths.splice(e,0,m),s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"insertColumnBefore",this).call(this,e)}},{key:"popColumn",value:function(){if(this.width<2)throw new Error("Cannot make spreadsheet that small");this.columnWidths.pop(),s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"popColumn",this).call(this)}},{key:"removeColumn",value:function(e){if(this.width<2)throw new Error("Cannot make spreadsheet that small");if(e<0||e>=this.width)throw new Error("Removing cells that do not exist");this.columnWidths.splice(e,1),s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"removeColumn",this).call(this,e)}},{key:"setValueAtPosition",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=s(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"setValueAtPosition",this).call(this,e,t,n,i);if(u&&"="!==n[0]){var o=(0,l.getCellID)(e,t),a=this.getCell(o);a&&(a.value=this.formatValue(o,n))}}}]),r}(f.default);r.default=y},function(e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.DRAG_HANDLE=2,r.DRAG_MOVE=1,r.DRAG_NONE=0},function(e,r,t){"use strict";function n(e){(0,m.unlisten)(e.elem,"focus"),(0,m.unlisten)(e.elem,"blur"),(0,m.unlisten)(e.elem,"keyup"),(0,m.unlisten)(e.elem,"keydown"),(0,m.unlisten)(e.elem,"mousedown"),(0,m.unlisten)(e.elem,"mouseup"),(0,m.unlisten)(e.elem,"mouseover")}function i(e){n(e);var r=e.elem;(0,m.listen)(r,"focus",u.bind(e)),(0,m.listen)(r,"blur",o.bind(e)),(0,m.listen)(r,"keyup",s.bind(e)),(0,m.listen)(r,"keydown",a.bind(e)),(0,m.listen)(r,"mousedown",l.bind(e)),(0,m.listen)(r,"mouseup",f.bind(e)),(0,m.listen)(r,"mouseover",c.bind(e))}function u(e){var r=0|e.target.getAttribute("data-row"),t=0|e.target.getAttribute("data-col");e.target.value=(this.data[r]||[])[t]||"",e.target.select(0,e.target.value.length),e.target.parentNode.className="websheet-cell-wrapper websheet-has-focus"}function o(e){var r=0|e.target.getAttribute("data-row"),t=0|e.target.getAttribute("data-col");this.setValueAtPosition(r,t,e.target.value),this.calculated[r]&&t in this.calculated[r]&&(e.target.value=this.formatValue((0,h.getCellID)(r,t),this.calculated[r][t])),e.target.parentNode.className="websheet-cell-wrapper"}function a(e){var r;37===e.keyCode&&0===e.target.selectionStart?r=this.getCell(e.target.getAttribute("data-id-prev-col")):39===e.keyCode&&e.target.selectionEnd===e.target.value.length&&(r=this.getCell(e.target.getAttribute("data-id-next-col"))),r&&(r.focus(),e.preventDefault())}function s(e){var r;13===e.keyCode||40===e.keyCode?r=this.getCell(e.target.getAttribute("data-id-next-row")):38===e.keyCode&&(r=this.getCell(e.target.getAttribute("data-id-prev-row"))),r&&r.focus()}function l(e){var r=e.target;if(r.classList.contains("websheet-has-focus")){e.preventDefault();var t=this.dragSource=r.firstChild.getAttribute("data-id"),n=(0,h.getCellPos)(t);if(this.setValueAtPosition(n.row,n.col,r.firstChild.value),e.layerX>r.clientWidth-10&&e.layerY>r.clientHeight-10)return void(this.dragType=p.DRAG_HANDLE);this.dragType=p.DRAG_MOVE,this.elem.className+=" websheet-grabbing"}}function f(e){var r=e.target;if(this.dragType!==p.DRAG_NONE&&r.classList.contains("websheet-cell")){var t=(0,h.getCellPos)(this.dragSource),n=(0,h.getCellPos)(r.getAttribute("data-id"));if(this.dragType===p.DRAG_MOVE)this.setValueAtPosition(n.row,n.col,this.getValueAtPos(t.row,t.col)||""),this.clearCell(t.row,t.col),e.target.focus();else if(this.dragType===p.DRAG_HANDLE&&(t.row===n.row||t.col===n.col)){var i=this.getValueAtPos(t.row,t.col)||"",u="="===i[0]&&(0,h.parseExpression)(i.substr(1));if(t.row===n.row){for(var o=Math.min(t.col,n.col),a=o;a<=Math.max(t.col,n.col);a++)if(a!==t.col)if(u){var s=u.clone();s.adjust(0,a-o),this.setValueAtPosition(t.row,a,"="+s.toString())}else this.setValueAtPosition(t.row,a,i)}else if(t.col===n.col){for(var l=Math.min(t.row,n.row),f=l;f<=Math.max(t.row,n.row);f++)if(f!==t.row)if(u){var c=u.clone();c.adjust(f-l,0),this.setValueAtPosition(f,t.col,"="+c.toString())}else this.setValueAtPosition(f,t.col,i)}else console.error("Cannot drag handle diagonally")}}this.elem.className="websheet",this.dragType=p.DRAG_NONE,this.dragSource=null;for(var m=this.elem.querySelectorAll(".websheet-cell-hover"),v=0;v<m.length;v++)m[v].classList.remove("websheet-cell-hover")}function c(e){var r=this;if(this.dragType!==p.DRAG_NONE&&e.target.classList.contains("websheet-cell")){for(var t=[],n=this.elem.querySelectorAll(".websheet-cell-hover"),i=0;i<n.length;i++)t.push(n[i].firstChild.dataset.id);var u=e.target.dataset.id;if(u!==this.dragSource){if(this.dragType===p.DRAG_HANDLE){var o=(0,h.getCellPos)(u),a=(0,h.getCellPos)(this.dragSource);if(o.col===a.col)for(var s=Math.min(a.row,o.row);s<=Math.max(a.row,o.row);s++){var l=(0,h.getCellID)(s,a.col),f=t.indexOf(l);f!==-1?t.splice(f,1):this.getCell(l).parentNode.classList.add("websheet-cell-hover")}else if(o.row===a.row)for(var c=Math.min(a.col,o.col);c<=Math.max(a.col,o.col);c++){var m=(0,h.getCellID)(a.row,c),v=t.indexOf(m);v!==-1?t.splice(v,1):this.getCell(m).parentNode.classList.add("websheet-cell-hover")}}else e.target.parentNode.classList.add("websheet-cell-hover");t.forEach(function(e){r.getCell(e).parentNode.classList.remove("websheet-cell-hover")})}}}Object.defineProperty(r,"__esModule",{value:!0}),r.unbindEvents=n,r.initEvents=i,r.onFocus=u,r.onBlur=o,r.onKeydown=a,r.onKeyup=s,r.onMousedown=l,r.onMouseup=f,r.onMouseover=c;var p=t(46),h=t(2),m=t(48)},function(e,r){"use strict";function t(e,r,t){i in e||(e[i]={}),e[i][r]=e[i][r]||[],e[i][r].push(t),e.addEventListener(r,t,e!==window)}function n(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e[i]&&e[i][r]&&e[i][r].forEach(function(n){t&&n!==t||e.removeEventListener(r,n,e!==window)})}Object.defineProperty(r,"__esModule",{value:!0}),r.listen=t,r.unlisten=n;var i=Symbol("websheets listeners")},function(e,r,t,n){e.exports=t(n)}]));