test-evernode-js-client
Version:
Javascript client library for Evernode.
1 lines • 916 kB
JavaScript
(()=>{var __webpack_modules__={1758:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=r(2361);const a=n(r(4085));const o=n(r(1705));const s=a.default("agent-base");function isAgent(e){return Boolean(e)&&typeof e.addRequest==="function"}function isSecureEndpoint(){const{stack:e}=new Error;if(typeof e!=="string")return false;return e.split("\n").some((e=>e.indexOf("(https.js:")!==-1||e.indexOf("node:https:")!==-1))}function createAgent(e,t){return new createAgent.Agent(e,t)}(function(e){class Agent extends i.EventEmitter{constructor(e,t){super();let r=t;if(typeof e==="function"){this.callback=e}else if(e){r=e}this.timeout=null;if(r&&typeof r.timeout==="number"){this.timeout=r.timeout}this.maxFreeSockets=1;this.maxSockets=1;this.maxTotalSockets=Infinity;this.sockets={};this.freeSockets={};this.requests={};this.options={}}get defaultPort(){if(typeof this.explicitDefaultPort==="number"){return this.explicitDefaultPort}return isSecureEndpoint()?443:80}set defaultPort(e){this.explicitDefaultPort=e}get protocol(){if(typeof this.explicitProtocol==="string"){return this.explicitProtocol}return isSecureEndpoint()?"https:":"http:"}set protocol(e){this.explicitProtocol=e}callback(e,t,r){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(e,t){const r=Object.assign({},t);if(typeof r.secureEndpoint!=="boolean"){r.secureEndpoint=isSecureEndpoint()}if(r.host==null){r.host="localhost"}if(r.port==null){r.port=r.secureEndpoint?443:80}if(r.protocol==null){r.protocol=r.secureEndpoint?"https:":"http:"}if(r.host&&r.path){delete r.path}delete r.agent;delete r.hostname;delete r._defaultAgent;delete r.defaultPort;delete r.createConnection;e._last=true;e.shouldKeepAlive=false;let n=false;let i=null;const a=r.timeout||this.timeout;const onerror=t=>{if(e._hadError)return;e.emit("error",t);e._hadError=true};const ontimeout=()=>{i=null;n=true;const e=new Error(`A "socket" was not created for HTTP request before ${a}ms`);e.code="ETIMEOUT";onerror(e)};const callbackError=e=>{if(n)return;if(i!==null){clearTimeout(i);i=null}onerror(e)};const onsocket=t=>{if(n)return;if(i!=null){clearTimeout(i);i=null}if(isAgent(t)){s("Callback returned another Agent instance %o",t.constructor.name);t.addRequest(e,r);return}if(t){t.once("free",(()=>{this.freeSocket(t,r)}));e.onSocket(t);return}const a=new Error(`no Duplex stream was returned to agent-base for \`${e.method} ${e.path}\``);onerror(a)};if(typeof this.callback!=="function"){onerror(new Error("`callback` is not defined"));return}if(!this.promisifiedCallback){if(this.callback.length>=3){s("Converting legacy callback function to promise");this.promisifiedCallback=o.default(this.callback)}else{this.promisifiedCallback=this.callback}}if(typeof a==="number"&&a>0){i=setTimeout(ontimeout,a)}if("port"in r&&typeof r.port!=="number"){r.port=Number(r.port)}try{s("Resolving socket for %o request: %o",r.protocol,`${e.method} ${e.path}`);Promise.resolve(this.promisifiedCallback(e,r)).then(onsocket,callbackError)}catch(e){Promise.reject(e).catch(callbackError)}}freeSocket(e,t){s("Freeing socket %o %o",e.constructor.name,t);e.destroy()}destroy(){s("Destroying agent %o",this.constructor.name)}}e.Agent=Agent;e.prototype=e.Agent.prototype})(createAgent||(createAgent={}));e.exports=createAgent},1705:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function promisify(e){return function(t,r){return new Promise(((n,i)=>{e.call(this,t,r,((e,t)=>{if(e){i(e)}else{n(t)}}))}))}}t["default"]=promisify},3358:(e,t,r)=>{"use strict";var n=r(6621).Buffer;function base(e){if(e.length>=255){throw new TypeError("Alphabet too long")}var t=new Uint8Array(256);for(var r=0;r<t.length;r++){t[r]=255}for(var i=0;i<e.length;i++){var a=e.charAt(i);var o=a.charCodeAt(0);if(t[o]!==255){throw new TypeError(a+" is ambiguous")}t[o]=i}var s=e.length;var u=e.charAt(0);var c=Math.log(s)/Math.log(256);var l=Math.log(256)/Math.log(s);function encode(t){if(Array.isArray(t)||t instanceof Uint8Array){t=n.from(t)}if(!n.isBuffer(t)){throw new TypeError("Expected Buffer")}if(t.length===0){return""}var r=0;var i=0;var a=0;var o=t.length;while(a!==o&&t[a]===0){a++;r++}var c=(o-a)*l+1>>>0;var d=new Uint8Array(c);while(a!==o){var h=t[a];var p=0;for(var m=c-1;(h!==0||p<i)&&m!==-1;m--,p++){h+=256*d[m]>>>0;d[m]=h%s>>>0;h=h/s>>>0}if(h!==0){throw new Error("Non-zero carry")}i=p;a++}var g=c-i;while(g!==c&&d[g]===0){g++}var v=u.repeat(r);for(;g<c;++g){v+=e.charAt(d[g])}return v}function decodeUnsafe(e){if(typeof e!=="string"){throw new TypeError("Expected String")}if(e.length===0){return n.alloc(0)}var r=0;var i=0;var a=0;while(e[r]===u){i++;r++}var o=(e.length-r)*c+1>>>0;var l=new Uint8Array(o);while(e[r]){var d=t[e.charCodeAt(r)];if(d===255){return}var h=0;for(var p=o-1;(d!==0||h<a)&&p!==-1;p--,h++){d+=s*l[p]>>>0;l[p]=d%256>>>0;d=d/256>>>0}if(d!==0){throw new Error("Non-zero carry")}a=h;r++}var m=o-a;while(m!==o&&l[m]===0){m++}var g=n.allocUnsafe(i+(o-m));g.fill(0,0,i);var v=i;while(m!==o){g[v++]=l[m++]}return g}function decode(e){var t=decodeUnsafe(e);if(t){return t}throw new Error("Non-base"+s+" character")}return{encode:encode,decodeUnsafe:decodeUnsafe,decode:decode}}e.exports=base},3325:(e,t)=>{"use strict";t.byteLength=byteLength;t.toByteArray=toByteArray;t.fromByteArray=fromByteArray;var r=[];var n=[];var i=typeof Uint8Array!=="undefined"?Uint8Array:Array;var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var o=0,s=a.length;o<s;++o){r[o]=a[o];n[a.charCodeAt(o)]=o}n["-".charCodeAt(0)]=62;n["_".charCodeAt(0)]=63;function getLens(e){var t=e.length;if(t%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var r=e.indexOf("=");if(r===-1)r=t;var n=r===t?0:4-r%4;return[r,n]}function byteLength(e){var t=getLens(e);var r=t[0];var n=t[1];return(r+n)*3/4-n}function _byteLength(e,t,r){return(t+r)*3/4-r}function toByteArray(e){var t;var r=getLens(e);var a=r[0];var o=r[1];var s=new i(_byteLength(e,a,o));var u=0;var c=o>0?a-4:a;var l;for(l=0;l<c;l+=4){t=n[e.charCodeAt(l)]<<18|n[e.charCodeAt(l+1)]<<12|n[e.charCodeAt(l+2)]<<6|n[e.charCodeAt(l+3)];s[u++]=t>>16&255;s[u++]=t>>8&255;s[u++]=t&255}if(o===2){t=n[e.charCodeAt(l)]<<2|n[e.charCodeAt(l+1)]>>4;s[u++]=t&255}if(o===1){t=n[e.charCodeAt(l)]<<10|n[e.charCodeAt(l+1)]<<4|n[e.charCodeAt(l+2)]>>2;s[u++]=t>>8&255;s[u++]=t&255}return s}function tripletToBase64(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[e&63]}function encodeChunk(e,t,r){var n;var i=[];for(var a=t;a<r;a+=3){n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255);i.push(tripletToBase64(n))}return i.join("")}function fromByteArray(e){var t;var n=e.length;var i=n%3;var a=[];var o=16383;for(var s=0,u=n-i;s<u;s+=o){a.push(encodeChunk(e,s,s+o>u?u:s+o))}if(i===1){t=e[n-1];a.push(r[t>>2]+r[t<<4&63]+"==")}else if(i===2){t=(e[n-2]<<8)+e[n-1];a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")}return a.join("")}},4922:(e,t,r)=>{e=r.nmd(e);var n=function(e){"use strict";var t=1e7,r=7,i=9007199254740992,a=smallToArray(i),o="0123456789abcdefghijklmnopqrstuvwxyz";var s=typeof BigInt==="function";function Integer(e,t,r,n){if(typeof e==="undefined")return Integer[0];if(typeof t!=="undefined")return+t===10&&!r?parseValue(e):parseBase(e,t,r,n);return parseValue(e)}function BigInteger(e,t){this.value=e;this.sign=t;this.isSmall=false}BigInteger.prototype=Object.create(Integer.prototype);function SmallInteger(e){this.value=e;this.sign=e<0;this.isSmall=true}SmallInteger.prototype=Object.create(Integer.prototype);function NativeBigInt(e){this.value=e}NativeBigInt.prototype=Object.create(Integer.prototype);function isPrecise(e){return-i<e&&e<i}function smallToArray(e){if(e<1e7)return[e];if(e<1e14)return[e%1e7,Math.floor(e/1e7)];return[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function arrayToSmall(e){trim(e);var r=e.length;if(r<4&&compareAbs(e,a)<0){switch(r){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*t;default:return e[0]+(e[1]+e[2]*t)*t}}return e}function trim(e){var t=e.length;while(e[--t]===0);e.length=t+1}function createArray(e){var t=new Array(e);var r=-1;while(++r<e){t[r]=0}return t}function truncate(e){if(e>0)return Math.floor(e);return Math.ceil(e)}function add(e,r){var n=e.length,i=r.length,a=new Array(n),o=0,s=t,u,c;for(c=0;c<i;c++){u=e[c]+r[c]+o;o=u>=s?1:0;a[c]=u-o*s}while(c<n){u=e[c]+o;o=u===s?1:0;a[c++]=u-o*s}if(o>0)a.push(o);return a}function addAny(e,t){if(e.length>=t.length)return add(e,t);return add(t,e)}function addSmall(e,r){var n=e.length,i=new Array(n),a=t,o,s;for(s=0;s<n;s++){o=e[s]-a+r;r=Math.floor(o/a);i[s]=o-r*a;r+=1}while(r>0){i[s++]=r%a;r=Math.floor(r/a)}return i}BigInteger.prototype.add=function(e){var t=parseValue(e);if(this.sign!==t.sign){return this.subtract(t.negate())}var r=this.value,n=t.value;if(t.isSmall){return new BigInteger(addSmall(r,Math.abs(n)),this.sign)}return new BigInteger(addAny(r,n),this.sign)};BigInteger.prototype.plus=BigInteger.prototype.add;SmallInteger.prototype.add=function(e){var t=parseValue(e);var r=this.value;if(r<0!==t.sign){return this.subtract(t.negate())}var n=t.value;if(t.isSmall){if(isPrecise(r+n))return new SmallInteger(r+n);n=smallToArray(Math.abs(n))}return new BigInteger(addSmall(n,Math.abs(r)),r<0)};SmallInteger.prototype.plus=SmallInteger.prototype.add;NativeBigInt.prototype.add=function(e){return new NativeBigInt(this.value+parseValue(e).value)};NativeBigInt.prototype.plus=NativeBigInt.prototype.add;function subtract(e,r){var n=e.length,i=r.length,a=new Array(n),o=0,s=t,u,c;for(u=0;u<i;u++){c=e[u]-o-r[u];if(c<0){c+=s;o=1}else o=0;a[u]=c}for(u=i;u<n;u++){c=e[u]-o;if(c<0)c+=s;else{a[u++]=c;break}a[u]=c}for(;u<n;u++){a[u]=e[u]}trim(a);return a}function subtractAny(e,t,r){var n;if(compareAbs(e,t)>=0){n=subtract(e,t)}else{n=subtract(t,e);r=!r}n=arrayToSmall(n);if(typeof n==="number"){if(r)n=-n;return new SmallInteger(n)}return new BigInteger(n,r)}function subtractSmall(e,r,n){var i=e.length,a=new Array(i),o=-r,s=t,u,c;for(u=0;u<i;u++){c=e[u]+o;o=Math.floor(c/s);c%=s;a[u]=c<0?c+s:c}a=arrayToSmall(a);if(typeof a==="number"){if(n)a=-a;return new SmallInteger(a)}return new BigInteger(a,n)}BigInteger.prototype.subtract=function(e){var t=parseValue(e);if(this.sign!==t.sign){return this.add(t.negate())}var r=this.value,n=t.value;if(t.isSmall)return subtractSmall(r,Math.abs(n),this.sign);return subtractAny(r,n,this.sign)};BigInteger.prototype.minus=BigInteger.prototype.subtract;SmallInteger.prototype.subtract=function(e){var t=parseValue(e);var r=this.value;if(r<0!==t.sign){return this.add(t.negate())}var n=t.value;if(t.isSmall){return new SmallInteger(r-n)}return subtractSmall(n,Math.abs(r),r>=0)};SmallInteger.prototype.minus=SmallInteger.prototype.subtract;NativeBigInt.prototype.subtract=function(e){return new NativeBigInt(this.value-parseValue(e).value)};NativeBigInt.prototype.minus=NativeBigInt.prototype.subtract;BigInteger.prototype.negate=function(){return new BigInteger(this.value,!this.sign)};SmallInteger.prototype.negate=function(){var e=this.sign;var t=new SmallInteger(-this.value);t.sign=!e;return t};NativeBigInt.prototype.negate=function(){return new NativeBigInt(-this.value)};BigInteger.prototype.abs=function(){return new BigInteger(this.value,false)};SmallInteger.prototype.abs=function(){return new SmallInteger(Math.abs(this.value))};NativeBigInt.prototype.abs=function(){return new NativeBigInt(this.value>=0?this.value:-this.value)};function multiplyLong(e,r){var n=e.length,i=r.length,a=n+i,o=createArray(a),s=t,u,c,l,d,h;for(l=0;l<n;++l){d=e[l];for(var p=0;p<i;++p){h=r[p];u=d*h+o[l+p];c=Math.floor(u/s);o[l+p]=u-c*s;o[l+p+1]+=c}}trim(o);return o}function multiplySmall(e,r){var n=e.length,i=new Array(n),a=t,o=0,s,u;for(u=0;u<n;u++){s=e[u]*r+o;o=Math.floor(s/a);i[u]=s-o*a}while(o>0){i[u++]=o%a;o=Math.floor(o/a)}return i}function shiftLeft(e,t){var r=[];while(t-- >0)r.push(0);return r.concat(e)}function multiplyKaratsuba(e,t){var r=Math.max(e.length,t.length);if(r<=30)return multiplyLong(e,t);r=Math.ceil(r/2);var n=e.slice(r),i=e.slice(0,r),a=t.slice(r),o=t.slice(0,r);var s=multiplyKaratsuba(i,o),u=multiplyKaratsuba(n,a),c=multiplyKaratsuba(addAny(i,n),addAny(o,a));var l=addAny(addAny(s,shiftLeft(subtract(subtract(c,s),u),r)),shiftLeft(u,2*r));trim(l);return l}function useKaratsuba(e,t){return-.012*e-.012*t+15e-6*e*t>0}BigInteger.prototype.multiply=function(e){var r=parseValue(e),n=this.value,i=r.value,a=this.sign!==r.sign,o;if(r.isSmall){if(i===0)return Integer[0];if(i===1)return this;if(i===-1)return this.negate();o=Math.abs(i);if(o<t){return new BigInteger(multiplySmall(n,o),a)}i=smallToArray(o)}if(useKaratsuba(n.length,i.length))return new BigInteger(multiplyKaratsuba(n,i),a);return new BigInteger(multiplyLong(n,i),a)};BigInteger.prototype.times=BigInteger.prototype.multiply;function multiplySmallAndArray(e,r,n){if(e<t){return new BigInteger(multiplySmall(r,e),n)}return new BigInteger(multiplyLong(r,smallToArray(e)),n)}SmallInteger.prototype._multiplyBySmall=function(e){if(isPrecise(e.value*this.value)){return new SmallInteger(e.value*this.value)}return multiplySmallAndArray(Math.abs(e.value),smallToArray(Math.abs(this.value)),this.sign!==e.sign)};BigInteger.prototype._multiplyBySmall=function(e){if(e.value===0)return Integer[0];if(e.value===1)return this;if(e.value===-1)return this.negate();return multiplySmallAndArray(Math.abs(e.value),this.value,this.sign!==e.sign)};SmallInteger.prototype.multiply=function(e){return parseValue(e)._multiplyBySmall(this)};SmallInteger.prototype.times=SmallInteger.prototype.multiply;NativeBigInt.prototype.multiply=function(e){return new NativeBigInt(this.value*parseValue(e).value)};NativeBigInt.prototype.times=NativeBigInt.prototype.multiply;function square(e){var r=e.length,n=createArray(r+r),i=t,a,o,s,u,c;for(s=0;s<r;s++){u=e[s];o=0-u*u;for(var l=s;l<r;l++){c=e[l];a=2*(u*c)+n[s+l]+o;o=Math.floor(a/i);n[s+l]=a-o*i}n[s+r]=o}trim(n);return n}BigInteger.prototype.square=function(){return new BigInteger(square(this.value),false)};SmallInteger.prototype.square=function(){var e=this.value*this.value;if(isPrecise(e))return new SmallInteger(e);return new BigInteger(square(smallToArray(Math.abs(this.value))),false)};NativeBigInt.prototype.square=function(e){return new NativeBigInt(this.value*this.value)};function divMod1(e,r){var n=e.length,i=r.length,a=t,o=createArray(r.length),s=r[i-1],u=Math.ceil(a/(2*s)),c=multiplySmall(e,u),l=multiplySmall(r,u),d,h,p,m,g,v,b;if(c.length<=n)c.push(0);l.push(0);s=l[i-1];for(h=n-i;h>=0;h--){d=a-1;if(c[h+i]!==s){d=Math.floor((c[h+i]*a+c[h+i-1])/s)}p=0;m=0;v=l.length;for(g=0;g<v;g++){p+=d*l[g];b=Math.floor(p/a);m+=c[h+g]-(p-b*a);p=b;if(m<0){c[h+g]=m+a;m=-1}else{c[h+g]=m;m=0}}while(m!==0){d-=1;p=0;for(g=0;g<v;g++){p+=c[h+g]-a+l[g];if(p<0){c[h+g]=p+a;p=0}else{c[h+g]=p;p=1}}m+=p}o[h]=d}c=divModSmall(c,u)[0];return[arrayToSmall(o),arrayToSmall(c)]}function divMod2(e,r){var n=e.length,i=r.length,a=[],o=[],s=t,u,c,l,d,h;while(n){o.unshift(e[--n]);trim(o);if(compareAbs(o,r)<0){a.push(0);continue}c=o.length;l=o[c-1]*s+o[c-2];d=r[i-1]*s+r[i-2];if(c>i){l=(l+1)*s}u=Math.ceil(l/d);do{h=multiplySmall(r,u);if(compareAbs(h,o)<=0)break;u--}while(u);a.push(u);o=subtract(o,h)}a.reverse();return[arrayToSmall(a),arrayToSmall(o)]}function divModSmall(e,r){var n=e.length,i=createArray(n),a=t,o,s,u,c;u=0;for(o=n-1;o>=0;--o){c=u*a+e[o];s=truncate(c/r);u=c-s*r;i[o]=s|0}return[i,u|0]}function divModAny(e,r){var n,i=parseValue(r);if(s){return[new NativeBigInt(e.value/i.value),new NativeBigInt(e.value%i.value)]}var a=e.value,o=i.value;var u;if(o===0)throw new Error("Cannot divide by zero");if(e.isSmall){if(i.isSmall){return[new SmallInteger(truncate(a/o)),new SmallInteger(a%o)]}return[Integer[0],e]}if(i.isSmall){if(o===1)return[e,Integer[0]];if(o==-1)return[e.negate(),Integer[0]];var c=Math.abs(o);if(c<t){n=divModSmall(a,c);u=arrayToSmall(n[0]);var l=n[1];if(e.sign)l=-l;if(typeof u==="number"){if(e.sign!==i.sign)u=-u;return[new SmallInteger(u),new SmallInteger(l)]}return[new BigInteger(u,e.sign!==i.sign),new SmallInteger(l)]}o=smallToArray(c)}var d=compareAbs(a,o);if(d===-1)return[Integer[0],e];if(d===0)return[Integer[e.sign===i.sign?1:-1],Integer[0]];if(a.length+o.length<=200)n=divMod1(a,o);else n=divMod2(a,o);u=n[0];var h=e.sign!==i.sign,p=n[1],m=e.sign;if(typeof u==="number"){if(h)u=-u;u=new SmallInteger(u)}else u=new BigInteger(u,h);if(typeof p==="number"){if(m)p=-p;p=new SmallInteger(p)}else p=new BigInteger(p,m);return[u,p]}BigInteger.prototype.divmod=function(e){var t=divModAny(this,e);return{quotient:t[0],remainder:t[1]}};NativeBigInt.prototype.divmod=SmallInteger.prototype.divmod=BigInteger.prototype.divmod;BigInteger.prototype.divide=function(e){return divModAny(this,e)[0]};NativeBigInt.prototype.over=NativeBigInt.prototype.divide=function(e){return new NativeBigInt(this.value/parseValue(e).value)};SmallInteger.prototype.over=SmallInteger.prototype.divide=BigInteger.prototype.over=BigInteger.prototype.divide;BigInteger.prototype.mod=function(e){return divModAny(this,e)[1]};NativeBigInt.prototype.mod=NativeBigInt.prototype.remainder=function(e){return new NativeBigInt(this.value%parseValue(e).value)};SmallInteger.prototype.remainder=SmallInteger.prototype.mod=BigInteger.prototype.remainder=BigInteger.prototype.mod;BigInteger.prototype.pow=function(e){var t=parseValue(e),r=this.value,n=t.value,i,a,o;if(n===0)return Integer[1];if(r===0)return Integer[0];if(r===1)return Integer[1];if(r===-1)return t.isEven()?Integer[1]:Integer[-1];if(t.sign){return Integer[0]}if(!t.isSmall)throw new Error("The exponent "+t.toString()+" is too large.");if(this.isSmall){if(isPrecise(i=Math.pow(r,n)))return new SmallInteger(truncate(i))}a=this;o=Integer[1];while(true){if(n&1===1){o=o.times(a);--n}if(n===0)break;n/=2;a=a.square()}return o};SmallInteger.prototype.pow=BigInteger.prototype.pow;NativeBigInt.prototype.pow=function(e){var t=parseValue(e);var r=this.value,n=t.value;var i=BigInt(0),a=BigInt(1),o=BigInt(2);if(n===i)return Integer[1];if(r===i)return Integer[0];if(r===a)return Integer[1];if(r===BigInt(-1))return t.isEven()?Integer[1]:Integer[-1];if(t.isNegative())return new NativeBigInt(i);var s=this;var u=Integer[1];while(true){if((n&a)===a){u=u.times(s);--n}if(n===i)break;n/=o;s=s.square()}return u};BigInteger.prototype.modPow=function(e,t){e=parseValue(e);t=parseValue(t);if(t.isZero())throw new Error("Cannot take modPow with modulus 0");var r=Integer[1],n=this.mod(t);if(e.isNegative()){e=e.multiply(Integer[-1]);n=n.modInv(t)}while(e.isPositive()){if(n.isZero())return Integer[0];if(e.isOdd())r=r.multiply(n).mod(t);e=e.divide(2);n=n.square().mod(t)}return r};NativeBigInt.prototype.modPow=SmallInteger.prototype.modPow=BigInteger.prototype.modPow;function compareAbs(e,t){if(e.length!==t.length){return e.length>t.length?1:-1}for(var r=e.length-1;r>=0;r--){if(e[r]!==t[r])return e[r]>t[r]?1:-1}return 0}BigInteger.prototype.compareAbs=function(e){var t=parseValue(e),r=this.value,n=t.value;if(t.isSmall)return 1;return compareAbs(r,n)};SmallInteger.prototype.compareAbs=function(e){var t=parseValue(e),r=Math.abs(this.value),n=t.value;if(t.isSmall){n=Math.abs(n);return r===n?0:r>n?1:-1}return-1};NativeBigInt.prototype.compareAbs=function(e){var t=this.value;var r=parseValue(e).value;t=t>=0?t:-t;r=r>=0?r:-r;return t===r?0:t>r?1:-1};BigInteger.prototype.compare=function(e){if(e===Infinity){return-1}if(e===-Infinity){return 1}var t=parseValue(e),r=this.value,n=t.value;if(this.sign!==t.sign){return t.sign?1:-1}if(t.isSmall){return this.sign?-1:1}return compareAbs(r,n)*(this.sign?-1:1)};BigInteger.prototype.compareTo=BigInteger.prototype.compare;SmallInteger.prototype.compare=function(e){if(e===Infinity){return-1}if(e===-Infinity){return 1}var t=parseValue(e),r=this.value,n=t.value;if(t.isSmall){return r==n?0:r>n?1:-1}if(r<0!==t.sign){return r<0?-1:1}return r<0?1:-1};SmallInteger.prototype.compareTo=SmallInteger.prototype.compare;NativeBigInt.prototype.compare=function(e){if(e===Infinity){return-1}if(e===-Infinity){return 1}var t=this.value;var r=parseValue(e).value;return t===r?0:t>r?1:-1};NativeBigInt.prototype.compareTo=NativeBigInt.prototype.compare;BigInteger.prototype.equals=function(e){return this.compare(e)===0};NativeBigInt.prototype.eq=NativeBigInt.prototype.equals=SmallInteger.prototype.eq=SmallInteger.prototype.equals=BigInteger.prototype.eq=BigInteger.prototype.equals;BigInteger.prototype.notEquals=function(e){return this.compare(e)!==0};NativeBigInt.prototype.neq=NativeBigInt.prototype.notEquals=SmallInteger.prototype.neq=SmallInteger.prototype.notEquals=BigInteger.prototype.neq=BigInteger.prototype.notEquals;BigInteger.prototype.greater=function(e){return this.compare(e)>0};NativeBigInt.prototype.gt=NativeBigInt.prototype.greater=SmallInteger.prototype.gt=SmallInteger.prototype.greater=BigInteger.prototype.gt=BigInteger.prototype.greater;BigInteger.prototype.lesser=function(e){return this.compare(e)<0};NativeBigInt.prototype.lt=NativeBigInt.prototype.lesser=SmallInteger.prototype.lt=SmallInteger.prototype.lesser=BigInteger.prototype.lt=BigInteger.prototype.lesser;BigInteger.prototype.greaterOrEquals=function(e){return this.compare(e)>=0};NativeBigInt.prototype.geq=NativeBigInt.prototype.greaterOrEquals=SmallInteger.prototype.geq=SmallInteger.prototype.greaterOrEquals=BigInteger.prototype.geq=BigInteger.prototype.greaterOrEquals;BigInteger.prototype.lesserOrEquals=function(e){return this.compare(e)<=0};NativeBigInt.prototype.leq=NativeBigInt.prototype.lesserOrEquals=SmallInteger.prototype.leq=SmallInteger.prototype.lesserOrEquals=BigInteger.prototype.leq=BigInteger.prototype.lesserOrEquals;BigInteger.prototype.isEven=function(){return(this.value[0]&1)===0};SmallInteger.prototype.isEven=function(){return(this.value&1)===0};NativeBigInt.prototype.isEven=function(){return(this.value&BigInt(1))===BigInt(0)};BigInteger.prototype.isOdd=function(){return(this.value[0]&1)===1};SmallInteger.prototype.isOdd=function(){return(this.value&1)===1};NativeBigInt.prototype.isOdd=function(){return(this.value&BigInt(1))===BigInt(1)};BigInteger.prototype.isPositive=function(){return!this.sign};SmallInteger.prototype.isPositive=function(){return this.value>0};NativeBigInt.prototype.isPositive=SmallInteger.prototype.isPositive;BigInteger.prototype.isNegative=function(){return this.sign};SmallInteger.prototype.isNegative=function(){return this.value<0};NativeBigInt.prototype.isNegative=SmallInteger.prototype.isNegative;BigInteger.prototype.isUnit=function(){return false};SmallInteger.prototype.isUnit=function(){return Math.abs(this.value)===1};NativeBigInt.prototype.isUnit=function(){return this.abs().value===BigInt(1)};BigInteger.prototype.isZero=function(){return false};SmallInteger.prototype.isZero=function(){return this.value===0};NativeBigInt.prototype.isZero=function(){return this.value===BigInt(0)};BigInteger.prototype.isDivisibleBy=function(e){var t=parseValue(e);if(t.isZero())return false;if(t.isUnit())return true;if(t.compareAbs(2)===0)return this.isEven();return this.mod(t).isZero()};NativeBigInt.prototype.isDivisibleBy=SmallInteger.prototype.isDivisibleBy=BigInteger.prototype.isDivisibleBy;function isBasicPrime(e){var t=e.abs();if(t.isUnit())return false;if(t.equals(2)||t.equals(3)||t.equals(5))return true;if(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))return false;if(t.lesser(49))return true}function millerRabinTest(e,t){var r=e.prev(),i=r,a=0,o,s,u,c;while(i.isEven())i=i.divide(2),a++;e:for(u=0;u<t.length;u++){if(e.lesser(t[u]))continue;c=n(t[u]).modPow(i,e);if(c.isUnit()||c.equals(r))continue;for(o=a-1;o!=0;o--){c=c.square().mod(e);if(c.isUnit())return false;if(c.equals(r))continue e}return false}return true}BigInteger.prototype.isPrime=function(t){var r=isBasicPrime(this);if(r!==e)return r;var i=this.abs();var a=i.bitLength();if(a<=64)return millerRabinTest(i,[2,3,5,7,11,13,17,19,23,29,31,37]);var o=Math.log(2)*a.toJSNumber();var s=Math.ceil(t===true?2*Math.pow(o,2):o);for(var u=[],c=0;c<s;c++){u.push(n(c+2))}return millerRabinTest(i,u)};NativeBigInt.prototype.isPrime=SmallInteger.prototype.isPrime=BigInteger.prototype.isPrime;BigInteger.prototype.isProbablePrime=function(t,r){var i=isBasicPrime(this);if(i!==e)return i;var a=this.abs();var o=t===e?5:t;for(var s=[],u=0;u<o;u++){s.push(n.randBetween(2,a.minus(2),r))}return millerRabinTest(a,s)};NativeBigInt.prototype.isProbablePrime=SmallInteger.prototype.isProbablePrime=BigInteger.prototype.isProbablePrime;BigInteger.prototype.modInv=function(e){var t=n.zero,r=n.one,i=parseValue(e),a=this.abs(),o,s,u;while(!a.isZero()){o=i.divide(a);s=t;u=i;t=r;i=a;r=s.subtract(o.multiply(r));a=u.subtract(o.multiply(a))}if(!i.isUnit())throw new Error(this.toString()+" and "+e.toString()+" are not co-prime");if(t.compare(0)===-1){t=t.add(e)}if(this.isNegative()){return t.negate()}return t};NativeBigInt.prototype.modInv=SmallInteger.prototype.modInv=BigInteger.prototype.modInv;BigInteger.prototype.next=function(){var e=this.value;if(this.sign){return subtractSmall(e,1,this.sign)}return new BigInteger(addSmall(e,1),this.sign)};SmallInteger.prototype.next=function(){var e=this.value;if(e+1<i)return new SmallInteger(e+1);return new BigInteger(a,false)};NativeBigInt.prototype.next=function(){return new NativeBigInt(this.value+BigInt(1))};BigInteger.prototype.prev=function(){var e=this.value;if(this.sign){return new BigInteger(addSmall(e,1),true)}return subtractSmall(e,1,this.sign)};SmallInteger.prototype.prev=function(){var e=this.value;if(e-1>-i)return new SmallInteger(e-1);return new BigInteger(a,true)};NativeBigInt.prototype.prev=function(){return new NativeBigInt(this.value-BigInt(1))};var u=[1];while(2*u[u.length-1]<=t)u.push(2*u[u.length-1]);var c=u.length,l=u[c-1];function shift_isSmall(e){return Math.abs(e)<=t}BigInteger.prototype.shiftLeft=function(e){var t=parseValue(e).toJSNumber();if(!shift_isSmall(t)){throw new Error(String(t)+" is too large for shifting.")}if(t<0)return this.shiftRight(-t);var r=this;if(r.isZero())return r;while(t>=c){r=r.multiply(l);t-=c-1}return r.multiply(u[t])};NativeBigInt.prototype.shiftLeft=SmallInteger.prototype.shiftLeft=BigInteger.prototype.shiftLeft;BigInteger.prototype.shiftRight=function(e){var t;var r=parseValue(e).toJSNumber();if(!shift_isSmall(r)){throw new Error(String(r)+" is too large for shifting.")}if(r<0)return this.shiftLeft(-r);var n=this;while(r>=c){if(n.isZero()||n.isNegative()&&n.isUnit())return n;t=divModAny(n,l);n=t[1].isNegative()?t[0].prev():t[0];r-=c-1}t=divModAny(n,u[r]);return t[1].isNegative()?t[0].prev():t[0]};NativeBigInt.prototype.shiftRight=SmallInteger.prototype.shiftRight=BigInteger.prototype.shiftRight;function bitwise(e,t,r){t=parseValue(t);var i=e.isNegative(),a=t.isNegative();var o=i?e.not():e,s=a?t.not():t;var u=0,c=0;var d=null,h=null;var p=[];while(!o.isZero()||!s.isZero()){d=divModAny(o,l);u=d[1].toJSNumber();if(i){u=l-1-u}h=divModAny(s,l);c=h[1].toJSNumber();if(a){c=l-1-c}o=d[0];s=h[0];p.push(r(u,c))}var m=r(i?1:0,a?1:0)!==0?n(-1):n(0);for(var g=p.length-1;g>=0;g-=1){m=m.multiply(l).add(n(p[g]))}return m}BigInteger.prototype.not=function(){return this.negate().prev()};NativeBigInt.prototype.not=SmallInteger.prototype.not=BigInteger.prototype.not;BigInteger.prototype.and=function(e){return bitwise(this,e,(function(e,t){return e&t}))};NativeBigInt.prototype.and=SmallInteger.prototype.and=BigInteger.prototype.and;BigInteger.prototype.or=function(e){return bitwise(this,e,(function(e,t){return e|t}))};NativeBigInt.prototype.or=SmallInteger.prototype.or=BigInteger.prototype.or;BigInteger.prototype.xor=function(e){return bitwise(this,e,(function(e,t){return e^t}))};NativeBigInt.prototype.xor=SmallInteger.prototype.xor=BigInteger.prototype.xor;var d=1<<30,h=(t&-t)*(t&-t)|d;function roughLOB(e){var r=e.value,n=typeof r==="number"?r|d:typeof r==="bigint"?r|BigInt(d):r[0]+r[1]*t|h;return n&-n}function integerLogarithm(e,t){if(t.compareTo(e)<=0){var r=integerLogarithm(e,t.square(t));var i=r.p;var a=r.e;var o=i.multiply(t);return o.compareTo(e)<=0?{p:o,e:a*2+1}:{p:i,e:a*2}}return{p:n(1),e:0}}BigInteger.prototype.bitLength=function(){var e=this;if(e.compareTo(n(0))<0){e=e.negate().subtract(n(1))}if(e.compareTo(n(0))===0){return n(0)}return n(integerLogarithm(e,n(2)).e).add(n(1))};NativeBigInt.prototype.bitLength=SmallInteger.prototype.bitLength=BigInteger.prototype.bitLength;function max(e,t){e=parseValue(e);t=parseValue(t);return e.greater(t)?e:t}function min(e,t){e=parseValue(e);t=parseValue(t);return e.lesser(t)?e:t}function gcd(e,t){e=parseValue(e).abs();t=parseValue(t).abs();if(e.equals(t))return e;if(e.isZero())return t;if(t.isZero())return e;var r=Integer[1],n,i;while(e.isEven()&&t.isEven()){n=min(roughLOB(e),roughLOB(t));e=e.divide(n);t=t.divide(n);r=r.multiply(n)}while(e.isEven()){e=e.divide(roughLOB(e))}do{while(t.isEven()){t=t.divide(roughLOB(t))}if(e.greater(t)){i=t;t=e;e=i}t=t.subtract(e)}while(!t.isZero());return r.isUnit()?e:e.multiply(r)}function lcm(e,t){e=parseValue(e).abs();t=parseValue(t).abs();return e.divide(gcd(e,t)).multiply(t)}function randBetween(e,r,n){e=parseValue(e);r=parseValue(r);var i=n||Math.random;var a=min(e,r),o=max(e,r);var s=o.subtract(a).add(1);if(s.isSmall)return a.add(Math.floor(i()*s));var u=toBase(s,t).value;var c=[],l=true;for(var d=0;d<u.length;d++){var h=l?u[d]+(d+1<u.length?u[d+1]/t:0):t;var p=truncate(i()*h);c.push(p);if(p<u[d])l=false}return a.add(Integer.fromArray(c,t,false))}var parseBase=function(e,t,r,n){r=r||o;e=String(e);if(!n){e=e.toLowerCase();r=r.toLowerCase()}var i=e.length;var a;var s=Math.abs(t);var u={};for(a=0;a<r.length;a++){u[r[a]]=a}for(a=0;a<i;a++){var c=e[a];if(c==="-")continue;if(c in u){if(u[c]>=s){if(c==="1"&&s===1)continue;throw new Error(c+" is not a valid digit in base "+t+".")}}}t=parseValue(t);var l=[];var d=e[0]==="-";for(a=d?1:0;a<e.length;a++){var c=e[a];if(c in u)l.push(parseValue(u[c]));else if(c==="<"){var h=a;do{a++}while(e[a]!==">"&&a<e.length);l.push(parseValue(e.slice(h+1,a)))}else throw new Error(c+" is not a valid character")}return parseBaseFromArray(l,t,d)};function parseBaseFromArray(e,t,r){var n=Integer[0],i=Integer[1],a;for(a=e.length-1;a>=0;a--){n=n.add(e[a].times(i));i=i.times(t)}return r?n.negate():n}function stringify(e,t){t=t||o;if(e<t.length){return t[e]}return"<"+e+">"}function toBase(e,t){t=n(t);if(t.isZero()){if(e.isZero())return{value:[0],isNegative:false};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:false};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e.toJSNumber())).map(Array.prototype.valueOf,[1,0])),isNegative:false};var r=Array.apply(null,Array(e.toJSNumber()-1)).map(Array.prototype.valueOf,[0,1]);r.unshift([1]);return{value:[].concat.apply([],r),isNegative:false}}var i=false;if(e.isNegative()&&t.isPositive()){i=true;e=e.abs()}if(t.isUnit()){if(e.isZero())return{value:[0],isNegative:false};return{value:Array.apply(null,Array(e.toJSNumber())).map(Number.prototype.valueOf,1),isNegative:i}}var a=[];var o=e,s;while(o.isNegative()||o.compareAbs(t)>=0){s=o.divmod(t);o=s.quotient;var u=s.remainder;if(u.isNegative()){u=t.minus(u).abs();o=o.next()}a.push(u.toJSNumber())}a.push(o.toJSNumber());return{value:a.reverse(),isNegative:i}}function toBaseString(e,t,r){var n=toBase(e,t);return(n.isNegative?"-":"")+n.value.map((function(e){return stringify(e,r)})).join("")}BigInteger.prototype.toArray=function(e){return toBase(this,e)};SmallInteger.prototype.toArray=function(e){return toBase(this,e)};NativeBigInt.prototype.toArray=function(e){return toBase(this,e)};BigInteger.prototype.toString=function(t,r){if(t===e)t=10;if(t!==10)return toBaseString(this,t,r);var n=this.value,i=n.length,a=String(n[--i]),o="0000000",s;while(--i>=0){s=String(n[i]);a+=o.slice(s.length)+s}var u=this.sign?"-":"";return u+a};SmallInteger.prototype.toString=function(t,r){if(t===e)t=10;if(t!=10)return toBaseString(this,t,r);return String(this.value)};NativeBigInt.prototype.toString=SmallInteger.prototype.toString;NativeBigInt.prototype.toJSON=BigInteger.prototype.toJSON=SmallInteger.prototype.toJSON=function(){return this.toString()};BigInteger.prototype.valueOf=function(){return parseInt(this.toString(),10)};BigInteger.prototype.toJSNumber=BigInteger.prototype.valueOf;SmallInteger.prototype.valueOf=function(){return this.value};SmallInteger.prototype.toJSNumber=SmallInteger.prototype.valueOf;NativeBigInt.prototype.valueOf=NativeBigInt.prototype.toJSNumber=function(){return parseInt(this.toString(),10)};function parseStringValue(e){if(isPrecise(+e)){var t=+e;if(t===truncate(t))return s?new NativeBigInt(BigInt(t)):new SmallInteger(t);throw new Error("Invalid integer: "+e)}var n=e[0]==="-";if(n)e=e.slice(1);var i=e.split(/e/i);if(i.length>2)throw new Error("Invalid integer: "+i.join("e"));if(i.length===2){var a=i[1];if(a[0]==="+")a=a.slice(1);a=+a;if(a!==truncate(a)||!isPrecise(a))throw new Error("Invalid integer: "+a+" is not a valid exponent.");var o=i[0];var u=o.indexOf(".");if(u>=0){a-=o.length-u-1;o=o.slice(0,u)+o.slice(u+1)}if(a<0)throw new Error("Cannot include negative exponent part for integers");o+=new Array(a+1).join("0");e=o}var c=/^([0-9][0-9]*)$/.test(e);if(!c)throw new Error("Invalid integer: "+e);if(s){return new NativeBigInt(BigInt(n?"-"+e:e))}var l=[],d=e.length,h=r,p=d-h;while(d>0){l.push(+e.slice(p,d));p-=h;if(p<0)p=0;d-=h}trim(l);return new BigInteger(l,n)}function parseNumberValue(e){if(s){return new NativeBigInt(BigInt(e))}if(isPrecise(e)){if(e!==truncate(e))throw new Error(e+" is not an integer.");return new SmallInteger(e)}return parseStringValue(e.toString())}function parseValue(e){if(typeof e==="number"){return parseNumberValue(e)}if(typeof e==="string"){return parseStringValue(e)}if(typeof e==="bigint"){return new NativeBigInt(e)}return e}for(var p=0;p<1e3;p++){Integer[p]=parseValue(p);if(p>0)Integer[-p]=parseValue(-p)}Integer.one=Integer[1];Integer.zero=Integer[0];Integer.minusOne=Integer[-1];Integer.max=max;Integer.min=min;Integer.gcd=gcd;Integer.lcm=lcm;Integer.isInstance=function(e){return e instanceof BigInteger||e instanceof SmallInteger||e instanceof NativeBigInt};Integer.randBetween=randBetween;Integer.fromArray=function(e,t,r){return parseBaseFromArray(e.map(parseValue),parseValue(t||10),r)};return Integer}();if(true&&e.hasOwnProperty("exports")){e.exports=n}if(typeof define==="function"&&define.amd){define((function(){return n}))}},1806:function(e){(function(t){"use strict";var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,a=Math.floor,o="[BigNumber Error] ",s=o+"Number primitive has more than 15 significant digits: ",u=1e14,c=14,l=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,p=1e9;function clone(e){var t,r,m,g=BigNumber.prototype={constructor:BigNumber,toString:null,valueOf:null},v=new BigNumber(1),b=20,y=4,w=-7,_=21,k=-1e7,A=1e7,E=false,I=1,T=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",N=true;function BigNumber(e,t){var i,o,u,d,h,p,g,v,w=this;if(!(w instanceof BigNumber))return new BigNumber(e,t);if(t==null){if(e&&e._isBigNumber===true){w.s=e.s;if(!e.c||e.e>A){w.c=w.e=null}else if(e.e<k){w.c=[w.e=0]}else{w.e=e.e;w.c=e.c.slice()}return}if((p=typeof e=="number")&&e*0==0){w.s=1/e<0?(e=-e,-1):1;if(e===~~e){for(d=0,h=e;h>=10;h/=10,d++);if(d>A){w.c=w.e=null}else{w.e=d;w.c=[e]}return}v=String(e)}else{if(!n.test(v=String(e)))return m(w,v,p);w.s=v.charCodeAt(0)==45?(v=v.slice(1),-1):1}if((d=v.indexOf("."))>-1)v=v.replace(".","");if((h=v.search(/e/i))>0){if(d<0)d=h;d+=+v.slice(h+1);v=v.substring(0,h)}else if(d<0){d=v.length}}else{intCheck(t,2,M.length,"Base");if(t==10&&N){w=new BigNumber(e);return round(w,b+w.e+1,y)}v=String(e);if(p=typeof e=="number"){if(e*0!=0)return m(w,v,p,t);w.s=1/e<0?(v=v.slice(1),-1):1;if(BigNumber.DEBUG&&v.replace(/^0\.0*|\./,"").length>15){throw Error(s+e)}}else{w.s=v.charCodeAt(0)===45?(v=v.slice(1),-1):1}i=M.slice(0,t);d=h=0;for(g=v.length;h<g;h++){if(i.indexOf(o=v.charAt(h))<0){if(o=="."){if(h>d){d=g;continue}}else if(!u){if(v==v.toUpperCase()&&(v=v.toLowerCase())||v==v.toLowerCase()&&(v=v.toUpperCase())){u=true;h=-1;d=0;continue}}return m(w,String(e),p,t)}}p=false;v=r(v,t,10,w.s);if((d=v.indexOf("."))>-1)v=v.replace(".","");else d=v.length}for(h=0;v.charCodeAt(h)===48;h++);for(g=v.length;v.charCodeAt(--g)===48;);if(v=v.slice(h,++g)){g-=h;if(p&&BigNumber.DEBUG&&g>15&&(e>l||e!==a(e))){throw Error(s+w.s*e)}if((d=d-h-1)>A){w.c=w.e=null}else if(d<k){w.c=[w.e=0]}else{w.e=d;w.c=[];h=(d+1)%c;if(d<0)h+=c;if(h<g){if(h)w.c.push(+v.slice(0,h));for(g-=c;h<g;){w.c.push(+v.slice(h,h+=c))}h=c-(v=v.slice(h)).length}else{h-=g}for(;h--;v+="0");w.c.push(+v)}}else{w.c=[w.e=0]}}BigNumber.clone=clone;BigNumber.ROUND_UP=0;BigNumber.ROUND_DOWN=1;BigNumber.ROUND_CEIL=2;BigNumber.ROUND_FLOOR=3;BigNumber.ROUND_HALF_UP=4;BigNumber.ROUND_HALF_DOWN=5;BigNumber.ROUND_HALF_EVEN=6;BigNumber.ROUND_HALF_CEIL=7;BigNumber.ROUND_HALF_FLOOR=8;BigNumber.EUCLID=9;BigNumber.config=BigNumber.set=function(e){var t,r;if(e!=null){if(typeof e=="object"){if(e.hasOwnProperty(t="DECIMAL_PLACES")){r=e[t];intCheck(r,0,p,t);b=r}if(e.hasOwnProperty(t="ROUNDING_MODE")){r=e[t];intCheck(r,0,8,t);y=r}if(e.hasOwnProperty(t="EXPONENTIAL_AT")){r=e[t];if(r&&r.pop){intCheck(r[0],-p,0,t);intCheck(r[1],0,p,t);w=r[0];_=r[1]}else{intCheck(r,-p,p,t);w=-(_=r<0?-r:r)}}if(e.hasOwnProperty(t="RANGE")){r=e[t];if(r&&r.pop){intCheck(r[0],-p,-1,t);intCheck(r[1],1,p,t);k=r[0];A=r[1]}else{intCheck(r,-p,p,t);if(r){k=-(A=r<0?-r:r)}else{throw Error(o+t+" cannot be zero: "+r)}}}if(e.hasOwnProperty(t="CRYPTO")){r=e[t];if(r===!!r){if(r){if(typeof crypto!="undefined"&&crypto&&(crypto.getRandomValues||crypto.randomBytes)){E=r}else{E=!r;throw Error(o+"crypto unavailable")}}else{E=r}}else{throw Error(o+t+" not true or false: "+r)}}if(e.hasOwnProperty(t="MODULO_MODE")){r=e[t];intCheck(r,0,9,t);I=r}if(e.hasOwnProperty(t="POW_PRECISION")){r=e[t];intCheck(r,0,p,t);T=r}if(e.hasOwnProperty(t="FORMAT")){r=e[t];if(typeof r=="object")B=r;else throw Error(o+t+" not an object: "+r)}if(e.hasOwnProperty(t="ALPHABET")){r=e[t];if(typeof r=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(r)){N=r.slice(0,10)=="0123456789";M=r}else{throw Error(o+t+" invalid: "+r)}}}else{throw Error(o+"Object expected: "+e)}}return{DECIMAL_PLACES:b,ROUNDING_MODE:y,EXPONENTIAL_AT:[w,_],RANGE:[k,A],CRYPTO:E,MODULO_MODE:I,POW_PRECISION:T,FORMAT:B,ALPHABET:M}};BigNumber.isBigNumber=function(e){if(!e||e._isBigNumber!==true)return false;if(!BigNumber.DEBUG)return true;var t,r,n=e.c,i=e.e,s=e.s;e:if({}.toString.call(n)=="[object Array]"){if((s===1||s===-1)&&i>=-p&&i<=p&&i===a(i)){if(n[0]===0){if(i===0&&n.length===1)return true;break e}t=(i+1)%c;if(t<1)t+=c;if(String(n[0]).length==t){for(t=0;t<n.length;t++){r=n[t];if(r<0||r>=u||r!==a(r))break e}if(r!==0)return true}}}else if(n===null&&i===null&&(s===null||s===1||s===-1)){return true}throw Error(o+"Invalid BigNumber: "+e)};BigNumber.maximum=BigNumber.max=function(){return maxOrMin(arguments,g.lt)};BigNumber.minimum=BigNumber.min=function(){return maxOrMin(arguments,g.gt)};BigNumber.random=function(){var e=9007199254740992;var t=Math.random()*e&2097151?function(){return a(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var r,n,s,u,l,h=0,m=[],g=new BigNumber(v);if(e==null)e=b;else intCheck(e,0,p);u=i(e/c);if(E){if(crypto.getRandomValues){r=crypto.getRandomValues(new Uint32Array(u*=2));for(;h<u;){l=r[h]*131072+(r[h+1]>>>11);if(l>=9e15){n=crypto.getRandomValues(new Uint32Array(2));r[h]=n[0];r[h+1]=n[1]}else{m.push(l%1e14);h+=2}}h=u/2}else if(crypto.randomBytes){r=crypto.randomBytes(u*=7);for(;h<u;){l=(r[h]&31)*281474976710656+r[h+1]*1099511627776+r[h+2]*4294967296+r[h+3]*16777216+(r[h+4]<<16)+(r[h+5]<<8)+r[h+6];if(l>=9e15){crypto.randomBytes(7).copy(r,h)}else{m.push(l%1e14);h+=7}}h=u/7}else{E=false;throw Error(o+"crypto unavailable")}}if(!E){for(;h<u;){l=t();if(l<9e15)m[h++]=l%1e14}}u=m[--h];e%=c;if(u&&e){l=d[c-e];m[h]=a(u/l)*l}for(;m[h]===0;m.pop(),h--);if(h<0){m=[s=0]}else{for(s=-1;m[0]===0;m.splice(0,1),s-=c);for(h=1,l=m[0];l>=10;l/=10,h++);if(h<c)s-=c-h}g.e=s;g.c=m;return g}}();BigNumber.sum=function(){var e=1,t=arguments,r=new BigNumber(t[0]);for(;e<t.length;)r=r.plus(t[e++]);return r};r=function(){var e="0123456789";function toBaseOut(e,t,r,n){var i,a=[0],o,s=0,u=e.length;for(;s<u;){for(o=a.length;o--;a[o]*=t);a[0]+=n.indexOf(e.charAt(s++));for(i=0;i<a.length;i++){if(a[i]>r-1){if(a[i+1]==null)a[i+1]=0;a[i+1]+=a[i]/r|0;a[i]%=r}}}return a.reverse()}return function(r,n,i,a,o){var s,u,c,l,d,h,p,m,g=r.indexOf("."),v=b,w=y;if(g>=0){l=T;T=0;r=r.replace(".","");m=new BigNumber(n);h=m.pow(r.length-g);T=l;m.c=toBaseOut(toFixedPoint(coeffToString(h.c),h.e,"0"),10,i,e);m.e=m.c.length}p=toBaseOut(r,n,i,o?(s=M,e):(s=e,M));c=l=p.length;for(;p[--l]==0;p.pop());if(!p[0])return s.charAt(0);if(g<0){--c}else{h.c=p;h.e=c;h.s=a;h=t(h,m,v,w,i);p=h.c;d=h.r;c=h.e}u=c+v+1;g=p[u];l=i/2;d=d||u<0||p[u+1]!=null;d=w<4?(g!=null||d)&&(w==0||w==(h.s<0?3:2)):g>l||g==l&&(w==4||d||w==6&&p[u-1]&1||w==(h.s<0?8:7));if(u<1||!p[0]){r=d?toFixedPoint(s.charAt(1),-v,s.charAt(0)):s.charAt(0)}else{p.length=u;if(d){for(--i;++p[--u]>i;){p[u]=0;if(!u){++c;p=[1].concat(p)}}}for(l=p.length;!p[--l];);for(g=0,r="";g<=l;r+=s.charAt(p[g++]));r=toFixedPoint(r,c,s.charAt(0))}return r}}();t=function(){function multiply(e,t,r){var n,i,a,o,s=0,u=e.length,c=t%h,l=t/h|0;for(e=e.slice();u--;){a=e[u]%h;o=e[u]/h|0;n=l*a+o*c;i=c*a+n%h*h+s;s=(i/r|0)+(n/h|0)+l*o;e[u]=i%r}if(s)e=[s].concat(e);return e}function compare(e,t,r,n){var i,a;if(r!=n){a=r>n?1:-1}else{for(i=a=0;i<r;i++){if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}}}return a}function subtract(e,t,r,n){var i=0;for(;r--;){e[r]-=i;i=e[r]<t[r]?1:0;e[r]=i*n+e[r]-t[r]}for(;!e[0]&&e.length>1;e.splice(0,1));}return function(e,t,r,n,i){var o,s,l,d,h,p,m,g,v,b,y,w,_,k,A,E,I,T=e.s==t.s?1:-1,B=e.c,M=t.c;if(!B||!B[0]||!M||!M[0]){return new BigNumber(!e.s||!t.s||(B?M&&B[0]==M[0]:!M)?NaN:B&&B[0]==0||!M?T*0:T/0)}g=new BigNumber(T);v=g.c=[];s=e.e-t.e;T=r+s+1;if(!i){i=u;s=bitFloor(e.e/c)-bitFloor(t.e/c);T=T/c|0}for(l=0;M[l]==(B[l]||0);l++);if(M[l]>(B[l]||0))s--;if(T<0){v.push(1);d=true}else{k=B.length;E=M.length;l=0;T+=2;h=a(i/(M[0]+1));if(h>1){M=multiply(M,h,i);B=multiply(B,h,i);E=M.length;k=B.length}_=E;b=B.slice(0,E);y=b.length;for(;y<E;b[y++]=0);I=M.slice();I=[0].concat(I);A=M[0];if(M[1]>=i/2)A++;do{h=0;o=compare(M,b,E,y);if(o<0){w=b[0];if(E!=y)w=w*i+(b[1]||0);h=a(w/A);if(h>1){if(h>=i)h=i-1;p=multiply(M,h,i);m=p.length;y=b.length;while(compare(p,b,m,y)==1){h--;subtract(p,E<m?I:M,m,i);m=p.length;o=1}}else{if(h==0){o=h=1}p=M.slice();m=p.length}if(m<y)p=[0].concat(p);subtract(b,p,y,i);y=b.length;if(o==-1){while(compare(M,b,E,y)<1){h++;subtract(b,E<y?I:M,y,i);y=b.length}}}else if(o===0){h++;b=[0]}v[l++]=h;if(b[0]){b[y++]=B[_]||0}else{b=[B[_]];y=1}}while((_++<k||b[0]!=null)&&T--);d=b[0]!=null;if(!v[0])v.splice(0,1)}if(i==u){for(l=1,T=v[0];T>=10;T/=10,l++);round(g,r+(g.e=l+s*c-1)+1,n,d)}else{g.e=s;g.r=+d}return g}}();function format(e,t,r,n){var i,a,o,s,u;if(r==null)r=y;else intCheck(r,0,8);if(!e.c)return e.toString();i=e.c[0];o=e.e;if(t==null){u=coeffToString(e.c);u=n==1||n==2&&(o<=w||o>=_)?toExponential(u,o):toFixedPoint(u,o,"0")}else{e=round(new BigNumber(e),t,r);a=e.e;u=coeffToString(e.c);s=u.length;if(n==1||n==2&&(t<=a||a<=w)){for(;s<t;u+="0",s++);u=toExponential(u,a)}else{t-=o;u=toFixedPoint(u,a,"0");if(a+1>s){if(--t>0)for(u+=".";t--;u+="0");}else{t+=a-s;if(t>0){if(a+1==s)u+=".";for(;t--;u+="0");}}}}return e.s<0&&i?"-"+u:u}function maxOrMin(e,t){var r,n=1,i=new BigNumber(e[0]);for(;n<e.length;n++){r=new BigNumber(e[n]);if(!r.s){i=r;break}else if(t.call(i,r)){i=r}}return i}function normalise(e,t,r){var n=1,i=t.length;for(;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);if((r=n+r*c-1)>A){e.c=e.e=null}else if(r<k){e.c=[e.e=0]}else{e.e=r;e.c=t}return e}m=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,s,u,c){var l,d=u?s:s.replace(i,"");if(n.test(d)){a.s=isNaN(d)?null:d<0?-1:1}else{if(!u){d=d.replace(e,(function(e,t,r){l=(r=r.toLowerCase())=="x"?16:r=="b"?2:8;return!c||c==l?t:e}));if(c){l=c;d=d.replace(t,"$1").replace(r,"0.$1")}if(s!=d)return new BigNumber(d,l)}if(BigNumber.DEBUG){throw Error(o+"Not a"+(c?" base "+c:"")+" number: "+s)}a.s=null}a.c=a.e=null}}();function round(e,t,r,n){var o,s,l,h,p,m,g,v=e.c,b=d;if(v){e:{for(o=1,h=v[0];h>=10;h/=10,o++);s=t-o;if(s<0){s+=c;l=t;p=v[m=0];g=p/b[o-l-1]%10|0}else{m=i((s+1)/c);if(m>=v.length){if(n){for(;v.length<=m;v.push(0));p=g=0;o=1;s%=c;l=s-c+1}else{break e}}else{p=h=v[m];for(o=1;h>=10;h/=10,o++);s%=c;l=s-c+o;g=l<0?0:p/b[o-l-1]%10|0}}n=n||t<0||v[m+1]!=null||(l<0?p:p%b[o-l-1]);n=r<4?(g||n)&&(r==0||r==(e.s<0?3:2)):g>5||g==5&&(r==4||n||r==6&&(s>0?l>0?p/b[o-l]:0:v[m-1])%10&1||r==(e.s<0?8:7));if(t<1||!v[0]){v.length=0;if(n){t-=e.e+1;v[0]=b[(c-t%c)%c];e.e=-t||0}else{v[0]=e.e=0}return e}if(s==0){v.length=m;h=1;m--}else{v.length=m+1;h=b[c-s];v[m]=l>0?a(p/b[o-l]%b[l])*h:0}if(n){for(;;){if(m==0){for(s=1,l=v[0];l>=10;l/=10,s++);l=v[0]+=h;for(h=1;l>=10;l/=10,h++);if(s!=h){e.e++;if(v[0]==u)v[0]=1}break}else{v[m]+=h;if(v[m]!=u)break;v[m--]=0;h=1}}}for(s=v.length;v[--s]===0;v.pop());}if(e.e>A){e.c=e.e=null}else if(e.e<k){e.c=[e.e=0]}}return e}function valueOf(e){var t,r=e.e;if(r===null)return e.toString();t=coeffToString(e.c);t=r<=w||r>=_?toExponential(t,r):toFixedPoint(t,r,"0");return e.s<0?"-"+t:t}g.absoluteValue=g.abs=function(){var e=new BigNumber(this);if(e.s<0)e.s=1;return e};g.comparedTo=function(e,t){return compare(this,new BigNumber(e,t))};g.decimalPlaces=g.dp=function(e,t){var r,n,i,a=this;if(e!=null){intCheck(e,0,p);if(t==null)t=y;else intCheck(t,0,8);return round(new BigNumber(a),e+a.e+1,t)}if(!(r=a.c))return null;n=((i=r.length-1)-bitFloor(this.e/c))*c;if(i=r[i])for(;i%10==0;i/=10,n--);if(n<0)n=0;return n};g.dividedBy=g.div=function(e,r){return t(this,new BigNumber(e,r),b,y)};g.dividedToIntegerBy=g.idiv=function(e,r){return t(this,new BigNumber(e,r),0,1)};g.exponentiatedBy=g.pow=function(e,t){var r,n,s,u,l,d,h,p,m,g=this;e=new BigNumber(e);if(e.c&&!e.isInteger()){throw Error(o+"Exponent not an integer: "+valueOf(e))}if(t!=null)t=new BigNumber(t);d=e.e>14;if(!g.c||!g.c[0]||g.c[0]==1&&!g.e&&g.c.length==1||!e.c||!e.c[0]){m=new BigNumber(Math.pow(+valueOf(g),d?2-isOdd(e):+valueOf(e)));return t?m.mod(t):m}h=e.s<0;if(t){if(t.c?!t.c[0]:!t.s)return new BigNumber(NaN);n=!h&&g.isInteger()&&t.isInteger();if(n)g=g.mod(t)}else if(e.e>9&&(g.e>0||g.e<-1||(g.e==0?g.c[0]>1||d&&g.c[1]>=24e7:g.c[0]<8e13||d&&g.c[0]<=9999975e7))){u=g.s<0&&isOdd(e)?-0:0;if(g.e>-1)u=1/u;return new BigNumber(h?1/u:u)}else if(T){u=i(T/c+2)}if(d){r=new BigNumber(.5);if(h)e.s=1;p=isOdd(e)}else{s=Math.abs(+valueOf(e));p=s%2}m=new BigNumber(v);for(;;){if(p){m=m.times(g);if(!m.c)break;if(u){if(m.c.length>u)m.c.length=u}else if(n){m=m.mod(t)}}if(s){s=a(s/2);if(s===0)break;p=s%2}else{e=e.times(r);round(e,e.e+1,1);if(e.e>14){p=isOdd(e)}else{s=+valueOf(e);if(s===0)break;p=s%2}}g=g.times(g);if(u){if(g.c&&g.c.length>u)g.c.length=u}else if(n){g=g.mod(t)}}if(n)return m;if(h)m=v.div(m);return t?m.mod(t):u?round(m,T,y,l):m};g.integerValue=function(e){var t=new BigNumber(this);if(e==null)e=y;else intCheck(e,0,8);return round(t,t.e+1,e)};g.isEqualTo=g.eq=function(e,t){return compare(this,new BigNumber(e,t))===0};g.isFinite=function(){return!!this.c};g.isGreaterThan=g.gt=function(e,t){return compare(this,new BigNumber(e,t))>0};g.isGreaterThanOrEqualTo=g.gte=function(e,t){return(t=compare(this,new BigNumber(e,t)))===1||t===0};g.isInteger=function(){return!!this.c&&bitFloor(this.e/c)>this.c.length-2};g.isLessThan=g.lt=function(e,t){return compare(this,new BigNumber(e,t))<0};g.isLessThanOrEqualTo=g.lte=function(e,t){return(t=compare(this,new BigNumber(e,t)))===-1||t===0};g.isNaN=function(){return!this.s};g.isNegative=function(){return this.s<0};g.isPositive=function(){return this.s>0};g.isZero=function(){return!!this.c&&this.c[0]==0};g.minus=function(e,t){var r,n,i,a,o=this,s=o.s;e=new BigNumber(e,t);t=e.s;if(!s||!t)return new BigNumber(NaN);if(s!=t){e.s=-t;return o.plus(e)}var l=o.e/c,d=e.e/c,h=o.c,p=e.c;if(!l||!d){if(!h||!p)return h?(e.s=-t,e):new BigNumber(p?o:NaN);if(!h[0]||!p[0]){return p[0]?(e.s=-t,e):new BigNumber(h[0]?o:y==3?-0:0)}}l=bitFloor(l);d=bitFloor(d);h=h.slice();if(s=l-d){if(a=s<0){s=-s;i=h}else{d=l;i=p}i.reverse();for(t=s;t--;i.push(0));i.reverse()}else{n=(a=(s=h.length)<(t=p.length))?s:t;for(s=t=0;t<n;t++){if(h[t]!=p[t]){a=h[t]<p[t];break}}}if(a)i=h,h=p,p=i,e.s=-e.s;t=(n=p.length)-(r=h.length);if(t>0)for(;t--;h[r++]=0);t=u-1;for(;n>s;){if(h[--n]<p[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r];h[n]+=u}h[n]-=p[n]}for(;h[0]==0;h.splice(0,1),--d);if(!h[0]){e.s=y==3?-1:1;e.c=[e.e=0];return e}return normalise(e,h,d)};g.modulo=g.mod=function(e,r){var n,i,a=this;e=new BigNumber(e,r);if(!a.c||!e.s||e.c&&!e.c[0]){return new BigNumber(NaN)}else if(!e.c||a.c&&!a.c[0]){return new BigNumber(a)}if(I==9){i=e.s;e.s=1;n=t(a,e,0,3);e.s=i;n.s*=i}else{n=t(a,e,0,I)}e=a.minus(n.times(e));if(!e.c[0]&&I==1)e.s=a.s;return e};g.multipliedBy=g.times=function(e,t){var r,n,i,a,o,s,l,d,p,m,g,v,b,y,w,_=this,k=_.c,A=(e=new BigNumber(e,t)).c;if(!k||!A||!k[0]||!A[0]){if(!_.s||!e.s||k&&!k[0]&&!A||A&&!A[0]&&!k){e.c=e.e=e.s=null}else{e.s*=_.s;if(!k||!A){e.c=e.e=null}else{e.c=[0];e.e=0}}return e}n=bitFloor(_.e/c)+bitFloor(e.e/c);e.s*=_.s;l=k.length;m=A.length;if(l<m)b=k,k=A,A=b,i=l,l=m,m=i;for(i=l+m,b=[];i--;b.push(0));y=u;w=h;for(i=m;--i>=0;){r=0;g=A[i]%w;v=A[i]/w|0;for(o=l,a=i+o;a>i;){d=k[--o]%w;p=k[o]/w|0;s=v*d+p*g;d=g*d+s%w*w+b[a]+r;r=(d/y|0)+(s/w|0)+v*p;b[a--]=d%y}b[a]=r}if(r){++n}else{b.splice(0,1)}return normalise(e,b,n)};g.negated=function(){var e=new BigNumber(this);e.s=-e.s||null;return e};g.plus=function(e,t){var r,n=this,i=n.s;e=new BigNumber(e,t);t=e.s;if(!i||!t)return new BigNumber(NaN