@smartledger/bsv 6.0.2 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bsv-ecies.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var bsvEcies;(()=>{var t={481(t,e,r){t.exports=r(729)},719(t,e,r){"use strict";var n=r(287).hp,{secp256k1:o}=r(112),{sha512:i,sha256:s}=r(544),{hmac:f}=r(474),{cbc:u}=r(110),c=r(722),h=c.PublicKey,a=c.util.preconditions,l=c.crypto.Random;function d(t){return n.from(t.buffer,t.byteOffset,t.byteLength)}function p(t,e){return d(f(s,t,e))}var g=function(){};g.encrypt=function(t,e,r){a.checkArgument(t),a.checkArgument(e),a.checkArgument(r),r=r||l.getRandomBuffer(16);var o=u(Uint8Array.from(e),Uint8Array.from(r)).encrypt(Uint8Array.from(t));return n.concat([n.from(r),d(o)])},g.decrypt=function(t,e){a.checkArgument(t),a.checkArgument(e);var r=t.slice(0,16),n=t.slice(16);return d(u(Uint8Array.from(e),Uint8Array.from(r)).decrypt(Uint8Array.from(n)))};var y=function t(e){if(!(this instanceof t))return new t;this.opts=e||{}};y.prototype.privateKey=function(t){return a.checkArgument(t,"no private key provided"),this._privateKey=t||null,this},y.prototype.publicKey=function(t){return a.checkArgument(t,"no public key provided"),this._publicKey=t||null,this};var w=function(t,e){var r="_"+t;Object.defineProperty(y.prototype,t,{configurable:!1,enumerable:!0,get:function(){var t=this[r];return t||(t=this[r]=e.apply(this)),t}})};w("Rbuf",function(){var t=this._privateKey.bn.toBuffer({size:32});return d(o.getPublicKey(Uint8Array.from(t),!0))}),w("kEkM",function(){var t=this._privateKey.bn.toBuffer({size:32}),e=this._publicKey.toDER(),r=o.getSharedSecret(Uint8Array.from(t),Uint8Array.from(e),!0).slice(1);return d(i(r))}),w("kE",function(){return this.kEkM.slice(0,32)}),w("kM",function(){return this.kEkM.slice(32,64)}),y.prototype.encrypt=function(t,e){n.isBuffer(t)||(t=n.from(t)),void 0===e&&(e=p(this._privateKey.toBuffer(),t).slice(0,16));var r=g.encrypt(t,this.kE,e),o=p(this.kM,r);return this.opts.shortTag&&(o=o.slice(0,4)),this.opts.noKey?n.concat([r,o]):n.concat([this.Rbuf,r,o])},y.prototype.decrypt=function(t){a.checkArgument(t);var e=0,r=this.opts.shortTag?4:32;if(!this.opts.noKey){var n;switch(t[0]){case 4:n=t.slice(0,65);break;case 3:case 2:n=t.slice(0,33);break;default:throw new Error("Invalid type: "+t[0])}this._publicKey=h.fromDER(n),e+=n.length}var o=t.slice(e,t.length-r),i=t.slice(t.length-r,t.length),s=p(this.kM,o);if(this.opts.shortTag&&(s=s.slice(0,4)),!function(t,e){if(t.length!==e.length)return!1;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 0===r}(i,s))throw new Error("Invalid checksum");return g.decrypt(o,this.kE)},t.exports=y},354(t,e,r){"use strict";var n=r(287).hp,o=r(722),i=o.PublicKey,s=o.PrivateKey,f=o.util.preconditions,u=r(719),c=r(318),{secp256k1:h}=r(112),{sha512:a,sha256:l}=r(544),{hmac:d}=r(474),{cbc:p}=r(110);function g(t){return n.from(t.buffer,t.byteOffset,t.byteLength)}function y(t,e){return g(d(l,e,t))}var w=function(){};w.encrypt=function(t,e,r){return f.checkArgument(t),f.checkArgument(e),f.checkArgument(r),f.checkArgument(16===e.length,"keybuf length must be 16"),f.checkArgument(16===r.length,"ivbuf length must be 16"),g(p(Uint8Array.from(e),Uint8Array.from(r)).encrypt(Uint8Array.from(t)))},w.decrypt=function(t,e,r){return f.checkArgument(t),f.checkArgument(e),f.checkArgument(r),f.checkArgument(16===e.length,"keybuf length must be 16"),f.checkArgument(16===r.length,"ivbuf length must be 16"),g(p(Uint8Array.from(e),Uint8Array.from(r)).decrypt(Uint8Array.from(t)))};var b=function t(e,r="BIE1"){if("BIE1"!==r)throw new c.UnsupportAlgorithm(r);if(!(this instanceof t))return new t(e,r);this._privateKey=new o.PrivateKey,this.opts=e||{},this.opts.ephemeralKey=!0};b.prototype.privateKey=function(t){return f.checkArgument(s.isValid(t),"no private key provided"),this._privateKey=s(t.toHex())||null,this.opts.ephemeralKey=!1,this},b.prototype.publicKey=function(t){return f.checkArgument(i.isValid(t),"no public key provided"),this._publicKey=i(t.toString())||null,null!=this._publicKey&&(this.opts.fixedPublicKey=!0),this};var m=function(t,e){var r="_"+t;Object.defineProperty(b.prototype,t,{configurable:!1,enumerable:!0,get:function(){this[r];return this[r]=e.apply(this)}})};m("Rbuf",function(){var t=this._privateKey.bn.toBuffer({size:32});return g(h.getPublicKey(Uint8Array.from(t),!0))}),m("ivkEkM",function(){var t=this._privateKey.bn.toBuffer({size:32}),e=this._publicKey.toDER(),r=h.getSharedSecret(Uint8Array.from(t),Uint8Array.from(e),!0);return g(a(r))}),m("iv",function(){return this.ivkEkM.slice(0,16)}),m("kE",function(){return this.ivkEkM.slice(16,32)}),m("kM",function(){return this.ivkEkM.slice(32,64)}),b.prototype.encrypt=function(t){n.isBuffer(t)||(t=n.from(t));var e,r=w.encrypt(t,this.kE,this.iv),o=n.from("BIE1"),i=y(e=this.opts.noKey&&!this.opts.ephemeralKey?n.concat([o,r]):n.concat([o,this.Rbuf,r]),this.kM);return this.opts.shortTag&&(i=i.slice(0,4)),n.concat([e,i])},b.prototype.decrypt=function(t){f.checkArgument(n.isBuffer(t),"ciphetext must be a buffer");var e=this.opts.shortTag?4:32,r=4;if(!t.slice(0,4).equals(n.from("BIE1")))throw new c.DecryptionError("Invalid Magic");if(!this.opts.noKey){var o=t.slice(4,37);this.opts.fixedPublicKey?console.log('Notice: Overriding PublicKey in message. Consider use "noKey" option if you are not sending message to electrum and do not want to use ephemeral key'):this._publicKey=i.fromDER(o),r=37}var s=t.slice(r,t.length-e),u=t.slice(t.length-e,t.length),h=y(t.slice(0,t.length-e),this.kM);if(this.opts.shortTag&&(h=h.slice(0,4)),u.length!==h.length)throw new c.DecryptionError("Invalid checksum");for(var a=0,l=0;l<h.length;l++)a|=u[l]^h[l];if(0!==a)throw new c.DecryptionError("Invalid checksum");return w.decrypt(s,this.kE,this.iv)},b.bitcoreECIES=u,t.exports=b},318(t,e,r){"use strict";t.exports=r(722).errors.extend({name:"ECIES",message:"Internal Error on bsv-ecies Module {0}",errors:[{name:"DecryptionError",message:"Invalid Message: {0}"},{name:"UnsupportAlgorithm",message:"Unsupport Algorithm: {0}"}]})},729(t,e,r){t.exports=r(354)},526(t,e){"use strict";e.toByteArray=function(t){var e,r,i=f(t),s=i[0],u=i[1],c=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),h=0,a=u>0?s-4:s;for(r=0;r<a;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[h++]=255&e);1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,f=0,u=n-o;f<u;f+=s)i.push(c(t,f,f+s>u?u:f+s));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function c(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(u(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},287(t,e,r){"use strict";
1
+ var bsvEcies;(()=>{var t={481(t,e,r){t.exports=r(729)},719(t,e,r){"use strict";var n=r(287).hp,{secp256k1:o}=r(554),{sha512:i,sha256:s}=r(87),{hmac:f}=r(474),{cbc:u}=r(405),c=r(722),h=c.PublicKey,a=c.util.preconditions,l=c.crypto.Random;function d(t){return n.from(t.buffer,t.byteOffset,t.byteLength)}function p(t,e){return d(f(s,t,e))}var g=function(){};g.encrypt=function(t,e,r){a.checkArgument(t),a.checkArgument(e),a.checkArgument(r),r=r||l.getRandomBuffer(16);var o=u(Uint8Array.from(e),Uint8Array.from(r)).encrypt(Uint8Array.from(t));return n.concat([n.from(r),d(o)])},g.decrypt=function(t,e){a.checkArgument(t),a.checkArgument(e);var r=t.slice(0,16),n=t.slice(16);return d(u(Uint8Array.from(e),Uint8Array.from(r)).decrypt(Uint8Array.from(n)))};var y=function t(e){if(!(this instanceof t))return new t;this.opts=e||{}};y.prototype.privateKey=function(t){return a.checkArgument(t,"no private key provided"),this._privateKey=t||null,this},y.prototype.publicKey=function(t){return a.checkArgument(t,"no public key provided"),this._publicKey=t||null,this};var w=function(t,e){var r="_"+t;Object.defineProperty(y.prototype,t,{configurable:!1,enumerable:!0,get:function(){var t=this[r];return t||(t=this[r]=e.apply(this)),t}})};w("Rbuf",function(){var t=this._privateKey.bn.toBuffer({size:32});return d(o.getPublicKey(Uint8Array.from(t),!0))}),w("kEkM",function(){var t=this._privateKey.bn.toBuffer({size:32}),e=this._publicKey.toDER(),r=o.getSharedSecret(Uint8Array.from(t),Uint8Array.from(e),!0).slice(1);return d(i(r))}),w("kE",function(){return this.kEkM.slice(0,32)}),w("kM",function(){return this.kEkM.slice(32,64)}),y.prototype.encrypt=function(t,e){n.isBuffer(t)||(t=n.from(t)),void 0===e&&(e=p(this._privateKey.toBuffer(),t).slice(0,16));var r=g.encrypt(t,this.kE,e),o=p(this.kM,r);return this.opts.shortTag&&(o=o.slice(0,4)),this.opts.noKey?n.concat([r,o]):n.concat([this.Rbuf,r,o])},y.prototype.decrypt=function(t){a.checkArgument(t);var e=0,r=this.opts.shortTag?4:32;if(!this.opts.noKey){var n;switch(t[0]){case 4:n=t.slice(0,65);break;case 3:case 2:n=t.slice(0,33);break;default:throw new Error("Invalid type: "+t[0])}this._publicKey=h.fromDER(n),e+=n.length}var o=t.slice(e,t.length-r),i=t.slice(t.length-r,t.length),s=p(this.kM,o);if(this.opts.shortTag&&(s=s.slice(0,4)),!function(t,e){if(t.length!==e.length)return!1;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 0===r}(i,s))throw new Error("Invalid checksum");return g.decrypt(o,this.kE)},t.exports=y},354(t,e,r){"use strict";var n=r(287).hp,o=r(722),i=o.PublicKey,s=o.PrivateKey,f=o.util.preconditions,u=r(719),c=r(318),{secp256k1:h}=r(554),{sha512:a,sha256:l}=r(87),{hmac:d}=r(474),{cbc:p}=r(405);function g(t){return n.from(t.buffer,t.byteOffset,t.byteLength)}function y(t,e){return g(d(l,e,t))}var w=function(){};w.encrypt=function(t,e,r){return f.checkArgument(t),f.checkArgument(e),f.checkArgument(r),f.checkArgument(16===e.length,"keybuf length must be 16"),f.checkArgument(16===r.length,"ivbuf length must be 16"),g(p(Uint8Array.from(e),Uint8Array.from(r)).encrypt(Uint8Array.from(t)))},w.decrypt=function(t,e,r){return f.checkArgument(t),f.checkArgument(e),f.checkArgument(r),f.checkArgument(16===e.length,"keybuf length must be 16"),f.checkArgument(16===r.length,"ivbuf length must be 16"),g(p(Uint8Array.from(e),Uint8Array.from(r)).decrypt(Uint8Array.from(t)))};var b=function t(e,r="BIE1"){if("BIE1"!==r)throw new c.UnsupportAlgorithm(r);if(!(this instanceof t))return new t(e,r);this._privateKey=new o.PrivateKey,this.opts=e||{},this.opts.ephemeralKey=!0};b.prototype.privateKey=function(t){return f.checkArgument(s.isValid(t),"no private key provided"),this._privateKey=s(t.toHex())||null,this.opts.ephemeralKey=!1,this},b.prototype.publicKey=function(t){return f.checkArgument(i.isValid(t),"no public key provided"),this._publicKey=i(t.toString())||null,null!=this._publicKey&&(this.opts.fixedPublicKey=!0),this};var m=function(t,e){var r="_"+t;Object.defineProperty(b.prototype,t,{configurable:!1,enumerable:!0,get:function(){this[r];return this[r]=e.apply(this)}})};m("Rbuf",function(){var t=this._privateKey.bn.toBuffer({size:32});return g(h.getPublicKey(Uint8Array.from(t),!0))}),m("ivkEkM",function(){var t=this._privateKey.bn.toBuffer({size:32}),e=this._publicKey.toDER(),r=h.getSharedSecret(Uint8Array.from(t),Uint8Array.from(e),!0);return g(a(r))}),m("iv",function(){return this.ivkEkM.slice(0,16)}),m("kE",function(){return this.ivkEkM.slice(16,32)}),m("kM",function(){return this.ivkEkM.slice(32,64)}),b.prototype.encrypt=function(t){n.isBuffer(t)||(t=n.from(t));var e,r=w.encrypt(t,this.kE,this.iv),o=n.from("BIE1"),i=y(e=this.opts.noKey&&!this.opts.ephemeralKey?n.concat([o,r]):n.concat([o,this.Rbuf,r]),this.kM);return this.opts.shortTag&&(i=i.slice(0,4)),n.concat([e,i])},b.prototype.decrypt=function(t){f.checkArgument(n.isBuffer(t),"ciphetext must be a buffer");var e=this.opts.shortTag?4:32,r=4;if(!t.slice(0,4).equals(n.from("BIE1")))throw new c.DecryptionError("Invalid Magic");if(!this.opts.noKey){var o=t.slice(4,37);this.opts.fixedPublicKey?console.log('Notice: Overriding PublicKey in message. Consider use "noKey" option if you are not sending message to electrum and do not want to use ephemeral key'):this._publicKey=i.fromDER(o),r=37}var s=t.slice(r,t.length-e),u=t.slice(t.length-e,t.length),h=y(t.slice(0,t.length-e),this.kM);if(this.opts.shortTag&&(h=h.slice(0,4)),u.length!==h.length)throw new c.DecryptionError("Invalid checksum");for(var a=0,l=0;l<h.length;l++)a|=u[l]^h[l];if(0!==a)throw new c.DecryptionError("Invalid checksum");return w.decrypt(s,this.kE,this.iv)},b.bitcoreECIES=u,t.exports=b},318(t,e,r){"use strict";t.exports=r(722).errors.extend({name:"ECIES",message:"Internal Error on bsv-ecies Module {0}",errors:[{name:"DecryptionError",message:"Invalid Message: {0}"},{name:"UnsupportAlgorithm",message:"Unsupport Algorithm: {0}"}]})},729(t,e,r){t.exports=r(354)},526(t,e){"use strict";e.toByteArray=function(t){var e,r,i=f(t),s=i[0],u=i[1],c=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,u)),h=0,a=u>0?s-4:s;for(r=0;r<a;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[h++]=255&e);1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e);return c},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],s=16383,f=0,u=n-o;f<u;f+=s)i.push(c(t,f,f+s>u?u:f+s));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function c(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(u(n));return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},287(t,e,r){"use strict";
2
2
  /*!
3
3
  * The buffer module from node.js, for the browser.
4
4
  *
@@ -7,9 +7,9 @@ var bsvEcies;(()=>{var t={481(t,e,r){t.exports=r(729)},719(t,e,r){"use strict";v
7
7
  */
8
8
  const n=r(526),o=r(251),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const s=2147483647;function f(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return a(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=f(r);const o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(G(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return l(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(G(t,ArrayBuffer)||t&&G(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(G(t,SharedArrayBuffer)||t&&G(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const o=function(t){if(u.isBuffer(t)){const e=0|p(t.length),r=f(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?f(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}(t);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(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 a(t){return h(t),f(t<0?0:0|p(t))}function l(t){const e=t.length<0?0:0|p(t.length),r=f(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function d(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function p(t){if(t>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||G(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 r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(o)return n?-1:V(t).length;e=(""+e).toLowerCase(),o=!0}}function y(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return U(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return O(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){let i,s=1,f=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,f/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<f;i++)if(c(t,i)===c(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===u)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+u>f&&(r=f-u),i=r;i>=0;i--){let r=!0;for(let n=0;n<u;n++)if(c(t,i+n)!==c(e,n)){r=!1;break}if(r)return i}return-1}function E(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(X(n))return s;t[r+s]=n}return s}function v(t,e,r,n){return Y(V(e,t.length-r),t,r,n)}function B(t,e,r,n){return Y(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function x(t,e,r,n){return Y(z(e),t,r,n)}function A(t,e,r,n){return Y(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function O(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,f,u;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(i=u));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=t[o+1],n=t[o+2],f=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&f)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&f,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}u.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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?f(t):void 0!==e?"string"==typeof r?f(t).fill(e,r):f(t).fill(e):f(t)}(t,e,r)},u.allocUnsafe=function(t){return a(t)},u.allocUnsafeSlow=function(t){return a(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(G(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),G(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},u.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}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if(G(e,Uint8Array))o+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.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)w(this,e,e+1);return this},u.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)w(this,e,e+3),w(this,e+1,e+2);return this},u.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)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?R(this,0,t):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.IS;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(u.prototype[i]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,o){if(G(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.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===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0);const f=Math.min(i,s),c=this.slice(n,o),h=t.slice(e,r);for(let t=0;t<f;++t)if(c[t]!==h[t]){i=c[t],s=h[t];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return b(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return b(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return E(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return B(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function U(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function S(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=W[t[n]];return o}function T(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function _(t,e,r,n,o){$(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function C(t,e,r,n,o){$(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function F(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,i){return e=+e,r>>>=0,i||F(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function H(t,e,r,n,i){return e=+e,r>>>=0,i||F(t,0,r,8),o.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J(function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))}),u.prototype.readBigUInt64BE=J(function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)}),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J(function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),u.prototype.readBigInt64BE=J(function(t){K(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)}),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(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},u.prototype.writeBigUInt64LE=J(function(t,e=0){return _(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=J(function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i|0)-s&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i|0)-s&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(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},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(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},u.prototype.writeBigInt64LE=J(function(t,e=0){return _(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=J(function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return H(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return H(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const i=u.isBuffer(t)?t:u.from(t,n),s=i.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=i[o%s]}return this};const M={};function P(t,e,r){M[t]=class extends r{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="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function $(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new M.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){K(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1))}(n,o,i)}function K(t,e){if("number"!=typeof t)throw new M.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,r){if(Math.floor(t)!==t)throw K(t,r),new M.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}P("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),P("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),P("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=j(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=j(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);const Z=/[^+/0-9A-Za-z-_]/g;function V(t,e){let r;e=e||1/0;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function z(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function G(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}const W=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},251(t,e){
9
9
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
10
- e.read=function(t,e,r,n,o){var i,s,f=8*o-n-1,u=(1<<f)-1,c=u>>1,h=-7,a=r?o-1:0,l=r?-1:1,d=t[e+a];for(a+=l,i=d&(1<<-h)-1,d>>=-h,h+=f;h>0;i=256*i+t[e+a],a+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+a],a+=l,h-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=c}return(d?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,f,u,c=8*i-o-1,h=(1<<c)-1,a=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+a>=1?l/u:l*Math.pow(2,1-a))*u>=2&&(s++,u/=2),s+a>=h?(f=0,s=h):s+a>=1?(f=(e*u-1)*Math.pow(2,o),s+=a):(f=e*Math.pow(2,a-1)*Math.pow(2,o),s=0));o>=8;t[r+d]=255&f,d+=p,f/=256,o-=8);for(s=s<<o|f,c+=o;c>0;t[r+d]=255&s,d+=p,s/=256,c-=8);t[r+d-p]|=128*g}},722(t){"use strict";t.exports=bsv},110(t,e,r){"use strict";function n(t,e,r=""){const n=(o=t)instanceof Uint8Array||ArrayBuffer.isView(o)&&"Uint8Array"===o.constructor.name&&"BYTES_PER_ELEMENT"in o&&1===o.BYTES_PER_ELEMENT;
10
+ e.read=function(t,e,r,n,o){var i,s,f=8*o-n-1,u=(1<<f)-1,c=u>>1,h=-7,a=r?o-1:0,l=r?-1:1,d=t[e+a];for(a+=l,i=d&(1<<-h)-1,d>>=-h,h+=f;h>0;i=256*i+t[e+a],a+=l,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[e+a],a+=l,h-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),i-=c}return(d?-1:1)*s*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var s,f,u,c=8*i-o-1,h=(1<<c)-1,a=h>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+a>=1?l/u:l*Math.pow(2,1-a))*u>=2&&(s++,u/=2),s+a>=h?(f=0,s=h):s+a>=1?(f=(e*u-1)*Math.pow(2,o),s+=a):(f=e*Math.pow(2,a-1)*Math.pow(2,o),s=0));o>=8;t[r+d]=255&f,d+=p,f/=256,o-=8);for(s=s<<o|f,c+=o;c>0;t[r+d]=255&s,d+=p,s/=256,c-=8);t[r+d-p]|=128*g}},722(t){"use strict";t.exports=bsv},405(t,e,r){"use strict";function n(t,e,r=""){const n=(o=t)instanceof Uint8Array||ArrayBuffer.isView(o)&&"Uint8Array"===o.constructor.name&&"BYTES_PER_ELEMENT"in o&&1===o.BYTES_PER_ELEMENT;
11
11
  /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
12
- var o;const i=t?.length,s=void 0!==e;if(!n||s&&i!==e){const o=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(n?`length=${i}`:"type="+typeof t);if(!n)throw new TypeError(o);throw new RangeError(o)}return t}function o(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function i(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}r.d(e,{cbc:()=>D});const s=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])(),f=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,u=s?t=>t:t=>{for(let e=0;e<t.length;e++)t[e]=f(t[e]);return t};function c(t,e){return!(!t.byteLength||!e.byteLength)&&(t.buffer===e.buffer&&t.byteOffset<e.byteOffset+e.byteLength&&e.byteOffset<t.byteOffset+t.byteLength)}function h(t,e){if(c(t,e)&&t.byteOffset<e.byteOffset)throw new Error("complex overlap of input and output is not supported")}const a=(t,e)=>{function r(r,...o){if(n(r,void 0,"key"),void 0!==t.nonceLength){n(o[0],t.varSizeNonce?void 0:t.nonceLength,"nonce")}const i=t.tagLength;i&&void 0!==o[1]&&n(o[1],void 0,"AAD");const s=e(r,...o),f=(t,e)=>{if(void 0!==e){if(2!==t)throw new Error("cipher output not supported");n(e,void 0,"output")}};let u=!1;return{encrypt(t,e){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,n(t),f(s.encrypt.length,e),s.encrypt(t,e)},decrypt(t,e){if(n(t),i&&t.length<i)throw new Error('"ciphertext" expected length bigger than tagLength='+i);return f(s.decrypt.length,e),s.decrypt(t,e)}}}return Object.assign(r,t),r};function l(t,e,r=!0){if(void 0===e)return new Uint8Array(t);if(n(e,void 0,"output"),e.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(r&&!d(e))throw new Error("invalid output, must be aligned");return e}function d(t){return t.byteOffset%4==0}function p(t){return Uint8Array.from(n(t))}const g=16;function y(t){if(![16,24,32].includes(t.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+t.length)}function w(t){return t<<1^283&-(t>>7)}function b(t,e){let r=0;for(;e>0;e>>=1)r^=t&-(1&e),t=w(t);return r}const m=(()=>{const t=new Uint8Array(256);for(let e=0,r=1;e<256;e++,r^=w(r))t[e]=r;const e=new Uint8Array(256);e[0]=99;for(let r=0;r<255;r++){let n=t[255-r];n|=n<<8,e[t[r]]=255&(n^n>>4^n>>5^n>>6^n>>7^99)}return i(t),e})(),E=m.map((t,e)=>m.indexOf(e)),v=t=>t<<24|t>>>8,B=t=>t<<8|t>>>24;function x(t,e){if(256!==t.length)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((r,n)=>e(t[n])),n=r.map(B),o=n.map(B),i=o.map(B),s=new Uint32Array(65536),f=new Uint32Array(65536),u=new Uint16Array(65536);for(let e=0;e<256;e++)for(let c=0;c<256;c++){const h=256*e+c;s[h]=r[e]^n[c],f[h]=o[e]^i[c],u[h]=t[e]<<8|t[c]}return{sbox:t,sbox2:u,T0:r,T1:n,T2:o,T3:i,T01:s,T23:f}}const A=x(m,t=>b(t,3)<<24|t<<16|t<<8|b(t,2)),O=x(E,t=>b(t,11)<<24|b(t,13)<<16|b(t,9)<<8|b(t,14)),R=(()=>{const t=new Uint8Array(16);for(let e=0,r=1;e<16;e++,r=w(r))t[e]=r;return t})();function I(t){n(t);const e=t.length;y(t);const{sbox2:r}=A,f=[];s&&d(t)||f.push(t=p(t));const c=u(o(t)),h=c.length,a=t=>S(r,t,t,t,t),l=new Uint32Array(e+28);l.set(c);for(let t=h;t<l.length;t++){let e=l[t-1];t%h===0?e=a(v(e))^R[t/h-1]:h>6&&t%h===4&&(e=a(e)),l[t]=l[t-h]^e}return i(...f),l}function U(t){const e=I(t),r=e.slice(),n=e.length,{sbox2:o}=A,{T0:s,T1:f,T2:u,T3:c}=O;for(let t=0;t<n;t+=4)for(let o=0;o<4;o++)r[t+o]=e[n-t-4+o];i(e);for(let t=4;t<n-4;t++){const e=r[t],n=S(o,e,e,e,e);r[t]=s[255&n]^f[n>>>8&255]^u[n>>>16&255]^c[n>>>24]}return r}function k(t,e,r,n,o,i){return t[r<<8&65280|n>>>8&255]^e[o>>>8&65280|i>>>24&255]}function S(t,e,r,n,o){return t[255&e|65280&r]|t[n>>>16&255|o>>>16&65280]<<16}function T(t,e,r,n,o){const{sbox2:i,T01:s,T23:f}=A;let u=0;e^=t[u++],r^=t[u++],n^=t[u++],o^=t[u++];const c=t.length/4-2;for(let i=0;i<c;i++){const i=t[u++]^k(s,f,e,r,n,o),c=t[u++]^k(s,f,r,n,o,e),h=t[u++]^k(s,f,n,o,e,r),a=t[u++]^k(s,f,o,e,r,n);e=i,r=c,n=h,o=a}return{s0:t[u++]^S(i,e,r,n,o),s1:t[u++]^S(i,r,n,o,e),s2:t[u++]^S(i,n,o,e,r),s3:t[u++]^S(i,o,e,r,n)}}function L(t,e,r,n,o){const{sbox2:i,T01:s,T23:f}=O;let u=0;e^=t[u++],r^=t[u++],n^=t[u++],o^=t[u++];const c=t.length/4-2;for(let i=0;i<c;i++){const i=t[u++]^k(s,f,e,o,n,r),c=t[u++]^k(s,f,r,e,o,n),h=t[u++]^k(s,f,n,r,e,o),a=t[u++]^k(s,f,o,n,r,e);e=i,r=c,n=h,o=a}return{s0:t[u++]^S(i,e,o,n,r),s1:t[u++]^S(i,r,e,o,n),s2:t[u++]^S(i,n,r,e,o),s3:t[u++]^S(i,o,n,r,e)}}function N(t){if(n(t),t.length%g!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size 16")}function _(t,e,r){n(t);let i=t.length;const f=i%g;if(!e&&0!==f)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");if(e){let t=g-f;t||(t=g),i+=t}h(t,r=l(i,r)),s&&d(t)||(t=p(t));const c=o(t);u(c);return{b:c,o:o(r),out:r}}function C(t,e){if(!e)return t;const r=t.length;if(0===r)throw new Error("aes/pkcs7: empty ciphertext not allowed");const n=t[r-1];let o=1;o&=n-1>>>31^1,o&=16-n>>>31^1;for(let e=0;e<16;e++){const i=e-n>>>31;o&=(0===(t[r-1-e]^n)?1:0)|1^i}if(!o)throw new Error("aes/pkcs7: wrong padding");return t.subarray(0,r-n)}function F(t){const e=new Uint8Array(16),r=o(e);e.set(t);const n=g-t.length;for(let t=g-n;t<g;t++)e[t]=n;return r}const D=a({blockSize:16,nonceLength:16},function(t,e,r={}){const n=!r.disablePadding;return{encrypt(r,f){const c=I(t),{b:h,o:a,out:l}=_(r,n,f);let g=e;const y=[c];s&&d(g)||y.push(g=p(g));const w=o(g);u(w);let b=w[0],m=w[1],E=w[2],v=w[3],B=0;for(;B+4<=h.length;)b^=h[B+0],m^=h[B+1],E^=h[B+2],v^=h[B+3],({s0:b,s1:m,s2:E,s3:v}=T(c,b,m,E,v)),a[B++]=b,a[B++]=m,a[B++]=E,a[B++]=v;if(n){const t=F(r.subarray(4*B));u(t),b^=t[0],m^=t[1],E^=t[2],v^=t[3],({s0:b,s1:m,s2:E,s3:v}=T(c,b,m,E,v)),a[B++]=b,a[B++]=m,a[B++]=E,a[B++]=v}return u(a),i(...y),l},decrypt(r,f){N(r);const c=U(t);let a=e;const g=[c];s&&d(a)||g.push(a=p(a));const y=o(a);u(y),h(r,f=l(r.length,f)),s&&d(r)||g.push(r=p(r));const w=o(r),b=o(f);u(w);let m=y[0],E=y[1],v=y[2],B=y[3];for(let t=0;t+4<=w.length;){const e=m,r=E,n=v,o=B;m=w[t+0],E=w[t+1],v=w[t+2],B=w[t+3];const{s0:i,s1:s,s2:f,s3:u}=L(c,m,E,v,B);b[t++]=i^e,b[t++]=s^r,b[t++]=f^n,b[t++]=u^o}return u(b),i(...g),C(f,n)}}})},112(t,e,r){"use strict";r.d(e,{secp256k1:()=>Ct});var n=r(544),o=r(508);
12
+ var o;const i=t?.length,s=void 0!==e;if(!n||s&&i!==e){const o=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(n?`length=${i}`:"type="+typeof t);if(!n)throw new TypeError(o);throw new RangeError(o)}return t}function o(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function i(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}r.d(e,{cbc:()=>D});const s=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])(),f=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,u=s?t=>t:t=>{for(let e=0;e<t.length;e++)t[e]=f(t[e]);return t};function c(t,e){return!(!t.byteLength||!e.byteLength)&&(t.buffer===e.buffer&&t.byteOffset<e.byteOffset+e.byteLength&&e.byteOffset<t.byteOffset+t.byteLength)}function h(t,e){if(c(t,e)&&t.byteOffset<e.byteOffset)throw new Error("complex overlap of input and output is not supported")}const a=(t,e)=>{function r(r,...o){if(n(r,void 0,"key"),void 0!==t.nonceLength){n(o[0],t.varSizeNonce?void 0:t.nonceLength,"nonce")}const i=t.tagLength;i&&void 0!==o[1]&&n(o[1],void 0,"AAD");const s=e(r,...o),f=(t,e)=>{if(void 0!==e){if(2!==t)throw new Error("cipher output not supported");n(e,void 0,"output")}};let u=!1;return{encrypt(t,e){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,n(t),f(s.encrypt.length,e),s.encrypt(t,e)},decrypt(t,e){if(n(t),i&&t.length<i)throw new Error('"ciphertext" expected length bigger than tagLength='+i);return f(s.decrypt.length,e),s.decrypt(t,e)}}}return Object.assign(r,t),r};function l(t,e,r=!0){if(void 0===e)return new Uint8Array(t);if(n(e,void 0,"output"),e.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(r&&!d(e))throw new Error("invalid output, must be aligned");return e}function d(t){return t.byteOffset%4==0}function p(t){return Uint8Array.from(n(t))}const g=16;function y(t){if(![16,24,32].includes(t.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+t.length)}function w(t){return t<<1^283&-(t>>7)}function b(t,e){let r=0;for(;e>0;e>>=1)r^=t&-(1&e),t=w(t);return r}const m=(()=>{const t=new Uint8Array(256);for(let e=0,r=1;e<256;e++,r^=w(r))t[e]=r;const e=new Uint8Array(256);e[0]=99;for(let r=0;r<255;r++){let n=t[255-r];n|=n<<8,e[t[r]]=255&(n^n>>4^n>>5^n>>6^n>>7^99)}return i(t),e})(),E=m.map((t,e)=>m.indexOf(e)),v=t=>t<<24|t>>>8,B=t=>t<<8|t>>>24;function x(t,e){if(256!==t.length)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((r,n)=>e(t[n])),n=r.map(B),o=n.map(B),i=o.map(B),s=new Uint32Array(65536),f=new Uint32Array(65536),u=new Uint16Array(65536);for(let e=0;e<256;e++)for(let c=0;c<256;c++){const h=256*e+c;s[h]=r[e]^n[c],f[h]=o[e]^i[c],u[h]=t[e]<<8|t[c]}return{sbox:t,sbox2:u,T0:r,T1:n,T2:o,T3:i,T01:s,T23:f}}const A=x(m,t=>b(t,3)<<24|t<<16|t<<8|b(t,2)),O=x(E,t=>b(t,11)<<24|b(t,13)<<16|b(t,9)<<8|b(t,14)),R=(()=>{const t=new Uint8Array(16);for(let e=0,r=1;e<16;e++,r=w(r))t[e]=r;return t})();function I(t){n(t);const e=t.length;y(t);const{sbox2:r}=A,f=[];s&&d(t)||f.push(t=p(t));const c=u(o(t)),h=c.length,a=t=>S(r,t,t,t,t),l=new Uint32Array(e+28);l.set(c);for(let t=h;t<l.length;t++){let e=l[t-1];t%h===0?e=a(v(e))^R[t/h-1]:h>6&&t%h===4&&(e=a(e)),l[t]=l[t-h]^e}return i(...f),l}function U(t){const e=I(t),r=e.slice(),n=e.length,{sbox2:o}=A,{T0:s,T1:f,T2:u,T3:c}=O;for(let t=0;t<n;t+=4)for(let o=0;o<4;o++)r[t+o]=e[n-t-4+o];i(e);for(let t=4;t<n-4;t++){const e=r[t],n=S(o,e,e,e,e);r[t]=s[255&n]^f[n>>>8&255]^u[n>>>16&255]^c[n>>>24]}return r}function k(t,e,r,n,o,i){return t[r<<8&65280|n>>>8&255]^e[o>>>8&65280|i>>>24&255]}function S(t,e,r,n,o){return t[255&e|65280&r]|t[n>>>16&255|o>>>16&65280]<<16}function T(t,e,r,n,o){const{sbox2:i,T01:s,T23:f}=A;let u=0;e^=t[u++],r^=t[u++],n^=t[u++],o^=t[u++];const c=t.length/4-2;for(let i=0;i<c;i++){const i=t[u++]^k(s,f,e,r,n,o),c=t[u++]^k(s,f,r,n,o,e),h=t[u++]^k(s,f,n,o,e,r),a=t[u++]^k(s,f,o,e,r,n);e=i,r=c,n=h,o=a}return{s0:t[u++]^S(i,e,r,n,o),s1:t[u++]^S(i,r,n,o,e),s2:t[u++]^S(i,n,o,e,r),s3:t[u++]^S(i,o,e,r,n)}}function L(t,e,r,n,o){const{sbox2:i,T01:s,T23:f}=O;let u=0;e^=t[u++],r^=t[u++],n^=t[u++],o^=t[u++];const c=t.length/4-2;for(let i=0;i<c;i++){const i=t[u++]^k(s,f,e,o,n,r),c=t[u++]^k(s,f,r,e,o,n),h=t[u++]^k(s,f,n,r,e,o),a=t[u++]^k(s,f,o,n,r,e);e=i,r=c,n=h,o=a}return{s0:t[u++]^S(i,e,o,n,r),s1:t[u++]^S(i,r,e,o,n),s2:t[u++]^S(i,n,r,e,o),s3:t[u++]^S(i,o,n,r,e)}}function N(t){if(n(t),t.length%g!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size 16")}function _(t,e,r){n(t);let i=t.length;const f=i%g;if(!e&&0!==f)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");if(e){let t=g-f;t||(t=g),i+=t}h(t,r=l(i,r)),s&&d(t)||(t=p(t));const c=o(t);u(c);return{b:c,o:o(r),out:r}}function C(t,e){if(!e)return t;const r=t.length;if(0===r)throw new Error("aes/pkcs7: empty ciphertext not allowed");const n=t[r-1];let o=1;o&=n-1>>>31^1,o&=16-n>>>31^1;for(let e=0;e<16;e++){const i=e-n>>>31;o&=(0===(t[r-1-e]^n)?1:0)|1^i}if(!o)throw new Error("aes/pkcs7: wrong padding");return t.subarray(0,r-n)}function F(t){const e=new Uint8Array(16),r=o(e);e.set(t);const n=g-t.length;for(let t=g-n;t<g;t++)e[t]=n;return r}const D=a({blockSize:16,nonceLength:16},function(t,e,r={}){const n=!r.disablePadding;return{encrypt(r,f){const c=I(t),{b:h,o:a,out:l}=_(r,n,f);let g=e;const y=[c];s&&d(g)||y.push(g=p(g));const w=o(g);u(w);let b=w[0],m=w[1],E=w[2],v=w[3],B=0;for(;B+4<=h.length;)b^=h[B+0],m^=h[B+1],E^=h[B+2],v^=h[B+3],({s0:b,s1:m,s2:E,s3:v}=T(c,b,m,E,v)),a[B++]=b,a[B++]=m,a[B++]=E,a[B++]=v;if(n){const t=F(r.subarray(4*B));u(t),b^=t[0],m^=t[1],E^=t[2],v^=t[3],({s0:b,s1:m,s2:E,s3:v}=T(c,b,m,E,v)),a[B++]=b,a[B++]=m,a[B++]=E,a[B++]=v}return u(a),i(...y),l},decrypt(r,f){N(r);const c=U(t);let a=e;const g=[c];s&&d(a)||g.push(a=p(a));const y=o(a);u(y),h(r,f=l(r.length,f)),s&&d(r)||g.push(r=p(r));const w=o(r),b=o(f);u(w);let m=y[0],E=y[1],v=y[2],B=y[3];for(let t=0;t+4<=w.length;){const e=m,r=E,n=v,o=B;m=w[t+0],E=w[t+1],v=w[t+2],B=w[t+3];const{s0:i,s1:s,s2:f,s3:u}=L(c,m,E,v,B);b[t++]=i^e,b[t++]=s^r,b[t++]=f^n,b[t++]=u^o}return u(b),i(...g),C(f,n)}}})},554(t,e,r){"use strict";r.d(e,{secp256k1:()=>Ct});var n=r(87),o=r(508);
13
13
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
14
14
  const i=(t,e,r)=>(0,o.DO)(t,e,r),s=o.Fe,f=o.My,u=(...t)=>(0,o.Id)(...t),c=t=>(0,o.aT)(t),h=o.aY,a=t=>(0,o.po)(t),l=BigInt(0),d=BigInt(1);function p(t,e=""){if("boolean"!=typeof t){throw new TypeError((e&&`"${e}" `)+"expected boolean, got type="+typeof t)}return t}function g(t){if("bigint"==typeof t){if(!x(t))throw new RangeError("positive bigint expected, got "+t)}else s(t);return t}function y(t,e=""){if("number"!=typeof t){throw new TypeError((e&&`"${e}" `)+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){throw new RangeError((e&&`"${e}" `)+"expected safe integer, got "+t)}}function w(t){const e=g(t).toString(16);return 1&e.length?"0"+e:e}function b(t){if("string"!=typeof t)throw new TypeError("hex string expected, got "+typeof t);return""===t?l:BigInt("0x"+t)}function m(t){return b((0,o.My)(t))}function E(t){return b((0,o.My)(function(t){return Uint8Array.from(i(t))}((0,o.DO)(t)).reverse()))}function v(t,e){if((0,o.Fe)(e),0===e)throw new RangeError("zero length");const r=(t=g(t)).toString(16);if(r.length>2*e)throw new RangeError("number too large");return(0,o.aT)(r.padStart(2*e,"0"))}function B(t,e){return v(t,e).reverse()}const x=t=>"bigint"==typeof t&&l<=t;function A(t,e,r,n){if(!function(t,e,r){return x(t)&&x(e)&&x(r)&&e<=t&&t<r}(e,r,n))throw new RangeError("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function O(t){if(t<l)throw new Error("expected non-negative bigint, got "+t);let e;for(e=0;t>l;t>>=d,e+=1);return e}const R=t=>(d<<BigInt(t))-d;function I(t,e={},r={}){if("[object Object]"!==Object.prototype.toString.call(t))throw new TypeError("expected valid options object");const n=(e,r)=>Object.entries(e).forEach(([e,n])=>function(e,r,n){if(!n&&"function"!==r&&!Object.hasOwn(t,e))throw new TypeError(`param "${e}" is invalid: expected own property`);const o=t[e];if(n&&void 0===o)return;const i=typeof o;if(i!==r||null===o)throw new TypeError(`param "${e}" is invalid: expected ${r}, got ${i}`)}(e,n,r));n(e,!1),n(r,!0)}const U=BigInt(0),k=BigInt(1),S=BigInt(2),T=BigInt(3),L=BigInt(4),N=BigInt(5),_=BigInt(7),C=BigInt(8),F=BigInt(9),D=BigInt(16);function H(t,e){if(e<=U)throw new Error("mod: expected positive modulus, got "+e);const r=t%e;return r>=U?r:e+r}function M(t,e,r){if(e<U)throw new Error("pow2: expected non-negative exponent, got "+e);let n=t;for(;e-- >U;)n*=n,n%=r;return n}function P(t,e){if(t===U)throw new Error("invert: expected non-zero number");if(e<=U)throw new Error("invert: expected positive modulus, got "+e);let r=H(t,e),n=e,o=U,i=k,s=k,f=U;for(;r!==U;){const t=n/r,e=n-r*t,u=o-s*t,c=i-f*t;n=r,r=e,o=s,i=f,s=u,f=c}if(n!==k)throw new Error("invert: does not exist");return H(o,e)}function j(t,e,r){const n=t;if(!n.eql(n.sqr(e),r))throw new Error("Cannot find square root")}function $(t,e){const r=t,n=(r.ORDER+k)/L,o=r.pow(e,n);return j(r,o,e),o}function K(t,e){const r=t,n=(r.ORDER-N)/C,o=r.mul(e,S),i=r.pow(o,n),s=r.mul(e,i),f=r.mul(r.mul(s,S),i),u=r.mul(s,r.sub(f,r.ONE));return j(r,u,e),u}function q(t){if(t<T)throw new Error("sqrt is not defined for small field");let e=t-k,r=0;for(;e%S===U;)e/=S,r++;let n=S;const o=J(t);for(;1===G(o,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return $;let i=o.pow(n,e);const s=(e+k)/S;return function(t,n){const o=t;if(o.is0(n))return n;if(1!==G(o,n))throw new Error("Cannot find square root");let f=r,u=o.mul(o.ONE,i),c=o.pow(n,e),h=o.pow(n,s);for(;!o.eql(c,o.ONE);){if(o.is0(c))return o.ZERO;let t=1,e=o.sqr(c);for(;!o.eql(e,o.ONE);)if(t++,e=o.sqr(e),t===f)throw new Error("Cannot find square root");const r=k<<BigInt(f-t-1),n=o.pow(u,r);f=t,u=o.sqr(n),c=o.mul(c,u),h=o.mul(h,n)}return h}}function Z(t){return t%L===T?$:t%C===N?K:t%D===F?function(t){const e=J(t),r=q(t),n=r(e,e.neg(e.ONE)),o=r(e,n),i=r(e,e.neg(n)),s=(t+_)/D;return(t,e)=>{const r=t;let f=r.pow(e,s),u=r.mul(f,n);const c=r.mul(f,o),h=r.mul(f,i),a=r.eql(r.sqr(u),e),l=r.eql(r.sqr(c),e);f=r.cmov(f,u,a),u=r.cmov(h,c,l);const d=r.eql(r.sqr(u),e),p=r.cmov(f,u,d);return j(r,p,e),p}}(t):q(t)}const V=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function z(t,e,r){const n=t;if(r<U)throw new Error("invalid exponent, negatives unsupported");if(r===U)return n.ONE;if(r===k)return e;let o=n.ONE,i=e;for(;r>U;)r&k&&(o=n.mul(o,i)),i=n.sqr(i),r>>=k;return o}function Y(t,e,r=!1){const n=t,o=new Array(e.length).fill(r?n.ZERO:void 0),i=e.reduce((t,e,r)=>n.is0(e)?t:(o[r]=t,n.mul(t,e)),n.ONE),s=n.inv(i);return e.reduceRight((t,e,r)=>n.is0(e)?t:(o[r]=n.mul(t,o[r]),n.mul(t,e)),s),o}function G(t,e){const r=t,n=(r.ORDER-k)/S,o=r.pow(e,n),i=r.eql(o,r.ONE),s=r.eql(o,r.ZERO),f=r.eql(o,r.neg(r.ONE));if(!i&&!s&&!f)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}const X=new WeakMap;class W{ORDER;BITS;BYTES;isLE;ZERO=U;ONE=k;_lengths;_mod;constructor(t,e={}){if(t<=k)throw new Error("invalid field: expected ORDER > 1, got "+t);let r;this.isLE=!1,null!=e&&"object"==typeof e&&("number"==typeof e.BITS&&(r=e.BITS),"function"==typeof e.sqrt&&Object.defineProperty(this,"sqrt",{value:e.sqrt,enumerable:!0}),"boolean"==typeof e.isLE&&(this.isLE=e.isLE),e.allowedLengths&&(this._lengths=Object.freeze(e.allowedLengths.slice())),"boolean"==typeof e.modFromBytes&&(this._mod=e.modFromBytes));const{nBitLength:n,nByteLength:o}=function(t,e){if(void 0!==e&&s(e),t<=U)throw new Error("invalid n length: expected positive n, got "+t);if(void 0!==e&&e<1)throw new Error("invalid n length: expected positive bit length, got "+e);const r=O(t);if(void 0!==e&&e<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${e})`);const n=void 0!==e?e:r;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}(t,r);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=o,Object.freeze(this)}create(t){return H(t,this.ORDER)}isValid(t){if("bigint"!=typeof t)throw new TypeError("invalid field element: expected bigint, got "+typeof t);return U<=t&&t<this.ORDER}is0(t){return t===U}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&k)===k}neg(t){return H(-t,this.ORDER)}eql(t,e){return t===e}sqr(t){return H(t*t,this.ORDER)}add(t,e){return H(t+e,this.ORDER)}sub(t,e){return H(t-e,this.ORDER)}mul(t,e){return H(t*e,this.ORDER)}pow(t,e){return z(this,t,e)}div(t,e){return H(t*P(e,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,e){return t+e}subN(t,e){return t-e}mulN(t,e){return t*e}inv(t){return P(t,this.ORDER)}sqrt(t){let e=X.get(this);return e||X.set(this,e=Z(this.ORDER)),e(this,t)}toBytes(t){return this.isLE?B(t,this.BYTES):v(t,this.BYTES)}fromBytes(t,e=!1){i(t);const{_lengths:r,BYTES:n,isLE:o,ORDER:s,_mod:f}=this;if(r){if(t.length<1||!r.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+r+" bytes, got "+t.length);const e=new Uint8Array(n);e.set(t,o?0:e.length-t.length),t=e}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let u=o?E(t):m(t);if(f&&(u=H(u,s)),!e&&!this.isValid(u))throw new Error("invalid field element: outside of range 0..ORDER");return u}invertBatch(t){return Y(this,t)}cmov(t,e,r){return p(r,"condition"),r?e:t}}function J(t,e={}){return new W(t,e)}function Q(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");if(t<=k)throw new Error("field order must be greater than 1");const e=O(t-k);return Math.ceil(e/8)}function tt(t){const e=Q(t);return e+Math.ceil(e/2)}Object.freeze(W.prototype);var et=r(474);
15
15
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -17,4 +17,4 @@ const rt=BigInt(0),nt=BigInt(1);function ot(t,e){const r=e.negate();return t?r:e
17
17
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
18
18
  const gt=(t,e)=>(t+(t>=0?e:-e)/Bt)/e;function yt(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function wt(t,e){I(t);const r={};for(let n of Object.keys(e))r[n]=void 0===t[n]?e[n]:t[n];return p(r.lowS,"lowS"),p(r.prehash,"prehash"),void 0!==r.format&&yt(r.format),r}class bt extends Error{constructor(t=""){super(t)}}const mt={Err:bt,_tlv:{encode:(t,e)=>{const{Err:r}=mt;if(y(t,"tag"),t<0||t>255)throw new r("tlv.encode: wrong tag");if("string"!=typeof e)throw new TypeError('"data" expected string, got type='+typeof e);if(1&e.length)throw new r("tlv.encode: unpadded data");const n=e.length/2,o=w(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?w(o.length/2|128):"";return w(t)+i+o+e},decode(t,e){const{Err:r}=mt;e=i(e,void 0,"DER data");let n=0;if(t<0||t>255)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const o=e[n++];let s=0;if(!!(128&o)){const t=127&o;if(!t)throw new r("tlv.decode(long): indefinite length not supported");if(t>4)throw new r("tlv.decode(long): byte length is too big");const i=e.subarray(n,n+t);if(i.length!==t)throw new r("tlv.decode: length bytes not complete");if(0===i[0])throw new r("tlv.decode(long): zero leftmost byte");for(const t of i)s=s<<8|t;if(n+=t,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=o;const f=e.subarray(n,n+s);if(f.length!==s)throw new r("tlv.decode: wrong value length");return{v:f,l:e.subarray(n+s)}}},_int:{encode(t){const{Err:e}=mt;if(g(t),t<Et)throw new e("integer: negative integers are not allowed");let r=w(t);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=mt;if(t.length<1)throw new e("invalid signature integer: empty");if(128&t[0])throw new e("invalid signature integer: negative");if(t.length>1&&0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return m(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=mt,o=i(t,void 0,"signature"),{v:s,l:f}=n.decode(48,o);if(f.length)throw new e("invalid signature: left bytes after parsing");const{v:u,l:c}=n.decode(2,s),{v:h,l:a}=n.decode(2,c);if(a.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(u),s:r.decode(h)}},hexFromSig(t){const{_tlv:e,_int:r}=mt,n=e.encode(2,r.encode(t.r))+e.encode(2,r.encode(t.s));return e.encode(48,n)}};Object.freeze(mt._tlv),Object.freeze(mt._int),Object.freeze(mt);const Et=BigInt(0),vt=BigInt(1),Bt=BigInt(2),xt=BigInt(3),At=BigInt(4);function Ot(t,e={}){const r=function(t,e,r={},n){if(void 0===n&&(n="edwards"===t),!e||"object"!=typeof e)throw new Error(`expected valid ${t} CURVE object`);for(const t of["p","n","h"]){const r=e[t];if(!("bigint"==typeof r&&r>rt))throw new Error(`CURVE.${t} must be positive bigint`)}const o=pt(e.p,r.Fp,n),i=pt(e.n,r.Fn,n),s=["Gx","Gy","a","weierstrass"===t?"b":"d"];for(const t of s)if(!o.isValid(e[t]))throw new Error(`CURVE.${t} must be valid field element of CURVE.Fp`);return{CURVE:e=Object.freeze(Object.assign({},e)),Fp:o,Fn:i}}("weierstrass",t,e),n=r.Fp,o=r.Fn;let s=r.CURVE;const{h,n:a}=s;I(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:d}=e;if(l&&(!n.is0(s.a)||"bigint"!=typeof l.beta||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const g=It(n,o);function y(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const w=void 0===e.toBytes?function(t,e,r){if(d&&e.is0())return Uint8Array.of(0);const{x:o,y:i}=e.toAffine(),s=n.toBytes(o);if(p(r,"isCompressed"),r){y();const t=!n.isOdd(i);return u(Rt(t),s)}return u(Uint8Array.of(4),s,n.toBytes(i))}:e.toBytes,b=void 0===e.fromBytes?function(t){i(t,void 0,"Point");const{publicKey:e,publicKeyUncompressed:r}=g,o=t.length,s=t[0],f=t.subarray(1);if(d&&1===o&&0===s)return{x:n.ZERO,y:n.ZERO};if(o!==e||2!==s&&3!==s){if(o===r&&4===s){const t=n.BYTES,e=n.fromBytes(f.subarray(0,t)),r=n.fromBytes(f.subarray(t,2*t));if(!E(e,r))throw new Error("bad point: is not on curve");return{x:e,y:r}}throw new Error(`bad point: got length ${o}, expected compressed=${e} or uncompressed=${r}`)}{const t=n.fromBytes(f);if(!n.isValid(t))throw new Error("bad point: is not on curve, wrong x");const e=m(t);let r;try{r=n.sqrt(e)}catch(t){const e=t instanceof Error?": "+t.message:"";throw new Error("bad point: is not on curve, sqrt error"+e)}y();return!(1&~s)!==n.isOdd(r)&&(r=n.neg(r)),{x:t,y:r}}}:e.fromBytes;function m(t){const e=n.sqr(t),r=n.mul(e,t);return n.add(n.add(r,n.mul(t,s.a)),s.b)}function E(t,e){const r=n.sqr(e),o=m(t);return n.eql(r,o)}if(!E(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const v=n.mul(n.pow(s.a,xt),At),B=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(v,B)))throw new Error("bad curve params: a or b");function x(t,e,r=!1){if(!n.isValid(e)||r&&n.is0(e))throw new Error(`bad point coordinate ${t}`);return e}function U(t){if(!(t instanceof T))throw new Error("Weierstrass Point expected")}function k(t){if(!l||!l.basises)throw new Error("no endo");return function(t,e,r){A("scalar",t,Et,r);const[[n,o],[i,s]]=e,f=gt(s*t,r),u=gt(-o*t,r);let c=t-f*n-u*i,h=-f*o-u*s;const a=c<Et,l=h<Et;a&&(c=-c),l&&(h=-h);const d=R(Math.ceil(O(r)/2))+vt;if(c<Et||c>=d||h<Et||h>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:a,k1:c,k2neg:l,k2:h}}(t,l.basises,o.ORDER)}function S(t,e,r,o,i){return r=new T(n.mul(r.X,t),r.Y,r.Z),e=ot(o,e),r=ot(i,r),e.add(r)}class T{static BASE=new T(s.Gx,s.Gy,n.ONE);static ZERO=new T(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=o;X;Y;Z;constructor(t,e,r){this.X=x("x",t),this.Y=x("y",e,!0),this.Z=x("z",r),Object.freeze(this)}static CURVE(){return s}static fromAffine(t){const{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw new Error("invalid affine point");if(t instanceof T)throw new Error("projective point not allowed");return n.is0(e)&&n.is0(r)?T.ZERO:new T(e,r,n.ONE)}static fromBytes(t){const e=T.fromAffine(b(i(t,void 0,"point")));return e.assertValidity(),e}static fromHex(t){return T.fromBytes(c(t))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(t=8,e=!0){return N.createCache(this,t),e||this.multiply(xt),this}assertValidity(){const t=this;if(t.is0()){if(e.allowInfinityPoint&&n.is0(t.X)&&n.eql(t.Y,n.ONE)&&n.is0(t.Z))return;throw new Error("bad point: ZERO")}const{x:r,y:o}=t.toAffine();if(!n.isValid(r)||!n.isValid(o))throw new Error("bad point: x or y not field elements");if(!E(r,o))throw new Error("bad point: equation left != right");if(!t.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:t}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(t)}equals(t){U(t);const{X:e,Y:r,Z:o}=this,{X:i,Y:s,Z:f}=t,u=n.eql(n.mul(e,f),n.mul(i,o)),c=n.eql(n.mul(r,f),n.mul(s,o));return u&&c}negate(){return new T(this.X,n.neg(this.Y),this.Z)}double(){const{a:t,b:e}=s,r=n.mul(e,xt),{X:o,Y:i,Z:f}=this;let u=n.ZERO,c=n.ZERO,h=n.ZERO,a=n.mul(o,o),l=n.mul(i,i),d=n.mul(f,f),p=n.mul(o,i);return p=n.add(p,p),h=n.mul(o,f),h=n.add(h,h),u=n.mul(t,h),c=n.mul(r,d),c=n.add(u,c),u=n.sub(l,c),c=n.add(l,c),c=n.mul(u,c),u=n.mul(p,u),h=n.mul(r,h),d=n.mul(t,d),p=n.sub(a,d),p=n.mul(t,p),p=n.add(p,h),h=n.add(a,a),a=n.add(h,a),a=n.add(a,d),a=n.mul(a,p),c=n.add(c,a),d=n.mul(i,f),d=n.add(d,d),a=n.mul(d,p),u=n.sub(u,a),h=n.mul(d,l),h=n.add(h,h),h=n.add(h,h),new T(u,c,h)}add(t){U(t);const{X:e,Y:r,Z:o}=this,{X:i,Y:f,Z:u}=t;let c=n.ZERO,h=n.ZERO,a=n.ZERO;const l=s.a,d=n.mul(s.b,xt);let p=n.mul(e,i),g=n.mul(r,f),y=n.mul(o,u),w=n.add(e,r),b=n.add(i,f);w=n.mul(w,b),b=n.add(p,g),w=n.sub(w,b),b=n.add(e,o);let m=n.add(i,u);return b=n.mul(b,m),m=n.add(p,y),b=n.sub(b,m),m=n.add(r,o),c=n.add(f,u),m=n.mul(m,c),c=n.add(g,y),m=n.sub(m,c),a=n.mul(l,b),c=n.mul(d,y),a=n.add(c,a),c=n.sub(g,a),a=n.add(g,a),h=n.mul(c,a),g=n.add(p,p),g=n.add(g,p),y=n.mul(l,y),b=n.mul(d,b),g=n.add(g,y),y=n.sub(p,y),y=n.mul(l,y),b=n.add(b,y),p=n.mul(g,b),h=n.add(h,p),p=n.mul(m,b),c=n.mul(w,c),c=n.sub(c,p),p=n.mul(w,g),a=n.mul(m,a),a=n.add(a,p),new T(c,h,a)}subtract(t){return U(t),this.add(t.negate())}is0(){return this.equals(T.ZERO)}multiply(t){const{endo:r}=e;if(!o.isValidNot0(t))throw new RangeError("invalid scalar: out of range");let n,i;const s=t=>N.cached(this,t,t=>it(T,t));if(r){const{k1neg:e,k1:o,k2neg:f,k2:u}=k(t),{p:c,f:h}=s(o),{p:a,f:l}=s(u);i=h.add(l),n=S(r.beta,c,a,e,f)}else{const{p:e,f:r}=s(t);n=e,i=r}return it(T,[n,i])[0]}multiplyUnsafe(t){const{endo:r}=e,n=this,i=t;if(!o.isValid(i))throw new RangeError("invalid scalar: out of range");if(i===Et||n.is0())return T.ZERO;if(i===vt)return n;if(N.hasCache(this))return this.multiply(i);if(r){const{k1neg:t,k1:e,k2neg:o,k2:s}=k(i),{p1:f,p2:u}=function(t,e,r,n){let o=e,i=t.ZERO,s=t.ZERO;for(;r>rt||n>rt;)r&nt&&(i=i.add(o)),n&nt&&(s=s.add(o)),o=o.double(),r>>=nt,n>>=nt;return{p1:i,p2:s}}(T,n,e,s);return S(r.beta,f,u,t,o)}return N.unsafe(n,i)}toAffine(t){let e=t;const{X:r,Y:o,Z:i}=this;if(n.eql(i,n.ONE))return{x:r,y:o};const s=this.is0();null==e&&(e=s?n.ONE:n.inv(i));const f=n.mul(r,e),u=n.mul(o,e),c=n.mul(i,e);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:f,y:u}}isTorsionFree(){const{isTorsionFree:t}=e;return h===vt||(t?t(T,this):N.unsafe(this,a).is0())}clearCofactor(){const{clearCofactor:t}=e;return h===vt?this:t?t(T,this):this.multiplyUnsafe(h)}isSmallOrder(){return h===vt?this.is0():this.clearCofactor().is0()}toBytes(t=!0){return p(t,"isCompressed"),this.assertValidity(),w(T,this,t)}toHex(t=!0){return f(this.toBytes(t))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const L=o.BITS,N=new dt(T,e.endo?Math.ceil(L/2):L);return L>=8&&T.BASE.precompute(8),Object.freeze(T.prototype),Object.freeze(T),T}function Rt(t){return Uint8Array.of(t?2:3)}function It(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function Ut(t,e={}){const{Fn:r}=t,n=void 0===e.randomBytes?a:e.randomBytes,o=Object.assign(It(t.Fp,r),{seed:Math.max(tt(r.ORDER),16)});function s(t){return t=void 0===t?n(o.seed):t,function(t,e,r=!1){i(t);const n=t.length,o=Q(e),s=Math.max(tt(e),16);if(n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const f=H(r?E(t):m(t),e-k)+k;return r?B(f,o):v(f,o)}(i(t,o.seed,"seed"),r.ORDER)}function f(e,n=!0){return t.BASE.multiply(r.fromBytes(e)).toBytes(n)}function u(t){const{secretKey:e,publicKey:n,publicKeyUncompressed:s}=o,f=r._lengths;if(!h(t))return;const u=i(t,void 0,"key").length,c=u===n||u===s,a=u===e||!!f?.includes(u);return c&&a?void 0:c}const c={isValidSecretKey:function(t){try{const e=r.fromBytes(t);return r.isValidNot0(e)}catch(t){return!1}},isValidPublicKey:function(e,r){const{publicKey:n,publicKeyUncompressed:i}=o;try{const o=e.length;return(!0!==r||o===n)&&((!1!==r||o===i)&&!!t.fromBytes(e))}catch(t){return!1}},randomSecretKey:s},l=function(t,e){return function(r){const n=t(r);return{secretKey:n,publicKey:e(n)}}}(s,f);return Object.freeze(c),Object.freeze(o),Object.freeze({getPublicKey:f,getSharedSecret:function(e,n,o=!0){if(!0===u(e))throw new Error("first arg must be private key");if(!1===u(n))throw new Error("second arg must be public key");const i=r.fromBytes(e);return t.fromBytes(n).multiply(i).toBytes(o)},keygen:l,Point:t,utils:c,lengths:o})}function kt(t,e,r={}){const n=e;(0,o.sd)(n),I(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const s=void 0===(r=Object.assign({},r)).randomBytes?a:r.randomBytes,l=void 0===r.hmac?(t,e)=>(0,et.hmac)(n,t,e):r.hmac,{Fp:d,Fn:p}=t,{ORDER:g,BITS:y}=p,{keygen:w,getPublicKey:b,getSharedSecret:E,utils:v,lengths:B}=Ut(t,r),x={prehash:!0,lowS:"boolean"!=typeof r.lowS||r.lowS,format:"compact",extraEntropy:!1},O=g*Bt+vt<d.ORDER;function U(t){return t>g>>vt}function k(t,e){if(!p.isValidNot0(e))throw new Error(`invalid signature ${t}: out of range 1..Point.Fn.ORDER`);return e}function S(){if(O)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function T(t,e){yt(e);const r=B.signature;return i(t,"compact"===e?r:"recovered"===e?r+1:void 0)}class L{r;s;recovery;constructor(t,e,r){if(this.r=k("r",t),this.s=k("s",e),null!=r){if(S(),![0,1,2,3].includes(r))throw new Error("invalid recovery id");this.recovery=r}Object.freeze(this)}static fromBytes(t,e=x.format){let r;if(T(t,e),"der"===e){const{r:e,s:r}=mt.toSig(i(t));return new L(e,r)}"recovered"===e&&(r=t[0],e="compact",t=t.subarray(1));const n=B.signature/2,o=t.subarray(0,n),s=t.subarray(n,2*n);return new L(p.fromBytes(o),p.fromBytes(s),r)}static fromHex(t,e){return this.fromBytes(c(t),e)}assertRecovery(){const{recovery:t}=this;if(null==t)throw new Error("invalid recovery id: must be present");return t}addRecoveryBit(t){return new L(this.r,this.s,t)}recoverPublicKey(e){const{r,s:n}=this,o=this.assertRecovery(),s=2===o||3===o?r+g:r;if(!d.isValid(s))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const f=d.toBytes(s),c=t.fromBytes(u(Rt(!(1&o)),f)),h=p.inv(s),a=_(i(e,void 0,"msgHash")),l=p.create(-a*h),y=p.create(n*h),w=t.BASE.multiplyUnsafe(l).add(c.multiplyUnsafe(y));if(w.is0())throw new Error("invalid recovery: point at infinify");return w.assertValidity(),w}hasHighS(){return U(this.s)}toBytes(t=x.format){if(yt(t),"der"===t)return c(mt.hexFromSig(this));const{r:e,s:r}=this,n=p.toBytes(e),o=p.toBytes(r);return"recovered"===t?(S(),u(Uint8Array.of(this.assertRecovery()),n,o)):u(n,o)}toHex(t){return f(this.toBytes(t))}}Object.freeze(L.prototype),Object.freeze(L);const N=void 0===r.bits2int?function(t){if(t.length>8192)throw new Error("input is too large");const e=m(t),r=8*t.length-y;return r>0?e>>BigInt(r):e}:r.bits2int,_=void 0===r.bits2int_modN?function(t){return p.create(N(t))}:r.bits2int_modN,C=R(y);function F(t){return A("num < 2^"+y,t,Et,C),p.toBytes(t)}function D(t,e){return i(t,void 0,"message"),e?i(n(t),void 0,"prehashed message"):t}return Object.freeze({keygen:w,getPublicKey:b,getSharedSecret:E,utils:v,lengths:B,Point:t,sign:function(e,r,f={}){const{seed:c,k2sig:h}=function(e,r,n){const{lowS:o,prehash:f,extraEntropy:c}=wt(n,x);e=D(e,f);const h=_(e),a=p.fromBytes(r);if(!p.isValidNot0(a))throw new Error("invalid private key");const l=[F(a),F(h)];if(null!=c&&!1!==c){const t=!0===c?s(B.secretKey):c;l.push(i(t,void 0,"extraEntropy"))}const d=u(...l),g=h;return{seed:d,k2sig:function(e){const r=N(e);if(!p.isValidNot0(r))return;const n=p.inv(r),i=t.BASE.multiply(r).toAffine(),s=p.create(i.x);if(s===Et)return;const f=p.create(n*p.create(g+s*a));if(f===Et)return;let u=(i.x===s?0:2)|Number(i.y&vt),c=f;return o&&U(f)&&(c=p.neg(f),u^=1),new L(s,c,O?void 0:u)}}}(e,r,f);return function(t,e,r){if((0,o.Fe)(t,"hashLen"),(0,o.Fe)(e,"qByteLen"),"function"!=typeof r)throw new TypeError("hmacFn must be a function");const n=t=>new Uint8Array(t),i=Uint8Array.of(),s=Uint8Array.of(0),f=Uint8Array.of(1);let c=n(t),h=n(t),a=0;const l=()=>{c.fill(1),h.fill(0),a=0},d=(...t)=>r(h,u(c,...t)),p=(t=i)=>{h=d(s,t),c=d(),0!==t.length&&(h=d(f,t),c=d())},g=()=>{if(a++>=1e3)throw new Error("drbg: tried max amount of iterations");let t=0;const r=[];for(;t<e;){c=d();const e=c.slice();r.push(e),t+=c.length}return u(...r)};return(t,e)=>{let r;for(l(),p(t);void 0===(r=e(g()));)p();return l(),r}}(n.outputLen,p.BYTES,l)(c,h).toBytes(f.format)},verify:function(e,r,n,o={}){const{lowS:s,prehash:f,format:u}=wt(o,x);if(n=i(n,void 0,"publicKey"),r=D(r,f),!h(e)){throw new Error("verify expects Uint8Array signature"+(e instanceof L?", use sig.toBytes()":""))}T(e,u);try{const o=L.fromBytes(e,u),i=t.fromBytes(n);if(s&&o.hasHighS())return!1;const{r:f,s:c}=o,h=_(r),a=p.inv(c),l=p.create(h*a),d=p.create(f*a),g=t.BASE.multiplyUnsafe(l).add(i.multiplyUnsafe(d));if(g.is0())return!1;return p.create(g.x)===f}catch(t){return!1}},recoverPublicKey:function(t,e,r={}){const{prehash:n}=wt(r,x);return e=D(e,n),L.fromBytes(t,"recovered").recoverPublicKey(e).toBytes()},Signature:L,hash:n})}
19
19
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
20
- const St={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Tt={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Lt=BigInt(2);const Nt=J(St.p,{sqrt:function(t){const e=St.p,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),f=BigInt(44),u=BigInt(88),c=t*t*t%e,h=c*c*t%e,a=M(h,r,e)*h%e,l=M(a,r,e)*h%e,d=M(l,Lt,e)*c%e,p=M(d,o,e)*d%e,g=M(p,i,e)*p%e,y=M(g,f,e)*g%e,w=M(y,u,e)*y%e,b=M(w,f,e)*g%e,m=M(b,r,e)*h%e,E=M(m,s,e)*p%e,v=M(E,n,e)*c%e,B=M(v,Lt,e);if(!Nt.eql(Nt.sqr(B),t))throw new Error("Cannot find square root");return B}}),_t=Ot(St,{Fp:Nt,endo:Tt}),Ct=kt(_t,n.sha256)},474(t,e,r){"use strict";r.d(e,{hmac:()=>i});var n=r(508);class o{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,e){if((0,n.sd)(t),(0,n.DO)(e,void 0,"key"),this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(e.length>r?t.create().update(e).digest():e);for(let t=0;t<o.length;t++)o[t]^=54;this.iHash.update(o),this.oHash=t.create();for(let t=0;t<o.length;t++)o[t]^=106;this.oHash.update(o),(0,n.uH)(o)}update(t){return(0,n.CC)(this),this.iHash.update(t),this}digestInto(t){(0,n.CC)(this),(0,n.Ht)(t,this),this.finished=!0;const e=t.subarray(0,this.outputLen);this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:e,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=n,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const i=(()=>{const t=(t,e,r)=>new o(t,e).update(r).digest();return t.create=(t,e)=>new o(t,e),t})()},544(t,e,r){"use strict";r.d(e,{sha256:()=>D,sha512:()=>H});var n=r(508);function o(t,e,r){return t&e^~t&r}function i(t,e,r){return t&e^t&r^e&r}class s{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,r,o){this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=(0,n.O8)(this.buffer)}update(t){(0,n.CC)(this),(0,n.DO)(t);const{view:e,buffer:r,blockLen:o}=this,i=t.length;for(let s=0;s<i;){const f=Math.min(o-this.pos,i-s);if(f===o){const e=(0,n.O8)(t);for(;o<=i-s;s+=o)this.process(e,s);continue}r.set(t.subarray(s,s+f),this.pos),this.pos+=f,s+=f,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,n.CC)(this),(0,n.Ht)(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:o,isLE:i}=this;let{pos:s}=this;e[s++]=128,(0,n.uH)(this.buffer.subarray(s)),this.padOffset>o-s&&(this.process(r,0),s=0);for(let t=s;t<o;t++)e[t]=0;r.setBigUint64(o-8,BigInt(8*this.length),i),this.process(r,0);const f=(0,n.O8)(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=u/4,h=this.get();if(c>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)f.setUint32(4*t,h[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=o,t.length=n,t.pos=s,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const f=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),c=BigInt(2**32-1),h=BigInt(32);function a(t,e=!1){return e?{h:Number(t&c),l:Number(t>>h&c)}:{h:0|Number(t>>h&c),l:0|Number(t&c)}}function l(t,e=!1){const r=t.length;let n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){const{h:r,l:s}=a(t[i],e);[n[i],o[i]]=[r,s]}return[n,o]}const d=(t,e,r)=>t>>>r,p=(t,e,r)=>t<<32-r|e>>>r,g=(t,e,r)=>t>>>r|e<<32-r,y=(t,e,r)=>t<<32-r|e>>>r,w=(t,e,r)=>t<<64-r|e>>>r-32,b=(t,e,r)=>t>>>r-32|e<<64-r;function m(t,e,r,n){const o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}}const E=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),v=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,B=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),x=(t,e,r,n,o)=>e+r+n+o+(t/2**32|0)|0,A=(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0),O=(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0;const R=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),I=new Uint32Array(64);class U extends s{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:n,E:o,F:i,G:s,H:f}=this;return[t,e,r,n,o,i,s,f]}set(t,e,r,n,o,i,s,f){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|f}process(t,e){for(let r=0;r<16;r++,e+=4)I[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=I[t-15],r=I[t-2],o=(0,n.Ow)(e,7)^(0,n.Ow)(e,18)^e>>>3,i=(0,n.Ow)(r,17)^(0,n.Ow)(r,19)^r>>>10;I[t]=i+I[t-7]+o+I[t-16]|0}let{A:r,B:s,C:f,D:u,E:c,F:h,G:a,H:l}=this;for(let t=0;t<64;t++){const e=l+((0,n.Ow)(c,6)^(0,n.Ow)(c,11)^(0,n.Ow)(c,25))+o(c,h,a)+R[t]+I[t]|0,d=((0,n.Ow)(r,2)^(0,n.Ow)(r,13)^(0,n.Ow)(r,22))+i(r,s,f)|0;l=a,a=h,h=c,c=u+e|0,u=f,f=s,s=r,r=e+d|0}r=r+this.A|0,s=s+this.B|0,f=f+this.C|0,u=u+this.D|0,c=c+this.E|0,h=h+this.F|0,a=a+this.G|0,l=l+this.H|0,this.set(r,s,f,u,c,h,a,l)}roundClean(){(0,n.uH)(I)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),(0,n.uH)(this.buffer)}}class k extends U{A=0|f[0];B=0|f[1];C=0|f[2];D=0|f[3];E=0|f[4];F=0|f[5];G=0|f[6];H=0|f[7];constructor(){super(32)}}const S=(()=>l(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),T=(()=>S[0])(),L=(()=>S[1])(),N=new Uint32Array(80),_=new Uint32Array(80);class C extends s{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:f,Eh:u,El:c,Fh:h,Fl:a,Gh:l,Gl:d,Hh:p,Hl:g}=this;return[t,e,r,n,o,i,s,f,u,c,h,a,l,d,p,g]}set(t,e,r,n,o,i,s,f,u,c,h,a,l,d,p,g){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|f,this.Eh=0|u,this.El=0|c,this.Fh=0|h,this.Fl=0|a,this.Gh=0|l,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(t,e){for(let r=0;r<16;r++,e+=4)N[r]=t.getUint32(e),_[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|N[t-15],r=0|_[t-15],n=g(e,r,1)^g(e,r,8)^d(e,0,7),o=y(e,r,1)^y(e,r,8)^p(e,r,7),i=0|N[t-2],s=0|_[t-2],f=g(i,s,19)^w(i,s,61)^d(i,0,6),u=y(i,s,19)^b(i,s,61)^p(i,s,6),c=B(o,u,_[t-7],_[t-16]),h=x(c,n,f,N[t-7],N[t-16]);N[t]=0|h,_[t]=0|c}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:f,Dh:u,Dl:c,Eh:h,El:a,Fh:l,Fl:R,Gh:I,Gl:U,Hh:k,Hl:S}=this;for(let t=0;t<80;t++){const e=g(h,a,14)^g(h,a,18)^w(h,a,41),d=y(h,a,14)^y(h,a,18)^b(h,a,41),p=h&l^~h&I,B=A(S,d,a&R^~a&U,L[t],_[t]),x=O(B,k,e,p,T[t],N[t]),C=0|B,F=g(r,n,28)^w(r,n,34)^w(r,n,39),D=y(r,n,28)^b(r,n,34)^b(r,n,39),H=r&o^r&s^o&s,M=n&i^n&f^i&f;k=0|I,S=0|U,I=0|l,U=0|R,l=0|h,R=0|a,({h,l:a}=m(0|u,0|c,0|x,0|C)),u=0|s,c=0|f,s=0|o,f=0|i,o=0|r,i=0|n;const P=E(C,D,M);r=v(P,x,F,H),n=0|P}({h:r,l:n}=m(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=m(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:f}=m(0|this.Ch,0|this.Cl,0|s,0|f)),({h:u,l:c}=m(0|this.Dh,0|this.Dl,0|u,0|c)),({h,l:a}=m(0|this.Eh,0|this.El,0|h,0|a)),({h:l,l:R}=m(0|this.Fh,0|this.Fl,0|l,0|R)),({h:I,l:U}=m(0|this.Gh,0|this.Gl,0|I,0|U)),({h:k,l:S}=m(0|this.Hh,0|this.Hl,0|k,0|S)),this.set(r,n,o,i,s,f,u,c,h,a,l,R,I,U,k,S)}roundClean(){(0,n.uH)(N,_)}destroy(){this.destroyed=!0,(0,n.uH)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class F extends C{Ah=0|u[0];Al=0|u[1];Bh=0|u[2];Bl=0|u[3];Ch=0|u[4];Cl=0|u[5];Dh=0|u[6];Dl=0|u[7];Eh=0|u[8];El=0|u[9];Fh=0|u[10];Fl=0|u[11];Gh=0|u[12];Gl=0|u[13];Hh=0|u[14];Hl=0|u[15];constructor(){super(64)}}const D=(0,n.qj)(()=>new k,(0,n.nx)(1)),H=(0,n.qj)(()=>new F,(0,n.nx)(3))},508(t,e,r){"use strict";function n(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name&&"BYTES_PER_ELEMENT"in t&&1===t.BYTES_PER_ELEMENT}function o(t,e=""){if("number"!=typeof t){throw new TypeError(`${e&&`"${e}" `}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){throw new RangeError(`${e&&`"${e}" `}expected integer >= 0, got ${t}`)}}function i(t,e,r=""){const o=n(t),i=t?.length,s=void 0!==e;if(!o||s&&i!==e){const n=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(o?`length=${i}`:"type="+typeof t);if(!o)throw new TypeError(n);throw new RangeError(n)}return t}function s(t){if("function"!=typeof t||"function"!=typeof t.create)throw new TypeError("Hash must wrapped by utils.createHasher");if(o(t.outputLen),o(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function f(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){i(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function c(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function h(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function a(t,e){return t<<32-e|t>>>e}r.d(e,{CC:()=>f,DO:()=>i,Fe:()=>o,Ht:()=>u,Id:()=>x,My:()=>p,O8:()=>h,Ow:()=>a,aT:()=>B,aY:()=>n,nx:()=>R,po:()=>O,qj:()=>A,sd:()=>s,uH:()=>c});const l=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),d=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function p(t){if(i(t),l)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=d[t[r]];return e}const g=48,y=57,w=65,b=70,m=97,E=102;function v(t){return t>=g&&t<=y?t-g:t>=w&&t<=b?t-(w-10):t>=m&&t<=E?t-(m-10):void 0}function B(t){if("string"!=typeof t)throw new TypeError("hex string expected, got "+typeof t);if(l)try{return Uint8Array.fromHex(t)}catch(t){if(t instanceof SyntaxError)throw new RangeError(t.message);throw t}const e=t.length,r=e/2;if(e%2)throw new RangeError("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,o=0;e<r;e++,o+=2){const r=v(t.charCodeAt(o)),i=v(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new RangeError('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function x(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];i(n),e+=n.length}const r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}function A(t,e={}){const r=(e,r)=>t(r).update(e).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=e=>t(e),Object.assign(r,e),Object.freeze(r)}function O(t=32){o(t,"bytesLength");const e="object"==typeof globalThis?globalThis.crypto:null;if("function"!=typeof e?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}const R=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])})}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n=r(481);bsvEcies=n})();
20
+ const St={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Tt={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Lt=BigInt(2);const Nt=J(St.p,{sqrt:function(t){const e=St.p,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),f=BigInt(44),u=BigInt(88),c=t*t*t%e,h=c*c*t%e,a=M(h,r,e)*h%e,l=M(a,r,e)*h%e,d=M(l,Lt,e)*c%e,p=M(d,o,e)*d%e,g=M(p,i,e)*p%e,y=M(g,f,e)*g%e,w=M(y,u,e)*y%e,b=M(w,f,e)*g%e,m=M(b,r,e)*h%e,E=M(m,s,e)*p%e,v=M(E,n,e)*c%e,B=M(v,Lt,e);if(!Nt.eql(Nt.sqr(B),t))throw new Error("Cannot find square root");return B}}),_t=Ot(St,{Fp:Nt,endo:Tt}),Ct=kt(_t,n.sha256)},474(t,e,r){"use strict";r.d(e,{hmac:()=>i});var n=r(508);class o{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,e){if((0,n.sd)(t),(0,n.DO)(e,void 0,"key"),this.iHash=t.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(e.length>r?t.create().update(e).digest():e);for(let t=0;t<o.length;t++)o[t]^=54;this.iHash.update(o),this.oHash=t.create();for(let t=0;t<o.length;t++)o[t]^=106;this.oHash.update(o),(0,n.uH)(o)}update(t){return(0,n.CC)(this),this.iHash.update(t),this}digestInto(t){(0,n.CC)(this),(0,n.Ht)(t,this),this.finished=!0;const e=t.subarray(0,this.outputLen);this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:e,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=n,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const i=(()=>{const t=(t,e,r)=>new o(t,e).update(r).digest();return t.create=(t,e)=>new o(t,e),t})()},87(t,e,r){"use strict";r.d(e,{sha256:()=>D,sha512:()=>H});var n=r(508);function o(t,e,r){return t&e^~t&r}function i(t,e,r){return t&e^t&r^e&r}class s{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,e,r,o){this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=(0,n.O8)(this.buffer)}update(t){(0,n.CC)(this),(0,n.DO)(t);const{view:e,buffer:r,blockLen:o}=this,i=t.length;for(let s=0;s<i;){const f=Math.min(o-this.pos,i-s);if(f===o){const e=(0,n.O8)(t);for(;o<=i-s;s+=o)this.process(e,s);continue}r.set(t.subarray(s,s+f),this.pos),this.pos+=f,s+=f,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,n.CC)(this),(0,n.Ht)(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:o,isLE:i}=this;let{pos:s}=this;e[s++]=128,(0,n.uH)(this.buffer.subarray(s)),this.padOffset>o-s&&(this.process(r,0),s=0);for(let t=s;t<o;t++)e[t]=0;r.setBigUint64(o-8,BigInt(8*this.length),i),this.process(r,0);const f=(0,n.O8)(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=u/4,h=this.get();if(c>h.length)throw new Error("_sha2: outputLen bigger than state");for(let t=0;t<c;t++)f.setUint32(4*t,h[t],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:e,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=o,t.length=n,t.pos=s,n%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const f=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),c=BigInt(2**32-1),h=BigInt(32);function a(t,e=!1){return e?{h:Number(t&c),l:Number(t>>h&c)}:{h:0|Number(t>>h&c),l:0|Number(t&c)}}function l(t,e=!1){const r=t.length;let n=new Uint32Array(r),o=new Uint32Array(r);for(let i=0;i<r;i++){const{h:r,l:s}=a(t[i],e);[n[i],o[i]]=[r,s]}return[n,o]}const d=(t,e,r)=>t>>>r,p=(t,e,r)=>t<<32-r|e>>>r,g=(t,e,r)=>t>>>r|e<<32-r,y=(t,e,r)=>t<<32-r|e>>>r,w=(t,e,r)=>t<<64-r|e>>>r-32,b=(t,e,r)=>t>>>r-32|e<<64-r;function m(t,e,r,n){const o=(e>>>0)+(n>>>0);return{h:t+r+(o/2**32|0)|0,l:0|o}}const E=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),v=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,B=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),x=(t,e,r,n,o)=>e+r+n+o+(t/2**32|0)|0,A=(t,e,r,n,o)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(o>>>0),O=(t,e,r,n,o,i)=>e+r+n+o+i+(t/2**32|0)|0;const R=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),I=new Uint32Array(64);class U extends s{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:e,C:r,D:n,E:o,F:i,G:s,H:f}=this;return[t,e,r,n,o,i,s,f]}set(t,e,r,n,o,i,s,f){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|f}process(t,e){for(let r=0;r<16;r++,e+=4)I[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){const e=I[t-15],r=I[t-2],o=(0,n.Ow)(e,7)^(0,n.Ow)(e,18)^e>>>3,i=(0,n.Ow)(r,17)^(0,n.Ow)(r,19)^r>>>10;I[t]=i+I[t-7]+o+I[t-16]|0}let{A:r,B:s,C:f,D:u,E:c,F:h,G:a,H:l}=this;for(let t=0;t<64;t++){const e=l+((0,n.Ow)(c,6)^(0,n.Ow)(c,11)^(0,n.Ow)(c,25))+o(c,h,a)+R[t]+I[t]|0,d=((0,n.Ow)(r,2)^(0,n.Ow)(r,13)^(0,n.Ow)(r,22))+i(r,s,f)|0;l=a,a=h,h=c,c=u+e|0,u=f,f=s,s=r,r=e+d|0}r=r+this.A|0,s=s+this.B|0,f=f+this.C|0,u=u+this.D|0,c=c+this.E|0,h=h+this.F|0,a=a+this.G|0,l=l+this.H|0,this.set(r,s,f,u,c,h,a,l)}roundClean(){(0,n.uH)(I)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),(0,n.uH)(this.buffer)}}class k extends U{A=0|f[0];B=0|f[1];C=0|f[2];D=0|f[3];E=0|f[4];F=0|f[5];G=0|f[6];H=0|f[7];constructor(){super(32)}}const S=(()=>l(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))))(),T=(()=>S[0])(),L=(()=>S[1])(),N=new Uint32Array(80),_=new Uint32Array(80);class C extends s{constructor(t){super(128,t,16,!1)}get(){const{Ah:t,Al:e,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:f,Eh:u,El:c,Fh:h,Fl:a,Gh:l,Gl:d,Hh:p,Hl:g}=this;return[t,e,r,n,o,i,s,f,u,c,h,a,l,d,p,g]}set(t,e,r,n,o,i,s,f,u,c,h,a,l,d,p,g){this.Ah=0|t,this.Al=0|e,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|f,this.Eh=0|u,this.El=0|c,this.Fh=0|h,this.Fl=0|a,this.Gh=0|l,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(t,e){for(let r=0;r<16;r++,e+=4)N[r]=t.getUint32(e),_[r]=t.getUint32(e+=4);for(let t=16;t<80;t++){const e=0|N[t-15],r=0|_[t-15],n=g(e,r,1)^g(e,r,8)^d(e,0,7),o=y(e,r,1)^y(e,r,8)^p(e,r,7),i=0|N[t-2],s=0|_[t-2],f=g(i,s,19)^w(i,s,61)^d(i,0,6),u=y(i,s,19)^b(i,s,61)^p(i,s,6),c=B(o,u,_[t-7],_[t-16]),h=x(c,n,f,N[t-7],N[t-16]);N[t]=0|h,_[t]=0|c}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:f,Dh:u,Dl:c,Eh:h,El:a,Fh:l,Fl:R,Gh:I,Gl:U,Hh:k,Hl:S}=this;for(let t=0;t<80;t++){const e=g(h,a,14)^g(h,a,18)^w(h,a,41),d=y(h,a,14)^y(h,a,18)^b(h,a,41),p=h&l^~h&I,B=A(S,d,a&R^~a&U,L[t],_[t]),x=O(B,k,e,p,T[t],N[t]),C=0|B,F=g(r,n,28)^w(r,n,34)^w(r,n,39),D=y(r,n,28)^b(r,n,34)^b(r,n,39),H=r&o^r&s^o&s,M=n&i^n&f^i&f;k=0|I,S=0|U,I=0|l,U=0|R,l=0|h,R=0|a,({h,l:a}=m(0|u,0|c,0|x,0|C)),u=0|s,c=0|f,s=0|o,f=0|i,o=0|r,i=0|n;const P=E(C,D,M);r=v(P,x,F,H),n=0|P}({h:r,l:n}=m(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=m(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:f}=m(0|this.Ch,0|this.Cl,0|s,0|f)),({h:u,l:c}=m(0|this.Dh,0|this.Dl,0|u,0|c)),({h,l:a}=m(0|this.Eh,0|this.El,0|h,0|a)),({h:l,l:R}=m(0|this.Fh,0|this.Fl,0|l,0|R)),({h:I,l:U}=m(0|this.Gh,0|this.Gl,0|I,0|U)),({h:k,l:S}=m(0|this.Hh,0|this.Hl,0|k,0|S)),this.set(r,n,o,i,s,f,u,c,h,a,l,R,I,U,k,S)}roundClean(){(0,n.uH)(N,_)}destroy(){this.destroyed=!0,(0,n.uH)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class F extends C{Ah=0|u[0];Al=0|u[1];Bh=0|u[2];Bl=0|u[3];Ch=0|u[4];Cl=0|u[5];Dh=0|u[6];Dl=0|u[7];Eh=0|u[8];El=0|u[9];Fh=0|u[10];Fl=0|u[11];Gh=0|u[12];Gl=0|u[13];Hh=0|u[14];Hl=0|u[15];constructor(){super(64)}}const D=(0,n.qj)(()=>new k,(0,n.nx)(1)),H=(0,n.qj)(()=>new F,(0,n.nx)(3))},508(t,e,r){"use strict";function n(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name&&"BYTES_PER_ELEMENT"in t&&1===t.BYTES_PER_ELEMENT}function o(t,e=""){if("number"!=typeof t){throw new TypeError(`${e&&`"${e}" `}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){throw new RangeError(`${e&&`"${e}" `}expected integer >= 0, got ${t}`)}}function i(t,e,r=""){const o=n(t),i=t?.length,s=void 0!==e;if(!o||s&&i!==e){const n=(r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${e}`:"")+", got "+(o?`length=${i}`:"type="+typeof t);if(!o)throw new TypeError(n);throw new RangeError(n)}return t}function s(t){if("function"!=typeof t||"function"!=typeof t.create)throw new TypeError("Hash must wrapped by utils.createHasher");if(o(t.outputLen),o(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function f(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function u(t,e){i(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function c(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function h(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function a(t,e){return t<<32-e|t>>>e}r.d(e,{CC:()=>f,DO:()=>i,Fe:()=>o,Ht:()=>u,Id:()=>x,My:()=>p,O8:()=>h,Ow:()=>a,aT:()=>B,aY:()=>n,nx:()=>R,po:()=>O,qj:()=>A,sd:()=>s,uH:()=>c});const l=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),d=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function p(t){if(i(t),l)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=d[t[r]];return e}const g=48,y=57,w=65,b=70,m=97,E=102;function v(t){return t>=g&&t<=y?t-g:t>=w&&t<=b?t-(w-10):t>=m&&t<=E?t-(m-10):void 0}function B(t){if("string"!=typeof t)throw new TypeError("hex string expected, got "+typeof t);if(l)try{return Uint8Array.fromHex(t)}catch(t){if(t instanceof SyntaxError)throw new RangeError(t.message);throw t}const e=t.length,r=e/2;if(e%2)throw new RangeError("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let e=0,o=0;e<r;e++,o+=2){const r=v(t.charCodeAt(o)),i=v(t.charCodeAt(o+1));if(void 0===r||void 0===i){const e=t[o]+t[o+1];throw new RangeError('hex string expected, got non-hex character "'+e+'" at index '+o)}n[e]=16*r+i}return n}function x(...t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];i(n),e+=n.length}const r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){const o=t[e];r.set(o,n),n+=o.length}return r}function A(t,e={}){const r=(e,r)=>t(r).update(e).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=e=>t(e),Object.assign(r,e),Object.freeze(r)}function O(t=32){o(t,"bytesLength");const e="object"==typeof globalThis?globalThis.crypto:null;if("function"!=typeof e?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}const R=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])})}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var n=r(481);bsvEcies=n})();