From 46b60c01eeef0a19c9e659a4ec5facd7fc04ebc9 Mon Sep 17 00:00:00 2001 From: josdejong Date: Mon, 11 Mar 2013 20:56:02 +0100 Subject: [PATCH] Fixed: minified version of the library was broken --- math.min.js | 2 +- tools/jake-utils.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/math.min.js b/math.min.js index 788b74596..41865f267 100644 --- a/math.min.js +++ b/math.min.js @@ -33,5 +33,5 @@ * License for the specific language governing permissions and limitations under * the License. */ -undefined(function(){function e(t,n){if(this.constructor!=e)throw Error("Unit constructor must be called with the new operator");this.value=1,this.unit=e.UNIT_NONE,this.prefix=e.PREFIX_NONE,this.hasUnit=!1,this.hasValue=!1,this.fixPrefix=!1,this._init(t,n)}function t(e){return e instanceof String||"string"==typeof e}function n(e){return e instanceof Number||"number"==typeof e}function r(e){return e==Math.round(e)}function i(e,r){if(this.constructor!=i)throw new SyntaxError("Complex constructor must be called with the new operator");switch(arguments.length){case 2:if(!n(e)||!n(r))throw new TypeError("Two numbers or a single string expected in Complex constructor");this.re=e,this.im=r;break;case 1:if(!t(e))throw new TypeError("Two numbers or a single string expected in Complex constructor");var a=i.parse(e);if(a)return a;throw new SyntaxError('"'+e+'" is no valid complex number');case 0:this.re=0,this.im=0;break;default:throw new SyntaxError("Wrong number of arguments in Complex constructor ("+arguments.length+" provided, 0, 1, or 2 expected)")}}function a(e){return e.replace(/^\s+|\s+$/g,"")}function s(e,t){var n=void 0;if(2==arguments.length){var r=l(t);n="Function "+e+" does not support a parameter of type "+r}else if(arguments.length>2){for(var i=[],a=1;arguments.length>a;a++)i.push(l(arguments[a]));n="Function "+e+" does not support a parameters of type "+i.join(", ")}else n="Unsupported parameter in function "+e;return new TypeError(n)}function o(e,t,n,r){var i="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(void 0!=r?"-"+r:"")+" expected)";return new SyntaxError(i)}function f(e,n){var r;if(t(e)){if("undefined"==typeof require)throw Error("Cannot load file: require not available.");var i=require(e);f(i)}else if(u(e)){if(r=e.name,!r)throw Error("Cannot import an unnamed function");(n||void 0===gt[r])&&(gt[r]=e)}else if(e instanceof Object)for(r in e)if(e.hasOwnProperty(r)){var a=e[r];u(a)?(n||void 0===gt[r])&&(gt[r]=a):f(a)}}function u(r){return"function"==typeof r||n(r)||t(r)||r instanceof i||r instanceof e}function h(e){if(1!=arguments.length)throw o("help",arguments.length,1);if(void 0!=e){if(e.doc)return c(e.doc);if(e.constructor.doc)return c(e.constructor.doc);if(t(e)){var n=gt[e];if(n&&n.doc)return c(n.doc)}}return e instanceof Object&&e.name?'No documentation found on subject "'+e.name+'"':e instanceof Object&&e.constructor.name?'No documentation found on subject "'+e.constructor.name+'"':'No documentation found on subject "'+e+'"'}function c(e){var t="";if(e.name&&(t+="NAME\n"+e.name+"\n\n"),e.category&&(t+="CATEGORY\n"+e.category+"\n\n"),e.syntax&&(t+="SYNTAX\n"+e.syntax.join("\n")+"\n\n"),e.examples){t+="EXAMPLES\n";for(var n=0;e.examples.length>n;n++)t+=e.examples[n]+"\n";t+="\n"}return e.seealso&&(t+="SEE ALSO\n"+e.seealso.join(", ")+"\n"),t}function l(e){if(1!=arguments.length)throw o("typeof",arguments.length,1);var t=typeof e;if("object"==t){if(null==e)return"null";if(e&&e.constructor&&e.constructor.name)return e.constructor.name.toLowerCase()}return t}function p(){if(0==arguments.length)throw Error("Function sum requires one or more parameters (0 provided)");if(1==arguments.length&&arguments[0]instanceof Array)return p.apply(this,arguments[0]);for(var e=arguments[0],t=1,n=arguments.length;n>t;t++){var r=arguments[t];X(r,e)&&(e=r)}return e}function m(){if(0==arguments.length)throw Error("Function sum requires one or more parameters (0 provided)");if(1==arguments.length&&arguments[0]instanceof Array)return m.apply(this,arguments[0]);for(var e=arguments[0],t=1,n=arguments.length;n>t;t++){var r=arguments[t];K(r,e)&&(e=r)}return e}function d(t,n){if(2!=arguments.length)throw o("in",arguments.length,2);if(t instanceof e){if(n.hasValue)throw Error("Cannot convert to a unit with a value");if(!n.hasUnit)throw Error("Unit expected on the right hand side of function in");var r=n.copy();return r.value=t.value,r.fixPrefix=!0,r}throw s("in",t)}function g(t){if(1!=arguments.length)throw o("sin",arguments.length,1);if(n(t))return Math.sin(t);if(t instanceof i)return new i(.5*Math.sin(t.re)*(Math.exp(-t.im)+Math.exp(t.im)),.5*Math.cos(t.re)*(Math.exp(t.im)-Math.exp(-t.im)));if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.sin(t.value)}if(t instanceof Array)return vt.map(t,g);throw s("sin",t)}function v(e,t){if(2!=arguments.length)throw o("atan2",arguments.length,2);if(n(e)){if(n(t))return Math.atan2(e,t);if(t instanceof i)return Math.atan2(e,t.re)}else if(e instanceof i){if(n(t))return Math.atan2(e.re,t);if(t instanceof i)return Math.atan2(e.re,t.re)}throw s("atan2",e,t)}function x(e){if(1!=arguments.length)throw o("asin",arguments.length,1);if(n(e))return e>=-1&&1>=e?Math.asin(e):x(new i(e,0));if(e instanceof i){var t=e.re,r=e.im,a=new i(r*r-t*t+1,-2*t*r),f=H(a),u=new i(f.re-r,f.im+t),h=Q(u);return new i(h.im,-h.re)}if(e instanceof Array)return vt.map(e,x);throw s("asin",e)}function y(e){if(1!=arguments.length)throw o("atan",arguments.length,1);if(n(e))return Math.atan(e);if(e instanceof i){var t=e.re,r=e.im,a=t*t+(1-r)*(1-r),f=new i((1-r*r-t*t)/a,-2*t/a),u=Q(f);return new i(-.5*u.im,.5*u.re)}if(e instanceof Array)return vt.map(e,y);throw s("atan",e)}function N(t){if(1!=arguments.length)throw o("csc",arguments.length,1);if(n(t))return 1/Math.sin(t);if(t instanceof i){var r=.25*(Math.exp(-2*t.im)+Math.exp(2*t.im))-.5*Math.cos(2*t.re);return new i(.5*Math.sin(t.re)*(Math.exp(-t.im)+Math.exp(t.im))/r,.5*Math.cos(t.re)*(Math.exp(-t.im)-Math.exp(t.im))/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return 1/Math.sin(t.value)}if(t instanceof Array)return vt.map(t,N);throw s("csc",t)}function E(t){if(1!=arguments.length)throw o("cos",arguments.length,1);if(n(t))return Math.cos(t);if(t instanceof i)return new i(.5*Math.cos(t.re)*(Math.exp(-t.im)+Math.exp(t.im)),.5*Math.sin(t.re)*(Math.exp(-t.im)-Math.exp(t.im)));if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(t.value)}if(t instanceof Array)return vt.map(t,E);throw s("cos",t)}function w(t){if(1!=arguments.length)throw o("cot",arguments.length,1);if(n(t))return 1/Math.tan(t);if(t instanceof i){var r=Math.exp(-4*t.im)-2*Math.exp(-2*t.im)*Math.cos(2*t.re)+1;return new i(2*Math.exp(-2*t.im)*Math.sin(2*t.re)/r,(Math.exp(-4*t.im)-1)/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return 1/Math.tan(t.value)}if(t instanceof Array)return vt.map(t,w);throw s("cot",t)}function b(t){if(1!=arguments.length)throw o("sec",arguments.length,1);if(n(t))return 1/Math.cos(t);if(t instanceof i){var r=.25*(Math.exp(-2*t.im)+Math.exp(2*t.im))+.5*Math.cos(2*t.re);return new i(.5*Math.cos(t.re)*(Math.exp(-t.im)+Math.exp(t.im))/r,.5*Math.sin(t.re)*(Math.exp(t.im)-Math.exp(-t.im))/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return 1/Math.cos(t.value)}if(t instanceof Array)return vt.map(t,b);throw s("sec",t)}function M(t){if(1!=arguments.length)throw o("tan",arguments.length,1);if(n(t))return Math.tan(t);if(t instanceof i){var r=Math.exp(-4*t.im)+2*Math.exp(-2*t.im)*Math.cos(2*t.re)+1;return new i(2*Math.exp(-2*t.im)*Math.sin(2*t.re)/r,(1-Math.exp(-4*t.im))/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return Math.tan(t.value)}if(t instanceof Array)return vt.map(t,M);throw s("tan",t)}function O(e){if(1!=arguments.length)throw o("acos",arguments.length,1);if(n(e))return e>=-1&&1>=e?Math.acos(e):O(new i(e,0));if(e instanceof i){var t=new i(e.im*e.im-e.re*e.re+1,-2*e.re*e.im),r=H(t),a=new i(r.re-e.im,r.im+e.re),f=Q(a);return new i(1.5707963267948966-f.im,f.re)}if(e instanceof Array)return vt.map(e,O);throw s("acos",e)}function T(e){if(1!=arguments.length)throw o("arg",arguments.length,1);if(n(e))return Math.atan2(0,e);if(e instanceof i)return Math.atan2(e.im,e.re);if(e instanceof Array)return vt.map(e,T);throw s("arg",e)}function S(e){if(1!=arguments.length)throw o("conj",arguments.length,1);if(n(e))return e;if(e instanceof i)return new i(e.re,-e.im);if(e instanceof Array)return vt.map(e,S);throw s("conj",e)}function k(e){if(1!=arguments.length)throw o("im",arguments.length,1);if(n(e))return 0;if(e instanceof i)return e.im;if(e instanceof Array)return vt.map(e,k);throw s("im",e)}function _(e){if(1!=arguments.length)throw o("re",arguments.length,1);if(n(e))return e;if(e instanceof i)return e.re;if(e instanceof Array)return vt.map(e,_);throw s("re",e)}function A(e){if(1!=arguments.length)throw o("cube",arguments.length,1);if(n(e))return e*e*e;if(e instanceof i)return nt(nt(e,e),e);throw s("cube",e)}function U(t,r){if(2!=arguments.length)throw o("divide",arguments.length,2);if(n(t)){if(n(r))return t/r;if(r instanceof i)return q(new i(t,0),r)}else if(t instanceof i){if(n(r))return q(t,new i(r,0));if(r instanceof i)return q(t,r)}else if(t instanceof e&&n(r)){var a=t.copy();return a.value/=r,a}throw s("divide",t,r)}function q(e,t){var n=t.re*t.re+t.im*t.im;return new i((e.re*t.re+e.im*t.im)/n,(e.im*t.re-e.re*t.im)/n)}function L(r,a){if(2!=arguments.length)throw o("smallereq",arguments.length,2);if(n(r)){if(n(a))return a>=r;if(a instanceof i)return Z(a)>=r}if(r instanceof i){if(n(a))return a>=Z(r);if(a instanceof i)return Z(r)<=Z(a)}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value<=a.value}if(t(r)||t(a))return a>=r;throw s("smallereq",r,a)}function C(e,t){if(1!=arguments.length&&2!=arguments.length)throw o("round",arguments.length,1,2);if(void 0==t){if(n(e))return Math.round(e);if(e instanceof i)return new i(Math.round(e.re),Math.round(e.im));throw s("round",e)}if(!n(t))throw new TypeError("Number of digits in function round must be an integer");if(t!==Math.round(t))throw new TypeError("Number of digits in function round must be integer");if(0>t||t>9)throw Error("Number of digits in function round must be in te range of 0-9");if(n(e))return I(e,t);if(e instanceof i)return new i(I(e.re,t),I(e.im,t));throw s("round",e,t)}function I(e,t){var n=Math.pow(10,void 0!=t?t:gt.options.precision);return Math.round(e*n)/n}function R(r,a){if(2!=arguments.length)throw o("equal",arguments.length,2);if(n(r)){if(n(a))return r==a;if(a instanceof i)return r==a.re&&0==a.im}if(r instanceof i){if(n(a))return r.re==a&&0==r.im;if(a instanceof i)return r.re==a.re&&r.im==a.im}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value==a.value}if(t(r)||t(a))return r==a;throw s("equal",r,a)}function P(r,a){if(2!=arguments.length)throw o("unequal",arguments.length,2);if(n(r)){if(n(a))return r==a;if(a instanceof i)return r==a.re&&0==a.im}if(r instanceof i){if(n(a))return r.re==a&&0==r.im;if(a instanceof i)return r.re==a.re&&r.im==a.im}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value==a.value}if(t(r)||t(a))return r==a;throw s("unequal",r,a)}function B(e){if(1!=arguments.length)throw o("log10",arguments.length,1);if(n(e))return e>=0?Math.log(e)/Math.LN10:B(new i(e,0));if(e instanceof i)return new i(Math.log(Math.sqrt(e.re*e.re+e.im*e.im))/Math.LN10,Math.atan2(e.im,e.re)/Math.LN10);if(e instanceof Array)return vt.map(e,B);throw s("log10",e)}function G(e){if(1!=arguments.length)throw o("fix",arguments.length,1);if(n(e))return value>0?Math.floor(e):Math.ceil(e);if(e instanceof i)return new i(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im));if(e instanceof Array)return vt.map(e,G);throw s("fix",e)}function D(r,a){if(2!=arguments.length)throw o("add",arguments.length,2);if(n(r)){if(n(a))return r+a;if(a instanceof i)return new i(r+a.re,a.im)}else if(r instanceof i){if(n(a))return new i(r.re+a,r.im);if(a instanceof i)return new i(r.re+a.re,r.im+a.im)}else if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Units do not match");if(!r.hasValue)throw Error("Unit on left hand side of operator + has no value");if(!a.hasValue)throw Error("Unit on right hand side of operator + has no value");var f=r.copy();return f.value+=a.value,f.fixPrefix=!1,f}if(t(r)||t(a))return r+a;throw s("add",r,a)}function Y(e,t){if(2!=arguments.length)throw o("mod",arguments.length,2);if(n(e)){if(n(t))return e%t;if(t instanceof i&&0==t.im)return e%t.re}else if(e instanceof i&&0==e.im){if(n(t))return e.re%t;if(t instanceof i&&0==t.im)return e.re%t.re}throw s("mod",e,t)}function V(e){if(1!=arguments.length)throw o("exp",arguments.length,1);if(n(e))return Math.exp(e);if(e instanceof i){var t=Math.exp(e.re);return new i(t*Math.cos(e.im),t*Math.sin(e.im))}if(e instanceof Array)return vt.map(e,V);throw s("exp",e)}function F(r,a){if(2!=arguments.length)throw o("largereq",arguments.length,2);if(n(r)){if(n(a))return r>=a;if(a instanceof i)return r>=Z(a)}if(r instanceof i){if(n(a))return Z(r)>=a;if(a instanceof i)return Z(r)>=Z(a)}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value>=a.value}if(t(r)||t(a))return r>=a;throw s("largereq",r,a)}function H(e){if(1!=arguments.length)throw o("sqrt",arguments.length,1);if(n(e))return e>=0?Math.sqrt(e):H(new i(e,0));if(e instanceof i){var t=Math.sqrt(e.re*e.re+e.im*e.im);return e.im>=0?new i(.5*Math.sqrt(2*(t+e.re)),.5*Math.sqrt(2*(t-e.re))):new i(.5*Math.sqrt(2*(t+e.re)),-.5*Math.sqrt(2*(t-e.re)))}if(e instanceof Array)return vt.map(e,H);throw s("sqrt",e)}function j(e){if(1!=arguments.length)throw o("square",arguments.length,1);if(n(e))return e*e;if(e instanceof i)return nt(e,e);throw s("square",e)}function K(r,a){if(2!=arguments.length)throw o("larger",arguments.length,2);if(n(r)){if(n(a))return r>a;if(a instanceof i)return r>Z(a)}if(r instanceof i){if(n(a))return Z(r)>a;if(a instanceof i)return Z(r)>Z(a)}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value>a.value}if(t(r)||t(a))return r>a;throw s("larger",r,a)}function z(e){if(1!=arguments.length)throw o("sign",arguments.length,1);if(n(e)){var t;return t=e>0?1:0>e?-1:0}if(e instanceof i){var r=Math.sqrt(e.re*e.re+e.im*e.im);return new i(e.re/r,e.im/r)}if(e instanceof Array)return vt.map(e,t);throw s("sign",e)}function W(t){if(1!=arguments.length)throw o("unaryminus",arguments.length,1);if(n(t))return-t;if(t instanceof i)return new i(-t.re,-t.im);if(t instanceof e){var r=t.copy();return r.value=-t.value,r}if(t instanceof Array)return vt.map(t,W);throw s("unaryminus",t)}function X(r,a){if(2!=arguments.length)throw o("smaller",arguments.length,2);if(n(r)){if(n(a))return a>r;if(a instanceof i)return Z(a)>r}if(r instanceof i){if(n(a))return a>Z(r);if(a instanceof i)return Z(r)r;throw s("smaller",r,a)}function Z(e){if(1!=arguments.length)throw o("abs",arguments.length,1);if(n(e))return Math.abs(e);if(e instanceof i)return Math.sqrt(e.re*e.re+e.im*e.im);if(e instanceof Array)return vt.map(e,Z);throw s("abs",e)}function Q(e,t){if(1!=arguments.length&&2!=arguments.length)throw o("log",arguments.length,1,2);if(void 0!==t)return U(Q(e),Q(t));if(n(e))return e>=0?Math.log(e):Q(new i(e,0));if(e instanceof i)return new i(Math.log(Math.sqrt(e.re*e.re+e.im*e.im)),Math.atan2(e.im,e.re));if(e instanceof Array)return vt.map(e,Q);throw s("log",e,t)}function J(e,t){if(2!=arguments.length)throw o("pow",arguments.length,2);if(n(e)){if(n(t))return r(t)||e>=0?Math.pow(e,t):$(new i(e,0),new i(t,0));if(t instanceof i)return $(new i(e,0),t)}else if(e instanceof i){if(n(t))return $(e,new i(t,0));if(t instanceof i)return $(e,t)}throw s("pow",e,t)}function $(e,t){var n=Q(e),r=nt(n,t);return V(r)}function et(e){if(1!=arguments.length)throw o("floor",arguments.length,1);if(n(e))return Math.floor(e);if(e instanceof i)return new i(Math.floor(e.re),Math.floor(e.im));if(e instanceof Array)return vt.map(e,et);throw s("floor",e)}function tt(e){if(1!=arguments.length)throw o("ceil",arguments.length,1);if(n(e))return Math.ceil(e);if(e instanceof i)return new i(Math.ceil(e.re),Math.ceil(e.im));if(e instanceof Array)return vt.map(e,tt);throw s("ceil",e)}function nt(t,r){var a;if(2!=arguments.length)throw o("multiply",arguments.length,2);if(n(t)){if(n(r))return t*r;if(r instanceof i)return rt(new i(t,0),r);if(r instanceof e)return a=r.copy(),a.value*=t,a}else if(t instanceof i){if(n(r))return rt(t,new i(r,0));if(r instanceof i)return rt(t,r)}else if(t instanceof e&&n(r))return a=t.copy(),a.value*=r,a;throw s("multiply",t,r)}function rt(e,t){return new i(e.re*t.re-e.im*t.im,e.re*t.im+e.im*t.re)}function it(t,r){if(2!=arguments.length)throw o("subtract",arguments.length,2);if(n(t)){if(n(r))return t-r;if(r instanceof i)return new i(t-r.re,r.im)}else if(t instanceof i){if(n(r))return new i(t.re-r,t.im);if(r instanceof i)return new i(t.re-r.re,t.im-r.im)}else if(t instanceof e&&r instanceof e){if(!t.equalBase(r))throw Error("Units do not match");if(!t.hasValue)throw Error("Unit on left hand side of operator - has no value");if(!r.hasValue)throw Error("Unit on right hand side of operator - has no value");var a=t.copy();return a.value-=r.value,a.fixPrefix=!1,a}throw s("subtract",t,r)}function at(){if(0!=arguments.length)throw o("random",arguments.length,0);return Math.random()}function st(e){if(1!=arguments.length)throw o("factorial",arguments.length,1);if(n(e)){if(!r(e))throw new TypeError("Function factorial can only handle integer values");var t=e,i=t;for(t--;t>1;)i*=t,t--;return 0==i&&(i=1),i}if(e instanceof Array)return vt.map(e,st);throw s("factorial",e)}function ot(){}function ft(e,t,n){this.name=e,this.fn=t,this.params=n}function ut(e){this.value=e}function ht(){this.params=[],this.visible=[]}function ct(e,t,n,r){this.name=e,this.params=t,this.expr=n,this.result=r}function lt(e,t,n,r,i){this.name=e,this.variables=n,this.values=[];for(var a=0,s=this.variables.length;s>a;a++)this.values[a]=function(){var e=function(){return e.value};return e.value=void 0,e}();this.def=this.createFunction(e,t,n,r),this.result=i}function pt(e){this.parentScope=e,this.nestedScopes=void 0,this.symbols={},this.defs={},this.updates={},this.links={}}function mt(){if(this.constructor!=mt)throw new SyntaxError("Parser constructor must be called with the new operator");this.TOKENTYPE={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},this.expr="",this.index=0,this.c="",this.token="",this.token_type=this.TOKENTYPE.NULL,this.scope=new pt}function dt(){this.idMax=-1,this.updateSeq=0,this.parser=new mt,this.scope=new pt,this.nodes={},this.firstNode=void 0,this.lastNode=void 0}var gt={parser:{node:{}},options:{precision:10}};"undefined"!=typeof module&&module.exports!==void 0&&(module.exports=gt),"undefined"!=typeof exports&&(exports=gt),"undefined"!=typeof require&&"undefined"!=typeof define&&define(function(){return gt}),"undefined"!=typeof window&&(window.math=gt);var vt={};if(vt.format=function(e,t){if(1/0===e)return"Infinity";if(e===-1/0)return"-Infinity";if(0/0===e)return"NaN";var n=Math.abs(e);if(n>1e-4&&1e6>n||0==n)return I(e,t)+"";var r=Math.round(Math.log(n)/Math.LN10),i=e/Math.pow(10,r);return I(i,t)+"E"+r},vt.randomUUID=function(){var e=function(){return Math.floor(65536*Math.random()).toString(16)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},vt.map=function(e,t){return e.map(function(e){return t(e)})},!Array.prototype.indexOf){Array.prototype.indexOf=function(e){for(var t=0;this.length>t;t++)if(this[t]==e)return t;return-1};try{console.log("Warning: Ancient browser detected. Please update your browser")}catch(xt){}}Array.prototype.forEach||(Array.prototype.forEach=function(e,t){for(var n=0,r=this.length;r>n;++n)e.call(t||this,this[n],n,this)}),Array.prototype.map||(Array.prototype.map=function(e,t){var n,r,i;if(null==this)throw new TypeError(" this is null or not defined");var a=Object(this),s=a.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(t&&(n=t),r=Array(s),i=0;s>i;){var o,f;i in a&&(o=a[i],f=e.call(n,o,i,a),r[i]=f),i++}return r}),gt.Unit=e,e.prototype.copy=function(){var t=new e;for(var n in this)this.hasOwnProperty(n)&&(t[n]=this[n]);return t},e.endsWith=function(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t},e.prototype._init=function(t,n){if(void 0!==n){for(var r=e.UNITS,i=!1,a=0,s=r.length;s>a;a++){var o=r[a];if(e.endsWith(n,o.name)){var f=n.length-o.name.length,u=n.substring(0,f),h=o.prefixes[u];if(void 0!==h){this.unit=o,this.prefix=h,this.hasUnit=!0,i=!0;break}}}if(!i)throw Error('String "'+n+'" is no unit')}void 0!==t?(this.value=this._normalize(t),this.hasValue=!0):this.value=this._normalize(1)},e.prototype._normalize=function(e){return(e+this.unit.offset)*this.unit.value*this.prefix.value},e.prototype._unnormalize=function(e,t){return void 0===t?e/this.unit.value/this.prefix.value-this.unit.offset:e/this.unit.value/t-this.unit.offset},e.isUnit=function(t){for(var n=e.UNITS,r=n.length,i=0;r>i;i++){var a=n[i];if(e.endsWith(t,a.name)){var s=t.length-a.name.length;if(0==s)return!0;var o=t.substring(0,s),f=a.prefixes[o];if(void 0!==f)return!0}}return!1},e.prototype.hasBase=function(e){return void 0===this.unit.base?void 0===e:this.unit.base===e},e.prototype.equalBase=function(e){return this.unit.base===e.unit.base},e.prototype.equals=function(e){return this.equalBase(e)&&this.value==e.value},e.prototype.toString=function(){var t;if(this.fixPrefix)return t=this._unnormalize(this.value),vt.format(t)+" "+this.prefix.name+this.unit.name;var n=e.PREFIX_NONE,r=Math.abs(Math.log(this.value/n.value)/Math.LN10-1.5),i=this.unit.prefixes;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];if(s.scientific){var o=Math.abs(Math.log(this.value/s.value)/Math.LN10-1.5);r>o&&(n=s,r=o)}}return t=this._unnormalize(this.value,n.value),vt.format(t)+" "+n.name+this.unit.name},e.PREFIXES={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},BINARY_SHORT:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1024,scientific:!0},M:{name:"M",value:Math.pow(1024,2),scientific:!0},G:{name:"G",value:Math.pow(1024,3),scientific:!0},T:{name:"T",value:Math.pow(1024,4),scientific:!0},P:{name:"P",value:Math.pow(1024,5),scientific:!0},E:{name:"E",value:Math.pow(1024,6),scientific:!0},Z:{name:"Z",value:Math.pow(1024,7),scientific:!0},Y:{name:"Y",value:Math.pow(1024,8),scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1024,scientific:!0},mega:{name:"mega",value:Math.pow(1024,2),scientific:!0},giga:{name:"giga",value:Math.pow(1024,3),scientific:!0},tera:{name:"tera",value:Math.pow(1024,4),scientific:!0},peta:{name:"peta",value:Math.pow(1024,5),scientific:!0},exa:{name:"exa",value:Math.pow(1024,6),scientific:!0},zetta:{name:"zetta",value:Math.pow(1024,7),scientific:!0},yotta:{name:"yotta",value:Math.pow(1024,8),scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}}},e.PREFIX_NONE={name:"",value:1,scientific:!0},e.BASE_UNITS={NONE:{},LENGTH:{},MASS:{},TIME:{},CURRENT:{},TEMPERATURE:{},LUMINOUS_INTENSITY:{},AMOUNT_OF_SUBSTANCE:{},FORCE:{},SURFACE:{},VOLUME:{},ANGLE:{},BIT:{}};var yt=e.BASE_UNITS,Nt=e.PREFIXES;e.BASE_UNIT_NONE={},e.UNIT_NONE={name:"",base:e.BASE_UNIT_NONE,value:1,offset:0},e.UNITS=[{name:"meter",base:yt.LENGTH,prefixes:Nt.LONG,value:1,offset:0},{name:"inch",base:yt.LENGTH,prefixes:Nt.NONE,value:.0254,offset:0},{name:"foot",base:yt.LENGTH,prefixes:Nt.NONE,value:.3048,offset:0},{name:"yard",base:yt.LENGTH,prefixes:Nt.NONE,value:.9144,offset:0},{name:"mile",base:yt.LENGTH,prefixes:Nt.NONE,value:1609.344,offset:0},{name:"link",base:yt.LENGTH,prefixes:Nt.NONE,value:.201168,offset:0},{name:"rod",base:yt.LENGTH,prefixes:Nt.NONE,value:5.02921,offset:0},{name:"chain",base:yt.LENGTH,prefixes:Nt.NONE,value:20.1168,offset:0},{name:"angstrom",base:yt.LENGTH,prefixes:Nt.NONE,value:1e-10,offset:0},{name:"m",base:yt.LENGTH,prefixes:Nt.SHORT,value:1,offset:0},{name:"ft",base:yt.LENGTH,prefixes:Nt.NONE,value:.3048,offset:0},{name:"yd",base:yt.LENGTH,prefixes:Nt.NONE,value:.9144,offset:0},{name:"mi",base:yt.LENGTH,prefixes:Nt.NONE,value:1609.344,offset:0},{name:"li",base:yt.LENGTH,prefixes:Nt.NONE,value:.201168,offset:0},{name:"rd",base:yt.LENGTH,prefixes:Nt.NONE,value:5.02921,offset:0},{name:"ch",base:yt.LENGTH,prefixes:Nt.NONE,value:20.1168,offset:0},{name:"mil",base:yt.LENGTH,prefixes:Nt.NONE,value:254e-7,offset:0},{name:"m2",base:yt.SURFACE,prefixes:Nt.SHORT,value:1,offset:0},{name:"sqin",base:yt.SURFACE,prefixes:Nt.NONE,value:64516e-8,offset:0},{name:"sqft",base:yt.SURFACE,prefixes:Nt.NONE,value:.09290304,offset:0},{name:"sqyd",base:yt.SURFACE,prefixes:Nt.NONE,value:.83612736,offset:0},{name:"sqmi",base:yt.SURFACE,prefixes:Nt.NONE,value:2589988.110336,offset:0},{name:"sqrd",base:yt.SURFACE,prefixes:Nt.NONE,value:25.29295,offset:0},{name:"sqch",base:yt.SURFACE,prefixes:Nt.NONE,value:404.6873,offset:0},{name:"sqmil",base:yt.SURFACE,prefixes:Nt.NONE,value:6.4516e-10,offset:0},{name:"m3",base:yt.VOLUME,prefixes:Nt.SHORT,value:1,offset:0},{name:"L",base:yt.VOLUME,prefixes:Nt.SHORT,value:.001,offset:0},{name:"litre",base:yt.VOLUME,prefixes:Nt.LONG,value:.001,offset:0},{name:"cuin",base:yt.VOLUME,prefixes:Nt.NONE,value:16387064e-12,offset:0},{name:"cuft",base:yt.VOLUME,prefixes:Nt.NONE,value:.028316846592,offset:0},{name:"cuyd",base:yt.VOLUME,prefixes:Nt.NONE,value:.764554857984,offset:0},{name:"teaspoon",base:yt.VOLUME,prefixes:Nt.NONE,value:5e-6,offset:0},{name:"tablespoon",base:yt.VOLUME,prefixes:Nt.NONE,value:15e-6,offset:0},{name:"minim",base:yt.VOLUME,prefixes:Nt.NONE,value:6.161152e-8,offset:0},{name:"fluiddram",base:yt.VOLUME,prefixes:Nt.NONE,value:36966911e-13,offset:0},{name:"fluidounce",base:yt.VOLUME,prefixes:Nt.NONE,value:2957353e-11,offset:0},{name:"gill",base:yt.VOLUME,prefixes:Nt.NONE,value:.0001182941,offset:0},{name:"cup",base:yt.VOLUME,prefixes:Nt.NONE,value:.0002365882,offset:0},{name:"pint",base:yt.VOLUME,prefixes:Nt.NONE,value:.0004731765,offset:0},{name:"quart",base:yt.VOLUME,prefixes:Nt.NONE,value:.0009463529,offset:0},{name:"gallon",base:yt.VOLUME,prefixes:Nt.NONE,value:.003785412,offset:0},{name:"beerbarrel",base:yt.VOLUME,prefixes:Nt.NONE,value:.1173478,offset:0},{name:"oilbarrel",base:yt.VOLUME,prefixes:Nt.NONE,value:.1589873,offset:0},{name:"hogshead",base:yt.VOLUME,prefixes:Nt.NONE,value:.238481,offset:0},{name:"fldr",base:yt.VOLUME,prefixes:Nt.NONE,value:36966911e-13,offset:0},{name:"floz",base:yt.VOLUME,prefixes:Nt.NONE,value:2957353e-11,offset:0},{name:"gi",base:yt.VOLUME,prefixes:Nt.NONE,value:.0001182941,offset:0},{name:"cp",base:yt.VOLUME,prefixes:Nt.NONE,value:.0002365882,offset:0},{name:"pt",base:yt.VOLUME,prefixes:Nt.NONE,value:.0004731765,offset:0},{name:"qt",base:yt.VOLUME,prefixes:Nt.NONE,value:.0009463529,offset:0},{name:"gal",base:yt.VOLUME,prefixes:Nt.NONE,value:.003785412,offset:0},{name:"bbl",base:yt.VOLUME,prefixes:Nt.NONE,value:.1173478,offset:0},{name:"obl",base:yt.VOLUME,prefixes:Nt.NONE,value:.1589873,offset:0},{name:"g",base:yt.MASS,prefixes:Nt.SHORT,value:.001,offset:0},{name:"gram",base:yt.MASS,prefixes:Nt.LONG,value:.001,offset:0},{name:"ton",base:yt.MASS,prefixes:Nt.SHORT,value:907.18474,offset:0},{name:"tonne",base:yt.MASS,prefixes:Nt.SHORT,value:1e3,offset:0},{name:"grain",base:yt.MASS,prefixes:Nt.NONE,value:6479891e-11,offset:0},{name:"dram",base:yt.MASS,prefixes:Nt.NONE,value:.0017718451953125,offset:0},{name:"ounce",base:yt.MASS,prefixes:Nt.NONE,value:.028349523125,offset:0},{name:"poundmass",base:yt.MASS,prefixes:Nt.NONE,value:.45359237,offset:0},{name:"hundredweight",base:yt.MASS,prefixes:Nt.NONE,value:45.359237,offset:0},{name:"stick",base:yt.MASS,prefixes:Nt.NONE,value:.115,offset:0},{name:"gr",base:yt.MASS,prefixes:Nt.NONE,value:6479891e-11,offset:0},{name:"dr",base:yt.MASS,prefixes:Nt.NONE,value:.0017718451953125,offset:0},{name:"oz",base:yt.MASS,prefixes:Nt.NONE,value:.028349523125,offset:0},{name:"lbm",base:yt.MASS,prefixes:Nt.NONE,value:.45359237,offset:0},{name:"cwt",base:yt.MASS,prefixes:Nt.NONE,value:45.359237,offset:0},{name:"s",base:yt.TIME,prefixes:Nt.SHORT,value:1,offset:0},{name:"min",base:yt.TIME,prefixes:Nt.NONE,value:60,offset:0},{name:"h",base:yt.TIME,prefixes:Nt.NONE,value:3600,offset:0},{name:"seconds",base:yt.TIME,prefixes:Nt.LONG,value:1,offset:0},{name:"second",base:yt.TIME,prefixes:Nt.LONG,value:1,offset:0},{name:"sec",base:yt.TIME,prefixes:Nt.LONG,value:1,offset:0},{name:"minutes",base:yt.TIME,prefixes:Nt.NONE,value:60,offset:0},{name:"minute",base:yt.TIME,prefixes:Nt.NONE,value:60,offset:0},{name:"hours",base:yt.TIME,prefixes:Nt.NONE,value:3600,offset:0},{name:"hour",base:yt.TIME,prefixes:Nt.NONE,value:3600,offset:0},{name:"day",base:yt.TIME,prefixes:Nt.NONE,value:86400,offset:0},{name:"days",base:yt.TIME,prefixes:Nt.NONE,value:86400,offset:0},{name:"rad",base:yt.ANGLE,prefixes:Nt.NONE,value:1,offset:0},{name:"deg",base:yt.ANGLE,prefixes:Nt.NONE,value:.017453292519943295,offset:0},{name:"grad",base:yt.ANGLE,prefixes:Nt.NONE,value:.015707963267948967,offset:0},{name:"cycle",base:yt.ANGLE,prefixes:Nt.NONE,value:6.283185307179586,offset:0},{name:"A",base:yt.CURRENT,prefixes:Nt.SHORT,value:1,offset:0},{name:"ampere",base:yt.CURRENT,prefixes:Nt.LONG,value:1,offset:0},{name:"K",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:0},{name:"degC",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:273.15},{name:"degF",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:459.67},{name:"degR",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:0},{name:"kelvin",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:0},{name:"celsius",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:273.15},{name:"fahrenheit",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:459.67},{name:"rankine",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:0},{name:"mol",base:yt.AMOUNT_OF_SUBSTANCE,prefixes:Nt.NONE,value:1,offset:0},{name:"mole",base:yt.AMOUNT_OF_SUBSTANCE,prefixes:Nt.NONE,value:1,offset:0},{name:"cd",base:yt.LUMINOUS_INTENSITY,prefixes:Nt.NONE,value:1,offset:0},{name:"candela",base:yt.LUMINOUS_INTENSITY,prefixes:Nt.NONE,value:1,offset:0},{name:"N",base:yt.FORCE,prefixes:Nt.SHORT,value:1,offset:0},{name:"newton",base:yt.FORCE,prefixes:Nt.LONG,value:1,offset:0},{name:"lbf",base:yt.FORCE,prefixes:Nt.NONE,value:4.4482216152605,offset:0},{name:"poundforce",base:yt.FORCE,prefixes:Nt.NONE,value:4.4482216152605,offset:0},{name:"b",base:yt.BIT,prefixes:Nt.BINARY_SHORT,value:1,offset:0},{name:"bits",base:yt.BIT,prefixes:Nt.BINARY_LONG,value:1,offset:0},{name:"B",base:yt.BIT,prefixes:Nt.BINARY_SHORT,value:8,offset:0},{name:"bytes",base:yt.BIT,prefixes:Nt.BINARY_LONG,value:8,offset:0}],gt.Complex=i,i.parse=function(e){var n=0,r=0; +(function(){function e(t,n){if(this.constructor!=e)throw Error("Unit constructor must be called with the new operator");this.value=1,this.unit=e.UNIT_NONE,this.prefix=e.PREFIX_NONE,this.hasUnit=!1,this.hasValue=!1,this.fixPrefix=!1,this._init(t,n)}function t(e){return e instanceof String||"string"==typeof e}function n(e){return e instanceof Number||"number"==typeof e}function r(e){return e==Math.round(e)}function i(e,r){if(this.constructor!=i)throw new SyntaxError("Complex constructor must be called with the new operator");switch(arguments.length){case 2:if(!n(e)||!n(r))throw new TypeError("Two numbers or a single string expected in Complex constructor");this.re=e,this.im=r;break;case 1:if(!t(e))throw new TypeError("Two numbers or a single string expected in Complex constructor");var a=i.parse(e);if(a)return a;throw new SyntaxError('"'+e+'" is no valid complex number');case 0:this.re=0,this.im=0;break;default:throw new SyntaxError("Wrong number of arguments in Complex constructor ("+arguments.length+" provided, 0, 1, or 2 expected)")}}function a(e){return e.replace(/^\s+|\s+$/g,"")}function s(e,t){var n=void 0;if(2==arguments.length){var r=l(t);n="Function "+e+" does not support a parameter of type "+r}else if(arguments.length>2){for(var i=[],a=1;arguments.length>a;a++)i.push(l(arguments[a]));n="Function "+e+" does not support a parameters of type "+i.join(", ")}else n="Unsupported parameter in function "+e;return new TypeError(n)}function o(e,t,n,r){var i="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(void 0!=r?"-"+r:"")+" expected)";return new SyntaxError(i)}function f(e,n){var r;if(t(e)){if("undefined"==typeof require)throw Error("Cannot load file: require not available.");var i=require(e);f(i)}else if(u(e)){if(r=e.name,!r)throw Error("Cannot import an unnamed function");(n||void 0===gt[r])&&(gt[r]=e)}else if(e instanceof Object)for(r in e)if(e.hasOwnProperty(r)){var a=e[r];u(a)?(n||void 0===gt[r])&&(gt[r]=a):f(a)}}function u(r){return"function"==typeof r||n(r)||t(r)||r instanceof i||r instanceof e}function h(e){if(1!=arguments.length)throw o("help",arguments.length,1);if(void 0!=e){if(e.doc)return c(e.doc);if(e.constructor.doc)return c(e.constructor.doc);if(t(e)){var n=gt[e];if(n&&n.doc)return c(n.doc)}}return e instanceof Object&&e.name?'No documentation found on subject "'+e.name+'"':e instanceof Object&&e.constructor.name?'No documentation found on subject "'+e.constructor.name+'"':'No documentation found on subject "'+e+'"'}function c(e){var t="";if(e.name&&(t+="NAME\n"+e.name+"\n\n"),e.category&&(t+="CATEGORY\n"+e.category+"\n\n"),e.syntax&&(t+="SYNTAX\n"+e.syntax.join("\n")+"\n\n"),e.examples){t+="EXAMPLES\n";for(var n=0;e.examples.length>n;n++)t+=e.examples[n]+"\n";t+="\n"}return e.seealso&&(t+="SEE ALSO\n"+e.seealso.join(", ")+"\n"),t}function l(e){if(1!=arguments.length)throw o("typeof",arguments.length,1);var t=typeof e;if("object"==t){if(null==e)return"null";if(e&&e.constructor&&e.constructor.name)return e.constructor.name.toLowerCase()}return t}function p(){if(0==arguments.length)throw Error("Function sum requires one or more parameters (0 provided)");if(1==arguments.length&&arguments[0]instanceof Array)return p.apply(this,arguments[0]);for(var e=arguments[0],t=1,n=arguments.length;n>t;t++){var r=arguments[t];X(r,e)&&(e=r)}return e}function m(){if(0==arguments.length)throw Error("Function sum requires one or more parameters (0 provided)");if(1==arguments.length&&arguments[0]instanceof Array)return m.apply(this,arguments[0]);for(var e=arguments[0],t=1,n=arguments.length;n>t;t++){var r=arguments[t];K(r,e)&&(e=r)}return e}function d(t,n){if(2!=arguments.length)throw o("in",arguments.length,2);if(t instanceof e){if(n.hasValue)throw Error("Cannot convert to a unit with a value");if(!n.hasUnit)throw Error("Unit expected on the right hand side of function in");var r=n.copy();return r.value=t.value,r.fixPrefix=!0,r}throw s("in",t)}function g(t){if(1!=arguments.length)throw o("sin",arguments.length,1);if(n(t))return Math.sin(t);if(t instanceof i)return new i(.5*Math.sin(t.re)*(Math.exp(-t.im)+Math.exp(t.im)),.5*Math.cos(t.re)*(Math.exp(t.im)-Math.exp(-t.im)));if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.sin(t.value)}if(t instanceof Array)return vt.map(t,g);throw s("sin",t)}function v(e,t){if(2!=arguments.length)throw o("atan2",arguments.length,2);if(n(e)){if(n(t))return Math.atan2(e,t);if(t instanceof i)return Math.atan2(e,t.re)}else if(e instanceof i){if(n(t))return Math.atan2(e.re,t);if(t instanceof i)return Math.atan2(e.re,t.re)}throw s("atan2",e,t)}function x(e){if(1!=arguments.length)throw o("asin",arguments.length,1);if(n(e))return e>=-1&&1>=e?Math.asin(e):x(new i(e,0));if(e instanceof i){var t=e.re,r=e.im,a=new i(r*r-t*t+1,-2*t*r),f=H(a),u=new i(f.re-r,f.im+t),h=Q(u);return new i(h.im,-h.re)}if(e instanceof Array)return vt.map(e,x);throw s("asin",e)}function y(e){if(1!=arguments.length)throw o("atan",arguments.length,1);if(n(e))return Math.atan(e);if(e instanceof i){var t=e.re,r=e.im,a=t*t+(1-r)*(1-r),f=new i((1-r*r-t*t)/a,-2*t/a),u=Q(f);return new i(-.5*u.im,.5*u.re)}if(e instanceof Array)return vt.map(e,y);throw s("atan",e)}function N(t){if(1!=arguments.length)throw o("csc",arguments.length,1);if(n(t))return 1/Math.sin(t);if(t instanceof i){var r=.25*(Math.exp(-2*t.im)+Math.exp(2*t.im))-.5*Math.cos(2*t.re);return new i(.5*Math.sin(t.re)*(Math.exp(-t.im)+Math.exp(t.im))/r,.5*Math.cos(t.re)*(Math.exp(-t.im)-Math.exp(t.im))/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return 1/Math.sin(t.value)}if(t instanceof Array)return vt.map(t,N);throw s("csc",t)}function E(t){if(1!=arguments.length)throw o("cos",arguments.length,1);if(n(t))return Math.cos(t);if(t instanceof i)return new i(.5*Math.cos(t.re)*(Math.exp(-t.im)+Math.exp(t.im)),.5*Math.sin(t.re)*(Math.exp(-t.im)-Math.exp(t.im)));if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return Math.cos(t.value)}if(t instanceof Array)return vt.map(t,E);throw s("cos",t)}function w(t){if(1!=arguments.length)throw o("cot",arguments.length,1);if(n(t))return 1/Math.tan(t);if(t instanceof i){var r=Math.exp(-4*t.im)-2*Math.exp(-2*t.im)*Math.cos(2*t.re)+1;return new i(2*Math.exp(-2*t.im)*Math.sin(2*t.re)/r,(Math.exp(-4*t.im)-1)/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return 1/Math.tan(t.value)}if(t instanceof Array)return vt.map(t,w);throw s("cot",t)}function b(t){if(1!=arguments.length)throw o("sec",arguments.length,1);if(n(t))return 1/Math.cos(t);if(t instanceof i){var r=.25*(Math.exp(-2*t.im)+Math.exp(2*t.im))+.5*Math.cos(2*t.re);return new i(.5*Math.cos(t.re)*(Math.exp(-t.im)+Math.exp(t.im))/r,.5*Math.sin(t.re)*(Math.exp(t.im)-Math.exp(-t.im))/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return 1/Math.cos(t.value)}if(t instanceof Array)return vt.map(t,b);throw s("sec",t)}function M(t){if(1!=arguments.length)throw o("tan",arguments.length,1);if(n(t))return Math.tan(t);if(t instanceof i){var r=Math.exp(-4*t.im)+2*Math.exp(-2*t.im)*Math.cos(2*t.re)+1;return new i(2*Math.exp(-2*t.im)*Math.sin(2*t.re)/r,(1-Math.exp(-4*t.im))/r)}if(t instanceof e){if(!t.hasBase(e.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return Math.tan(t.value)}if(t instanceof Array)return vt.map(t,M);throw s("tan",t)}function O(e){if(1!=arguments.length)throw o("acos",arguments.length,1);if(n(e))return e>=-1&&1>=e?Math.acos(e):O(new i(e,0));if(e instanceof i){var t=new i(e.im*e.im-e.re*e.re+1,-2*e.re*e.im),r=H(t),a=new i(r.re-e.im,r.im+e.re),f=Q(a);return new i(1.5707963267948966-f.im,f.re)}if(e instanceof Array)return vt.map(e,O);throw s("acos",e)}function T(e){if(1!=arguments.length)throw o("arg",arguments.length,1);if(n(e))return Math.atan2(0,e);if(e instanceof i)return Math.atan2(e.im,e.re);if(e instanceof Array)return vt.map(e,T);throw s("arg",e)}function S(e){if(1!=arguments.length)throw o("conj",arguments.length,1);if(n(e))return e;if(e instanceof i)return new i(e.re,-e.im);if(e instanceof Array)return vt.map(e,S);throw s("conj",e)}function k(e){if(1!=arguments.length)throw o("im",arguments.length,1);if(n(e))return 0;if(e instanceof i)return e.im;if(e instanceof Array)return vt.map(e,k);throw s("im",e)}function _(e){if(1!=arguments.length)throw o("re",arguments.length,1);if(n(e))return e;if(e instanceof i)return e.re;if(e instanceof Array)return vt.map(e,_);throw s("re",e)}function A(e){if(1!=arguments.length)throw o("cube",arguments.length,1);if(n(e))return e*e*e;if(e instanceof i)return nt(nt(e,e),e);throw s("cube",e)}function U(t,r){if(2!=arguments.length)throw o("divide",arguments.length,2);if(n(t)){if(n(r))return t/r;if(r instanceof i)return q(new i(t,0),r)}else if(t instanceof i){if(n(r))return q(t,new i(r,0));if(r instanceof i)return q(t,r)}else if(t instanceof e&&n(r)){var a=t.copy();return a.value/=r,a}throw s("divide",t,r)}function q(e,t){var n=t.re*t.re+t.im*t.im;return new i((e.re*t.re+e.im*t.im)/n,(e.im*t.re-e.re*t.im)/n)}function L(r,a){if(2!=arguments.length)throw o("smallereq",arguments.length,2);if(n(r)){if(n(a))return a>=r;if(a instanceof i)return Z(a)>=r}if(r instanceof i){if(n(a))return a>=Z(r);if(a instanceof i)return Z(r)<=Z(a)}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value<=a.value}if(t(r)||t(a))return a>=r;throw s("smallereq",r,a)}function C(e,t){if(1!=arguments.length&&2!=arguments.length)throw o("round",arguments.length,1,2);if(void 0==t){if(n(e))return Math.round(e);if(e instanceof i)return new i(Math.round(e.re),Math.round(e.im));throw s("round",e)}if(!n(t))throw new TypeError("Number of digits in function round must be an integer");if(t!==Math.round(t))throw new TypeError("Number of digits in function round must be integer");if(0>t||t>9)throw Error("Number of digits in function round must be in te range of 0-9");if(n(e))return I(e,t);if(e instanceof i)return new i(I(e.re,t),I(e.im,t));throw s("round",e,t)}function I(e,t){var n=Math.pow(10,void 0!=t?t:gt.options.precision);return Math.round(e*n)/n}function R(r,a){if(2!=arguments.length)throw o("equal",arguments.length,2);if(n(r)){if(n(a))return r==a;if(a instanceof i)return r==a.re&&0==a.im}if(r instanceof i){if(n(a))return r.re==a&&0==r.im;if(a instanceof i)return r.re==a.re&&r.im==a.im}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value==a.value}if(t(r)||t(a))return r==a;throw s("equal",r,a)}function P(r,a){if(2!=arguments.length)throw o("unequal",arguments.length,2);if(n(r)){if(n(a))return r==a;if(a instanceof i)return r==a.re&&0==a.im}if(r instanceof i){if(n(a))return r.re==a&&0==r.im;if(a instanceof i)return r.re==a.re&&r.im==a.im}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value==a.value}if(t(r)||t(a))return r==a;throw s("unequal",r,a)}function B(e){if(1!=arguments.length)throw o("log10",arguments.length,1);if(n(e))return e>=0?Math.log(e)/Math.LN10:B(new i(e,0));if(e instanceof i)return new i(Math.log(Math.sqrt(e.re*e.re+e.im*e.im))/Math.LN10,Math.atan2(e.im,e.re)/Math.LN10);if(e instanceof Array)return vt.map(e,B);throw s("log10",e)}function G(e){if(1!=arguments.length)throw o("fix",arguments.length,1);if(n(e))return value>0?Math.floor(e):Math.ceil(e);if(e instanceof i)return new i(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im));if(e instanceof Array)return vt.map(e,G);throw s("fix",e)}function D(r,a){if(2!=arguments.length)throw o("add",arguments.length,2);if(n(r)){if(n(a))return r+a;if(a instanceof i)return new i(r+a.re,a.im)}else if(r instanceof i){if(n(a))return new i(r.re+a,r.im);if(a instanceof i)return new i(r.re+a.re,r.im+a.im)}else if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Units do not match");if(!r.hasValue)throw Error("Unit on left hand side of operator + has no value");if(!a.hasValue)throw Error("Unit on right hand side of operator + has no value");var f=r.copy();return f.value+=a.value,f.fixPrefix=!1,f}if(t(r)||t(a))return r+a;throw s("add",r,a)}function Y(e,t){if(2!=arguments.length)throw o("mod",arguments.length,2);if(n(e)){if(n(t))return e%t;if(t instanceof i&&0==t.im)return e%t.re}else if(e instanceof i&&0==e.im){if(n(t))return e.re%t;if(t instanceof i&&0==t.im)return e.re%t.re}throw s("mod",e,t)}function V(e){if(1!=arguments.length)throw o("exp",arguments.length,1);if(n(e))return Math.exp(e);if(e instanceof i){var t=Math.exp(e.re);return new i(t*Math.cos(e.im),t*Math.sin(e.im))}if(e instanceof Array)return vt.map(e,V);throw s("exp",e)}function F(r,a){if(2!=arguments.length)throw o("largereq",arguments.length,2);if(n(r)){if(n(a))return r>=a;if(a instanceof i)return r>=Z(a)}if(r instanceof i){if(n(a))return Z(r)>=a;if(a instanceof i)return Z(r)>=Z(a)}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value>=a.value}if(t(r)||t(a))return r>=a;throw s("largereq",r,a)}function H(e){if(1!=arguments.length)throw o("sqrt",arguments.length,1);if(n(e))return e>=0?Math.sqrt(e):H(new i(e,0));if(e instanceof i){var t=Math.sqrt(e.re*e.re+e.im*e.im);return e.im>=0?new i(.5*Math.sqrt(2*(t+e.re)),.5*Math.sqrt(2*(t-e.re))):new i(.5*Math.sqrt(2*(t+e.re)),-.5*Math.sqrt(2*(t-e.re)))}if(e instanceof Array)return vt.map(e,H);throw s("sqrt",e)}function j(e){if(1!=arguments.length)throw o("square",arguments.length,1);if(n(e))return e*e;if(e instanceof i)return nt(e,e);throw s("square",e)}function K(r,a){if(2!=arguments.length)throw o("larger",arguments.length,2);if(n(r)){if(n(a))return r>a;if(a instanceof i)return r>Z(a)}if(r instanceof i){if(n(a))return Z(r)>a;if(a instanceof i)return Z(r)>Z(a)}if(r instanceof e&&a instanceof e){if(!r.equalBase(a))throw Error("Cannot compare units with different base");return r.value>a.value}if(t(r)||t(a))return r>a;throw s("larger",r,a)}function z(e){if(1!=arguments.length)throw o("sign",arguments.length,1);if(n(e)){var t;return t=e>0?1:0>e?-1:0}if(e instanceof i){var r=Math.sqrt(e.re*e.re+e.im*e.im);return new i(e.re/r,e.im/r)}if(e instanceof Array)return vt.map(e,t);throw s("sign",e)}function W(t){if(1!=arguments.length)throw o("unaryminus",arguments.length,1);if(n(t))return-t;if(t instanceof i)return new i(-t.re,-t.im);if(t instanceof e){var r=t.copy();return r.value=-t.value,r}if(t instanceof Array)return vt.map(t,W);throw s("unaryminus",t)}function X(r,a){if(2!=arguments.length)throw o("smaller",arguments.length,2);if(n(r)){if(n(a))return a>r;if(a instanceof i)return Z(a)>r}if(r instanceof i){if(n(a))return a>Z(r);if(a instanceof i)return Z(r)r;throw s("smaller",r,a)}function Z(e){if(1!=arguments.length)throw o("abs",arguments.length,1);if(n(e))return Math.abs(e);if(e instanceof i)return Math.sqrt(e.re*e.re+e.im*e.im);if(e instanceof Array)return vt.map(e,Z);throw s("abs",e)}function Q(e,t){if(1!=arguments.length&&2!=arguments.length)throw o("log",arguments.length,1,2);if(void 0!==t)return U(Q(e),Q(t));if(n(e))return e>=0?Math.log(e):Q(new i(e,0));if(e instanceof i)return new i(Math.log(Math.sqrt(e.re*e.re+e.im*e.im)),Math.atan2(e.im,e.re));if(e instanceof Array)return vt.map(e,Q);throw s("log",e,t)}function J(e,t){if(2!=arguments.length)throw o("pow",arguments.length,2);if(n(e)){if(n(t))return r(t)||e>=0?Math.pow(e,t):$(new i(e,0),new i(t,0));if(t instanceof i)return $(new i(e,0),t)}else if(e instanceof i){if(n(t))return $(e,new i(t,0));if(t instanceof i)return $(e,t)}throw s("pow",e,t)}function $(e,t){var n=Q(e),r=nt(n,t);return V(r)}function et(e){if(1!=arguments.length)throw o("floor",arguments.length,1);if(n(e))return Math.floor(e);if(e instanceof i)return new i(Math.floor(e.re),Math.floor(e.im));if(e instanceof Array)return vt.map(e,et);throw s("floor",e)}function tt(e){if(1!=arguments.length)throw o("ceil",arguments.length,1);if(n(e))return Math.ceil(e);if(e instanceof i)return new i(Math.ceil(e.re),Math.ceil(e.im));if(e instanceof Array)return vt.map(e,tt);throw s("ceil",e)}function nt(t,r){var a;if(2!=arguments.length)throw o("multiply",arguments.length,2);if(n(t)){if(n(r))return t*r;if(r instanceof i)return rt(new i(t,0),r);if(r instanceof e)return a=r.copy(),a.value*=t,a}else if(t instanceof i){if(n(r))return rt(t,new i(r,0));if(r instanceof i)return rt(t,r)}else if(t instanceof e&&n(r))return a=t.copy(),a.value*=r,a;throw s("multiply",t,r)}function rt(e,t){return new i(e.re*t.re-e.im*t.im,e.re*t.im+e.im*t.re)}function it(t,r){if(2!=arguments.length)throw o("subtract",arguments.length,2);if(n(t)){if(n(r))return t-r;if(r instanceof i)return new i(t-r.re,r.im)}else if(t instanceof i){if(n(r))return new i(t.re-r,t.im);if(r instanceof i)return new i(t.re-r.re,t.im-r.im)}else if(t instanceof e&&r instanceof e){if(!t.equalBase(r))throw Error("Units do not match");if(!t.hasValue)throw Error("Unit on left hand side of operator - has no value");if(!r.hasValue)throw Error("Unit on right hand side of operator - has no value");var a=t.copy();return a.value-=r.value,a.fixPrefix=!1,a}throw s("subtract",t,r)}function at(){if(0!=arguments.length)throw o("random",arguments.length,0);return Math.random()}function st(e){if(1!=arguments.length)throw o("factorial",arguments.length,1);if(n(e)){if(!r(e))throw new TypeError("Function factorial can only handle integer values");var t=e,i=t;for(t--;t>1;)i*=t,t--;return 0==i&&(i=1),i}if(e instanceof Array)return vt.map(e,st);throw s("factorial",e)}function ot(){}function ft(e,t,n){this.name=e,this.fn=t,this.params=n}function ut(e){this.value=e}function ht(){this.params=[],this.visible=[]}function ct(e,t,n,r){this.name=e,this.params=t,this.expr=n,this.result=r}function lt(e,t,n,r,i){this.name=e,this.variables=n,this.values=[];for(var a=0,s=this.variables.length;s>a;a++)this.values[a]=function(){var e=function(){return e.value};return e.value=void 0,e}();this.def=this.createFunction(e,t,n,r),this.result=i}function pt(e){this.parentScope=e,this.nestedScopes=void 0,this.symbols={},this.defs={},this.updates={},this.links={}}function mt(){if(this.constructor!=mt)throw new SyntaxError("Parser constructor must be called with the new operator");this.TOKENTYPE={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},this.expr="",this.index=0,this.c="",this.token="",this.token_type=this.TOKENTYPE.NULL,this.scope=new pt}function dt(){this.idMax=-1,this.updateSeq=0,this.parser=new mt,this.scope=new pt,this.nodes={},this.firstNode=void 0,this.lastNode=void 0}var gt={parser:{node:{}},options:{precision:10}};"undefined"!=typeof module&&module.exports!==void 0&&(module.exports=gt),"undefined"!=typeof exports&&(exports=gt),"undefined"!=typeof require&&"undefined"!=typeof define&&define(function(){return gt}),"undefined"!=typeof window&&(window.math=gt);var vt={};if(vt.format=function(e,t){if(1/0===e)return"Infinity";if(e===-1/0)return"-Infinity";if(0/0===e)return"NaN";var n=Math.abs(e);if(n>1e-4&&1e6>n||0==n)return I(e,t)+"";var r=Math.round(Math.log(n)/Math.LN10),i=e/Math.pow(10,r);return I(i,t)+"E"+r},vt.randomUUID=function(){var e=function(){return Math.floor(65536*Math.random()).toString(16)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},vt.map=function(e,t){return e.map(function(e){return t(e)})},!Array.prototype.indexOf){Array.prototype.indexOf=function(e){for(var t=0;this.length>t;t++)if(this[t]==e)return t;return-1};try{console.log("Warning: Ancient browser detected. Please update your browser")}catch(xt){}}Array.prototype.forEach||(Array.prototype.forEach=function(e,t){for(var n=0,r=this.length;r>n;++n)e.call(t||this,this[n],n,this)}),Array.prototype.map||(Array.prototype.map=function(e,t){var n,r,i;if(null==this)throw new TypeError(" this is null or not defined");var a=Object(this),s=a.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(t&&(n=t),r=Array(s),i=0;s>i;){var o,f;i in a&&(o=a[i],f=e.call(n,o,i,a),r[i]=f),i++}return r}),gt.Unit=e,e.prototype.copy=function(){var t=new e;for(var n in this)this.hasOwnProperty(n)&&(t[n]=this[n]);return t},e.endsWith=function(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t},e.prototype._init=function(t,n){if(void 0!==n){for(var r=e.UNITS,i=!1,a=0,s=r.length;s>a;a++){var o=r[a];if(e.endsWith(n,o.name)){var f=n.length-o.name.length,u=n.substring(0,f),h=o.prefixes[u];if(void 0!==h){this.unit=o,this.prefix=h,this.hasUnit=!0,i=!0;break}}}if(!i)throw Error('String "'+n+'" is no unit')}void 0!==t?(this.value=this._normalize(t),this.hasValue=!0):this.value=this._normalize(1)},e.prototype._normalize=function(e){return(e+this.unit.offset)*this.unit.value*this.prefix.value},e.prototype._unnormalize=function(e,t){return void 0===t?e/this.unit.value/this.prefix.value-this.unit.offset:e/this.unit.value/t-this.unit.offset},e.isUnit=function(t){for(var n=e.UNITS,r=n.length,i=0;r>i;i++){var a=n[i];if(e.endsWith(t,a.name)){var s=t.length-a.name.length;if(0==s)return!0;var o=t.substring(0,s),f=a.prefixes[o];if(void 0!==f)return!0}}return!1},e.prototype.hasBase=function(e){return void 0===this.unit.base?void 0===e:this.unit.base===e},e.prototype.equalBase=function(e){return this.unit.base===e.unit.base},e.prototype.equals=function(e){return this.equalBase(e)&&this.value==e.value},e.prototype.toString=function(){var t;if(this.fixPrefix)return t=this._unnormalize(this.value),vt.format(t)+" "+this.prefix.name+this.unit.name;var n=e.PREFIX_NONE,r=Math.abs(Math.log(this.value/n.value)/Math.LN10-1.5),i=this.unit.prefixes;for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];if(s.scientific){var o=Math.abs(Math.log(this.value/s.value)/Math.LN10-1.5);r>o&&(n=s,r=o)}}return t=this._unnormalize(this.value,n.value),vt.format(t)+" "+n.name+this.unit.name},e.PREFIXES={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},BINARY_SHORT:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1024,scientific:!0},M:{name:"M",value:Math.pow(1024,2),scientific:!0},G:{name:"G",value:Math.pow(1024,3),scientific:!0},T:{name:"T",value:Math.pow(1024,4),scientific:!0},P:{name:"P",value:Math.pow(1024,5),scientific:!0},E:{name:"E",value:Math.pow(1024,6),scientific:!0},Z:{name:"Z",value:Math.pow(1024,7),scientific:!0},Y:{name:"Y",value:Math.pow(1024,8),scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1024,scientific:!0},mega:{name:"mega",value:Math.pow(1024,2),scientific:!0},giga:{name:"giga",value:Math.pow(1024,3),scientific:!0},tera:{name:"tera",value:Math.pow(1024,4),scientific:!0},peta:{name:"peta",value:Math.pow(1024,5),scientific:!0},exa:{name:"exa",value:Math.pow(1024,6),scientific:!0},zetta:{name:"zetta",value:Math.pow(1024,7),scientific:!0},yotta:{name:"yotta",value:Math.pow(1024,8),scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}}},e.PREFIX_NONE={name:"",value:1,scientific:!0},e.BASE_UNITS={NONE:{},LENGTH:{},MASS:{},TIME:{},CURRENT:{},TEMPERATURE:{},LUMINOUS_INTENSITY:{},AMOUNT_OF_SUBSTANCE:{},FORCE:{},SURFACE:{},VOLUME:{},ANGLE:{},BIT:{}};var yt=e.BASE_UNITS,Nt=e.PREFIXES;e.BASE_UNIT_NONE={},e.UNIT_NONE={name:"",base:e.BASE_UNIT_NONE,value:1,offset:0},e.UNITS=[{name:"meter",base:yt.LENGTH,prefixes:Nt.LONG,value:1,offset:0},{name:"inch",base:yt.LENGTH,prefixes:Nt.NONE,value:.0254,offset:0},{name:"foot",base:yt.LENGTH,prefixes:Nt.NONE,value:.3048,offset:0},{name:"yard",base:yt.LENGTH,prefixes:Nt.NONE,value:.9144,offset:0},{name:"mile",base:yt.LENGTH,prefixes:Nt.NONE,value:1609.344,offset:0},{name:"link",base:yt.LENGTH,prefixes:Nt.NONE,value:.201168,offset:0},{name:"rod",base:yt.LENGTH,prefixes:Nt.NONE,value:5.02921,offset:0},{name:"chain",base:yt.LENGTH,prefixes:Nt.NONE,value:20.1168,offset:0},{name:"angstrom",base:yt.LENGTH,prefixes:Nt.NONE,value:1e-10,offset:0},{name:"m",base:yt.LENGTH,prefixes:Nt.SHORT,value:1,offset:0},{name:"ft",base:yt.LENGTH,prefixes:Nt.NONE,value:.3048,offset:0},{name:"yd",base:yt.LENGTH,prefixes:Nt.NONE,value:.9144,offset:0},{name:"mi",base:yt.LENGTH,prefixes:Nt.NONE,value:1609.344,offset:0},{name:"li",base:yt.LENGTH,prefixes:Nt.NONE,value:.201168,offset:0},{name:"rd",base:yt.LENGTH,prefixes:Nt.NONE,value:5.02921,offset:0},{name:"ch",base:yt.LENGTH,prefixes:Nt.NONE,value:20.1168,offset:0},{name:"mil",base:yt.LENGTH,prefixes:Nt.NONE,value:254e-7,offset:0},{name:"m2",base:yt.SURFACE,prefixes:Nt.SHORT,value:1,offset:0},{name:"sqin",base:yt.SURFACE,prefixes:Nt.NONE,value:64516e-8,offset:0},{name:"sqft",base:yt.SURFACE,prefixes:Nt.NONE,value:.09290304,offset:0},{name:"sqyd",base:yt.SURFACE,prefixes:Nt.NONE,value:.83612736,offset:0},{name:"sqmi",base:yt.SURFACE,prefixes:Nt.NONE,value:2589988.110336,offset:0},{name:"sqrd",base:yt.SURFACE,prefixes:Nt.NONE,value:25.29295,offset:0},{name:"sqch",base:yt.SURFACE,prefixes:Nt.NONE,value:404.6873,offset:0},{name:"sqmil",base:yt.SURFACE,prefixes:Nt.NONE,value:6.4516e-10,offset:0},{name:"m3",base:yt.VOLUME,prefixes:Nt.SHORT,value:1,offset:0},{name:"L",base:yt.VOLUME,prefixes:Nt.SHORT,value:.001,offset:0},{name:"litre",base:yt.VOLUME,prefixes:Nt.LONG,value:.001,offset:0},{name:"cuin",base:yt.VOLUME,prefixes:Nt.NONE,value:16387064e-12,offset:0},{name:"cuft",base:yt.VOLUME,prefixes:Nt.NONE,value:.028316846592,offset:0},{name:"cuyd",base:yt.VOLUME,prefixes:Nt.NONE,value:.764554857984,offset:0},{name:"teaspoon",base:yt.VOLUME,prefixes:Nt.NONE,value:5e-6,offset:0},{name:"tablespoon",base:yt.VOLUME,prefixes:Nt.NONE,value:15e-6,offset:0},{name:"minim",base:yt.VOLUME,prefixes:Nt.NONE,value:6.161152e-8,offset:0},{name:"fluiddram",base:yt.VOLUME,prefixes:Nt.NONE,value:36966911e-13,offset:0},{name:"fluidounce",base:yt.VOLUME,prefixes:Nt.NONE,value:2957353e-11,offset:0},{name:"gill",base:yt.VOLUME,prefixes:Nt.NONE,value:.0001182941,offset:0},{name:"cup",base:yt.VOLUME,prefixes:Nt.NONE,value:.0002365882,offset:0},{name:"pint",base:yt.VOLUME,prefixes:Nt.NONE,value:.0004731765,offset:0},{name:"quart",base:yt.VOLUME,prefixes:Nt.NONE,value:.0009463529,offset:0},{name:"gallon",base:yt.VOLUME,prefixes:Nt.NONE,value:.003785412,offset:0},{name:"beerbarrel",base:yt.VOLUME,prefixes:Nt.NONE,value:.1173478,offset:0},{name:"oilbarrel",base:yt.VOLUME,prefixes:Nt.NONE,value:.1589873,offset:0},{name:"hogshead",base:yt.VOLUME,prefixes:Nt.NONE,value:.238481,offset:0},{name:"fldr",base:yt.VOLUME,prefixes:Nt.NONE,value:36966911e-13,offset:0},{name:"floz",base:yt.VOLUME,prefixes:Nt.NONE,value:2957353e-11,offset:0},{name:"gi",base:yt.VOLUME,prefixes:Nt.NONE,value:.0001182941,offset:0},{name:"cp",base:yt.VOLUME,prefixes:Nt.NONE,value:.0002365882,offset:0},{name:"pt",base:yt.VOLUME,prefixes:Nt.NONE,value:.0004731765,offset:0},{name:"qt",base:yt.VOLUME,prefixes:Nt.NONE,value:.0009463529,offset:0},{name:"gal",base:yt.VOLUME,prefixes:Nt.NONE,value:.003785412,offset:0},{name:"bbl",base:yt.VOLUME,prefixes:Nt.NONE,value:.1173478,offset:0},{name:"obl",base:yt.VOLUME,prefixes:Nt.NONE,value:.1589873,offset:0},{name:"g",base:yt.MASS,prefixes:Nt.SHORT,value:.001,offset:0},{name:"gram",base:yt.MASS,prefixes:Nt.LONG,value:.001,offset:0},{name:"ton",base:yt.MASS,prefixes:Nt.SHORT,value:907.18474,offset:0},{name:"tonne",base:yt.MASS,prefixes:Nt.SHORT,value:1e3,offset:0},{name:"grain",base:yt.MASS,prefixes:Nt.NONE,value:6479891e-11,offset:0},{name:"dram",base:yt.MASS,prefixes:Nt.NONE,value:.0017718451953125,offset:0},{name:"ounce",base:yt.MASS,prefixes:Nt.NONE,value:.028349523125,offset:0},{name:"poundmass",base:yt.MASS,prefixes:Nt.NONE,value:.45359237,offset:0},{name:"hundredweight",base:yt.MASS,prefixes:Nt.NONE,value:45.359237,offset:0},{name:"stick",base:yt.MASS,prefixes:Nt.NONE,value:.115,offset:0},{name:"gr",base:yt.MASS,prefixes:Nt.NONE,value:6479891e-11,offset:0},{name:"dr",base:yt.MASS,prefixes:Nt.NONE,value:.0017718451953125,offset:0},{name:"oz",base:yt.MASS,prefixes:Nt.NONE,value:.028349523125,offset:0},{name:"lbm",base:yt.MASS,prefixes:Nt.NONE,value:.45359237,offset:0},{name:"cwt",base:yt.MASS,prefixes:Nt.NONE,value:45.359237,offset:0},{name:"s",base:yt.TIME,prefixes:Nt.SHORT,value:1,offset:0},{name:"min",base:yt.TIME,prefixes:Nt.NONE,value:60,offset:0},{name:"h",base:yt.TIME,prefixes:Nt.NONE,value:3600,offset:0},{name:"seconds",base:yt.TIME,prefixes:Nt.LONG,value:1,offset:0},{name:"second",base:yt.TIME,prefixes:Nt.LONG,value:1,offset:0},{name:"sec",base:yt.TIME,prefixes:Nt.LONG,value:1,offset:0},{name:"minutes",base:yt.TIME,prefixes:Nt.NONE,value:60,offset:0},{name:"minute",base:yt.TIME,prefixes:Nt.NONE,value:60,offset:0},{name:"hours",base:yt.TIME,prefixes:Nt.NONE,value:3600,offset:0},{name:"hour",base:yt.TIME,prefixes:Nt.NONE,value:3600,offset:0},{name:"day",base:yt.TIME,prefixes:Nt.NONE,value:86400,offset:0},{name:"days",base:yt.TIME,prefixes:Nt.NONE,value:86400,offset:0},{name:"rad",base:yt.ANGLE,prefixes:Nt.NONE,value:1,offset:0},{name:"deg",base:yt.ANGLE,prefixes:Nt.NONE,value:.017453292519943295,offset:0},{name:"grad",base:yt.ANGLE,prefixes:Nt.NONE,value:.015707963267948967,offset:0},{name:"cycle",base:yt.ANGLE,prefixes:Nt.NONE,value:6.283185307179586,offset:0},{name:"A",base:yt.CURRENT,prefixes:Nt.SHORT,value:1,offset:0},{name:"ampere",base:yt.CURRENT,prefixes:Nt.LONG,value:1,offset:0},{name:"K",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:0},{name:"degC",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:273.15},{name:"degF",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:459.67},{name:"degR",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:0},{name:"kelvin",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:0},{name:"celsius",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1,offset:273.15},{name:"fahrenheit",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:459.67},{name:"rankine",base:yt.TEMPERATURE,prefixes:Nt.NONE,value:1/1.8,offset:0},{name:"mol",base:yt.AMOUNT_OF_SUBSTANCE,prefixes:Nt.NONE,value:1,offset:0},{name:"mole",base:yt.AMOUNT_OF_SUBSTANCE,prefixes:Nt.NONE,value:1,offset:0},{name:"cd",base:yt.LUMINOUS_INTENSITY,prefixes:Nt.NONE,value:1,offset:0},{name:"candela",base:yt.LUMINOUS_INTENSITY,prefixes:Nt.NONE,value:1,offset:0},{name:"N",base:yt.FORCE,prefixes:Nt.SHORT,value:1,offset:0},{name:"newton",base:yt.FORCE,prefixes:Nt.LONG,value:1,offset:0},{name:"lbf",base:yt.FORCE,prefixes:Nt.NONE,value:4.4482216152605,offset:0},{name:"poundforce",base:yt.FORCE,prefixes:Nt.NONE,value:4.4482216152605,offset:0},{name:"b",base:yt.BIT,prefixes:Nt.BINARY_SHORT,value:1,offset:0},{name:"bits",base:yt.BIT,prefixes:Nt.BINARY_LONG,value:1,offset:0},{name:"B",base:yt.BIT,prefixes:Nt.BINARY_SHORT,value:8,offset:0},{name:"bytes",base:yt.BIT,prefixes:Nt.BINARY_LONG,value:8,offset:0}],gt.Complex=i,i.parse=function(e){var n=0,r=0; if(!t(e))return null;var s,o=[],f="+",u=e.lastIndexOf(f);-1==u&&(f="-",u=e.lastIndexOf(f)),-1!=u?(s=a(e.substring(0,u)),s&&o.push(s),s=a(e.substring(u+1)),s&&o.push(f+s)):(s=a(e),s&&o.push(s));var h=!1;switch(o.length){case 1:s=o[0],"I"==s[s.length-1].toUpperCase()?(n=0,r=Number(s.substring(0,s.length-1)),h=!isNaN(r)):(n=Number(s),r=0,h=!isNaN(n));break;case 2:s=o[0],n=Number(o[0]),r=Number(o[1].substring(0,o[1].length-1)),h=!isNaN(n)&&!isNaN(r)&&"I"==o[1][o[1].length-1].toUpperCase()}return h?new i(n,r):null},i.prototype.copy=function(){return new i(this.re,this.im)},i.prototype.toString=function(){var e="";return e=0===this.im?vt.format(this.re):0===this.re?1===this.im?"i":-1===this.im?"-i":vt.format(this.im)+"i":this.im>0?1==this.im?vt.format(this.re)+" + i":vt.format(this.re)+" + "+vt.format(this.im)+"i":-1==this.im?vt.format(this.re)+" - i":vt.format(this.re)+" - "+vt.format(Math.abs(this.im))+"i"},i.doc={name:"Complex",category:"type",syntax:["a + bi","a + b * i"],description:"A complex value a + bi, where a is the real part and b is the complex part, and i is the imaginary number defined as sqrt(-1).",examples:["2 + 3i","sqrt(-4)","(1.2 -5i) * 2"],seealso:["abs","arg","conj","im","re"]},gt.E=Math.E,gt.LN2=Math.LN2,gt.LN10=Math.LN10,gt.LOG2E=Math.LOG2E,gt.LOG10E=Math.LOG10E,gt.PI=Math.PI,gt.SQRT1_2=Math.SQRT1_2,gt.SQRT2=Math.SQRT2,gt.I=new i(0,-1),gt.pi=gt.PI,gt.e=gt.E,gt.i=gt.I,gt["import"]=f,f.doc={name:"import",category:"Utils",syntax:["import(string)"],description:"Import functions from a file.",examples:['import("numbers")','import("./mylib.js")'],seealso:[]},gt.help=h,h.doc={name:"help",category:"Utils",syntax:["help(object)"],description:"Display documentation on a function or data type.",examples:['help("sqrt")','help("Complex")'],seealso:[]},gt["typeof"]=l,l.doc={name:"typeof",category:"Utils",syntax:["typeof(x)"],description:"Get the type of a variable.",examples:["typeof(3.5)","typeof(2 - 4i)","typeof(45 deg)",'typeof("hello world")'],seealso:[]},gt.min=p,p.doc={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)"],description:"Compute the minimum value of a list of values.",examples:["max(2, 3, 4, 1)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["sum","prod","avg","var","std","min","median"]},gt.max=m,m.doc={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["sum","prod","avg","var","std","min","median"]},gt["in"]=d,d.doc={name:"in",category:"Units",syntax:["x in unit","in(x, unit)"],description:"Change the unit of a value.",examples:["5 inch in cm","3.2kg in g","16 bytes in bits"],seealso:[]},gt.sin=g,g.doc={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},gt.atan2=v,v.doc={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},gt.asin=x,x.doc={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(2.3))"],seealso:["sin","acos","asin"]},gt.atan=y,y.doc={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(2.3))"],seealso:["tan","acos","asin"]},gt.csc=N,N.doc={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},gt.cos=E,E.doc={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},gt.cot=w,w.doc={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},gt.sec=b,b.doc={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},gt.tan=M,M.doc={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},gt.acos=O,O.doc={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","acos","asin"]},gt.arg=T,T.doc={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 - 3i)"],seealso:["re","im","conj","abs"]},gt.conj=S,S.doc={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},gt.im=k,k.doc={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},gt.re=_,_.doc={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},gt.cube=A,A.doc={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},gt.divide=U,U.doc={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["2 / 3","ans * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},gt.smallereq=L,L.doc={name:"smallereq",category:"Operators",syntax:["x <= y","smallereq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns 1 if x is smaller than y, and 0 if not.",examples:["2 < 1+1","2 <= 1+1","a = 3.2","b = 6-2.8","(a < b)"],seealso:["equal","unequal","larger","smaller","largereq"]},gt.round=C,C.doc={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]},gt.equal=R,R.doc={name:"equal",category:"Operators",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns 1 if the values are equal, and 0 if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallereq","largereq"]},gt.unequal=P,P.doc={name:"unequal",category:"Operators",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns 1 if the values are unequal, and 0 if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallereq","largereq"]},gt.log10=B,B.doc={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(1000)","10 ^ 3","log10(0.01)","log(1000) / log(10)","log(1000, 10)"],seealso:["exp","log"]},gt.fix=G,G.doc={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero.If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},gt.add=D,D.doc={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["2.1 + 3.6","ans - 3.6","3 + 2i",'"hello" + " world"',"3 cm + 2 inch"],seealso:["subtract"]},gt.mod=Y,Y.doc={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","function isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:[]},gt.exp=V,V.doc={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["square","multiply","log"]},gt.largereq=F,F.doc={name:"largereq",category:"Operators",syntax:["x >= y","largereq(x, y)"],description:"Check if value x is larger or equal to y. Returns 1 if x is larger or equal to y, and 0 if not.",examples:["2 > 1+1","2 >= 1+1","a = 3.2","b = 6-2.8","(a > b)"],seealso:["equal","unequal","smallereq","smaller","largereq"]},gt.sqrt=H,H.doc={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","multiply"]},gt.square=j,j.doc={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},gt.larger=K,K.doc={name:"larger",category:"Operators",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns 1 if x is larger than y, and 0 if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallereq","largereq"]},gt.sign=z,z.doc={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},gt.unaryminus=W,W.doc={name:"unaryminus",category:"Operators",syntax:["-x","unaryminus(x)"],description:"Inverse the sign of a value.",examples:["-4.5","-(-5.6)"],seealso:["add","subtract"]},gt.smaller=X,X.doc={name:"smaller",category:"Operators",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns 1 if x is smaller than y, and 0 if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallereq","largereq"]},gt.abs=Z,Z.doc={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},gt.log=Q,Q.doc={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 3","log(1000, 10)","log(1000) / log(10)","b = logb(1024, 2)","2 ^ b"],seealso:["exp","log10"]},gt.pow=J,J.doc={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3 = 8","2*2*2","1 + e ^ (pi * i)"],seealso:["unequal","smaller","larger","smallereq","largereq"]},gt.floor=et,et.doc={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},gt.ceil=tt,tt.doc={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity.If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},gt.multiply=nt,nt.doc={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["2.1 * 3.6","ans / 3.6","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},gt.subtract=it,it.doc={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["5.3 - 2","ans + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},gt.random=at,at.doc={name:"random",category:"Probability",syntax:["random()"],description:"Return a random number between 0 and 1.",examples:["random()","100 * random()"],seealso:[]},gt.factorial=st,st.doc={name:"factorial",category:"Probability",syntax:["x!","factorial(x)"],description:"Compute the factorial of a value",examples:["5!","5*4*3*2*1","3!"],seealso:[]},gt.parser.node.Node=ot,ot.prototype.eval=function(){throw Error("Cannot evaluate a Node interface")},ot.prototype.toString=function(){return""},ft.prototype=new ot,gt.parser.node.Symbol=ft,ft.prototype.hasParams=function(){return void 0!=this.params&&this.params.length>0},ft.prototype.eval=function(){var e=this.fn;if(void 0===e)throw Error("Undefined symbol "+this.name);var t=this.params.map(function(e){return e.eval()});return e.apply(this,t)},ft.prototype.toString=function(){if(this.name&&!this.params)return this.name;var e=this.name;return this.params&&this.params.length&&(e+="("+this.params.join(", ")+")"),e},ut.prototype=new ot,gt.parser.node.Constant=ut,ut.prototype.eval=function(){return this.value},ut.prototype.toString=function(){return this.value?""+this.value:""},ht.prototype=new ot,gt.parser.node.Block=ht,ht.prototype.add=function(e,t){var n=this.params.length;this.params[n]=e,this.visible[n]=void 0!=t?t:!0},ht.prototype.eval=function(){for(var e=[],t=0,n=this.params.length;n>t;t++){var r=this.params[t].eval();this.visible[t]&&e.push(r)}return e},ht.prototype.toString=function(){for(var e=[],t=0,n=this.params.length;n>t;t++)this.visible[t]&&e.push("\n "+(""+this.params[t]));return"["+e.join(",")+"\n]"},ct.prototype=new ot,gt.parser.node.Assignment=ct,ct.prototype.eval=function(){if(void 0===this.expr)throw Error("Undefined symbol "+this.name);var e,t=this.params;if(t&&t.length){var n=[];this.params.forEach(function(e){n.push(e.eval())});var r=this.expr.eval();if(void 0==this.result.value)throw Error("Undefined symbol "+this.name);var i=this.result.eval();e=i.set(n,r),this.result.value=e}else e=this.expr.eval(),this.result.value=e;return e},ct.prototype.toString=function(){var e="";return e+=this.name,this.params&&this.params.length&&(e+="("+this.params.join(", ")+")"),e+=" = ",e+=""+this.expr},lt.prototype=new ot,gt.parser.node.FunctionAssignment=lt,lt.prototype.createFunction=function(e,t,n,r){var i=function(){var t=n?n.length:0,i=arguments?arguments.length:0;if(t!=i)throw o(e,i,t);if(t>0)for(var a=0;t>a;a++)n[a].value=arguments[a];return r.eval()};return i.toString=function(){return e+"("+t.join(", ")+")"},i},lt.prototype.eval=function(){for(var e=this.variables,t=this.values,n=0,r=e.length;r>n;n++)e[n].value=t[n];return this.result.value=this.def,this.def},lt.prototype.toString=function(){return""+this.def},gt.parser.node.Scope=pt,pt.prototype.createNestedScope=function(){var e=new pt(this);return this.nestedScopes||(this.nestedScopes=[]),this.nestedScopes.push(e),e},pt.prototype.clear=function(){if(this.symbols={},this.defs={},this.links={},this.updates={},this.nestedScopes)for(var e=this.nestedScopes,t=0,n=e.length;n>t;t++)e[t].clear()},pt.prototype.createSymbol=function(e){var t=this.symbols[e];if(!t){var n=this.findDef(e);t=this.newSymbol(e,n),this.symbols[e]=t}return t},pt.prototype.newSymbol=function(e,t){var n=this,r=function(){if(!r.value&&(r.value=n.findDef(e),!r.value))throw Error("Undefined symbol "+e);return"function"==typeof r.value?r.value.apply(null,arguments):r.value};return r.value=t,r.toString=function(){return r.value?""+r.value:""},r},pt.prototype.createLink=function(e){var t=this.links[e];return t||(t=this.createSymbol(e),this.links[e]=t),t},pt.prototype.createDef=function(e,t){var n=this.defs[e];return n||(n=this.createSymbol(e),this.defs[e]=n),n&&void 0!=t&&(n.value=t),n},pt.prototype.createUpdate=function(e){var t=this.updates[e];return t||(t=this.createLink(e),this.updates[e]=t),t},pt.prototype.findDef=function(t){function n(e,t){var n=a(e,t);return s[e]=n,o[e]=n,n}var r;if(r=this.defs[t])return r;if(r=this.updates[t])return r;if(this.parentScope)return this.parentScope.findDef(t);var a=this.newSymbol,s=this.symbols,o=this.defs;if("pi"==t)return n(t,gt.PI);if("e"==t)return n(t,gt.E);if("i"==t)return n(t,new i(0,1));var f=gt[t];if(f)return n(t,f);if(e.isUnit(t)){var u=new e(void 0,t);return n(t,u)}return void 0},pt.prototype.removeLink=function(e){delete this.links[e]},pt.prototype.removeDef=function(e){delete this.defs[e]},pt.prototype.removeUpdate=function(e){delete this.updates[e]},pt.prototype.init=function(){var e=this.symbols,t=this.parentScope;for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];r.value=t?t.findDef(n):void 0}this.nestedScopes&&this.nestedScopes.forEach(function(e){e.init()})},pt.prototype.hasLink=function(e){if(this.links[e])return!0;if(this.nestedScopes)for(var t=this.nestedScopes,n=0,r=t.length;r>n;n++)if(t[n].hasLink(e))return!0;return!1},pt.prototype.hasDef=function(e){return void 0!=this.defs[e]},pt.prototype.hasUpdate=function(e){return void 0!=this.updates[e]},pt.prototype.getUndefinedSymbols=function(){var e=this.symbols,t=[];for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];void 0==r.value&&t.push(r)}return this.nestedScopes&&this.nestedScopes.forEach(function(e){t=t.concat(e.getUndefinedSymbols())}),t},gt.parser.Parser=mt,mt.prototype.parse=function(e,t){return this.expr=e||"",t||(t=this.scope),this.parse_start(t)},mt.prototype.eval=function(e){var t=this.parse(e);return t.eval()},mt.prototype.get=function(e){var t=this.scope.findDef(e);return t?t.value:void 0},mt.prototype.put=function(e,t){this.scope.createDef(e,t)},mt.prototype.clear=function(){this.scope.clear()},mt.prototype.getChar=function(){this.index++,this.c=this.expr.charAt(this.index)},mt.prototype.getFirstChar=function(){this.index=0,this.c=this.expr.charAt(0)},mt.prototype.getToken=function(){for(this.token_type=this.TOKENTYPE.NULL,this.token="";" "==this.c||" "==this.c;)this.getChar();if("#"==this.c)for(;"\n"!=this.c&&""!=this.c;)this.getChar();if(""==this.c)return this.token_type=this.TOKENTYPE.DELIMITER,void 0;if("-"==this.c||","==this.c||"("==this.c||")"==this.c||"["==this.c||"]"==this.c||'"'==this.c||"\n"==this.c||";"==this.c||":"==this.c)return this.token_type=this.TOKENTYPE.DELIMITER,this.token+=this.c,this.getChar(),void 0;if(this.isDelimiter(this.c))for(this.token_type=this.TOKENTYPE.DELIMITER;this.isDelimiter(this.c);)this.token+=this.c,this.getChar();else if(this.isDigitDot(this.c)){for(this.token_type=this.TOKENTYPE.NUMBER;this.isDigitDot(this.c);)this.token+=this.c,this.getChar();if("E"==this.c||"e"==this.c)for(this.token+=this.c,this.getChar(),("+"==this.c||"-"==this.c)&&(this.token+=this.c,this.getChar()),this.isDigit(this.c)||(this.token_type=this.TOKENTYPE.UNKNOWN);this.isDigit(this.c);)this.token+=this.c,this.getChar()}else{if(!this.isAlpha(this.c)){for(this.token_type=this.TOKENTYPE.UNKNOWN;""!=this.c;)this.token+=this.c,this.getChar();throw this.createSyntaxError('Syntax error in part "'+this.token+'"')}for(this.token_type=this.TOKENTYPE.SYMBOL;this.isAlpha(this.c)||this.isDigit(this.c);)this.token+=this.c,this.getChar()}},mt.prototype.isDelimiter=function(e){return"&"==e||"|"==e||"<"==e||">"==e||"="==e||"+"==e||"/"==e||"*"==e||"%"==e||"^"==e||","==e||";"==e||"\n"==e||"!"==e},mt.prototype.isValidSymbolName=function(e){for(var t=0,n=e.length;n>t;t++){var r=e.charAt(t),i=this.isAlpha(r);if(!i)return!1}return!0},mt.prototype.isAlpha=function(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"==e},mt.prototype.isDigitDot=function(e){return e>="0"&&"9">=e||"."==e},mt.prototype.isDigit=function(e){return e>="0"&&"9">=e},mt.prototype.parse_start=function(e){this.getFirstChar(),this.getToken();var t;if(t=""==this.token?new ut(void 0):this.parse_block(e),""!=this.token)throw this.token_type==this.TOKENTYPE.DELIMITER?this.createError("Unknown operator "+this.token):this.createSyntaxError('Unexpected part "'+this.token+'"');return t},mt.prototype.parse_ans=function(e){var t=this.parse_function_assignment(e);if(!(t instanceof ct)){var n="ans",r=void 0,i=e.createDef(n);return new ct(n,r,t,i)}return t},mt.prototype.parse_block=function(e){var t,n,r;for("\n"!=this.token&&";"!=this.token&&""!=this.token&&(t=this.parse_ans(e));"\n"==this.token||";"==this.token;)n||(n=new ht,t&&(r=";"!=this.token,n.add(t,r))),this.getToken(),"\n"!=this.token&&";"!=this.token&&""!=this.token&&(t=this.parse_ans(e),r=";"!=this.token,n.add(t,r));return n?n:(t||(t=this.parse_ans(e)),t)},mt.prototype.parse_function_assignment=function(e){if(this.token_type==this.TOKENTYPE.SYMBOL&&"function"==this.token){if(this.getToken(),this.token_type!=this.TOKENTYPE.SYMBOL)throw this.createSyntaxError("Function name expected");var t=this.token;if(this.getToken(),"("!=this.token)throw this.createSyntaxError("Opening parenthesis ( expected");for(var n=e.createNestedScope(),r=[],i=[];;){if(this.getToken(),this.token_type!=this.TOKENTYPE.SYMBOL)throw this.createSyntaxError("Variable name expected");var a=this.token,s=n.createDef(a);if(r.push(a),i.push(s),this.getToken(),","!=this.token){if(")"==this.token)break;throw this.createSyntaxError('Comma , or closing parenthesis ) expected"')}}if(this.getToken(),"="!=this.token)throw this.createSyntaxError("Equal sign = expected");this.getToken();var o=this.parse_range(n),f=e.createDef(t);return new lt(t,r,i,o,f)}return this.parse_assignment(e)},mt.prototype.parse_assignment=function(e){var t=!1;this.token_type==this.TOKENTYPE.SYMBOL&&(t=e.hasLink(this.token));var n=this.parse_range(e);if("="==this.token){if(!(n instanceof ft))throw this.createSyntaxError("Symbol expected at the left hand side of assignment operator =");var r=n.name,i=n.params;t||e.removeLink(r),this.getToken();var a=this.parse_range(e),s=n.hasParams()?e.createUpdate(r):e.createDef(r);return new ct(r,i,a,s)}return n},mt.prototype.parse_range=function(e){var t=this.parse_conditions(e);return t},mt.prototype.parse_conditions=function(e){for(var t=this.parse_bitwise_conditions(e),n={"in":"in"};void 0!==n[this.token];){var r=this.token,i=gt[n[r]];this.getToken();var a=[t,this.parse_bitwise_conditions(e)];t=new ft(r,i,a)}return t},mt.prototype.parse_bitwise_conditions=function(e){var t=this.parse_comparison(e);return t},mt.prototype.parse_comparison=function(e){for(var t=this.parse_addsubtract(e),n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallereq",">=":"largereq"};void 0!==n[this.token];){var r=this.token,i=gt[n[r]];this.getToken();var a=[t,this.parse_addsubtract(e)];t=new ft(r,i,a)}return t},mt.prototype.parse_addsubtract=function(e){for(var t=this.parse_multiplydivide(e),n={"+":"add","-":"subtract"};void 0!==n[this.token];){var r=this.token,i=gt[n[r]];this.getToken();var a=[t,this.parse_multiplydivide(e)];t=new ft(r,i,a)}return t},mt.prototype.parse_multiplydivide=function(e){for(var t=this.parse_pow(e),n={"*":"multiply","/":"divide","%":"mod",mod:"mod"};void 0!==n[this.token];){var r=this.token,i=gt[n[r]];this.getToken();var a=[t,this.parse_pow(e)];t=new ft(r,i,a)}return t},mt.prototype.parse_pow=function(e){for(var t=this.parse_factorial(e);"^"==this.token;){var n=this.token,r=J;this.getToken();var i=[t,this.parse_factorial(e)];t=new ft(n,r,i)}return t},mt.prototype.parse_factorial=function(e){for(var t=this.parse_unaryminus(e);"!"==this.token;){var n=this.token,r=st;this.getToken();var i=[t];t=new ft(n,r,i)}return t},mt.prototype.parse_unaryminus=function(e){if("-"==this.token){var t=this.token,n=W;this.getToken();var r=[this.parse_plot(e)];return new ft(t,n,r)}return this.parse_plot(e)},mt.prototype.parse_plot=function(e){return this.parse_symbol(e)},mt.prototype.parse_symbol=function(e){if(this.token_type==this.TOKENTYPE.SYMBOL){var t=this.token;this.getToken();var n=e.createLink(t),r=this.parse_arguments(e),i=new ft(t,n,r);return i}return this.parse_string(e)},mt.prototype.parse_arguments=function(e){var t=[];if("("==this.token){if(this.getToken(),")"!=this.token)for(t.push(this.parse_range(e));","==this.token;)this.getToken(),t.push(this.parse_range(e));if(")"!=this.token)throw this.createSyntaxError("Parenthesis ) missing");this.getToken()}return t},mt.prototype.parse_string=function(e){if('"'==this.token){for(var t="",n="";""!=this.c&&('"'!=this.c||"\\"==n);)t+=this.c,n=this.c,this.getChar();if(this.getToken(),'"'!=this.token)throw this.createSyntaxError('End of string " missing');this.getToken();var r=new ut(t);return r}return this.parse_matrix(e)},mt.prototype.parse_matrix=function(e){return this.parse_number(e)},mt.prototype.parse_number=function(t){if(this.token_type==this.TOKENTYPE.NUMBER){var n;n="."==this.token?0:Number(this.token),this.getToken();var r;if(this.token_type==this.TOKENTYPE.SYMBOL){if("i"==this.token||"I"==this.token)return r=new i(0,n),this.getToken(),new ut(r);if(e.isUnit(this.token))return r=new e(n,this.token),this.getToken(),new ut(r);throw this.createTypeError('Unknown unit "'+this.token+'"')}var a=new ut(n);return a}return this.parse_parentheses(t)},mt.prototype.parse_parentheses=function(e){if("("==this.token){this.getToken();var t=this.parse_range(e);if(")"!=this.token)throw this.createSyntaxError("Parenthesis ) expected");return this.getToken(),t}return this.parse_end(e)},mt.prototype.parse_end=function(){throw""==this.token?this.createSyntaxError("Unexpected end of expression"):this.createSyntaxError("Value expected")},mt.prototype.row=function(){return void 0},mt.prototype.col=function(){return this.index-this.token.length+1},mt.prototype.createErrorMessage=function(e){var t=this.row(),n=this.col();return void 0===t?void 0===n?e:e+" (col "+n+")":e+" (ln "+t+", col "+n+")"},mt.prototype.createSyntaxError=function(e){return new SyntaxError(this.createErrorMessage(e))},mt.prototype.createTypeError=function(e){return new TypeError(this.createErrorMessage(e))},mt.prototype.createError=function(e){return Error(this.createErrorMessage(e))},gt.parser.Workspace=dt,dt.prototype.clear=function(){this.nodes={},this.firstNode=void 0,this.lastNode=void 0},dt.prototype.append=function(e){var t=this._getNewId(),n=this.lastNode?this.lastNode.scope:this.scope,r=new pt(n),i=new dt.Node({id:t,expression:e,parser:this.parser,scope:r,nextNode:void 0,previousNode:this.lastNode});return this.nodes[t]=i,this.firstNode||(this.firstNode=i),this.lastNode&&(this.lastNode.nextNode=i),this.lastNode=i,this._update([t]),t},dt.prototype.insertBefore=function(e,t){var n=this.nodes[t];if(!n)throw'Node with id "'+t+'" not found';var r=n.previousNode,i=this._getNewId(),a=r?r.scope:this.scope,s=new pt(a),o=new dt.Node({id:i,expression:e,parser:this.parser,scope:s,nextNode:n,previousNode:r});this.nodes[i]=o,r?r.nextNode=o:this.firstNode=o,n.previousNode=o,n.scope.parentScope=o.scope;var f=this.getDependencies(i);return-1==f.indexOf(i)&&f.unshift(i),this._update(f),i},dt.prototype.insertAfter=function(e,t){var n=this.nodes[t];if(!n)throw'Node with id "'+t+'" not found';return n==this.lastNode?this.append(e):this.insertBefore(t+1,e)},dt.prototype.remove=function(e){var t=this.nodes[e];if(!t)throw'Node with id "'+e+'" not found';var n=this.getDependencies(e),r=t.previousNode,i=t.nextNode;r?r.nextNode=i:this.firstNode=i,i?i.previousNode=r:this.lastNode=r;var a=r?r.scope:this.scope;i&&(i.scope.parentScope=a),delete this.nodes[e],this._update(n)},dt.prototype.replace=function(e,t){var n=this.nodes[t];if(!n)throw'Node with id "'+t+'" not found';var r=[t];dt._merge(r,this.getDependencies(t));var i=n.previousNode;n.nextNode,i?i.scope:this.scope,n.setExpr(e),dt._merge(r,this.getDependencies(t)),this._update(r)},dt.Node=function(e){this.id=e.id,this.parser=e.parser,this.scope=e.scope,this.nextNode=e.nextNode,this.previousNode=e.previousNode,this.updateSeq=0,this.result=void 0,this.setExpr(e.expression)},dt.Node.prototype.setExpr=function(e){this.expression=e||"",this.scope.clear(),this._parse()},dt.Node.prototype.getExpr=function(){return this.expression},dt.Node.prototype.getResult=function(){return this.result},dt.Node.prototype._parse=function(){try{this.fn=this.parser.parse(this.expression,this.scope)}catch(e){var t="Error: "+((e.message||e)+"");this.fn=new ut(t)}},dt.Node.prototype.eval=function(){try{this.scope.init(),this.result=this.fn.eval()}catch(e){this.scope.init(),this.result="Error: "+((e.message||e)+"")}return this.result},dt._merge=function(e,t){for(var n=0,r=t.length;r>n;n++){var i=t[n];-1==e.indexOf(i)&&e.push(i)}},dt.prototype.getDependencies=function(e){var t,n=[],r=this.nodes[e];if(r){var i=r.scope.defs,a=r.scope.updates,s=[];for(t in i)i.hasOwnProperty(t)&&s.push(t);for(t in a)a.hasOwnProperty(t)&&-1==s.indexOf(t)&&s.push(t);for(var o=r.nextNode;o&&s.length;){for(var f=o.scope,u=0;s.length>u;){if(t=s[u],(f.hasLink(t)||f.hasUpdate(t))&&-1==n.indexOf(o.id)){n.push(o.id);var h=this.getDependencies(o.id);dt._merge(n,h)}f.hasDef(t)&&(s.splice(u,1),u--),u++}o=o.nextNode}}return n},dt.prototype.getExpr=function(e){var t=this.nodes[e];if(!t)throw'Node with id "'+e+'" not found';return t.getExpr()},dt.prototype.getResult=function(e){var t=this.nodes[e];if(!t)throw'Node with id "'+e+'" not found';return t.getResult()},dt.prototype._update=function(e){this.updateSeq++;for(var t=this.updateSeq,n=this.nodes,r=0,i=e.length;i>r;r++){var a=e[r],s=n[a];s&&(s.eval(),s.updateSeq=t)}},dt.prototype.getChanges=function(e){var t=[],n=this.firstNode;for(e=e||0;n;)n.updateSeq>e&&t.push(n.id),n=n.nextNode;return{ids:t,updateSeq:this.updateSeq}},dt.prototype.autoComplete=function(e){var t=e.toLowerCase(),n=[];for(var r in gt)gt.hasOwnProperty(r)&&0==r.toLowerCase().indexOf(t)&&n.push(r);return n},dt.prototype._getNewId=function(){return this.idMax++,this.idMax},dt.prototype.toString=function(){return JSON.stringify(this.toJSON())},dt.prototype.toJSON=function(){for(var e=[],t=this.firstNode;t;){var n={id:t.id,expression:t.expression,dependencies:this.getDependencies(t.id)};try{n.result=t.getResult()}catch(r){n.result="Error: "+((r.message||r)+"")}e.push(n),t=t.nextNode}return e}})(); \ No newline at end of file diff --git a/tools/jake-utils.js b/tools/jake-utils.js index 045f02a8c..91ccd8805 100644 --- a/tools/jake-utils.js +++ b/tools/jake-utils.js @@ -169,7 +169,7 @@ function concat (params) { } var code = ''; - var separator = String(params.separator) || ''; + var separator = params.separator ? String(params.separator) : ''; // header if (params.header) { @@ -251,7 +251,7 @@ function minify (params) { } var code = ''; - var separator = String(params.separator) || ''; + var separator = params.separator ? String(params.separator) : ''; var options = params.options || {}; // header