UNPKG

@hashgraphonline/standards-agent-kit

Version:

A modular SDK for building on-chain autonomous agents using Hashgraph Online Standards, including HCS-10 for agent discovery and communication.

20 lines 3.29 MB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).StandardsAgentKit={})}(this,(function(exports){"use strict";var __defProp3=Object.defineProperty,__defNormalProp3=(e,t,r)=>t in e?__defProp3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__publicField3=(e,t,r)=>__defNormalProp3(e,"symbol"!=typeof t?t+"":t,r);function _mergeNamespaces(e,t){for(var r=0;r<t.length;r++){const n=t[r];if("string"!=typeof n&&!Array.isArray(n))for(const t in n)if("default"!==t&&!(t in e)){const r=Object.getOwnPropertyDescriptor(n,t);r&&Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function getDefaultExportFromCjs$4(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var browser$h={exports:{}},process$3=browser$h.exports={},cachedSetTimeout$2,cachedClearTimeout$2;function defaultSetTimout$2(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout$2(){throw new Error("clearTimeout has not been defined")}function runTimeout$2(e){if(cachedSetTimeout$2===setTimeout)return setTimeout(e,0);if((cachedSetTimeout$2===defaultSetTimout$2||!cachedSetTimeout$2)&&setTimeout)return cachedSetTimeout$2=setTimeout,setTimeout(e,0);try{return cachedSetTimeout$2(e,0)}catch(t){try{return cachedSetTimeout$2.call(null,e,0)}catch(r){return cachedSetTimeout$2.call(this,e,0)}}}function runClearTimeout$2(e){if(cachedClearTimeout$2===clearTimeout)return clearTimeout(e);if((cachedClearTimeout$2===defaultClearTimeout$2||!cachedClearTimeout$2)&&clearTimeout)return cachedClearTimeout$2=clearTimeout,clearTimeout(e);try{return cachedClearTimeout$2(e)}catch(t){try{return cachedClearTimeout$2.call(null,e)}catch(r){return cachedClearTimeout$2.call(this,e)}}}!function(){try{cachedSetTimeout$2="function"==typeof setTimeout?setTimeout:defaultSetTimout$2}catch(e){cachedSetTimeout$2=defaultSetTimout$2}try{cachedClearTimeout$2="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout$2}catch(e){cachedClearTimeout$2=defaultClearTimeout$2}}();var queue$3=[],draining$2=!1,currentQueue$2,queueIndex$2=-1;function cleanUpNextTick$2(){draining$2&&currentQueue$2&&(draining$2=!1,currentQueue$2.length?queue$3=currentQueue$2.concat(queue$3):queueIndex$2=-1,queue$3.length&&drainQueue$2())}function drainQueue$2(){if(!draining$2){var e=runTimeout$2(cleanUpNextTick$2);draining$2=!0;for(var t=queue$3.length;t;){for(currentQueue$2=queue$3,queue$3=[];++queueIndex$2<t;)currentQueue$2&&currentQueue$2[queueIndex$2].run();queueIndex$2=-1,t=queue$3.length}currentQueue$2=null,draining$2=!1,runClearTimeout$2(e)}}function Item$2(e,t){this.fun=e,this.array=t}function noop$5(){}process$3.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue$3.push(new Item$2(e,t)),1!==queue$3.length||draining$2||runTimeout$2(drainQueue$2)},Item$2.prototype.run=function(){this.fun.apply(null,this.array)},process$3.title="browser",process$3.browser=!0,process$3.env={},process$3.argv=[],process$3.version="",process$3.versions={},process$3.on=noop$5,process$3.addListener=noop$5,process$3.once=noop$5,process$3.off=noop$5,process$3.removeListener=noop$5,process$3.removeAllListeners=noop$5,process$3.emit=noop$5,process$3.prependListener=noop$5,process$3.prependOnceListener=noop$5,process$3.listeners=function(e){return[]},process$3.binding=function(e){throw new Error("process.binding is not supported")},process$3.cwd=function(){return"/"},process$3.chdir=function(e){throw new Error("process.chdir is not supported")},process$3.umask=function(){return 0};var browserExports$3=browser$h.exports;const process$1$2=getDefaultExportFromCjs$4(browserExports$3);var commonjsGlobal$2="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs$3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var browser$g={exports:{}},quickFormatUnescaped$1,hasRequiredQuickFormatUnescaped$1,hasRequiredBrowser$f;function requireQuickFormatUnescaped$1(){if(hasRequiredQuickFormatUnescaped$1)return quickFormatUnescaped$1;function e(e){try{return JSON.stringify(e)}catch(t){return'"[Circular]"'}}return hasRequiredQuickFormatUnescaped$1=1,quickFormatUnescaped$1=function(t,r,n){var i=n&&n.stringify||e;if("object"==typeof t&&null!==t){var o=r.length+1;if(1===o)return t;var a=new Array(o);a[0]=i(t);for(var s=1;s<o;s++)a[s]=i(r[s]);return a.join(" ")}if("string"!=typeof t)return t;var c=r.length;if(0===c)return t;for(var u="",l=0,d=-1,p=t&&t.length||0,h=0;h<p;){if(37===t.charCodeAt(h)&&h+1<p){switch(d=d>-1?d:0,t.charCodeAt(h+1)){case 100:case 102:if(l>=c)break;if(null==r[l])break;d<h&&(u+=t.slice(d,h)),u+=Number(r[l]),d=h+2,h++;break;case 105:if(l>=c)break;if(null==r[l])break;d<h&&(u+=t.slice(d,h)),u+=Math.floor(Number(r[l])),d=h+2,h++;break;case 79:case 111:case 106:if(l>=c)break;if(void 0===r[l])break;d<h&&(u+=t.slice(d,h));var f=typeof r[l];if("string"===f){u+="'"+r[l]+"'",d=h+2,h++;break}if("function"===f){u+=r[l].name||"<anonymous>",d=h+2,h++;break}u+=i(r[l]),d=h+2,h++;break;case 115:if(l>=c)break;d<h&&(u+=t.slice(d,h)),u+=String(r[l]),d=h+2,h++;break;case 37:d<h&&(u+=t.slice(d,h)),u+="%",d=h+2,h++,l--}++l}++h}if(-1===d)return t;d<p&&(u+=t.slice(d));return u}}function requireBrowser$f(){if(hasRequiredBrowser$f)return browser$g.exports;hasRequiredBrowser$f=1;const e=requireQuickFormatUnescaped$1();browser$g.exports=c;const t=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},r={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p,errWithCause:p};function n(e,t){return"silent"===e?1/0:t.levels.values[e]}const i=Symbol("pino.logFuncs"),o=Symbol("pino.hierarchy"),a={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function s(e,t){const r={logger:t,parent:e[o]};t[o]=r}function c(e){(e=e||{}).browser=e.browser||{};const r=e.browser.transmit;if(r&&"function"!=typeof r.send)throw Error("pino: transmit option must have a send function");const o=e.browser.write||t;e.browser.write&&(e.browser.asObject=!0);const p=e.serializers||{},f=function(e,t){if(Array.isArray(e))return e.filter((function(e){return"!stdSerializers.err"!==e}));return!0===e&&Object.keys(t)}(e.browser.serialize,p);let m=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(m=!1);const y=Object.keys(e.customLevels||{}),b=["error","fatal","warn","info","debug","trace"].concat(y);"function"==typeof o&&b.forEach((function(e){o[e]=o})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const v=e.level||"info",w=Object.create(o);w.log||(w.log=g),function(e,r,n){const o={};r.forEach((e=>{o[e]=n[e]?n[e]:t[e]||t[a[e]||"log"]||g})),e[i]=o}(w,b,o),s({},w),Object.defineProperty(w,"levelVal",{get:function(){return n(this.level,this)}}),Object.defineProperty(w,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,u(this,_,w,"error"),u(this,_,w,"fatal"),u(this,_,w,"warn"),u(this,_,w,"info"),u(this,_,w,"debug"),u(this,_,w,"trace"),y.forEach((e=>{u(this,_,w,e)}))}});const _={transmit:r,serialize:f,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:b,timestamp:h(e),messageKey:e.messageKey||"msg",onChild:e.onChild||g};function x(t,n,i){if(!n)throw new Error("missing bindings for child Pino");i=i||{},f&&n.serializers&&(i.serializers=n.serializers);const o=i.serializers;if(f&&o){var a=Object.assign({},p,o),c=!0===e.browser.serialize?Object.keys(a):f;delete n.serializers,l([n],c,a,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=n,a&&(this.serializers=a,this._serialize=c),r&&(this._logEvent=d([].concat(e._logEvent.bindings,n)))}u.prototype=this;const h=new u(this);return s(this,h),h.child=function(...e){return x.call(this,t,...e)},h.level=i.level||this.level,t.onChild(h),h}return w.levels=function(e){const t=e.customLevels||{},r=Object.assign({},c.levels.values,t),n=Object.assign({},c.levels.labels,function(e){const t={};return Object.keys(e).forEach((function(r){t[e[r]]=r})),t}(t));return{values:r,labels:n}}(e),w.level=v,w.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},w.setMaxListeners=w.getMaxListeners=w.emit=w.addListener=w.on=w.prependListener=w.once=w.prependOnceListener=w.removeListener=w.removeAllListeners=w.listeners=w.listenerCount=w.eventNames=w.write=w.flush=g,w.serializers=p,w._serialize=f,w._stdErrSerialize=m,w.child=function(...e){return x.call(this,_,...e)},r&&(w._logEvent=d()),w}function u(r,a,s,c){if(Object.defineProperty(r,c,{value:n(r.level,s)>n(c,s)?g:s[i][c],writable:!0,enumerable:!0,configurable:!0}),r[c]===g){if(!a.transmit)return;const e=n(a.transmit.level||r.level,s);if(n(c,s)<e)return}r[c]=function(r,o,a,s){return function(i){return function(){const c=o.timestamp(),u=new Array(arguments.length),p=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var h=0;h<u.length;h++)u[h]=arguments[h];var f=!1;if(o.serialize&&(l(u,this._serialize,this.serializers,this._stdErrSerialize),f=!0),o.asObject||o.formatters?i.call(p,...function(t,r,n,i,o){const{level:a,log:s=e=>e}=o.formatters||{},c=n.slice();let u=c[0];const l={};let d=1+(0|t._childLevel);d<1&&(d=1);i&&(l.time=i);if(a){const e=a(r,t.levels.values[r]);Object.assign(l,e)}else l.level=t.levels.values[r];if(o.asObjectBindingsOnly){if(null!==u&&"object"==typeof u)for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());return[s(l),...c]}if(null!==u&&"object"==typeof u){for(;d--&&"object"==typeof c[0];)Object.assign(l,c.shift());u=c.length?e(c.shift(),c):void 0}else"string"==typeof u&&(u=e(c.shift(),c));void 0!==u&&(l[o.messageKey]=u);return[s(l)]}(this,s,u,c,o)):i.apply(p,u),o.transmit){const e=n(o.transmit.level||r._level,a),t=n(s,a);if(t<e)return;!function(e,t,r,n=!1){const i=t.send,o=t.ts,a=t.methodLevel,s=t.methodValue,c=t.val,u=e._logEvent.bindings;n||l(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize);e._logEvent.ts=o,e._logEvent.messages=r.filter((function(e){return-1===u.indexOf(e)})),e._logEvent.level.label=a,e._logEvent.level.value=s,i(a,e._logEvent,c),e._logEvent=d(u)}(this,{ts:c,methodLevel:s,methodValue:t,transmitValue:a.levels.values[o.transmit.level||r._level],send:o.transmit.send,val:n(r._level,a)},u,f)}}}(r[i][s])}(r,a,s,c);const u=function(e){const t=[];e.bindings&&t.push(e.bindings);let r=e[o];for(;r.parent;)r=r.parent,r.logger.bindings&&t.push(r.logger.bindings);return t.reverse()}(r);0!==u.length&&(r[c]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(u,r[c]))}function l(e,t,r,n){for(const i in e)if(n&&e[i]instanceof Error)e[i]=c.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const n in e[i])t.indexOf(n)>-1&&n in r&&(e[i][n]=r[n](e[i][n]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t}function h(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?y:b}function f(){return{}}function m(e){return e}function g(){}function y(){return!1}function b(){return Date.now()}return c.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},c.stdSerializers=r,c.stdTimeFunctions=Object.assign({},{nullTime:y,epochTime:b,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),browser$g.exports.default=c,browser$g.exports.pino=c,browser$g.exports}var browserExports$2=requireBrowser$f();const e$c=getDefaultExportFromCjs$3(browserExports$2),_Logger$1=class e{constructor(e={}){const t="true"===process$1$2.env.DISABLE_LOGS,r=e.silent||t,n=r?"silent":e.level||"info";this.moduleContext=e.module||"app";const i={level:n,enabled:!r,transport:!r&&!1!==e.prettyPrint?{target:"pino-pretty",options:{colorize:!0,translateTime:"SYS:standard",ignore:"pid,hostname"}}:void 0};this.logger=e$c(i)}static getInstance(t={}){const r=t.module||"default";if("true"===process$1$2.env.DISABLE_LOGS&&e.instances.has(r)){"silent"!==e.instances.get(r).getLevel()&&e.instances.delete(r)}return e.instances.has(r)||e.instances.set(r,new e(t)),e.instances.get(r)}setLogLevel(e){this.logger.level=e}getLevel(){return this.logger.level}setSilent(e){e&&(this.logger.level="silent")}setModule(e){this.moduleContext=e}debug(...e){this.logger.debug({module:this.moduleContext},...e)}info(...e){this.logger.info({module:this.moduleContext},...e)}warn(...e){this.logger.warn({module:this.moduleContext},...e)}error(...e){this.logger.error({module:this.moduleContext},...e)}trace(...e){this.logger.trace({module:this.moduleContext},...e)}};_Logger$1.instances=new Map;let Logger$3=_Logger$1; /** * @license * Copyright 2009 The Closure Library Authors * Copyright 2020 Daniel Wirtz / The long.js Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 */var wasm=null;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Long(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function isLong(e){return!0===(e&&e.__isLong__)}function ctz32(e){var t=Math.clz32(e&-e);return e?31-t:t}Long.prototype.__isLong__,Object.defineProperty(Long.prototype,"__isLong__",{value:!0}),Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=UINT_CACHE[e])?n:(r=fromBits(e,0,!0),i&&(UINT_CACHE[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=INT_CACHE[e])?n:(r=fromBits(e,e<0?-1:0,!1),i&&(INT_CACHE[e]=r),r)}function fromNumber(e,t){if(isNaN(e))return t?UZERO:ZERO;if(t){if(e<0)return UZERO;if(e>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(e<=-0x8000000000000000)return MIN_VALUE;if(e+1>=TWO_PWR_63_DBL)return MAX_VALUE}return e<0?fromNumber(-e,t).neg():fromBits(e%TWO_PWR_32_DBL|0,e/TWO_PWR_32_DBL|0,t)}function fromBits(e,t,r){return new Long(e,t,r)}Long.fromInt=fromInt,Long.fromNumber=fromNumber,Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(e,t,r){if(0===e.length)throw Error("empty string");if("number"==typeof t?(r=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?UZERO:ZERO;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return fromString(e.substring(1),t,r).neg();for(var i=fromNumber(pow_dbl(r,8)),o=ZERO,a=0;a<e.length;a+=8){var s=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+s),r);if(s<8){var u=fromNumber(pow_dbl(r,s));o=o.mul(u).add(fromNumber(c))}else o=(o=o.mul(i)).add(fromNumber(c))}return o.unsigned=t,o}function fromValue(e,t){return"number"==typeof e?fromNumber(e,t):"string"==typeof e?fromString(e,t):fromBits(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}Long.fromString=fromString,Long.fromValue=fromValue;var TWO_PWR_16_DBL=65536,TWO_PWR_24_DBL=1<<24,TWO_PWR_32_DBL=TWO_PWR_16_DBL*TWO_PWR_16_DBL,TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL,TWO_PWR_63_DBL=TWO_PWR_64_DBL/2,TWO_PWR_24=fromInt(TWO_PWR_24_DBL),ZERO=fromInt(0);Long.ZERO=ZERO;var UZERO=fromInt(0,!0);Long.UZERO=UZERO;var ONE=fromInt(1);Long.ONE=ONE;var UONE=fromInt(1,!0);Long.UONE=UONE;var NEG_ONE=fromInt(-1);Long.NEG_ONE=NEG_ONE;var MAX_VALUE=fromBits(-1,2147483647,!1);Long.MAX_VALUE=MAX_VALUE;var MAX_UNSIGNED_VALUE=fromBits(-1,-1,!0);Long.MAX_UNSIGNED_VALUE=MAX_UNSIGNED_VALUE;var MIN_VALUE=fromBits(0,-2147483648,!1);Long.MIN_VALUE=MIN_VALUE;var LongPrototype=Long.prototype;LongPrototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},LongPrototype.toNumber=function(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)},LongPrototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(MIN_VALUE)){var t=fromNumber(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=fromNumber(pow_dbl(e,6),this.unsigned),o=this,a="";;){var s=o.div(i),c=(o.sub(s.mul(i)).toInt()>>>0).toString(e);if((o=s).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},LongPrototype.getHighBits=function(){return this.high},LongPrototype.getHighBitsUnsigned=function(){return this.high>>>0},LongPrototype.getLowBits=function(){return this.low},LongPrototype.getLowBitsUnsigned=function(){return this.low>>>0},LongPrototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},LongPrototype.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&(-1===e&&!(0===this.low&&-2097152===this.high))},LongPrototype.isZero=function(){return 0===this.high&&0===this.low},LongPrototype.eqz=LongPrototype.isZero,LongPrototype.isNegative=function(){return!this.unsigned&&this.high<0},LongPrototype.isPositive=function(){return this.unsigned||this.high>=0},LongPrototype.isOdd=function(){return!(1&~this.low)},LongPrototype.isEven=function(){return!(1&this.low)},LongPrototype.equals=function(e){return isLong(e)||(e=fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},LongPrototype.eq=LongPrototype.equals,LongPrototype.notEquals=function(e){return!this.eq(e)},LongPrototype.neq=LongPrototype.notEquals,LongPrototype.ne=LongPrototype.notEquals,LongPrototype.lessThan=function(e){return this.comp(e)<0},LongPrototype.lt=LongPrototype.lessThan,LongPrototype.lessThanOrEqual=function(e){return this.comp(e)<=0},LongPrototype.lte=LongPrototype.lessThanOrEqual,LongPrototype.le=LongPrototype.lessThanOrEqual,LongPrototype.greaterThan=function(e){return this.comp(e)>0},LongPrototype.gt=LongPrototype.greaterThan,LongPrototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},LongPrototype.gte=LongPrototype.greaterThanOrEqual,LongPrototype.ge=LongPrototype.greaterThanOrEqual,LongPrototype.compare=function(e){if(isLong(e)||(e=fromValue(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},LongPrototype.comp=LongPrototype.compare,LongPrototype.negate=function(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE)},LongPrototype.neg=LongPrototype.negate,LongPrototype.add=function(e){isLong(e)||(e=fromValue(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,o=e.high>>>16,a=65535&e.high,s=e.low>>>16,c=0,u=0,l=0,d=0;return l+=(d+=i+(65535&e.low))>>>16,u+=(l+=n+s)>>>16,c+=(u+=r+a)>>>16,c+=t+o,fromBits((l&=65535)<<16|(d&=65535),(c&=65535)<<16|(u&=65535),this.unsigned)},LongPrototype.subtract=function(e){return isLong(e)||(e=fromValue(e)),this.add(e.neg())},LongPrototype.sub=LongPrototype.subtract,LongPrototype.multiply=function(e){if(this.isZero())return this;if(isLong(e)||(e=fromValue(e)),wasm)return fromBits(wasm.mul(this.low,this.high,e.low,e.high),wasm.get_high(),this.unsigned);if(e.isZero())return this.unsigned?UZERO:ZERO;if(this.eq(MIN_VALUE))return e.isOdd()?MIN_VALUE:ZERO;if(e.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(TWO_PWR_24)&&e.lt(TWO_PWR_24))return fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,o=e.high>>>16,a=65535&e.high,s=e.low>>>16,c=65535&e.low,u=0,l=0,d=0,p=0;return d+=(p+=i*c)>>>16,l+=(d+=n*c)>>>16,d&=65535,l+=(d+=i*s)>>>16,u+=(l+=r*c)>>>16,l&=65535,u+=(l+=n*s)>>>16,l&=65535,u+=(l+=i*a)>>>16,u+=t*c+r*s+n*a+i*o,fromBits((d&=65535)<<16|(p&=65535),(u&=65535)<<16|(l&=65535),this.unsigned)},LongPrototype.mul=LongPrototype.multiply,LongPrototype.divide=function(e){if(isLong(e)||(e=fromValue(e)),e.isZero())throw Error("division by zero");var t,r,n;if(wasm)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?fromBits((this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,e.low,e.high),wasm.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?UZERO:ZERO;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return UZERO;if(e.gt(this.shru(1)))return UONE;n=UZERO}else{if(this.eq(MIN_VALUE))return e.eq(ONE)||e.eq(NEG_ONE)?MIN_VALUE:e.eq(MIN_VALUE)?ONE:(t=this.shr(1).div(e).shl(1)).eq(ZERO)?e.isNegative()?ONE:NEG_ONE:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=ZERO}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var i=Math.ceil(Math.log(t)/Math.LN2),o=i<=48?1:pow_dbl(2,i-48),a=fromNumber(t),s=a.mul(e);s.isNegative()||s.gt(r);)s=(a=fromNumber(t-=o,this.unsigned)).mul(e);a.isZero()&&(a=ONE),n=n.add(a),r=r.sub(s)}return n},LongPrototype.div=LongPrototype.divide,LongPrototype.modulo=function(e){return isLong(e)||(e=fromValue(e)),wasm?fromBits((this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,e.low,e.high),wasm.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},LongPrototype.mod=LongPrototype.modulo,LongPrototype.rem=LongPrototype.modulo,LongPrototype.not=function(){return fromBits(~this.low,~this.high,this.unsigned)},LongPrototype.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},LongPrototype.clz=LongPrototype.countLeadingZeros,LongPrototype.countTrailingZeros=function(){return this.low?ctz32(this.low):ctz32(this.high)+32},LongPrototype.ctz=LongPrototype.countTrailingZeros,LongPrototype.and=function(e){return isLong(e)||(e=fromValue(e)),fromBits(this.low&e.low,this.high&e.high,this.unsigned)},LongPrototype.or=function(e){return isLong(e)||(e=fromValue(e)),fromBits(this.low|e.low,this.high|e.high,this.unsigned)},LongPrototype.xor=function(e){return isLong(e)||(e=fromValue(e)),fromBits(this.low^e.low,this.high^e.high,this.unsigned)},LongPrototype.shiftLeft=function(e){return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):fromBits(0,this.low<<e-32,this.unsigned)},LongPrototype.shl=LongPrototype.shiftLeft,LongPrototype.shiftRight=function(e){return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},LongPrototype.shr=LongPrototype.shiftRight,LongPrototype.shiftRightUnsigned=function(e){return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?fromBits(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):fromBits(32===e?this.high:this.high>>>e-32,0,this.unsigned)},LongPrototype.shru=LongPrototype.shiftRightUnsigned,LongPrototype.shr_u=LongPrototype.shiftRightUnsigned,LongPrototype.rotateLeft=function(e){var t;return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?fromBits(this.high,this.low,this.unsigned):e<32?(t=32-e,fromBits(this.low<<e|this.high>>>t,this.high<<e|this.low>>>t,this.unsigned)):(t=32-(e-=32),fromBits(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},LongPrototype.rotl=LongPrototype.rotateLeft,LongPrototype.rotateRight=function(e){var t;return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?fromBits(this.high,this.low,this.unsigned):e<32?(t=32-e,fromBits(this.high<<t|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned)):(t=32-(e-=32),fromBits(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},LongPrototype.rotr=LongPrototype.rotateRight,LongPrototype.toSigned=function(){return this.unsigned?fromBits(this.low,this.high,!1):this},LongPrototype.toUnsigned=function(){return this.unsigned?this:fromBits(this.low,this.high,!0)},LongPrototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},LongPrototype.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},LongPrototype.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Long.fromBytes=function(e,t,r){return r?Long.fromBytesLE(e,t):Long.fromBytesBE(e,t)},Long.fromBytesLE=function(e,t){return new Long(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Long.fromBytesBE=function(e,t){return new Long(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(Long.fromBigInt=function(e,t){return fromBits(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},Long.fromValue=function(e,t){return"bigint"==typeof e?Long.fromBigInt(e,t):fromValue(e,t)},LongPrototype.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e});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$1=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 t,r,n,i,o,a=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),c=20,u=4,l=-7,d=21,p=-1e7,h=1e7,f=!1,m=1,g=0,y={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},b="0123456789abcdefghijklmnopqrstuvwxyz",v=!0;function w(e,t){var i,o,a,s,l,d,f,m,g=this;if(!(g instanceof w))return new w(e,t);if(null==t){if(e&&!0===e._isBigNumber)return g.s=e.s,void(!e.c||e.e>h?g.c=g.e=null:e.e<p?g.c=[g.e=0]:(g.e=e.e,g.c=e.c.slice()));if((d="number"==typeof e)&&0*e==0){if(g.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,l=e;l>=10;l/=10,s++);return void(s>h?g.c=g.e=null:(g.e=s,g.c=[e]))}m=String(e)}else{if(!isNumeric.test(m=String(e)))return n(g,m,d);g.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(s=m.indexOf("."))>-1&&(m=m.replace(".","")),(l=m.search(/e/i))>0?(s<0&&(s=l),s+=+m.slice(l+1),m=m.substring(0,l)):s<0&&(s=m.length)}else{if(intCheck(t,2,b.length,"Base"),10==t&&v)return I(g=new w(e),c+g.e+1,u);if(m=String(e),d="number"==typeof e){if(0*e!=0)return n(g,m,d,t);if(g.s=1/e<0?(m=m.slice(1),-1):1,w.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else g.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(i=b.slice(0,t),s=l=0,f=m.length;l<f;l++)if(i.indexOf(o=m.charAt(l))<0){if("."==o){if(l>s){s=f;continue}}else if(!a&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){a=!0,l=-1,s=0;continue}return n(g,String(e),d,t)}d=!1,(s=(m=r(m,t,10,g.s)).indexOf("."))>-1?m=m.replace(".",""):s=m.length}for(l=0;48===m.charCodeAt(l);l++);for(f=m.length;48===m.charCodeAt(--f););if(m=m.slice(l,++f)){if(f-=l,d&&w.DEBUG&&f>15&&(e>MAX_SAFE_INTEGER$1||e!==mathfloor(e)))throw Error(tooManyDigits+g.s*e);if((s=s-l-1)>h)g.c=g.e=null;else if(s<p)g.c=[g.e=0];else{if(g.e=s,g.c=[],l=(s+1)%LOG_BASE,s<0&&(l+=LOG_BASE),l<f){for(l&&g.c.push(+m.slice(0,l)),f-=LOG_BASE;l<f;)g.c.push(+m.slice(l,l+=LOG_BASE));l=LOG_BASE-(m=m.slice(l)).length}else l-=f;for(;l--;m+="0");g.c.push(+m)}}else g.c=[g.e=0]}function _(e,t,r,n){var i,o,a,s,c;if(null==r?r=u:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)c=coeffToString(e.c),c=1==n||2==n&&(a<=l||a>=d)?toExponential(c,a):toFixedPoint(c,a,"0");else if(o=(e=I(new w(e),t,r)).e,s=(c=coeffToString(e.c)).length,1==n||2==n&&(t<=o||o<=l)){for(;s<t;c+="0",s++);c=toExponential(c,o)}else if(t-=a,c=toFixedPoint(c,o,"0"),o+1>s){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-s)>0)for(o+1==s&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function x(e,t){for(var r,n,i=1,o=new w(e[0]);i<e.length;i++)(!(n=new w(e[i])).s||(r=compare(o,n))===t||0===r&&o.s===t)&&(o=n);return o}function k(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*LOG_BASE-1)>h?e.c=e.e=null:r<p?e.c=[e.e=0]:(e.e=r,e.c=t),e}function I(e,t,r,n){var i,o,a,s,c,u,l,d=e.c,f=POWS_TEN;if(d){e:{for(i=1,s=d[0];s>=10;s/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,c=d[u=0],l=mathfloor(c/f[i-a-1]%10);else if((u=mathceil((o+1)/LOG_BASE))>=d.length){if(!n)break e;for(;d.length<=u;d.push(0));c=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(c=s=d[u],i=1;s>=10;s/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:mathfloor(c/f[i-a-1]%10)}if(n=n||t<0||null!=d[u+1]||(a<0?c:c%f[i-a-1]),n=r<4?(l||n)&&(0==r||r==(e.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(o>0?a>0?c/f[i-a]:0:d[u-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,n?(t-=e.e+1,d[0]=f[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):d[0]=e.e=0,e;if(0==o?(d.length=u,s=1,u--):(d.length=u+1,s=f[LOG_BASE-o],d[u]=a>0?mathfloor(c/f[i-a]%f[a])*s:0),n)for(;;){if(0==u){for(o=1,a=d[0];a>=10;a/=10,o++);for(a=d[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(e.e++,d[0]==BASE&&(d[0]=1));break}if(d[u]+=s,d[u]!=BASE)break;d[u--]=0,s=1}for(o=d.length;0===d[--o];d.pop());}e.e>h?e.c=e.e=null:e.e<p&&(e.c=[e.e=0])}return e}function T(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=l||r>=d?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return w.clone=clone,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.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),c=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),u=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-1e9,0,t),intCheck(r[1],0,MAX,t),l=r[0],d=r[1]):(intCheck(r,-1e9,MAX,t),l=-(d=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-1e9,-1,t),intCheck(r[1],1,MAX,t),p=r[0],h=r[1];else{if(intCheck(r,-1e9,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);p=-(h=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){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw f=!r,Error(bignumberError+"crypto unavailable");f=r}else f=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),m=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),g=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);y=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);v="0123456789"==r.slice(0,10),b=r}}return{DECIMAL_PLACES:c,ROUNDING_MODE:u,EXPONENTIAL_AT:[l,d],RANGE:[p,h],CRYPTO:f,MODULO_MODE:m,POW_PRECISION:g,FORMAT:y,ALPHABET:b}},w.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!w.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)&&i>=-1e9&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}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||r>=BASE||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)},w.maximum=w.max=function(){return x(arguments,-1)},w.minimum=w.min=function(){return x(arguments,1)},w.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,a,u=0,l=[],d=new w(s);if(null==e?e=c:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),f)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*t[u]+(t[u+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[u]=r[0],t[u+1]=r[1]):(l.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw f=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(l.push(a%1e14),u+=7);u=i/7}if(!f)for(;u<i;)(a=o())<9e15&&(l[u++]=a%1e14);for(i=l[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],l[u]=mathfloor(i/a)*a);0===l[u];l.pop(),u--);if(u<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=LOG_BASE);for(u=1,a=l[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return d.e=n,d.c=l,d}),w.sum=function(){for(var e=1,t=arguments,r=new w(t[0]);e<t.length;)r=r.plus(t[e++]);return r},r=function(){var e="0123456789";function r(e,t,r,n){for(var i,o,a=[0],s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,o,a,s){var l,d,p,h,f,m,y,v,_=n.indexOf("."),x=c,k=u;for(_>=0&&(h=g,g=0,n=n.replace(".",""),m=(v=new w(i)).pow(n.length-_),g=h,v.c=r(toFixedPoint(coeffToString(m.c),m.e,"0"),10,o,e),v.e=v.c.length),p=h=(y=r(n,i,o,s?(l=b,e):(l=e,b))).length;0==y[--h];y.pop());if(!y[0])return l.charAt(0);if(_<0?--p:(m.c=y,m.e=p,m.s=a,y=(m=t(m,v,x,k,o)).c,f=m.r,p=m.e),_=y[d=p+x+1],h=o/2,f=f||d<0||null!=y[d+1],f=k<4?(null!=_||f)&&(0==k||k==(m.s<0?3:2)):_>h||_==h&&(4==k||f||6==k&&1&y[d-1]||k==(m.s<0?8:7)),d<1||!y[0])n=f?toFixedPoint(l.charAt(1),-x,l.charAt(0)):l.charAt(0);else{if(y.length=d,f)for(--o;++y[--d]>o;)y[d]=0,d||(++p,y=[1].concat(y));for(h=y.length;!y[--h];);for(_=0,n="";_<=h;n+=l.charAt(y[_++]));n=toFixedPoint(n,p,l.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,a,s=0,c=e.length,u=t%SQRT_BASE,l=t/SQRT_BASE|0;for(e=e.slice();c--;)s=((i=u*(o=e[c]%SQRT_BASE)+(n=l*o+(a=e[c]/SQRT_BASE|0)*u)%SQRT_BASE*SQRT_BASE+s)/r|0)+(n/SQRT_BASE|0)+l*a,e[c]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?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 r(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]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,s){var c,u,l,d,p,h,f,m,g,y,b,v,_,x,k,T,E,A=n.s==i.s?1:-1,$=n.c,S=i.c;if(!($&&$[0]&&S&&S[0]))return new w(n.s&&i.s&&($?!S||$[0]!=S[0]:S)?$&&0==$[0]||!S?0*A:A/0:NaN);for(g=(m=new w(A)).c=[],A=o+(u=n.e-i.e)+1,s||(s=BASE,u=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),A=A/LOG_BASE|0),l=0;S[l]==($[l]||0);l++);if(S[l]>($[l]||0)&&u--,A<0)g.push(1),d=!0;else{for(x=$.length,T=S.length,l=0,A+=2,(p=mathfloor(s/(S[0]+1)))>1&&(S=e(S,p,s),$=e($,p,s),T=S.length,x=$.length),_=T,b=(y=$.slice(0,T)).length;b<T;y[b++]=0);E=S.slice(),E=[0].concat(E),k=S[0],S[1]>=s/2&&k++;do{if(p=0,(c=t(S,y,T,b))<0){if(v=y[0],T!=b&&(v=v*s+(y[1]||0)),(p=mathfloor(v/k))>1)for(p>=s&&(p=s-1),f=(h=e(S,p,s)).length,b=y.length;1==t(h,y,f,b);)p--,r(h,T<f?E:S,f,s),f=h.length,c=1;else 0==p&&(c=p=1),f=(h=S.slice()).length;if(f<b&&(h=[0].concat(h)),r(y,h,b,s),b=y.length,-1==c)for(;t(S,y,T,b)<1;)p++,r(y,T<b?E:S,b,s),b=y.length}else 0===c&&(p++,y=[0]);g[l++]=p,y[0]?y[b++]=$[_]||0:(y=[$[_]],b=1)}while((_++<x||null!=y[0])&&A--);d=null!=y[0],g[0]||g.splice(0,1)}if(s==BASE){for(l=1,A=g[0];A>=10;A/=10,l++);I(m,o+(m.e=l+u*LOG_BASE-1)+1,a,d)}else m.e=u,m.r=+d;return m}}(),n=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,a,s,c){var u,l=s?a:a.replace(i,"");if(n.test(l))o.s=isNaN(l)?null:l<0?-1:1;else{if(!s&&(l=l.replace(e,(function(e,t,r){return u="x"==(r=r.toLowerCase())?16:"b"==r?2:8,c&&c!=u?e:t})),c&&(u=c,l=l.replace(t,"$1").replace(r,"0.$1")),a!=l))return new w(l,u);if(w.DEBUG)throw Error(bignumberError+"Not a"+(c?" base "+c:"")+" number: "+a);o.s=null}o.c=o.e=null}}(),a.absoluteValue=a.abs=function(){var e=new w(this);return e.s<0&&(e.s=1),e},a.comparedTo=function(e,t){return compare(this,new w(e,t))},a.decimalPlaces=a.dp=function(e,t){var r,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==t?t=u:intCheck(t,0,8),I(new w(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},a.dividedBy=a.div=function(e,r){return t(this,new w(e,r),c,u)},a.dividedToIntegerBy=a.idiv=function(e,r){return t(this,new w(e,r),0,1)},a.exponentiatedBy=a.pow=function(e,t){var r,n,i,o,a,c,l,d,p=this;if((e=new w(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=t&&(t=new w(t)),a=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new w(Math.pow(+T(p),a?e.s*(2-isOdd(e)):+T(e))),t?d.mod(t):d;if(c=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new w(NaN);(n=!c&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||a&&p.c[1]>=24e7:p.c[0]<8e13||a&&p.c[0]<=9999975e7)))return o=p.s<0&&isOdd(e)?-0:0,p.e>-1&&(o=1/o),new w(c?1/o:o);g&&(o=mathceil(g/LOG_BASE+2))}for(a?(r=new w(.5),c&&(e.s=1),l=isOdd(e)):l=(i=Math.abs(+T(e)))%2,d=new w(s);;){if(l){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;l=i%2}else if(I(e=e.times(r),e.e+1,1),e.e>14)l=isOdd(e);else{if(0===(i=+T(e)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?d:(c&&(d=s.div(d)),t?d.mod(t):o?I(d,g,u,undefined):d)},a.integerValue=function(e){var t=new w(this);return null==e?e=u:intCheck(e,0,8),I(t,t.e+1,e)},a.isEqualTo=a.eq=function(e,t){return 0===compare(this,new w(e,t))},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(e,t){return compare(this,new w(e,t))>0},a.isGreaterThanOrEqualTo=a.gte=function(e,t){return 1===(t=compare(this,new w(e,t)))||0===t},a.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},a.isLessThan=a.lt=function(e,t){return compare(this,new w(e,t))<0},a.isLessThanOrEqualTo=a.lte=function(e,t){return-1===(t=compare(this,new w(e,t)))||0===t},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&0==this.c[0]},a.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new w(e,t)).s,!s||!t)return new w(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/LOG_BASE,l=e.e/LOG_BASE,d=a.c,p=e.c;if(!c||!l){if(!d||!p)return d?(e.s=-t,e):new w(p?a:NaN);if(!d[0]||!p[0])return p[0]?(e.s=-t,e):new w(d[0]?a:3==u?-0:0)}if(c=bitFloor(c),l=bitFloor(l),d=d.slice(),s=c-l){for((o=s<0)?(s=-s,i=d):(l=c,i=p),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=d.length)<(t=p.length))?s:t,s=t=0;t<n;t++)if(d[t]!=p[t]){o=d[t]<p[t];break}if(o&&(i=d,d=p,p=i,e.s=-e.s),(t=(n=p.length)-(r=d.length))>0)for(;t--;d[r++]=0);for(t=BASE-1;n>s;){if(d[--n]<p[n]){for(r=n;r&&!d[--r];d[r]=t);--d[r],d[n]+=BASE}d[n]-=p[n]}for(;0==d[0];d.splice(0,1),--l);return d[0]?k(e,d,l):(e.s=3==u?-1:1,e.c=[e.e=0],e)},a.modulo=a.mod=function(e,r){var n,i,o=this;return e=new w(e,r),!o.c||!e.s||e.c&&!e.c[0]?new w(NaN):!e.c||o.c&&!o.c[0]?new w(o):(9==m?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,m),(e=o.minus(n.times(e))).c[0]||1!=m||(e.s=o.s),e)},a.multipliedBy=a.times=function(e,t){var r,n,i,o,a,s,c,u,l,d,p,h,f,m,g,y=this,b=y.c,v=(e=new w(e,t)).c;if(!(b&&v&&b[0]&&v[0]))return!y.s||!e.s||b&&!b[0]&&!v||v&&!v[0]&&!b?e.c=e.e=e.s=null:(e.s*=y.s,b&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(y.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=y.s,(c=b.length)<(d=v.length)&&(f=b,b=v,v=f,i=c,c=d,d=i),i=c+d,f=[];i--;f.push(0));for(m=BASE,g=SQRT_BASE,i=d;--i>=0;){for(r=0,p=v[i]%g,h=v[i]/g|0,o=i+(a=c);o>i;)r=((u=p*(u=b[--a]%g)+(s=h*u+(l=b[a]/g|0)*p)%g*g+f[o]+r)/m|0)+(s/g|0)+h*l,f[o--]=u%m;f[o]=r}return r?++n:f.splice(0,1),k(e,f,n)},a.negated=function(){var e=new w(this);return e.s=-e.s||null,e},a.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new w(e,t)).s,!i||!t)return new w(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,c=e.c;if(!o||!a){if(!s||!c)return new w(i/0);if(!s[0]||!c[0])return c[0]?e:new w(s[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=c):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=c.length)<0&&(r=c,c=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return i&&(s=[i].concat(s),++a),k(e,s,a)},a.precision=a.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=u:intCheck(t,0,8),I(new w(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*LOG_BASE+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},a.shiftedBy=function(e){return intCheck(e,-9007199254740991,MAX_SAFE_INTEGER$1),this.times("1e"+e)},a.squareRoot=a.sqrt=function(){var e,r,n,i,o,a=this,s=a.c,l=a.s,d=a.e,p=c+4,h=new w("0.5");if(1!==l||!s||!s[0])return new w(!l||l<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(l=Math.sqrt(+T(a)))||l==1/0?(((r=coeffToString(s)).length+d)%2==0&&(r+="0"),l=Math.sqrt(+r),d=bitFloor((d+1)/2)-(d<0||d%2),n=new w(r=l==1/0?"5e"+d:(r=l.toExponential()).slice(0,r.indexOf("e")+1)+d)):n=new w(l+""),n.c[0])for((l=(d=n.e)+p)<3&&(l=0);;)if(o=n,n=h.times(o.plus(t(a,o,p,1))),coeffToString(o.c).slice(0,l)===(r=coeffToString(n.c)).slice(0,l)){if(n.e<d&&--l,"9999"!=(r=r.slice(l-3,l+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(I(n,n.e+c+2,1),e=!n.times(n).eq(a));break}if(!i&&(I(o,o.e+c+2,0),o.times(o).eq(a))){n=o;break}p+=4,l+=4,i=1}return I(n,n.e+c+1,u,e)},a.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),_(this,e,t,1)},a.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),_(this,e,t)},a.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=y;else if("object"!=typeof r)throw Error(bignumberError+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,a=n.split("."),s=+r.groupSize,c=+r.secondaryGroupSize,u=r.groupSeparator||"",l=a[0],d=a[1],p=i.s<0,h=p?l.slice(1):l,f=h.length;if(c&&(o=s,s=c,c=o,f-=o),s>0&&f>0){for(o=f%s||s,l=h.substr(0,o);o<f;o+=s)l+=u+h.substr(o,s);c>0&&(l+=u+h.slice(o)),p&&(l="-"+l)}n=d?l+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+n+(r.suffix||"")},a.toFraction=function(e){var r,n,i,o,a,c,l,d,p,f,m,g,y=this,b=y.c;if(null!=e&&(!(l=new w(e)).isInteger()&&(l.c||1!==l.s)||l.lt(s)))throw Error(bignumberError+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+T(l));if(!b)return new w(y);for(r=new w(s),p=n=new w(s),i=d=new w(s),g=coeffToString(b),a=r.e=g.length-y.e-1,r.c[0]=POWS_TEN[(c=a%LOG_BASE)<0?LOG_BASE+c:c],e=!e||l.comparedTo(r)>0?a>0?r:p:l,c=h,h=1/0,l=new w(g),d.c[0]=0;f=t(l,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,p=d.plus(f.times(o=p)),d=o,r=l.minus(f.times(o=r)),l=o;return o=t(e.minus(n),i,0,1),d=d.plus(o.times(p)),n=n.plus(o.times(i)),d.s=p.s=y.s,m=t(p,i,a*=2,u).minus(y).abs().comparedTo(t(d,n,a,u).minus(y).abs())<1?[p,i]:[d,n],h=c,m},a.toNumber=function(){return+T(this)},a.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),_(this,e,t,2)},a.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=l||o>=d?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&v?t=toFixedPoint(coeffToString((n=I(new w(n),c+o+1,u)).c),n.e,"0"):(intCheck(e,2,b.length,"Base"),t=r(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},a.valueOf=a.toJSON=function(){return T(this)},a._isBigNumber=!0,a[Symbol.toStringTag]="BigNumber",a[Symbol.for("nodejs.util.inspect.custom")]=a.valueOf,null!=e&&w.set(e),w}function bitFloor(e){var t=0|e;return e>0||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,c=e.e,u=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=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(s=(c=i.length)<(u=o.length)?c:u,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return c==u?0:c>u^r?1:-1}function intCheck(e,t,r,n){if(e<t||e>r||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||e>r?" 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(e.length>1?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$1=clone(),lib={},indexMinimal={},minimal$1={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;return hasRequiredAspromise=1,aspromise=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,a){r[n]=function(e){if(o)if(o=!1,e)a(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(s){o&&(o=!1,a(s))}}))},aspromise}var base64$1={},hasRequiredBase64,eventemitter,hasRequiredEventemitter,float,hasRequiredFloat,inquire_1,hasRequiredInquire;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(e){var t=e;t.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var r=new Array(64),n=new Array(123),i=0;i<64;)n[r[i]=i<26?i+65:i<52?i+71:i<62?i-4:i-59|43]=i++;t.encode=function(e,t,n){for(var i,o=null,a=[],s=0,c=0;t<n;){var u=e[t++];switch(c){case 0:a[s++]=r[u>>2],i=(3&u)<<4,c=1;break;case 1:a[s++]=r[i|u>>4],i=(15&u)<<2,c=2;break;case 2:a[s++]=r[i|u>>6],a[s++]=r[63&u],c=0}s>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),s=0)}return c&&(a[s++]=r[i],a[s++]=61,1===c&&(a[s++]=61)),o?(s&&o.push(String.fromCharCode.apply(String,a.slice(0,s))),o.join("")):String.fromCharCode.apply(String,a.slice(0,s))};var o="invalid encoding";t.decode=function(e,t,r){for(var i,a=r,s=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&s>1)break;if(void 0===(u=n[u]))throw Error(o);switch(s){case 0:i=u,s=1;break;case 1:t[r++]=i<<2|(48&u)>>4,i=u,s=2;break;case 2:t[r++]=(15&i)<<4|(60&u)>>2,i=u,s=3;break;case 3:t[r++]=(3&i)<<6|u,s=0}}if(1===s)throw Error(o);return r-a},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(base64$1)),base64$1}function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;function e(){this._listeners={}}return hasRequiredEventemitter=1,eventemitter=e,e.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},e.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this},eventemitter}function requireFloat(){if(hasRequiredFloat)return float;function e(e){return"undefined"!=typeof Float32Array?func