a-calc 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser/index.js +1 -1
- package/cjs/index.cjs +1 -1
- package/es/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ A convenient library for accurate calculation and formatting of numbers, which c
|
|
|
12
12
|
|
|
13
13
|
> Supported operators : + - * / % **
|
|
14
14
|
|
|
15
|
-
**Language:**
|
|
15
|
+
**Language:** English | [简体中文](https://github.com/Autumn-one/a-calc-old/blob/main/README_ZH.md)
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
package/browser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 _(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){var r;if(e)return"string"==typeof e?n(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):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 n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var O="1.2.1",N=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,A=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function S(e){return-1<"+-*/%()**".indexOf(e)}function x(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function f(e){return void 0!==e}function h(e){return null!==e}function c(e){return"string"==typeof e&&!!N.test(e)}var o={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",to_number:"to-number",scientific:"scientific"},j="<>=";function k(e){for(var t=o.initial,r=[],n=[];e;){var i=e[0];if(t===o.initial)if(/\s/.test(i))e=e.slice(1);else if(j.includes(i))t=o.symbol,r.push(i),e=e.slice(1);else if(","===i)t=o.initial,n.push({type:"comma",value:i}),e=e.slice(1);else if(/[a-zA-Z_]/.test(i))t=o.variable,r.push(i),e=e.slice(1);else if(/\d/.test(i))t=o.number,r.push(i),e=e.slice(1);else if("+"===i)t=o.initial,n.push({type:"plus",value:i}),e=e.slice(1);else if("~"===i)t=o.round,r.push(i),e=e.slice(1);else if("%"===i)t=o.initial,n.push({type:"percent",value:i}),e=e.slice(1);else if("/"===i)t=o.initial,n.push({type:"fraction",value:i}),e=e.slice(1);else{if("!"!==i)throw new Error("不识别的fmt字符:".concat(i));if(t=o.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else if(t===o.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.symbol)/\s/.test(i)?e=e.slice(1):j.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=o.initial);else{if(t!==o.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=o.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=o.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=Array.isArray,t="object"==C(t)&&t&&t.Object===Object&&t,i="object"==("undefined"==typeof self?"undefined":C(self))&&self&&self.Object===Object&&self,t=t||i||Function("return this")(),i=t.Symbol,s=Object.prototype,P=s.hasOwnProperty,$=s.toString,l=i?i.toStringTag:void 0;var T=Object.prototype.toString;var B=function(e){var t=P.call(e,l),r=e[l];try{var n=!(e[l]=void 0)}catch(e){}var i=$.call(e);return n&&(t?e[l]=r:delete e[l]),i},F=function(e){return T.call(e)},I=i?i.toStringTag:void 0;function R(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(I&&I in Object(e)?B:F)(e)}var J=R,K=function(e){return null!=e&&"object"==C(e)};function u(e){return"symbol"==C(e)||K(e)&&"[object Symbol]"==J(e)}var Q=r,ee=u,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,re=/^\w*$/;function ne(e,t){var r;return!Q(e)&&(!("number"!=(r=C(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ee(e))||re.test(e)||!te.test(e)||null!=t&&e in Object(t))}function ie(e){var t=C(e);return null!=e&&("object"==t||"function"==t)}var oe=R,se=ie;function le(e){return!!se(e)&&("[object Function]"==(e=oe(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var s=t["__core-js_shared__"],ue=(s=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var ce=Function.prototype.toString;var ae=le,fe=function(e){return!!ue&&ue in e},he=ie,pe=function(e){if(null!=e){try{return ce.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ge=/^\[object .+?Constructor\]$/,s=Function.prototype,a=Object.prototype,s=s.toString,a=a.hasOwnProperty,ve=RegExp("^"+s.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var de=function(e){return!(!he(e)||fe(e))&&(ae(e)?ve:ge).test(pe(e))},me=function(e,t){return null==e?void 0:e[t]};function we(e,t){return e=me(e,t),de(e)?e:void 0}var s=we(Object,"create"),ye=s;var be=s,_e=Object.prototype.hasOwnProperty;var Ee=s,Oe=Object.prototype.hasOwnProperty;var Ne=s;function Ae(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function Se(e){var t,r=this.__data__;return be?"__lodash_hash_undefined__"===(t=r[e])?void 0:t:_e.call(r,e)?r[e]:void 0}function xe(e){var t=this.__data__;return Ee?void 0!==t[e]:Oe.call(t,e)}function je(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this}function p(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}p.prototype.clear=function(){this.__data__=ye?ye(null):{},this.size=0},p.prototype.delete=Ae,p.prototype.get=Se,p.prototype.has=xe,p.prototype.set=je;a=p;var ke=function(e,t){return e===t||e!=e&&t!=t};function g(e,t){for(var r=e.length;r--;)if(ke(e[r][0],t))return r;return-1}var Pe=g,$e=Array.prototype.splice;var Te=g;var Be=g;var Fe=g;function Ie(e){var t=this.__data__;return!((e=Pe(t,e))<0||(e==t.length-1?t.pop():$e.call(t,e,1),--this.size,0))}function Re(e){var t=this.__data__;return(e=Te(t,e))<0?void 0:t[e][1]}function Ce(e){return-1<Be(this.__data__,e)}function ze(e,t){var r=this.__data__,n=Fe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function v(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}v.prototype.clear=function(){this.__data__=[],this.size=0},v.prototype.delete=Ie,v.prototype.get=Re,v.prototype.has=Ce,v.prototype.set=ze;var s=v,t=we(t,"Map"),De=a,Ue=s,Le=t;var Me=function(e){var t=C(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function d(e,t){return e=e.__data__,Me(t)?e["string"==typeof t?"string":"hash"]:e.map}var Ge=d;var qe=d;var He=d;var Ve=d;function We(e){return e=Ge(this,e).delete(e),this.size-=e?1:0,e}function Ze(e){return qe(this,e).get(e)}function Xe(e){return He(this,e).has(e)}function Ye(e,t){var r=Ve(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function m(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}m.prototype.clear=function(){this.size=0,this.__data__={hash:new De,map:new(Le||Ue),string:new De}},m.prototype.delete=We,m.prototype.get=Ze,m.prototype.has=Xe,m.prototype.set=Ye;var Je=m;function w(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError("Expected a function");function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(w.Cache||Je),o}w.Cache=Je;var Ke=w;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,a=function(e){var t=(e=Ke(e,function(e){return 500===t.size&&t.clear(),e})).cache;return e}(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(Qe,function(e,t,r,n){i.push(r?n.replace(et,"$1"):t||e)}),i});var tt=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},rt=r,nt=u,s=i?i.prototype:void 0,it=s?s.toString:void 0;var ot=function e(t){var r;return"string"==typeof t?t:rt(t)?tt(t,e)+"":nt(t)?it?it.call(t):"":"0"==(r=t+"")&&1/t==-1/0?"-0":r};var st=r,lt=ne,ut=a,ct=function(e){return null==e?"":ot(e)};var at=u;var ft=function(e,t){return st(e)?e:lt(e,t)?[e]:ut(ct(e))},ht=function(e){var t;return"string"==typeof e||at(e)?e:"0"==(t=e+"")&&1/e==-1/0?"-0":t};var pt=function(e,t){for(var r=0,n=(t=ft(t,e)).length;null!=e&&r<n;)e=e[ht(t[r++])];return r&&r==n?e:void 0};var y=function(e,t,r){return void 0===(e=null==e?void 0:pt(e,t))?r:e};var b={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},gt="+-",vt="*/%",dt="()";function mt(e,t){for(var r,n,i,o=1<arguments.length&&void 0!==t&&t,s=b.initial,l=[],u=[],c=function(){l.push(r),e=e.slice(1)},a=function(e){u.push({type:e,value:l.join("")}),l.length=0},f=function(){e=e.slice(1)};e;)switch(r=e[0],s){case b.initial:if(gt.includes(r)){var h=u.at(-1),s=0===u.length||"operator"===h.type||"("===h?b.number:b.operator;c()}else if(vt.includes(r))s=b.operator,c();else if(/\d/.test(r))s=b.number,c();else if(dt.includes(r))s=b.bracket;else if(/[a-zA-Z_$]/.test(r))s=b.var,c();else{if(!/\s/.test(r))throw new Error("不识别的字符".concat(r));f()}break;case b.bracket:u.push({type:b.bracket,value:r}),f(),s=b.initial;break;case b.operator:h=l.at(-1);"*"===r&&"*"===h&&c(),a(b.operator),s=b.initial;break;case b.number:if(/\d/.test(r))c();else if("."===r){if(0===l.length||l.includes("."))throw new Error("非法的小数部分".concat(l.join("")));c()}else"Ee".includes(r)?(s=b.scientific,c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(b.number),s=b.initial);break;case b.scientific:/\d/.test(r)?c():gt.includes(r)?(n=l.slice(1),i=l.at(-1),n.includes(r)||!/[Ee]/.test(i)?(a(b.scientific),s=b.initial):c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(b.scientific),s=b.initial);break;case b.var:/[\w_.\[\]"']/.test(r)?c():(a(b.var),s=b.initial);break;default:throw new Error("状态错误")}return 0!==l.length&&(u.push({type:s,value:l.join("")}),l.length=0,s=b.initial),u}function wt(e,t,r){if(null===t)throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var s=null,l=0;l<t.length;l++){var u=t[l],u=y(u,o.value);if(void 0!==u){s=u;break}}if(null===s)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof s){if(""===s.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!A.test(s))throw new Error("token填充失败,".concat(o.value,"值:").concat(s,"为非法单位数字"))}else if(!c(s))throw new Error("token填充失败,".concat(o,"值:").concat(s,"为非法数字"))}s="string"!=typeof s?s.toString():s,n.push({type:"number",value:s})}}return n}function yt(e){for(var t,r=[],n=[],i=e.map(function(e){return e.value});0<i.length;){var o=i.shift();if(S(o))if("("===o)r.push(o);else if(")"===o){for(var s=r.pop();"("!==s&&0<r.length;)n.push(s),s=r.pop();if("("!==s)throw"error: unmatched ()"}else{for(;t=r[r.length-1],x(o)<=x(t)&&0<r.length;)n.push(r.pop());r.push(o)}else n.push(o)}if(0<r.length){if(")"===r[r.length-1]||"("===r[r.length-1])throw"error: unmatched ()";for(;0<r.length;)n.push(r.pop())}return n}var bt=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,_t=Math.ceil,z=Math.floor,D="[BigNumber Error] ",Et=D+"Number primitive has more than 15 significant digits: ",U=1e14,L=14,Ot=9007199254740991,Nt=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],M=1e7,G=1e9;function q(e){var t=0|e;return 0<e||e===t?t:t-1}function H(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=L-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function V(e,t){var r,n,i=e.c,o=t.c,s=e.s,l=t.s,e=e.e,t=t.e;if(!s||!l)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-l:s;if(s!=l)return s;if(r=s<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(l=(e=i.length)<(t=o.length)?e:t,s=0;s<l;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return e==t?0:t<e^r?1:-1}function W(e,t,r,n){if(e<t||r<e||e!==z(e))throw Error(D+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Z(e){var t=e.c.length-1;return q(e.e/L)==t&&e.c[t]%2!=0}function X(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Y(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var E=function R(e){var d,f,h,t,c,m,s,l,u,a,p,r=j.prototype={constructor:j,toString:null,valueOf:null},g=new j(1),w=20,y=4,v=-7,b=21,_=-1e7,E=1e7,O=!1,i=1,N=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function j(e,t){var r,n,i,o,s,l,u,c,a=this;if(!(a instanceof j))return new j(e,t);if(null==t){if(e&&!0===e._isBigNumber)return a.s=e.s,void(!e.c||e.e>E?a.c=a.e=null:e.e<_?a.c=[a.e=0]:(a.e=e.e,a.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(a.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,s=e;10<=s;s/=10,o++);return void(E<o?a.c=a.e=null:(a.e=o,a.c=[e]))}c=String(e)}else{if(!bt.test(c=String(e)))return h(a,c,l);a.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(s=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=s),o+=+c.slice(s+1),c=c.substring(0,s)):o<0&&(o=c.length)}else{if(W(t,2,S.length,"Base"),10==t&&x)return F(a=new j(e),w+a.e+1,y);if(c=String(e),l="number"==typeof e){if(0*e!=0)return h(a,c,l,t);if(a.s=1/e<0?(c=c.slice(1),-1):1,j.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(Et+e)}else a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=S.slice(0,t),o=s=0,u=c.length;s<u;s++)if(r.indexOf(n=c.charAt(s))<0){if("."==n){if(o<s){o=u;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,s=-1,o=0;continue}return h(a,String(e),l,t)}l=!1,-1<(o=(c=f(c,t,10,a.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(s=0;48===c.charCodeAt(s);s++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(s,++u)){if(u-=s,l&&j.DEBUG&&15<u&&(Ot<e||e!==z(e)))throw Error(Et+a.s*e);if((o=o-s-1)>E)a.c=a.e=null;else if(o<_)a.c=[a.e=0];else{if(a.e=o,a.c=[],s=(o+1)%L,o<0&&(s+=L),s<u){for(s&&a.c.push(+c.slice(0,s)),u-=L;s<u;)a.c.push(+c.slice(s,s+=L));s=L-(c=c.slice(s)).length}else s-=u;for(;s--;c+="0");a.c.push(+c)}}else a.c=[a.e=0]}function k(e,t,r,n){for(var i,o,s=[0],l=0,u=e.length;l<u;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(l++)),i=0;i<s.length;i++)r-1<s[i]&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}function P(e,t,r){var n,i,o,s=0,l=e.length,u=t%M,c=t/M|0;for(e=e.slice();l--;)s=((i=u*(o=e[l]%M)+(n=c*o+(o=e[l]/M|0)*u)%M*M+s)/r|0)+(n/M|0)+c*o,e[l]=i%r;return e=s?[s].concat(e):e}function $(e,t,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function T(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,s,l;if(null==r?r=y:W(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)l=H(e.c),l=1==n||2==n&&(o<=v||b<=o)?X(l,o):Y(l,o,"0");else if(r=(e=F(new j(e),t,r)).e,s=(l=H(e.c)).length,1==n||2==n&&(t<=r||r<=v)){for(;s<t;l+="0",s++);l=X(l,r)}else if(t-=o,l=Y(l,r,"0"),s<r+1){if(0<--t)for(l+=".";t--;l+="0");}else if(0<(t+=r-s))for(r+1==s&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function o(e,t){for(var r,n=1,i=new j(e[0]);n<e.length;n++){if(!(r=new j(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function B(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*L-1)>E?e.c=e.e=null:r<_?e.c=[e.e=0]:(e.e=r,e.c=t),e}function F(e,t,r,n){var i,o,s,l,u,c,a,f=e.c,h=Nt;if(f){e:{for(i=1,l=f[0];10<=l;l/=10,i++);if((o=t-i)<0)o+=L,s=t,a=(u=f[c=0])/h[i-s-1]%10|0;else if((c=_t((o+1)/L))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));u=a=0,s=(o%=L)-L+(i=1)}else{for(u=l=f[c],i=1;10<=l;l/=10,i++);a=(s=(o%=L)-L+i)<0?0:u/h[i-s-1]%10|0}if(n=n||t<0||null!=f[c+1]||(s<0?u:u%h[i-s-1]),n=r<4?(a||n)&&(0==r||r==(e.s<0?3:2)):5<a||5==a&&(4==r||n||6==r&&(0<o?0<s?u/h[i-s]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(L-t%L)%L],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,l=1,c--):(f.length=c+1,l=h[L-o],f[c]=0<s?z(u/h[i-s]%h[s])*l:0),n)for(;;){if(0==c){for(o=1,s=f[0];10<=s;s/=10,o++);for(s=f[0]+=l,l=1;10<=s;s/=10,l++);o!=l&&(e.e++,f[0]==U)&&(f[0]=1);break}if(f[c]+=l,f[c]!=U)break;f[c--]=0,l=1}for(o=f.length;0===f[--o];f.pop());}e.e>E?e.c=e.e=null:e.e<_&&(e.c=[e.e=0])}return e}function I(e){var t,r=e.e;return null===r?e.toString():(t=H(e.c),t=r<=v||b<=r?X(t,r):Y(t,r,"0"),e.s<0?"-"+t:t)}return j.clone=R,j.ROUND_UP=0,j.ROUND_DOWN=1,j.ROUND_CEIL=2,j.ROUND_FLOOR=3,j.ROUND_HALF_UP=4,j.ROUND_HALF_DOWN=5,j.ROUND_HALF_EVEN=6,j.ROUND_HALF_CEIL=7,j.ROUND_HALF_FLOOR=8,j.EUCLID=9,j.config=j.set=function(e){var t,r;if(null!=e){if("object"!=C(e))throw Error(D+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(W(r=e[t],0,G,t),w=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(W(r=e[t],0,8,t),y=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(W(r[0],-G,0,t),W(r[1],0,G,t),v=r[0],b=r[1]):(W(r,-G,G,t),v=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)W(r[0],-G,-1,t),W(r[1],1,G,t),_=r[0],E=r[1];else{if(W(r,-G,G,t),!r)throw Error(D+t+" cannot be zero: "+r);_=-(E=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(D+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw O=!r,Error(D+"crypto unavailable");O=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(W(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(W(r=e[t],0,G,t),N=r),e.hasOwnProperty(t="FORMAT")){if("object"!=C(r=e[t]))throw Error(D+t+" not an object: "+r);A=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(D+t+" invalid: "+r);x="0123456789"==r.slice(0,10),S=r}}return{DECIMAL_PLACES:w,ROUNDING_MODE:y,EXPONENTIAL_AT:[v,b],RANGE:[_,E],CRYPTO:O,MODULO_MODE:i,POW_PRECISION:N,FORMAT:A,ALPHABET:S}},j.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!j.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-G<=i&&i<=G&&i===z(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%L)<1&&(t+=L),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||U<=r||r!==z(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(D+"Invalid BigNumber: "+e)},j.maximum=j.max=function(){return o(arguments,r.lt)},j.minimum=j.min=function(){return o(arguments,r.gt)},j.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return z(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,l=[],u=new j(g);if(null==e?e=w:W(e,0,G),i=_t(e/L),O)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)9e15<=(o=131072*t[s]+(t[s+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw O=!1,Error(D+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s<i;)9e15<=(o=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])?crypto.randomBytes(7).copy(t,s):(l.push(o%1e14),s+=7);s=i/7}if(!O)for(;s<i;)(o=c())<9e15&&(l[s++]=o%1e14);for(i=l[--s],e%=L,i&&e&&(l[s]=z(i/(o=Nt[L-e]))*o);0===l[s];l.pop(),s--);if(s<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=L);for(s=1,o=l[0];10<=o;o/=10,s++);s<L&&(n-=L-s)}return u.e=n,u.c=l,u}),j.sum=function(){for(var e=1,t=arguments,r=new j(t[0]);e<t.length;)r=r.plus(t[e++]);return r},m="0123456789",f=function(e,t,r,n,i){var o,s,l,u,c,a,f,h,p=e.indexOf("."),g=w,v=y;for(0<=p&&(u=N,N=0,e=e.replace(".",""),a=(h=new j(t)).pow(e.length-p),N=u,h.c=k(Y(H(a.c),a.e,"0"),10,r,m),h.e=h.c.length),l=u=(f=k(e,t,r,i?(o=S,m):(o=m,S))).length;0==f[--u];f.pop());if(!f[0])return o.charAt(0);if(p<0?--l:(a.c=f,a.e=l,a.s=n,f=(a=d(a,h,g,v,r)).c,c=a.r,l=a.e),p=f[s=l+g+1],u=r/2,c=c||s<0||null!=f[s+1],c=v<4?(null!=p||c)&&(0==v||v==(a.s<0?3:2)):u<p||p==u&&(4==v||c||6==v&&1&f[s-1]||v==(a.s<0?8:7)),s<1||!f[0])e=c?Y(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=s,c)for(--r;++f[--s]>r;)f[s]=0,s||(++l,f=[1].concat(f));for(u=f.length;!f[--u];);for(p=0,e="";p<=u;e+=o.charAt(f[p++]));e=Y(e,l,o.charAt(0))}return e},d=function(e,t,r,n,i){var o,s,l,u,c,a,f,h,p,g,v,d,m,w,y,b,_,E=e.s==t.s?1:-1,O=e.c,N=t.c;if(!(O&&O[0]&&N&&N[0]))return new j(e.s&&t.s&&(O?!N||O[0]!=N[0]:N)?O&&0==O[0]||!N?0*E:E/0:NaN);for(p=(h=new j(E)).c=[],E=r+(s=e.e-t.e)+1,i||(i=U,s=q(e.e/L)-q(t.e/L),E=E/L|0),l=0;N[l]==(O[l]||0);l++);if(N[l]>(O[l]||0)&&s--,E<0)p.push(1),u=!0;else{for(w=O.length,b=N.length,E+=2,1<(c=z(i/(N[l=0]+1)))&&(N=P(N,c,i),O=P(O,c,i),b=N.length,w=O.length),m=b,v=(g=O.slice(0,b)).length;v<b;g[v++]=0);_=N.slice(),_=[0].concat(_),y=N[0],N[1]>=i/2&&y++;do{if(c=0,(o=$(N,g,b,v))<0){if(d=g[0],b!=v&&(d=d*i+(g[1]||0)),1<(c=z(d/y)))for(f=(a=P(N,c=i<=c?i-1:c,i)).length,v=g.length;1==$(a,g,f,v);)c--,T(a,b<f?_:N,f,i),f=a.length,o=1;else 0==c&&(o=c=1),f=(a=N.slice()).length;if(T(g,a=f<v?[0].concat(a):a,v,i),v=g.length,-1==o)for(;$(N,g,b,v)<1;)c++,T(g,b<v?_:N,v,i),v=g.length}else 0===o&&(c++,g=[0])}while(p[l++]=c,g[0]?g[v++]=O[m]||0:(g=[O[m]],v=1),(m++<w||null!=g[0])&&E--);u=null!=g[0],p[0]||p.splice(0,1)}if(i==U){for(l=1,E=p[0];10<=E;E/=10,l++);F(h,r+(h.e=l+s*L-1)+1,n,u)}else h.e=s,h.r=+u;return h},s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,u=/^\.([^.]+)$/,a=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(a.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(s,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(l,"$1").replace(u,"0.$1")),t!=o))return new j(o,i);if(j.DEBUG)throw Error(D+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new j(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return V(this,new j(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return W(e,0,G),null==t?t=y:W(t,0,8),F(new j(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-q(this.e/L))*L,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return d(this,new j(e,t),w,y)},r.dividedToIntegerBy=r.idiv=function(e,t){return d(this,new j(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,s,l,u,c,a=this;if((e=new j(e)).c&&!e.isInteger())throw Error(D+"Exponent not an integer: "+I(e));if(null!=t&&(t=new j(t)),s=14<e.e,!a.c||!a.c[0]||1==a.c[0]&&!a.e&&1==a.c.length||!e.c||!e.c[0])return c=new j(Math.pow(+I(a),s?e.s*(2-Z(e)):+I(e))),t?c.mod(t):c;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new j(NaN);(n=!l&&a.isInteger()&&t.isInteger())&&(a=a.mod(t))}else{if(9<e.e&&(0<a.e||a.e<-1||(0==a.e?1<a.c[0]||s&&24e7<=a.c[1]:a.c[0]<8e13||s&&a.c[0]<=9999975e7)))return o=a.s<0&&Z(e)?-0:0,-1<a.e&&(o=1/o),new j(l?1/o:o);N&&(o=_t(N/L+2))}for(u=s?(r=new j(.5),l&&(e.s=1),Z(e)):(i=Math.abs(+I(e)))%2,c=new j(g);;){if(u){if(!(c=c.times(a)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=z(i/2)))break;u=i%2}else if(F(e=e.times(r),e.e+1,1),14<e.e)u=Z(e);else{if(0==(i=+I(e)))break;u=i%2}a=a.times(a),o?a.c&&a.c.length>o&&(a.c.length=o):n&&(a=a.mod(t))}return n?c:(l&&(c=g.div(c)),t?c.mod(t):o?F(c,N,y,void 0):c)},r.integerValue=function(e){var t=new j(this);return null==e?e=y:W(e,0,8),F(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===V(this,new j(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<V(this,new j(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=V(this,new j(e,t)))||0===t},r.isInteger=function(){return!!this.c&&q(this.e/L)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return V(this,new j(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=V(this,new j(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,s=this,l=s.s;if(t=(e=new j(e,t)).s,!l||!t)return new j(NaN);if(l!=t)return e.s=-t,s.plus(e);var u=s.e/L,c=e.e/L,a=s.c,f=e.c;if(!u||!c){if(!a||!f)return a?(e.s=-t,e):new j(f?s:NaN);if(!a[0]||!f[0])return f[0]?(e.s=-t,e):new j(a[0]?s:3==y?-0:0)}if(u=q(u),c=q(c),a=a.slice(),l=u-c){for((i=(o=l<0)?(l=-l,a):(c=u,f)).reverse(),t=l;t--;i.push(0));i.reverse()}else for(n=(o=(l=a.length)<(t=f.length))?l:t,l=t=0;t<n;t++)if(a[t]!=f[t]){o=a[t]<f[t];break}if(o&&(i=a,a=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=a.length)))for(;t--;a[r++]=0);for(t=U-1;l<n;){if(a[--n]<f[n]){for(r=n;r&&!a[--r];a[r]=t);--a[r],a[n]+=U}a[n]-=f[n]}for(;0==a[0];a.splice(0,1),--c);return a[0]?B(e,a,c):(e.s=3==y?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new j(e,t),!n.c||!e.s||e.c&&!e.c[0]?new j(NaN):!e.c||n.c&&!n.c[0]?new j(n):(9==i?(t=e.s,e.s=1,r=d(n,e,0,3),e.s=t,r.s*=t):r=d(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,s,l,u,c,a,f,h,p=this,g=p.c,v=(e=new j(e,t)).c;if(!(g&&v&&g[0]&&v[0]))return!p.s||!e.s||g&&!g[0]&&!v||v&&!v[0]&&!g?e.c=e.e=e.s=null:(e.s*=p.s,g&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=q(p.e/L)+q(e.e/L),e.s*=p.s,(l=g.length)<(p=v.length)&&(h=g,g=v,v=h,n=l,l=p,p=n),n=l+p,h=[];n--;h.push(0));for(n=p;0<=--n;){for(a=v[n]%1e7,f=v[n]/1e7|(r=0),i=n+(o=l);n<i;)r=((u=a*(u=g[--o]%1e7)+(s=f*u+(c=g[o]/1e7|0)*a)%1e7*1e7+h[i]+r)/1e14|0)+(s/1e7|0)+f*c,h[i--]=u%1e14;h[i]=r}return r?++t:h.splice(0,1),B(e,h,t)},r.negated=function(){var e=new j(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new j(e,t)).s,!i||!t)return new j(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/L,s=e.e/L,l=n.c,u=e.c;if(!o||!s){if(!l||!u)return new j(i/0);if(!l[0]||!u[0])return u[0]?e:new j(l[0]?n:0*i)}if(o=q(o),s=q(s),l=l.slice(),i=o-s){for((r=0<i?(s=o,u):(i=-i,l)).reverse();i--;r.push(0));r.reverse()}for((i=l.length)-(t=u.length)<0&&(r=u,u=l,l=r,t=i),i=0;t;)i=(l[--t]=l[t]+u[t]+i)/U|0,l[t]=U===l[t]?0:l[t]%U;return i&&(l=[i].concat(l),++s),B(e,l,s)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return W(e,1,G),null==t?t=y:W(t,0,8),F(new j(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*L+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return W(e,-Ot,Ot),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,s=o.c,l=o.s,u=o.e,c=w+4,a=new j("0.5");if(1!==l||!s||!s[0])return new j(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);if((r=0==(l=Math.sqrt(+I(o)))||l==1/0?(((t=H(s)).length+u)%2==0&&(t+="0"),l=Math.sqrt(+t),u=q((u+1)/2)-(u<0||u%2),new j(t=l==1/0?"5e"+u:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+u)):new j(l+"")).c[0])for((l=(u=r.e)+c)<3&&(l=0);;)if(i=r,r=a.times(i.plus(d(o,i,c,1))),H(i.c).slice(0,l)===(t=H(r.c)).slice(0,l)){if(r.e<u&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(F(r,r.e+w+2,1),e=!r.times(r).eq(o));break}if(!n&&(F(i,i.e+w+2,0),i.times(i).eq(o))){r=i;break}c+=4,l+=4,n=1}return F(r,r.e+w+1,y,e)},r.toExponential=function(e,t){return null!=e&&(W(e,0,G),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(W(e,0,G),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==C(t)?(r=t,t=null):e&&"object"==C(e)?(r=e,e=t=null):r=A;else if("object"!=C(r))throw Error(D+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,s=r.groupSeparator||"",l=t[0],t=t[1],u=this.s<0,c=u?l.slice(1):l,a=c.length;if(o&&(n=i,i=o,a-=o=n),0<i&&0<a){for(l=c.substr(0,n=a%i||i);n<a;n+=i)l+=s+c.substr(n,i);0<o&&(l+=s+c.slice(n)),u&&(l="-"+l)}e=t?l+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):l}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,s,l,u,c,a,f=this,h=f.c;if(null!=e&&(!(l=new j(e)).isInteger()&&(l.c||1!==l.s)||l.lt(g)))throw Error(D+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+I(l));if(!h)return new j(f);for(t=new j(g),c=r=new j(g),n=u=new j(g),h=H(h),o=t.e=h.length-f.e-1,t.c[0]=Nt[(s=o%L)<0?L+s:s],e=!e||0<l.comparedTo(t)?0<o?t:c:l,s=E,E=1/0,l=new j(h),u.c[0]=0;a=d(l,t,0,1),1!=(i=r.plus(a.times(n))).comparedTo(e);)r=n,n=i,c=u.plus(a.times(i=c)),u=i,t=l.minus(a.times(i=t)),l=i;return i=d(e.minus(r),n,0,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=f.s,h=d(c,n,o*=2,y).minus(f).abs().comparedTo(d(u,r,o,y).minus(f).abs())<1?[c,n]:[u,r],E=s,h},r.toNumber=function(){return+I(this)},r.toPrecision=function(e,t){return null!=e&&W(e,1,G),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=v||b<=i?X(H(r.c),i):Y(H(r.c),i,"0"):10===e&&x?Y(H((r=F(new j(r),w+i+1,y)).c),r.e,"0"):(W(e,2,S.length,"Base"),f(Y(H(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return I(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&j.set(e),j}();function At(e){for(var t=[];0<e.length;){var r=e.shift();if(S(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!E.isBigNumber(n)){if(!c(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new E(n)}if("string"==typeof i&&!E.isBigNumber(i)){if(!c(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new E(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=E.isBigNumber(o)?o:E(o)).isNaN())throw new Error("计算结果为NaN");return o}function St(e,t,r){var n,i,o,s,l,u,c,a,f,h,p,g,v,d,m,w,y,b,_="";return E.isBigNumber(e)?_=e.toFixed():"string"!=typeof e&&(_=e.toString()),"undefined"===_||"NaN"===_?null:(i=n=null,s=o=!1,w=a=c=u=!(l="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)w=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)s=!0;else if("round"===t)l=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)u=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");a=!0}}),u?(e=E(_).toExponential(),s&&!e.startsWith("-")?"+"+e:e):c?(t=E(_).toFraction().map(function(e){return e.toFixed()}).join("/"),s&&!t.startsWith("-")?"+"+t:t):(a&&(_=E(_).times(100).toFixed()),n&&(e=_.split("."),t=e[0],e=1===e.length?"":e[1],p=i,g=+n,y=l,v=f=t,m=(d=h=e).length,b={"~-":function(){d=h.slice(0,"<"===p?g-1:g)},"~+":function(){var e,t="<"===p?g-1:g;m<=t||0===m||(e=h.slice(0,t),0!=+h.slice(t,m)&&(e=(+e+1).toString()).length>t?(d=e.slice(1,e.length),v=(+v+1).toString()):d=e)},"~5":function(){var e,t;0===m||(d=h.slice(0,e="<"===p?g-1:g),t=+h[e],Number.isNaN(t))||5<=t&&(d=(+d+1).toString()).length>e&&(d=d.slice(1,d.length),v=(+v+1).toString())},"~6":function(){var e,t,r,n;0!==m&&(t=+h[e="<"===p?g-1:g],r=""===(r=h.slice(+e+1,h.length))?0:parseInt(r),n=0===e?+f[f.length-1]:+h[e-1],d=h.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(d=(+d+1).toString()).length>e&&(d=d.slice(1,d.length),v=(+v+1).toString())}},"<="===p?d=m<=g?h:(b[y]&&b[y](),d.replace(/0+$/,"")):"<"===p?d=m<g?h:(b[y]&&b[y](),d.replace(/0+$/,"")):"="===p?m<g?d=h+"0".repeat(g-m):g<m&&b[y]&&b[y]():">="===p?m<g&&(d=h+"0".repeat(g-m)):">"===p&&m<=g&&(d=h+"0".repeat(g-m+1)),t=(b={int_part:v,dec_part:d}).int_part,_=""===(e=b.dec_part)?t:"".concat(t,".").concat(e)),o&&(w=!1,_=1<(y=_.split(".")).length?((b=y[0]).includes("-")?y[0]=b[0]+b.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):y[0]=b.replace(/(?=(?!^)(?:\d{3})+$)/g,","),y.join(".")):(t=y[0]).includes("-")?t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),s&&(w=!1,_.startsWith("-")||(_="+"+_)),a&&(w=!1,_+="%"),w&&!r?+_:_))}function xt(e,i){return e.map(function(e){if("var"!==e.type)return e;for(var t,r,n=0;n<i.length&&!f(t=y(i[n],e.value));n++);if("number"==typeof(r=t)||c(r))return{type:"number",value:t};throw new Error("错误的填充值")})}function jt(e){var r=null;return e.length,{tokens:e.map(function(e){var t=function(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],s=0;s<o.length;s++){var l=e.match(o[s]);if(l){t=l;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}function kt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=(f(i=e[1])&&(t.options=i),y(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(C(n)))}r=n.toString()}if(e=r.split("|"),t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=k(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=k(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}(t),i=y(n,"options._error",void 0),o=y(n,"options._debug",!1),s=y(n,"options._unit",!1),l=n.options,u=null;if(n.fmt_err||n.expr_err){if(f(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(f(i))try{c=mt(n.expr,s)}catch(e){return i}else c=mt(n.expr,s);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),h(l)){var c,a=[];if(Array.isArray(l)?a=l:(a.push(l),f(l=y(l,"_fill_data",{}))&&(Array.isArray(l)?a=[].concat(_(a),_(l)):a.push(l))),f(i))try{c=wt(c,a,s),h(n.fmt)&&(n.fmt=xt(n.fmt,a))}catch(e){return i}else c=wt(c,a,s),h(n.fmt)&&(n.fmt=xt(n.fmt,a));[!0,"on","auto","space"].includes(s)&&(u=(l=jt(c)).unit,c=l.tokens)}a=yt(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(a),console.warn("单位:".concat(u))),l=null;if(f(i))try{l=At(a)}catch(e){return i}else l=At(a);if("Infinity"!==(l=h(n.fmt)?St(l,n.fmt,s):null!==l?l.toFixed():null)&&null!==l)return null!==u&&(l+=u),l;if(f(i))return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(O," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");t=kt;return e.calc=kt,e.fmt=t,e.version=O,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
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 _(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){var r;if(e)return"string"==typeof e?n(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):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 n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var O="1.2.2",N=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,A=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function S(e){return-1<"+-*/%()**".indexOf(e)}function x(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function f(e){return void 0!==e}function h(e){return null!==e}function c(e){return"string"==typeof e&&!!N.test(e)}var o={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",to_number:"to-number",scientific:"scientific"},j="<>=";function k(e){for(var t=o.initial,r=[],n=[];e;){var i=e[0];if(t===o.initial)if(/\s/.test(i))e=e.slice(1);else if(j.includes(i))t=o.symbol,r.push(i),e=e.slice(1);else if(","===i)t=o.initial,n.push({type:"comma",value:i}),e=e.slice(1);else if(/[a-zA-Z_]/.test(i))t=o.variable,r.push(i),e=e.slice(1);else if(/\d/.test(i))t=o.number,r.push(i),e=e.slice(1);else if("+"===i)t=o.initial,n.push({type:"plus",value:i}),e=e.slice(1);else if("~"===i)t=o.round,r.push(i),e=e.slice(1);else if("%"===i)t=o.initial,n.push({type:"percent",value:i}),e=e.slice(1);else if("/"===i)t=o.initial,n.push({type:"fraction",value:i}),e=e.slice(1);else{if("!"!==i)throw new Error("不识别的fmt字符:".concat(i));if(t=o.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else if(t===o.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.symbol)/\s/.test(i)?e=e.slice(1):j.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=o.initial);else{if(t!==o.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=o.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=o.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=Array.isArray,t="object"==C(t)&&t&&t.Object===Object&&t,i="object"==("undefined"==typeof self?"undefined":C(self))&&self&&self.Object===Object&&self,t=t||i||Function("return this")(),i=t.Symbol,s=Object.prototype,P=s.hasOwnProperty,$=s.toString,l=i?i.toStringTag:void 0;var T=Object.prototype.toString;var B=function(e){var t=P.call(e,l),r=e[l];try{var n=!(e[l]=void 0)}catch(e){}var i=$.call(e);return n&&(t?e[l]=r:delete e[l]),i},F=function(e){return T.call(e)},I=i?i.toStringTag:void 0;function R(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(I&&I in Object(e)?B:F)(e)}var J=R,K=function(e){return null!=e&&"object"==C(e)};function u(e){return"symbol"==C(e)||K(e)&&"[object Symbol]"==J(e)}var Q=r,ee=u,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,re=/^\w*$/;function ne(e,t){var r;return!Q(e)&&(!("number"!=(r=C(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ee(e))||re.test(e)||!te.test(e)||null!=t&&e in Object(t))}function ie(e){var t=C(e);return null!=e&&("object"==t||"function"==t)}var oe=R,se=ie;function le(e){return!!se(e)&&("[object Function]"==(e=oe(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var s=t["__core-js_shared__"],ue=(s=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var ce=Function.prototype.toString;var ae=le,fe=function(e){return!!ue&&ue in e},he=ie,pe=function(e){if(null!=e){try{return ce.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ge=/^\[object .+?Constructor\]$/,s=Function.prototype,a=Object.prototype,s=s.toString,a=a.hasOwnProperty,ve=RegExp("^"+s.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var de=function(e){return!(!he(e)||fe(e))&&(ae(e)?ve:ge).test(pe(e))},me=function(e,t){return null==e?void 0:e[t]};function we(e,t){return e=me(e,t),de(e)?e:void 0}var s=we(Object,"create"),ye=s;var be=s,_e=Object.prototype.hasOwnProperty;var Ee=s,Oe=Object.prototype.hasOwnProperty;var Ne=s;function Ae(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function Se(e){var t,r=this.__data__;return be?"__lodash_hash_undefined__"===(t=r[e])?void 0:t:_e.call(r,e)?r[e]:void 0}function xe(e){var t=this.__data__;return Ee?void 0!==t[e]:Oe.call(t,e)}function je(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this}function p(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}p.prototype.clear=function(){this.__data__=ye?ye(null):{},this.size=0},p.prototype.delete=Ae,p.prototype.get=Se,p.prototype.has=xe,p.prototype.set=je;a=p;var ke=function(e,t){return e===t||e!=e&&t!=t};function g(e,t){for(var r=e.length;r--;)if(ke(e[r][0],t))return r;return-1}var Pe=g,$e=Array.prototype.splice;var Te=g;var Be=g;var Fe=g;function Ie(e){var t=this.__data__;return!((e=Pe(t,e))<0||(e==t.length-1?t.pop():$e.call(t,e,1),--this.size,0))}function Re(e){var t=this.__data__;return(e=Te(t,e))<0?void 0:t[e][1]}function Ce(e){return-1<Be(this.__data__,e)}function ze(e,t){var r=this.__data__,n=Fe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function v(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}v.prototype.clear=function(){this.__data__=[],this.size=0},v.prototype.delete=Ie,v.prototype.get=Re,v.prototype.has=Ce,v.prototype.set=ze;var s=v,t=we(t,"Map"),De=a,Ue=s,Le=t;var Me=function(e){var t=C(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function d(e,t){return e=e.__data__,Me(t)?e["string"==typeof t?"string":"hash"]:e.map}var Ge=d;var qe=d;var He=d;var Ve=d;function We(e){return e=Ge(this,e).delete(e),this.size-=e?1:0,e}function Ze(e){return qe(this,e).get(e)}function Xe(e){return He(this,e).has(e)}function Ye(e,t){var r=Ve(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function m(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}m.prototype.clear=function(){this.size=0,this.__data__={hash:new De,map:new(Le||Ue),string:new De}},m.prototype.delete=We,m.prototype.get=Ze,m.prototype.has=Xe,m.prototype.set=Ye;var Je=m;function w(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError("Expected a function");function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(w.Cache||Je),o}w.Cache=Je;var Ke=w;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,a=function(e){var t=(e=Ke(e,function(e){return 500===t.size&&t.clear(),e})).cache;return e}(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(Qe,function(e,t,r,n){i.push(r?n.replace(et,"$1"):t||e)}),i});var tt=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},rt=r,nt=u,s=i?i.prototype:void 0,it=s?s.toString:void 0;var ot=function e(t){var r;return"string"==typeof t?t:rt(t)?tt(t,e)+"":nt(t)?it?it.call(t):"":"0"==(r=t+"")&&1/t==-1/0?"-0":r};var st=r,lt=ne,ut=a,ct=function(e){return null==e?"":ot(e)};var at=u;var ft=function(e,t){return st(e)?e:lt(e,t)?[e]:ut(ct(e))},ht=function(e){var t;return"string"==typeof e||at(e)?e:"0"==(t=e+"")&&1/e==-1/0?"-0":t};var pt=function(e,t){for(var r=0,n=(t=ft(t,e)).length;null!=e&&r<n;)e=e[ht(t[r++])];return r&&r==n?e:void 0};var y=function(e,t,r){return void 0===(e=null==e?void 0:pt(e,t))?r:e};var b={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},gt="+-",vt="*/%",dt="()";function mt(e,t){for(var r,n,i,o=1<arguments.length&&void 0!==t&&t,s=b.initial,l=[],u=[],c=function(){l.push(r),e=e.slice(1)},a=function(e){u.push({type:e,value:l.join("")}),l.length=0},f=function(){e=e.slice(1)};e;)switch(r=e[0],s){case b.initial:if(gt.includes(r)){var h=u.at(-1),s=0===u.length||"operator"===h.type||"("===h?b.number:b.operator;c()}else if(vt.includes(r))s=b.operator,c();else if(/\d/.test(r))s=b.number,c();else if(dt.includes(r))s=b.bracket;else if(/[a-zA-Z_$]/.test(r))s=b.var,c();else{if(!/\s/.test(r))throw new Error("不识别的字符".concat(r));f()}break;case b.bracket:u.push({type:b.bracket,value:r}),f(),s=b.initial;break;case b.operator:h=l.at(-1);"*"===r&&"*"===h&&c(),a(b.operator),s=b.initial;break;case b.number:if(/\d/.test(r))c();else if("."===r){if(0===l.length||l.includes("."))throw new Error("非法的小数部分".concat(l.join("")));c()}else"Ee".includes(r)?(s=b.scientific,c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(b.number),s=b.initial);break;case b.scientific:/\d/.test(r)?c():gt.includes(r)?(n=l.slice(1),i=l.at(-1),n.includes(r)||!/[Ee]/.test(i)?(a(b.scientific),s=b.initial):c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(b.scientific),s=b.initial);break;case b.var:/[\w_.\[\]"']/.test(r)?c():(a(b.var),s=b.initial);break;default:throw new Error("状态错误")}return 0!==l.length&&(u.push({type:s,value:l.join("")}),l.length=0,s=b.initial),u}function wt(e,t,r){if(null===t)throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var s=null,l=0;l<t.length;l++){var u=t[l],u=y(u,o.value);if(void 0!==u){s=u;break}}if(null===s)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof s){if(""===s.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!A.test(s))throw new Error("token填充失败,".concat(o.value,"值:").concat(s,"为非法单位数字"))}else if(!c(s))throw new Error("token填充失败,".concat(o,"值:").concat(s,"为非法数字"))}s="string"!=typeof s?s.toString():s,n.push({type:"number",value:s})}}return n}function yt(e){for(var t,r=[],n=[],i=e.map(function(e){return e.value});0<i.length;){var o=i.shift();if(S(o))if("("===o)r.push(o);else if(")"===o){for(var s=r.pop();"("!==s&&0<r.length;)n.push(s),s=r.pop();if("("!==s)throw"error: unmatched ()"}else{for(;t=r[r.length-1],x(o)<=x(t)&&0<r.length;)n.push(r.pop());r.push(o)}else n.push(o)}if(0<r.length){if(")"===r[r.length-1]||"("===r[r.length-1])throw"error: unmatched ()";for(;0<r.length;)n.push(r.pop())}return n}var bt=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,_t=Math.ceil,z=Math.floor,D="[BigNumber Error] ",Et=D+"Number primitive has more than 15 significant digits: ",U=1e14,L=14,Ot=9007199254740991,Nt=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],M=1e7,G=1e9;function q(e){var t=0|e;return 0<e||e===t?t:t-1}function H(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=L-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function V(e,t){var r,n,i=e.c,o=t.c,s=e.s,l=t.s,e=e.e,t=t.e;if(!s||!l)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-l:s;if(s!=l)return s;if(r=s<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(l=(e=i.length)<(t=o.length)?e:t,s=0;s<l;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return e==t?0:t<e^r?1:-1}function W(e,t,r,n){if(e<t||r<e||e!==z(e))throw Error(D+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Z(e){var t=e.c.length-1;return q(e.e/L)==t&&e.c[t]%2!=0}function X(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Y(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var E=function R(e){var d,f,h,t,c,m,s,l,u,a,p,r=j.prototype={constructor:j,toString:null,valueOf:null},g=new j(1),w=20,y=4,v=-7,b=21,_=-1e7,E=1e7,O=!1,i=1,N=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function j(e,t){var r,n,i,o,s,l,u,c,a=this;if(!(a instanceof j))return new j(e,t);if(null==t){if(e&&!0===e._isBigNumber)return a.s=e.s,void(!e.c||e.e>E?a.c=a.e=null:e.e<_?a.c=[a.e=0]:(a.e=e.e,a.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(a.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,s=e;10<=s;s/=10,o++);return void(E<o?a.c=a.e=null:(a.e=o,a.c=[e]))}c=String(e)}else{if(!bt.test(c=String(e)))return h(a,c,l);a.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(s=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=s),o+=+c.slice(s+1),c=c.substring(0,s)):o<0&&(o=c.length)}else{if(W(t,2,S.length,"Base"),10==t&&x)return F(a=new j(e),w+a.e+1,y);if(c=String(e),l="number"==typeof e){if(0*e!=0)return h(a,c,l,t);if(a.s=1/e<0?(c=c.slice(1),-1):1,j.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(Et+e)}else a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=S.slice(0,t),o=s=0,u=c.length;s<u;s++)if(r.indexOf(n=c.charAt(s))<0){if("."==n){if(o<s){o=u;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,s=-1,o=0;continue}return h(a,String(e),l,t)}l=!1,-1<(o=(c=f(c,t,10,a.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(s=0;48===c.charCodeAt(s);s++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(s,++u)){if(u-=s,l&&j.DEBUG&&15<u&&(Ot<e||e!==z(e)))throw Error(Et+a.s*e);if((o=o-s-1)>E)a.c=a.e=null;else if(o<_)a.c=[a.e=0];else{if(a.e=o,a.c=[],s=(o+1)%L,o<0&&(s+=L),s<u){for(s&&a.c.push(+c.slice(0,s)),u-=L;s<u;)a.c.push(+c.slice(s,s+=L));s=L-(c=c.slice(s)).length}else s-=u;for(;s--;c+="0");a.c.push(+c)}}else a.c=[a.e=0]}function k(e,t,r,n){for(var i,o,s=[0],l=0,u=e.length;l<u;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(l++)),i=0;i<s.length;i++)r-1<s[i]&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}function P(e,t,r){var n,i,o,s=0,l=e.length,u=t%M,c=t/M|0;for(e=e.slice();l--;)s=((i=u*(o=e[l]%M)+(n=c*o+(o=e[l]/M|0)*u)%M*M+s)/r|0)+(n/M|0)+c*o,e[l]=i%r;return e=s?[s].concat(e):e}function $(e,t,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function T(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,s,l;if(null==r?r=y:W(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)l=H(e.c),l=1==n||2==n&&(o<=v||b<=o)?X(l,o):Y(l,o,"0");else if(r=(e=F(new j(e),t,r)).e,s=(l=H(e.c)).length,1==n||2==n&&(t<=r||r<=v)){for(;s<t;l+="0",s++);l=X(l,r)}else if(t-=o,l=Y(l,r,"0"),s<r+1){if(0<--t)for(l+=".";t--;l+="0");}else if(0<(t+=r-s))for(r+1==s&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function o(e,t){for(var r,n=1,i=new j(e[0]);n<e.length;n++){if(!(r=new j(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function B(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*L-1)>E?e.c=e.e=null:r<_?e.c=[e.e=0]:(e.e=r,e.c=t),e}function F(e,t,r,n){var i,o,s,l,u,c,a,f=e.c,h=Nt;if(f){e:{for(i=1,l=f[0];10<=l;l/=10,i++);if((o=t-i)<0)o+=L,s=t,a=(u=f[c=0])/h[i-s-1]%10|0;else if((c=_t((o+1)/L))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));u=a=0,s=(o%=L)-L+(i=1)}else{for(u=l=f[c],i=1;10<=l;l/=10,i++);a=(s=(o%=L)-L+i)<0?0:u/h[i-s-1]%10|0}if(n=n||t<0||null!=f[c+1]||(s<0?u:u%h[i-s-1]),n=r<4?(a||n)&&(0==r||r==(e.s<0?3:2)):5<a||5==a&&(4==r||n||6==r&&(0<o?0<s?u/h[i-s]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(L-t%L)%L],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,l=1,c--):(f.length=c+1,l=h[L-o],f[c]=0<s?z(u/h[i-s]%h[s])*l:0),n)for(;;){if(0==c){for(o=1,s=f[0];10<=s;s/=10,o++);for(s=f[0]+=l,l=1;10<=s;s/=10,l++);o!=l&&(e.e++,f[0]==U)&&(f[0]=1);break}if(f[c]+=l,f[c]!=U)break;f[c--]=0,l=1}for(o=f.length;0===f[--o];f.pop());}e.e>E?e.c=e.e=null:e.e<_&&(e.c=[e.e=0])}return e}function I(e){var t,r=e.e;return null===r?e.toString():(t=H(e.c),t=r<=v||b<=r?X(t,r):Y(t,r,"0"),e.s<0?"-"+t:t)}return j.clone=R,j.ROUND_UP=0,j.ROUND_DOWN=1,j.ROUND_CEIL=2,j.ROUND_FLOOR=3,j.ROUND_HALF_UP=4,j.ROUND_HALF_DOWN=5,j.ROUND_HALF_EVEN=6,j.ROUND_HALF_CEIL=7,j.ROUND_HALF_FLOOR=8,j.EUCLID=9,j.config=j.set=function(e){var t,r;if(null!=e){if("object"!=C(e))throw Error(D+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(W(r=e[t],0,G,t),w=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(W(r=e[t],0,8,t),y=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(W(r[0],-G,0,t),W(r[1],0,G,t),v=r[0],b=r[1]):(W(r,-G,G,t),v=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)W(r[0],-G,-1,t),W(r[1],1,G,t),_=r[0],E=r[1];else{if(W(r,-G,G,t),!r)throw Error(D+t+" cannot be zero: "+r);_=-(E=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(D+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw O=!r,Error(D+"crypto unavailable");O=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(W(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(W(r=e[t],0,G,t),N=r),e.hasOwnProperty(t="FORMAT")){if("object"!=C(r=e[t]))throw Error(D+t+" not an object: "+r);A=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(D+t+" invalid: "+r);x="0123456789"==r.slice(0,10),S=r}}return{DECIMAL_PLACES:w,ROUNDING_MODE:y,EXPONENTIAL_AT:[v,b],RANGE:[_,E],CRYPTO:O,MODULO_MODE:i,POW_PRECISION:N,FORMAT:A,ALPHABET:S}},j.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!j.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-G<=i&&i<=G&&i===z(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%L)<1&&(t+=L),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||U<=r||r!==z(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(D+"Invalid BigNumber: "+e)},j.maximum=j.max=function(){return o(arguments,r.lt)},j.minimum=j.min=function(){return o(arguments,r.gt)},j.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return z(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,l=[],u=new j(g);if(null==e?e=w:W(e,0,G),i=_t(e/L),O)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)9e15<=(o=131072*t[s]+(t[s+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw O=!1,Error(D+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s<i;)9e15<=(o=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])?crypto.randomBytes(7).copy(t,s):(l.push(o%1e14),s+=7);s=i/7}if(!O)for(;s<i;)(o=c())<9e15&&(l[s++]=o%1e14);for(i=l[--s],e%=L,i&&e&&(l[s]=z(i/(o=Nt[L-e]))*o);0===l[s];l.pop(),s--);if(s<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=L);for(s=1,o=l[0];10<=o;o/=10,s++);s<L&&(n-=L-s)}return u.e=n,u.c=l,u}),j.sum=function(){for(var e=1,t=arguments,r=new j(t[0]);e<t.length;)r=r.plus(t[e++]);return r},m="0123456789",f=function(e,t,r,n,i){var o,s,l,u,c,a,f,h,p=e.indexOf("."),g=w,v=y;for(0<=p&&(u=N,N=0,e=e.replace(".",""),a=(h=new j(t)).pow(e.length-p),N=u,h.c=k(Y(H(a.c),a.e,"0"),10,r,m),h.e=h.c.length),l=u=(f=k(e,t,r,i?(o=S,m):(o=m,S))).length;0==f[--u];f.pop());if(!f[0])return o.charAt(0);if(p<0?--l:(a.c=f,a.e=l,a.s=n,f=(a=d(a,h,g,v,r)).c,c=a.r,l=a.e),p=f[s=l+g+1],u=r/2,c=c||s<0||null!=f[s+1],c=v<4?(null!=p||c)&&(0==v||v==(a.s<0?3:2)):u<p||p==u&&(4==v||c||6==v&&1&f[s-1]||v==(a.s<0?8:7)),s<1||!f[0])e=c?Y(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=s,c)for(--r;++f[--s]>r;)f[s]=0,s||(++l,f=[1].concat(f));for(u=f.length;!f[--u];);for(p=0,e="";p<=u;e+=o.charAt(f[p++]));e=Y(e,l,o.charAt(0))}return e},d=function(e,t,r,n,i){var o,s,l,u,c,a,f,h,p,g,v,d,m,w,y,b,_,E=e.s==t.s?1:-1,O=e.c,N=t.c;if(!(O&&O[0]&&N&&N[0]))return new j(e.s&&t.s&&(O?!N||O[0]!=N[0]:N)?O&&0==O[0]||!N?0*E:E/0:NaN);for(p=(h=new j(E)).c=[],E=r+(s=e.e-t.e)+1,i||(i=U,s=q(e.e/L)-q(t.e/L),E=E/L|0),l=0;N[l]==(O[l]||0);l++);if(N[l]>(O[l]||0)&&s--,E<0)p.push(1),u=!0;else{for(w=O.length,b=N.length,E+=2,1<(c=z(i/(N[l=0]+1)))&&(N=P(N,c,i),O=P(O,c,i),b=N.length,w=O.length),m=b,v=(g=O.slice(0,b)).length;v<b;g[v++]=0);_=N.slice(),_=[0].concat(_),y=N[0],N[1]>=i/2&&y++;do{if(c=0,(o=$(N,g,b,v))<0){if(d=g[0],b!=v&&(d=d*i+(g[1]||0)),1<(c=z(d/y)))for(f=(a=P(N,c=i<=c?i-1:c,i)).length,v=g.length;1==$(a,g,f,v);)c--,T(a,b<f?_:N,f,i),f=a.length,o=1;else 0==c&&(o=c=1),f=(a=N.slice()).length;if(T(g,a=f<v?[0].concat(a):a,v,i),v=g.length,-1==o)for(;$(N,g,b,v)<1;)c++,T(g,b<v?_:N,v,i),v=g.length}else 0===o&&(c++,g=[0])}while(p[l++]=c,g[0]?g[v++]=O[m]||0:(g=[O[m]],v=1),(m++<w||null!=g[0])&&E--);u=null!=g[0],p[0]||p.splice(0,1)}if(i==U){for(l=1,E=p[0];10<=E;E/=10,l++);F(h,r+(h.e=l+s*L-1)+1,n,u)}else h.e=s,h.r=+u;return h},s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,u=/^\.([^.]+)$/,a=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(a.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(s,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(l,"$1").replace(u,"0.$1")),t!=o))return new j(o,i);if(j.DEBUG)throw Error(D+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new j(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return V(this,new j(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return W(e,0,G),null==t?t=y:W(t,0,8),F(new j(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-q(this.e/L))*L,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return d(this,new j(e,t),w,y)},r.dividedToIntegerBy=r.idiv=function(e,t){return d(this,new j(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,s,l,u,c,a=this;if((e=new j(e)).c&&!e.isInteger())throw Error(D+"Exponent not an integer: "+I(e));if(null!=t&&(t=new j(t)),s=14<e.e,!a.c||!a.c[0]||1==a.c[0]&&!a.e&&1==a.c.length||!e.c||!e.c[0])return c=new j(Math.pow(+I(a),s?e.s*(2-Z(e)):+I(e))),t?c.mod(t):c;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new j(NaN);(n=!l&&a.isInteger()&&t.isInteger())&&(a=a.mod(t))}else{if(9<e.e&&(0<a.e||a.e<-1||(0==a.e?1<a.c[0]||s&&24e7<=a.c[1]:a.c[0]<8e13||s&&a.c[0]<=9999975e7)))return o=a.s<0&&Z(e)?-0:0,-1<a.e&&(o=1/o),new j(l?1/o:o);N&&(o=_t(N/L+2))}for(u=s?(r=new j(.5),l&&(e.s=1),Z(e)):(i=Math.abs(+I(e)))%2,c=new j(g);;){if(u){if(!(c=c.times(a)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=z(i/2)))break;u=i%2}else if(F(e=e.times(r),e.e+1,1),14<e.e)u=Z(e);else{if(0==(i=+I(e)))break;u=i%2}a=a.times(a),o?a.c&&a.c.length>o&&(a.c.length=o):n&&(a=a.mod(t))}return n?c:(l&&(c=g.div(c)),t?c.mod(t):o?F(c,N,y,void 0):c)},r.integerValue=function(e){var t=new j(this);return null==e?e=y:W(e,0,8),F(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===V(this,new j(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<V(this,new j(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=V(this,new j(e,t)))||0===t},r.isInteger=function(){return!!this.c&&q(this.e/L)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return V(this,new j(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=V(this,new j(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,s=this,l=s.s;if(t=(e=new j(e,t)).s,!l||!t)return new j(NaN);if(l!=t)return e.s=-t,s.plus(e);var u=s.e/L,c=e.e/L,a=s.c,f=e.c;if(!u||!c){if(!a||!f)return a?(e.s=-t,e):new j(f?s:NaN);if(!a[0]||!f[0])return f[0]?(e.s=-t,e):new j(a[0]?s:3==y?-0:0)}if(u=q(u),c=q(c),a=a.slice(),l=u-c){for((i=(o=l<0)?(l=-l,a):(c=u,f)).reverse(),t=l;t--;i.push(0));i.reverse()}else for(n=(o=(l=a.length)<(t=f.length))?l:t,l=t=0;t<n;t++)if(a[t]!=f[t]){o=a[t]<f[t];break}if(o&&(i=a,a=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=a.length)))for(;t--;a[r++]=0);for(t=U-1;l<n;){if(a[--n]<f[n]){for(r=n;r&&!a[--r];a[r]=t);--a[r],a[n]+=U}a[n]-=f[n]}for(;0==a[0];a.splice(0,1),--c);return a[0]?B(e,a,c):(e.s=3==y?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new j(e,t),!n.c||!e.s||e.c&&!e.c[0]?new j(NaN):!e.c||n.c&&!n.c[0]?new j(n):(9==i?(t=e.s,e.s=1,r=d(n,e,0,3),e.s=t,r.s*=t):r=d(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,s,l,u,c,a,f,h,p=this,g=p.c,v=(e=new j(e,t)).c;if(!(g&&v&&g[0]&&v[0]))return!p.s||!e.s||g&&!g[0]&&!v||v&&!v[0]&&!g?e.c=e.e=e.s=null:(e.s*=p.s,g&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=q(p.e/L)+q(e.e/L),e.s*=p.s,(l=g.length)<(p=v.length)&&(h=g,g=v,v=h,n=l,l=p,p=n),n=l+p,h=[];n--;h.push(0));for(n=p;0<=--n;){for(a=v[n]%1e7,f=v[n]/1e7|(r=0),i=n+(o=l);n<i;)r=((u=a*(u=g[--o]%1e7)+(s=f*u+(c=g[o]/1e7|0)*a)%1e7*1e7+h[i]+r)/1e14|0)+(s/1e7|0)+f*c,h[i--]=u%1e14;h[i]=r}return r?++t:h.splice(0,1),B(e,h,t)},r.negated=function(){var e=new j(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new j(e,t)).s,!i||!t)return new j(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/L,s=e.e/L,l=n.c,u=e.c;if(!o||!s){if(!l||!u)return new j(i/0);if(!l[0]||!u[0])return u[0]?e:new j(l[0]?n:0*i)}if(o=q(o),s=q(s),l=l.slice(),i=o-s){for((r=0<i?(s=o,u):(i=-i,l)).reverse();i--;r.push(0));r.reverse()}for((i=l.length)-(t=u.length)<0&&(r=u,u=l,l=r,t=i),i=0;t;)i=(l[--t]=l[t]+u[t]+i)/U|0,l[t]=U===l[t]?0:l[t]%U;return i&&(l=[i].concat(l),++s),B(e,l,s)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return W(e,1,G),null==t?t=y:W(t,0,8),F(new j(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*L+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return W(e,-Ot,Ot),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,s=o.c,l=o.s,u=o.e,c=w+4,a=new j("0.5");if(1!==l||!s||!s[0])return new j(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);if((r=0==(l=Math.sqrt(+I(o)))||l==1/0?(((t=H(s)).length+u)%2==0&&(t+="0"),l=Math.sqrt(+t),u=q((u+1)/2)-(u<0||u%2),new j(t=l==1/0?"5e"+u:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+u)):new j(l+"")).c[0])for((l=(u=r.e)+c)<3&&(l=0);;)if(i=r,r=a.times(i.plus(d(o,i,c,1))),H(i.c).slice(0,l)===(t=H(r.c)).slice(0,l)){if(r.e<u&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(F(r,r.e+w+2,1),e=!r.times(r).eq(o));break}if(!n&&(F(i,i.e+w+2,0),i.times(i).eq(o))){r=i;break}c+=4,l+=4,n=1}return F(r,r.e+w+1,y,e)},r.toExponential=function(e,t){return null!=e&&(W(e,0,G),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(W(e,0,G),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==C(t)?(r=t,t=null):e&&"object"==C(e)?(r=e,e=t=null):r=A;else if("object"!=C(r))throw Error(D+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,s=r.groupSeparator||"",l=t[0],t=t[1],u=this.s<0,c=u?l.slice(1):l,a=c.length;if(o&&(n=i,i=o,a-=o=n),0<i&&0<a){for(l=c.substr(0,n=a%i||i);n<a;n+=i)l+=s+c.substr(n,i);0<o&&(l+=s+c.slice(n)),u&&(l="-"+l)}e=t?l+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):l}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,s,l,u,c,a,f=this,h=f.c;if(null!=e&&(!(l=new j(e)).isInteger()&&(l.c||1!==l.s)||l.lt(g)))throw Error(D+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+I(l));if(!h)return new j(f);for(t=new j(g),c=r=new j(g),n=u=new j(g),h=H(h),o=t.e=h.length-f.e-1,t.c[0]=Nt[(s=o%L)<0?L+s:s],e=!e||0<l.comparedTo(t)?0<o?t:c:l,s=E,E=1/0,l=new j(h),u.c[0]=0;a=d(l,t,0,1),1!=(i=r.plus(a.times(n))).comparedTo(e);)r=n,n=i,c=u.plus(a.times(i=c)),u=i,t=l.minus(a.times(i=t)),l=i;return i=d(e.minus(r),n,0,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=f.s,h=d(c,n,o*=2,y).minus(f).abs().comparedTo(d(u,r,o,y).minus(f).abs())<1?[c,n]:[u,r],E=s,h},r.toNumber=function(){return+I(this)},r.toPrecision=function(e,t){return null!=e&&W(e,1,G),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=v||b<=i?X(H(r.c),i):Y(H(r.c),i,"0"):10===e&&x?Y(H((r=F(new j(r),w+i+1,y)).c),r.e,"0"):(W(e,2,S.length,"Base"),f(Y(H(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return I(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&j.set(e),j}();function At(e){for(var t=[];0<e.length;){var r=e.shift();if(S(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!E.isBigNumber(n)){if(!c(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new E(n)}if("string"==typeof i&&!E.isBigNumber(i)){if(!c(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new E(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=E.isBigNumber(o)?o:E(o)).isNaN())throw new Error("计算结果为NaN");return o}function St(e,t,r){var n,i,o,s,l,u,c,a,f,h,p,g,v,d,m,w,y,b,_="";return E.isBigNumber(e)?_=e.toFixed():"string"!=typeof e&&(_=e.toString()),"undefined"===_||"NaN"===_?null:(i=n=null,s=o=!1,w=a=c=u=!(l="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)w=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)s=!0;else if("round"===t)l=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)u=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");a=!0}}),u?(e=E(_).toExponential(),s&&!e.startsWith("-")?"+"+e:e):c?(t=E(_).toFraction().map(function(e){return e.toFixed()}).join("/"),s&&!t.startsWith("-")?"+"+t:t):(a&&(_=E(_).times(100).toFixed()),n&&(e=_.split("."),t=e[0],e=1===e.length?"":e[1],p=i,g=+n,y=l,v=f=t,m=(d=h=e).length,b={"~-":function(){d=h.slice(0,"<"===p?g-1:g)},"~+":function(){var e,t="<"===p?g-1:g;m<=t||0===m||(e=h.slice(0,t),0!=+h.slice(t,m)&&(e=(+e+1).toString()).length>t?(d=e.slice(1,e.length),v=(+v+1).toString()):d=e)},"~5":function(){var e,t;0===m||(d=h.slice(0,e="<"===p?g-1:g),t=+h[e],Number.isNaN(t))||5<=t&&(d=(+d+1).toString()).length>e&&(d=d.slice(1,d.length),v=(+v+1).toString())},"~6":function(){var e,t,r,n;0!==m&&(t=+h[e="<"===p?g-1:g],r=""===(r=h.slice(+e+1,h.length))?0:parseInt(r),n=0===e?+f[f.length-1]:+h[e-1],d=h.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(d=(+d+1).toString()).length>e&&(d=d.slice(1,d.length),v=(+v+1).toString())}},"<="===p?d=m<=g?h:(b[y]&&b[y](),d.replace(/0+$/,"")):"<"===p?d=m<g?h:(b[y]&&b[y](),d.replace(/0+$/,"")):"="===p?m<g?d=h+"0".repeat(g-m):g<m&&b[y]&&b[y]():">="===p?m<g&&(d=h+"0".repeat(g-m)):">"===p&&m<=g&&(d=h+"0".repeat(g-m+1)),t=(b={int_part:v,dec_part:d}).int_part,_=""===(e=b.dec_part)?t:"".concat(t,".").concat(e)),o&&(w=!1,_=1<(y=_.split(".")).length?((b=y[0]).includes("-")?y[0]=b[0]+b.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):y[0]=b.replace(/(?=(?!^)(?:\d{3})+$)/g,","),y.join(".")):(t=y[0]).includes("-")?t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),s&&(w=!1,_.startsWith("-")||(_="+"+_)),a&&(w=!1,_+="%"),w&&!r?+_:_))}function xt(e,i){return e.map(function(e){if("var"!==e.type)return e;for(var t,r,n=0;n<i.length&&!f(t=y(i[n],e.value));n++);if("number"==typeof(r=t)||c(r))return{type:"number",value:t};throw new Error("错误的填充值")})}function jt(e){var r=null;return e.length,{tokens:e.map(function(e){var t=function(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],s=0;s<o.length;s++){var l=e.match(o[s]);if(l){t=l;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}function kt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=(f(i=e[1])&&(t.options=i),y(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(C(n)))}r=n.toString()}if(e=r.split("|"),t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=k(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=k(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}(t),i=y(n,"options._error",void 0),o=y(n,"options._debug",!1),s=y(n,"options._unit",!1),l=n.options,u=null;if(n.fmt_err||n.expr_err){if(f(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(f(i))try{c=mt(n.expr,s)}catch(e){return i}else c=mt(n.expr,s);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),h(l)){var c,a=[];if(Array.isArray(l)?a=l:(a.push(l),f(l=y(l,"_fill_data",{}))&&(Array.isArray(l)?a=[].concat(_(a),_(l)):a.push(l))),f(i))try{c=wt(c,a,s),h(n.fmt)&&(n.fmt=xt(n.fmt,a))}catch(e){return i}else c=wt(c,a,s),h(n.fmt)&&(n.fmt=xt(n.fmt,a));[!0,"on","auto","space"].includes(s)&&(u=(l=jt(c)).unit,c=l.tokens)}a=yt(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(a),console.warn("单位:".concat(u))),l=null;if(f(i))try{l=At(a)}catch(e){return i}else l=At(a);if("Infinity"!==(l=h(n.fmt)?St(l,n.fmt,s):null!==l?l.toFixed():null)&&null!==l)return null!==u&&(l+=u),l;if(f(i))return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(O," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");t=kt;return e.calc=kt,e.fmt=t,e.version=O,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
package/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];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.")}Object.defineProperty(exports,"__esModule",{value:!0});var version="1.2.1",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<o.length;a++){var s=e.match(o[a]);if(s){t=s;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",to_number:"to-number",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var i=e[0];if(t===state$1.initial)if(/\s/.test(i))e=e.slice(1);else if(symbol.includes(i))t=state$1.symbol,r.push(i),e=e.slice(1);else if(","===i)t=state$1.initial,n.push({type:"comma",value:i}),e=e.slice(1);else if(/[a-zA-Z_]/.test(i))t=state$1.variable,r.push(i),e=e.slice(1);else if(/\d/.test(i))t=state$1.number,r.push(i),e=e.slice(1);else if("+"===i)t=state$1.initial,n.push({type:"plus",value:i}),e=e.slice(1);else if("~"===i)t=state$1.round,r.push(i),e=e.slice(1);else if("%"===i)t=state$1.initial,n.push({type:"percent",value:i}),e=e.slice(1);else if("/"===i)t=state$1.initial,n.push({type:"fraction",value:i}),e=e.slice(1);else{if("!"!==i)throw new Error("不识别的fmt字符:".concat(i));if(t=state$1.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else if(t===state$1.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(i)?e=e.slice(1):symbol.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=freeGlobal$1,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$3=freeGlobal||freeSelf||Function("return this")(),_root=root$3,root$2=_root,_Symbol2=_root.Symbol,_Symbol$3=_Symbol2,_Symbol$2=_Symbol$3,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$2?_Symbol$2.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var _getRawTag=getRawTag$1,objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$1=_Symbol$3,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$3?_Symbol$3.toStringTag:void 0;function baseGetTag$2(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$2;function isObjectLike$1(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$1,baseGetTag$1=baseGetTag$2,isObjectLike=isObjectLike$1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag$1(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag=baseGetTag$2,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$1=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource$1(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$1,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource=toSource$1,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$2(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$2,getNative$1=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$1.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative=_getNative,root=_root,Map$1=_getNative(_root,"Map"),_Map=Map$1,Hash=_Hash,ListCache=_ListCache,Map=Map$1;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError(FUNC_ERROR_TEXT);function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(memoize$1.Cache||MapCache),o}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(rePropName,function(e,t,r,n){i.push(r?n.replace(reEscapeChar,"$1"):t||e)}),i}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var _arrayMap=arrayMap$1,_Symbol=_Symbol$3,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto=_Symbol$3?_Symbol$3.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=e[1],i=(not_undefined(i)&&(t.options=i),get_1(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=fmt_tokenizer(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){for(var t,r,n,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=state.initial,a=[],s=[],l=function(){a.push(t),e=e.slice(1)},c=function(e){s.push({type:e,value:a.join("")}),a.length=0},u=function(){e=e.slice(1)};e;)switch(t=e[0],o){case state.initial:if(signed.includes(t)){var f=s.at(-1),o=0===s.length||"operator"===f.type||"("===f?state.number:state.operator;l()}else if(operator.includes(t))o=state.operator,l();else if(/\d/.test(t))o=state.number,l();else if(brackets.includes(t))o=state.bracket;else if(/[a-zA-Z_$]/.test(t))o=state.var,l();else{if(!/\s/.test(t))throw new Error("不识别的字符".concat(t));u()}break;case state.bracket:s.push({type:state.bracket,value:t}),u(),o=state.initial;break;case state.operator:f=a.at(-1);"*"===t&&"*"===f&&l(),c(state.operator),o=state.initial;break;case state.number:if(/\d/.test(t))l();else if("."===t){if(0===a.length||a.includes("."))throw new Error("非法的小数部分".concat(a.join("")));l()}else"Ee".includes(t)?(o=state.scientific,l()):["auto","on",!0].includes(i)&&/[^*/+\-()\s]/.test(t)||"space"===i&&/\S/.test(t)?l():(c(state.number),o=state.initial);break;case state.scientific:/\d/.test(t)?l():signed.includes(t)?(r=a.slice(1),n=a.at(-1),r.includes(t)||!/[Ee]/.test(n)?(c(state.scientific),o=state.initial):l()):["auto","on",!0].includes(i)&&/[^*/+\-()\s]/.test(t)||"space"===i&&/\S/.test(t)?l():(c(state.scientific),o=state.initial);break;case state.var:/[\w_.\[\]"']/.test(t)?l():(c(state.var),o=state.initial);break;default:throw new Error("状态错误")}return 0!==a.length&&(s.push({type:o,value:a.join("")}),a.length=0,o=state.initial),s}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,o.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(o.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(o,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var i=n.shift();if(is_operator(i))if("("===i)t.push(i);else if(")"===i){for(var o=t.pop();"("!==o&&0<t.length;)r.push(o),o=t.pop();if("("!==o)throw"error: unmatched ()"}else{for(;prioraty(i,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(i)}else r.push(i)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var m,f,h,t,c,b,a,s,l,u,p,r=T.prototype={constructor:T,toString:null,valueOf:null},g=new T(1),y=20,d=4,_=-7,v=21,$=-1e7,S=1e7,E=!1,i=1,w=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function T(e,t){var r,n,i,o,a,s,l,c,u=this;if(!(u instanceof T))return new T(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<$?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,a=e;10<=a;a/=10,o++);return void(S<o?u.c=u.e=null:(u.e=o,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):o<0&&(o=c.length)}else{if(intCheck(t,2,A.length,"Base"),10==t&&O)return M(u=new T(e),y+u.e+1,d);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,T.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=A.slice(0,t),o=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(o<a){o=l;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,a=-1,o=0;continue}return h(u,String(e),s,t)}s=!1,-1<(o=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&T.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((o=o-a-1)>S)u.c=u.e=null;else if(o<$)u.c=[u.e=0];else{if(u.e=o,u.c=[],a=(o+1)%LOG_BASE,o<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var i,o,a=[0],s=0,l=e.length;s<l;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),i=0;i<a.length;i++)r-1<a[i]&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}function G(e,t,r){var n,i,o,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((i=l*(o=e[s]%SQRT_BASE)+(n=c*o+(o=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*o,e[s]=i%r;return e=a?[a].concat(e):e}function k(e,t,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function B(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,a,s;if(null==r?r=d:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(o<=_||v<=o)?toExponential(s,o):toFixedPoint(s,o,"0");else if(r=(e=M(new T(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=o,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function o(e,t){for(var r,n=1,i=new T(e[0]);n<e.length;n++){if(!(r=new T(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function x(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<$?e.c=[e.e=0]:(e.e=r,e.c=t),e}function M(e,t,r,n){var i,o,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(i=1,s=f[0];10<=s;s/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,u=(l=f[c=0])/h[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(o%=LOG_BASE)-LOG_BASE+(i=1)}else{for(l=s=f[c],i=1;10<=s;s/=10,i++);u=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:l/h[i-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[i-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<o?0<a?l/h[i-a]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-o],f[c]=0<a?mathfloor(l/h[i-a]%h[a])*s:0),n)for(;;){if(0==c){for(o=1,a=f[0];10<=a;a/=10,o++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);o!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}e.e>S?e.c=e.e=null:e.e<$&&(e.c=[e.e=0])}return e}function P(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||v<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return T.clone=clone,T.ROUND_UP=0,T.ROUND_DOWN=1,T.ROUND_CEIL=2,T.ROUND_FLOOR=3,T.ROUND_HALF_UP=4,T.ROUND_HALF_DOWN=5,T.ROUND_HALF_EVEN=6,T.ROUND_HALF_CEIL=7,T.ROUND_HALF_FLOOR=8,T.EUCLID=9,T.config=T.set=function(e){var t,r;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX,t),y=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),d=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX,0,t),intCheck(r[1],0,MAX,t),_=r[0],v=r[1]):(intCheck(r,-MAX,MAX,t),_=-(v=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX,-1,t),intCheck(r[1],1,MAX,t),$=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);$=-(S=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw E=!r,Error(bignumberError+"crypto unavailable");E=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),w=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);C=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);O="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:d,EXPONENTIAL_AT:[_,v],RANGE:[$,S],CRYPTO:E,MODULO_MODE:i,POW_PRECISION:w,FORMAT:C,ALPHABET:A}},T.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!T.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-MAX<=i&&i<=MAX&&i===mathfloor(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},T.maximum=T.max=function(){return o(arguments,r.lt)},T.minimum=T.min=function(){return o(arguments,r.gt)},T.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,a=0,s=[],l=new T(g);if(null==e?e=y:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),E)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)9e15<=(o=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw E=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a<i;)9e15<=(o=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(o%1e14),a+=7);a=i/7}if(!E)for(;a<i;)(o=c())<9e15&&(s[a++]=o%1e14);for(i=s[--a],e%=LOG_BASE,i&&e&&(o=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(i/o)*o);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,o=s[0];10<=o;o/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),T.sum=function(){for(var e=1,t=arguments,r=new T(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=d;for(0<=p&&(l=w,w=0,e=e.replace(".",""),u=(h=new T(t)).pow(e.length-p),w=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,i?(o=A,b):(o=b,A))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=o.charAt(f[p++]));e=toFixedPoint(e,s,o.charAt(0))}return e},m=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p,g,_,m,b,y,d,v,$,S=e.s==t.s?1:-1,E=e.c,w=t.c;if(!(E&&E[0]&&w&&w[0]))return new T(e.s&&t.s&&(E?!w||E[0]!=w[0]:w)?E&&0==E[0]||!w?0*S:S/0:NaN);for(p=(h=new T(S)).c=[],S=r+(a=e.e-t.e)+1,i||(i=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;w[s]==(E[s]||0);s++);if(w[s]>(E[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=E.length,v=w.length,S+=2,1<(c=mathfloor(i/(w[s=0]+1)))&&(w=G(w,c,i),E=G(E,c,i),v=w.length,y=E.length),b=v,_=(g=E.slice(0,v)).length;_<v;g[_++]=0);$=w.slice(),$=[0].concat($),d=w[0],w[1]>=i/2&&d++;do{if(c=0,(o=k(w,g,v,_))<0){if(m=g[0],v!=_&&(m=m*i+(g[1]||0)),1<(c=mathfloor(m/d)))for(f=(u=G(w,c=i<=c?i-1:c,i)).length,_=g.length;1==k(u,g,f,_);)c--,B(u,v<f?$:w,f,i),f=u.length,o=1;else 0==c&&(o=c=1),f=(u=w.slice()).length;if(B(g,u=f<_?[0].concat(u):u,_,i),_=g.length,-1==o)for(;k(w,g,v,_)<1;)c++,B(g,v<_?$:w,_,i),_=g.length}else 0===o&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=E[b]||0:(g=[E[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(i==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);M(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(u.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(s,"$1").replace(l,"0.$1")),t!=o))return new T(o,i);if(T.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new T(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new T(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=d:intCheck(t,0,8),M(new T(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new T(e,t),y,d)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new T(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,a,s,l,c,u=this;if((e=new T(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+P(e));if(null!=t&&(t=new T(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new T(Math.pow(+P(u),a?e.s*(2-isOdd(e)):+P(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new T(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return o=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(o=1/o),new T(s?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(l=a?(r=new T(.5),s&&(e.s=1),isOdd(e)):(i=Math.abs(+P(e)))%2,c=new T(g);;){if(l){if(!(c=c.times(u)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;l=i%2}else if(M(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(i=+P(e)))break;l=i%2}u=u.times(u),o?u.c&&u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):o?M(c,w,d,void 0):c)},r.integerValue=function(e){var t=new T(this);return null==e?e=d:intCheck(e,0,8),M(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new T(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new T(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new T(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new T(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new T(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new T(e,t)).s,!s||!t)return new T(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new T(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new T(u[0]?a:3==d?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((i=(o=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){o=u[t]<f[t];break}if(o&&(i=u,u=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?x(e,u,c):(e.s=3==d?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new T(e,t),!n.c||!e.s||e.c&&!e.c[0]?new T(NaN):!e.c||n.c&&!n.c[0]?new T(n):(9==i?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new T(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),i=n+(o=s);n<i;)r=((l=u*(l=m[--o]%g)+(a=f*l+(c=m[o]/g|0)*u)%g*g+h[i]+r)/p|0)+(a/g|0)+f*c,h[i--]=l%p;h[i]=r}return r?++t:h.splice(0,1),x(e,h,t)},r.negated=function(){var e=new T(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new T(e,t)).s,!i||!t)return new T(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!o||!a){if(!s||!l)return new T(i/0);if(!s[0]||!l[0])return l[0]?e:new T(s[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),s=s.slice(),i=o-a){for((r=0<i?(a=o,l):(i=-i,s)).reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+l[t]+i)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return i&&(s=[i].concat(s),++a),x(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=d:intCheck(t,0,8),M(new T(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,s=o.s,l=o.e,c=y+4,u=new T("0.5");if(1!==s||!a||!a[0])return new T(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if((r=0==(s=Math.sqrt(+P(o)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new T(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new T(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(i=r,r=u.times(i.plus(m(o,i,c,1))),coeffToString(i.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(M(r,r.e+y+2,1),e=!r.times(r).eq(o));break}if(!n&&(M(i,i.e+y+2,0),i.times(i).eq(o))){r=i;break}c+=4,s+=4,n=1}return M(r,r.e+y+1,d,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=C;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(o&&(n=i,i=o,u-=o=n),0<i&&0<u){for(s=c.substr(0,n=u%i||i);n<u;n+=i)s+=a+c.substr(n,i);0<o&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new T(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+P(s));if(!h)return new T(f);for(t=new T(g),c=r=new T(g),n=l=new T(g),h=coeffToString(h),o=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=o%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<o?t:c:s,a=S,S=1/0,s=new T(h),l.c[0]=0;u=m(s,t,0,1),1!=(i=r.plus(u.times(n))).comparedTo(e);)r=n,n=i,c=l.plus(u.times(i=c)),l=i,t=s.minus(u.times(i=t)),s=i;return i=m(e.minus(r),n,0,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=f.s,h=m(c,n,o*=2,d).minus(f).abs().comparedTo(m(l,r,o,d).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+P(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=_||v<=i?toExponential(coeffToString(r.c),i):toFixedPoint(coeffToString(r.c),i,"0"):10===e&&O?toFixedPoint(coeffToString((r=M(new T(r),y+i+1,d)).c),r.e,"0"):(intCheck(e,2,A.length,"Base"),f(toFixedPoint(coeffToString(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return P(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&T.set(e),T}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=i.length)<(t=o.length)?e:t,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof i&&!BigNumber.isBigNumber(i)){if(!is_str_number(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new BigNumber(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=BigNumber.isBigNumber(o)?o:BigNumber(o)).isNaN())throw new Error("计算结果为NaN");return o}function decimal_round(i,o,a,s,e){var l=i,c=o,u=o.length,t={"~-":function(){c=o.slice(0,"<"===a?s-1:s)},"~+":function(){var e,t="<"===a?s-1:s;u<=t||0===u||(e=o.slice(0,t),0!=+o.slice(t,u)&&(e=(+e+1).toString()).length>t?(c=e.slice(1,e.length),l=(+l+1).toString()):c=e)},"~5":function(){var e,t;0===u||(c=o.slice(0,e="<"===a?s-1:s),t=+o[e],Number.isNaN(t))||5<=t&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())},"~6":function(){var e,t,r,n;0!==u&&(t=+o[e="<"===a?s-1:s],r=""===(r=o.slice(+e+1,o.length))?0:parseInt(r),n=0===e?+i[i.length-1]:+o[e-1],c=o.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())}};return"<="===a?c=u<=s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"<"===a?c=u<s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"="===a?u<s?c=o+"0".repeat(s-u):s<u&&t[e]&&t[e]():">="===a?u<s&&(c=o+"0".repeat(s-u)):">"===a&&u<=s&&(c=o+"0".repeat(s-u+1)),{int_part:l,dec_part:c}}function format(e,t,r){var n,i,o,a,s,l,c,u,f,h="";return BigNumber.isBigNumber(e)?h=e.toFixed():"string"!=typeof e&&(h=e.toString()),"undefined"===h||"NaN"===h?null:(i=n=null,a=o=!1,f=u=c=l=!(s="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)f=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)a=!0;else if("round"===t)s=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");u=!0}}),l?(e=BigNumber(h).toExponential(),a&&!e.startsWith("-")?"+"+e:e):c?(t=BigNumber(h).toFraction().map(function(e){return e.toFixed()}).join("/"),a&&!t.startsWith("-")?"+"+t:t):(u&&(h=BigNumber(h).times(100).toFixed()),n&&(t=(e=decimal_round(t=(e=h.split("."))[0],1===e.length?"":e[1],i,+n,s)).int_part,h=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),o&&(f=!1,h=1<(t=h.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),a&&(f=!1,h.startsWith("-")||(h="+"+h)),u&&(f=!1,h+="%"),f&&!r?+h:h))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),i=get_1(n,"options._error",void 0),o=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(i))try{c=tokenizer(n.expr,a)}catch(e){return i}else c=tokenizer(n.expr,a);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(i))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return i}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),s=null;if(not_undefined(i))try{s=eval_postfix(u)}catch(e){return i}else s=eval_postfix(u);if("Infinity"!==(s=not_null(n.fmt)?format(s,n.fmt,a):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(not_undefined(i))return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;exports.calc=calc,exports.fmt=fmt,exports.version=version;
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];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.")}Object.defineProperty(exports,"__esModule",{value:!0});var version="1.2.2",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<o.length;a++){var s=e.match(o[a]);if(s){t=s;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",to_number:"to-number",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var i=e[0];if(t===state$1.initial)if(/\s/.test(i))e=e.slice(1);else if(symbol.includes(i))t=state$1.symbol,r.push(i),e=e.slice(1);else if(","===i)t=state$1.initial,n.push({type:"comma",value:i}),e=e.slice(1);else if(/[a-zA-Z_]/.test(i))t=state$1.variable,r.push(i),e=e.slice(1);else if(/\d/.test(i))t=state$1.number,r.push(i),e=e.slice(1);else if("+"===i)t=state$1.initial,n.push({type:"plus",value:i}),e=e.slice(1);else if("~"===i)t=state$1.round,r.push(i),e=e.slice(1);else if("%"===i)t=state$1.initial,n.push({type:"percent",value:i}),e=e.slice(1);else if("/"===i)t=state$1.initial,n.push({type:"fraction",value:i}),e=e.slice(1);else{if("!"!==i)throw new Error("不识别的fmt字符:".concat(i));if(t=state$1.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else if(t===state$1.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(i)?e=e.slice(1):symbol.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=freeGlobal$1,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$3=freeGlobal||freeSelf||Function("return this")(),_root=root$3,root$2=_root,_Symbol2=_root.Symbol,_Symbol$3=_Symbol2,_Symbol$2=_Symbol$3,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$2?_Symbol$2.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var _getRawTag=getRawTag$1,objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$1=_Symbol$3,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$3?_Symbol$3.toStringTag:void 0;function baseGetTag$2(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$2;function isObjectLike$1(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$1,baseGetTag$1=baseGetTag$2,isObjectLike=isObjectLike$1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag$1(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag=baseGetTag$2,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$1=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource$1(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$1,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource=toSource$1,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$2(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$2,getNative$1=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$1.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative=_getNative,root=_root,Map$1=_getNative(_root,"Map"),_Map=Map$1,Hash=_Hash,ListCache=_ListCache,Map=Map$1;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError(FUNC_ERROR_TEXT);function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(memoize$1.Cache||MapCache),o}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(rePropName,function(e,t,r,n){i.push(r?n.replace(reEscapeChar,"$1"):t||e)}),i}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var _arrayMap=arrayMap$1,_Symbol=_Symbol$3,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto=_Symbol$3?_Symbol$3.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=e[1],i=(not_undefined(i)&&(t.options=i),get_1(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=fmt_tokenizer(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){for(var t,r,n,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=state.initial,a=[],s=[],l=function(){a.push(t),e=e.slice(1)},c=function(e){s.push({type:e,value:a.join("")}),a.length=0},u=function(){e=e.slice(1)};e;)switch(t=e[0],o){case state.initial:if(signed.includes(t)){var f=s.at(-1),o=0===s.length||"operator"===f.type||"("===f?state.number:state.operator;l()}else if(operator.includes(t))o=state.operator,l();else if(/\d/.test(t))o=state.number,l();else if(brackets.includes(t))o=state.bracket;else if(/[a-zA-Z_$]/.test(t))o=state.var,l();else{if(!/\s/.test(t))throw new Error("不识别的字符".concat(t));u()}break;case state.bracket:s.push({type:state.bracket,value:t}),u(),o=state.initial;break;case state.operator:f=a.at(-1);"*"===t&&"*"===f&&l(),c(state.operator),o=state.initial;break;case state.number:if(/\d/.test(t))l();else if("."===t){if(0===a.length||a.includes("."))throw new Error("非法的小数部分".concat(a.join("")));l()}else"Ee".includes(t)?(o=state.scientific,l()):["auto","on",!0].includes(i)&&/[^*/+\-()\s]/.test(t)||"space"===i&&/\S/.test(t)?l():(c(state.number),o=state.initial);break;case state.scientific:/\d/.test(t)?l():signed.includes(t)?(r=a.slice(1),n=a.at(-1),r.includes(t)||!/[Ee]/.test(n)?(c(state.scientific),o=state.initial):l()):["auto","on",!0].includes(i)&&/[^*/+\-()\s]/.test(t)||"space"===i&&/\S/.test(t)?l():(c(state.scientific),o=state.initial);break;case state.var:/[\w_.\[\]"']/.test(t)?l():(c(state.var),o=state.initial);break;default:throw new Error("状态错误")}return 0!==a.length&&(s.push({type:o,value:a.join("")}),a.length=0,o=state.initial),s}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,o.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(o.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(o,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var i=n.shift();if(is_operator(i))if("("===i)t.push(i);else if(")"===i){for(var o=t.pop();"("!==o&&0<t.length;)r.push(o),o=t.pop();if("("!==o)throw"error: unmatched ()"}else{for(;prioraty(i,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(i)}else r.push(i)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var m,f,h,t,c,b,a,s,l,u,p,r=T.prototype={constructor:T,toString:null,valueOf:null},g=new T(1),y=20,d=4,_=-7,v=21,$=-1e7,S=1e7,E=!1,i=1,w=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function T(e,t){var r,n,i,o,a,s,l,c,u=this;if(!(u instanceof T))return new T(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<$?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,a=e;10<=a;a/=10,o++);return void(S<o?u.c=u.e=null:(u.e=o,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):o<0&&(o=c.length)}else{if(intCheck(t,2,A.length,"Base"),10==t&&O)return M(u=new T(e),y+u.e+1,d);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,T.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=A.slice(0,t),o=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(o<a){o=l;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,a=-1,o=0;continue}return h(u,String(e),s,t)}s=!1,-1<(o=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&T.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((o=o-a-1)>S)u.c=u.e=null;else if(o<$)u.c=[u.e=0];else{if(u.e=o,u.c=[],a=(o+1)%LOG_BASE,o<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var i,o,a=[0],s=0,l=e.length;s<l;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),i=0;i<a.length;i++)r-1<a[i]&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}function G(e,t,r){var n,i,o,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((i=l*(o=e[s]%SQRT_BASE)+(n=c*o+(o=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*o,e[s]=i%r;return e=a?[a].concat(e):e}function k(e,t,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function B(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,a,s;if(null==r?r=d:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(o<=_||v<=o)?toExponential(s,o):toFixedPoint(s,o,"0");else if(r=(e=M(new T(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=o,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function o(e,t){for(var r,n=1,i=new T(e[0]);n<e.length;n++){if(!(r=new T(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function x(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<$?e.c=[e.e=0]:(e.e=r,e.c=t),e}function M(e,t,r,n){var i,o,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(i=1,s=f[0];10<=s;s/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,u=(l=f[c=0])/h[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(o%=LOG_BASE)-LOG_BASE+(i=1)}else{for(l=s=f[c],i=1;10<=s;s/=10,i++);u=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:l/h[i-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[i-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<o?0<a?l/h[i-a]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-o],f[c]=0<a?mathfloor(l/h[i-a]%h[a])*s:0),n)for(;;){if(0==c){for(o=1,a=f[0];10<=a;a/=10,o++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);o!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}e.e>S?e.c=e.e=null:e.e<$&&(e.c=[e.e=0])}return e}function P(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||v<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return T.clone=clone,T.ROUND_UP=0,T.ROUND_DOWN=1,T.ROUND_CEIL=2,T.ROUND_FLOOR=3,T.ROUND_HALF_UP=4,T.ROUND_HALF_DOWN=5,T.ROUND_HALF_EVEN=6,T.ROUND_HALF_CEIL=7,T.ROUND_HALF_FLOOR=8,T.EUCLID=9,T.config=T.set=function(e){var t,r;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX,t),y=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),d=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX,0,t),intCheck(r[1],0,MAX,t),_=r[0],v=r[1]):(intCheck(r,-MAX,MAX,t),_=-(v=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX,-1,t),intCheck(r[1],1,MAX,t),$=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);$=-(S=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw E=!r,Error(bignumberError+"crypto unavailable");E=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),w=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);C=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);O="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:d,EXPONENTIAL_AT:[_,v],RANGE:[$,S],CRYPTO:E,MODULO_MODE:i,POW_PRECISION:w,FORMAT:C,ALPHABET:A}},T.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!T.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-MAX<=i&&i<=MAX&&i===mathfloor(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},T.maximum=T.max=function(){return o(arguments,r.lt)},T.minimum=T.min=function(){return o(arguments,r.gt)},T.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,a=0,s=[],l=new T(g);if(null==e?e=y:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),E)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)9e15<=(o=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw E=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a<i;)9e15<=(o=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(o%1e14),a+=7);a=i/7}if(!E)for(;a<i;)(o=c())<9e15&&(s[a++]=o%1e14);for(i=s[--a],e%=LOG_BASE,i&&e&&(o=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(i/o)*o);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,o=s[0];10<=o;o/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),T.sum=function(){for(var e=1,t=arguments,r=new T(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=d;for(0<=p&&(l=w,w=0,e=e.replace(".",""),u=(h=new T(t)).pow(e.length-p),w=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,i?(o=A,b):(o=b,A))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=o.charAt(f[p++]));e=toFixedPoint(e,s,o.charAt(0))}return e},m=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p,g,_,m,b,y,d,v,$,S=e.s==t.s?1:-1,E=e.c,w=t.c;if(!(E&&E[0]&&w&&w[0]))return new T(e.s&&t.s&&(E?!w||E[0]!=w[0]:w)?E&&0==E[0]||!w?0*S:S/0:NaN);for(p=(h=new T(S)).c=[],S=r+(a=e.e-t.e)+1,i||(i=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;w[s]==(E[s]||0);s++);if(w[s]>(E[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=E.length,v=w.length,S+=2,1<(c=mathfloor(i/(w[s=0]+1)))&&(w=G(w,c,i),E=G(E,c,i),v=w.length,y=E.length),b=v,_=(g=E.slice(0,v)).length;_<v;g[_++]=0);$=w.slice(),$=[0].concat($),d=w[0],w[1]>=i/2&&d++;do{if(c=0,(o=k(w,g,v,_))<0){if(m=g[0],v!=_&&(m=m*i+(g[1]||0)),1<(c=mathfloor(m/d)))for(f=(u=G(w,c=i<=c?i-1:c,i)).length,_=g.length;1==k(u,g,f,_);)c--,B(u,v<f?$:w,f,i),f=u.length,o=1;else 0==c&&(o=c=1),f=(u=w.slice()).length;if(B(g,u=f<_?[0].concat(u):u,_,i),_=g.length,-1==o)for(;k(w,g,v,_)<1;)c++,B(g,v<_?$:w,_,i),_=g.length}else 0===o&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=E[b]||0:(g=[E[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(i==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);M(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(u.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(s,"$1").replace(l,"0.$1")),t!=o))return new T(o,i);if(T.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new T(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new T(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=d:intCheck(t,0,8),M(new T(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new T(e,t),y,d)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new T(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,a,s,l,c,u=this;if((e=new T(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+P(e));if(null!=t&&(t=new T(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new T(Math.pow(+P(u),a?e.s*(2-isOdd(e)):+P(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new T(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return o=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(o=1/o),new T(s?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(l=a?(r=new T(.5),s&&(e.s=1),isOdd(e)):(i=Math.abs(+P(e)))%2,c=new T(g);;){if(l){if(!(c=c.times(u)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;l=i%2}else if(M(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(i=+P(e)))break;l=i%2}u=u.times(u),o?u.c&&u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):o?M(c,w,d,void 0):c)},r.integerValue=function(e){var t=new T(this);return null==e?e=d:intCheck(e,0,8),M(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new T(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new T(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new T(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new T(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new T(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new T(e,t)).s,!s||!t)return new T(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new T(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new T(u[0]?a:3==d?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((i=(o=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){o=u[t]<f[t];break}if(o&&(i=u,u=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?x(e,u,c):(e.s=3==d?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new T(e,t),!n.c||!e.s||e.c&&!e.c[0]?new T(NaN):!e.c||n.c&&!n.c[0]?new T(n):(9==i?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new T(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),i=n+(o=s);n<i;)r=((l=u*(l=m[--o]%g)+(a=f*l+(c=m[o]/g|0)*u)%g*g+h[i]+r)/p|0)+(a/g|0)+f*c,h[i--]=l%p;h[i]=r}return r?++t:h.splice(0,1),x(e,h,t)},r.negated=function(){var e=new T(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new T(e,t)).s,!i||!t)return new T(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!o||!a){if(!s||!l)return new T(i/0);if(!s[0]||!l[0])return l[0]?e:new T(s[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),s=s.slice(),i=o-a){for((r=0<i?(a=o,l):(i=-i,s)).reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+l[t]+i)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return i&&(s=[i].concat(s),++a),x(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=d:intCheck(t,0,8),M(new T(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,s=o.s,l=o.e,c=y+4,u=new T("0.5");if(1!==s||!a||!a[0])return new T(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if((r=0==(s=Math.sqrt(+P(o)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new T(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new T(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(i=r,r=u.times(i.plus(m(o,i,c,1))),coeffToString(i.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(M(r,r.e+y+2,1),e=!r.times(r).eq(o));break}if(!n&&(M(i,i.e+y+2,0),i.times(i).eq(o))){r=i;break}c+=4,s+=4,n=1}return M(r,r.e+y+1,d,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=C;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(o&&(n=i,i=o,u-=o=n),0<i&&0<u){for(s=c.substr(0,n=u%i||i);n<u;n+=i)s+=a+c.substr(n,i);0<o&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new T(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+P(s));if(!h)return new T(f);for(t=new T(g),c=r=new T(g),n=l=new T(g),h=coeffToString(h),o=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=o%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<o?t:c:s,a=S,S=1/0,s=new T(h),l.c[0]=0;u=m(s,t,0,1),1!=(i=r.plus(u.times(n))).comparedTo(e);)r=n,n=i,c=l.plus(u.times(i=c)),l=i,t=s.minus(u.times(i=t)),s=i;return i=m(e.minus(r),n,0,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=f.s,h=m(c,n,o*=2,d).minus(f).abs().comparedTo(m(l,r,o,d).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+P(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=_||v<=i?toExponential(coeffToString(r.c),i):toFixedPoint(coeffToString(r.c),i,"0"):10===e&&O?toFixedPoint(coeffToString((r=M(new T(r),y+i+1,d)).c),r.e,"0"):(intCheck(e,2,A.length,"Base"),f(toFixedPoint(coeffToString(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return P(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&T.set(e),T}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=i.length)<(t=o.length)?e:t,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof i&&!BigNumber.isBigNumber(i)){if(!is_str_number(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new BigNumber(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=BigNumber.isBigNumber(o)?o:BigNumber(o)).isNaN())throw new Error("计算结果为NaN");return o}function decimal_round(i,o,a,s,e){var l=i,c=o,u=o.length,t={"~-":function(){c=o.slice(0,"<"===a?s-1:s)},"~+":function(){var e,t="<"===a?s-1:s;u<=t||0===u||(e=o.slice(0,t),0!=+o.slice(t,u)&&(e=(+e+1).toString()).length>t?(c=e.slice(1,e.length),l=(+l+1).toString()):c=e)},"~5":function(){var e,t;0===u||(c=o.slice(0,e="<"===a?s-1:s),t=+o[e],Number.isNaN(t))||5<=t&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())},"~6":function(){var e,t,r,n;0!==u&&(t=+o[e="<"===a?s-1:s],r=""===(r=o.slice(+e+1,o.length))?0:parseInt(r),n=0===e?+i[i.length-1]:+o[e-1],c=o.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())}};return"<="===a?c=u<=s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"<"===a?c=u<s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"="===a?u<s?c=o+"0".repeat(s-u):s<u&&t[e]&&t[e]():">="===a?u<s&&(c=o+"0".repeat(s-u)):">"===a&&u<=s&&(c=o+"0".repeat(s-u+1)),{int_part:l,dec_part:c}}function format(e,t,r){var n,i,o,a,s,l,c,u,f,h="";return BigNumber.isBigNumber(e)?h=e.toFixed():"string"!=typeof e&&(h=e.toString()),"undefined"===h||"NaN"===h?null:(i=n=null,a=o=!1,f=u=c=l=!(s="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)f=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)a=!0;else if("round"===t)s=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");u=!0}}),l?(e=BigNumber(h).toExponential(),a&&!e.startsWith("-")?"+"+e:e):c?(t=BigNumber(h).toFraction().map(function(e){return e.toFixed()}).join("/"),a&&!t.startsWith("-")?"+"+t:t):(u&&(h=BigNumber(h).times(100).toFixed()),n&&(t=(e=decimal_round(t=(e=h.split("."))[0],1===e.length?"":e[1],i,+n,s)).int_part,h=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),o&&(f=!1,h=1<(t=h.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),a&&(f=!1,h.startsWith("-")||(h="+"+h)),u&&(f=!1,h+="%"),f&&!r?+h:h))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),i=get_1(n,"options._error",void 0),o=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(i))try{c=tokenizer(n.expr,a)}catch(e){return i}else c=tokenizer(n.expr,a);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(i))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return i}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),s=null;if(not_undefined(i))try{s=eval_postfix(u)}catch(e){return i}else s=eval_postfix(u);if("Infinity"!==(s=not_null(n.fmt)?format(s,n.fmt,a):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(not_undefined(i))return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;exports.calc=calc,exports.fmt=fmt,exports.version=version;
|
package/es/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function _typeof(e){return(_typeof="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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];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.")}var version="1.2.1",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<o.length;a++){var s=e.match(o[a]);if(s){t=s;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",to_number:"to-number",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var i=e[0];if(t===state$1.initial)if(/\s/.test(i))e=e.slice(1);else if(symbol.includes(i))t=state$1.symbol,r.push(i),e=e.slice(1);else if(","===i)t=state$1.initial,n.push({type:"comma",value:i}),e=e.slice(1);else if(/[a-zA-Z_]/.test(i))t=state$1.variable,r.push(i),e=e.slice(1);else if(/\d/.test(i))t=state$1.number,r.push(i),e=e.slice(1);else if("+"===i)t=state$1.initial,n.push({type:"plus",value:i}),e=e.slice(1);else if("~"===i)t=state$1.round,r.push(i),e=e.slice(1);else if("%"===i)t=state$1.initial,n.push({type:"percent",value:i}),e=e.slice(1);else if("/"===i)t=state$1.initial,n.push({type:"fraction",value:i}),e=e.slice(1);else{if("!"!==i)throw new Error("不识别的fmt字符:".concat(i));if(t=state$1.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else if(t===state$1.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(i)?e=e.slice(1):symbol.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=freeGlobal$1,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$3=freeGlobal||freeSelf||Function("return this")(),_root=root$3,root$2=_root,_Symbol2=_root.Symbol,_Symbol$3=_Symbol2,_Symbol$2=_Symbol$3,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$2?_Symbol$2.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var _getRawTag=getRawTag$1,objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$1=_Symbol$3,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$3?_Symbol$3.toStringTag:void 0;function baseGetTag$2(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$2;function isObjectLike$1(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$1,baseGetTag$1=baseGetTag$2,isObjectLike=isObjectLike$1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag$1(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag=baseGetTag$2,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$1=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource$1(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$1,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource=toSource$1,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$2(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$2,getNative$1=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$1.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative=_getNative,root=_root,Map$1=_getNative(_root,"Map"),_Map=Map$1,Hash=_Hash,ListCache=_ListCache,Map=Map$1;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError(FUNC_ERROR_TEXT);function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(memoize$1.Cache||MapCache),o}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(rePropName,function(e,t,r,n){i.push(r?n.replace(reEscapeChar,"$1"):t||e)}),i}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var _arrayMap=arrayMap$1,_Symbol=_Symbol$3,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto=_Symbol$3?_Symbol$3.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=e[1],i=(not_undefined(i)&&(t.options=i),get_1(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=fmt_tokenizer(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){function t(){c.push(i),e=e.slice(1)}function r(e){u.push({type:e,value:c.join("")}),c.length=0}function n(){e=e.slice(1)}for(var i,o,a,s=1<arguments.length&&void 0!==arguments[1]&&arguments[1],l=state.initial,c=[],u=[];e;)switch(i=e[0],l){case state.initial:if(signed.includes(i)){var f=u.at(-1),l=0===u.length||"operator"===f.type||"("===f?state.number:state.operator;t()}else if(operator.includes(i))l=state.operator,t();else if(/\d/.test(i))l=state.number,t();else if(brackets.includes(i))l=state.bracket;else if(/[a-zA-Z_$]/.test(i))l=state.var,t();else{if(!/\s/.test(i))throw new Error("不识别的字符".concat(i));n()}break;case state.bracket:u.push({type:state.bracket,value:i}),n(),l=state.initial;break;case state.operator:f=c.at(-1);"*"===i&&"*"===f&&t(),r(state.operator),l=state.initial;break;case state.number:if(/\d/.test(i))t();else if("."===i){if(0===c.length||c.includes("."))throw new Error("非法的小数部分".concat(c.join("")));t()}else"Ee".includes(i)?(l=state.scientific,t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(i)||"space"===s&&/\S/.test(i)?t():(r(state.number),l=state.initial);break;case state.scientific:/\d/.test(i)?t():signed.includes(i)?(o=c.slice(1),a=c.at(-1),o.includes(i)||!/[Ee]/.test(a)?(r(state.scientific),l=state.initial):t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(i)||"space"===s&&/\S/.test(i)?t():(r(state.scientific),l=state.initial);break;case state.var:/[\w_.\[\]"']/.test(i)?t():(r(state.var),l=state.initial);break;default:throw new Error("状态错误")}return 0!==c.length&&(u.push({type:l,value:c.join("")}),c.length=0,l=state.initial),u}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,o.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(o.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(o,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var i=n.shift();if(is_operator(i))if("("===i)t.push(i);else if(")"===i){for(var o=t.pop();"("!==o&&0<t.length;)r.push(o),o=t.pop();if("("!==o)throw"error: unmatched ()"}else{for(;prioraty(i,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(i)}else r.push(i)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var m,f,h,t,c,b,a,s,l,u,p,r=T.prototype={constructor:T,toString:null,valueOf:null},g=new T(1),y=20,d=4,_=-7,v=21,$=-1e7,S=1e7,E=!1,i=1,w=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function T(e,t){var r,n,i,o,a,s,l,c,u=this;if(!(u instanceof T))return new T(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<$?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,a=e;10<=a;a/=10,o++);return void(S<o?u.c=u.e=null:(u.e=o,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):o<0&&(o=c.length)}else{if(intCheck(t,2,A.length,"Base"),10==t&&O)return x(u=new T(e),y+u.e+1,d);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,T.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=A.slice(0,t),o=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(o<a){o=l;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,a=-1,o=0;continue}return h(u,String(e),s,t)}s=!1,-1<(o=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&T.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((o=o-a-1)>S)u.c=u.e=null;else if(o<$)u.c=[u.e=0];else{if(u.e=o,u.c=[],a=(o+1)%LOG_BASE,o<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var i,o,a=[0],s=0,l=e.length;s<l;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),i=0;i<a.length;i++)r-1<a[i]&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}function G(e,t,r){var n,i,o,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((i=l*(o=e[s]%SQRT_BASE)+(n=c*o+(o=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*o,e[s]=i%r;return e=a?[a].concat(e):e}function k(e,t,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function B(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,a,s;if(null==r?r=d:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(o<=_||v<=o)?toExponential(s,o):toFixedPoint(s,o,"0");else if(r=(e=x(new T(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=o,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function o(e,t){for(var r,n=1,i=new T(e[0]);n<e.length;n++){if(!(r=new T(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function M(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<$?e.c=[e.e=0]:(e.e=r,e.c=t),e}function x(e,t,r,n){var i,o,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(i=1,s=f[0];10<=s;s/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,u=(l=f[c=0])/h[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(o%=LOG_BASE)-LOG_BASE+(i=1)}else{for(l=s=f[c],i=1;10<=s;s/=10,i++);u=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:l/h[i-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[i-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<o?0<a?l/h[i-a]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-o],f[c]=0<a?mathfloor(l/h[i-a]%h[a])*s:0),n)for(;;){if(0==c){for(o=1,a=f[0];10<=a;a/=10,o++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);o!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}e.e>S?e.c=e.e=null:e.e<$&&(e.c=[e.e=0])}return e}function P(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||v<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return T.clone=clone,T.ROUND_UP=0,T.ROUND_DOWN=1,T.ROUND_CEIL=2,T.ROUND_FLOOR=3,T.ROUND_HALF_UP=4,T.ROUND_HALF_DOWN=5,T.ROUND_HALF_EVEN=6,T.ROUND_HALF_CEIL=7,T.ROUND_HALF_FLOOR=8,T.EUCLID=9,T.config=T.set=function(e){var t,r;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX,t),y=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),d=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX,0,t),intCheck(r[1],0,MAX,t),_=r[0],v=r[1]):(intCheck(r,-MAX,MAX,t),_=-(v=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX,-1,t),intCheck(r[1],1,MAX,t),$=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);$=-(S=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw E=!r,Error(bignumberError+"crypto unavailable");E=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),w=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);C=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);O="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:d,EXPONENTIAL_AT:[_,v],RANGE:[$,S],CRYPTO:E,MODULO_MODE:i,POW_PRECISION:w,FORMAT:C,ALPHABET:A}},T.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!T.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-MAX<=i&&i<=MAX&&i===mathfloor(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},T.maximum=T.max=function(){return o(arguments,r.lt)},T.minimum=T.min=function(){return o(arguments,r.gt)},T.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,a=0,s=[],l=new T(g);if(null==e?e=y:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),E)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)9e15<=(o=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw E=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a<i;)9e15<=(o=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(o%1e14),a+=7);a=i/7}if(!E)for(;a<i;)(o=c())<9e15&&(s[a++]=o%1e14);for(i=s[--a],e%=LOG_BASE,i&&e&&(o=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(i/o)*o);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,o=s[0];10<=o;o/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),T.sum=function(){for(var e=1,t=arguments,r=new T(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=d;for(0<=p&&(l=w,w=0,e=e.replace(".",""),u=(h=new T(t)).pow(e.length-p),w=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,i?(o=A,b):(o=b,A))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=o.charAt(f[p++]));e=toFixedPoint(e,s,o.charAt(0))}return e},m=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p,g,_,m,b,y,d,v,$,S=e.s==t.s?1:-1,E=e.c,w=t.c;if(!(E&&E[0]&&w&&w[0]))return new T(e.s&&t.s&&(E?!w||E[0]!=w[0]:w)?E&&0==E[0]||!w?0*S:S/0:NaN);for(p=(h=new T(S)).c=[],S=r+(a=e.e-t.e)+1,i||(i=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;w[s]==(E[s]||0);s++);if(w[s]>(E[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=E.length,v=w.length,S+=2,1<(c=mathfloor(i/(w[s=0]+1)))&&(w=G(w,c,i),E=G(E,c,i),v=w.length,y=E.length),b=v,_=(g=E.slice(0,v)).length;_<v;g[_++]=0);$=w.slice(),$=[0].concat($),d=w[0],w[1]>=i/2&&d++;do{if(c=0,(o=k(w,g,v,_))<0){if(m=g[0],v!=_&&(m=m*i+(g[1]||0)),1<(c=mathfloor(m/d)))for(f=(u=G(w,c=i<=c?i-1:c,i)).length,_=g.length;1==k(u,g,f,_);)c--,B(u,v<f?$:w,f,i),f=u.length,o=1;else 0==c&&(o=c=1),f=(u=w.slice()).length;if(B(g,u=f<_?[0].concat(u):u,_,i),_=g.length,-1==o)for(;k(w,g,v,_)<1;)c++,B(g,v<_?$:w,_,i),_=g.length}else 0===o&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=E[b]||0:(g=[E[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(i==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);x(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(u.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(s,"$1").replace(l,"0.$1")),t!=o))return new T(o,i);if(T.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new T(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new T(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=d:intCheck(t,0,8),x(new T(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new T(e,t),y,d)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new T(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,a,s,l,c,u=this;if((e=new T(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+P(e));if(null!=t&&(t=new T(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new T(Math.pow(+P(u),a?e.s*(2-isOdd(e)):+P(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new T(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return o=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(o=1/o),new T(s?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(l=a?(r=new T(.5),s&&(e.s=1),isOdd(e)):(i=Math.abs(+P(e)))%2,c=new T(g);;){if(l){if(!(c=c.times(u)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;l=i%2}else if(x(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(i=+P(e)))break;l=i%2}u=u.times(u),o?u.c&&u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):o?x(c,w,d,void 0):c)},r.integerValue=function(e){var t=new T(this);return null==e?e=d:intCheck(e,0,8),x(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new T(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new T(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new T(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new T(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new T(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new T(e,t)).s,!s||!t)return new T(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new T(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new T(u[0]?a:3==d?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((i=(o=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){o=u[t]<f[t];break}if(o&&(i=u,u=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?M(e,u,c):(e.s=3==d?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new T(e,t),!n.c||!e.s||e.c&&!e.c[0]?new T(NaN):!e.c||n.c&&!n.c[0]?new T(n):(9==i?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new T(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),i=n+(o=s);n<i;)r=((l=u*(l=m[--o]%g)+(a=f*l+(c=m[o]/g|0)*u)%g*g+h[i]+r)/p|0)+(a/g|0)+f*c,h[i--]=l%p;h[i]=r}return r?++t:h.splice(0,1),M(e,h,t)},r.negated=function(){var e=new T(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new T(e,t)).s,!i||!t)return new T(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!o||!a){if(!s||!l)return new T(i/0);if(!s[0]||!l[0])return l[0]?e:new T(s[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),s=s.slice(),i=o-a){for((r=0<i?(a=o,l):(i=-i,s)).reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+l[t]+i)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return i&&(s=[i].concat(s),++a),M(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=d:intCheck(t,0,8),x(new T(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,s=o.s,l=o.e,c=y+4,u=new T("0.5");if(1!==s||!a||!a[0])return new T(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if((r=0==(s=Math.sqrt(+P(o)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new T(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new T(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(i=r,r=u.times(i.plus(m(o,i,c,1))),coeffToString(i.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(x(r,r.e+y+2,1),e=!r.times(r).eq(o));break}if(!n&&(x(i,i.e+y+2,0),i.times(i).eq(o))){r=i;break}c+=4,s+=4,n=1}return x(r,r.e+y+1,d,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=C;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(o&&(n=i,i=o,u-=o=n),0<i&&0<u){for(s=c.substr(0,n=u%i||i);n<u;n+=i)s+=a+c.substr(n,i);0<o&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new T(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+P(s));if(!h)return new T(f);for(t=new T(g),c=r=new T(g),n=l=new T(g),h=coeffToString(h),o=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=o%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<o?t:c:s,a=S,S=1/0,s=new T(h),l.c[0]=0;u=m(s,t,0,1),1!=(i=r.plus(u.times(n))).comparedTo(e);)r=n,n=i,c=l.plus(u.times(i=c)),l=i,t=s.minus(u.times(i=t)),s=i;return i=m(e.minus(r),n,0,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=f.s,h=m(c,n,o*=2,d).minus(f).abs().comparedTo(m(l,r,o,d).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+P(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=_||v<=i?toExponential(coeffToString(r.c),i):toFixedPoint(coeffToString(r.c),i,"0"):10===e&&O?toFixedPoint(coeffToString((r=x(new T(r),y+i+1,d)).c),r.e,"0"):(intCheck(e,2,A.length,"Base"),f(toFixedPoint(coeffToString(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return P(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&T.set(e),T}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=i.length)<(t=o.length)?e:t,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof i&&!BigNumber.isBigNumber(i)){if(!is_str_number(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new BigNumber(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=BigNumber.isBigNumber(o)?o:BigNumber(o)).isNaN())throw new Error("计算结果为NaN");return o}function decimal_round(i,o,a,s,e){var l=i,c=o,u=o.length,t={"~-":function(){c=o.slice(0,"<"===a?s-1:s)},"~+":function(){var e,t="<"===a?s-1:s;u<=t||0===u||(e=o.slice(0,t),0!=+o.slice(t,u)&&(e=(+e+1).toString()).length>t?(c=e.slice(1,e.length),l=(+l+1).toString()):c=e)},"~5":function(){var e,t;0===u||(c=o.slice(0,e="<"===a?s-1:s),t=+o[e],Number.isNaN(t))||5<=t&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())},"~6":function(){var e,t,r,n;0!==u&&(t=+o[e="<"===a?s-1:s],r=""===(r=o.slice(+e+1,o.length))?0:parseInt(r),n=0===e?+i[i.length-1]:+o[e-1],c=o.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())}};return"<="===a?c=u<=s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"<"===a?c=u<s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"="===a?u<s?c=o+"0".repeat(s-u):s<u&&t[e]&&t[e]():">="===a?u<s&&(c=o+"0".repeat(s-u)):">"===a&&u<=s&&(c=o+"0".repeat(s-u+1)),{int_part:l,dec_part:c}}function format(e,t,r){var n,i,o,a,s,l,c,u,f,h="";return BigNumber.isBigNumber(e)?h=e.toFixed():"string"!=typeof e&&(h=e.toString()),"undefined"===h||"NaN"===h?null:(i=n=null,a=o=!1,f=u=c=l=!(s="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)f=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)a=!0;else if("round"===t)s=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");u=!0}}),l?(e=BigNumber(h).toExponential(),a&&!e.startsWith("-")?"+"+e:e):c?(t=BigNumber(h).toFraction().map(function(e){return e.toFixed()}).join("/"),a&&!t.startsWith("-")?"+"+t:t):(u&&(h=BigNumber(h).times(100).toFixed()),n&&(t=(e=decimal_round(t=(e=h.split("."))[0],1===e.length?"":e[1],i,+n,s)).int_part,h=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),o&&(f=!1,h=1<(t=h.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),a&&(f=!1,h.startsWith("-")||(h="+"+h)),u&&(f=!1,h+="%"),f&&!r?+h:h))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),i=get_1(n,"options._error",void 0),o=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(i))try{c=tokenizer(n.expr,a)}catch(e){return i}else c=tokenizer(n.expr,a);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(i))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return i}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),s=null;if(not_undefined(i))try{s=eval_postfix(u)}catch(e){return i}else s=eval_postfix(u);if("Infinity"!==(s=not_null(n.fmt)?format(s,n.fmt,a):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(not_undefined(i))return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;export{calc,fmt,version};
|
|
1
|
+
function _typeof(e){return(_typeof="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 _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];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.")}var version="1.2.2",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<o.length;a++){var s=e.match(o[a]);if(s){t=s;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",to_number:"to-number",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var i=e[0];if(t===state$1.initial)if(/\s/.test(i))e=e.slice(1);else if(symbol.includes(i))t=state$1.symbol,r.push(i),e=e.slice(1);else if(","===i)t=state$1.initial,n.push({type:"comma",value:i}),e=e.slice(1);else if(/[a-zA-Z_]/.test(i))t=state$1.variable,r.push(i),e=e.slice(1);else if(/\d/.test(i))t=state$1.number,r.push(i),e=e.slice(1);else if("+"===i)t=state$1.initial,n.push({type:"plus",value:i}),e=e.slice(1);else if("~"===i)t=state$1.round,r.push(i),e=e.slice(1);else if("%"===i)t=state$1.initial,n.push({type:"percent",value:i}),e=e.slice(1);else if("/"===i)t=state$1.initial,n.push({type:"fraction",value:i}),e=e.slice(1);else{if("!"!==i)throw new Error("不识别的fmt字符:".concat(i));if(t=state$1.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else if(t===state$1.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(i)?e=e.slice(1):symbol.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=freeGlobal$1,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$3=freeGlobal||freeSelf||Function("return this")(),_root=root$3,root$2=_root,_Symbol2=_root.Symbol,_Symbol$3=_Symbol2,_Symbol$2=_Symbol$3,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$2?_Symbol$2.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var _getRawTag=getRawTag$1,objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$1=_Symbol$3,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$3?_Symbol$3.toStringTag:void 0;function baseGetTag$2(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$2;function isObjectLike$1(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$1,baseGetTag$1=baseGetTag$2,isObjectLike=isObjectLike$1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag$1(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag=baseGetTag$2,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$1=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource$1(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$1,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource=toSource$1,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$2(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$2,getNative$1=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$1.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative=_getNative,root=_root,Map$1=_getNative(_root,"Map"),_Map=Map$1,Hash=_Hash,ListCache=_ListCache,Map=Map$1;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError(FUNC_ERROR_TEXT);function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(memoize$1.Cache||MapCache),o}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(rePropName,function(e,t,r,n){i.push(r?n.replace(reEscapeChar,"$1"):t||e)}),i}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var _arrayMap=arrayMap$1,_Symbol=_Symbol$3,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto=_Symbol$3?_Symbol$3.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=e[1],i=(not_undefined(i)&&(t.options=i),get_1(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=fmt_tokenizer(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){function t(){c.push(i),e=e.slice(1)}function r(e){u.push({type:e,value:c.join("")}),c.length=0}function n(){e=e.slice(1)}for(var i,o,a,s=1<arguments.length&&void 0!==arguments[1]&&arguments[1],l=state.initial,c=[],u=[];e;)switch(i=e[0],l){case state.initial:if(signed.includes(i)){var f=u.at(-1),l=0===u.length||"operator"===f.type||"("===f?state.number:state.operator;t()}else if(operator.includes(i))l=state.operator,t();else if(/\d/.test(i))l=state.number,t();else if(brackets.includes(i))l=state.bracket;else if(/[a-zA-Z_$]/.test(i))l=state.var,t();else{if(!/\s/.test(i))throw new Error("不识别的字符".concat(i));n()}break;case state.bracket:u.push({type:state.bracket,value:i}),n(),l=state.initial;break;case state.operator:f=c.at(-1);"*"===i&&"*"===f&&t(),r(state.operator),l=state.initial;break;case state.number:if(/\d/.test(i))t();else if("."===i){if(0===c.length||c.includes("."))throw new Error("非法的小数部分".concat(c.join("")));t()}else"Ee".includes(i)?(l=state.scientific,t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(i)||"space"===s&&/\S/.test(i)?t():(r(state.number),l=state.initial);break;case state.scientific:/\d/.test(i)?t():signed.includes(i)?(o=c.slice(1),a=c.at(-1),o.includes(i)||!/[Ee]/.test(a)?(r(state.scientific),l=state.initial):t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(i)||"space"===s&&/\S/.test(i)?t():(r(state.scientific),l=state.initial);break;case state.var:/[\w_.\[\]"']/.test(i)?t():(r(state.var),l=state.initial);break;default:throw new Error("状态错误")}return 0!==c.length&&(u.push({type:l,value:c.join("")}),c.length=0,l=state.initial),u}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,o.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(o.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(o,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var i=n.shift();if(is_operator(i))if("("===i)t.push(i);else if(")"===i){for(var o=t.pop();"("!==o&&0<t.length;)r.push(o),o=t.pop();if("("!==o)throw"error: unmatched ()"}else{for(;prioraty(i,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(i)}else r.push(i)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var m,f,h,t,c,b,a,s,l,u,p,r=T.prototype={constructor:T,toString:null,valueOf:null},g=new T(1),y=20,d=4,_=-7,v=21,$=-1e7,S=1e7,E=!1,i=1,w=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",O=!0;function T(e,t){var r,n,i,o,a,s,l,c,u=this;if(!(u instanceof T))return new T(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<$?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,a=e;10<=a;a/=10,o++);return void(S<o?u.c=u.e=null:(u.e=o,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):o<0&&(o=c.length)}else{if(intCheck(t,2,A.length,"Base"),10==t&&O)return x(u=new T(e),y+u.e+1,d);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,T.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=A.slice(0,t),o=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(o<a){o=l;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,a=-1,o=0;continue}return h(u,String(e),s,t)}s=!1,-1<(o=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&T.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((o=o-a-1)>S)u.c=u.e=null;else if(o<$)u.c=[u.e=0];else{if(u.e=o,u.c=[],a=(o+1)%LOG_BASE,o<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var i,o,a=[0],s=0,l=e.length;s<l;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),i=0;i<a.length;i++)r-1<a[i]&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}function G(e,t,r){var n,i,o,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((i=l*(o=e[s]%SQRT_BASE)+(n=c*o+(o=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*o,e[s]=i%r;return e=a?[a].concat(e):e}function k(e,t,r,n){var i,o;if(r!=n)o=n<r?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function B(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,a,s;if(null==r?r=d:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(o<=_||v<=o)?toExponential(s,o):toFixedPoint(s,o,"0");else if(r=(e=x(new T(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=o,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function o(e,t){for(var r,n=1,i=new T(e[0]);n<e.length;n++){if(!(r=new T(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function M(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<$?e.c=[e.e=0]:(e.e=r,e.c=t),e}function x(e,t,r,n){var i,o,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(i=1,s=f[0];10<=s;s/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,u=(l=f[c=0])/h[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(o%=LOG_BASE)-LOG_BASE+(i=1)}else{for(l=s=f[c],i=1;10<=s;s/=10,i++);u=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:l/h[i-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[i-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<o?0<a?l/h[i-a]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-o],f[c]=0<a?mathfloor(l/h[i-a]%h[a])*s:0),n)for(;;){if(0==c){for(o=1,a=f[0];10<=a;a/=10,o++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);o!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}e.e>S?e.c=e.e=null:e.e<$&&(e.c=[e.e=0])}return e}function P(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||v<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return T.clone=clone,T.ROUND_UP=0,T.ROUND_DOWN=1,T.ROUND_CEIL=2,T.ROUND_FLOOR=3,T.ROUND_HALF_UP=4,T.ROUND_HALF_DOWN=5,T.ROUND_HALF_EVEN=6,T.ROUND_HALF_CEIL=7,T.ROUND_HALF_FLOOR=8,T.EUCLID=9,T.config=T.set=function(e){var t,r;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX,t),y=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),d=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX,0,t),intCheck(r[1],0,MAX,t),_=r[0],v=r[1]):(intCheck(r,-MAX,MAX,t),_=-(v=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX,-1,t),intCheck(r[1],1,MAX,t),$=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);$=-(S=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw E=!r,Error(bignumberError+"crypto unavailable");E=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),w=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);C=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);O="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:d,EXPONENTIAL_AT:[_,v],RANGE:[$,S],CRYPTO:E,MODULO_MODE:i,POW_PRECISION:w,FORMAT:C,ALPHABET:A}},T.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!T.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&-MAX<=i&&i<=MAX&&i===mathfloor(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},T.maximum=T.max=function(){return o(arguments,r.lt)},T.minimum=T.min=function(){return o(arguments,r.gt)},T.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,a=0,s=[],l=new T(g);if(null==e?e=y:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),E)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)9e15<=(o=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(o%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw E=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);a<i;)9e15<=(o=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(o%1e14),a+=7);a=i/7}if(!E)for(;a<i;)(o=c())<9e15&&(s[a++]=o%1e14);for(i=s[--a],e%=LOG_BASE,i&&e&&(o=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(i/o)*o);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,o=s[0];10<=o;o/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),T.sum=function(){for(var e=1,t=arguments,r=new T(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=d;for(0<=p&&(l=w,w=0,e=e.replace(".",""),u=(h=new T(t)).pow(e.length-p),w=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,i?(o=A,b):(o=b,A))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=o.charAt(f[p++]));e=toFixedPoint(e,s,o.charAt(0))}return e},m=function(e,t,r,n,i){var o,a,s,l,c,u,f,h,p,g,_,m,b,y,d,v,$,S=e.s==t.s?1:-1,E=e.c,w=t.c;if(!(E&&E[0]&&w&&w[0]))return new T(e.s&&t.s&&(E?!w||E[0]!=w[0]:w)?E&&0==E[0]||!w?0*S:S/0:NaN);for(p=(h=new T(S)).c=[],S=r+(a=e.e-t.e)+1,i||(i=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;w[s]==(E[s]||0);s++);if(w[s]>(E[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=E.length,v=w.length,S+=2,1<(c=mathfloor(i/(w[s=0]+1)))&&(w=G(w,c,i),E=G(E,c,i),v=w.length,y=E.length),b=v,_=(g=E.slice(0,v)).length;_<v;g[_++]=0);$=w.slice(),$=[0].concat($),d=w[0],w[1]>=i/2&&d++;do{if(c=0,(o=k(w,g,v,_))<0){if(m=g[0],v!=_&&(m=m*i+(g[1]||0)),1<(c=mathfloor(m/d)))for(f=(u=G(w,c=i<=c?i-1:c,i)).length,_=g.length;1==k(u,g,f,_);)c--,B(u,v<f?$:w,f,i),f=u.length,o=1;else 0==c&&(o=c=1),f=(u=w.slice()).length;if(B(g,u=f<_?[0].concat(u):u,_,i),_=g.length,-1==o)for(;k(w,g,v,_)<1;)c++,B(g,v<_?$:w,_,i),_=g.length}else 0===o&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=E[b]||0:(g=[E[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(i==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);x(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(u.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(s,"$1").replace(l,"0.$1")),t!=o))return new T(o,i);if(T.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new T(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new T(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=d:intCheck(t,0,8),x(new T(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new T(e,t),y,d)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new T(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,a,s,l,c,u=this;if((e=new T(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+P(e));if(null!=t&&(t=new T(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new T(Math.pow(+P(u),a?e.s*(2-isOdd(e)):+P(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new T(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return o=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(o=1/o),new T(s?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(l=a?(r=new T(.5),s&&(e.s=1),isOdd(e)):(i=Math.abs(+P(e)))%2,c=new T(g);;){if(l){if(!(c=c.times(u)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;l=i%2}else if(x(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(i=+P(e)))break;l=i%2}u=u.times(u),o?u.c&&u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):o?x(c,w,d,void 0):c)},r.integerValue=function(e){var t=new T(this);return null==e?e=d:intCheck(e,0,8),x(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new T(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new T(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new T(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new T(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new T(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new T(e,t)).s,!s||!t)return new T(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new T(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new T(u[0]?a:3==d?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((i=(o=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){o=u[t]<f[t];break}if(o&&(i=u,u=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?M(e,u,c):(e.s=3==d?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new T(e,t),!n.c||!e.s||e.c&&!e.c[0]?new T(NaN):!e.c||n.c&&!n.c[0]?new T(n):(9==i?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new T(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),i=n+(o=s);n<i;)r=((l=u*(l=m[--o]%g)+(a=f*l+(c=m[o]/g|0)*u)%g*g+h[i]+r)/p|0)+(a/g|0)+f*c,h[i--]=l%p;h[i]=r}return r?++t:h.splice(0,1),M(e,h,t)},r.negated=function(){var e=new T(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new T(e,t)).s,!i||!t)return new T(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!o||!a){if(!s||!l)return new T(i/0);if(!s[0]||!l[0])return l[0]?e:new T(s[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),s=s.slice(),i=o-a){for((r=0<i?(a=o,l):(i=-i,s)).reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+l[t]+i)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return i&&(s=[i].concat(s),++a),M(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=d:intCheck(t,0,8),x(new T(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,s=o.s,l=o.e,c=y+4,u=new T("0.5");if(1!==s||!a||!a[0])return new T(!s||s<0&&(!a||a[0])?NaN:a?o:1/0);if((r=0==(s=Math.sqrt(+P(o)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new T(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new T(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(i=r,r=u.times(i.plus(m(o,i,c,1))),coeffToString(i.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(x(r,r.e+y+2,1),e=!r.times(r).eq(o));break}if(!n&&(x(i,i.e+y+2,0),i.times(i).eq(o))){r=i;break}c+=4,s+=4,n=1}return x(r,r.e+y+1,d,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=C;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(o&&(n=i,i=o,u-=o=n),0<i&&0<u){for(s=c.substr(0,n=u%i||i);n<u;n+=i)s+=a+c.substr(n,i);0<o&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new T(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+P(s));if(!h)return new T(f);for(t=new T(g),c=r=new T(g),n=l=new T(g),h=coeffToString(h),o=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=o%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<o?t:c:s,a=S,S=1/0,s=new T(h),l.c[0]=0;u=m(s,t,0,1),1!=(i=r.plus(u.times(n))).comparedTo(e);)r=n,n=i,c=l.plus(u.times(i=c)),l=i,t=s.minus(u.times(i=t)),s=i;return i=m(e.minus(r),n,0,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=f.s,h=m(c,n,o*=2,d).minus(f).abs().comparedTo(m(l,r,o,d).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+P(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=_||v<=i?toExponential(coeffToString(r.c),i):toFixedPoint(coeffToString(r.c),i,"0"):10===e&&O?toFixedPoint(coeffToString((r=x(new T(r),y+i+1,d)).c),r.e,"0"):(intCheck(e,2,A.length,"Base"),f(toFixedPoint(coeffToString(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return P(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&T.set(e),T}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=i.length)<(t=o.length)?e:t,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof i&&!BigNumber.isBigNumber(i)){if(!is_str_number(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new BigNumber(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=BigNumber.isBigNumber(o)?o:BigNumber(o)).isNaN())throw new Error("计算结果为NaN");return o}function decimal_round(i,o,a,s,e){var l=i,c=o,u=o.length,t={"~-":function(){c=o.slice(0,"<"===a?s-1:s)},"~+":function(){var e,t="<"===a?s-1:s;u<=t||0===u||(e=o.slice(0,t),0!=+o.slice(t,u)&&(e=(+e+1).toString()).length>t?(c=e.slice(1,e.length),l=(+l+1).toString()):c=e)},"~5":function(){var e,t;0===u||(c=o.slice(0,e="<"===a?s-1:s),t=+o[e],Number.isNaN(t))||5<=t&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())},"~6":function(){var e,t,r,n;0!==u&&(t=+o[e="<"===a?s-1:s],r=""===(r=o.slice(+e+1,o.length))?0:parseInt(r),n=0===e?+i[i.length-1]:+o[e-1],c=o.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())}};return"<="===a?c=u<=s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"<"===a?c=u<s?o:(t[e]&&t[e](),c.replace(/0+$/,"")):"="===a?u<s?c=o+"0".repeat(s-u):s<u&&t[e]&&t[e]():">="===a?u<s&&(c=o+"0".repeat(s-u)):">"===a&&u<=s&&(c=o+"0".repeat(s-u+1)),{int_part:l,dec_part:c}}function format(e,t,r){var n,i,o,a,s,l,c,u,f,h="";return BigNumber.isBigNumber(e)?h=e.toFixed():"string"!=typeof e&&(h=e.toString()),"undefined"===h||"NaN"===h?null:(i=n=null,a=o=!1,f=u=c=l=!(s="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)f=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)a=!0;else if("round"===t)s=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");u=!0}}),l?(e=BigNumber(h).toExponential(),a&&!e.startsWith("-")?"+"+e:e):c?(t=BigNumber(h).toFraction().map(function(e){return e.toFixed()}).join("/"),a&&!t.startsWith("-")?"+"+t:t):(u&&(h=BigNumber(h).times(100).toFixed()),n&&(t=(e=decimal_round(t=(e=h.split("."))[0],1===e.length?"":e[1],i,+n,s)).int_part,h=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),o&&(f=!1,h=1<(t=h.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),a&&(f=!1,h.startsWith("-")||(h="+"+h)),u&&(f=!1,h+="%"),f&&!r?+h:h))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),i=get_1(n,"options._error",void 0),o=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(i))try{c=tokenizer(n.expr,a)}catch(e){return i}else c=tokenizer(n.expr,a);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(i))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return i}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),s=null;if(not_undefined(i))try{s=eval_postfix(u)}catch(e){return i}else s=eval_postfix(u);if("Infinity"!==(s=not_null(n.fmt)?format(s,n.fmt,a):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(not_undefined(i))return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;export{calc,fmt,version};
|