UNPKG

dimension-js-sdk

Version:
2 lines 797 kB
/*! For license information please see lib.js.LICENSE.txt */ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(function(){return(()=>{var t={8794:(t,e,r)=>{"use strict";r.d(e,{i:()=>n});const n="bignumber/5.1.1"},2593:(t,e,r)=>{"use strict";r.d(e,{Zm:()=>l,O$:()=>p,g$:()=>v,t2:()=>w});var n=r(3550),i=r.n(n),o=r(3286),a=r(711),s=r(8794),u=i().BN;const c=new a.Yd(s.i),f={},h=9007199254740991;function l(t){return null!=t&&(p.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||(0,o.isHexString)(t)||"bigint"==typeof t||(0,o.isBytes)(t))}let d=!1;class p{constructor(t,e){c.checkNew(new.target,p),t!==f&&c.throwError("cannot call constructor directly; use BigNumber.from",a.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return m(b(this).fromTwos(t))}toTwos(t){return m(b(this).toTwos(t))}abs(){return"-"===this._hex[0]?p.from(this._hex.substring(1)):this}add(t){return m(b(this).add(b(t)))}sub(t){return m(b(this).sub(b(t)))}div(t){return p.from(t).isZero()&&g("division by zero","div"),m(b(this).div(b(t)))}mul(t){return m(b(this).mul(b(t)))}mod(t){const e=b(t);return e.isNeg()&&g("cannot modulo negative values","mod"),m(b(this).umod(e))}pow(t){const e=b(t);return e.isNeg()&&g("cannot raise to negative values","pow"),m(b(this).pow(e))}and(t){const e=b(t);return(this.isNegative()||e.isNeg())&&g("cannot 'and' negative values","and"),m(b(this).and(e))}or(t){const e=b(t);return(this.isNegative()||e.isNeg())&&g("cannot 'or' negative values","or"),m(b(this).or(e))}xor(t){const e=b(t);return(this.isNegative()||e.isNeg())&&g("cannot 'xor' negative values","xor"),m(b(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&g("cannot mask negative values","mask"),m(b(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&g("cannot shift negative values","shl"),m(b(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&g("cannot shift negative values","shr"),m(b(this).shrn(t))}eq(t){return b(this).eq(b(t))}lt(t){return b(this).lt(b(t))}lte(t){return b(this).lte(b(t))}gt(t){return b(this).gt(b(t))}gte(t){return b(this).gte(b(t))}isNegative(){return"-"===this._hex[0]}isZero(){return b(this).isZero()}toNumber(){try{return b(this).toNumber()}catch(t){g("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return c.throwError("this platform does not support BigInt",a.Yd.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?d||(d=!0,c.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?c.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",a.Yd.errors.UNEXPECTED_ARGUMENT,{}):c.throwError("BigNumber.toString does not accept parameters",a.Yd.errors.UNEXPECTED_ARGUMENT,{})),b(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof p)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new p(f,y(t)):t.match(/^-?[0-9]+$/)?new p(f,y(new u(t))):c.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&g("underflow","BigNumber.from",t),(t>=h||t<=-h)&&g("overflow","BigNumber.from",t),p.from(String(t));const e=t;if("bigint"==typeof e)return p.from(e.toString());if((0,o.isBytes)(e))return p.from((0,o.hexlify)(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return p.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&((0,o.isHexString)(t)||"-"===t[0]&&(0,o.isHexString)(t.substring(1))))return p.from(t)}return c.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function y(t){if("string"!=typeof t)return y(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&c.throwArgumentError("invalid hex","value",t),"0x00"===(t=y(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function m(t){return p.from(y(t))}function b(t){const e=p.from(t).toHexString();return"-"===e[0]?new u("-"+e.substring(3),16):new u(e.substring(2),16)}function g(t,e,r){const n={fault:t,operation:e};return null!=r&&(n.value=r),c.throwError(t,a.Yd.errors.NUMERIC_FAULT,n)}function v(t){return new u(t,36).toString(16)}function w(t){return new u(t,16).toString(36)}},2092:(t,e,r)=>{"use strict";r.r(e),r.d(e,{BigNumber:()=>n.O$,FixedFormat:()=>m,FixedNumber:()=>b,_base16To36:()=>n.t2,_base36To16:()=>n.g$,formatFixed:()=>p,parseFixed:()=>y});var n=r(2593),i=r(3286),o=r(711),a=r(8794);const s=new o.Yd(a.i),u={},c=n.O$.from(0),f=n.O$.from(-1);function h(t,e,r,n){const i={fault:e,operation:r};return void 0!==n&&(i.value=n),s.throwError(t,o.Yd.errors.NUMERIC_FAULT,i)}let l="0";for(;l.length<256;)l+=l;function d(t){if("number"!=typeof t)try{t=n.O$.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+l.substring(0,t):s.throwArgumentError("invalid decimal size","decimals",t)}function p(t,e){null==e&&(e=0);const r=d(e),i=(t=n.O$.from(t)).lt(c);i&&(t=t.mul(f));let o=t.mod(r).toString();for(;o.length<r.length-1;)o="0"+o;o=o.match(/^([0-9]*[1-9]|0)(0*)/)[1];const a=t.div(r).toString();return t=a+"."+o,i&&(t="-"+t),t}function y(t,e){null==e&&(e=0);const r=d(e);if("string"==typeof t&&t.match(/^-?[0-9.,]+$/)||s.throwArgumentError("invalid decimal value","value",t),r.length-1==0)return n.O$.from(t);const i="-"===t.substring(0,1);i&&(t=t.substring(1)),"."===t&&s.throwArgumentError("missing value","value",t);const o=t.split(".");o.length>2&&s.throwArgumentError("too many decimal points","value",t);let a=o[0],u=o[1];for(a||(a="0"),u||(u="0"),u.length>r.length-1&&h("fractional component exceeds decimals","underflow","parseFixed");u.length<r.length-1;)u+="0";const c=n.O$.from(a),l=n.O$.from(u);let p=c.mul(r).add(l);return i&&(p=p.mul(f)),p}class m{constructor(t,e,r,n){t!==u&&s.throwError("cannot use FixedFormat constructor; use FixedFormat.from",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=r,this.decimals=n,this.name=(e?"":"u")+"fixed"+String(r)+"x"+String(n),this._multiplier=d(n),Object.freeze(this)}static from(t){if(t instanceof m)return t;let e=!0,r=128,n=18;if("string"==typeof t){if("fixed"===t);else if("ufixed"===t)e=!1;else if(null!=t){const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||s.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}}else if(t){const i=(e,r,n)=>null==t[e]?n:(typeof t[e]!==r&&s.throwArgumentError("invalid fixed format ("+e+" not "+r+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&s.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&s.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new m(u,e,r,n)}}class b{constructor(t,e,r,n){s.checkNew(new.target,b),t!==u&&s.throwError("cannot use FixedNumber constructor; use FixedNumber.from",o.Yd.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=e,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&s.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.add(r),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.sub(r),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=y(this._value,this.format.decimals),r=y(t._value,t.format.decimals);return b.fromValue(e.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){let t=this.toString().split("."),e=b.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(e=e.subUnsafe(g)),e}ceiling(){let t=this.toString().split("."),e=b.from(t[0],this.format);const r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(e=e.addUnsafe(g)),e}round(t){null==t&&(t=0);let e=this.toString().split(".");if((t<0||t>80||t%1)&&s.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const r=b.from("1"+l.substring(0,t));return this.mulUnsafe(r).addUnsafe(v).floor().divUnsafe(r)}isZero(){return"0.0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&s.throwArgumentError("invalid byte width","width",t);const e=n.O$.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return(0,i.hexZeroPad)(e,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return b.fromString(this._value,t)}static fromValue(t,e,r){return null!=r||null==e||(0,n.Zm)(e)||(r=e,e=null),null==e&&(e=0),null==r&&(r="fixed"),b.fromString(p(t,e),m.from(r))}static fromString(t,e){null==e&&(e="fixed");const r=m.from(e),n=y(t,r.decimals);!r.signed&&n.lt(c)&&h("unsigned value cannot be negative","overflow","value",t);let o=null;r.signed?o=n.toTwos(r.width).toHexString():(o=n.toHexString(),o=(0,i.hexZeroPad)(o,r.width/8));const a=p(n,r.decimals);return new b(u,o,a,r)}static fromBytes(t,e){null==e&&(e="fixed");const r=m.from(e);if((0,i.arrayify)(t).length>r.width/8)throw new Error("overflow");let o=n.O$.from(t);r.signed&&(o=o.fromTwos(r.width));const a=o.toTwos((r.signed?0:1)+r.width).toHexString(),s=p(o,r.decimals);return new b(u,a,s,r)}static from(t,e){if("string"==typeof t)return b.fromString(t,e);if((0,i.isBytes)(t))return b.fromBytes(t,e);try{return b.fromValue(t,0,e)}catch(t){if(t.code!==o.Yd.errors.INVALID_ARGUMENT)throw t}return s.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const g=b.from(1),v=b.from("0.5")},3286:(t,e,r)=>{"use strict";r.r(e),r.d(e,{arrayify:()=>u,concat:()=>c,hexConcat:()=>b,hexDataLength:()=>y,hexDataSlice:()=>m,hexStripZeros:()=>v,hexValue:()=>g,hexZeroPad:()=>w,hexlify:()=>p,isBytes:()=>s,isBytesLike:()=>a,isHexString:()=>l,joinSignature:()=>M,splitSignature:()=>_,stripZeros:()=>f,zeroPad:()=>h});const n=new(r(711).Yd)("bytes/5.1.0");function i(t){return!!t.toHexString}function o(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return o(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function a(t){return l(t)&&!(t.length%2)||s(t)}function s(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(null==t.length)return!1;for(let e=0;e<t.length;e++){const r=t[e];if("number"!=typeof r||r<0||r>=256||r%1)return!1}return!0}function u(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),o(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t)&&(t=t.toHexString()),l(t)){let r=t.substring(2);r.length%2&&("left"===e.hexPad?r="0x0"+r.substring(2):"right"===e.hexPad?r+="0":n.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let t=0;t<r.length;t+=2)i.push(parseInt(r.substring(t,t+2),16));return o(new Uint8Array(i))}return s(t)?o(new Uint8Array(t)):n.throwArgumentError("invalid arrayify value","value",t)}function c(t){const e=t.map((t=>u(t))),r=e.reduce(((t,e)=>t+e.length),0),n=new Uint8Array(r);return e.reduce(((t,e)=>(n.set(e,t),t+e.length)),0),o(n)}function f(t){let e=u(t);if(0===e.length)return e;let r=0;for(;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e}function h(t,e){(t=u(t)).length>e&&n.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),o(r)}function l(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const d="0123456789abcdef";function p(t,e){if(e||(e={}),"number"==typeof t){n.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=d[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),i(t))return t.toHexString();if(l(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":n.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(s(t)){let e="0x";for(let r=0;r<t.length;r++){let n=t[r];e+=d[(240&n)>>4]+d[15&n]}return e}return n.throwArgumentError("invalid hexlify value","value",t)}function y(t){if("string"!=typeof t)t=p(t);else if(!l(t)||t.length%2)return null;return(t.length-2)/2}function m(t,e,r){return"string"!=typeof t?t=p(t):(!l(t)||t.length%2)&&n.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function b(t){let e="0x";return t.forEach((t=>{e+=p(t).substring(2)})),e}function g(t){const e=v(p(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function v(t){"string"!=typeof t&&(t=p(t)),l(t)||n.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}function w(t,e){for("string"!=typeof t?t=p(t):l(t)||n.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&n.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function _(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0};if(a(t)){const r=u(t);65!==r.length&&n.throwArgumentError("invalid signature string; must be 65 bytes","signature",t),e.r=p(r.slice(0,32)),e.s=p(r.slice(32,64)),e.v=r[64],e.v<27&&(0===e.v||1===e.v?e.v+=27:n.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=p(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const r=h(u(e._vs),32);e._vs=p(r);const i=r[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=i:e.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),r[0]&=127;const o=p(r);null==e.s?e.s=o:e.s!==o&&n.throwArgumentError("signature v mismatch _vs","signature",t)}null==e.recoveryParam?null==e.v?n.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2:null==e.v?e.v=27+e.recoveryParam:e.recoveryParam!==1-e.v%2&&n.throwArgumentError("signature recoveryParam mismatch v","signature",t),null!=e.r&&l(e.r)?e.r=w(e.r,32):n.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&l(e.s)?e.s=w(e.s,32):n.throwArgumentError("signature missing or invalid s","signature",t);const r=u(e.s);r[0]>=128&&n.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=p(r);e._vs&&(l(e._vs)||n.throwArgumentError("signature invalid _vs","signature",t),e._vs=w(e._vs,32)),null==e._vs?e._vs=i:e._vs!==i&&n.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e}function M(t){return p(c([(t=_(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}},2279:(t,e,r)=>{"use strict";r.r(e),r.d(e,{AddressZero:()=>n,EtherSymbol:()=>l,HashZero:()=>h,MaxUint256:()=>f,NegativeOne:()=>o,One:()=>s,Two:()=>u,WeiPerEther:()=>c,Zero:()=>a});const n="0x0000000000000000000000000000000000000000";var i=r(2593);const o=i.O$.from(-1),a=i.O$.from(0),s=i.O$.from(1),u=i.O$.from(2),c=i.O$.from("1000000000000000000"),f=i.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),h="0x0000000000000000000000000000000000000000000000000000000000000000",l="Ξ"},711:(t,e,r)=>{"use strict";r.d(e,{Yd:()=>h});let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let a=o.default,s=null;const u=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(r){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var c,f;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(c||(c={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT"}(f||(f={}));class h{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const r=t.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",t),a>o[r]||console.log.apply(console,e)}debug(...t){this._log(h.levels.DEBUG,t)}info(...t){this._log(h.levels.INFO,t)}warn(...t){this._log(h.levels.WARNING,t)}makeError(t,e,r){if(i)return this.makeError("censored error",e,{});e||(e=h.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((t=>{try{n.push(t+"="+JSON.stringify(r[t]))}catch(e){n.push(t+"="+JSON.stringify(r[t].toString()))}})),n.push(`code=${e}`),n.push(`version=${this.version}`);const o=t;n.length&&(t+=" ("+n.join(", ")+")");const a=new Error(t);return a.reason=o,a.code=e,Object.keys(r).forEach((function(t){a[t]=r[t]})),a}throwError(t,e,r){throw this.makeError(t,e,r)}throwArgumentError(t,e,r){return this.throwError(t,h.errors.INVALID_ARGUMENT,{argument:e,value:r})}assert(t,e,r,n){t||this.throwError(e,r,n)}assertArgument(t,e,r,n){t||this.throwArgumentError(e,r,n)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),u&&this.throwError("platform missing String.prototype.normalize",h.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:u})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,r){r=r?": "+r:"",t<e&&this.throwError("missing argument"+r,h.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+r,h.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",h.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",h.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",h.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return s||(s=new h("logger/5.1.0")),s}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!t)return;this.globalLogger().throwError("error censorship permanent",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!t,n=!!e}static setLogLevel(t){const e=o[t.toLowerCase()];null!=e?a=e:h.globalLogger().warn("invalid log level - "+t)}static from(t){return new h(t)}}h.errors=f,h.levels=c},2440:function(t,e){"use strict";var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.requestManager=t}return t.prototype.startBatch=function(){return this.requestManager.startBatch()},t.prototype.stopBatch=function(){return this.requestManager.stopBatch()},t.prototype.request=function(t,e){return r(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2,this.requestManager.request(t,!1,e)]}}))}))},t.prototype.notify=function(t){return r(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return this.requestManager.connectPromise?[4,this.requestManager.connectPromise]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2,this.requestManager.request(t,!0,null)]}}))}))},t.prototype.onNotification=function(t){this.requestManager.requestChannel.addListener("notification",t)},t.prototype.onError=function(t){this.requestManager.requestChannel.addListener("error",t)},t.prototype.close=function(){this.requestManager.close()},t}();e.default=i},9931:function(t,e){"use strict";var r,n=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.convertJSONToRPCError=e.JSONRPCError=e.ERR_UNKNOWN=e.ERR_MISSIING_ID=e.ERR_TIMEOUT=void 0,e.ERR_TIMEOUT=7777,e.ERR_MISSIING_ID=7878,e.ERR_UNKNOWN=7979;var i=function(t){function e(e,r,n){var i=this.constructor,o=t.call(this,e)||this;return o.message=e,o.code=r,o.data=n,Object.setPrototypeOf(o,i.prototype),o}return n(e,t),e}(Error);e.JSONRPCError=i,e.convertJSONToRPCError=function(t){if(t.error){var r=t.error,n=r.message,o=r.code,a=r.data;return new i(n,o,a)}return new i("Unknown error",e.ERR_UNKNOWN,t)}},7182:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNotifications=e.getBatchRequests=e.isNotification=void 0,e.isNotification=function(t){return void 0===t.request.id||null===t.request.id},e.getBatchRequests=function(t){return t instanceof Array?t.filter((function(t){return null!=t.request.request.id})).map((function(t){return t.request})):[]},e.getNotifications=function(t){return t instanceof Array?t.filter((function(t){return e.isNotification(t.request)})).map((function(t){return t.request})):e.isNotification(t)?[t]:[]}},2752:function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(7187),a=function(){function t(t){this.batch=[],this.batchStarted=!1,this.lastId=-1,this.transports=t,this.requests={},this.connectPromise=this.connect(),this.requestChannel=new o.EventEmitter}return t.prototype.connect=function(){var t=this;return Promise.all(this.transports.map((function(e){return n(t,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return e.subscribe("error",this.handleError.bind(this)),e.subscribe("notification",this.handleNotification.bind(this)),[4,e.connect()];case 1:return t.sent(),[2]}}))}))})))},t.prototype.getPrimaryTransport=function(){return this.transports[0]},t.prototype.request=function(t,e,r){return void 0===e&&(e=!1),n(this,void 0,void 0,(function(){var n,o,a,s=this;return i(this,(function(i){return n=(++this.lastId).toString(),o=e?null:n,a={request:this.makeRequest(t.method,t.params||[],o),internalID:n},this.batchStarted?[2,new Promise((function(t,e){s.batch.push({resolve:t,reject:e,request:a})}))]:[2,this.getPrimaryTransport().sendData(a,r)]}))}))},t.prototype.close=function(){this.requestChannel.removeAllListeners(),this.transports.forEach((function(t){t.unsubscribe(),t.close()}))},t.prototype.startBatch=function(){this.batchStarted=!0},t.prototype.stopBatch=function(){if(!1===this.batchStarted)throw new Error("cannot end that which has never started");0!==this.batch.length?(this.getPrimaryTransport().sendData(this.batch),this.batch=[],this.batchStarted=!1):this.batchStarted=!1},t.prototype.makeRequest=function(t,e,r){return r?{jsonrpc:"2.0",id:r,method:t,params:e}:{jsonrpc:"2.0",method:t,params:e}},t.prototype.handleError=function(t){this.requestChannel.emit("error",t)},t.prototype.handleNotification=function(t){this.requestChannel.emit("notification",t)},t}();e.default=a},4927:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PostMessageIframeTransport=e.PostMessageWindowTransport=e.JSONRPCError=e.WebSocketTransport=e.EventEmitterTransport=e.HTTPTransport=e.RequestManager=e.Client=void 0;var i=n(r(2752));e.RequestManager=i.default;var o=n(r(2300));e.EventEmitterTransport=o.default;var a=n(r(2855));e.HTTPTransport=a.default;var s=n(r(6628));e.WebSocketTransport=s.default;var u=n(r(6514));e.PostMessageWindowTransport=u.default;var c=n(r(5280));e.PostMessageIframeTransport=c.default;var f=r(9931);Object.defineProperty(e,"JSONRPCError",{enumerable:!0,get:function(){return f.JSONRPCError}});var h=n(r(2440));e.Client=h.default,e.default=h.default},2300:function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var o=r(3629),a=r(7182),s=r(9931),u=function(t){function e(e,r,n){var i=t.call(this)||this;return i.connection=e,i.reqUri=r,i.resUri=n,i}return i(e,t),e.prototype.connect=function(){var t=this;return this.connection.on(this.resUri,(function(e){t.transportRequestManager.resolveResponse(e)})),Promise.resolve()},e.prototype.sendData=function(t,e){void 0===e&&(e=null);var r=this.transportRequestManager.addRequest(t,e),n=a.getNotifications(t),i=this.parseData(t);try{return this.connection.emit(this.reqUri,i),this.transportRequestManager.settlePendingRequest(n),r}catch(t){var o=new s.JSONRPCError(t.message,s.ERR_UNKNOWN,t);return this.transportRequestManager.settlePendingRequest(n,o),Promise.reject(o)}},e.prototype.close=function(){this.connection.removeAllListeners()},e}(o.Transport);e.default=u},2855:function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.HTTPTransport=void 0;var u=s(r(4301)),c=r(3629),f=r(7182),h=r(9931),l=function(t){function e(r,n){var i=t.call(this)||this;return i.onlyNotifications=function(t){return t instanceof Array?t.every((function(t){return null===t.request.request.id||void 0===t.request.request.id})):null===t.request.id||void 0===t.request.id},i.uri=r,i.credentials=n&&n.credentials,i.headers=e.setupHeaders(n&&n.headers),i}return i(e,t),e.prototype.connect=function(){return Promise.resolve()},e.prototype.sendData=function(t,e){return void 0===e&&(e=null),o(this,void 0,void 0,(function(){var r,n,i,o,s,c,l;return a(this,(function(a){switch(a.label){case 0:r=this.transportRequestManager.addRequest(t,e),n=f.getNotifications(t),i=f.getBatchRequests(t),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,u.default(this.uri,{method:"POST",headers:this.headers,body:JSON.stringify(this.parseData(t)),credentials:this.credentials})];case 2:return o=a.sent(),this.transportRequestManager.settlePendingRequest(n),this.onlyNotifications(t)?[2,Promise.resolve()]:[4,o.text()];case 3:return s=a.sent(),(l=this.transportRequestManager.resolveResponse(s))?(this.transportRequestManager.settlePendingRequest(i,l),[2,Promise.reject(l)]):[3,5];case 4:return c=a.sent(),l=new h.JSONRPCError(c.message,h.ERR_UNKNOWN,c),this.transportRequestManager.settlePendingRequest(n,l),this.transportRequestManager.settlePendingRequest(f.getBatchRequests(t),l),[2,Promise.reject(l)];case 5:return[2,r]}}))}))},e.prototype.close=function(){},e.setupHeaders=function(t){var e=new Headers(t);return e.set("Content-Type","application/json"),e},e}(c.Transport);e.HTTPTransport=l,e.default=l},5280:function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(e){var r=t.call(this)||this;return r.messageHandler=function(t){r.transportRequestManager.resolveResponse(JSON.stringify(t.data))},r.uri=e,r.postMessageID="post-message-transport-"+Math.random(),r}return i(e,t),e.prototype.createWindow=function(t){var e=this;return new Promise((function(r,n){var i,o=document.createElement("iframe");o.setAttribute("id",e.postMessageID),o.setAttribute("width","0px"),o.setAttribute("height","0px"),o.setAttribute("style","visiblity:hidden;border:none;outline:none;"),o.addEventListener("load",(function(){r(i)})),o.setAttribute("src",t),window.document.body.appendChild(o),i=o.contentWindow}))},e.prototype.connect=function(){var t=this,e=/^(http|https):\/\/.*$/;return new Promise((function(r,n){return o(t,void 0,void 0,(function(){var t;return a(this,(function(i){switch(i.label){case 0:return e.test(this.uri)||n(new Error("Bad URI")),t=this,[4,this.createWindow(this.uri)];case 1:return t.frame=i.sent(),window.addEventListener("message",this.messageHandler),r(),[2]}}))}))}))},e.prototype.sendData=function(t,e){return void 0===e&&(e=5e3),o(this,void 0,void 0,(function(){var e;return a(this,(function(r){return e=this.transportRequestManager.addRequest(t,null),this.frame&&this.frame.postMessage(t.request,"*"),[2,e]}))}))},e.prototype.close=function(){var t=document.getElementById(this.postMessageID);null==t||t.remove(),window.removeEventListener("message",this.messageHandler)},e}(r(3629).Transport);e.default=s},6514:function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var s=function(t){function e(e){var r=t.call(this)||this;return r.messageHandler=function(t){r.transportRequestManager.resolveResponse(JSON.stringify(t.data))},r.uri=e,r.postMessageID="post-message-transport-"+Math.random(),r}return i(e,t),e.prototype.createWindow=function(t){return new Promise((function(e,r){var n,i,o;i=t,o=window.screen.height,n=window.open(i,"inspector:popup","left=0,top=0,width=400,height="+o+",resizable,scrollbars=yes,status=1"),setTimeout((function(){e(n)}),3e3)}))},e.prototype.connect=function(){var t=this,e=/^(http|https):\/\/.*$/;return new Promise((function(r,n){return o(t,void 0,void 0,(function(){var t;return a(this,(function(i){switch(i.label){case 0:return e.test(this.uri)||n(new Error("Bad URI")),t=this,[4,this.createWindow(this.uri)];case 1:return t.frame=i.sent(),window.addEventListener("message",this.messageHandler),r(),[2]}}))}))}))},e.prototype.sendData=function(t,e){return void 0===e&&(e=5e3),o(this,void 0,void 0,(function(){var e;return a(this,(function(r){return e=this.transportRequestManager.addRequest(t,null),this.frame&&this.frame.postMessage(t.request,this.uri),[2,e]}))}))},e.prototype.close=function(){this.frame&&(window.removeEventListener("message",this.messageHandler),this.frame.close())},e}(r(3629).Transport);e.default=s},3629:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Transport=void 0;var n=r(7016),i=function(){function t(){this.transportRequestManager=new n.TransportRequestManager,this.transportRequestManager.transportEventChannel.on("error",(function(){}))}return t.prototype.subscribe=function(t,e){this.transportRequestManager.transportEventChannel.addListener(t,e)},t.prototype.unsubscribe=function(t,e){if(!t)return this.transportRequestManager.transportEventChannel.removeAllListeners();t&&e&&this.transportRequestManager.transportEventChannel.removeListener(t,e)},t.prototype.parseData=function(t){return t instanceof Array?t.map((function(t){return t.request.request})):t.request},t}();e.Transport=i},7016:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TransportRequestManager=void 0;var n=r(7187),i=r(9931),o=function(){function t(){this.pendingRequest={},this.pendingBatchRequest={},this.transportEventChannel=new n.EventEmitter}return t.prototype.addRequest=function(t,e){return this.transportEventChannel.emit("pending",t),t instanceof Array?(this.addBatchReq(t,e),Promise.resolve()):this.addReq(t.internalID,e)},t.prototype.settlePendingRequest=function(t,e){var r=this;t.forEach((function(t){var n=r.pendingRequest[t.internalID];delete r.pendingBatchRequest[t.internalID],void 0!==n&&(e?n.reject(e):n.resolve())}))},t.prototype.resolveResponse=function(t,e){void 0===e&&(e=!0);var r=t;try{if(r=JSON.parse(t),!1===this.checkJSONRPC(r))return;return r instanceof Array?this.resolveBatch(r,e):this.resolveRes(r,e)}catch(r){var n=new i.JSONRPCError("Bad response format",i.ERR_UNKNOWN,t);return e&&this.transportEventChannel.emit("error",n),n}},t.prototype.addBatchReq=function(t,e){var r=this;return t.forEach((function(t){var e=t.resolve,n=t.reject,i=t.request.internalID;r.pendingBatchRequest[i]=!0,r.pendingRequest[i]={resolve:e,reject:n}})),Promise.resolve()},t.prototype.addReq=function(t,e){var r=this;return new Promise((function(n,i){null!==e&&e&&r.setRequestTimeout(t,e,i),r.pendingRequest[t]={resolve:n,reject:i}}))},t.prototype.checkJSONRPC=function(t){var e=[t];return t instanceof Array&&(e=t),e.every((function(t){return void 0!==t.result||void 0!==t.error||void 0!==t.method}))},t.prototype.processResult=function(t,e){if(t.error){var r=i.convertJSONToRPCError(t);e.reject(r)}else e.resolve(t.result)},t.prototype.resolveBatch=function(t,e){var r=this,n=t.map((function(t){return r.resolveRes(t,e)})).filter((function(t){return t}));if(n.length>0)return n[0]},t.prototype.resolveRes=function(t,e){var r,n=t.id,o=t.error,a=this.pendingRequest[n];return a?(delete this.pendingRequest[n],this.processResult(t,a),void this.transportEventChannel.emit("response",t)):void 0!==n||void 0!==o?(o&&(r=i.convertJSONToRPCError(t)),e&&o&&r&&this.transportEventChannel.emit("error",r),r):void this.transportEventChannel.emit("notification",t)},t.prototype.setRequestTimeout=function(t,e,r){var n=this;setTimeout((function(){delete n.pendingRequest[t],r(new i.JSONRPCError("Request timeout request took longer than "+e+" ms to resolve",i.ERR_TIMEOUT))}),e)},t}();e.TransportRequestManager=o},6628:function(t,e,r){"use strict";var n,i=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(t){o(t)}}function s(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var u=s(r(6792)),c=r(3629),f=r(7182),h=r(9931),l=function(t){function e(e){var r=t.call(this)||this;return r.uri=e,r.connection=new u.default(e),r}return i(e,t),e.prototype.connect=function(){var t=this;return new Promise((function(e,r){var n=function(){t.connection.removeEventListener("open",n),e()};t.connection.addEventListener("open",n),t.connection.addEventListener("message",(function(e){var r=e.data;t.transportRequestManager.resolveResponse(r)}))}))},e.prototype.sendData=function(t,e){return void 0===e&&(e=5e3),o(this,void 0,void 0,(function(){var r,n,i=this;return a(this,(function(o){return r=this.transportRequestManager.addRequest(t,e),n=f.getNotifications(t),this.connection.send(JSON.stringify(this.parseData(t)),(function(e){if(e){var o=new h.JSONRPCError(e.message,h.ERR_UNKNOWN,e);i.transportRequestManager.settlePendingRequest(n,o),i.transportRequestManager.settlePendingRequest(f.getBatchRequests(t),o),r=Promise.reject(o)}i.transportRequestManager.settlePendingRequest(n)})),[2,r]}))}))},e.prototype.close=function(){this.connection.close()},e}(c.Transport);e.default=l},2190:t=>{t.exports=function(t,r,n){if(t.filter)return t.filter(r,n);if(null==t)throw new TypeError;if("function"!=typeof r)throw new TypeError;for(var i=[],o=0;o<t.length;o++)if(e.call(t,o)){var a=t[o];r.call(n,a,o,t)&&i.push(a)}return i};var e=Object.prototype.hasOwnProperty},9809:(t,e,r)=>{"use strict";const n=e;n.bignum=r(3550),n.define=r(2500).define,n.base=r(1979),n.constants=r(6826),n.decoders=r(8307),n.encoders=r(6579)},2500:(t,e,r)=>{"use strict";const n=r(6579),i=r(8307),o=r(5717);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function r(t){this._initNamed(t,e)}return o(r,t),r.prototype._initNamed=function(e,r){t.call(this,e,r)},new r(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},a.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(n[t])),this.encoders[t]},a.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},6625:(t,e,r)=>{"use strict";const n=r(5717),i=r(8465).b,o=r(2399).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}n(a,i),e.C=a,a.isDecoderBuffer=function(t){return t instanceof a||"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const r=new a(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.R=s,s.isEncoderBuffer=function(t){return t instanceof s||"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},1979:(t,e,r)=>{"use strict";const n=e;n.Reporter=r(8465).b,n.DecoderBuffer=r(6625).C,n.EncoderBuffer=r(6625).R,n.Node=r(1949)},1949:(t,e,r)=>{"use strict";const n=r(8465).b,i=r(6625).R,o=r(6625).C,a=r(9746),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(t,e,r){const n={};this._baseState=n,n.name=r,n.enc=t,n.parent=e||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null