@metamask/snap-account-abstraction-keyring
Version:
An account abstraction keyring snap that integrates with MetaMask accounts.
1 lines • 555 kB
JavaScript
(()=>{var t={991:(t,e)=>{"use strict";e.byteLength=function(t){var e=o(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,i=o(t),a=i[0],f=i[1],c=new s(function(t,e,n){return 3*(e+n)/4-n}(0,a,f)),u=0,l=f>0?a-4:a;for(n=0;n<l;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],c[u++]=e>>16&255,c[u++]=e>>8&255,c[u++]=255&e;2===f&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[u++]=255&e);1===f&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[u++]=e>>8&255,c[u++]=255&e);return c},e.fromByteArray=function(t){for(var e,r=t.length,s=r%3,i=[],a=16383,o=0,c=r-s;o<c;o+=a)i.push(f(t,o,o+a>c?c:o+a));1===s?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===s&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],r=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function o(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,r){for(var s,i,a=[],o=e;o<r;o+=3)s=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(n[(i=s)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},586:(t,e)=>{"use strict";e.I=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={};for(let t=0;t<32;t++){const e=n.charAt(t);r[e]=t}function s(t){const e=t>>25;return(33554431&t)<<5^996825010&-(1&e)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function i(t){let e=1;for(let n=0;n<t.length;++n){const r=t.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+t+")";e=s(e)^r>>5}e=s(e);for(let n=0;n<t.length;++n){const r=t.charCodeAt(n);e=s(e)^31&r}return e}function a(t,e,n,r){let s=0,i=0;const a=(1<<n)-1,o=[];for(let r=0;r<t.length;++r)for(s=s<<e|t[r],i+=e;i>=n;)i-=n,o.push(s>>i&a);if(r)i>0&&o.push(s<<n-i&a);else{if(i>=e)return"Excess padding";if(s<<n-i&a)return"Non-zero padding"}return o}function o(t){return a(t,8,5,!0)}function f(t){const e=a(t,5,8,!1);if(Array.isArray(e))return e}function c(t){const e=a(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function u(t){let e;function a(t,n){if(n=n||90,t.length<8)return t+" too short";if(t.length>n)return"Exceeds length limit";const a=t.toLowerCase(),o=t.toUpperCase();if(t!==a&&t!==o)return"Mixed-case string "+t;const f=(t=a).lastIndexOf("1");if(-1===f)return"No separator character for "+t;if(0===f)return"Missing prefix for "+t;const c=t.slice(0,f),u=t.slice(f+1);if(u.length<6)return"Data too short";let l=i(c);if("string"==typeof l)return l;const d=[];for(let t=0;t<u.length;++t){const e=u.charAt(t),n=r[e];if(void 0===n)return"Unknown character "+e;l=s(l)^n,t+6>=u.length||d.push(n)}return l!==e?"Invalid checksum for "+t:{prefix:c,words:d}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=a(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=a(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,a){if(a=a||90,t.length+7+r.length>a)throw new TypeError("Exceeds length limit");let o=i(t=t.toLowerCase());if("string"==typeof o)throw new Error(o);let f=t+"1";for(let t=0;t<r.length;++t){const e=r[t];if(e>>5)throw new Error("Non 5-bit word");o=s(o)^e,f+=n.charAt(e)}for(let t=0;t<6;++t)o=s(o);o^=e;for(let t=0;t<6;++t){f+=n.charAt(o>>5*(5-t)&31)}return f},toWords:o,fromWordsUnsafe:f,fromWords:c}}e.I=u("bech32"),u("bech32m")},48:(t,e,n)=>{"use strict";const r=n(991),s=n(318),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=f,e.IS=50;const a=2147483647;function o(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,f.prototype),e}function f(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|b(t,e);let r=o(n);const s=r.write(t,e);s!==n&&(r=r.slice(0,s));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(J(t,Uint8Array)){const e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return h(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(J(t,SharedArrayBuffer)||t&&J(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return f.from(r,e,n);const s=function(t){if(f.isBuffer(t)){const e=0|p(t.length),n=o(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||W(t.length)?o(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return f.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return u(t),o(t<0?0:0|p(t))}function d(t){const e=t.length<0?0:0|p(t.length),n=o(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,f.prototype),r}function p(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function b(t,e){if(f.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let s=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(s)return r?-1:K(t).length;e=(""+e).toLowerCase(),s=!0}}function y(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return O(this,e,n);case"ascii":return B(this,e,n);case"latin1":case"binary":return N(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function g(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,s){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),W(n=+n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof e&&(e=f.from(e,r)),f.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,s);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,s);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,s){let i,a=1,o=t.length,f=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,f/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(s){let r=-1;for(i=n;i<o;i++)if(c(t,i)===c(e,-1===r?0:i-r)){if(-1===r&&(r=i),i-r+1===f)return r*a}else-1!==r&&(i-=i-r),r=-1}else for(n+f>o&&(n=o-f),i=n;i>=0;i--){let n=!0;for(let r=0;r<f;r++)if(c(t,i+r)!==c(e,r)){n=!1;break}if(n)return i}return-1}function A(t,e,n,r){n=Number(n)||0;const s=t.length-n;r?(r=Number(r))>s&&(r=s):r=s;const i=e.length;let a;for(r>i/2&&(r=i/2),a=0;a<r;++a){const r=parseInt(e.substr(2*a,2),16);if(W(r))return a;t[n+a]=r}return a}function E(t,e,n,r){return $(K(e,t.length-n),t,n,r)}function v(t,e,n,r){return $(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function I(t,e,n,r){return $(q(e),t,n,r)}function T(t,e,n,r){return $(function(t,e){let n,r,s;const i=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,s=n%256,i.push(s),i.push(r);return i}(e,t.length-n),t,n,r)}function x(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function O(t,e,n){n=Math.min(t.length,n);const r=[];let s=e;for(;s<n;){const e=t[s];let i=null,a=e>239?4:e>223?3:e>191?2:1;if(s+a<=n){let n,r,o,f;switch(a){case 1:e<128&&(i=e);break;case 2:n=t[s+1],128==(192&n)&&(f=(31&e)<<6|63&n,f>127&&(i=f));break;case 3:n=t[s+1],r=t[s+2],128==(192&n)&&128==(192&r)&&(f=(15&e)<<12|(63&n)<<6|63&r,f>2047&&(f<55296||f>57343)&&(i=f));break;case 4:n=t[s+1],r=t[s+2],o=t[s+3],128==(192&n)&&128==(192&r)&&128==(192&o)&&(f=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&o,f>65535&&f<1114112&&(i=f))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),s+=a}return function(t){const e=t.length;if(e<=k)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=k));return n}(r)}f.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),f.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}}),f.poolSize=8192,f.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array),f.alloc=function(t,e,n){return function(t,e,n){return u(t),t<=0?o(t):void 0!==e?"string"==typeof n?o(t).fill(e,n):o(t).fill(e):o(t)}(t,e,n)},f.allocUnsafe=function(t){return l(t)},f.allocUnsafeSlow=function(t){return l(t)},f.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==f.prototype},f.compare=function(t,e){if(J(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(t)||!f.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let s=0,i=Math.min(n,r);s<i;++s)if(t[s]!==e[s]){n=t[s],r=e[s];break}return n<r?-1:r<n?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=f.allocUnsafe(e);let s=0;for(n=0;n<t.length;++n){let e=t[n];if(J(e,Uint8Array))s+e.length>r.length?(f.isBuffer(e)||(e=f.from(e)),e.copy(r,s)):Uint8Array.prototype.set.call(r,e,s);else{if(!f.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,s)}s+=e.length}return r},f.byteLength=b,f.prototype._isBuffer=!0,f.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},f.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},f.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},f.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?O(this,0,t):y.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},i&&(f.prototype[i]=f.prototype.inspect),f.prototype.compare=function(t,e,n,r,s){if(J(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),e<0||n>t.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&e>=n)return 0;if(r>=s)return-1;if(e>=n)return 1;if(this===t)return 0;let i=(s>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0);const o=Math.min(i,a),c=this.slice(r,s),u=t.slice(e,n);for(let t=0;t<o;++t)if(c[t]!==u[t]){i=c[t],a=u[t];break}return i<a?-1:a<i?1:0},f.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},f.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},f.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},f.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const s=this.length-e;if((void 0===n||n>s)&&(n=s),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":case"latin1":case"binary":return v(this,t,e,n);case"base64":return I(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const k=4096;function B(t,e,n){let r="";n=Math.min(t.length,n);for(let s=e;s<n;++s)r+=String.fromCharCode(127&t[s]);return r}function N(t,e,n){let r="";n=Math.min(t.length,n);for(let s=e;s<n;++s)r+=String.fromCharCode(t[s]);return r}function R(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let s="";for(let r=e;r<n;++r)s+=Z[t[r]];return s}function P(t,e,n){const r=t.slice(e,n);let s="";for(let t=0;t<r.length-1;t+=2)s+=String.fromCharCode(r[t]+256*r[t+1]);return s}function C(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function S(t,e,n,r,s,i){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function U(t,e,n,r,s){V(e,r,s,t,n,7);let i=Number(e&BigInt(4294967295));t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i,i>>=8,t[n++]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function L(t,e,n,r,s){V(e,r,s,t,n,7);let i=Number(e&BigInt(4294967295));t[n+7]=i,i>>=8,t[n+6]=i,i>>=8,t[n+5]=i,i>>=8,t[n+4]=i;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,s,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),s.write(t,e,n,r,23,4),n+4}function M(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),s.write(t,e,n,r,52,8),n+8}f.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,f.prototype),r},f.prototype.readUintLE=f.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],s=1,i=0;for(;++i<e&&(s*=256);)r+=this[t+i]*s;return r},f.prototype.readUintBE=f.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t+--e],s=1;for(;e>0&&(s*=256);)r+=this[t+--e]*s;return r},f.prototype.readUint8=f.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readBigUInt64LE=Y((function(t){_(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,s=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(s)<<BigInt(32))})),f.prototype.readBigUInt64BE=Y((function(t){_(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],s=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(s)})),f.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],s=1,i=0;for(;++i<e&&(s*=256);)r+=this[t+i]*s;return s*=128,r>=s&&(r-=Math.pow(2,8*e)),r},f.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=e,s=1,i=this[t+--r];for(;r>0&&(s*=256);)i+=this[t+--r]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i},f.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},f.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readBigInt64LE=Y((function(t){_(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),f.prototype.readBigInt64BE=Y((function(t){_(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||z(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),f.prototype.readFloatLE=function(t,e){return t>>>=0,e||C(t,4,this.length),s.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),s.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),s.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),s.read(this,t,!1,52,8)},f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){S(this,t,e,n,Math.pow(2,8*n)-1,0)}let s=1,i=0;for(this[e]=255&t;++i<n&&(s*=256);)this[e+i]=t/s&255;return e+n},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){S(this,t,e,n,Math.pow(2,8*n)-1,0)}let s=n-1,i=1;for(this[e+s]=255&t;--s>=0&&(i*=256);)this[e+s]=t/i&255;return e+n},f.prototype.writeUint8=f.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,255,0),this[e]=255&t,e+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigUInt64LE=Y((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeBigUInt64BE=Y((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),f.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let s=0,i=1,a=0;for(this[e]=255&t;++s<n&&(i*=256);)t<0&&0===a&&0!==this[e+s-1]&&(a=1),this[e+s]=(t/i|0)-a&255;return e+n},f.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,t,e,n,r-1,-r)}let s=n-1,i=1,a=0;for(this[e+s]=255&t;--s>=0&&(i*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/i|0)-a&255;return e+n},f.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},f.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},f.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},f.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},f.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||S(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},f.prototype.writeBigInt64LE=Y((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeBigInt64BE=Y((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),f.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},f.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},f.prototype.writeDoubleLE=function(t,e,n){return M(this,t,e,!0,n)},f.prototype.writeDoubleBE=function(t,e,n){return M(this,t,e,!1,n)},f.prototype.copy=function(t,e,n,r){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const s=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),s},f.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!f.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{const i=f.isBuffer(t)?t:f.from(t,r),a=i.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=i[s%a]}return this};const G={};function H(t,e,n){G[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function j(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function V(t,e,n,r,s,i){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let s;throw s=i>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new G.ERR_OUT_OF_RANGE("value",s,t)}!function(t,e,n){_(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||z(e,t.length-(n+1))}(r,s,i)}function _(t,e){if("number"!=typeof t)throw new G.ERR_INVALID_ARG_TYPE(e,"number",t)}function z(t,e,n){if(Math.floor(t)!==t)throw _(t,n),new G.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new G.ERR_BUFFER_OUT_OF_BOUNDS;throw new G.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,s=n;return Number.isInteger(n)&&Math.abs(n)>2**32?s=j(String(n)):"bigint"==typeof n&&(s=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(s=j(s)),s+="n"),r+=` It must be ${e}. Received ${s}`,r}),RangeError);const Q=/[^+/0-9A-Za-z-_]/g;function K(t,e){let n;e=e||1/0;const r=t.length;let s=null;const i=[];for(let a=0;a<r;++a){if(n=t.charCodeAt(a),n>55295&&n<57344){if(!s){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}s=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),s=n;continue}n=65536+(s-55296<<10|n-56320)}else s&&(e-=3)>-1&&i.push(239,191,189);if(s=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function q(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,n,r){let s;for(s=0;s<r&&!(s+n>=e.length||s>=t.length);++s)e[s+n]=t[s];return s}function J(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function W(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let s=0;s<16;++s)e[r+s]=t[n]+t[s]}return e}();function Y(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}},46:t=>{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function i(){i.init.call(this)}t.exports=i,t.exports.once=function(t,e){return new Promise((function(n,r){function s(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",s),n([].slice.call(arguments))}b(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&b(t,"error",e,n)}(t,s,{once:!0})}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function o(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?i.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var s,i,a,c;if(o(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),a=i[e]),void 0===a)a=i[e]=n,++t._eventsCount;else if("function"==typeof a?a=i[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(s=f(t))>0&&a.length>s&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,c=u,console&&console.warn&&console.warn(c)}return t}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},s=u.bind(r);return s.listener=n,r.wrapFn=s,s}function d(t,e,n){var r=t._events;if(void 0===r)return[];var s=r[e];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(s):p(s,s.length)}function h(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function b(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function s(i){r.once&&t.removeEventListener(e,s),n(i)}))}}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},i.prototype.getMaxListeners=function(){return f(this)},i.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var s="error"===t,i=this._events;if(void 0!==i)s=s&&void 0===i.error;else if(!s)return!1;if(s){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var f=i[t];if(void 0===f)return!1;if("function"==typeof f)r(f,this,e);else{var c=f.length,u=p(f,c);for(n=0;n<c;++n)r(u[n],this,e)}return!0},i.prototype.addListener=function(t,e){return c(this,t,e,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(t,e){return c(this,t,e,!0)},i.prototype.once=function(t,e){return o(e),this.on(t,l(this,t,e)),this},i.prototype.prependOnceListener=function(t,e){return o(e),this.prependListener(t,l(this,t,e)),this},i.prototype.removeListener=function(t,e){var n,r,s,i,a;if(o(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===e||n[i].listener===e){a=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,s),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},i.prototype.listeners=function(t){return d(this,t,!0)},i.prototype.rawListeners=function(t){return d(this,t,!1)},i.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):h.call(t,e)},i.prototype.listenerCount=h,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},318:(t,e)=>{e.read=function(t,e,n,r,s){var i,a,o=8*s-r-1,f=(1<<o)-1,c=f>>1,u=-7,l=n?s-1:0,d=n?-1:1,h=t[e+l];for(l+=d,i=h&(1<<-u)-1,h>>=-u,u+=o;u>0;i=256*i+t[e+l],l+=d,u-=8);for(a=i&(1<<-u)-1,i>>=-u,u+=r;u>0;a=256*a+t[e+l],l+=d,u-=8);if(0===i)i=1-c;else{if(i===f)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=c}return(h?-1:1)*a*Math.pow(2,i-r)},e.write=function(t,e,n,r,s,i){var a,o,f,c=8*i-s-1,u=(1<<c)-1,l=u>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+l>=1?d/f:d*Math.pow(2,1-l))*f>=2&&(a++,f/=2),a+l>=u?(o=0,a=u):a+l>=1?(o=(e*f-1)*Math.pow(2,s),a+=l):(o=e*Math.pow(2,l-1)*Math.pow(2,s),a=0));s>=8;t[n+h]=255&o,h+=p,o/=256,s-=8);for(a=a<<s|o,c+=s;c>0;t[n+h]=255&a,h+=p,a/=256,c-=8);t[n+h-p]|=128*b}}},e={};function n(r){var s=e[r];if(void 0!==s)return s.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{onKeyringRequest:()=>Ow,onRpcRequest:()=>xw});var t={};n.r(t),n.d(t,{OG:()=>fn,My:()=>We,bytesToNumberBE:()=>en,lX:()=>nn,Id:()=>on,fg:()=>ln,qj:()=>an,hexToBytes:()=>tn,aY:()=>$e,lq:()=>rn,z:()=>sn,Q5:()=>hn});var e={};n.r(e),n.d(e,{OG:()=>ep,My:()=>Kh,bytesToNumberBE:()=>Jh,lX:()=>Wh,Id:()=>tp,fg:()=>sp,qj:()=>Xh,hexToBytes:()=>$h,lq:()=>Zh,z:()=>Yh,Q5:()=>ap});class s extends TypeError{constructor(t,e){let n;const{message:r,explanation:s,...i}=t,{path:a}=t,o=0===a.length?r:`At path: ${a.join(".")} -- ${r}`;super(s??o),null!=s&&(this.cause=o),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...e()])}}function i(t){return"object"==typeof t&&null!==t}function a(t){return"symbol"==typeof t?t.toString():"string"==typeof t?JSON.stringify(t):`${t}`}function o(t,e,n,r){if(!0===t)return;!1===t?t={}:"string"==typeof t&&(t={message:t});const{path:s,branch:i}=e,{type:o}=n,{refinement:f,message:c=`Expected a value of type \`${o}\`${f?` with refinement \`${f}\``:""}, but received: \`${a(r)}\``}=t;return{value:r,type:o,refinement:f,key:s[s.length-1],path:s,branch:i,...t,message:c}}function*f(t,e,n,r){(function(t){return i(t)&&"function"==typeof t[Symbol.iterator]})(t)||(t=[t]);for(const s of t){const t=o(s,e,n,r);t&&(yield t)}}function*c(t,e,n={}){const{path:r=[],branch:s=[t],coerce:a=!1,mask:o=!1}=n,f={path:r,branch:s};if(a&&(t=e.coercer(t,f),o&&"type"!==e.type&&i(e.schema)&&i(t)&&!Array.isArray(t)))for(const n in t)void 0===e.schema[n]&&delete t[n];let u="valid";for(const r of e.validator(t,f))r.explanation=n.message,u="not_valid",yield[r,void 0];for(let[l,d,h]of e.entries(t,f)){const e=c(d,h,{path:void 0===l?r:[...r,l],branch:void 0===l?s:[...s,d],coerce:a,mask:o,message:n.message});for(const n of e)n[0]?(u=null===n[0].refinement||void 0===n[0].refinement?"not_valid":"not_refined",yield[n[0],void 0]):a&&(d=n[1],void 0===l?t=d:t instanceof Map?t.set(l,d):t instanceof Set?t.add(d):i(t)&&(void 0!==d||l in t)&&(t[l]=d))}if("not_valid"!==u)for(const r of e.refiner(t,f))r.explanation=n.message,u="not_refined",yield[r,void 0];"valid"===u&&(yield[void 0,t])}class u{constructor(t){const{type:e,schema:n,validator:r,refiner:s,coercer:i=(t=>t),entries:a=function*(){}}=t;this.type=e,this.schema=n,this.entries=a,this.coercer=i,this.validator=r?(t,e)=>f(r(t,e),e,this,t):()=>[],this.refiner=s?(t,e)=>f(s(t,e),e,this,t):()=>[]}assert(t,e){return l(t,this,e)}create(t,e){return function(t,e,n){const r=h(t,e,{coerce:!0,message:n});if(r[0])throw r[0];return r[1]}(t,this,e)}is(t){return d(t,this)}mask(t,e){return function(t,e,n){const r=h(t,e,{coerce:!0,mask:!0,message:n});if(r[0])throw r[0];return r[1]}(t,this,e)}validate(t,e={}){return h(t,this,e)}}function l(t,e,n){const r=h(t,e,{message:n});if(r[0])throw r[0]}function d(t,e){return!h(t,e)[0]}function h(t,e,n={}){const r=c(t,e,n),i=function(t){const{done:e,value:n}=t.next();return e?void 0:n}(r);if(i[0]){return[new s(i[0],(function*(){for(const t of r)t[0]&&(yield t[0])})),void 0]}return[void 0,i[1]]}function p(t,e){return new u({type:t,schema:null,validator:e})}function b(t){let e;return new u({type:"lazy",schema:null,*entries(n,r){e??(e=t()),yield*e.entries(n,r)},validator:(n,r)=>(e??(e=t()),e.validator(n,r)),coercer:(n,r)=>(e??(e=t()),e.coercer(n,r)),refiner:(n,r)=>(e??(e=t()),e.refiner(n,r))})}function y(){return p("any",(()=>!0))}function g(t){return new u({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[n,r]of e.entries())yield[n,r,t]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||`Expected an array value, but received: ${a(t)}`})}function m(){return p("boolean",(t=>"boolean"==typeof t))}function w(t){const e={},n=t.map((t=>a(t))).join();for(const n of t)e[n]=n;return new u({type:"enums",schema:e,validator:e=>t.includes(e)||`Expected one of \`${n}\`, but received: ${a(e)}`})}function A(){return p("integer",(t=>"number"==typeof t&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${a(t)}`))}function E(t){const e=a(t),n=typeof t;return new u({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:n=>n===t||`Expected the literal \`${e}\`, but received: ${a(n)}`})}function v(){return p("never",(()=>!1))}function I(t){return new u({...t,validator:(e,n)=>null===e||t.validator(e,n),refiner:(e,n)=>null===e||t.refiner(e,n)})}function T(){return p("number",(t=>"number"==typeof t&&!isNaN(t)||`Expected a number, but received: ${a(t)}`))}function x(t){const e=t?Object.keys(t):[],n=v();return new u({type:"object",schema:t??null,*entries(r){if(t&&i(r)){const s=new Set(Object.keys(r));for(const n of e)s.delete(n),yield[n,r[n],t[n]];for(const t of s)yield[t,r[t],n]}},validator:t=>i(t)||`Expected an object, but received: ${a(t)}`,coercer:t=>i(t)?{...t}:t})}function O(t){return new u({...t,validator:(e,n)=>void 0===e||t.validator(e,n),refiner:(e,n)=>void 0===e||t.refiner(e,n)})}function k(t,e){return new u({type:"record",schema:null,*entries(n){if(i(n))for(const r in n){const s=n[r];yield[r,r,t],yield[r,s,e]}},validator:t=>i(t)||`Expected an object, but received: ${a(t)}`})}function B(){return p("string",(t=>"string"==typeof t||`Expected a string, but received: ${a(t)}`))}function N(t){const e=t.map((t=>t.type)).join(" | ");return new u({type:"union",schema:null,coercer(e){for(const n of t){const[t,r]=n.validate(e,{coerce:!0});if(!t)return r}return e},validator(n,r){const s=[];for(const e of t){const[...t]=c(n,e,r),[i]=t;if(!i?.[0])return[];for(const[e]of t)e&&s.push(e)}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${a(n)}`,...s]}})}function R(){return p("unknown",(()=>!0))}function P(t){return x(t)}function C(t){return t.path[t.path.length-1]in t.branch[t.branch.length-2]}function S(t){return new u({...t,validator:(e,n)=>!C(n)||t.validator(e,n),refiner:(e,n)=>!C(n)||t.refiner(e,n)})}function U(t,e){return p(t,(t=>"string"==typeof t&&e.test(t)))}const L=U("UuidV4",/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu),D=p("Url",(t=>{try{const e=new URL(t);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}})),F=U("StringNumber",/^\d+(\.\d+)?$/u);function M(t,e,n){return new u({...t,coercer:(r,s)=>d(r,e)?t.coercer(n(r,s),s):t.coercer(r,s)})}Error;const G=(t,e)=>Object.hasOwnProperty.call(t,e);var H;!function(t){t[t.Null=4]="Null",t[t.Comma=1]="Comma",t[t.Wrapper=1]="Wrapper",t[t.True=4]="True",t[t.False=5]="False",t[t.Quote=1]="Quote",t[t.Colon=1]="Colon",t[t.Date=24]="Date"}(H=H||(H={}));function j(t){return function(t){return function(t){return"object"==typeof t&&null!==t&&"message"in t}(t)&&"string"==typeof t.message?t.message:null==t?"":String(t)}(t).replace(/\.$/u,"")}function V(t,e){return n=t,Boolean("string"==typeof n?.prototype?.constructor?.name)?new t({message:e}):t({message:e});var n}class _ extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}function z(t,e="Assertion failed.",n=_){if(!t){if(e instanceof Error)throw e;throw V(n,e)}}const Q=t=>x(t);function K({path:t,branch:e}){const n=t[t.length-1];return G(e[e.length-2],n)}function q(t){return new u({...t,type:`optional ${t.type}`,validator:(e,n)=>!K(n)||t.validator(e,n),refiner:(e,n)=>!K(n)||t.refiner(e,n)})}const $=N([E(null),m(),p("finite number",(t=>d(t,T())&&Number.isFinite(t))),B(),g(b((()=>$))),k(B(),b((()=>$)))]),J=M($,y(),(t=>(function(t,e,n="Assertion failed",r=_){try{l(t,e)}catch(t){throw V(r,`${n}: ${j(t)}.`)}}(t,$),JSON.parse(JSON.stringify(t,((t,e)=>{if("__proto__"!==t&&"constructor"!==t)return e}))))));const W=E("2.0"),Z=I(N([T(),B()])),Y=Q({code:A(),message:B(),data:q(J),stack:q(B())}),X=N([k(B(),J),g(J)]);Q({id:Z,jsonrpc:W,method:B(),params:q(X)}),Q({jsonrpc:W,method:B(),params:q(X)});x({id:Z,jsonrpc:W,result:O(R()),error:O(Y)});const tt=Q({id:Z,jsonrpc:W,result:J}),et=Q({id:Z,jsonrpc:W,error:Y});N([tt,et]);const nt=P({jsonrpc:E("2.0"),id:N([B(),T(),E(null)]),method:B(),params:S(N([g(J),k(B(),J)]))});function rt(t){return t instanceof Map||t instanceof Set?t.size:t.length}function st(t){return at(t,"nonempty",(e=>rt(e)>0||`Expected a nonempty ${t.type} but received an empty one`))}function it(t,e){return at(t,"pattern",(n=>e.test(n)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${n}"`))}function at(t,e,n){return new u({...t,*refiner(r,s){yield*t.refiner(r,s);const i=f(n(r,s),s,t,r);for(const t of i)yield{...t,refinement:e}}})}const ot=/^(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})$/u,ft=/^[-a-z0-9]{3,8}$/u,ct=/^[-_a-zA-Z0-9]{1,32}$/u,ut=/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32})):(?<accountAddress>[-.%a-zA-Z0-9]{1,128})$/u,lt=it(B(),ot),dt=it(B(),ft),ht=(it(B(),ct),it(B(),ut),it(B(),/^[-.%a-zA-Z0-9]{1,128}$/u),it(B(),/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u)),pt=it(B(),/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u);var bt;!function(t){t.Bip122="bip122",t.Solana="solana",t.Eip155="eip155",t.Wallet="wallet"}(bt=bt||(bt={}));const yt=(t,e)=>Object.hasOwnProperty.call(t,e);var gt;!function(t){t[t.Null=4]="Null",t[t.Comma=1]="Comma",t[t.Wrapper=1]="Wrapper",t[t.True=4]="True",t[t.False=5]="False",t[t.Quote=1]="Quote",t[t.Colon=1]="Colon",t[t.Date=24]="Date"}(gt=gt||(gt={}));const mt=t=>x(t);function wt({path:t,branch:e}){const n=t[t.length-1];return yt(e[e.length-2],n)}function At(t){return new u({...t,type:`optional ${t.type}`,validator:(e,n)=>!wt(n)||t.validator(e,n),refiner:(e,n)=>!wt(n)||t.refiner(e,n)})}function Et(t){if(null===t||"boolean"==typeof t||"string"==typeof t)return!0;if("number"==typeof t&&Number.isFinite(t))return!0;if("object"==typeof t){let e=!0;if(Array.isArray(t)){for(let n=0;n<t.length;n++)if(!Et(t[n])){e=!1;break}return e}const n=Object.entries(t);for(let t=0;t<n.length;t++)if("string"!=typeof n[t][0]||!Et(n[t][1])){e=!1;break}return e}return!1}const vt=p("JSON",(t=>Et(t))),It=M(vt,at(y(),"JSON",(t=>d(t,vt))),(t=>JSON.parse(JSON.stringify(t,((t,e)=>{if("__proto__"!==t&&"constructor"!==t)return e})))));const Tt=E("2.0"),xt=I(N([T(),B()])),Ot=mt({code:A(),message:B(),data:At(It),stack:At(B())}),kt=N([k(B(),It),g(It)]);mt({id:xt,jsonrpc:Tt,method:B(),params:At(kt)}),mt({jsonrpc:Tt,method:B(),params:At(kt)});x({id:xt,jsonrpc:Tt,result:O(R()),error:O(Ot)});const Bt=mt({id:xt,jsonrpc:Tt,result:It}),Nt=mt({id:xt,jsonrpc:Tt,error:Ot});N([Bt,Nt]);var Rt,Pt,Ct;!function(t){t.Eoa="eip155:eoa",t.Erc4337="eip155:erc4337"}(Rt||(Rt={})),function(t){t.P2wpkh="bip122:p2wpkh"}(Pt||(Pt={})),function(t){t.DataAccount="solana:data-account"}(Ct||(Ct={}));const St=P({id:L,type:w([`${Rt.Eoa}`,`${Rt.Erc4337}`,`${Pt.P2wpkh}`,`${Ct.DataAccount}`]),address:B(),scopes:st(g(N([dt,lt]))),options:k(B(),It),methods:g(B())}),Ut=P({fungible:E(!0),type:ht,unit:B(),amount:F}),Lt=P({fungible:E(!1),id:pt}),Dt=(Ft=t=>function(t){if("object"!=typeof t||null===t)return!1;try{let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}catch(t){return!1}}(t)&&!t.fungible?Lt:Ut,new u({type:"union",schema:null,*entries(t,e){yield*Ft(t).entries(t,e)},*refiner(t,e){yield*Ft(t).refiner(t,e)},coercer:(t,e)=>Ft(t).coercer(t,e),validator:(t,e)=>Ft(t).validator(t,e)}));var Ft;const Mt=P({amount:F,unit:B()}),Gt=U("CaipAssetType",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})$/u);U("CaipAssetId",/^(?<chainId>(?<namespace>[-a-z0-9]{3,8}):(?<reference>[-_a-zA-Z0-9]{1,32}))\/(?<assetNamespace>[-a-z0-9]{3,8}):(?<assetReference>[-.%a-zA-Z0-9]{1,128})\/(?<tokenId>[-.%a-zA-Z0-9]{1,78})$/u);k(B(),It);const Ht=P({id:L,scope:B(),account:L,request:P({method:B(),params:S(N([g(It),k(B(),It)]))})}),jt=(N([P({pending:E(!0),redirect:S(P({message:S(B()),url:S(B())}))}),P({pending:E(!1),result:It})]),P({address:B(),asset:I(Dt)}));var Vt;!function(t){t.Base="base",t.Priority="priority"}(Vt||(Vt={}));const _t=P({type:w([`${Vt.Base}`,`${Vt.Priority}`]),asset:Dt});var zt,Qt;!function(t){t.Submitted="submitted",t.Unconfirmed="unconfirmed",t.Confirmed="confirmed",t.Failed="failed"}(zt||(zt={})),function(t){t.Send="send",t.Receive="receive"}(Qt||(Qt={}));const Kt=P({status:w([`${zt.Submitted}`,`${zt.Unconfirmed}`,`${zt.Confirmed}`,`${zt.Failed}`]),timestamp:I(T())}),qt=P({id:B(),chain:lt,account:L,status:w([`${zt.Submitted}`,`${zt.Unconfirmed}`,`${zt.Confirmed}`,`${zt.Failed}`]),timestamp:I(T()),type:w([`${Qt.Send}`,`${Qt.Receive}`]),from:g(jt),to:g(jt),fees:g(_t),events:g(Kt)}),$t=(P({data:g(qt),next:I(B())}),P({limit:T(),next:S(I(B()))}));var Jt;!function(t){t.Namespace="bip122",t.Mainnet="bip122:000000000019d6689c085ae165831e93",t.Testnet="bip122:000000000933ea01ad0ee984209779ba",t.Testnet4="bip122:00000000da84f2bafbbc53dee25a72ae",t.Signet="bip122:00000008819873e925422c1ff0f99f7c",t.Regtest="bip122:regtest"}(Jt||(Jt={}));var Wt=n(586);const Zt=at(B(),"BtcP2wpkhAddressStruct",(t=>{try{Wt.I.decode(t)}catch(t){return new Error(`Could not decode P2WPKH address: ${t.message}`)}return!0}));var Yt;!function(t){t.SendBitcoin="sendBitcoin"}(Yt||(Yt={}));P({...St.schema,address:Zt,type:E(`${Pt.P2wpkh}`),methods:g(w([`${Yt.SendBitcoin}`]))});var Xt;!function(t){t.Namespace="solana",t.Devnet="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",t.Mainnet="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",t.Testnet="solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}(Xt||(Xt={}));const te=U("SolAddress",/^[1-9A-HJ-NP-Za-km-z]{32,44}$/iu);var ee;!function(t){t.SendAndConfirmTransaction="sendAndConfirmTransaction"}(ee||(ee={}));P({...St.schema,address:te,type:E(`${Ct.DataAccount}`),methods:g(w([`${ee.SendAndConfirmTransaction}`]))});var ne;!function(t){t.Namespace="eip155",t.Mainnet="eip155:1"}(ne||(ne={}));const re=U("EthBytes",/^0x[0-9a-f]*$/iu),se=U("EthAddress",/^0x[0-9a-f]{40}$/iu),ie=U("EthUint256",/^0x([1-9a-f][0-9a-f]*|0)$/i