Socket
Socket
Sign inDemoInstall

xrpl-client

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xrpl-client - npm Package Compare versions

Comparing version 1.9.0 to 1.9.1

4

dist/browser.min.js

@@ -7,3 +7,3 @@ require=function e(t,n,r){function i(s,l){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!l&&u)return u(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var c=n[s]={exports:{}};t[s][0].call(c.exports,(function(e){return i(t[s][1][e]||e)}),c,c.exports,e,t,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0})},{}],2:[function(e,t,n){(function(n){(function(){"use strict";var r=e("object-assign");

* @license MIT
*/function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}function o(e){return n.Buffer&&"function"==typeof n.Buffer.isBuffer?n.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var s=e("util/"),l=Object.prototype.hasOwnProperty,u=Array.prototype.slice,a="foo"===function(){}.name;function c(e){return Object.prototype.toString.call(e)}function f(e){return!o(e)&&("function"==typeof n.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var d=t.exports=y,p=/\s*function\s+([^\(\s]*)\s*/;function h(e){if(s.isFunction(e)){if(a)return e.name;var t=e.toString().match(p);return t&&t[1]}}function v(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function m(e){if(a||!s.isFunction(e))return s.inspect(e);var t=h(e);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,n,r,i){throw new d.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function y(e,t){e||g(e,!0,t,"==",d.ok)}function b(e,t,n,r){if(e===t)return!0;if(o(e)&&o(t))return 0===i(e,t);if(s.isDate(e)&&s.isDate(t))return e.getTime()===t.getTime();if(s.isRegExp(e)&&s.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&c(e)===c(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var l=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==l&&l===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(s.isPrimitive(e)||s.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=C(e),o=C(t);if(i&&!o||!i&&o)return!1;if(i)return b(e=u.call(e),t=u.call(t),n);var l,a,c=x(e),f=x(t);if(c.length!==f.length)return!1;for(c.sort(),f.sort(),a=c.length-1;a>=0;a--)if(c[a]!==f[a])return!1;for(a=c.length-1;a>=0;a--)if(!b(e[l=c[a]],t[l],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function C(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function _(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&g(i,n,"Missing expected exception"+r);var o="string"==typeof r,l=!e&&i&&!n;if((!e&&s.isError(i)&&o&&w(i,n)||l)&&g(i,n,"Got unwanted exception"+r),e&&i&&n&&!w(i,n)||!e&&i)throw i}d.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return v(m(e.actual),128)+" "+e.operator+" "+v(m(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=h(t),o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}},s.inherits(d.AssertionError,Error),d.fail=g,d.ok=y,d.equal=function(e,t,n){e!=t&&g(e,t,n,"==",d.equal)},d.notEqual=function(e,t,n){e==t&&g(e,t,n,"!=",d.notEqual)},d.deepEqual=function(e,t,n){b(e,t,!1)||g(e,t,n,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(e,t,n){b(e,t,!0)||g(e,t,n,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(e,t,n){b(e,t,!1)&&g(e,t,n,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&g(t,n,r,"notDeepStrictEqual",e)},d.strictEqual=function(e,t,n){e!==t&&g(e,t,n,"===",d.strictEqual)},d.notStrictEqual=function(e,t,n){e===t&&g(e,t,n,"!==",d.notStrictEqual)},d.throws=function(e,t,n){_(!0,e,t,n)},d.doesNotThrow=function(e,t,n){_(!1,e,t,n)},d.ifError=function(e){if(e)throw e},d.strict=r((function e(t,n){t||g(t,!0,n,"==",e)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var x=Object.keys||function(e){var t=[];for(var n in e)l.call(e,n)&&t.push(n);return t}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":11,"util/":5}],3:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],4:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],5:[function(e,t,n){(function(t,r){(function(){var i=/%[sdj%]/g;n.format=function(e){if(!g(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(l(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(e).replace(i,(function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n<o;u=r[++n])v(u)||!C(u)?s+=" "+u:s+=" "+l(u);return s},n.deprecate=function(e,i){if(y(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(!0===t.noDeprecation)return e;var o=!1;return function(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}};var o,s={};function l(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(t)?r.showHidden=t:t&&n._extend(r,t),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=l.styles[t];return n?"["+l.colors[n][0]+"m"+e+"["+l.colors[n][1]+"m":e}function a(e,t){return e}function c(e,t,r){if(e.customInspect&&t&&x(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return g(i)||(i=c(e,i,r)),i}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(m(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(v(t))return e.stylize("null","null")}(e,t);if(o)return o;var s=Object.keys(t),l=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),_(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(t);if(0===s.length){if(x(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(b(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(w(t))return e.stylize(Date.prototype.toString.call(t),"date");if(_(t))return f(t)}var a,C="",S=!1,O=["{","}"];(p(t)&&(S=!0,O=["[","]"]),x(t))&&(C=" [Function"+(t.name?": "+t.name:"")+"]");return b(t)&&(C=" "+RegExp.prototype.toString.call(t)),w(t)&&(C=" "+Date.prototype.toUTCString.call(t)),_(t)&&(C=" "+f(t)),0!==s.length||S&&0!=t.length?r<0?b(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),a=S?function(e,t,n,r,i){for(var o=[],s=0,l=t.length;s<l;++s)F(t,String(s))?o.push(d(e,t,n,r,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(e,t,n,r,i,!0))})),o}(e,t,r,l,s):s.map((function(n){return d(e,t,r,l,n,S)})),e.seen.pop(),function(e,t,n){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(a,C,O)):O[0]+C+O[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i,o){var s,l,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?l=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(l=e.stylize("[Setter]","special")),F(r,i)||(s="["+i+"]"),l||(e.seen.indexOf(u.value)<0?(l=v(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(l=o?l.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+l.split("\n").map((function(e){return" "+e})).join("\n")):l=e.stylize("[Circular]","special")),y(s)){if(o&&i.match(/^\d+$/))return l;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+l}function p(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function v(e){return null===e}function m(e){return"number"==typeof e}function g(e){return"string"==typeof e}function y(e){return void 0===e}function b(e){return C(e)&&"[object RegExp]"===S(e)}function C(e){return"object"==typeof e&&null!==e}function w(e){return C(e)&&"[object Date]"===S(e)}function _(e){return C(e)&&("[object Error]"===S(e)||e instanceof Error)}function x(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function O(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(y(o)&&(o=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=t.pid;s[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else s[e]=function(){};return s[e]},n.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=h,n.isNull=v,n.isNullOrUndefined=function(e){return null==e},n.isNumber=m,n.isString=g,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=y,n.isRegExp=b,n.isObject=C,n.isDate=w,n.isError=_,n.isFunction=x,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(){var e=new Date,t=[O(e.getHours()),O(e.getMinutes()),O(e.getSeconds())].join(":");return[e.getDate(),E[e.getMonth()],t].join(" ")}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){console.log("%s - %s",j(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":4,_process:12,inherits:3}],6:[function(e,t,n){(function(r){(function(){n.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),e.splice(i,0,n)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG);return e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":7,_process:12}],7:[function(e,t,n){t.exports=function(t){function n(e){let t,i=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),s=i-(t||i);r.diff=s,r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let l=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,i)=>{if("%%"===t)return"%";l++;const o=n.formatters[i];if("function"==typeof o){const n=e[l];t=o.call(r,n),e.splice(l,1),l--}return t})),n.formatArgs.call(r,e);(r.log||n.log).apply(r,e)}return o.namespace=e,o.useColors=n.useColors(),o.color=n.selectColor(e),o.extend=r,o.destroy=n.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?n.enabled(e):i,set:e=>{i=e}}),"function"==typeof n.init&&n.init(o),o}function r(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(i),...n.skips.map(i).map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=e("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((e=>{n[e]=t[e]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n}},{ms:10}],8:[function(e,t,n){var r=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return r()}try{return __global__||r()}finally{delete Object.prototype.__global__}}()},{}],9:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var l,u=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),l=0===a.x}catch(e){l=!1}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,n){if(t)e.call(n);else for(var r=e.length,i=w(e,r),o=0;o<r;++o)i[o].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=w(e,i),s=0;s<i;++s)o[s].call(n,r)}function p(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=w(e,o),l=0;l<o;++l)s[l].call(n,r,i)}function h(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,l=w(e,s),u=0;u<s;++u)l[u].call(n,r,i,o)}function v(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=w(e,i),s=0;s<i;++s)o[s].apply(n,r)}function m(e,t,n,i){var o,s,l;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]):(s=e._events=r(null),e._eventsCount=0),l){if("function"==typeof l?l=s[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),!l.warned&&(o=c(e))&&o>0&&l.length>o){l.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else l=s[t]=n,++e._eventsCount;return e}function g(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function y(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(g,r);return i.listener=n,r.wrapFn=i,i}function b(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):w(i,i.length):[]}function C(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}l?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');u=e}}):s.defaultMaxListeners=u,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){var t,n,r,i,o,s,l="error"===e;if(s=this._events)l=l&&null==s.error;else if(!l)return!1;if(l){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=s[e]))return!1;var a="function"==typeof n;switch(r=arguments.length){case 1:f(n,a,this);break;case 2:d(n,a,this,arguments[1]);break;case 3:p(n,a,this,arguments[1],arguments[2]);break;case 4:h(n,a,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];v(n,a,this,i)}return!0},s.prototype.addListener=function(e,t){return m(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return m(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,y(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,y(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,o,s,l;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){l=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,l||t)}return this},s.prototype.removeAllListeners=function(e){var t,n,o;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var s,l=i(n);for(o=0;o<l.length;++o)"removeListener"!==(s=l[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return b(this,e,!0)},s.prototype.rawListeners=function(e){return b(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):C.call(e,t)},s.prototype.listenerCount=C,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],10:[function(e,t,n){var r=1e3,i=60*r,o=60*i,s=24*o,l=7*s,u=365.25*s;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*u;case"weeks":case"week":case"w":return n*l;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*o;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return a(e,t,s,"day");if(t>=o)return a(e,t,o,"hour");if(t>=i)return a(e,t,i,"minute");if(t>=r)return a(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],11:[function(e,t,n){
*/function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}function o(e){return n.Buffer&&"function"==typeof n.Buffer.isBuffer?n.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var s=e("util/"),l=Object.prototype.hasOwnProperty,u=Array.prototype.slice,a="foo"===function(){}.name;function c(e){return Object.prototype.toString.call(e)}function f(e){return!o(e)&&("function"==typeof n.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var d=t.exports=y,p=/\s*function\s+([^\(\s]*)\s*/;function h(e){if(s.isFunction(e)){if(a)return e.name;var t=e.toString().match(p);return t&&t[1]}}function v(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function m(e){if(a||!s.isFunction(e))return s.inspect(e);var t=h(e);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,n,r,i){throw new d.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function y(e,t){e||g(e,!0,t,"==",d.ok)}function b(e,t,n,r){if(e===t)return!0;if(o(e)&&o(t))return 0===i(e,t);if(s.isDate(e)&&s.isDate(t))return e.getTime()===t.getTime();if(s.isRegExp(e)&&s.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&c(e)===c(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var l=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==l&&l===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(s.isPrimitive(e)||s.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=C(e),o=C(t);if(i&&!o||!i&&o)return!1;if(i)return b(e=u.call(e),t=u.call(t),n);var l,a,c=x(e),f=x(t);if(c.length!==f.length)return!1;for(c.sort(),f.sort(),a=c.length-1;a>=0;a--)if(c[a]!==f[a])return!1;for(a=c.length-1;a>=0;a--)if(!b(e[l=c[a]],t[l],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function C(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function _(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&g(i,n,"Missing expected exception"+r);var o="string"==typeof r,l=!e&&i&&!n;if((!e&&s.isError(i)&&o&&w(i,n)||l)&&g(i,n,"Got unwanted exception"+r),e&&i&&n&&!w(i,n)||!e&&i)throw i}d.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return v(m(e.actual),128)+" "+e.operator+" "+v(m(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=h(t),o=r.indexOf("\n"+i);if(o>=0){var s=r.indexOf("\n",o+1);r=r.substring(s+1)}this.stack=r}}},s.inherits(d.AssertionError,Error),d.fail=g,d.ok=y,d.equal=function(e,t,n){e!=t&&g(e,t,n,"==",d.equal)},d.notEqual=function(e,t,n){e==t&&g(e,t,n,"!=",d.notEqual)},d.deepEqual=function(e,t,n){b(e,t,!1)||g(e,t,n,"deepEqual",d.deepEqual)},d.deepStrictEqual=function(e,t,n){b(e,t,!0)||g(e,t,n,"deepStrictEqual",d.deepStrictEqual)},d.notDeepEqual=function(e,t,n){b(e,t,!1)&&g(e,t,n,"notDeepEqual",d.notDeepEqual)},d.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&g(t,n,r,"notDeepStrictEqual",e)},d.strictEqual=function(e,t,n){e!==t&&g(e,t,n,"===",d.strictEqual)},d.notStrictEqual=function(e,t,n){e===t&&g(e,t,n,"!==",d.notStrictEqual)},d.throws=function(e,t,n){_(!0,e,t,n)},d.doesNotThrow=function(e,t,n){_(!1,e,t,n)},d.ifError=function(e){if(e)throw e},d.strict=r((function e(t,n){t||g(t,!0,n,"==",e)}),d,{equal:d.strictEqual,deepEqual:d.deepStrictEqual,notEqual:d.notStrictEqual,notDeepEqual:d.notDeepStrictEqual}),d.strict.strict=d.strict;var x=Object.keys||function(e){var t=[];for(var n in e)l.call(e,n)&&t.push(n);return t}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":11,"util/":5}],3:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],4:[function(e,t,n){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],5:[function(e,t,n){(function(t,r){(function(){var i=/%[sdj%]/g;n.format=function(e){if(!g(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(l(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,o=r.length,s=String(e).replace(i,(function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n<o;u=r[++n])v(u)||!C(u)?s+=" "+u:s+=" "+l(u);return s},n.deprecate=function(e,i){if(y(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(!0===t.noDeprecation)return e;var o=!1;return function(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}};var o,s={};function l(e,t){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(t)?r.showHidden=t:t&&n._extend(r,t),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=l.styles[t];return n?"["+l.colors[n][0]+"m"+e+"["+l.colors[n][1]+"m":e}function a(e,t){return e}function c(e,t,r){if(e.customInspect&&t&&x(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return g(i)||(i=c(e,i,r)),i}var o=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(m(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(v(t))return e.stylize("null","null")}(e,t);if(o)return o;var s=Object.keys(t),l=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),_(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(t);if(0===s.length){if(x(t)){var u=t.name?": "+t.name:"";return e.stylize("[Function"+u+"]","special")}if(b(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(w(t))return e.stylize(Date.prototype.toString.call(t),"date");if(_(t))return f(t)}var a,C="",O=!1,S=["{","}"];(p(t)&&(O=!0,S=["[","]"]),x(t))&&(C=" [Function"+(t.name?": "+t.name:"")+"]");return b(t)&&(C=" "+RegExp.prototype.toString.call(t)),w(t)&&(C=" "+Date.prototype.toUTCString.call(t)),_(t)&&(C=" "+f(t)),0!==s.length||O&&0!=t.length?r<0?b(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),a=O?function(e,t,n,r,i){for(var o=[],s=0,l=t.length;s<l;++s)F(t,String(s))?o.push(d(e,t,n,r,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(d(e,t,n,r,i,!0))})),o}(e,t,r,l,s):s.map((function(n){return d(e,t,r,l,n,O)})),e.seen.pop(),function(e,t,n){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(a,C,S)):S[0]+C+S[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i,o){var s,l,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?l=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(l=e.stylize("[Setter]","special")),F(r,i)||(s="["+i+"]"),l||(e.seen.indexOf(u.value)<0?(l=v(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(l=o?l.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+l.split("\n").map((function(e){return" "+e})).join("\n")):l=e.stylize("[Circular]","special")),y(s)){if(o&&i.match(/^\d+$/))return l;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+l}function p(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function v(e){return null===e}function m(e){return"number"==typeof e}function g(e){return"string"==typeof e}function y(e){return void 0===e}function b(e){return C(e)&&"[object RegExp]"===O(e)}function C(e){return"object"==typeof e&&null!==e}function w(e){return C(e)&&"[object Date]"===O(e)}function _(e){return C(e)&&("[object Error]"===O(e)||e instanceof Error)}function x(e){return"function"==typeof e}function O(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}n.debuglog=function(e){if(y(o)&&(o=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=t.pid;s[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else s[e]=function(){};return s[e]},n.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=h,n.isNull=v,n.isNullOrUndefined=function(e){return null==e},n.isNumber=m,n.isString=g,n.isSymbol=function(e){return"symbol"==typeof e},n.isUndefined=y,n.isRegExp=b,n.isObject=C,n.isDate=w,n.isError=_,n.isFunction=x,n.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},n.isBuffer=e("./support/isBuffer");var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),E[e.getMonth()],t].join(" ")}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}n.log=function(){console.log("%s - %s",j(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":4,_process:12,inherits:3}],6:[function(e,t,n){(function(r){(function(){n.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),e.splice(i,0,n)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG);return e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":7,_process:12}],7:[function(e,t,n){t.exports=function(t){function n(e){let t,i=null;function o(...e){if(!o.enabled)return;const r=o,i=Number(new Date),s=i-(t||i);r.diff=s,r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let l=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,i)=>{if("%%"===t)return"%";l++;const o=n.formatters[i];if("function"==typeof o){const n=e[l];t=o.call(r,n),e.splice(l,1),l--}return t})),n.formatArgs.call(r,e);(r.log||n.log).apply(r,e)}return o.namespace=e,o.useColors=n.useColors(),o.color=n.selectColor(e),o.extend=r,o.destroy=n.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?n.enabled(e):i,set:e=>{i=e}}),"function"==typeof n.init&&n.init(o),o}function r(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(i),...n.skips.map(i).map((e=>"-"+e))].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1},n.humanize=e("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((e=>{n[e]=t[e]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n}},{ms:10}],8:[function(e,t,n){var r=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return r()}try{return __global__||r()}finally{delete Object.prototype.__global__}}()},{}],9:[function(e,t,n){var r=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=r(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var l,u=10;try{var a={};Object.defineProperty&&Object.defineProperty(a,"x",{value:0}),l=0===a.x}catch(e){l=!1}function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,n){if(t)e.call(n);else for(var r=e.length,i=w(e,r),o=0;o<r;++o)i[o].call(n)}function d(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,o=w(e,i),s=0;s<i;++s)o[s].call(n,r)}function p(e,t,n,r,i){if(t)e.call(n,r,i);else for(var o=e.length,s=w(e,o),l=0;l<o;++l)s[l].call(n,r,i)}function h(e,t,n,r,i,o){if(t)e.call(n,r,i,o);else for(var s=e.length,l=w(e,s),u=0;u<s;++u)l[u].call(n,r,i,o)}function v(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,o=w(e,i),s=0;s<i;++s)o[s].apply(n,r)}function m(e,t,n,i){var o,s,l;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),l=s[t]):(s=e._events=r(null),e._eventsCount=0),l){if("function"==typeof l?l=s[t]=i?[n,l]:[l,n]:i?l.unshift(n):l.push(n),!l.warned&&(o=c(e))&&o>0&&l.length>o){l.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",u.name,u.message)}}else l=s[t]=n,++e._eventsCount;return e}function g(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function y(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(g,r);return i.listener=n,r.wrapFn=i,i}function b(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):w(i,i.length):[]}function C(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function w(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}l?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');u=e}}):s.defaultMaxListeners=u,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){var t,n,r,i,o,s,l="error"===e;if(s=this._events)l=l&&null==s.error;else if(!l)return!1;if(l){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var u=new Error('Unhandled "error" event. ('+t+")");throw u.context=t,u}if(!(n=s[e]))return!1;var a="function"==typeof n;switch(r=arguments.length){case 1:f(n,a,this);break;case 2:d(n,a,this,arguments[1]);break;case 3:p(n,a,this,arguments[1],arguments[2]);break;case 4:h(n,a,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),o=1;o<r;o++)i[o-1]=arguments[o];v(n,a,this,i)}return!0},s.prototype.addListener=function(e,t){return m(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return m(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,y(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,y(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,o,s,l;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(n=i[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=r(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){l=n[s].listener,o=s;break}if(o<0)return this;0===o?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,l||t)}return this},s.prototype.removeAllListeners=function(e){var t,n,o;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=r(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=r(null):delete n[e]),this;if(0===arguments.length){var s,l=i(n);for(o=0;o<l.length;++o)"removeListener"!==(s=l[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=r(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return b(this,e,!0)},s.prototype.rawListeners=function(e){return b(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):C.call(e,t)},s.prototype.listenerCount=C,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],10:[function(e,t,n){var r=1e3,i=60*r,o=60*i,s=24*o,l=7*s,u=365.25*s;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*u;case"weeks":case"week":case"w":return n*l;case"days":case"day":case"d":return n*s;case"hours":case"hour":case"hrs":case"hr":case"h":return n*o;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return a(e,t,s,"day");if(t>=o)return a(e,t,o,"hour");if(t>=i)return a(e,t,i,"minute");if(t>=r)return a(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=o)return Math.round(e/o)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],11:[function(e,t,n){
/*

@@ -14,2 +14,2 @@ object-assign

*/
"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,u=s(e),a=1;a<arguments.length;a++){for(var c in n=Object(arguments[a]))i.call(n,c)&&(u[c]=n[c]);if(r){l=r(n);for(var f=0;f<l.length;f++)o.call(n,l[f])&&(u[l[f]]=n[l[f]])}}return u}},{}],12:[function(e,t,n){var r,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{i="function"==typeof clearTimeout?clearTimeout:l}catch(e){i=l}}();var a,c=[],f=!1,d=-1;function p(){f&&a&&(f=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!f){var e=u(p);f=!0;for(var t=c.length;t;){for(a=c,c=[];++d<t;)a&&a[d].run();d=-1,t=c.length}a=null,f=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new v(e,t)),1!==c.length||f||u(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],13:[function(e,t,n){var r;if("object"==typeof globalThis)r=globalThis;else try{r=e("es5-ext/global")}catch(e){}finally{if(r||"undefined"==typeof window||(r=window),!r)throw new Error("Could not determine global this")}var i=r.WebSocket||r.MozWebSocket,o=e("./version");function s(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(s,e,{get:function(){return i[e]}})})),t.exports={w3cwebsocket:i?s:null,version:o}},{"./version":14,"es5-ext/global":8}],14:[function(e,t,n){t.exports=e("../package.json").version},{"../package.json":15}],15:[function(e,t,n){t.exports={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)",contributors:["Iรฑaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"}},{}],"xrpl-client":[function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,l)}u((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.XrplClient=void 0;const l=s(e("assert")),u=e("events"),a=e("debug"),c=e("websocket");i(e("./types"),n);const f=a.debug("xrplclient"),d=f.extend("warning"),p=f.extend("message"),h=f.extend("node");class v extends u.EventEmitter{constructor(e,t){var n;let r;super(),this.eventBus=new u.EventEmitter,this.closed=!1,this.uplinkReady=!1,this.options={connectAttemptTimeoutSeconds:3,assumeOfflineAfterSeconds:15,maxConnectionAttempts:null},this.callId=0,this.pendingCalls=[],this.subscriptions=[],this.serverState={validatedLedgers:"",reserveBase:null,reserveInc:null,latency:[],fee:[],connectAttempts:-1},t&&Object.assign(this.options,t);const i=()=>{var e;clearTimeout(r);const t=1e3*Number((null===(e=null==this?void 0:this.options)||void 0===e?void 0:e.assumeOfflineAfterSeconds)||15);r=setTimeout((()=>{var e;if(this.uplinkReady){d(`Conn. TIMEOUT, no ledger for ${t} sec.`);try{null===(e=this.connection)||void 0===e||e.close()}catch(e){}}}),t)};i();const s=()=>{var e,t;let n=1;const r=(null===(e=this.options)||void 0===e?void 0:e.maxConnectionAttempts)||null;r&&(n=(((null===(t=this.options)||void 0===t?void 0:t.connectAttemptTimeoutSeconds)||3)-1)/(r-1));return Math.max(1.5,(this.serverState.connectAttempts+1)*n)};this.endpoints=[],e&&(this.endpoints=[...new Set(Array.isArray(e)?e:[e])].map((e=>e.trim())).filter((e=>e.match(/^ws[s]{0,1}:\/\//)))),this.endpoints.length<1&&(this.endpoints=["wss://xrplcluster.com","wss://xrpl.link","wss://s2.ripple.com"],d("No valid WebSocket endpoint(s) specified, falling back to defaults",this.endpoints)),this.endpoint=this.endpoints[0].trim(),this.endpoints.length>1&&!(null===(n=this.options)||void 0===n?void 0:n.maxConnectionAttempts)&&(f(`Multiple endpoints (${this.endpoints.length}) and no maxConnection attempts, set (3)`),Object.assign(this.options,{maxConnectionAttempts:3})),f("Initialized xrpld WebSocket Client"),this.on("ledger",(()=>{v(),i()}));const a=()=>{},v=()=>{this.uplinkReady||(this.serverState.connectAttempts=0,h("Connection ready, fire events"),this.uplinkReady=!0,this.eventBus.emit("flush"),this.emit("online"),this.emit("state",this.getState()))},m=()=>{if(this.closed||this.connection.readyState!==c.w3cwebsocket.OPEN)try{this.connection.close()}catch(e){}else{if(f("Connection opened :)"),this.endpoint.match(/^wss:\/\/(xrplcluster\.com|xrpl\.link|xrpl\.ws)/))try{this.connection.send(JSON.stringify({__api:"state",origin:"xrpl-client@js/ts"}))}catch(e){}this.send({id:"_WsClient_Internal_Subscription",command:"subscribe",streams:["ledger"]},{sendIfNotReady:!0,noReplayAfterReconnect:!0}).then(a,a),this.send({id:"_WsClient_Internal_ServerInfo@"+Number(new Date),command:"server_info"},{sendIfNotReady:!0,noReplayAfterReconnect:!0}).then((()=>{v()}),a)}},g=e=>{this.emit("close"),this.emit("state",this.getState()),this.uplinkReady&&(this.emit("offline"),this.endpoint=this.endpoints[0]),this.uplinkReady=!1,this.serverInfo=void 0,d("Upstream/Websocket closed",null==e?void 0:e.code,null==e?void 0:e.reason),k(),this.closed?f("Closed on purpose, not reconnecting"):(this.emit("retry"),d(`Not closed on purpose, reconnecting after ${s()}...`),setTimeout((()=>{this.eventBus.emit("reconnect")}),1e3*s()))},y=e=>{var t,n;if(null===(t=null==e?void 0:e.result)||void 0===t?void 0:t.info){const t=e;this.serverInfo||h("Connected, server_info:",{pubkey_node:t.result.info.pubkey_node,build_version:t.result.info.build_version,complete_ledgers:t.result.info.complete_ledgers});const r=Number(new Date)-Number(String((null==e?void 0:e.id)||"").split("@").reverse()[0]);r&&(this.serverState.latency.push({moment:new Date,value:r}),this.serverState.latency.splice(0,this.serverState.latency.length-10));const i=1.2,o=t.result.info.load_factor*Number(null===(n=t.result.info.validated_ledger)||void 0===n?void 0:n.base_fee_xrp)*1e6*i;o&&(this.serverState.fee.push({moment:new Date,value:o}),this.serverState.fee.splice(0,this.serverState.fee.length-5)),this.serverInfo=t}},b=e=>{var t,n,r,i,o,s,l,u,c,f;if("_WsClient_Internal_Subscription"!==(null===(t=null==e?void 0:e.id)||void 0===t?void 0:t._Request)){let t;if(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n._WsClient){const n=this.subscriptions.filter((t=>{var n;return t.id===(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n._WsClient)}));n.length>0&&(t=n[0],t.promiseCallables.resolve(Object.assign(e,{id:null===(r=null==e?void 0:e.id)||void 0===r?void 0:r._Request})))}if(this.emit("message",e),"ledgerClosed"===(null==e?void 0:e.type))p("Async",e.type),Object.assign(this.serverState,{validatedLedgers:null==e?void 0:e.validated_ledgers,reserveBase:Number(null==e?void 0:e.reserve_base)/1e6||null,reserveInc:Number(null==e?void 0:e.reserve_inc)/1e6||null}),this.emit("ledger",e),this.send({id:"_WsClient_Internal_ServerInfo@"+Number(new Date),command:"server_info"}).then(a,a);else if("path_find"===(null==e?void 0:e.type))p("Async",e.type),this.emit("path",e);else if("transaction"===(null==e?void 0:e.type))p("Async",e.type),this.emit("transaction",e);else if(null==e?void 0:e.validation_public_key)p("Async","validation"),this.emit("validation",e);else if("path_find"===(null===(i=null==t?void 0:t.request)||void 0===i?void 0:i.command))p("Async",null===(o=null==t?void 0:t.request)||void 0===o?void 0:o.command),this.emit("path",e);else if("subscribe"===(null===(s=null==t?void 0:t.request)||void 0===s?void 0:s.command)&&Array.isArray(null===(l=null==t?void 0:t.request)||void 0===l?void 0:l.streams)&&(null===(u=null==t?void 0:t.request)||void 0===u?void 0:u.streams.indexOf("ledger"))>-1)p("Async","subscription:ledger"),this.emit("ledger",e);else if(t);else{if(!((null===(c=null==e?void 0:e.id)||void 0===c?void 0:c._Request)&&String(e.id._Request).match(/^_WsClient_Internal/))){try{const t=e;if("PROXY"===(null==t?void 0:t.type))return this.clusterInfo_=t,void this.emit("clusterinfo",this.clusterInfo_)}catch(e){}p("Handle <UNKNOWN> Async Message",{internalId:null===(f=null==e?void 0:e.id)||void 0===f?void 0:f._WsClient,matchingSubscription:t,type:null==e?void 0:e.type,message:e})}}}},C=e=>{var t,n,r,i,o,s;try{l.default("string"==typeof e.data,"Unexpected incoming WebSocket message data type");const u=JSON.parse(e.data);if(this.lastContact=new Date,null===(t=null==u?void 0:u.id)||void 0===t?void 0:t._WsClient){const e=this.subscriptions.filter((e=>{var t;return e.id===(null===(t=null==u?void 0:u.id)||void 0===t?void 0:t._WsClient)})),t=this.pendingCalls.filter((e=>{var t;return e.id===(null===(t=null==u?void 0:u.id)||void 0===t?void 0:t._WsClient)}));if(1===e.length)b(u);else if(1===t.length){const e="_WsClient_Internal_ServerInfo"===String((null===(i=null===(r=null===(n=t[0])||void 0===n?void 0:n.request)||void 0===r?void 0:r.id)||void 0===i?void 0:i._Request)||"").split("@")[0];Object.assign(u,{id:null===(o=null==u?void 0:u.id)||void 0===o?void 0:o._Request}),(null===(s=t[0].sendOptions)||void 0===s?void 0:s.timeoutSeconds)&&t[0].timeout&&clearTimeout(t[0].timeout),t[0].promiseCallables.resolve((null==u?void 0:u.result)||u),this.pendingCalls.splice(this.pendingCalls.indexOf(t[0]),1),e?y(u):f("ยป Pending Call Length",this.pendingCalls.length)}else b(u)}else b(u)}catch(e){d("Uplink response: parse error",e.message)}},w=e=>{d("Upstream/Websocket error")},_=e=>{var t;(null===(t=null==e?void 0:e.sendOptions)||void 0===t?void 0:t.timeoutSeconds)&&!(null==e?void 0:e.timeout)&&Object.assign(e,{timeout:setTimeout((()=>o(this,void 0,void 0,(function*(){var t;"_WsClient_Internal_CallResolved"===(yield Promise.race([e.promise,Promise.resolve("_WsClient_Internal_CallResolved")]))&&e.promiseCallables.reject(new Error(`Call timeout after ${null===(t=e.sendOptions)||void 0===t?void 0:t.timeoutSeconds} seconds`))}))),1e3*Number(e.sendOptions.timeoutSeconds))})},x=e=>{var t,n,r;"_WsClient_Internal_ServerInfo"!==String((null===(n=null===(t=null==e?void 0:e.request)||void 0===t?void 0:t.id)||void 0===n?void 0:n._Request)||"").split("@")[0]&&f(" > Process call",e.id,e.request.command);try{this.connection.send(JSON.stringify(e.request)),(null===(r=null==e?void 0:e.sendOptions)||void 0===r?void 0:r.timeoutStartsWhenOnline)&&_(e)}catch(e){d("Process (send to uplink) error",e.message)}},S=e=>{var t,n,r,i,o;"_WsClient_Internal_ServerInfo"!==String((null===(n=null===(t=null==e?void 0:e.request)||void 0===t?void 0:t.id)||void 0===n?void 0:n._Request)||"").split("@")[0]&&f(`Call ${e.id}: ${e.request.command}\n > `,this.uplinkReady?"Uplink ready, pass immediately":(null===(r=null==e?void 0:e.sendOptions)||void 0===r?void 0:r.sendIfNotReady)?"Uplink not flagged as ready yet, but `sendIfNotReady` = true, so go ahead":"Uplink not ready, wait for flush"),(null===(i=null==e?void 0:e.sendOptions)||void 0===i?void 0:i.timeoutStartsWhenOnline)||_(e),(this.uplinkReady||(null===(o=null==e?void 0:e.sendOptions)||void 0===o?void 0:o.sendIfNotReady))&&x(e)},O=()=>{f("Connected, flushing pending calls & subscriptions"),this.pendingCalls.forEach((e=>{x(e)})),this.subscriptions.forEach((e=>{x(e)}))},E=()=>{f("Reinstating..."),this.closed=!1,i(),this.connection=A()},j=e=>{f("Closing connection"),this.emit("close"),this.closed=!0;try{this.connection.close()}catch(e){}clearTimeout(r),e&&this.emit("error",e)},F=e=>{j(e),k(),this.subscriptions.forEach((e=>{e.promiseCallables.reject(new Error("Class (connection) hard close requested"))})),this.pendingCalls.forEach((e=>{e.promiseCallables.reject(new Error("Class (connection) hard close requested"))})),this.eventBus.off("__WsClient_call",S),this.eventBus.off("__WsClient_destroy",F),this.eventBus.off("__WsClient_close",j),this.eventBus.off("__WsClient_reinstate",E),this.eventBus.off("flush",O),this.eventBus.off("reconnect",A)},k=()=>{f("Cleanup"),this.connection.removeEventListener("open",m),this.connection.removeEventListener("message",C),this.connection.removeEventListener("error",w),this.connection.removeEventListener("close",g)},A=()=>{var e,t,n,r,i;try{this.connection.close()}catch(e){}if(f("Connecting",this.endpoint),this.serverState.connectAttempts++,this.options.maxConnectionAttempts&&Number((null===(e=this.options)||void 0===e?void 0:e.maxConnectionAttempts)||1)>1&&this.serverState.connectAttempts>=Number((null===(t=this.options)||void 0===t?void 0:t.maxConnectionAttempts)||1))if(h("Too many connection attempts",this.serverState.connectAttempts,null===(n=this.options)||void 0===n?void 0:n.maxConnectionAttempts),f(this.endpoint,this.endpoints,this.endpoints.length,this.endpoints.indexOf(this.endpoint)),this.endpoints.length>1&&this.endpoints.indexOf(this.endpoint)>-1){d("Multiple endpoints, max. connection attempts exceeded. Switch endpoint.");const e=this.endpoints.indexOf(this.endpoint)+1;d("--- Current endpoint",this.endpoint),this.endpoint=this.endpoints[e>=this.endpoints.length?0:e],d("--- New endpoint",this.endpoint),this.serverState.connectAttempts=0,this.emit("nodeswitch",this.endpoint),e>=this.endpoints.length&&this.emit("round")}else d("Only one valid endpoint, after the max. connection attempts: game over"),j(new Error("Max. connection attempts exceeded"));if(!this.closed){const e=new c.w3cwebsocket(this.endpoint,void 0,void 0,Object.assign((null===(r=this.options)||void 0===r?void 0:r.httpHeaders)||{},{"user-agent":"xrpl-client@js/ts"}),(null===(i=this.options)||void 0===i?void 0:i.httpRequestOptions)||{},{maxReceivedFrameSize:2147483648,maxReceivedMessageSize:8589934592});setTimeout((()=>{e.readyState!==c.w3cwebsocket.OPEN&&e.close()}),1e3*s()-1),e.addEventListener("open",m),e.addEventListener("message",C),e.addEventListener("error",w),e.addEventListener("close",g),this.connection=e}return this.connection};this.eventBus.on("__WsClient_call",S),this.eventBus.on("__WsClient_destroy",F),this.eventBus.on("__WsClient_close",j),this.eventBus.on("__WsClient_reinstate",E),this.eventBus.on("flush",O),this.eventBus.on("reconnect",A),this.connection=A()}ready(){return new Promise(((e,t)=>{const n=this.getState();if(n.online&&n.secLastContact&&n.secLastContact<10&&n.ledger.last)return e(this);this.on("ledger",(()=>{e(this)}))}))}send(e,t={}){var n,r,i;l.default("object"==typeof e&&e,"`send()`: expecting object containing `command`"),l.default("string"==typeof e.command,"`command` must be typeof string"),this.callId++;const o={resolve:e=>{},reject:e=>{}},s=new Promise(((e,t)=>{Object.assign(o,{resolve:e,reject:t})})),u={id:this.callId,request:Object.assign(e,{id:{_WsClient:this.callId,_Request:null==e?void 0:e.id},command:e.command.toLowerCase().trim()}),promise:s,promiseCallables:o,sendOptions:t};if(this.closed)return o.reject(new Error("Client in closed state")),s;const a=("subscribe"===u.request.command||"unsubscribe"===u.request.command||"path_find"===u.request.command)&&!(null==t?void 0:t.noReplayAfterReconnect);return"unsubscribe"===(null===(n=u.request)||void 0===n?void 0:n.command)&&Array.isArray(null===(r=u.request)||void 0===r?void 0:r.streams)&&(null===(i=u.request)||void 0===i?void 0:i.streams.indexOf("ledger"))>-1&&(u.request.streams.splice(u.request.streams.indexOf("ledger"),1),0===u.request.streams.length&&0===Object.keys(u.request).filter((e=>"id"!==e&&"streams"!==e&&"command"!==e)).length)?Promise.reject(new Error("Unsubscribing from (just) the ledger stream is not allowed")):("_WsClient_Internal_ServerInfo"!==String((null==e?void 0:e.id)||"").split("@")[0]&&this[a?"subscriptions":"pendingCalls"].push(u),this.eventBus.emit("__WsClient_call",u),s)}getState(){var e,t,n,r,i,o,s,l,u;const a=this.serverState.validatedLedgers.split(",").map((e=>{const t=e.split("-");return t.length>1?parseInt(t[1])-parseInt(t[0]):1})).reduce(((e,t)=>e+t),0);return{online:this.uplinkReady&&!this.closed&&this.connection.readyState===c.w3cwebsocket.OPEN,latencyMs:{last:this.serverState.latency.slice(-1).map((e=>e.value))[0]||null,avg:this.serverState.latency.map((e=>e.value)).reduce(((e,t)=>e+t),0)/this.serverState.latency.length||null,secAgo:Number(new Date)/1e3-this.serverState.latency.slice(-1).map((e=>Number(e.moment)/1e3))[0]||null},server:{version:(null===(n=null===(t=null===(e=this.serverInfo)||void 0===e?void 0:e.result)||void 0===t?void 0:t.info)||void 0===n?void 0:n.build_version)||"",uptime:(null===(o=null===(i=null===(r=this.serverInfo)||void 0===r?void 0:r.result)||void 0===i?void 0:i.info)||void 0===o?void 0:o.uptime)||0,publicKey:(null===(u=null===(l=null===(s=this.serverInfo)||void 0===s?void 0:s.result)||void 0===l?void 0:l.info)||void 0===u?void 0:u.pubkey_node)||"",uri:this.endpoint},ledger:{last:Number(this.serverState.validatedLedgers.split(",").reverse()[0].split("-").reverse()[0]),validated:this.serverState.validatedLedgers,count:""===this.serverState.validatedLedgers?0:a},fee:{last:this.serverState.fee.slice(-1).map((e=>e.value))[0]||null,avg:this.serverState.fee.map((e=>e.value)).reduce(((e,t)=>e+t),0)/this.serverState.fee.length||null,secAgo:Number(new Date)/1e3-this.serverState.fee.slice(-1).map((e=>Number(e.moment)/1e3))[0]||null},reserve:{base:this.serverState.reserveBase,owner:this.serverState.reserveInc},secLastContact:this.lastContact?Number(new Date)/1e3-Number(this.lastContact)/1e3:null}}close(){f("> CLOSE"),this.eventBus.emit("__WsClient_close")}reinstate(){f("> REINSTATE"),this.eventBus.emit("__WsClient_reinstate")}destroy(){f("> DESTROY"),this.eventBus.emit("__WsClient_destroy")}clusterInfo(){return new Promise(((e,t)=>{if(this.clusterInfo_)return e(this.clusterInfo_);this.on("clusterinfo",(t=>{e(t)}))}))}}n.XrplClient=v},{"./types":1,assert:2,debug:6,events:9,websocket:13}]},{},[]);
"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}t.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,l,u=s(e),a=1;a<arguments.length;a++){for(var c in n=Object(arguments[a]))i.call(n,c)&&(u[c]=n[c]);if(r){l=r(n);for(var f=0;f<l.length;f++)o.call(n,l[f])&&(u[l[f]]=n[l[f]])}}return u}},{}],12:[function(e,t,n){var r,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{i="function"==typeof clearTimeout?clearTimeout:l}catch(e){i=l}}();var a,c=[],f=!1,d=-1;function p(){f&&a&&(f=!1,a.length?c=a.concat(c):d=-1,c.length&&h())}function h(){if(!f){var e=u(p);f=!0;for(var t=c.length;t;){for(a=c,c=[];++d<t;)a&&a[d].run();d=-1,t=c.length}a=null,f=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===l||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new v(e,t)),1!==c.length||f||u(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],13:[function(e,t,n){var r;if("object"==typeof globalThis)r=globalThis;else try{r=e("es5-ext/global")}catch(e){}finally{if(r||"undefined"==typeof window||(r=window),!r)throw new Error("Could not determine global this")}var i=r.WebSocket||r.MozWebSocket,o=e("./version");function s(e,t){return t?new i(e,t):new i(e)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(s,e,{get:function(){return i[e]}})})),t.exports={w3cwebsocket:i?s:null,version:o}},{"./version":14,"es5-ext/global":8}],14:[function(e,t,n){t.exports=e("../package.json").version},{"../package.json":15}],15:[function(e,t,n){t.exports={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)",contributors:["Iรฑaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"}},{}],"xrpl-client":[function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function l(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,l)}u((r=r.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.XrplClient=void 0;const l=s(e("assert")),u=e("events"),a=e("debug"),c=e("websocket");i(e("./types"),n);const f=a.debug("xrplclient"),d=f.extend("warning"),p=f.extend("message"),h=f.extend("node");class v extends u.EventEmitter{constructor(e,t){var n;let r;super(),this.eventBus=new u.EventEmitter,this.closed=!1,this.destroyed=!1,this.uplinkReady=!1,this.options={connectAttemptTimeoutSeconds:3,assumeOfflineAfterSeconds:15,maxConnectionAttempts:null},this.callId=0,this.pendingCalls=[],this.subscriptions=[],this.serverState={validatedLedgers:"",reserveBase:null,reserveInc:null,latency:[],fee:[],connectAttempts:-1},t&&Object.assign(this.options,t);const i=()=>{var e;clearTimeout(r);const t=1e3*Number((null===(e=null==this?void 0:this.options)||void 0===e?void 0:e.assumeOfflineAfterSeconds)||15);r=setTimeout((()=>{var e;if(this.uplinkReady){d(`Conn. TIMEOUT, no ledger for ${t} sec.`);try{null===(e=this.connection)||void 0===e||e.close()}catch(e){}}}),t)};i();const s=()=>{var e,t;let n=1;const r=(null===(e=this.options)||void 0===e?void 0:e.maxConnectionAttempts)||null;r&&(n=(((null===(t=this.options)||void 0===t?void 0:t.connectAttemptTimeoutSeconds)||3)-1)/(r-1));return Math.max(1.5,(this.serverState.connectAttempts+1)*n)};this.endpoints=[],e&&(this.endpoints=[...new Set(Array.isArray(e)?e:[e])].map((e=>e.trim())).filter((e=>e.match(/^ws[s]{0,1}:\/\//)))),this.endpoints.length<1&&(this.endpoints=["wss://xrplcluster.com","wss://xrpl.link","wss://s2.ripple.com"],d("No valid WebSocket endpoint(s) specified, falling back to defaults",this.endpoints)),this.endpoint=this.endpoints[0].trim(),this.endpoints.length>1&&!(null===(n=this.options)||void 0===n?void 0:n.maxConnectionAttempts)&&(f(`Multiple endpoints (${this.endpoints.length}) and no maxConnection attempts, set (3)`),Object.assign(this.options,{maxConnectionAttempts:3})),f("Initialized xrpld WebSocket Client"),this.on("ledger",(()=>{v(),i()}));const a=()=>{},v=()=>{this.uplinkReady||(this.serverState.connectAttempts=0,h("Connection ready, fire events"),this.uplinkReady=!0,this.eventBus.emit("flush"),this.emit("online"),this.emit("state",this.getState()))},m=()=>{if(this.closed||this.connection.readyState!==c.w3cwebsocket.OPEN)try{this.connection.close()}catch(e){}else{if(f("Connection opened :)"),this.endpoint.match(/^wss:\/\/(xrplcluster\.com|xrpl\.link|xrpl\.ws)/))try{this.connection.send(JSON.stringify({__api:"state",origin:"xrpl-client@js/ts"}))}catch(e){}this.send({id:"_WsClient_Internal_Subscription",command:"subscribe",streams:["ledger"]},{sendIfNotReady:!0,noReplayAfterReconnect:!0}).then(a,a),this.send({id:"_WsClient_Internal_ServerInfo@"+Number(new Date),command:"server_info"},{sendIfNotReady:!0,noReplayAfterReconnect:!0}).then((()=>{v()}),a)}},g=e=>{this.emit("close"),this.emit("state",this.getState()),this.uplinkReady&&(this.emit("offline"),this.endpoint=this.endpoints[0]),this.uplinkReady=!1,this.serverInfo=void 0,d("Upstream/Websocket closed",null==e?void 0:e.code,null==e?void 0:e.reason),k(),this.closed?f("Closed on purpose, not reconnecting"):(this.emit("retry"),d(`Not closed on purpose, reconnecting after ${s()}...`),setTimeout((()=>{this.eventBus.emit("reconnect")}),1e3*s()))},y=e=>{var t,n;if(null===(t=null==e?void 0:e.result)||void 0===t?void 0:t.info){const t=e;this.serverInfo||h("Connected, server_info:",{pubkey_node:t.result.info.pubkey_node,build_version:t.result.info.build_version,complete_ledgers:t.result.info.complete_ledgers});const r=Number(new Date)-Number(String((null==e?void 0:e.id)||"").split("@").reverse()[0]);r&&(this.serverState.latency.push({moment:new Date,value:r}),this.serverState.latency.splice(0,this.serverState.latency.length-10));const i=1.2,o=t.result.info.load_factor*Number(null===(n=t.result.info.validated_ledger)||void 0===n?void 0:n.base_fee_xrp)*1e6*i;o&&(this.serverState.fee.push({moment:new Date,value:o}),this.serverState.fee.splice(0,this.serverState.fee.length-5)),this.serverInfo=t}},b=e=>{var t,n,r,i,o,s,l,u,c,f;if("_WsClient_Internal_Subscription"!==(null===(t=null==e?void 0:e.id)||void 0===t?void 0:t._Request)){let t;if(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n._WsClient){const n=this.subscriptions.filter((t=>{var n;return t.id===(null===(n=null==e?void 0:e.id)||void 0===n?void 0:n._WsClient)}));n.length>0&&(t=n[0],t.promiseCallables.resolve(Object.assign(e,{id:null===(r=null==e?void 0:e.id)||void 0===r?void 0:r._Request})))}if(this.emit("message",e),"ledgerClosed"===(null==e?void 0:e.type))p("Async",e.type),Object.assign(this.serverState,{validatedLedgers:null==e?void 0:e.validated_ledgers,reserveBase:Number(null==e?void 0:e.reserve_base)/1e6||null,reserveInc:Number(null==e?void 0:e.reserve_inc)/1e6||null}),this.emit("ledger",e),this.send({id:"_WsClient_Internal_ServerInfo@"+Number(new Date),command:"server_info"}).then(a,a);else if("path_find"===(null==e?void 0:e.type))p("Async",e.type),this.emit("path",e);else if("transaction"===(null==e?void 0:e.type))p("Async",e.type),this.emit("transaction",e);else if(null==e?void 0:e.validation_public_key)p("Async","validation"),this.emit("validation",e);else if("path_find"===(null===(i=null==t?void 0:t.request)||void 0===i?void 0:i.command))p("Async",null===(o=null==t?void 0:t.request)||void 0===o?void 0:o.command),this.emit("path",e);else if("subscribe"===(null===(s=null==t?void 0:t.request)||void 0===s?void 0:s.command)&&Array.isArray(null===(l=null==t?void 0:t.request)||void 0===l?void 0:l.streams)&&(null===(u=null==t?void 0:t.request)||void 0===u?void 0:u.streams.indexOf("ledger"))>-1)p("Async","subscription:ledger"),this.emit("ledger",e);else if(t);else{if(!((null===(c=null==e?void 0:e.id)||void 0===c?void 0:c._Request)&&String(e.id._Request).match(/^_WsClient_Internal/))){try{const t=e;if("PROXY"===(null==t?void 0:t.type))return this.clusterInfo_=t,void this.emit("clusterinfo",this.clusterInfo_)}catch(e){}p("Handle <UNKNOWN> Async Message",{internalId:null===(f=null==e?void 0:e.id)||void 0===f?void 0:f._WsClient,matchingSubscription:t,type:null==e?void 0:e.type,message:e})}}}},C=e=>{var t,n,r,i,o,s;try{l.default("string"==typeof e.data,"Unexpected incoming WebSocket message data type");const u=JSON.parse(e.data);if(this.lastContact=new Date,null===(t=null==u?void 0:u.id)||void 0===t?void 0:t._WsClient){const e=this.subscriptions.filter((e=>{var t;return e.id===(null===(t=null==u?void 0:u.id)||void 0===t?void 0:t._WsClient)})),t=this.pendingCalls.filter((e=>{var t;return e.id===(null===(t=null==u?void 0:u.id)||void 0===t?void 0:t._WsClient)}));if(1===e.length)b(u);else if(1===t.length){const e="_WsClient_Internal_ServerInfo"===String((null===(i=null===(r=null===(n=t[0])||void 0===n?void 0:n.request)||void 0===r?void 0:r.id)||void 0===i?void 0:i._Request)||"").split("@")[0];Object.assign(u,{id:null===(o=null==u?void 0:u.id)||void 0===o?void 0:o._Request}),(null===(s=t[0].sendOptions)||void 0===s?void 0:s.timeoutSeconds)&&t[0].timeout&&clearTimeout(t[0].timeout),t[0].promiseCallables.resolve((null==u?void 0:u.result)||u),this.pendingCalls.splice(this.pendingCalls.indexOf(t[0]),1),e?y(u):f("ยป Pending Call Length",this.pendingCalls.length)}else b(u)}else b(u)}catch(e){d("Uplink response: parse error",e.message)}},w=e=>{d("Upstream/Websocket error")},_=e=>{var t;(null===(t=null==e?void 0:e.sendOptions)||void 0===t?void 0:t.timeoutSeconds)&&!(null==e?void 0:e.timeout)&&Object.assign(e,{timeout:setTimeout((()=>o(this,void 0,void 0,(function*(){var t;"_WsClient_Internal_CallResolved"===(yield Promise.race([e.promise,Promise.resolve("_WsClient_Internal_CallResolved")]))&&e.promiseCallables.reject(new Error(`Call timeout after ${null===(t=e.sendOptions)||void 0===t?void 0:t.timeoutSeconds} seconds`))}))),1e3*Number(e.sendOptions.timeoutSeconds))})},x=e=>{var t,n,r;"_WsClient_Internal_ServerInfo"!==String((null===(n=null===(t=null==e?void 0:e.request)||void 0===t?void 0:t.id)||void 0===n?void 0:n._Request)||"").split("@")[0]&&f(" > Process call",e.id,e.request.command);try{this.connection.send(JSON.stringify(e.request)),(null===(r=null==e?void 0:e.sendOptions)||void 0===r?void 0:r.timeoutStartsWhenOnline)&&_(e)}catch(e){d("Process (send to uplink) error",e.message)}},O=e=>{var t,n,r,i,o;"_WsClient_Internal_ServerInfo"!==String((null===(n=null===(t=null==e?void 0:e.request)||void 0===t?void 0:t.id)||void 0===n?void 0:n._Request)||"").split("@")[0]&&f(`Call ${e.id}: ${e.request.command}\n > `,this.uplinkReady?"Uplink ready, pass immediately":(null===(r=null==e?void 0:e.sendOptions)||void 0===r?void 0:r.sendIfNotReady)?"Uplink not flagged as ready yet, but `sendIfNotReady` = true, so go ahead":"Uplink not ready, wait for flush"),(null===(i=null==e?void 0:e.sendOptions)||void 0===i?void 0:i.timeoutStartsWhenOnline)||_(e),(this.uplinkReady||(null===(o=null==e?void 0:e.sendOptions)||void 0===o?void 0:o.sendIfNotReady))&&x(e)},S=()=>{f("Connected, flushing pending calls & subscriptions"),this.pendingCalls.forEach((e=>{x(e)})),this.subscriptions.forEach((e=>{x(e)}))},E=()=>{l.default(!this.destroyed,"Object is in destroyed state"),f("Reinstating..."),this.closed=!1,i(),this.connection=A()},j=e=>{f("Closing connection"),this.emit("close"),this.closed=!0;try{this.connection.close()}catch(e){}clearTimeout(r),e&&this.emit("error",e)},F=e=>{this.destroyed=!0,j(e),k(),this.subscriptions.forEach((e=>{e.promiseCallables.reject(new Error("Class (connection) hard close requested"))})),this.pendingCalls.forEach((e=>{e.promiseCallables.reject(new Error("Class (connection) hard close requested"))})),this.eventBus.off("__WsClient_call",O),this.eventBus.off("__WsClient_destroy",F),this.eventBus.off("__WsClient_close",j),this.eventBus.off("__WsClient_reinstate",E),this.eventBus.off("flush",S),this.eventBus.off("reconnect",A)},k=()=>{f("Cleanup"),this.connection.removeEventListener("open",m),this.connection.removeEventListener("message",C),this.connection.removeEventListener("error",w),this.connection.removeEventListener("close",g)},A=()=>{var e,t,n,r,i;try{this.connection.close()}catch(e){}if(f("Connecting",this.endpoint),this.serverState.connectAttempts++,this.options.maxConnectionAttempts&&Number((null===(e=this.options)||void 0===e?void 0:e.maxConnectionAttempts)||1)>1&&this.serverState.connectAttempts>=Number((null===(t=this.options)||void 0===t?void 0:t.maxConnectionAttempts)||1))if(h("Too many connection attempts",this.serverState.connectAttempts,null===(n=this.options)||void 0===n?void 0:n.maxConnectionAttempts),f(this.endpoint,this.endpoints,this.endpoints.length,this.endpoints.indexOf(this.endpoint)),this.endpoints.length>1&&this.endpoints.indexOf(this.endpoint)>-1){d("Multiple endpoints, max. connection attempts exceeded. Switch endpoint.");const e=this.endpoints.indexOf(this.endpoint)+1;d("--- Current endpoint",this.endpoint),this.endpoint=this.endpoints[e>=this.endpoints.length?0:e],d("--- New endpoint",this.endpoint),this.serverState.connectAttempts=0,this.emit("nodeswitch",this.endpoint),e>=this.endpoints.length&&this.emit("round")}else d("Only one valid endpoint, after the max. connection attempts: game over"),j(new Error("Max. connection attempts exceeded"));if(!this.closed){const e=new c.w3cwebsocket(this.endpoint,void 0,void 0,Object.assign((null===(r=this.options)||void 0===r?void 0:r.httpHeaders)||{},{"user-agent":"xrpl-client@js/ts"}),(null===(i=this.options)||void 0===i?void 0:i.httpRequestOptions)||{},{maxReceivedFrameSize:2147483648,maxReceivedMessageSize:8589934592});setTimeout((()=>{e.readyState!==c.w3cwebsocket.OPEN&&e.close()}),1e3*s()-1),e.addEventListener("open",m),e.addEventListener("message",C),e.addEventListener("error",w),e.addEventListener("close",g),this.connection=e}return this.connection};this.eventBus.on("__WsClient_call",O),this.eventBus.on("__WsClient_destroy",F),this.eventBus.on("__WsClient_close",j),this.eventBus.on("__WsClient_reinstate",E),this.eventBus.on("flush",S),this.eventBus.on("reconnect",A),this.connection=A()}ready(){return new Promise(((e,t)=>{const n=this.getState();if(n.online&&n.secLastContact&&n.secLastContact<10&&n.ledger.last)return e(this);this.on("ledger",(()=>{e(this)}))}))}send(e,t={}){var n,r,i;l.default("object"==typeof e&&e,"`send()`: expecting object containing `command`"),l.default("string"==typeof e.command,"`command` must be typeof string"),this.callId++;const o={resolve:e=>{},reject:e=>{}},s=new Promise(((e,t)=>{Object.assign(o,{resolve:e,reject:t})})),u={id:this.callId,request:Object.assign(e,{id:{_WsClient:this.callId,_Request:null==e?void 0:e.id},command:e.command.toLowerCase().trim()}),promise:s,promiseCallables:o,sendOptions:t};if(this.destroyed)return o.reject(new Error("Client in destroyed state")),s;const a=("subscribe"===u.request.command||"unsubscribe"===u.request.command||"path_find"===u.request.command)&&!(null==t?void 0:t.noReplayAfterReconnect);return"unsubscribe"===(null===(n=u.request)||void 0===n?void 0:n.command)&&Array.isArray(null===(r=u.request)||void 0===r?void 0:r.streams)&&(null===(i=u.request)||void 0===i?void 0:i.streams.indexOf("ledger"))>-1&&(u.request.streams.splice(u.request.streams.indexOf("ledger"),1),0===u.request.streams.length&&0===Object.keys(u.request).filter((e=>"id"!==e&&"streams"!==e&&"command"!==e)).length)?Promise.reject(new Error("Unsubscribing from (just) the ledger stream is not allowed")):("_WsClient_Internal_ServerInfo"!==String((null==e?void 0:e.id)||"").split("@")[0]&&this[a?"subscriptions":"pendingCalls"].push(u),this.eventBus.emit("__WsClient_call",u),s)}getState(){var e,t,n,r,i,o,s,l,u;const a=this.serverState.validatedLedgers.split(",").map((e=>{const t=e.split("-");return t.length>1?parseInt(t[1])-parseInt(t[0]):1})).reduce(((e,t)=>e+t),0);return{online:this.uplinkReady&&!this.closed&&this.connection.readyState===c.w3cwebsocket.OPEN,latencyMs:{last:this.serverState.latency.slice(-1).map((e=>e.value))[0]||null,avg:this.serverState.latency.map((e=>e.value)).reduce(((e,t)=>e+t),0)/this.serverState.latency.length||null,secAgo:Number(new Date)/1e3-this.serverState.latency.slice(-1).map((e=>Number(e.moment)/1e3))[0]||null},server:{version:(null===(n=null===(t=null===(e=this.serverInfo)||void 0===e?void 0:e.result)||void 0===t?void 0:t.info)||void 0===n?void 0:n.build_version)||"",uptime:(null===(o=null===(i=null===(r=this.serverInfo)||void 0===r?void 0:r.result)||void 0===i?void 0:i.info)||void 0===o?void 0:o.uptime)||0,publicKey:(null===(u=null===(l=null===(s=this.serverInfo)||void 0===s?void 0:s.result)||void 0===l?void 0:l.info)||void 0===u?void 0:u.pubkey_node)||"",uri:this.endpoint},ledger:{last:Number(this.serverState.validatedLedgers.split(",").reverse()[0].split("-").reverse()[0]),validated:this.serverState.validatedLedgers,count:""===this.serverState.validatedLedgers?0:a},fee:{last:this.serverState.fee.slice(-1).map((e=>e.value))[0]||null,avg:this.serverState.fee.map((e=>e.value)).reduce(((e,t)=>e+t),0)/this.serverState.fee.length||null,secAgo:Number(new Date)/1e3-this.serverState.fee.slice(-1).map((e=>Number(e.moment)/1e3))[0]||null},reserve:{base:this.serverState.reserveBase,owner:this.serverState.reserveInc},secLastContact:this.lastContact?Number(new Date)/1e3-Number(this.lastContact)/1e3:null}}close(){f("> CLOSE"),this.eventBus.emit("__WsClient_close")}reinstate(){f("> REINSTATE"),this.eventBus.emit("__WsClient_reinstate")}destroy(){f("> DESTROY"),this.eventBus.emit("__WsClient_destroy")}clusterInfo(){return new Promise(((e,t)=>{if(this.clusterInfo_)return e(this.clusterInfo_);this.on("clusterinfo",(t=>{e(t)}))}))}}n.XrplClient=v},{"./types":1,assert:2,debug:6,events:9,websocket:13}]},{},[]);

@@ -11,2 +11,3 @@ /// <reference types="node" />

private closed;
private destroyed;
private uplinkReady;

@@ -13,0 +14,0 @@ private options;

@@ -44,2 +44,3 @@ "use strict";

this.closed = false;
this.destroyed = false;
this.uplinkReady = false;

@@ -445,2 +446,3 @@ this.options = {

const reinstate = () => {
assert_1.default(!this.destroyed, "Object is in destroyed state");
log("Reinstating...");

@@ -467,2 +469,3 @@ this.closed = false;

const destroy = (error) => {
this.destroyed = true;
close(error);

@@ -604,4 +607,4 @@ WsCleanup();

};
if (this.closed) {
promiseCallables.reject(new Error("Client in closed state"));
if (this.destroyed) {
promiseCallables.reject(new Error("Client in destroyed state"));
return promise;

@@ -608,0 +611,0 @@ }

{
"name": "xrpl-client",
"version": "1.9.0",
"version": "1.9.1",
"description": "Connect to the XRP Ledger using WebSockets",

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

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc