@smartledger/bsv 6.1.2 → 6.2.1
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/CHANGELOG.md +56 -0
- package/README.md +38 -38
- package/SECURITY.md +39 -12
- package/bsv-anchor.min.js +18 -11
- package/bsv-covenant.min.js +2 -48
- package/bsv-didweb.min.js +18 -11
- package/bsv-ecies.min.js +2 -20
- package/bsv-gdaf.min.js +103 -45
- package/bsv-ltp.min.js +103 -45
- package/bsv-message.min.js +3 -10
- package/bsv-mnemonic.min.js +20 -11
- package/bsv-script-helper.min.js +2 -10
- package/bsv-security.min.js +2 -10
- package/bsv-shamir.min.js +20 -11
- package/bsv-smartcontract.min.js +26 -48
- package/bsv-statuslist.min.js +74 -17
- package/bsv-vcjwt.min.js +18 -11
- package/bsv.bundle.js +103 -45
- package/bsv.min.js +103 -45
- package/build/esbuild/empty.js +2 -0
- package/build/esbuild/globals.js +6 -0
- package/build/esbuild.js +129 -0
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/THREAT_MODEL.md +127 -0
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/index.js +3 -2
- package/lib/smart_contract/index.js +1 -1
- package/package.json +5 -23
- package/test/build/bundle_smoke.js +55 -0
- package/test/build/esbuild_main.js +65 -0
- package/test/build/version_sync.js +14 -0
- package/test/security/threat_model_coverage.js +31 -0
- package/version.js +3 -0
- package/build/webpack.anchor.config.js +0 -15
- package/build/webpack.base.js +0 -125
- package/build/webpack.bundle.config.js +0 -15
- package/build/webpack.config.js +0 -17
- package/build/webpack.covenant.config.js +0 -17
- package/build/webpack.didweb.config.js +0 -15
- package/build/webpack.ecies.config.js +0 -15
- package/build/webpack.gdaf.config.js +0 -15
- package/build/webpack.ltp.config.js +0 -15
- package/build/webpack.message.config.js +0 -15
- package/build/webpack.mnemonic.config.js +0 -15
- package/build/webpack.script-helper.config.js +0 -17
- package/build/webpack.security.config.js +0 -15
- package/build/webpack.shamir.config.js +0 -15
- package/build/webpack.smartcontract.config.js +0 -18
- package/build/webpack.statuslist.config.js +0 -15
- package/build/webpack.vcjwt.config.js +0 -15
package/bsv-message.min.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
var bsvMessage;(()=>{var t={157(t,e,r){var n=r(722);n.Message=r(558),t.exports=n.Message},558(t,e,r){"use strict";var n=r(287).hp,i=r(722),o=i.deps._,f=i.PrivateKey,s=i.PublicKey,u=i.Address,h=i.encoding.BufferWriter,a=i.crypto.ECDSA,c=i.crypto.Signature,p=i.crypto.Hash.sha256sha256,l=i.util.js,g=i.util.preconditions,y=function t(e){return this instanceof t?(g.checkArgument(o.isString(e)||n.isBuffer(e),"First argument should be a string or Buffer"),o.isString(e)&&(this.messageBuffer=n.from(e)),n.isBuffer(e)&&(this.messageBuffer=e),this):new t(e)};y.sign=function(t,e){return new y(t).sign(e)},y.verify=function(t,e,r){return new y(t).verify(e,r)},y.MAGIC_BYTES=n.from("Bitcoin Signed Message:\n"),y.prototype.magicHash=function(){var t=h.varintBufNum(y.MAGIC_BYTES.length),e=h.varintBufNum(this.messageBuffer.length),r=n.concat([t,y.MAGIC_BYTES,e,this.messageBuffer]);return p(r)},y.prototype._sign=function(t){g.checkArgument(t instanceof f,"First argument should be an instance of PrivateKey");var e=this.magicHash();return a.signWithCalcI(e,t)},y.prototype.sign=function(t){return this._sign(t).toCompact().toString("base64")},y.prototype._verify=function(t,e){g.checkArgument(t instanceof s,"First argument should be an instance of PublicKey"),g.checkArgument(e instanceof c,"Second argument should be an instance of Signature");var r=this.magicHash(),n=a.verify(r,e,t);return n||(this.error="The signature was invalid"),n},y.prototype.verify=function(t,e){g.checkArgument(t),g.checkArgument(e&&o.isString(e)),o.isString(t)&&(t=u.fromString(t));var r=c.fromCompact(n.from(e,"base64")),i=new a;i.hashbuf=this.magicHash(),i.sig=r;var f=i.toPublicKey(),s=u.fromPublicKey(f,t.network);return t.toString()!==s.toString()?(this.error="The signature did not match the message digest",!1):this._verify(f,r)},y.fromString=function(t){return new y(t)},y.fromJSON=function(t){return l.isValidJSON(t)&&(t=JSON.parse(t)),y.fromObject(t)},y.prototype.toObject=function(){return{messageHex:this.messageBuffer.toString("hex")}},y.fromObject=function(t){let e=n.from(t.messageHex,"hex");return new y(e)},y.prototype.toJSON=function(){return JSON.stringify(this.toObject())},y.prototype.toString=function(){return this.messageBuffer.toString()},y.prototype.inspect=function(){return"<Message: "+this.toString()+">"},t.exports=y},613(t,e,r){t.exports=r(157)},526(t,e){"use strict";e.toByteArray=function(t){var e,r,o=s(t),f=o[0],u=o[1],h=new i(function(t,e,r){return 3*(e+r)/4-r}(0,f,u)),a=0,c=u>0?f-4:f;for(r=0;r<c;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)],h[a++]=e>>16&255,h[a++]=e>>8&255,h[a++]=255&e;2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[a++]=255&e);1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[a++]=e>>8&255,h[a++]=255&e);return h},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],f=16383,s=0,u=n-i;s<u;s+=f)o.push(h(t,s,s+f>u?u:s+f));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0;f<64;++f)r[f]=o[f],n[o.charCodeAt(f)]=f;function s(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 h(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(u(n));return i.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},287(t,e,r){"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6
|
-
* @license MIT
|
|
7
|
-
*/
|
|
8
|
-
const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=u,e.IS=50;const f=2147483647;function s(t){if(t>f)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 c(t)}return h(t,e,r)}function h(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|y(t,e);let n=s(r);const i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(W(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return p(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(W(t,ArrayBuffer)||t&&W(t.buffer,ArrayBuffer))return l(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(W(t,SharedArrayBuffer)||t&&W(t.buffer,SharedArrayBuffer)))return l(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 i=function(t){if(u.isBuffer(t)){const e=0|g(t.length),r=s(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length)?s(0):p(t);if("Buffer"===t.type&&Array.isArray(t.data))return p(t.data)}(t);if(i)return i;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 a(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 c(t){return a(t),s(t<0?0:0|g(t))}function p(t){const e=t.length<0?0:0|g(t.length),r=s(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(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 g(t){if(t>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|t}function y(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||W(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 i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(t).length;default:if(i)return n?-1:J(t).length;e=(""+e).toLowerCase(),i=!0}}function d(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 L(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return T(this,e,r);case"base64":return U(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(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,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)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,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){let o,f=1,s=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;f=2,s/=2,u/=2,r/=2}function h(t,e){return 1===f?t[e]:t.readUInt16BE(e*f)}if(i){let n=-1;for(o=r;o<s;o++)if(h(t,o)===h(e,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*f}else-1!==n&&(o-=o-n),n=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(h(t,o+n)!==h(e,n)){r=!1;break}if(r)return o}return-1}function B(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=e.length;let f;for(n>o/2&&(n=o/2),f=0;f<n;++f){const n=parseInt(e.substr(2*f,2),16);if(q(n))return f;t[r+f]=n}return f}function E(t,e,r,n){return V(J(e,t.length-r),t,r,n)}function A(t,e,r,n){return V(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 v(t,e,r,n){return V(K(e),t,r,n)}function I(t,e,r,n){return V(function(t,e){let r,n,i;const o=[];for(let f=0;f<t.length&&!((e-=2)<0);++f)r=t.charCodeAt(f),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function U(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let o=null,f=e>239?4:e>223?3:e>191?2:1;if(i+f<=r){let r,n,s,u;switch(f){case 1:e<128&&(o=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(o=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=t[i+1],n=t[i+2],s=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,f=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=f}return function(t){const e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));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 h(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 a(t),t<=0?s(t):void 0!==e?"string"==typeof r?s(t).fill(e,r):s(t).fill(e):s(t)}(t,e,r)},u.allocUnsafe=function(t){return c(t)},u.allocUnsafeSlow=function(t){return c(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(W(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),W(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 i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];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 i=0;for(r=0;r<t.length;++r){let e=t[r];if(W(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=y,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?S(this,0,t):d.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+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(W(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===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let o=(i>>>=0)-(n>>>=0),f=(r>>>=0)-(e>>>=0);const s=Math.min(o,f),h=this.slice(n,i),a=t.slice(e,r);for(let t=0;t<s;++t)if(h[t]!==a[t]){o=h[t],f=a[t];break}return o<f?-1:f<o?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 i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return B(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":case"latin1":case"binary":return A(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function O(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function L(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=Z[t[n]];return i}function _(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function x(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 C(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function M(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,f>>=8,t[r++]=f,r}function N(t,e,r,n,i){z(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o>>=8,t[r+6]=o,o>>=8,t[r+5]=o,o>>=8,t[r+4]=o;let f=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=f,f>>=8,t[r+2]=f,f>>=8,t[r+1]=f,f>>=8,t[r]=f,r+8}function $(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(t,e,r,n,o){return e=+e,r>>>=0,o||$(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function k(t,e,r,n,o){return e=+e,r>>>=0,o||$(t,0,r,8),i.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||x(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||x(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||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))}),u.prototype.readBigUInt64BE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=this[t],i=1,o=0;for(;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||x(t,e,this.length);let n=e,i=1,o=this[t+--n];for(;n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return t>>>=0,e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||x(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||x(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||x(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||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(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=Q(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||Y(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||x(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||x(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||x(t,8,this.length),i.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){C(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){C(this,t,e,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||C(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||C(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||C(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||C(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||C(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=Q(function(t,e=0){return M(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Q(function(t,e=0){return N(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);C(this,t,e,r,n-1,-n)}let i=0,o=1,f=0;for(this[e]=255&t;++i<r&&(o*=256);)t<0&&0===f&&0!==this[e+i-1]&&(f=1),this[e+i]=(t/o|0)-f&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);C(this,t,e,r,n-1,-n)}let i=r-1,o=1,f=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===f&&0!==this[e+i+1]&&(f=1),this[e+i]=(t/o|0)-f&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||C(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||C(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||C(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||C(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||C(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=Q(function(t,e=0){return M(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Q(function(t,e=0){return N(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeFloatLE=function(t,e,r){return P(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return P(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return k(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return k(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 i=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),i},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 i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const o=u.isBuffer(t)?t:u.from(t,n),f=o.length;if(0===f)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=o[i%f]}return this};const j={};function F(t,e,r){j[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 D(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 z(t,e,r,n,i,o){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){G(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||Y(e,t.length-(r+1))}(n,i,o)}function G(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function Y(t,e,r){if(Math.floor(t)!==t)throw G(t,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}F("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),F("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),F("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=D(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=D(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);const H=/[^+/0-9A-Za-z-_]/g;function J(t,e){let r;e=e||1/0;const n=t.length;let i=null;const o=[];for(let f=0;f<n;++f){if(r=t.charCodeAt(f),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(f+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.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;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function W(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?X:t}function X(){throw new Error("BigInt not supported")}},251(t,e){
|
|
9
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
-
e.read=function(t,e,r,n,i){var o,f,s=8*i-n-1,u=(1<<s)-1,h=u>>1,a=-7,c=r?i-1:0,p=r?-1:1,l=t[e+c];for(c+=p,o=l&(1<<-a)-1,l>>=-a,a+=s;a>0;o=256*o+t[e+c],c+=p,a-=8);for(f=o&(1<<-a)-1,o>>=-a,a+=n;a>0;f=256*f+t[e+c],c+=p,a-=8);if(0===o)o=1-h;else{if(o===u)return f?NaN:1/0*(l?-1:1);f+=Math.pow(2,n),o-=h}return(l?-1:1)*f*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var f,s,u,h=8*o-i-1,a=(1<<h)-1,c=a>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,g=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,f=a):(f=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-f))<1&&(f--,u*=2),(e+=f+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(f++,u/=2),f+c>=a?(s=0,f=a):f+c>=1?(s=(e*u-1)*Math.pow(2,i),f+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),f=0));i>=8;t[r+l]=255&s,l+=g,s/=256,i-=8);for(f=f<<i|s,h+=i;h>0;t[r+l]=255&f,l+=g,f/=256,h-=8);t[r+l-g]|=128*y}},722(t){"use strict";t.exports=bsv}},e={};var r=function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}(613);bsvMessage=r})();
|
|
1
|
+
var bsvMessage=(()=>{var Vr=Object.create;var cr=Object.defineProperty;var Xr=Object.getOwnPropertyDescriptor;var zr=Object.getOwnPropertyNames;var Qr=Object.getPrototypeOf,Zr=Object.prototype.hasOwnProperty;var vr=(e,r,t)=>()=>{if(t)throw t[0];try{return e&&(r=e(e=0)),r}catch(i){throw t=[i],i}};var R=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(t){throw r=0,t}};var rt=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of zr(r))!Zr.call(e,n)&&n!==t&&cr(e,n,{get:()=>r[n],enumerable:!(i=Xr(r,n))||i.enumerable});return e};var sr=(e,r,t)=>(t=e!=null?Vr(Qr(e)):{},rt(r||!e||!e.__esModule?cr(t,"default",{value:e,enumerable:!0}):t,e));var wr=R((Gt,yr)=>{x();var y=yr.exports={},E,I;function X(){throw new Error("setTimeout has not been defined")}function z(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?E=setTimeout:E=X}catch{E=X}try{typeof clearTimeout=="function"?I=clearTimeout:I=z}catch{I=z}})();function ar(e){if(E===setTimeout)return setTimeout(e,0);if((E===X||!E)&&setTimeout)return E=setTimeout,setTimeout(e,0);try{return E(e,0)}catch{try{return E.call(null,e,0)}catch{return E.call(this,e,0)}}}function tt(e){if(I===clearTimeout)return clearTimeout(e);if((I===z||!I)&&clearTimeout)return I=clearTimeout,clearTimeout(e);try{return I(e)}catch{try{return I.call(null,e)}catch{return I.call(this,e)}}}var T=[],P=!1,N,Y=-1;function et(){!P||!N||(P=!1,N.length?T=N.concat(T):Y=-1,T.length&&pr())}function pr(){if(!P){var e=ar(et);P=!0;for(var r=T.length;r;){for(N=T,T=[];++Y<r;)N&&N[Y].run();Y=-1,r=T.length}N=null,P=!1,tt(e)}}y.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];T.push(new lr(e,r)),T.length===1&&!P&&ar(pr)};function lr(e,r){this.fun=e,this.array=r}lr.prototype.run=function(){this.fun.apply(null,this.array)};y.title="browser";y.browser=!0;y.env={};y.argv=[];y.version="";y.versions={};function S(){}y.on=S;y.addListener=S;y.once=S;y.off=S;y.removeListener=S;y.removeAllListeners=S;y.emit=S;y.prependListener=S;y.prependOnceListener=S;y.listeners=function(e){return[]};y.binding=function(e){throw new Error("process.binding is not supported")};y.cwd=function(){return"/"};y.chdir=function(e){throw new Error("process.chdir is not supported")};y.umask=function(){return 0}});var Br=R(J=>{"use strict";x();J.byteLength=nt;J.toByteArray=ut;J.fromByteArray=ct;var F=[],m=[],it=typeof Uint8Array<"u"?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(M=0,xr=Q.length;M<xr;++M)F[M]=Q[M],m[Q.charCodeAt(M)]=M;var M,xr;m[45]=62;m[95]=63;function gr(e){var r=e.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=e.indexOf("=");t===-1&&(t=r);var i=t===r?0:4-t%4;return[t,i]}function nt(e){var r=gr(e),t=r[0],i=r[1];return(t+i)*3/4-i}function ot(e,r,t){return(r+t)*3/4-t}function ut(e){var r,t=gr(e),i=t[0],n=t[1],o=new it(ot(e,i,n)),u=0,h=n>0?i-4:i,c;for(c=0;c<h;c+=4)r=m[e.charCodeAt(c)]<<18|m[e.charCodeAt(c+1)]<<12|m[e.charCodeAt(c+2)]<<6|m[e.charCodeAt(c+3)],o[u++]=r>>16&255,o[u++]=r>>8&255,o[u++]=r&255;return n===2&&(r=m[e.charCodeAt(c)]<<2|m[e.charCodeAt(c+1)]>>4,o[u++]=r&255),n===1&&(r=m[e.charCodeAt(c)]<<10|m[e.charCodeAt(c+1)]<<4|m[e.charCodeAt(c+2)]>>2,o[u++]=r>>8&255,o[u++]=r&255),o}function ft(e){return F[e>>18&63]+F[e>>12&63]+F[e>>6&63]+F[e&63]}function ht(e,r,t){for(var i,n=[],o=r;o<t;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(ft(i));return n.join("")}function ct(e){for(var r,t=e.length,i=t%3,n=[],o=16383,u=0,h=t-i;u<h;u+=o)n.push(ht(e,u,u+o>h?h:u+o));return i===1?(r=e[t-1],n.push(F[r>>2]+F[r<<4&63]+"==")):i===2&&(r=(e[t-2]<<8)+e[t-1],n.push(F[r>>10]+F[r>>4&63]+F[r<<2&63]+"=")),n.join("")}});var mr=R(Z=>{x();Z.read=function(e,r,t,i,n){var o,u,h=n*8-i-1,c=(1<<h)-1,p=c>>1,a=-7,s=t?n-1:0,k=t?-1:1,d=e[r+s];for(s+=k,o=d&(1<<-a)-1,d>>=-a,a+=h;a>0;o=o*256+e[r+s],s+=k,a-=8);for(u=o&(1<<-a)-1,o>>=-a,a+=i;a>0;u=u*256+e[r+s],s+=k,a-=8);if(o===0)o=1-p;else{if(o===c)return u?NaN:(d?-1:1)*(1/0);u=u+Math.pow(2,i),o=o-p}return(d?-1:1)*u*Math.pow(2,o-i)};Z.write=function(e,r,t,i,n,o){var u,h,c,p=o*8-n-1,a=(1<<p)-1,s=a>>1,k=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:o-1,V=i?1:-1,Kr=r<0||r===0&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(h=isNaN(r)?1:0,u=a):(u=Math.floor(Math.log(r)/Math.LN2),r*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+s>=1?r+=k/c:r+=k*Math.pow(2,1-s),r*c>=2&&(u++,c/=2),u+s>=a?(h=0,u=a):u+s>=1?(h=(r*c-1)*Math.pow(2,n),u=u+s):(h=r*Math.pow(2,s-1)*Math.pow(2,n),u=0));n>=8;e[t+d]=h&255,d+=V,h/=256,n-=8);for(u=u<<n|h,p+=n;p>0;e[t+d]=u&255,d+=V,u/=256,p-=8);e[t+d-V]|=Kr*128}});var Pr=R(q=>{"use strict";x();var v=Br(),$=mr(),dr=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;q.Buffer=f;q.SlowBuffer=wt;q.INSPECT_MAX_BYTES=50;var W=2147483647;q.kMaxLength=W;f.TYPED_ARRAY_SUPPORT=st();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&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.");function st(){try{let e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function C(e){if(e>W)throw new RangeError('The value "'+e+'" is invalid for option "size"');let r=new Uint8Array(e);return Object.setPrototypeOf(r,f.prototype),r}function f(e,r,t){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ir(e)}return Ar(e,r,t)}f.poolSize=8192;function Ar(e,r,t){if(typeof e=="string")return pt(e,r);if(ArrayBuffer.isView(e))return lt(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(A(e,ArrayBuffer)||e&&A(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(A(e,SharedArrayBuffer)||e&&A(e.buffer,SharedArrayBuffer)))return tr(e,r,t);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return f.from(i,r,t);let n=yt(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return f.from(e[Symbol.toPrimitive]("string"),r,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}f.from=function(e,r,t){return Ar(e,r,t)};Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f,Uint8Array);function Ur(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function at(e,r,t){return Ur(e),e<=0?C(e):r!==void 0?typeof t=="string"?C(e).fill(r,t):C(e).fill(r):C(e)}f.alloc=function(e,r,t){return at(e,r,t)};function ir(e){return Ur(e),C(e<0?0:nr(e)|0)}f.allocUnsafe=function(e){return ir(e)};f.allocUnsafeSlow=function(e){return ir(e)};function pt(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!f.isEncoding(r))throw new TypeError("Unknown encoding: "+r);let t=Tr(e,r)|0,i=C(t),n=i.write(e,r);return n!==t&&(i=i.slice(0,n)),i}function rr(e){let r=e.length<0?0:nr(e.length)|0,t=C(r);for(let i=0;i<r;i+=1)t[i]=e[i]&255;return t}function lt(e){if(A(e,Uint8Array)){let r=new Uint8Array(e);return tr(r.buffer,r.byteOffset,r.byteLength)}return rr(e)}function tr(e,r,t){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(t||0))throw new RangeError('"length" is outside of buffer bounds');let i;return r===void 0&&t===void 0?i=new Uint8Array(e):t===void 0?i=new Uint8Array(e,r):i=new Uint8Array(e,r,t),Object.setPrototypeOf(i,f.prototype),i}function yt(e){if(f.isBuffer(e)){let r=nr(e.length)|0,t=C(r);return t.length===0||e.copy(t,0,0,r),t}if(e.length!==void 0)return typeof e.length!="number"||ur(e.length)?C(0):rr(e);if(e.type==="Buffer"&&Array.isArray(e.data))return rr(e.data)}function nr(e){if(e>=W)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+W.toString(16)+" bytes");return e|0}function wt(e){return+e!=e&&(e=0),f.alloc(+e)}f.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==f.prototype};f.compare=function(r,t){if(A(r,Uint8Array)&&(r=f.from(r,r.offset,r.byteLength)),A(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(r)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let i=r.length,n=t.length;for(let o=0,u=Math.min(i,n);o<u;++o)if(r[o]!==t[o]){i=r[o],n=t[o];break}return i<n?-1:n<i?1:0};f.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};f.concat=function(r,t){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return f.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<r.length;++i)t+=r[i].length;let n=f.allocUnsafe(t),o=0;for(i=0;i<r.length;++i){let u=r[i];if(A(u,Uint8Array))o+u.length>n.length?(f.isBuffer(u)||(u=f.from(u)),u.copy(n,o)):Uint8Array.prototype.set.call(n,u,o);else if(f.isBuffer(u))u.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return n};function Tr(e,r){if(f.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||A(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let t=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return er(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return kr(e).length;default:if(n)return i?-1:er(e).length;r=(""+r).toLowerCase(),n=!0}}f.byteLength=Tr;function xt(e,r,t){let i=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,r>>>=0,t<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return Tt(this,r,t);case"utf8":case"utf-8":return Cr(this,r,t);case"ascii":return At(this,r,t);case"latin1":case"binary":return Ut(this,r,t);case"base64":return It(this,r,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return St(this,r,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}f.prototype._isBuffer=!0;function L(e,r,t){let i=e[r];e[r]=e[t],e[t]=i}f.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)L(this,t,t+1);return this};f.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)L(this,t,t+3),L(this,t+1,t+2);return this};f.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)L(this,t,t+7),L(this,t+1,t+6),L(this,t+2,t+5),L(this,t+3,t+4);return this};f.prototype.toString=function(){let r=this.length;return r===0?"":arguments.length===0?Cr(this,0,r):xt.apply(this,arguments)};f.prototype.toLocaleString=f.prototype.toString;f.prototype.equals=function(r){if(!f.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:f.compare(this,r)===0};f.prototype.inspect=function(){let r="",t=q.INSPECT_MAX_BYTES;return r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(r+=" ... "),"<Buffer "+r+">"};dr&&(f.prototype[dr]=f.prototype.inspect);f.prototype.compare=function(r,t,i,n,o){if(A(r,Uint8Array)&&(r=f.from(r,r.offset,r.byteLength)),!f.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0&&(t=0),i===void 0&&(i=r?r.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>r.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===r)return 0;let u=o-n,h=i-t,c=Math.min(u,h),p=this.slice(n,o),a=r.slice(t,i);for(let s=0;s<c;++s)if(p[s]!==a[s]){u=p[s],h=a[s];break}return u<h?-1:h<u?1:0};function Sr(e,r,t,i,n){if(e.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,ur(t)&&(t=n?0:e.length-1),t<0&&(t=e.length+t),t>=e.length){if(n)return-1;t=e.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof r=="string"&&(r=f.from(r,i)),f.isBuffer(r))return r.length===0?-1:Er(e,r,t,i,n);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,r,t):Uint8Array.prototype.lastIndexOf.call(e,r,t):Er(e,[r],t,i,n);throw new TypeError("val must be string, number or Buffer")}function Er(e,r,t,i,n){let o=1,u=e.length,h=r.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||r.length<2)return-1;o=2,u/=2,h/=2,t/=2}function c(a,s){return o===1?a[s]:a.readUInt16BE(s*o)}let p;if(n){let a=-1;for(p=t;p<u;p++)if(c(e,p)===c(r,a===-1?0:p-a)){if(a===-1&&(a=p),p-a+1===h)return a*o}else a!==-1&&(p-=p-a),a=-1}else for(t+h>u&&(t=u-h),p=t;p>=0;p--){let a=!0;for(let s=0;s<h;s++)if(c(e,p+s)!==c(r,s)){a=!1;break}if(a)return p}return-1}f.prototype.includes=function(r,t,i){return this.indexOf(r,t,i)!==-1};f.prototype.indexOf=function(r,t,i){return Sr(this,r,t,i,!0)};f.prototype.lastIndexOf=function(r,t,i){return Sr(this,r,t,i,!1)};function gt(e,r,t,i){t=Number(t)||0;let n=e.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;let o=r.length;i>o/2&&(i=o/2);let u;for(u=0;u<i;++u){let h=parseInt(r.substr(u*2,2),16);if(ur(h))return u;e[t+u]=h}return u}function Bt(e,r,t,i){return j(er(r,e.length-t),e,t,i)}function mt(e,r,t,i){return j(bt(r),e,t,i)}function dt(e,r,t,i){return j(kr(r),e,t,i)}function Et(e,r,t,i){return j(Nt(r,e.length-t),e,t,i)}f.prototype.write=function(r,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),r.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return gt(this,r,t,i);case"utf8":case"utf-8":return Bt(this,r,t,i);case"ascii":case"latin1":case"binary":return mt(this,r,t,i);case"base64":return dt(this,r,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Et(this,r,t,i);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function It(e,r,t){return r===0&&t===e.length?v.fromByteArray(e):v.fromByteArray(e.slice(r,t))}function Cr(e,r,t){t=Math.min(e.length,t);let i=[],n=r;for(;n<t;){let o=e[n],u=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h<=t){let c,p,a,s;switch(h){case 1:o<128&&(u=o);break;case 2:c=e[n+1],(c&192)===128&&(s=(o&31)<<6|c&63,s>127&&(u=s));break;case 3:c=e[n+1],p=e[n+2],(c&192)===128&&(p&192)===128&&(s=(o&15)<<12|(c&63)<<6|p&63,s>2047&&(s<55296||s>57343)&&(u=s));break;case 4:c=e[n+1],p=e[n+2],a=e[n+3],(c&192)===128&&(p&192)===128&&(a&192)===128&&(s=(o&15)<<18|(c&63)<<12|(p&63)<<6|a&63,s>65535&&s<1114112&&(u=s))}}u===null?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023),i.push(u),n+=h}return Ft(i)}var Ir=4096;function Ft(e){let r=e.length;if(r<=Ir)return String.fromCharCode.apply(String,e);let t="",i=0;for(;i<r;)t+=String.fromCharCode.apply(String,e.slice(i,i+=Ir));return t}function At(e,r,t){let i="";t=Math.min(e.length,t);for(let n=r;n<t;++n)i+=String.fromCharCode(e[n]&127);return i}function Ut(e,r,t){let i="";t=Math.min(e.length,t);for(let n=r;n<t;++n)i+=String.fromCharCode(e[n]);return i}function Tt(e,r,t){let i=e.length;(!r||r<0)&&(r=0),(!t||t<0||t>i)&&(t=i);let n="";for(let o=r;o<t;++o)n+=Mt[e[o]];return n}function St(e,r,t){let i=e.slice(r,t),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}f.prototype.slice=function(r,t){let i=this.length;r=~~r,t=t===void 0?i:~~t,r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<r&&(t=r);let n=this.subarray(r,t);return Object.setPrototypeOf(n,f.prototype),n};function w(e,r,t){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>t)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r],o=1,u=0;for(;++u<t&&(o*=256);)n+=this[r+u]*o;return n};f.prototype.readUintBE=f.prototype.readUIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r+--t],o=1;for(;t>0&&(o*=256);)n+=this[r+--t]*o;return n};f.prototype.readUint8=f.prototype.readUInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]};f.prototype.readUint16LE=f.prototype.readUInt16LE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]|this[r+1]<<8};f.prototype.readUint16BE=f.prototype.readUInt16BE=function(r,t){return r=r>>>0,t||w(r,2,this.length),this[r]<<8|this[r+1]};f.prototype.readUint32LE=f.prototype.readUInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216};f.prototype.readUint32BE=f.prototype.readUInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])};f.prototype.readBigUInt64LE=b(function(r){r=r>>>0,O(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&H(r,this.length-8);let n=t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,o=this[++r]+this[++r]*2**8+this[++r]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});f.prototype.readBigUInt64BE=b(function(r){r=r>>>0,O(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&H(r,this.length-8);let n=t*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],o=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});f.prototype.readIntLE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=this[r],o=1,u=0;for(;++u<t&&(o*=256);)n+=this[r+u]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};f.prototype.readIntBE=function(r,t,i){r=r>>>0,t=t>>>0,i||w(r,t,this.length);let n=t,o=1,u=this[r+--n];for(;n>0&&(o*=256);)u+=this[r+--n]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*t)),u};f.prototype.readInt8=function(r,t){return r=r>>>0,t||w(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]};f.prototype.readInt16LE=function(r,t){r=r>>>0,t||w(r,2,this.length);let i=this[r]|this[r+1]<<8;return i&32768?i|4294901760:i};f.prototype.readInt16BE=function(r,t){r=r>>>0,t||w(r,2,this.length);let i=this[r+1]|this[r]<<8;return i&32768?i|4294901760:i};f.prototype.readInt32LE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24};f.prototype.readInt32BE=function(r,t){return r=r>>>0,t||w(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]};f.prototype.readBigInt64LE=b(function(r){r=r>>>0,O(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&H(r,this.length-8);let n=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)});f.prototype.readBigInt64BE=b(function(r){r=r>>>0,O(r,"offset");let t=this[r],i=this[r+7];(t===void 0||i===void 0)&&H(r,this.length-8);let n=(t<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(n)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+i)});f.prototype.readFloatLE=function(r,t){return r=r>>>0,t||w(r,4,this.length),$.read(this,r,!0,23,4)};f.prototype.readFloatBE=function(r,t){return r=r>>>0,t||w(r,4,this.length),$.read(this,r,!1,23,4)};f.prototype.readDoubleLE=function(r,t){return r=r>>>0,t||w(r,8,this.length),$.read(this,r,!0,52,8)};f.prototype.readDoubleBE=function(r,t){return r=r>>>0,t||w(r,8,this.length),$.read(this,r,!1,52,8)};function B(e,r,t,i,n,o){if(!f.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>n||r<o)throw new RangeError('"value" argument is out of bounds');if(t+i>e.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;B(this,r,t,i,h,0)}let o=1,u=0;for(this[t]=r&255;++u<i&&(o*=256);)this[t+u]=r/o&255;return t+i};f.prototype.writeUintBE=f.prototype.writeUIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;B(this,r,t,i,h,0)}let o=i-1,u=1;for(this[t+o]=r&255;--o>=0&&(u*=256);)this[t+o]=r/u&255;return t+i};f.prototype.writeUint8=f.prototype.writeUInt8=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,1,255,0),this[t]=r&255,t+1};f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,2,65535,0),this[t]=r&255,this[t+1]=r>>>8,t+2};f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,2,65535,0),this[t]=r>>>8,this[t+1]=r&255,t+2};f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,4,4294967295,0),this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4};f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,4,4294967295,0),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};function Rr(e,r,t,i,n){Lr(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o,o=o>>8,e[t++]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,u=u>>8,e[t++]=u,t}function _r(e,r,t,i,n){Lr(r,i,n,e,t,7);let o=Number(r&BigInt(4294967295));e[t+7]=o,o=o>>8,e[t+6]=o,o=o>>8,e[t+5]=o,o=o>>8,e[t+4]=o;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[t+3]=u,u=u>>8,e[t+2]=u,u=u>>8,e[t+1]=u,u=u>>8,e[t]=u,t+8}f.prototype.writeBigUInt64LE=b(function(r,t=0){return Rr(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeBigUInt64BE=b(function(r,t=0){return _r(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeIntLE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let c=Math.pow(2,8*i-1);B(this,r,t,i,c-1,-c)}let o=0,u=1,h=0;for(this[t]=r&255;++o<i&&(u*=256);)r<0&&h===0&&this[t+o-1]!==0&&(h=1),this[t+o]=(r/u>>0)-h&255;return t+i};f.prototype.writeIntBE=function(r,t,i,n){if(r=+r,t=t>>>0,!n){let c=Math.pow(2,8*i-1);B(this,r,t,i,c-1,-c)}let o=i-1,u=1,h=0;for(this[t+o]=r&255;--o>=0&&(u*=256);)r<0&&h===0&&this[t+o+1]!==0&&(h=1),this[t+o]=(r/u>>0)-h&255;return t+i};f.prototype.writeInt8=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,1,127,-128),r<0&&(r=255+r+1),this[t]=r&255,t+1};f.prototype.writeInt16LE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,2,32767,-32768),this[t]=r&255,this[t+1]=r>>>8,t+2};f.prototype.writeInt16BE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,2,32767,-32768),this[t]=r>>>8,this[t+1]=r&255,t+2};f.prototype.writeInt32LE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,4,2147483647,-2147483648),this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4};f.prototype.writeInt32BE=function(r,t,i){return r=+r,t=t>>>0,i||B(this,r,t,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4};f.prototype.writeBigInt64LE=b(function(r,t=0){return Rr(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});f.prototype.writeBigInt64BE=b(function(r,t=0){return _r(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function br(e,r,t,i,n,o){if(t+i>e.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Nr(e,r,t,i,n){return r=+r,t=t>>>0,n||br(e,r,t,4,34028234663852886e22,-34028234663852886e22),$.write(e,r,t,i,23,4),t+4}f.prototype.writeFloatLE=function(r,t,i){return Nr(this,r,t,!0,i)};f.prototype.writeFloatBE=function(r,t,i){return Nr(this,r,t,!1,i)};function Mr(e,r,t,i,n){return r=+r,t=t>>>0,n||br(e,r,t,8,17976931348623157e292,-17976931348623157e292),$.write(e,r,t,i,52,8),t+8}f.prototype.writeDoubleLE=function(r,t,i){return Mr(this,r,t,!0,i)};f.prototype.writeDoubleBE=function(r,t,i){return Mr(this,r,t,!1,i)};f.prototype.copy=function(r,t,i,n){if(!f.isBuffer(r))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=r.length&&(t=r.length),t||(t=0),n>0&&n<i&&(n=i),n===i||r.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=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),r.length-t<n-i&&(n=r.length-t+i);let o=n-i;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(r,this.subarray(i,n),t),o};f.prototype.fill=function(r,t,i,n){if(typeof r=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(r.length===1){let u=r.charCodeAt(0);(n==="utf8"&&u<128||n==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,r||(r=0);let o;if(typeof r=="number")for(o=t;o<i;++o)this[o]=r;else{let u=f.isBuffer(r)?r:f.from(r,n),h=u.length;if(h===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=u[o%h]}return this};var D={};function or(e,r,t){D[e]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);or("ERR_INVALID_ARG_TYPE",function(e,r){return`The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError);or("ERR_OUT_OF_RANGE",function(e,r,t){let i=`The value of "${e}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=Fr(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=Fr(n)),n+="n"),i+=` It must be ${r}. Received ${n}`,i},RangeError);function Fr(e){let r="",t=e.length,i=e[0]==="-"?1:0;for(;t>=i+4;t-=3)r=`_${e.slice(t-3,t)}${r}`;return`${e.slice(0,t)}${r}`}function Ct(e,r,t){O(r,"offset"),(e[r]===void 0||e[r+t]===void 0)&&H(r,e.length-(t+1))}function Lr(e,r,t,i,n,o){if(e>t||e<r){let u=typeof r=="bigint"?"n":"",h;throw o>3?r===0||r===BigInt(0)?h=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:h=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:h=`>= ${r}${u} and <= ${t}${u}`,new D.ERR_OUT_OF_RANGE("value",h,e)}Ct(i,n,o)}function O(e,r){if(typeof e!="number")throw new D.ERR_INVALID_ARG_TYPE(r,"number",e)}function H(e,r,t){throw Math.floor(e)!==e?(O(e,t),new D.ERR_OUT_OF_RANGE(t||"offset","an integer",e)):r<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${r}`,e)}var Rt=/[^+/0-9A-Za-z-_]/g;function _t(e){if(e=e.split("=")[0],e=e.trim().replace(Rt,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function er(e,r){r=r||1/0;let t,i=e.length,n=null,o=[];for(let u=0;u<i;++u){if(t=e.charCodeAt(u),t>55295&&t<57344){if(!n){if(t>56319){(r-=3)>-1&&o.push(239,191,189);continue}else if(u+1===i){(r-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(r-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(r-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((r-=1)<0)break;o.push(t)}else if(t<2048){if((r-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((r-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((r-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function bt(e){let r=[];for(let t=0;t<e.length;++t)r.push(e.charCodeAt(t)&255);return r}function Nt(e,r){let t,i,n,o=[];for(let u=0;u<e.length&&!((r-=2)<0);++u)t=e.charCodeAt(u),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function kr(e){return v.toByteArray(_t(e))}function j(e,r,t,i){let n;for(n=0;n<i&&!(n+t>=r.length||n>=e.length);++n)r[n+t]=e[n];return n}function A(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function ur(e){return e!==e}var Mt=(function(){let e="0123456789abcdef",r=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)r[i+n]=e[t]+e[n]}return r})();function b(e){return typeof BigInt>"u"?Lt:e}function Lt(){throw new Error("BigInt not supported")}});var _,g,x=vr(()=>{_=sr(wr()),g=sr(Pr())});var fr=R((Qt,Dr)=>{x();Dr.exports=(typeof globalThis<"u"?globalThis:typeof self<"u"?self:window).bsv});var Hr=R((vt,Gr)=>{"use strict";x();var U=fr(),K=U.deps._,kt=U.PrivateKey,Pt=U.PublicKey,$r=U.Address,Or=U.encoding.BufferWriter,hr=U.crypto.ECDSA,qr=U.crypto.Signature,Dt=U.crypto.Hash.sha256sha256,$t=U.util.js,G=U.util.preconditions,l=function e(r){return this instanceof e?(G.checkArgument(K.isString(r)||g.Buffer.isBuffer(r),"First argument should be a string or Buffer"),K.isString(r)&&(this.messageBuffer=g.Buffer.from(r)),g.Buffer.isBuffer(r)&&(this.messageBuffer=r),this):new e(r)};l.sign=function(e,r){return new l(e).sign(r)};l.verify=function(e,r,t){return new l(e).verify(r,t)};l.MAGIC_BYTES=g.Buffer.from(`Bitcoin Signed Message:
|
|
2
|
+
`);l.prototype.magicHash=function(){var r=Or.varintBufNum(l.MAGIC_BYTES.length),t=Or.varintBufNum(this.messageBuffer.length),i=g.Buffer.concat([r,l.MAGIC_BYTES,t,this.messageBuffer]),n=Dt(i);return n};l.prototype._sign=function(r){G.checkArgument(r instanceof kt,"First argument should be an instance of PrivateKey");var t=this.magicHash();return hr.signWithCalcI(t,r)};l.prototype.sign=function(r){var t=this._sign(r);return t.toCompact().toString("base64")};l.prototype._verify=function(r,t){G.checkArgument(r instanceof Pt,"First argument should be an instance of PublicKey"),G.checkArgument(t instanceof qr,"Second argument should be an instance of Signature");var i=this.magicHash(),n=hr.verify(i,t,r);return n||(this.error="The signature was invalid"),n};l.prototype.verify=function(r,t){G.checkArgument(r),G.checkArgument(t&&K.isString(t)),K.isString(r)&&(r=$r.fromString(r));var i=qr.fromCompact(g.Buffer.from(t,"base64")),n=new hr;n.hashbuf=this.magicHash(),n.sig=i;var o=n.toPublicKey(),u=$r.fromPublicKey(o,r.network);return r.toString()!==u.toString()?(this.error="The signature did not match the message digest",!1):this._verify(o,i)};l.fromString=function(e){return new l(e)};l.fromJSON=function(r){return $t.isValidJSON(r)&&(r=JSON.parse(r)),l.fromObject(r)};l.prototype.toObject=function(){return{messageHex:this.messageBuffer.toString("hex")}};l.fromObject=function(e){let r=g.Buffer.from(e.messageHex,"hex");return new l(r)};l.prototype.toJSON=function(){return JSON.stringify(this.toObject())};l.prototype.toString=function(){return this.messageBuffer.toString()};l.prototype.inspect=function(){return"<Message: "+this.toString()+">"};Gr.exports=l});var Wr=R((te,Jr)=>{x();var Yr=fr();Yr.Message=Hr();Jr.exports=Yr.Message});var Ot=R((ie,jr)=>{x();jr.exports=Wr()});return Ot();})();
|
|
3
|
+
if(typeof module!=="undefined"&&module.exports){module.exports=bsvMessage}else if(typeof define==="function"&&define.amd){define([],function(){return bsvMessage})}
|