Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-calc

Package Overview
Dependencies
Maintainers
1
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-calc - npm Package Compare versions

Comparing version 0.0.35 to 0.0.36

2

browser/index.core.js

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

var a_calc=function(t){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=r(BigNumber);function o(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function n(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,r,e){return r&&n(t.prototype,r),e&&n(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&f(t,r)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t,r){return(f=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function s(t,r,e){return(s=c()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);r=new(Function.bind.apply(t,n));return e&&f(r,e.prototype),r}).apply(null,arguments)}function p(t){var e="function"==typeof Map?new Map:void 0;return(p=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return s(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),f(r,t)})(t)}function h(t,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");r=t;if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function d(e){var n=c();return function(){var t,r=l(e);return h(this,n?(t=l(this).constructor,Reflect.construct(r,arguments,t)):r.apply(this,arguments))}}function y(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(t){if("string"==typeof t)return v(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(e="Object"===e&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?v(t,r):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function g(t){return-1<"+-*/%()".indexOf(t)}function b(t){switch(t){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function w(t){var r={expr:"",fmt:null,data:null},e="",n=t[0];if(1===t.length)"string"==typeof n?e=n:"number"==typeof n?e=n.toString():Array.isArray(n)&&(e=n[0]);else if(1<t.length){n=t[t.length-1];if(l=n,"[object Object]"!==Object.prototype.toString.call(l)||Array.isArray(l))for(var o=y(t.shift());o.length||t.length;)var i=0===o.length?"":o.shift(),a=0===t.length?"":t.shift(),e=e+i+(a="number"==typeof a?a.toString():a);else e=t[0],r.data=n}var l=e.split("|");return 1===l.length?r.expr=l[0]:(r.expr=l[0],""!==(n=l[1]).trim()&&(r.fmt=n)),r}function m(t,r){var e="",n=(e=u.default.isBigNumber(t)?t.toFixed():"string"!=typeof t?t.toString():t,null),t=null,o=null,i=r.match(/(<=|>=|=)\s*(\d+)/);if(i&&(t=i[1],n=Number(i[2])),r.includes(",")&&(o=!0),null!==n){var i=e.split("."),r=i[0],a=1===i.length?"":i[1],l=a.length;switch(t){case"<=":a=l<=n?a:a.slice(0,n);break;case"=":l<n?a+="0".repeat(n-l):n<l&&(a=a.slice(0,n));break;case">=":a=n<=l?a:a+"0".repeat(n-l)}e=""===a?r:"".concat(r,".").concat(a)}return e=null!==o?1<(i=e.split(".")).length?((t=i[0]).includes("-")?i[0]=t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):i[0]=t.replace(/(?=(?!^)(?:\d{3})+$)/g,","),i.join(".")):(r=i[0]).includes("-")?r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):r.replace(/(?=(?!^)(?:\d{3})+$)/g,","):e}function O(t){for(var r=[],e=0,n=null,o=t.length;e<o;)if(n=t[e],/\s/.test(n))e++;else if("+-".includes(n)){var i=r[r.length-1];if(0===r.length||"+-".includes(i)||"("===i){for(var a=n,n=t[++e];/[a-zA-Z\d._]/.test(n);)a+=n,n=t[++e];r.push(a)}else r.push(n),e++}else if("*/%()".includes(n))r.push(n),e++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++e>=o));)n=t[e];r.push(l)}else if(/\d/.test(n)){for(var u="";/[\d.]/.test(n)&&(u+=n,!(++e>=o));)n=t[e];r.push(u)}return r}var j=function(){a(n,p(Error));var e=d(n);function n(t){var r;return o(this,n),(r=e.call(this,t)).name="CalculatorError",r.message=t,r}return i(n)}(),E=function(){a(n,p(Error));var e=d(n);function n(t){var r;return o(this,n),(r=e.call(this,t)).name="TokensFillError",r.message=t,r}return i(n)}();function _(t,r){var e=r._fillData;return void 0===r._fillData&&(e=r),t.map(function(t){if(/^[a-zA-z_][\w_]*$/.test(t)){var r=e[t];if(void 0!==r)return"number"==typeof r?r.toString():r;throw new E("错误的参数:".concat(t," 请确认他存在"))}return t})}function A(t){for(var r,e=[],n=[],o=t;0<o.length;){var i=o.shift();if(g(i))if("("===i)e.push(i);else if(")"===i){for(var a=e.pop();"("!==a&&0<e.length;)n.push(a),a=e.pop();if("("!==a)throw"error: unmatched ()"}else{for(;r=e[e.length-1],b(i)<=b(r)&&0<e.length;)n.push(e.pop());e.push(i)}else n.push(i)}if(0<e.length){if(")"===e[e.length-1]||"("===e[e.length-1])throw"error: unmatched ()";for(;0<e.length;)n.push(e.pop())}return n}function x(t){for(var r=[];0<t.length;){var e=t.shift();if(g(e)){if(r.length<2)throw new j("错误的栈长度, 可能是无法计算的表达式");var n=r.pop(),o=r.pop();if("string"==typeof n&&!u.default.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new j("".concat(n,"不是一个合法的数字"));n=new u.default(n)}if("string"==typeof o&&!u.default.isBigNumber(o)){if(!/^[+-]*[\d.]+$/.test(o))throw new j("".concat(o,"不是一个合法的数字"));o=new u.default(o)}switch(e){case"+":r.push(o.plus(n));break;case"-":r.push(o.minus(n));break;case"*":r.push(o.times(n));break;case"/":r.push(o.div(n));break;case"%":r.push(o.mod(n))}}else r.push(e)}if(1!==r.length)throw"unvalid expression";return r[0]}return t.calc=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];var n=w(r),o=O(n.expr),i=null;if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=_(o,n.data);else try{o=_(o,n.data)}catch(t){if(t instanceof E)return console.warn(t),i.fillError||i.error;throw t}var o=A(o),a=null;if(null!==i){if(void 0!==i.calcError||void 0!==i.error)try{a=x(o)}catch(t){if(t instanceof j)return console.warn(t),void 0!==i.calcError?i.calcError:i.error;throw t}}else a=x(o);return a=null!==n.fmt?m(a,n.fmt):null!==a?a.toFixed():null},t.fmt=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];var n=w(r),o=O(n.expr),i=null;if(2<o.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==o.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=_(o,n.data);else try{o=_(o,n.data)}catch(t){if(t instanceof TokensFillError)return i.fillError||i.error;throw t}if(null===n.fmt)throw"表达式没有格式化部分";return m(o[0],n.fmt)},t.version="0.0.34",Object.defineProperty(t,"__esModule",{value:!0}),t}({});
var a_calc=function(r){"use strict";function t(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var u=t(BigNumber);function o(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function n(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function i(r,t,e){return t&&n(r.prototype,t),e&&n(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function a(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&f(r,t)}function l(r){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(r)}function f(r,t){return(f=Object.setPrototypeOf||function(r,t){return r.__proto__=t,r})(r,t)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function s(r,t,e){return(s=c()?Reflect.construct:function(r,t,e){var n=[null];n.push.apply(n,t);t=new(Function.bind.apply(r,n));return e&&f(t,e.prototype),t}).apply(null,arguments)}function p(r){var e="function"==typeof Map?new Map:void 0;return(p=function(r){if(null===r||-1===Function.toString.call(r).indexOf("[native code]"))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return s(r,arguments,l(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),f(t,r)})(r)}function h(r,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");t=r;if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function d(e){var n=c();return function(){var r,t=l(e);return h(this,n?(r=l(this).constructor,Reflect.construct(t,arguments,r)):t.apply(this,arguments))}}function v(r){return function(r){if(Array.isArray(r))return y(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(r){if("string"==typeof r)return y(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(e="Object"===e&&r.constructor?r.constructor.name:e)||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?y(r,t):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function g(r){return-1<"+-*/%()".indexOf(r)}function b(r){switch(r){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function w(r){var t={expr:"",fmt:null,data:null},e="",n=r[0];if(1===r.length)"string"==typeof n?e=n:"number"==typeof n?e=n.toString():Array.isArray(n)&&(e=n[0]);else if(1<r.length){n=r[r.length-1];if(l=n,"[object Object]"!==Object.prototype.toString.call(l)||Array.isArray(l))for(var o=v(r.shift());o.length||r.length;)var i=0===o.length?"":o.shift(),a=0===r.length?"":r.shift(),e=e+i+(a="number"==typeof a?a.toString():a);else e=r[0],t.data=n}var l=e.split("|");return 1===l.length?t.expr=l[0]:(t.expr=l[0],""!==(n=l[1]).trim()&&(t.fmt=n)),t}function m(r,t){var e="",n=(e=u.default.isBigNumber(r)?r.toFixed():"string"!=typeof r?r.toString():r,null),r=null,o=null,i=t.match(/(<=|>=|=)\s*(\d+)/);if(i&&(r=i[1],n=Number(i[2])),t.includes(",")&&(o=!0),null!==n){var i=e.split("."),t=i[0],a=1===i.length?"":i[1],l=a.length;switch(r){case"<=":a=l<=n?a:a.slice(0,n);break;case"=":l<n?a+="0".repeat(n-l):n<l&&(a=a.slice(0,n));break;case">=":a=n<=l?a:a+"0".repeat(n-l)}e=""===a?t:"".concat(t,".").concat(a)}return e=null!==o?1<(i=e.split(".")).length?((r=i[0]).includes("-")?i[0]=r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):i[0]=r.replace(/(?=(?!^)(?:\d{3})+$)/g,","),i.join(".")):(t=i[0]).includes("-")?t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t.replace(/(?=(?!^)(?:\d{3})+$)/g,","):e}function O(r){for(var t=[],e=0,n=null,o=r.length;e<o;)if(n=r[e],/\s/.test(n))e++;else if("+-".includes(n)){var i=t[t.length-1];if(0===t.length||"+-".includes(i)||"("===i){for(var a=n,n=r[++e];/[a-zA-Z\d._]/.test(n);)a+=n,n=r[++e];t.push(a)}else t.push(n),e++}else if("*/%()".includes(n))t.push(n),e++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++e>=o));)n=r[e];t.push(l)}else if(/\d/.test(n)){for(var u="";/[\d.]/.test(n)&&(u+=n,!(++e>=o));)n=r[e];t.push(u)}return t}var j=function(){a(n,p(Error));var e=d(n);function n(r){var t;return o(this,n),(t=e.call(this,r)).name="CalculatorError",t.message=r,t}return i(n)}(),E=function(){a(n,p(Error));var e=d(n);function n(r){var t;return o(this,n),(t=e.call(this,r)).name="TokensFillError",t.message=r,t}return i(n)}();function _(r,t){var e=t._fillData;return void 0===t._fillData&&(e=t),r.map(function(r){if(/^[a-zA-z_][\w_]*$/.test(r)){var t=e[r];if(void 0!==t)return"number"==typeof t?t.toString():t;throw new E("错误的参数:".concat(r," 请确认他存在"))}return r})}function A(r){for(var t,e=[],n=[],o=r;0<o.length;){var i=o.shift();if(g(i))if("("===i)e.push(i);else if(")"===i){for(var a=e.pop();"("!==a&&0<e.length;)n.push(a),a=e.pop();if("("!==a)throw"error: unmatched ()"}else{for(;t=e[e.length-1],b(i)<=b(t)&&0<e.length;)n.push(e.pop());e.push(i)}else n.push(i)}if(0<e.length){if(")"===e[e.length-1]||"("===e[e.length-1])throw"error: unmatched ()";for(;0<e.length;)n.push(e.pop())}return n}function x(r){for(var t=[];0<r.length;){var e=r.shift();if(g(e)){if(t.length<2)throw new j("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!u.default.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new j("".concat(n,"不是一个合法的数字"));n=new u.default(n)}if("string"==typeof o&&!u.default.isBigNumber(o)){if(!/^[+-]*[\d.]+$/.test(o))throw new j("".concat(o,"不是一个合法的数字"));o=new u.default(o)}switch(e){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n))}}else t.push(e)}if(1!==t.length)throw"unvalid expression";return t[0]}return r.calc=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var n=w(t),o=O(n.expr),i=null;if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=_(o,n.data);else try{o=_(o,n.data)}catch(r){if(r instanceof E)return void 0!==i.warn&&!0===i.warn&&console.warn(r),i.fillError||i.error;throw r}var o=A(o),a=null;if(null!==i){if(void 0!==i.calcError||void 0!==i.error)try{a=x(o)}catch(r){if(r instanceof j)return void 0!==i.warn&&!0===i.warn&&console.warn(r),void 0!==i.calcError?i.calcError:i.error;throw r}}else a=x(o);return a=null!==n.fmt?m(a,n.fmt):null!==a?a.toFixed():null},r.fmt=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var n=w(t),o=O(n.expr),i=null;if(2<o.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==o.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=_(o,n.data);else try{o=_(o,n.data)}catch(r){if(r instanceof TokensFillError)return i.fillError||i.error;throw r}if(null===n.fmt)throw"表达式没有格式化部分";return m(o[0],n.fmt)},r.version="0.0.35",Object.defineProperty(r,"__esModule",{value:!0}),r}({});

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

var a_calc=function(e){"use strict";function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,r){return(l=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function s(e,r,t){return(s=f()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);r=new(Function.bind.apply(e,n));return t&&l(r,t.prototype),r}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function y(e,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");r=e;if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function a(t){var n=f();return function(){var e,r=u(t);return y(this,n?(e=u(this).constructor,Reflect.construct(r,arguments,e)):r.apply(this,arguments))}}function b(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return h(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function p(e){return-1<"+-*/%()".indexOf(e)}function g(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function d(e){var r={expr:"",fmt:null,data:null},t="",n=e[0];if(1===e.length)"string"==typeof n?t=n:"number"==typeof n?t=n.toString():Array.isArray(n)&&(t=n[0]);else if(1<e.length){n=e[e.length-1];if(l=n,"[object Object]"!==Object.prototype.toString.call(l)||Array.isArray(l))for(var i=b(e.shift());i.length||e.length;)var o=0===i.length?"":i.shift(),u=0===e.length?"":e.shift(),t=t+o+(u="number"==typeof u?u.toString():u);else t=e[0],r.data=n}var l=t.split("|");return 1===l.length?r.expr=l[0]:(r.expr=l[0],""!==(n=l[1]).trim()&&(r.fmt=n)),r}var re=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,M=Math.ceil,k=Math.floor,F="[BigNumber Error] ",$=F+"Number primitive has more than 15 significant digits: ",G=1e14,z=14,q=9007199254740991,H=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],V=1e7,W=1e9;function Z(e){var r=0|e;return 0<e||e===r?r:r-1}function X(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=z-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function Y(e,r){var t,n,i=e.c,o=r.c,u=e.s,l=r.s,e=e.e,r=r.e;if(!u||!l)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-l:u;if(u!=l)return u;if(t=u<0,n=e==r,!i||!o)return n?0:!i^t?1:-1;if(!n)return r<e^t?1:-1;for(l=(e=i.length)<(r=o.length)?e:r,u=0;u<l;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return e==r?0:r<e^t?1:-1}function J(e,r,t,n){if(e<r||t<e||e!==k(e))throw Error(F+(n||"Argument")+("number"==typeof e?e<r||t<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function K(e){var r=e.c.length-1;return Z(e.e/z)==r&&e.c[r]%2!=0}function Q(e,r){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function ee(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var w=function U(e){var w,a,h,r,s,m,u,l,f,c,p,t=P.prototype={constructor:P,toString:null,valueOf:null},g=new P(1),v=20,y=4,d=-7,b=21,O=-1e7,E=1e7,N=!1,i=1,A=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},_="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function P(e,r){var t,n,i,o,u,l,f,s,c=this;if(!(c instanceof P))return new P(e,r);if(null==r){if(e&&!0===e._isBigNumber)return c.s=e.s,void(!e.c||e.e>E?c.c=c.e=null:e.e<O?c.c=[c.e=0]:(c.e=e.e,c.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(c.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,u=e;10<=u;u/=10,o++);return void(E<o?c.c=c.e=null:(c.e=o,c.c=[e]))}s=String(e)}else{if(!re.test(s=String(e)))return h(c,s,l);c.s=45==s.charCodeAt(0)?(s=s.slice(1),-1):1}0<(u=(s=-1<(o=s.indexOf("."))?s.replace(".",""):s).search(/e/i))?(o<0&&(o=u),o+=+s.slice(u+1),s=s.substring(0,u)):o<0&&(o=s.length)}else{if(J(r,2,_.length,"Base"),10==r&&x)return I(c=new P(e),v+c.e+1,y);if(s=String(e),l="number"==typeof e){if(0*e!=0)return h(c,s,l,r);if(c.s=1/e<0?(s=s.slice(1),-1):1,P.DEBUG&&15<s.replace(/^0\.0*|\./,"").length)throw Error($+e)}else c.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1;for(t=_.slice(0,r),o=u=0,f=s.length;u<f;u++)if(t.indexOf(n=s.charAt(u))<0){if("."==n){if(o<u){o=f;continue}}else if(!i&&(s==s.toUpperCase()&&(s=s.toLowerCase())||s==s.toLowerCase()&&(s=s.toUpperCase()))){i=!0,u=-1,o=0;continue}return h(c,String(e),l,r)}l=!1,-1<(o=(s=a(s,r,10,c.s)).indexOf("."))?s=s.replace(".",""):o=s.length}for(u=0;48===s.charCodeAt(u);u++);for(f=s.length;48===s.charCodeAt(--f););if(s=s.slice(u,++f)){if(f-=u,l&&P.DEBUG&&15<f&&(q<e||e!==k(e)))throw Error($+c.s*e);if((o=o-u-1)>E)c.c=c.e=null;else if(o<O)c.c=[c.e=0];else{if(c.e=o,c.c=[],u=(o+1)%z,o<0&&(u+=z),u<f){for(u&&c.c.push(+s.slice(0,u)),f-=z;u<f;)c.c.push(+s.slice(u,u+=z));u=z-(s=s.slice(u)).length}else u-=f;for(;u--;s+="0");c.c.push(+s)}}else c.c=[c.e=0]}function R(e,r,t,n){for(var i,o,u=[0],l=0,f=e.length;l<f;){for(o=u.length;o--;u[o]*=r);for(u[0]+=n.indexOf(e.charAt(l++)),i=0;i<u.length;i++)u[i]>t-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/t|0,u[i]%=t)}return u.reverse()}function D(e,r,t){var n,i,o,u=0,l=e.length,f=r%V,s=r/V|0;for(e=e.slice();l--;)u=((i=f*(o=e[l]%V)+(n=s*o+(o=e[l]/V|0)*f)%V*V+u)/t|0)+(n/V|0)+s*o,e[l]=i%t;return e=u?[u].concat(e):e}function j(e,r,t,n){var i,o;if(t!=n)o=n<t?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function B(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,r,t,n){var i,o,u,l;if(null==t?t=y:J(t,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==r)l=X(e.c),l=1==n||2==n&&(o<=d||b<=o)?Q(l,o):ee(l,o,"0");else if(t=(e=I(new P(e),r,t)).e,u=(l=X(e.c)).length,1==n||2==n&&(r<=t||t<=d)){for(;u<r;l+="0",u++);l=Q(l,t)}else if(r-=o,l=ee(l,t,"0"),u<t+1){if(0<--r)for(l+=".";r--;l+="0");}else if(0<(r+=t-u))for(t+1==u&&(l+=".");r--;l+="0");return e.s<0&&i?"-"+l:l}function o(e,r){for(var t,n=1,i=new P(e[0]);n<e.length;n++){if(!(t=new P(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function T(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];10<=i;i/=10,n++);return(t=n+t*z-1)>E?e.c=e.e=null:t<O?e.c=[e.e=0]:(e.e=t,e.c=r),e}function I(e,r,t,n){var i,o,u,l,f,s,c,a=e.c,h=H;if(a){e:{for(i=1,l=a[0];10<=l;l/=10,i++);if((o=r-i)<0)o+=z,u=r,c=(f=a[s=0])/h[i-u-1]%10|0;else if((s=M((o+1)/z))>=a.length){if(!n)break e;for(;a.length<=s;a.push(0));f=c=0,u=(o%=z)-z+(i=1)}else{for(f=l=a[s],i=1;10<=l;l/=10,i++);c=(u=(o%=z)-z+i)<0?0:f/h[i-u-1]%10|0}if(n=n||r<0||null!=a[s+1]||(u<0?f:f%h[i-u-1]),n=t<4?(c||n)&&(0==t||t==(e.s<0?3:2)):5<c||5==c&&(4==t||n||6==t&&(0<o?0<u?f/h[i-u]:0:a[s-1])%10&1||t==(e.s<0?8:7)),r<1||!a[0])return a.length=0,n?(r-=e.e+1,a[0]=h[(z-r%z)%z],e.e=-r||0):a[0]=e.e=0,e;if(0==o?(a.length=s,l=1,s--):(a.length=s+1,l=h[z-o],a[s]=0<u?k(f/h[i-u]%h[u])*l:0),n)for(;;){if(0==s){for(o=1,u=a[0];10<=u;u/=10,o++);for(u=a[0]+=l,l=1;10<=u;u/=10,l++);o!=l&&(e.e++,a[0]==G&&(a[0]=1));break}if(a[s]+=l,a[s]!=G)break;a[s--]=0,l=1}for(o=a.length;0===a[--o];a.pop());}e.e>E?e.c=e.e=null:e.e<O&&(e.c=[e.e=0])}return e}function L(e){var r,t=e.e;return null===t?e.toString():(r=X(e.c),r=t<=d||b<=t?Q(r,t):ee(r,t,"0"),e.s<0?"-"+r:r)}return P.clone=U,P.ROUND_UP=0,P.ROUND_DOWN=1,P.ROUND_CEIL=2,P.ROUND_FLOOR=3,P.ROUND_HALF_UP=4,P.ROUND_HALF_DOWN=5,P.ROUND_HALF_EVEN=6,P.ROUND_HALF_CEIL=7,P.ROUND_HALF_FLOOR=8,P.EUCLID=9,P.config=P.set=function(e){var r,t;if(null!=e){if("object"!=C(e))throw Error(F+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(J(t=e[r],0,W,r),v=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(J(t=e[r],0,8,r),y=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(J(t[0],-W,0,r),J(t[1],0,W,r),d=t[0],b=t[1]):(J(t,-W,W,r),d=-(b=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)J(t[0],-W,-1,r),J(t[1],1,W,r),O=t[0],E=t[1];else{if(J(t,-W,W,r),!t)throw Error(F+r+" cannot be zero: "+t);O=-(E=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(F+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw N=!t,Error(F+"crypto unavailable");N=t}else N=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(J(t=e[r],0,9,r),i=t),e.hasOwnProperty(r="POW_PRECISION")&&(J(t=e[r],0,W,r),A=t),e.hasOwnProperty(r="FORMAT")){if("object"!=C(t=e[r]))throw Error(F+r+" not an object: "+t);S=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(F+r+" invalid: "+t);x="0123456789"==t.slice(0,10),_=t}}return{DECIMAL_PLACES:v,ROUNDING_MODE:y,EXPONENTIAL_AT:[d,b],RANGE:[O,E],CRYPTO:N,MODULO_MODE:i,POW_PRECISION:A,FORMAT:S,ALPHABET:_}},P.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!P.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-W<=i&&i<=W&&i===k(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((r=(i+1)%z)<1&&(r+=z),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||G<=t||t!==k(t))break e;if(0!==t)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(F+"Invalid BigNumber: "+e)},P.maximum=P.max=function(){return o(arguments,t.lt)},P.minimum=P.min=function(){return o(arguments,t.gt)},P.random=(r=9007199254740992,s=Math.random()*r&2097151?function(){return k(Math.random()*r)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,o,u=0,l=[],f=new P(g);if(null==e?e=v:J(e,0,W),i=M(e/z),N)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)9e15<=(o=131072*r[u]+(r[u+1]>>>11))?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(l.push(o%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw N=!1,Error(F+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)9e15<=(o=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])?crypto.randomBytes(7).copy(r,u):(l.push(o%1e14),u+=7);u=i/7}if(!N)for(;u<i;)(o=s())<9e15&&(l[u++]=o%1e14);for(i=l[--u],e%=z,i&&e&&(l[u]=k(i/(o=H[z-e]))*o);0===l[u];l.pop(),u--);if(u<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=z);for(u=1,o=l[0];10<=o;o/=10,u++);u<z&&(n-=z-u)}return f.e=n,f.c=l,f}),P.sum=function(){for(var e=1,r=arguments,t=new P(r[0]);e<r.length;)t=t.plus(r[e++]);return t},m="0123456789",a=function(e,r,t,n,i){var o,u,l,f,s,c,a,h,p=e.indexOf("."),g=v,d=y;for(0<=p&&(f=A,A=0,e=e.replace(".",""),c=(h=new P(r)).pow(e.length-p),A=f,h.c=R(ee(X(c.c),c.e,"0"),10,t,m),h.e=h.c.length),l=f=(a=R(e,r,t,i?(o=_,m):(o=m,_))).length;0==a[--f];a.pop());if(!a[0])return o.charAt(0);if(p<0?--l:(c.c=a,c.e=l,c.s=n,a=(c=w(c,h,g,d,t)).c,s=c.r,l=c.e),p=a[u=l+g+1],f=t/2,s=s||u<0||null!=a[u+1],s=d<4?(null!=p||s)&&(0==d||d==(c.s<0?3:2)):f<p||p==f&&(4==d||s||6==d&&1&a[u-1]||d==(c.s<0?8:7)),u<1||!a[0])e=s?ee(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(a.length=u,s)for(--t;++a[--u]>t;)a[u]=0,u||(++l,a=[1].concat(a));for(f=a.length;!a[--f];);for(p=0,e="";p<=f;e+=o.charAt(a[p++]));e=ee(e,l,o.charAt(0))}return e},w=function(e,r,t,n,i){var o,u,l,f,s,c,a,h,p,g,d,w,m,v,y,b,O,E=e.s==r.s?1:-1,N=e.c,A=r.c;if(!(N&&N[0]&&A&&A[0]))return new P(e.s&&r.s&&(N?!A||N[0]!=A[0]:A)?N&&0==N[0]||!A?0*E:E/0:NaN);for(p=(h=new P(E)).c=[],E=t+(u=e.e-r.e)+1,i||(i=G,u=Z(e.e/z)-Z(r.e/z),E=E/z|0),l=0;A[l]==(N[l]||0);l++);if(A[l]>(N[l]||0)&&u--,E<0)p.push(1),f=!0;else{for(v=N.length,b=A.length,E+=2,1<(s=k(i/(A[l=0]+1)))&&(A=D(A,s,i),N=D(N,s,i),b=A.length,v=N.length),m=b,d=(g=N.slice(0,b)).length;d<b;g[d++]=0);O=A.slice(),O=[0].concat(O),y=A[0],A[1]>=i/2&&y++;do{if(s=0,(o=j(A,g,b,d))<0){if(w=g[0],b!=d&&(w=w*i+(g[1]||0)),1<(s=k(w/y)))for(a=(c=D(A,s=i<=s?i-1:s,i)).length,d=g.length;1==j(c,g,a,d);)s--,B(c,b<a?O:A,a,i),a=c.length,o=1;else 0==s&&(o=s=1),a=(c=A.slice()).length;if(B(g,c=a<d?[0].concat(c):c,d,i),d=g.length,-1==o)for(;j(A,g,b,d)<1;)s++,B(g,b<d?O:A,d,i),d=g.length}else 0===o&&(s++,g=[0])}while(p[l++]=s,g[0]?g[d++]=N[m]||0:(g=[N[m]],d=1),(m++<v||null!=g[0])&&E--);f=null!=g[0],p[0]||p.splice(0,1)}if(i==G){for(l=1,E=p[0];10<=E;E/=10,l++);I(h,t+(h.e=l+u*z-1)+1,n,f)}else h.e=u,h.r=+f;return h},u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,f=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,r,t,n){var i,o=t?r:r.replace(p,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(u,function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r}),n&&(i=n,o=o.replace(l,"$1").replace(f,"0.$1")),r!=o))return new P(o,i);if(P.DEBUG)throw Error(F+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},t.absoluteValue=t.abs=function(){var e=new P(this);return e.s<0&&(e.s=1),e},t.comparedTo=function(e,r){return Y(this,new P(e,r))},t.decimalPlaces=t.dp=function(e,r){var t,n;if(null!=e)return J(e,0,W),null==r?r=y:J(r,0,8),I(new P(this),e+this.e+1,r);if(!(e=this.c))return null;if(t=((n=e.length-1)-Z(this.e/z))*z,n=e[n])for(;n%10==0;n/=10,t--);return t=t<0?0:t},t.dividedBy=t.div=function(e,r){return w(this,new P(e,r),v,y)},t.dividedToIntegerBy=t.idiv=function(e,r){return w(this,new P(e,r),0,1)},t.exponentiatedBy=t.pow=function(e,r){var t,n,i,o,u,l,f,s,c=this;if((e=new P(e)).c&&!e.isInteger())throw Error(F+"Exponent not an integer: "+L(e));if(null!=r&&(r=new P(r)),u=14<e.e,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return s=new P(Math.pow(+L(c),u?2-K(e):+L(e))),r?s.mod(r):s;if(l=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new P(NaN);(n=!l&&c.isInteger()&&r.isInteger())&&(c=c.mod(r))}else{if(9<e.e&&(0<c.e||c.e<-1||(0==c.e?1<c.c[0]||u&&24e7<=c.c[1]:c.c[0]<8e13||u&&c.c[0]<=9999975e7)))return o=c.s<0&&K(e)?-0:0,-1<c.e&&(o=1/o),new P(l?1/o:o);A&&(o=M(A/z+2))}for(f=u?(t=new P(.5),l&&(e.s=1),K(e)):(i=Math.abs(+L(e)))%2,s=new P(g);;){if(f){if(!(s=s.times(c)).c)break;o?s.c.length>o&&(s.c.length=o):n&&(s=s.mod(r))}if(i){if(0===(i=k(i/2)))break;f=i%2}else if(I(e=e.times(t),e.e+1,1),14<e.e)f=K(e);else{if(0==(i=+L(e)))break;f=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}return n?s:(l&&(s=g.div(s)),r?s.mod(r):o?I(s,A,y,void 0):s)},t.integerValue=function(e){var r=new P(this);return null==e?e=y:J(e,0,8),I(r,r.e+1,e)},t.isEqualTo=t.eq=function(e,r){return 0===Y(this,new P(e,r))},t.isFinite=function(){return!!this.c},t.isGreaterThan=t.gt=function(e,r){return 0<Y(this,new P(e,r))},t.isGreaterThanOrEqualTo=t.gte=function(e,r){return 1===(r=Y(this,new P(e,r)))||0===r},t.isInteger=function(){return!!this.c&&Z(this.e/z)>this.c.length-2},t.isLessThan=t.lt=function(e,r){return Y(this,new P(e,r))<0},t.isLessThanOrEqualTo=t.lte=function(e,r){return-1===(r=Y(this,new P(e,r)))||0===r},t.isNaN=function(){return!this.s},t.isNegative=function(){return this.s<0},t.isPositive=function(){return 0<this.s},t.isZero=function(){return!!this.c&&0==this.c[0]},t.minus=function(e,r){var t,n,i,o,u=this,l=u.s;if(r=(e=new P(e,r)).s,!l||!r)return new P(NaN);if(l!=r)return e.s=-r,u.plus(e);var f=u.e/z,s=e.e/z,c=u.c,a=e.c;if(!f||!s){if(!c||!a)return c?(e.s=-r,e):new P(a?u:NaN);if(!c[0]||!a[0])return a[0]?(e.s=-r,e):new P(c[0]?u:3==y?-0:0)}if(f=Z(f),s=Z(s),c=c.slice(),l=f-s){for((i=(o=l<0)?(l=-l,c):(s=f,a)).reverse(),r=l;r--;i.push(0));i.reverse()}else for(n=(o=(l=c.length)<(r=a.length))?l:r,l=r=0;r<n;r++)if(c[r]!=a[r]){o=c[r]<a[r];break}if(o&&(i=c,c=a,a=i,e.s=-e.s),0<(r=(n=a.length)-(t=c.length)))for(;r--;c[t++]=0);for(r=G-1;l<n;){if(c[--n]<a[n]){for(t=n;t&&!c[--t];c[t]=r);--c[t],c[n]+=G}c[n]-=a[n]}for(;0==c[0];c.splice(0,1),--s);return c[0]?T(e,c,s):(e.s=3==y?-1:1,e.c=[e.e=0],e)},t.modulo=t.mod=function(e,r){var t,n=this;return e=new P(e,r),!n.c||!e.s||e.c&&!e.c[0]?new P(NaN):!e.c||n.c&&!n.c[0]?new P(n):(9==i?(r=e.s,e.s=1,t=w(n,e,0,3),e.s=r,t.s*=r):t=w(n,e,0,i),(e=n.minus(t.times(e))).c[0]||1!=i||(e.s=n.s),e)},t.multipliedBy=t.times=function(e,r){var t,n,i,o,u,l,f,s,c,a,h,p=this,g=p.c,d=(e=new P(e,r)).c;if(!(g&&d&&g[0]&&d[0]))return!p.s||!e.s||g&&!g[0]&&!d||d&&!d[0]&&!g?e.c=e.e=e.s=null:(e.s*=p.s,g&&d?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=Z(p.e/z)+Z(e.e/z),e.s*=p.s,(l=g.length)<(p=d.length)&&(h=g,g=d,d=h,n=l,l=p,p=n),n=l+p,h=[];n--;h.push(0));for(n=p;0<=--n;){for(c=d[n]%1e7,a=d[n]/1e7|(t=0),i=n+(o=l);n<i;)t=((f=c*(f=g[--o]%1e7)+(u=a*f+(s=g[o]/1e7|0)*c)%1e7*1e7+h[i]+t)/1e14|0)+(u/1e7|0)+a*s,h[i--]=f%1e14;h[i]=t}return t?++r:h.splice(0,1),T(e,h,r)},t.negated=function(){var e=new P(this);return e.s=-e.s||null,e},t.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new P(e,r)).s,!i||!r)return new P(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/z,u=e.e/z,l=n.c,f=e.c;if(!o||!u){if(!l||!f)return new P(i/0);if(!l[0]||!f[0])return f[0]?e:new P(l[0]?n:0*i)}if(o=Z(o),u=Z(u),l=l.slice(),i=o-u){for((t=0<i?(u=o,f):(i=-i,l)).reverse();i--;t.push(0));t.reverse()}for((i=l.length)-(r=f.length)<0&&(t=f,f=l,l=t,r=i),i=0;r;)i=(l[--r]=l[r]+f[r]+i)/G|0,l[r]=G===l[r]?0:l[r]%G;return i&&(l=[i].concat(l),++u),T(e,l,u)},t.precision=t.sd=function(e,r){var t,n;if(null!=e&&e!==!!e)return J(e,1,W),null==r?r=y:J(r,0,8),I(new P(this),e,r);if(!(r=this.c))return null;if(t=(n=r.length-1)*z+1,n=r[n]){for(;n%10==0;n/=10,t--);for(n=r[0];10<=n;n/=10,t++);}return t=e&&this.e+1>t?this.e+1:t},t.shiftedBy=function(e){return J(e,-q,q),this.times("1e"+e)},t.squareRoot=t.sqrt=function(){var e,r,t,n,i,o=this,u=o.c,l=o.s,f=o.e,s=v+4,c=new P("0.5");if(1!==l||!u||!u[0])return new P(!l||l<0&&(!u||u[0])?NaN:u?o:1/0);if((t=0==(l=Math.sqrt(+L(o)))||l==1/0?(((r=X(u)).length+f)%2==0&&(r+="0"),l=Math.sqrt(+r),f=Z((f+1)/2)-(f<0||f%2),new P(r=l==1/0?"5e"+f:(r=l.toExponential()).slice(0,r.indexOf("e")+1)+f)):new P(l+"")).c[0])for((l=(f=t.e)+s)<3&&(l=0);;)if(i=t,t=c.times(i.plus(w(o,i,s,1))),X(i.c).slice(0,l)===(r=X(t.c)).slice(0,l)){if(t.e<f&&--l,"9999"!=(r=r.slice(l-3,l+1))&&(n||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(I(t,t.e+v+2,1),e=!t.times(t).eq(o));break}if(!n&&(I(i,i.e+v+2,0),i.times(i).eq(o))){t=i;break}s+=4,l+=4,n=1}return I(t,t.e+v+1,y,e)},t.toExponential=function(e,r){return null!=e&&(J(e,0,W),e++),n(this,e,r,1)},t.toFixed=function(e,r){return null!=e&&(J(e,0,W),e=e+this.e+1),n(this,e,r)},t.toFormat=function(e,r,t){if(null==t)null!=e&&r&&"object"==C(r)?(t=r,r=null):e&&"object"==C(e)?(t=e,e=r=null):t=S;else if("object"!=C(t))throw Error(F+"Argument not an object: "+t);if(e=this.toFixed(e,r),this.c){var n,r=e.split("."),i=+t.groupSize,o=+t.secondaryGroupSize,u=t.groupSeparator||"",l=r[0],r=r[1],f=this.s<0,s=f?l.slice(1):l,c=s.length;if(o&&(n=i,i=o,c-=o=n),0<i&&0<c){for(l=s.substr(0,n=c%i||i);n<c;n+=i)l+=u+s.substr(n,i);0<o&&(l+=u+s.slice(n)),f&&(l="-"+l)}e=r?l+(t.decimalSeparator||"")+((o=+t.fractionGroupSize)?r.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):r):l}return(t.prefix||"")+e+(t.suffix||"")},t.toFraction=function(e){var r,t,n,i,o,u,l,f,s,c,a=this,h=a.c;if(null!=e&&(!(l=new P(e)).isInteger()&&(l.c||1!==l.s)||l.lt(g)))throw Error(F+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+L(l));if(!h)return new P(a);for(r=new P(g),s=t=new P(g),n=f=new P(g),h=X(h),o=r.e=h.length-a.e-1,r.c[0]=H[(u=o%z)<0?z+u:u],e=!e||0<l.comparedTo(r)?0<o?r:s:l,u=E,E=1/0,l=new P(h),f.c[0]=0;c=w(l,r,0,1),1!=(i=t.plus(c.times(n))).comparedTo(e);)t=n,n=i,s=f.plus(c.times(i=s)),f=i,r=l.minus(c.times(i=r)),l=i;return i=w(e.minus(t),n,0,1),f=f.plus(i.times(s)),t=t.plus(i.times(n)),f.s=s.s=a.s,h=w(s,n,o*=2,y).minus(a).abs().comparedTo(w(f,t,o,y).minus(a).abs())<1?[s,n]:[f,t],E=u,h},t.toNumber=function(){return+L(this)},t.toPrecision=function(e,r){return null!=e&&J(e,1,W),n(this,e,r,2)},t.toString=function(e){var r,t=this,n=t.s,i=t.e;return null===i?n?(r="Infinity",n<0&&(r="-"+r)):r="NaN":(r=null==e?i<=d||b<=i?Q(X(t.c),i):ee(X(t.c),i,"0"):10===e&&x?ee(X((t=I(new P(t),v+i+1,y)).c),t.e,"0"):(J(e,2,_.length,"Base"),a(ee(X(t.c),i,"0"),10,e,n,!0)),n<0&&t.c[0]&&(r="-"+r)),r},t.valueOf=t.toJSON=function(){return L(this)},t._isBigNumber=!0,t[Symbol.toStringTag]="BigNumber",t[Symbol.for("nodejs.util.inspect.custom")]=t.valueOf,null!=e&&P.set(e),P}();function O(e,r){var t="",n=(t=w.isBigNumber(e)?e.toFixed():"string"!=typeof e?e.toString():e,null),e=null,i=null,o=r.match(/(<=|>=|=)\s*(\d+)/);if(o&&(e=o[1],n=Number(o[2])),r.includes(",")&&(i=!0),null!==n){var o=t.split("."),r=o[0],u=1===o.length?"":o[1],l=u.length;switch(e){case"<=":u=l<=n?u:u.slice(0,n);break;case"=":l<n?u+="0".repeat(n-l):n<l&&(u=u.slice(0,n));break;case">=":u=n<=l?u:u+"0".repeat(n-l)}t=""===u?r:"".concat(r,".").concat(u)}return t=null!==i?1<(o=t.split(".")).length?((e=o[0]).includes("-")?o[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):o[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),o.join(".")):(r=o[0]).includes("-")?r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):r.replace(/(?=(?!^)(?:\d{3})+$)/g,","):t}function E(e){for(var r=[],t=0,n=null,i=e.length;t<i;)if(n=e[t],/\s/.test(n))t++;else if("+-".includes(n)){var o=r[r.length-1];if(0===r.length||"+-".includes(o)||"("===o){for(var u=n,n=e[++t];/[a-zA-Z\d._]/.test(n);)u+=n,n=e[++t];r.push(u)}else r.push(n),t++}else if("*/%()".includes(n))r.push(n),t++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++t>=i));)n=e[t];r.push(l)}else if(/\d/.test(n)){for(var f="";/[\d.]/.test(n)&&(f+=n,!(++t>=i));)n=e[t];r.push(f)}return r}var m=function(){o(n,c(Error));var t=a(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).name="CalculatorError",r.message=e,r}return r(n)}(),N=function(){o(n,c(Error));var t=a(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).name="TokensFillError",r.message=e,r}return r(n)}();function v(e,r){var t=r._fillData;return void 0===r._fillData&&(t=r),e.map(function(e){if(/^[a-zA-z_][\w_]*$/.test(e)){var r=t[e];if(void 0!==r)return"number"==typeof r?r.toString():r;throw new N("错误的参数:".concat(e," 请确认他存在"))}return e})}function A(e){for(var r,t=[],n=[],i=e;0<i.length;){var o=i.shift();if(p(o))if("("===o)t.push(o);else if(")"===o){for(var u=t.pop();"("!==u&&0<t.length;)n.push(u),u=t.pop();if("("!==u)throw"error: unmatched ()"}else{for(;r=t[t.length-1],g(o)<=g(r)&&0<t.length;)n.push(t.pop());t.push(o)}else n.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)n.push(t.pop())}return n}function S(e){for(var r=[];0<e.length;){var t=e.shift();if(p(t)){if(r.length<2)throw new m("错误的栈长度, 可能是无法计算的表达式");var n=r.pop(),i=r.pop();if("string"==typeof n&&!w.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new m("".concat(n,"不是一个合法的数字"));n=new w(n)}if("string"==typeof i&&!w.isBigNumber(i)){if(!/^[+-]*[\d.]+$/.test(i))throw new m("".concat(i,"不是一个合法的数字"));i=new w(i)}switch(t){case"+":r.push(i.plus(n));break;case"-":r.push(i.minus(n));break;case"*":r.push(i.times(n));break;case"/":r.push(i.div(n));break;case"%":r.push(i.mod(n))}}else r.push(t)}if(1!==r.length)throw"unvalid expression";return r[0]}return e.calc=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=d(r),i=E(n.expr),o=null;if(null!==n.data)if(null===(o=void 0!==n.data._fillData?n.data:o)||void 0===o.fillError&&void 0===o.error)i=v(i,n.data);else try{i=v(i,n.data)}catch(e){if(e instanceof N)return console.warn(e),o.fillError||o.error;throw e}var i=A(i),u=null;if(null!==o){if(void 0!==o.calcError||void 0!==o.error)try{u=S(i)}catch(e){if(e instanceof m)return console.warn(e),void 0!==o.calcError?o.calcError:o.error;throw e}}else u=S(i);return u=null!==n.fmt?O(u,n.fmt):null!==u?u.toFixed():null},e.fmt=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=d(r),i=E(n.expr),o=null;if(2<i.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==i.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(o=void 0!==n.data._fillData?n.data:o)||void 0===o.fillError&&void 0===o.error)i=v(i,n.data);else try{i=v(i,n.data)}catch(e){if(e instanceof TokensFillError)return o.fillError||o.error;throw e}if(null===n.fmt)throw"表达式没有格式化部分";return O(i[0],n.fmt)},e.version="0.0.34",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var a_calc=function(e){"use strict";function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),r&&l(e,r)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,r){return(l=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function s(e,r,t){return(s=f()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);r=new(Function.bind.apply(e,n));return t&&l(r,t.prototype),r}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return s(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)})(e)}function y(e,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");r=e;if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function a(t){var n=f();return function(){var e,r=u(t);return y(this,n?(e=u(this).constructor,Reflect.construct(r,arguments,e)):r.apply(this,arguments))}}function b(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return h(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(t="Object"===t&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?h(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function p(e){return-1<"+-*/%()".indexOf(e)}function g(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function d(e){var r={expr:"",fmt:null,data:null},t="",n=e[0];if(1===e.length)"string"==typeof n?t=n:"number"==typeof n?t=n.toString():Array.isArray(n)&&(t=n[0]);else if(1<e.length){n=e[e.length-1];if(l=n,"[object Object]"!==Object.prototype.toString.call(l)||Array.isArray(l))for(var i=b(e.shift());i.length||e.length;)var o=0===i.length?"":i.shift(),u=0===e.length?"":e.shift(),t=t+o+(u="number"==typeof u?u.toString():u);else t=e[0],r.data=n}var l=t.split("|");return 1===l.length?r.expr=l[0]:(r.expr=l[0],""!==(n=l[1]).trim()&&(r.fmt=n)),r}var re=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,M=Math.ceil,k=Math.floor,F="[BigNumber Error] ",$=F+"Number primitive has more than 15 significant digits: ",G=1e14,z=14,q=9007199254740991,H=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],V=1e7,W=1e9;function Z(e){var r=0|e;return 0<e||e===r?r:r-1}function X(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=z-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function Y(e,r){var t,n,i=e.c,o=r.c,u=e.s,l=r.s,e=e.e,r=r.e;if(!u||!l)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-l:u;if(u!=l)return u;if(t=u<0,n=e==r,!i||!o)return n?0:!i^t?1:-1;if(!n)return r<e^t?1:-1;for(l=(e=i.length)<(r=o.length)?e:r,u=0;u<l;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return e==r?0:r<e^t?1:-1}function J(e,r,t,n){if(e<r||t<e||e!==k(e))throw Error(F+(n||"Argument")+("number"==typeof e?e<r||t<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function K(e){var r=e.c.length-1;return Z(e.e/z)==r&&e.c[r]%2!=0}function Q(e,r){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function ee(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var w=function U(e){var w,a,h,r,s,m,u,l,f,c,p,t=P.prototype={constructor:P,toString:null,valueOf:null},g=new P(1),v=20,y=4,d=-7,b=21,O=-1e7,E=1e7,N=!1,i=1,A=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},_="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function P(e,r){var t,n,i,o,u,l,f,s,c=this;if(!(c instanceof P))return new P(e,r);if(null==r){if(e&&!0===e._isBigNumber)return c.s=e.s,void(!e.c||e.e>E?c.c=c.e=null:e.e<O?c.c=[c.e=0]:(c.e=e.e,c.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(c.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,u=e;10<=u;u/=10,o++);return void(E<o?c.c=c.e=null:(c.e=o,c.c=[e]))}s=String(e)}else{if(!re.test(s=String(e)))return h(c,s,l);c.s=45==s.charCodeAt(0)?(s=s.slice(1),-1):1}0<(u=(s=-1<(o=s.indexOf("."))?s.replace(".",""):s).search(/e/i))?(o<0&&(o=u),o+=+s.slice(u+1),s=s.substring(0,u)):o<0&&(o=s.length)}else{if(J(r,2,_.length,"Base"),10==r&&x)return I(c=new P(e),v+c.e+1,y);if(s=String(e),l="number"==typeof e){if(0*e!=0)return h(c,s,l,r);if(c.s=1/e<0?(s=s.slice(1),-1):1,P.DEBUG&&15<s.replace(/^0\.0*|\./,"").length)throw Error($+e)}else c.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1;for(t=_.slice(0,r),o=u=0,f=s.length;u<f;u++)if(t.indexOf(n=s.charAt(u))<0){if("."==n){if(o<u){o=f;continue}}else if(!i&&(s==s.toUpperCase()&&(s=s.toLowerCase())||s==s.toLowerCase()&&(s=s.toUpperCase()))){i=!0,u=-1,o=0;continue}return h(c,String(e),l,r)}l=!1,-1<(o=(s=a(s,r,10,c.s)).indexOf("."))?s=s.replace(".",""):o=s.length}for(u=0;48===s.charCodeAt(u);u++);for(f=s.length;48===s.charCodeAt(--f););if(s=s.slice(u,++f)){if(f-=u,l&&P.DEBUG&&15<f&&(q<e||e!==k(e)))throw Error($+c.s*e);if((o=o-u-1)>E)c.c=c.e=null;else if(o<O)c.c=[c.e=0];else{if(c.e=o,c.c=[],u=(o+1)%z,o<0&&(u+=z),u<f){for(u&&c.c.push(+s.slice(0,u)),f-=z;u<f;)c.c.push(+s.slice(u,u+=z));u=z-(s=s.slice(u)).length}else u-=f;for(;u--;s+="0");c.c.push(+s)}}else c.c=[c.e=0]}function R(e,r,t,n){for(var i,o,u=[0],l=0,f=e.length;l<f;){for(o=u.length;o--;u[o]*=r);for(u[0]+=n.indexOf(e.charAt(l++)),i=0;i<u.length;i++)u[i]>t-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/t|0,u[i]%=t)}return u.reverse()}function D(e,r,t){var n,i,o,u=0,l=e.length,f=r%V,s=r/V|0;for(e=e.slice();l--;)u=((i=f*(o=e[l]%V)+(n=s*o+(o=e[l]/V|0)*f)%V*V+u)/t|0)+(n/V|0)+s*o,e[l]=i%t;return e=u?[u].concat(e):e}function j(e,r,t,n){var i,o;if(t!=n)o=n<t?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function B(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,r,t,n){var i,o,u,l;if(null==t?t=y:J(t,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==r)l=X(e.c),l=1==n||2==n&&(o<=d||b<=o)?Q(l,o):ee(l,o,"0");else if(t=(e=I(new P(e),r,t)).e,u=(l=X(e.c)).length,1==n||2==n&&(r<=t||t<=d)){for(;u<r;l+="0",u++);l=Q(l,t)}else if(r-=o,l=ee(l,t,"0"),u<t+1){if(0<--r)for(l+=".";r--;l+="0");}else if(0<(r+=t-u))for(t+1==u&&(l+=".");r--;l+="0");return e.s<0&&i?"-"+l:l}function o(e,r){for(var t,n=1,i=new P(e[0]);n<e.length;n++){if(!(t=new P(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function T(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];10<=i;i/=10,n++);return(t=n+t*z-1)>E?e.c=e.e=null:t<O?e.c=[e.e=0]:(e.e=t,e.c=r),e}function I(e,r,t,n){var i,o,u,l,f,s,c,a=e.c,h=H;if(a){e:{for(i=1,l=a[0];10<=l;l/=10,i++);if((o=r-i)<0)o+=z,u=r,c=(f=a[s=0])/h[i-u-1]%10|0;else if((s=M((o+1)/z))>=a.length){if(!n)break e;for(;a.length<=s;a.push(0));f=c=0,u=(o%=z)-z+(i=1)}else{for(f=l=a[s],i=1;10<=l;l/=10,i++);c=(u=(o%=z)-z+i)<0?0:f/h[i-u-1]%10|0}if(n=n||r<0||null!=a[s+1]||(u<0?f:f%h[i-u-1]),n=t<4?(c||n)&&(0==t||t==(e.s<0?3:2)):5<c||5==c&&(4==t||n||6==t&&(0<o?0<u?f/h[i-u]:0:a[s-1])%10&1||t==(e.s<0?8:7)),r<1||!a[0])return a.length=0,n?(r-=e.e+1,a[0]=h[(z-r%z)%z],e.e=-r||0):a[0]=e.e=0,e;if(0==o?(a.length=s,l=1,s--):(a.length=s+1,l=h[z-o],a[s]=0<u?k(f/h[i-u]%h[u])*l:0),n)for(;;){if(0==s){for(o=1,u=a[0];10<=u;u/=10,o++);for(u=a[0]+=l,l=1;10<=u;u/=10,l++);o!=l&&(e.e++,a[0]==G&&(a[0]=1));break}if(a[s]+=l,a[s]!=G)break;a[s--]=0,l=1}for(o=a.length;0===a[--o];a.pop());}e.e>E?e.c=e.e=null:e.e<O&&(e.c=[e.e=0])}return e}function L(e){var r,t=e.e;return null===t?e.toString():(r=X(e.c),r=t<=d||b<=t?Q(r,t):ee(r,t,"0"),e.s<0?"-"+r:r)}return P.clone=U,P.ROUND_UP=0,P.ROUND_DOWN=1,P.ROUND_CEIL=2,P.ROUND_FLOOR=3,P.ROUND_HALF_UP=4,P.ROUND_HALF_DOWN=5,P.ROUND_HALF_EVEN=6,P.ROUND_HALF_CEIL=7,P.ROUND_HALF_FLOOR=8,P.EUCLID=9,P.config=P.set=function(e){var r,t;if(null!=e){if("object"!=C(e))throw Error(F+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(J(t=e[r],0,W,r),v=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(J(t=e[r],0,8,r),y=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(J(t[0],-W,0,r),J(t[1],0,W,r),d=t[0],b=t[1]):(J(t,-W,W,r),d=-(b=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)J(t[0],-W,-1,r),J(t[1],1,W,r),O=t[0],E=t[1];else{if(J(t,-W,W,r),!t)throw Error(F+r+" cannot be zero: "+t);O=-(E=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(F+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw N=!t,Error(F+"crypto unavailable");N=t}else N=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(J(t=e[r],0,9,r),i=t),e.hasOwnProperty(r="POW_PRECISION")&&(J(t=e[r],0,W,r),A=t),e.hasOwnProperty(r="FORMAT")){if("object"!=C(t=e[r]))throw Error(F+r+" not an object: "+t);S=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(F+r+" invalid: "+t);x="0123456789"==t.slice(0,10),_=t}}return{DECIMAL_PLACES:v,ROUNDING_MODE:y,EXPONENTIAL_AT:[d,b],RANGE:[O,E],CRYPTO:N,MODULO_MODE:i,POW_PRECISION:A,FORMAT:S,ALPHABET:_}},P.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!P.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-W<=i&&i<=W&&i===k(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((r=(i+1)%z)<1&&(r+=z),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||G<=t||t!==k(t))break e;if(0!==t)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(F+"Invalid BigNumber: "+e)},P.maximum=P.max=function(){return o(arguments,t.lt)},P.minimum=P.min=function(){return o(arguments,t.gt)},P.random=(r=9007199254740992,s=Math.random()*r&2097151?function(){return k(Math.random()*r)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,o,u=0,l=[],f=new P(g);if(null==e?e=v:J(e,0,W),i=M(e/z),N)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)9e15<=(o=131072*r[u]+(r[u+1]>>>11))?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(l.push(o%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw N=!1,Error(F+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)9e15<=(o=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])?crypto.randomBytes(7).copy(r,u):(l.push(o%1e14),u+=7);u=i/7}if(!N)for(;u<i;)(o=s())<9e15&&(l[u++]=o%1e14);for(i=l[--u],e%=z,i&&e&&(l[u]=k(i/(o=H[z-e]))*o);0===l[u];l.pop(),u--);if(u<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=z);for(u=1,o=l[0];10<=o;o/=10,u++);u<z&&(n-=z-u)}return f.e=n,f.c=l,f}),P.sum=function(){for(var e=1,r=arguments,t=new P(r[0]);e<r.length;)t=t.plus(r[e++]);return t},m="0123456789",a=function(e,r,t,n,i){var o,u,l,f,s,c,a,h,p=e.indexOf("."),g=v,d=y;for(0<=p&&(f=A,A=0,e=e.replace(".",""),c=(h=new P(r)).pow(e.length-p),A=f,h.c=R(ee(X(c.c),c.e,"0"),10,t,m),h.e=h.c.length),l=f=(a=R(e,r,t,i?(o=_,m):(o=m,_))).length;0==a[--f];a.pop());if(!a[0])return o.charAt(0);if(p<0?--l:(c.c=a,c.e=l,c.s=n,a=(c=w(c,h,g,d,t)).c,s=c.r,l=c.e),p=a[u=l+g+1],f=t/2,s=s||u<0||null!=a[u+1],s=d<4?(null!=p||s)&&(0==d||d==(c.s<0?3:2)):f<p||p==f&&(4==d||s||6==d&&1&a[u-1]||d==(c.s<0?8:7)),u<1||!a[0])e=s?ee(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(a.length=u,s)for(--t;++a[--u]>t;)a[u]=0,u||(++l,a=[1].concat(a));for(f=a.length;!a[--f];);for(p=0,e="";p<=f;e+=o.charAt(a[p++]));e=ee(e,l,o.charAt(0))}return e},w=function(e,r,t,n,i){var o,u,l,f,s,c,a,h,p,g,d,w,m,v,y,b,O,E=e.s==r.s?1:-1,N=e.c,A=r.c;if(!(N&&N[0]&&A&&A[0]))return new P(e.s&&r.s&&(N?!A||N[0]!=A[0]:A)?N&&0==N[0]||!A?0*E:E/0:NaN);for(p=(h=new P(E)).c=[],E=t+(u=e.e-r.e)+1,i||(i=G,u=Z(e.e/z)-Z(r.e/z),E=E/z|0),l=0;A[l]==(N[l]||0);l++);if(A[l]>(N[l]||0)&&u--,E<0)p.push(1),f=!0;else{for(v=N.length,b=A.length,E+=2,1<(s=k(i/(A[l=0]+1)))&&(A=D(A,s,i),N=D(N,s,i),b=A.length,v=N.length),m=b,d=(g=N.slice(0,b)).length;d<b;g[d++]=0);O=A.slice(),O=[0].concat(O),y=A[0],A[1]>=i/2&&y++;do{if(s=0,(o=j(A,g,b,d))<0){if(w=g[0],b!=d&&(w=w*i+(g[1]||0)),1<(s=k(w/y)))for(a=(c=D(A,s=i<=s?i-1:s,i)).length,d=g.length;1==j(c,g,a,d);)s--,B(c,b<a?O:A,a,i),a=c.length,o=1;else 0==s&&(o=s=1),a=(c=A.slice()).length;if(B(g,c=a<d?[0].concat(c):c,d,i),d=g.length,-1==o)for(;j(A,g,b,d)<1;)s++,B(g,b<d?O:A,d,i),d=g.length}else 0===o&&(s++,g=[0])}while(p[l++]=s,g[0]?g[d++]=N[m]||0:(g=[N[m]],d=1),(m++<v||null!=g[0])&&E--);f=null!=g[0],p[0]||p.splice(0,1)}if(i==G){for(l=1,E=p[0];10<=E;E/=10,l++);I(h,t+(h.e=l+u*z-1)+1,n,f)}else h.e=u,h.r=+f;return h},u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,f=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,r,t,n){var i,o=t?r:r.replace(p,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(u,function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r}),n&&(i=n,o=o.replace(l,"$1").replace(f,"0.$1")),r!=o))return new P(o,i);if(P.DEBUG)throw Error(F+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},t.absoluteValue=t.abs=function(){var e=new P(this);return e.s<0&&(e.s=1),e},t.comparedTo=function(e,r){return Y(this,new P(e,r))},t.decimalPlaces=t.dp=function(e,r){var t,n;if(null!=e)return J(e,0,W),null==r?r=y:J(r,0,8),I(new P(this),e+this.e+1,r);if(!(e=this.c))return null;if(t=((n=e.length-1)-Z(this.e/z))*z,n=e[n])for(;n%10==0;n/=10,t--);return t=t<0?0:t},t.dividedBy=t.div=function(e,r){return w(this,new P(e,r),v,y)},t.dividedToIntegerBy=t.idiv=function(e,r){return w(this,new P(e,r),0,1)},t.exponentiatedBy=t.pow=function(e,r){var t,n,i,o,u,l,f,s,c=this;if((e=new P(e)).c&&!e.isInteger())throw Error(F+"Exponent not an integer: "+L(e));if(null!=r&&(r=new P(r)),u=14<e.e,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return s=new P(Math.pow(+L(c),u?2-K(e):+L(e))),r?s.mod(r):s;if(l=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new P(NaN);(n=!l&&c.isInteger()&&r.isInteger())&&(c=c.mod(r))}else{if(9<e.e&&(0<c.e||c.e<-1||(0==c.e?1<c.c[0]||u&&24e7<=c.c[1]:c.c[0]<8e13||u&&c.c[0]<=9999975e7)))return o=c.s<0&&K(e)?-0:0,-1<c.e&&(o=1/o),new P(l?1/o:o);A&&(o=M(A/z+2))}for(f=u?(t=new P(.5),l&&(e.s=1),K(e)):(i=Math.abs(+L(e)))%2,s=new P(g);;){if(f){if(!(s=s.times(c)).c)break;o?s.c.length>o&&(s.c.length=o):n&&(s=s.mod(r))}if(i){if(0===(i=k(i/2)))break;f=i%2}else if(I(e=e.times(t),e.e+1,1),14<e.e)f=K(e);else{if(0==(i=+L(e)))break;f=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}return n?s:(l&&(s=g.div(s)),r?s.mod(r):o?I(s,A,y,void 0):s)},t.integerValue=function(e){var r=new P(this);return null==e?e=y:J(e,0,8),I(r,r.e+1,e)},t.isEqualTo=t.eq=function(e,r){return 0===Y(this,new P(e,r))},t.isFinite=function(){return!!this.c},t.isGreaterThan=t.gt=function(e,r){return 0<Y(this,new P(e,r))},t.isGreaterThanOrEqualTo=t.gte=function(e,r){return 1===(r=Y(this,new P(e,r)))||0===r},t.isInteger=function(){return!!this.c&&Z(this.e/z)>this.c.length-2},t.isLessThan=t.lt=function(e,r){return Y(this,new P(e,r))<0},t.isLessThanOrEqualTo=t.lte=function(e,r){return-1===(r=Y(this,new P(e,r)))||0===r},t.isNaN=function(){return!this.s},t.isNegative=function(){return this.s<0},t.isPositive=function(){return 0<this.s},t.isZero=function(){return!!this.c&&0==this.c[0]},t.minus=function(e,r){var t,n,i,o,u=this,l=u.s;if(r=(e=new P(e,r)).s,!l||!r)return new P(NaN);if(l!=r)return e.s=-r,u.plus(e);var f=u.e/z,s=e.e/z,c=u.c,a=e.c;if(!f||!s){if(!c||!a)return c?(e.s=-r,e):new P(a?u:NaN);if(!c[0]||!a[0])return a[0]?(e.s=-r,e):new P(c[0]?u:3==y?-0:0)}if(f=Z(f),s=Z(s),c=c.slice(),l=f-s){for((i=(o=l<0)?(l=-l,c):(s=f,a)).reverse(),r=l;r--;i.push(0));i.reverse()}else for(n=(o=(l=c.length)<(r=a.length))?l:r,l=r=0;r<n;r++)if(c[r]!=a[r]){o=c[r]<a[r];break}if(o&&(i=c,c=a,a=i,e.s=-e.s),0<(r=(n=a.length)-(t=c.length)))for(;r--;c[t++]=0);for(r=G-1;l<n;){if(c[--n]<a[n]){for(t=n;t&&!c[--t];c[t]=r);--c[t],c[n]+=G}c[n]-=a[n]}for(;0==c[0];c.splice(0,1),--s);return c[0]?T(e,c,s):(e.s=3==y?-1:1,e.c=[e.e=0],e)},t.modulo=t.mod=function(e,r){var t,n=this;return e=new P(e,r),!n.c||!e.s||e.c&&!e.c[0]?new P(NaN):!e.c||n.c&&!n.c[0]?new P(n):(9==i?(r=e.s,e.s=1,t=w(n,e,0,3),e.s=r,t.s*=r):t=w(n,e,0,i),(e=n.minus(t.times(e))).c[0]||1!=i||(e.s=n.s),e)},t.multipliedBy=t.times=function(e,r){var t,n,i,o,u,l,f,s,c,a,h,p=this,g=p.c,d=(e=new P(e,r)).c;if(!(g&&d&&g[0]&&d[0]))return!p.s||!e.s||g&&!g[0]&&!d||d&&!d[0]&&!g?e.c=e.e=e.s=null:(e.s*=p.s,g&&d?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=Z(p.e/z)+Z(e.e/z),e.s*=p.s,(l=g.length)<(p=d.length)&&(h=g,g=d,d=h,n=l,l=p,p=n),n=l+p,h=[];n--;h.push(0));for(n=p;0<=--n;){for(c=d[n]%1e7,a=d[n]/1e7|(t=0),i=n+(o=l);n<i;)t=((f=c*(f=g[--o]%1e7)+(u=a*f+(s=g[o]/1e7|0)*c)%1e7*1e7+h[i]+t)/1e14|0)+(u/1e7|0)+a*s,h[i--]=f%1e14;h[i]=t}return t?++r:h.splice(0,1),T(e,h,r)},t.negated=function(){var e=new P(this);return e.s=-e.s||null,e},t.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new P(e,r)).s,!i||!r)return new P(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/z,u=e.e/z,l=n.c,f=e.c;if(!o||!u){if(!l||!f)return new P(i/0);if(!l[0]||!f[0])return f[0]?e:new P(l[0]?n:0*i)}if(o=Z(o),u=Z(u),l=l.slice(),i=o-u){for((t=0<i?(u=o,f):(i=-i,l)).reverse();i--;t.push(0));t.reverse()}for((i=l.length)-(r=f.length)<0&&(t=f,f=l,l=t,r=i),i=0;r;)i=(l[--r]=l[r]+f[r]+i)/G|0,l[r]=G===l[r]?0:l[r]%G;return i&&(l=[i].concat(l),++u),T(e,l,u)},t.precision=t.sd=function(e,r){var t,n;if(null!=e&&e!==!!e)return J(e,1,W),null==r?r=y:J(r,0,8),I(new P(this),e,r);if(!(r=this.c))return null;if(t=(n=r.length-1)*z+1,n=r[n]){for(;n%10==0;n/=10,t--);for(n=r[0];10<=n;n/=10,t++);}return t=e&&this.e+1>t?this.e+1:t},t.shiftedBy=function(e){return J(e,-q,q),this.times("1e"+e)},t.squareRoot=t.sqrt=function(){var e,r,t,n,i,o=this,u=o.c,l=o.s,f=o.e,s=v+4,c=new P("0.5");if(1!==l||!u||!u[0])return new P(!l||l<0&&(!u||u[0])?NaN:u?o:1/0);if((t=0==(l=Math.sqrt(+L(o)))||l==1/0?(((r=X(u)).length+f)%2==0&&(r+="0"),l=Math.sqrt(+r),f=Z((f+1)/2)-(f<0||f%2),new P(r=l==1/0?"5e"+f:(r=l.toExponential()).slice(0,r.indexOf("e")+1)+f)):new P(l+"")).c[0])for((l=(f=t.e)+s)<3&&(l=0);;)if(i=t,t=c.times(i.plus(w(o,i,s,1))),X(i.c).slice(0,l)===(r=X(t.c)).slice(0,l)){if(t.e<f&&--l,"9999"!=(r=r.slice(l-3,l+1))&&(n||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(I(t,t.e+v+2,1),e=!t.times(t).eq(o));break}if(!n&&(I(i,i.e+v+2,0),i.times(i).eq(o))){t=i;break}s+=4,l+=4,n=1}return I(t,t.e+v+1,y,e)},t.toExponential=function(e,r){return null!=e&&(J(e,0,W),e++),n(this,e,r,1)},t.toFixed=function(e,r){return null!=e&&(J(e,0,W),e=e+this.e+1),n(this,e,r)},t.toFormat=function(e,r,t){if(null==t)null!=e&&r&&"object"==C(r)?(t=r,r=null):e&&"object"==C(e)?(t=e,e=r=null):t=S;else if("object"!=C(t))throw Error(F+"Argument not an object: "+t);if(e=this.toFixed(e,r),this.c){var n,r=e.split("."),i=+t.groupSize,o=+t.secondaryGroupSize,u=t.groupSeparator||"",l=r[0],r=r[1],f=this.s<0,s=f?l.slice(1):l,c=s.length;if(o&&(n=i,i=o,c-=o=n),0<i&&0<c){for(l=s.substr(0,n=c%i||i);n<c;n+=i)l+=u+s.substr(n,i);0<o&&(l+=u+s.slice(n)),f&&(l="-"+l)}e=r?l+(t.decimalSeparator||"")+((o=+t.fractionGroupSize)?r.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):r):l}return(t.prefix||"")+e+(t.suffix||"")},t.toFraction=function(e){var r,t,n,i,o,u,l,f,s,c,a=this,h=a.c;if(null!=e&&(!(l=new P(e)).isInteger()&&(l.c||1!==l.s)||l.lt(g)))throw Error(F+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+L(l));if(!h)return new P(a);for(r=new P(g),s=t=new P(g),n=f=new P(g),h=X(h),o=r.e=h.length-a.e-1,r.c[0]=H[(u=o%z)<0?z+u:u],e=!e||0<l.comparedTo(r)?0<o?r:s:l,u=E,E=1/0,l=new P(h),f.c[0]=0;c=w(l,r,0,1),1!=(i=t.plus(c.times(n))).comparedTo(e);)t=n,n=i,s=f.plus(c.times(i=s)),f=i,r=l.minus(c.times(i=r)),l=i;return i=w(e.minus(t),n,0,1),f=f.plus(i.times(s)),t=t.plus(i.times(n)),f.s=s.s=a.s,h=w(s,n,o*=2,y).minus(a).abs().comparedTo(w(f,t,o,y).minus(a).abs())<1?[s,n]:[f,t],E=u,h},t.toNumber=function(){return+L(this)},t.toPrecision=function(e,r){return null!=e&&J(e,1,W),n(this,e,r,2)},t.toString=function(e){var r,t=this,n=t.s,i=t.e;return null===i?n?(r="Infinity",n<0&&(r="-"+r)):r="NaN":(r=null==e?i<=d||b<=i?Q(X(t.c),i):ee(X(t.c),i,"0"):10===e&&x?ee(X((t=I(new P(t),v+i+1,y)).c),t.e,"0"):(J(e,2,_.length,"Base"),a(ee(X(t.c),i,"0"),10,e,n,!0)),n<0&&t.c[0]&&(r="-"+r)),r},t.valueOf=t.toJSON=function(){return L(this)},t._isBigNumber=!0,t[Symbol.toStringTag]="BigNumber",t[Symbol.for("nodejs.util.inspect.custom")]=t.valueOf,null!=e&&P.set(e),P}();function O(e,r){var t="",n=(t=w.isBigNumber(e)?e.toFixed():"string"!=typeof e?e.toString():e,null),e=null,i=null,o=r.match(/(<=|>=|=)\s*(\d+)/);if(o&&(e=o[1],n=Number(o[2])),r.includes(",")&&(i=!0),null!==n){var o=t.split("."),r=o[0],u=1===o.length?"":o[1],l=u.length;switch(e){case"<=":u=l<=n?u:u.slice(0,n);break;case"=":l<n?u+="0".repeat(n-l):n<l&&(u=u.slice(0,n));break;case">=":u=n<=l?u:u+"0".repeat(n-l)}t=""===u?r:"".concat(r,".").concat(u)}return t=null!==i?1<(o=t.split(".")).length?((e=o[0]).includes("-")?o[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):o[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),o.join(".")):(r=o[0]).includes("-")?r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):r.replace(/(?=(?!^)(?:\d{3})+$)/g,","):t}function E(e){for(var r=[],t=0,n=null,i=e.length;t<i;)if(n=e[t],/\s/.test(n))t++;else if("+-".includes(n)){var o=r[r.length-1];if(0===r.length||"+-".includes(o)||"("===o){for(var u=n,n=e[++t];/[a-zA-Z\d._]/.test(n);)u+=n,n=e[++t];r.push(u)}else r.push(n),t++}else if("*/%()".includes(n))r.push(n),t++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++t>=i));)n=e[t];r.push(l)}else if(/\d/.test(n)){for(var f="";/[\d.]/.test(n)&&(f+=n,!(++t>=i));)n=e[t];r.push(f)}return r}var m=function(){o(n,c(Error));var t=a(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).name="CalculatorError",r.message=e,r}return r(n)}(),N=function(){o(n,c(Error));var t=a(n);function n(e){var r;return i(this,n),(r=t.call(this,e)).name="TokensFillError",r.message=e,r}return r(n)}();function v(e,r){var t=r._fillData;return void 0===r._fillData&&(t=r),e.map(function(e){if(/^[a-zA-z_][\w_]*$/.test(e)){var r=t[e];if(void 0!==r)return"number"==typeof r?r.toString():r;throw new N("错误的参数:".concat(e," 请确认他存在"))}return e})}function A(e){for(var r,t=[],n=[],i=e;0<i.length;){var o=i.shift();if(p(o))if("("===o)t.push(o);else if(")"===o){for(var u=t.pop();"("!==u&&0<t.length;)n.push(u),u=t.pop();if("("!==u)throw"error: unmatched ()"}else{for(;r=t[t.length-1],g(o)<=g(r)&&0<t.length;)n.push(t.pop());t.push(o)}else n.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)n.push(t.pop())}return n}function S(e){for(var r=[];0<e.length;){var t=e.shift();if(p(t)){if(r.length<2)throw new m("错误的栈长度, 可能是无法计算的表达式");var n=r.pop(),i=r.pop();if("string"==typeof n&&!w.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new m("".concat(n,"不是一个合法的数字"));n=new w(n)}if("string"==typeof i&&!w.isBigNumber(i)){if(!/^[+-]*[\d.]+$/.test(i))throw new m("".concat(i,"不是一个合法的数字"));i=new w(i)}switch(t){case"+":r.push(i.plus(n));break;case"-":r.push(i.minus(n));break;case"*":r.push(i.times(n));break;case"/":r.push(i.div(n));break;case"%":r.push(i.mod(n))}}else r.push(t)}if(1!==r.length)throw"unvalid expression";return r[0]}return e.calc=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=d(r),i=E(n.expr),o=null;if(null!==n.data)if(null===(o=void 0!==n.data._fillData?n.data:o)||void 0===o.fillError&&void 0===o.error)i=v(i,n.data);else try{i=v(i,n.data)}catch(e){if(e instanceof N)return void 0!==o.warn&&!0===o.warn&&console.warn(e),o.fillError||o.error;throw e}var i=A(i),u=null;if(null!==o){if(void 0!==o.calcError||void 0!==o.error)try{u=S(i)}catch(e){if(e instanceof m)return void 0!==o.warn&&!0===o.warn&&console.warn(e),void 0!==o.calcError?o.calcError:o.error;throw e}}else u=S(i);return u=null!==n.fmt?O(u,n.fmt):null!==u?u.toFixed():null},e.fmt=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];var n=d(r),i=E(n.expr),o=null;if(2<i.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==i.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(o=void 0!==n.data._fillData?n.data:o)||void 0===o.fillError&&void 0===o.error)i=v(i,n.data);else try{i=v(i,n.data)}catch(e){if(e instanceof TokensFillError)return o.fillError||o.error;throw e}if(null===n.fmt)throw"表达式没有格式化部分";return O(i[0],n.fmt)},e.version="0.0.35",Object.defineProperty(e,"__esModule",{value:!0}),e}({});

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var BigNumber=require("bignumber.js");function _interopDefaultLegacy(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var BigNumber__default=_interopDefaultLegacy(BigNumber);function _classCallCheck(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function _createClass(r,e,t){return e&&_defineProperties(r.prototype,e),t&&_defineProperties(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function _inherits(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&_setPrototypeOf(r,e)}function _getPrototypeOf(r){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(r)}function _setPrototypeOf(r,e){return(_setPrototypeOf=Object.setPrototypeOf||function(r,e){return r.__proto__=e,r})(r,e)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function _construct(r,e,t){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function(r,e,t){var n=[null];n.push.apply(n,e);e=new(Function.bind.apply(r,n));return t&&_setPrototypeOf(e,t.prototype),e}).apply(null,arguments)}function _isNativeFunction(r){return-1!==Function.toString.call(r).indexOf("[native code]")}function _wrapNativeSuper(r){var t="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(r){if(null===r||!_isNativeFunction(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(r))return t.get(r);t.set(r,e)}function e(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(e,r)})(r)}function _assertThisInitialized(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function _possibleConstructorReturn(r,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(r)}function _createSuper(t){var n=_isNativeReflectConstruct();return function(){var r,e=_getPrototypeOf(t);return _possibleConstructorReturn(this,n?(r=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,r)):e.apply(this,arguments))}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _unsupportedIterableToArray(r,e){if(r){if("string"==typeof r)return _arrayLikeToArray(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(t="Object"===t&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,e):void 0}}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function isOperator(r){return-1<"+-*/%()".indexOf(r)}function getPrioraty(r){switch(r){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function prioraty(r,e){return getPrioraty(r)<=getPrioraty(e)}function isObj(r){return"[object Object]"===Object.prototype.toString.call(r)&&!Array.isArray(r)}function parseArgs(r){var e={expr:"",fmt:null,data:null},t="",n=r[0];if(1===r.length)"string"==typeof n?t=n:"number"==typeof n?t=n.toString():Array.isArray(n)&&(t=n[0]);else if(1<r.length){n=r[r.length-1];if(isObj(n))t=r[0],e.data=n;else for(var o=_toConsumableArray(r.shift());o.length||r.length;)var i=0===o.length?"":o.shift(),a=0===r.length?"":r.shift(),t=t+i+(a="number"==typeof a?a.toString():a)}var n=t.split("|");return 1===n.length?e.expr=n[0]:(e.expr=n[0],""!==(n=n[1]).trim()&&(e.fmt=n)),e}function format(r,e){var t="",n=(t=BigNumber__default.default.isBigNumber(r)?r.toFixed():"string"!=typeof r?r.toString():r,null),r=null,o=null,i=e.match(/(<=|>=|=)\s*(\d+)/);if(i&&(r=i[1],n=Number(i[2])),e.includes(",")&&(o=!0),null!==n){var i=t.split("."),e=i[0],a=1===i.length?"":i[1],l=a.length;switch(r){case"<=":a=l<=n?a:a.slice(0,n);break;case"=":l<n?a+="0".repeat(n-l):n<l&&(a=a.slice(0,n));break;case">=":a=n<=l?a:a+"0".repeat(n-l)}t=""===a?e:"".concat(e,".").concat(a)}return t=null!==o?1<(i=t.split(".")).length?((r=i[0]).includes("-")?i[0]=r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):i[0]=r.replace(/(?=(?!^)(?:\d{3})+$)/g,","),i.join(".")):(e=i[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,","):t}function tokenizer(r){for(var e=[],t=0,n=null,o=r.length;t<o;)if(n=r[t],/\s/.test(n))t++;else if("+-".includes(n)){var i=e[e.length-1];if(0===e.length||"+-".includes(i)||"("===i){for(var a=n,n=r[++t];/[a-zA-Z\d._]/.test(n);)a+=n,n=r[++t];e.push(a)}else e.push(n),t++}else if("*/%()".includes(n))e.push(n),t++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++t>=o));)n=r[t];e.push(l)}else if(/\d/.test(n)){for(var u="";/[\d.]/.test(n)&&(u+=n,!(++t>=o));)n=r[t];e.push(u)}return e}var CalculatorError=function(){_inherits(n,_wrapNativeSuper(Error));var t=_createSuper(n);function n(r){var e;return _classCallCheck(this,n),(e=t.call(this,r)).name="CalculatorError",e.message=r,e}return _createClass(n)}(),TokensFillError$1=function(){_inherits(n,_wrapNativeSuper(Error));var t=_createSuper(n);function n(r){var e;return _classCallCheck(this,n),(e=t.call(this,r)).name="TokensFillError",e.message=r,e}return _createClass(n)}();function fillTokens(r,e){var t=e._fillData;return void 0===e._fillData&&(t=e),r.map(function(r){if(/^[a-zA-z_][\w_]*$/.test(r)){var e=t[r];if(void 0!==e)return"number"==typeof e?e.toString():e;throw new TokensFillError$1("错误的参数:".concat(r," 请确认他存在"))}return r})}function fmt(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=parseArgs(e),o=tokenizer(n.expr),i=null;if(2<o.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==o.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError)return i.fillError||i.error;throw r}if(null===n.fmt)throw"表达式没有格式化部分";return format(o[0],n.fmt)}var version="0.0.34";function token2postfix(r){for(var e=[],t=[],n=r;0<n.length;){var o=n.shift();if(isOperator(o))if("("===o)e.push(o);else if(")"===o){for(var i=e.pop();"("!==i&&0<e.length;)t.push(i),i=e.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,e[e.length-1])&&0<e.length;)t.push(e.pop());e.push(o)}else t.push(o)}if(0<e.length){if(")"===e[e.length-1]||"("===e[e.length-1])throw"error: unmatched ()";for(;0<e.length;)t.push(e.pop())}return t}function evalPostfix(r){for(var e=[];0<r.length;){var t=r.shift();if(isOperator(t)){if(e.length<2)throw new CalculatorError("错误的栈长度, 可能是无法计算的表达式");var n=e.pop(),o=e.pop();if("string"==typeof n&&!BigNumber__default.default.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new CalculatorError("".concat(n,"不是一个合法的数字"));n=new BigNumber__default.default(n)}if("string"==typeof o&&!BigNumber__default.default.isBigNumber(o)){if(!/^[+-]*[\d.]+$/.test(o))throw new CalculatorError("".concat(o,"不是一个合法的数字"));o=new BigNumber__default.default(o)}switch(t){case"+":e.push(o.plus(n));break;case"-":e.push(o.minus(n));break;case"*":e.push(o.times(n));break;case"/":e.push(o.div(n));break;case"%":e.push(o.mod(n))}}else e.push(t)}if(1!==e.length)throw"unvalid expression";return e[0]}function calc(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=parseArgs(e),o=tokenizer(n.expr),i=null;if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError$1)return console.warn(r),i.fillError||i.error;throw r}var o=token2postfix(o),a=null;if(null!==i){if(void 0!==i.calcError||void 0!==i.error)try{a=evalPostfix(o)}catch(r){if(r instanceof CalculatorError)return console.warn(r),void 0!==i.calcError?i.calcError:i.error;throw r}}else a=evalPostfix(o);return a=null!==n.fmt?format(a,n.fmt):null!==a?a.toFixed():null}exports.calc=calc,exports.fmt=fmt,exports.version=version;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var BigNumber=require("bignumber.js");function _interopDefaultLegacy(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var BigNumber__default=_interopDefaultLegacy(BigNumber);function _classCallCheck(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function _createClass(r,e,t){return e&&_defineProperties(r.prototype,e),t&&_defineProperties(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function _inherits(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&_setPrototypeOf(r,e)}function _getPrototypeOf(r){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(r)}function _setPrototypeOf(r,e){return(_setPrototypeOf=Object.setPrototypeOf||function(r,e){return r.__proto__=e,r})(r,e)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function _construct(r,e,t){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function(r,e,t){var n=[null];n.push.apply(n,e);e=new(Function.bind.apply(r,n));return t&&_setPrototypeOf(e,t.prototype),e}).apply(null,arguments)}function _isNativeFunction(r){return-1!==Function.toString.call(r).indexOf("[native code]")}function _wrapNativeSuper(r){var t="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(r){if(null===r||!_isNativeFunction(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(r))return t.get(r);t.set(r,e)}function e(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(e,r)})(r)}function _assertThisInitialized(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function _possibleConstructorReturn(r,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(r)}function _createSuper(t){var n=_isNativeReflectConstruct();return function(){var r,e=_getPrototypeOf(t);return _possibleConstructorReturn(this,n?(r=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,r)):e.apply(this,arguments))}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _unsupportedIterableToArray(r,e){if(r){if("string"==typeof r)return _arrayLikeToArray(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(t="Object"===t&&r.constructor?r.constructor.name:t)||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,e):void 0}}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function isOperator(r){return-1<"+-*/%()".indexOf(r)}function getPrioraty(r){switch(r){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function prioraty(r,e){return getPrioraty(r)<=getPrioraty(e)}function isObj(r){return"[object Object]"===Object.prototype.toString.call(r)&&!Array.isArray(r)}function parseArgs(r){var e={expr:"",fmt:null,data:null},t="",n=r[0];if(1===r.length)"string"==typeof n?t=n:"number"==typeof n?t=n.toString():Array.isArray(n)&&(t=n[0]);else if(1<r.length){n=r[r.length-1];if(isObj(n))t=r[0],e.data=n;else for(var o=_toConsumableArray(r.shift());o.length||r.length;)var i=0===o.length?"":o.shift(),a=0===r.length?"":r.shift(),t=t+i+(a="number"==typeof a?a.toString():a)}var n=t.split("|");return 1===n.length?e.expr=n[0]:(e.expr=n[0],""!==(n=n[1]).trim()&&(e.fmt=n)),e}function format(r,e){var t="",n=(t=BigNumber__default.default.isBigNumber(r)?r.toFixed():"string"!=typeof r?r.toString():r,null),r=null,o=null,i=e.match(/(<=|>=|=)\s*(\d+)/);if(i&&(r=i[1],n=Number(i[2])),e.includes(",")&&(o=!0),null!==n){var i=t.split("."),e=i[0],a=1===i.length?"":i[1],l=a.length;switch(r){case"<=":a=l<=n?a:a.slice(0,n);break;case"=":l<n?a+="0".repeat(n-l):n<l&&(a=a.slice(0,n));break;case">=":a=n<=l?a:a+"0".repeat(n-l)}t=""===a?e:"".concat(e,".").concat(a)}return t=null!==o?1<(i=t.split(".")).length?((r=i[0]).includes("-")?i[0]=r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):i[0]=r.replace(/(?=(?!^)(?:\d{3})+$)/g,","),i.join(".")):(e=i[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,","):t}function tokenizer(r){for(var e=[],t=0,n=null,o=r.length;t<o;)if(n=r[t],/\s/.test(n))t++;else if("+-".includes(n)){var i=e[e.length-1];if(0===e.length||"+-".includes(i)||"("===i){for(var a=n,n=r[++t];/[a-zA-Z\d._]/.test(n);)a+=n,n=r[++t];e.push(a)}else e.push(n),t++}else if("*/%()".includes(n))e.push(n),t++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++t>=o));)n=r[t];e.push(l)}else if(/\d/.test(n)){for(var u="";/[\d.]/.test(n)&&(u+=n,!(++t>=o));)n=r[t];e.push(u)}return e}var CalculatorError=function(){_inherits(n,_wrapNativeSuper(Error));var t=_createSuper(n);function n(r){var e;return _classCallCheck(this,n),(e=t.call(this,r)).name="CalculatorError",e.message=r,e}return _createClass(n)}(),TokensFillError$1=function(){_inherits(n,_wrapNativeSuper(Error));var t=_createSuper(n);function n(r){var e;return _classCallCheck(this,n),(e=t.call(this,r)).name="TokensFillError",e.message=r,e}return _createClass(n)}();function fillTokens(r,e){var t=e._fillData;return void 0===e._fillData&&(t=e),r.map(function(r){if(/^[a-zA-z_][\w_]*$/.test(r)){var e=t[r];if(void 0!==e)return"number"==typeof e?e.toString():e;throw new TokensFillError$1("错误的参数:".concat(r," 请确认他存在"))}return r})}function fmt(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=parseArgs(e),o=tokenizer(n.expr),i=null;if(2<o.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==o.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError)return i.fillError||i.error;throw r}if(null===n.fmt)throw"表达式没有格式化部分";return format(o[0],n.fmt)}var version="0.0.35";function token2postfix(r){for(var e=[],t=[],n=r;0<n.length;){var o=n.shift();if(isOperator(o))if("("===o)e.push(o);else if(")"===o){for(var i=e.pop();"("!==i&&0<e.length;)t.push(i),i=e.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,e[e.length-1])&&0<e.length;)t.push(e.pop());e.push(o)}else t.push(o)}if(0<e.length){if(")"===e[e.length-1]||"("===e[e.length-1])throw"error: unmatched ()";for(;0<e.length;)t.push(e.pop())}return t}function evalPostfix(r){for(var e=[];0<r.length;){var t=r.shift();if(isOperator(t)){if(e.length<2)throw new CalculatorError("错误的栈长度, 可能是无法计算的表达式");var n=e.pop(),o=e.pop();if("string"==typeof n&&!BigNumber__default.default.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new CalculatorError("".concat(n,"不是一个合法的数字"));n=new BigNumber__default.default(n)}if("string"==typeof o&&!BigNumber__default.default.isBigNumber(o)){if(!/^[+-]*[\d.]+$/.test(o))throw new CalculatorError("".concat(o,"不是一个合法的数字"));o=new BigNumber__default.default(o)}switch(t){case"+":e.push(o.plus(n));break;case"-":e.push(o.minus(n));break;case"*":e.push(o.times(n));break;case"/":e.push(o.div(n));break;case"%":e.push(o.mod(n))}}else e.push(t)}if(1!==e.length)throw"unvalid expression";return e[0]}function calc(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];var n=parseArgs(e),o=tokenizer(n.expr),i=null;if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError$1)return void 0!==i.warn&&!0===i.warn&&console.warn(r),i.fillError||i.error;throw r}var o=token2postfix(o),a=null;if(null!==i){if(void 0!==i.calcError||void 0!==i.error)try{a=evalPostfix(o)}catch(r){if(r instanceof CalculatorError)return void 0!==i.warn&&!0===i.warn&&console.warn(r),void 0!==i.calcError?i.calcError:i.error;throw r}}else a=evalPostfix(o);return a=null!==n.fmt?format(a,n.fmt):null!==a?a.toFixed():null}exports.calc=calc,exports.fmt=fmt,exports.version=version;

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

import BigNumber from"bignumber.js";function _classCallCheck(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function _createClass(r,t,e){return t&&_defineProperties(r.prototype,t),e&&_defineProperties(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function _inherits(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&_setPrototypeOf(r,t)}function _getPrototypeOf(r){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(r)}function _setPrototypeOf(r,t){return(_setPrototypeOf=Object.setPrototypeOf||function(r,t){return r.__proto__=t,r})(r,t)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function _construct(r,t,e){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function(r,t,e){var n=[null];n.push.apply(n,t);t=new(Function.bind.apply(r,n));return e&&_setPrototypeOf(t,e.prototype),t}).apply(null,arguments)}function _isNativeFunction(r){return-1!==Function.toString.call(r).indexOf("[native code]")}function _wrapNativeSuper(r){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(r){if(null===r||!_isNativeFunction(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(t,r)})(r)}function _assertThisInitialized(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function _possibleConstructorReturn(r,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(r)}function _createSuper(e){var n=_isNativeReflectConstruct();return function(){var r,t=_getPrototypeOf(e);return _possibleConstructorReturn(this,n?(r=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,r)):t.apply(this,arguments))}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _unsupportedIterableToArray(r,t){if(r){if("string"==typeof r)return _arrayLikeToArray(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(e="Object"===e&&r.constructor?r.constructor.name:e)||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(r,t):void 0}}function _arrayLikeToArray(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function isOperator(r){return-1<"+-*/%()".indexOf(r)}function getPrioraty(r){switch(r){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function prioraty(r,t){return getPrioraty(r)<=getPrioraty(t)}function isObj(r){return"[object Object]"===Object.prototype.toString.call(r)&&!Array.isArray(r)}function parseArgs(r){var t={expr:"",fmt:null,data:null},e="",n=r[0];if(1===r.length)"string"==typeof n?e=n:"number"==typeof n?e=n.toString():Array.isArray(n)&&(e=n[0]);else if(1<r.length){n=r[r.length-1];if(isObj(n))e=r[0],t.data=n;else for(var o=_toConsumableArray(r.shift());o.length||r.length;)var i=0===o.length?"":o.shift(),a=0===r.length?"":r.shift(),e=e+i+(a="number"==typeof a?a.toString():a)}var n=e.split("|");return 1===n.length?t.expr=n[0]:(t.expr=n[0],""!==(n=n[1]).trim()&&(t.fmt=n)),t}function format(r,t){var e="",n=(e=BigNumber.isBigNumber(r)?r.toFixed():"string"!=typeof r?r.toString():r,null),r=null,o=null,i=t.match(/(<=|>=|=)\s*(\d+)/);if(i&&(r=i[1],n=Number(i[2])),t.includes(",")&&(o=!0),null!==n){var i=e.split("."),t=i[0],a=1===i.length?"":i[1],l=a.length;switch(r){case"<=":a=l<=n?a:a.slice(0,n);break;case"=":l<n?a+="0".repeat(n-l):n<l&&(a=a.slice(0,n));break;case">=":a=n<=l?a:a+"0".repeat(n-l)}e=""===a?t:"".concat(t,".").concat(a)}return e=null!==o?1<(i=e.split(".")).length?((r=i[0]).includes("-")?i[0]=r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):i[0]=r.replace(/(?=(?!^)(?:\d{3})+$)/g,","),i.join(".")):(t=i[0]).includes("-")?t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t.replace(/(?=(?!^)(?:\d{3})+$)/g,","):e}function tokenizer(r){for(var t=[],e=0,n=null,o=r.length;e<o;)if(n=r[e],/\s/.test(n))e++;else if("+-".includes(n)){var i=t[t.length-1];if(0===t.length||"+-".includes(i)||"("===i){for(var a=n,n=r[++e];/[a-zA-Z\d._]/.test(n);)a+=n,n=r[++e];t.push(a)}else t.push(n),e++}else if("*/%()".includes(n))t.push(n),e++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++e>=o));)n=r[e];t.push(l)}else if(/\d/.test(n)){for(var u="";/[\d.]/.test(n)&&(u+=n,!(++e>=o));)n=r[e];t.push(u)}return t}var CalculatorError=function(){_inherits(n,_wrapNativeSuper(Error));var e=_createSuper(n);function n(r){var t;return _classCallCheck(this,n),(t=e.call(this,r)).name="CalculatorError",t.message=r,t}return _createClass(n)}(),TokensFillError$1=function(){_inherits(n,_wrapNativeSuper(Error));var e=_createSuper(n);function n(r){var t;return _classCallCheck(this,n),(t=e.call(this,r)).name="TokensFillError",t.message=r,t}return _createClass(n)}();function fillTokens(r,t){var e=t._fillData;return void 0===t._fillData&&(e=t),r.map(function(r){if(/^[a-zA-z_][\w_]*$/.test(r)){var t=e[r];if(void 0!==t)return"number"==typeof t?t.toString():t;throw new TokensFillError$1("错误的参数:".concat(r," 请确认他存在"))}return r})}function fmt(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var n=parseArgs(t),o=tokenizer(n.expr),i=null;if(2<o.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==o.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError)return i.fillError||i.error;throw r}if(null===n.fmt)throw"表达式没有格式化部分";return format(o[0],n.fmt)}var version="0.0.34";function token2postfix(r){for(var t=[],e=[],n=r;0<n.length;){var o=n.shift();if(isOperator(o))if("("===o)t.push(o);else if(")"===o){for(var i=t.pop();"("!==i&&0<t.length;)e.push(i),i=t.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,t[t.length-1])&&0<t.length;)e.push(t.pop());t.push(o)}else e.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)e.push(t.pop())}return e}function evalPostfix(r){for(var t=[];0<r.length;){var e=r.shift();if(isOperator(e)){if(t.length<2)throw new CalculatorError("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new CalculatorError("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof o&&!BigNumber.isBigNumber(o)){if(!/^[+-]*[\d.]+$/.test(o))throw new CalculatorError("".concat(o,"不是一个合法的数字"));o=new BigNumber(o)}switch(e){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n))}}else t.push(e)}if(1!==t.length)throw"unvalid expression";return t[0]}function calc(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var n=parseArgs(t),o=tokenizer(n.expr),i=null;if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError$1)return console.warn(r),i.fillError||i.error;throw r}var o=token2postfix(o),a=null;if(null!==i){if(void 0!==i.calcError||void 0!==i.error)try{a=evalPostfix(o)}catch(r){if(r instanceof CalculatorError)return console.warn(r),void 0!==i.calcError?i.calcError:i.error;throw r}}else a=evalPostfix(o);return a=null!==n.fmt?format(a,n.fmt):null!==a?a.toFixed():null}export{calc,fmt,version};
import BigNumber from"bignumber.js";function _classCallCheck(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function _createClass(r,t,e){return t&&_defineProperties(r.prototype,t),e&&_defineProperties(r,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function _inherits(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&_setPrototypeOf(r,t)}function _getPrototypeOf(r){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(r)}function _setPrototypeOf(r,t){return(_setPrototypeOf=Object.setPrototypeOf||function(r,t){return r.__proto__=t,r})(r,t)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(r){return!1}}function _construct(r,t,e){return(_construct=_isNativeReflectConstruct()?Reflect.construct:function(r,t,e){var n=[null];n.push.apply(n,t);t=new(Function.bind.apply(r,n));return e&&_setPrototypeOf(t,e.prototype),t}).apply(null,arguments)}function _isNativeFunction(r){return-1!==Function.toString.call(r).indexOf("[native code]")}function _wrapNativeSuper(r){var e="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(r){if(null===r||!_isNativeFunction(r))return r;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return _construct(r,arguments,_getPrototypeOf(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(t,r)})(r)}function _assertThisInitialized(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function _possibleConstructorReturn(r,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(r)}function _createSuper(e){var n=_isNativeReflectConstruct();return function(){var r,t=_getPrototypeOf(e);return _possibleConstructorReturn(this,n?(r=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,r)):t.apply(this,arguments))}}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _unsupportedIterableToArray(r,t){if(r){if("string"==typeof r)return _arrayLikeToArray(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Map"===(e="Object"===e&&r.constructor?r.constructor.name:e)||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(r,t):void 0}}function _arrayLikeToArray(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function isOperator(r){return-1<"+-*/%()".indexOf(r)}function getPrioraty(r){switch(r){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function prioraty(r,t){return getPrioraty(r)<=getPrioraty(t)}function isObj(r){return"[object Object]"===Object.prototype.toString.call(r)&&!Array.isArray(r)}function parseArgs(r){var t={expr:"",fmt:null,data:null},e="",n=r[0];if(1===r.length)"string"==typeof n?e=n:"number"==typeof n?e=n.toString():Array.isArray(n)&&(e=n[0]);else if(1<r.length){n=r[r.length-1];if(isObj(n))e=r[0],t.data=n;else for(var o=_toConsumableArray(r.shift());o.length||r.length;)var i=0===o.length?"":o.shift(),a=0===r.length?"":r.shift(),e=e+i+(a="number"==typeof a?a.toString():a)}var n=e.split("|");return 1===n.length?t.expr=n[0]:(t.expr=n[0],""!==(n=n[1]).trim()&&(t.fmt=n)),t}function format(r,t){var e="",n=(e=BigNumber.isBigNumber(r)?r.toFixed():"string"!=typeof r?r.toString():r,null),r=null,o=null,i=t.match(/(<=|>=|=)\s*(\d+)/);if(i&&(r=i[1],n=Number(i[2])),t.includes(",")&&(o=!0),null!==n){var i=e.split("."),t=i[0],a=1===i.length?"":i[1],l=a.length;switch(r){case"<=":a=l<=n?a:a.slice(0,n);break;case"=":l<n?a+="0".repeat(n-l):n<l&&(a=a.slice(0,n));break;case">=":a=n<=l?a:a+"0".repeat(n-l)}e=""===a?t:"".concat(t,".").concat(a)}return e=null!==o?1<(i=e.split(".")).length?((r=i[0]).includes("-")?i[0]=r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):i[0]=r.replace(/(?=(?!^)(?:\d{3})+$)/g,","),i.join(".")):(t=i[0]).includes("-")?t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t.replace(/(?=(?!^)(?:\d{3})+$)/g,","):e}function tokenizer(r){for(var t=[],e=0,n=null,o=r.length;e<o;)if(n=r[e],/\s/.test(n))e++;else if("+-".includes(n)){var i=t[t.length-1];if(0===t.length||"+-".includes(i)||"("===i){for(var a=n,n=r[++e];/[a-zA-Z\d._]/.test(n);)a+=n,n=r[++e];t.push(a)}else t.push(n),e++}else if("*/%()".includes(n))t.push(n),e++;else if(/[a-zA-Z_]/.test(n)){for(var l="";/[a-zA-Z0-9_]/.test(n)&&(l+=n,!(++e>=o));)n=r[e];t.push(l)}else if(/\d/.test(n)){for(var u="";/[\d.]/.test(n)&&(u+=n,!(++e>=o));)n=r[e];t.push(u)}return t}var CalculatorError=function(){_inherits(n,_wrapNativeSuper(Error));var e=_createSuper(n);function n(r){var t;return _classCallCheck(this,n),(t=e.call(this,r)).name="CalculatorError",t.message=r,t}return _createClass(n)}(),TokensFillError$1=function(){_inherits(n,_wrapNativeSuper(Error));var e=_createSuper(n);function n(r){var t;return _classCallCheck(this,n),(t=e.call(this,r)).name="TokensFillError",t.message=r,t}return _createClass(n)}();function fillTokens(r,t){var e=t._fillData;return void 0===t._fillData&&(e=t),r.map(function(r){if(/^[a-zA-z_][\w_]*$/.test(r)){var t=e[r];if(void 0!==t)return"number"==typeof t?t.toString():t;throw new TokensFillError$1("错误的参数:".concat(r," 请确认他存在"))}return r})}function fmt(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var n=parseArgs(t),o=tokenizer(n.expr),i=null;if(2<o.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==o.length)throw new Error("fmt接收了一个无法被解析的标识");if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError)return i.fillError||i.error;throw r}if(null===n.fmt)throw"表达式没有格式化部分";return format(o[0],n.fmt)}var version="0.0.35";function token2postfix(r){for(var t=[],e=[],n=r;0<n.length;){var o=n.shift();if(isOperator(o))if("("===o)t.push(o);else if(")"===o){for(var i=t.pop();"("!==i&&0<t.length;)e.push(i),i=t.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,t[t.length-1])&&0<t.length;)e.push(t.pop());t.push(o)}else e.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)e.push(t.pop())}return e}function evalPostfix(r){for(var t=[];0<r.length;){var e=r.shift();if(isOperator(e)){if(t.length<2)throw new CalculatorError("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!/^[+-]*[\d.]+$/.test(n))throw new CalculatorError("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof o&&!BigNumber.isBigNumber(o)){if(!/^[+-]*[\d.]+$/.test(o))throw new CalculatorError("".concat(o,"不是一个合法的数字"));o=new BigNumber(o)}switch(e){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n))}}else t.push(e)}if(1!==t.length)throw"unvalid expression";return t[0]}function calc(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];var n=parseArgs(t),o=tokenizer(n.expr),i=null;if(null!==n.data)if(null===(i=void 0!==n.data._fillData?n.data:i)||void 0===i.fillError&&void 0===i.error)o=fillTokens(o,n.data);else try{o=fillTokens(o,n.data)}catch(r){if(r instanceof TokensFillError$1)return void 0!==i.warn&&!0===i.warn&&console.warn(r),i.fillError||i.error;throw r}var o=token2postfix(o),a=null;if(null!==i){if(void 0!==i.calcError||void 0!==i.error)try{a=evalPostfix(o)}catch(r){if(r instanceof CalculatorError)return void 0!==i.warn&&!0===i.warn&&console.warn(r),void 0!==i.calcError?i.calcError:i.error;throw r}}else a=evalPostfix(o);return a=null!==n.fmt?format(a,n.fmt):null!==a?a.toFixed():null}export{calc,fmt,version};
{
"name": "a-calc",
"version": "0.0.35",
"version": "0.0.36",
"description": "JavaScript的字符串四则运算库, 支持格式化操作例如: 千分位格式化, 灵活指定小数点位数",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc