@gibme/crypto-browser 20.0.1 → 22.0.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/dist/Crypto.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see Crypto.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(()=>{return e={156:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Crypto=void 0;const o=r(319),s=r(672);i(r(319),t);class a extends o.CryptoModule{constructor(){super()}static async init(e={}){if(this.external_library=e,!this.runtime_configuration.library){if(await this.load_wasm_library())return new a;if(await this.load_js_library())return new a;throw new Error("Could not initialize an underlying library")}return new a}static async force_js_library(){return this.load_js_library()}static async force_wasm_library(){return this.load_wasm_library()}static async load(e){return!!await a.url_exists(e)&&new Promise(((t,r)=>{const n=document.createElement("script");n.src=e,n.defer=!0,n.async=!1,n.crossOrigin="anonymous",n.referrerPolicy="no-referrer",n.addEventListener("load",(()=>t(!0))),n.addEventListener("error",(()=>function(e){return r(new Error(e.message))})),document.head.appendChild(n)}))}static async load_library(e,t){if(!await this.load(e))return!1;if(!window.CryptoModule)return!1;const r=await new window.CryptoModule;return 0!==Object.getOwnPropertyNames(r).length&&void 0!==r.sha3&&(o.CryptoModule.runtime_configuration={type:t,library:r},!0)}static async load_js_library(){return!!await this.load_library(`https://cdn.jsdelivr.net/npm/@gibme/crypto@${s.version}/dist/src/loaders/crypto-module.js`,o.CryptoModule.Type.JS)||this.load_library("https://testmodule.pages.dev/crypto-module.js",o.CryptoModule.Type.JS)}static async load_wasm_library(){return!!await this.load_library(`https://cdn.jsdelivr.net/npm/@gibme/crypto@${s.version}/dist/src/loaders/crypto-module-wasm.js`,o.CryptoModule.Type.WASM)||this.load_library("https://testmodule.pages.dev/crypto-module-wasm.js",o.CryptoModule.Type.WASM)}static async url_exists(e){return(await fetch(e,{method:"HEAD"})).ok}}t.default=a,t.Crypto=a},251:(e,t)=>{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,h=r?i-1:0,l=r?-1:1,p=e[t+h];for(h+=l,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+h],h+=l,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=c}return(p?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,y=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=y,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+p]=255&s,p+=y,s/=256,c-=8);e[r+p-y]|=128*g}},274:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},287:(e,t,r)=>{"use strict";const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const i=function(e){if(u.isBuffer(e)){const t=0|y(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)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 h(e){return f(e),a(e<0?0:0|y(e))}function l(e){const t=e.length<0?0:0|y(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function y(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(i)return n?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function _(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function d(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(e,o+n)!==c(t,n)){r=!1;break}if(r)return o}return-1}function w(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Z(n))return s;e[r+s]=n}return s}function x(e,t,r,n){return K(W(t,e.length-r),e,r,n)}function E(e,t,r,n){return K(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return K(Y(t),e,r,n)}function B(e,t,r,n){return K(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}t.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){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(e,t,r){return c(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return f(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},u.allocUnsafe=function(e){return h(e)},u.allocUnsafeSlow=function(e){return h(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(V(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).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(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=u.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(V(t,Uint8Array))i+t.length>n.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)d(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)d(this,t,t+3),d(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)d(this,t,t+7),d(this,t+1,t+6),d(this,t+2,t+5),d(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):_.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),c=this.slice(n,i),f=e.slice(t,r);for(let e=0;e<a;++e)if(c[e]!==f[e]){o=c[e],s=f[e];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,t,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 k=4096;function S(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function O(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function N(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=q[e[n]];return i}function U(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function L(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function R(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function C(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function M(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||T(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||T(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=X((function(e,t=0){return R(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=X((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=X((function(e,t=0){return R(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=X((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=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===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=u.isBuffer(e)?e:u.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const $={};function J(e,t,r){$[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function D(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function H(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===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}`:`>= ${t}${n} and <= ${r}${n}`,new $.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){F(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(n,i,o)}function F(e,t){if("number"!=typeof e)throw new $.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw F(e,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}J("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),J("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),J("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" 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 ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},319:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoModule=void 0;const o=r(429),s=r(287);i(r(274),t);class a{constructor(){}static get external_library(){return this._external_library}static set external_library(e){for(const t of Object.keys(e))this._external_library[t]=e[t]}set external_library(e){a.external_library=e}static get library_name(){return a.typeToString(this.runtime_configuration.type)}static get library_type(){return this.runtime_configuration.type}static get is_native(){return this.runtime_configuration.type===a.Type.NODE}get external_library(){return a.external_library}get library_name(){return a.library_name}get library_type(){return a.library_type}get is_native(){return a.is_native}static is_hex(e){return/^[0-9a-f]+$/i.test(e)}static make_module_result(e,t,r){const n={error:e,result:t};return r&&(n.error_message=r),JSON.stringify(n)}static languageToString(e){switch(e){case a.Language.CHINESE_SIMPLIFIED:return"Chinese (simplified)";case a.Language.CHINESE_TRADITIONAL:return"Chinese (traditional)";case a.Language.CZECH:return"Czech";case a.Language.ENGLISH:return"English";case a.Language.FRENCH:return"French";case a.Language.ITALIAN:return"Italian";case a.Language.JAPANESE:return"Japanese";case a.Language.KOREAN:return"Korean";case a.Language.PORTUGUESE:return"Portuguese";case a.Language.SPANISH:return"Spanish";default:return"Unknown"}}static typeToString(e){switch(e){case a.Type.NODE:return"Node C++ Addon";case a.Type.WASM:return"WASM.js Library";case a.Type.JS:return"Javascript asm.js (slow)";default:return"unknown"}}async base58_address_encode(e,t,r){return r?this.execute("base58_address_encode",{prefix:e,public_spend:t,public_view:r}):this.execute("base58_address_encode",{prefix:e,public_key:t})}async cn_base58_address_encode(e,t,r){return r?this.execute("cn_base58_address_encode",{prefix:e,public_spend:t,public_view:r}):this.execute("cn_base58_address_encode",{prefix:e,public_key:t})}async base58_address_decode(e){const t=await this.execute("base58_address_decode",e);return t.public_view&&o.uint256.from(t.public_view).value===BigInt(1)&&delete t.public_view,t}async cn_base58_address_decode(e){const t=await this.execute("cn_base58_address_decode",e);return t.public_view&&o.uint256.from(t.public_view).value===BigInt(1)&&delete t.public_view,t}async random_entropy(e,t=256,r=!0){return await this.execute("random_entropy",{entropy:null!=e?e:"",bits:t,encode_timestamp:r})}async random_hash(){return await this.execute("random_hash")}async random_hashes(e=1){return await this.execute("random_hashes",e)}async random_scalar(){return await this.execute("random_scalar")}async random_scalars(e=1){return await this.execute("random_scalars",e)}async random_point(){return await this.execute("random_point")}async random_points(e=1){return await this.execute("random_points",e)}async sha256(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha256",e)}async sha384(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha384",e)}async sha512(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha512",e)}async sha3(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha3",e)}async sha3_slow(e,t=0){return this.execute("sha3_slow",{input:e,iterations:t})}async blake2b(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("blake2b",e)}async argon2i(e,t=1,r=256,n=1){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("argon2i",{input:e,iterations:t,memory:r,threads:n})}async argon2d(e,t=1,r=256,n=1){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("argon2d",{input:e,iterations:t,memory:r,threads:n})}async argon2id(e,t=1,r=256,n=1){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("argon2id",{input:e,iterations:t,memory:r,threads:n})}async entropy_recover(e,t=a.Language.ENGLISH){return Array.isArray(e)&&(e=e.join(" ")),this.execute("entropy_recover",{input:e,language:t})}async generate_derivation(e,t){return this.execute("generate_derivation",{public_key:e,secret_key:t})}async generate_derivation_scalar(e,t=0){return this.execute("generate_derivation_scalar",{derivation:e,output_index:t})}async derive_public_key(e,t){return this.execute("derive_public_key",{derivation_scalar:e,public_key:t})}async derive_secret_key(e,t){return this.execute("derive_secret_key",{derivation_scalar:e,secret_key:t})}async generate_key_image(e,t){return this.execute("generate_key_image",{public_ephemeral:e,secret_ephemeral:t})}async generate_key_image_v2(e){return this.execute("generate_key_image_v2",e)}async generate_keys(){return this.execute("generate_keys")}async generate_keys_m(e=1){return this.execute("generate_keys_m",e)}async underive_public_key(e,t,r=0){return this.execute("underive_public_key",{derivation:e,output_index:r,public_ephemeral:t})}async secret_key_to_public_key(e){return this.execute("secret_key_to_public_key",e)}async private_key_to_keys(e){return this.execute("private_key_to_keys",e)}async hash_to_point(e){return e instanceof s.Buffer?this.execute("hash_to_point",e.toString("hex")):("string"!=typeof e&&(e=JSON.stringify(e)),this.execute("hash_to_point",e))}async hash_to_scalar(e){return e instanceof s.Buffer?this.execute("hash_to_scalar",e.toString("hex")):("string"!=typeof e&&(e=JSON.stringify(e)),this.execute("hash_to_scalar",e))}async scalar_reduce(e){return e instanceof s.Buffer?this.execute("scalar_reduce",e.subarray(0,32).toString("hex")):this.execute("scalar_reduce",e)}async tree_depth(e){return this.execute("tree_depth",e)}async root_hash(e){return this.execute("root_hash",{items:e})}async root_hash_from_branch(e,t,r=0,n=0){return this.execute("root_hash_from_branch",{branches:e,depth:r,leaf:t,path:n})}async tree_branch(e){return this.execute("tree_branch",{items:e})}async generate_rfc8032_signature(e,t){return this.execute("generate_rfc8032_signature",{message:e,secret_key:t})}async check_rfc8032_signature(e,t,r){try{return await this.execute("check_rfc8032_signature",{message:e,public_key:t,signature:r}),!0}catch(e){return!1}}async generate_signature(e,t){return this.execute("generate_signature",{message_digest:e,secret_key:t})}async prepare_signature(e,t){return this.execute("prepare_signature",{message_digest:e,public_key:t})}async complete_signature(e,t){return this.execute("complete_signature",{secret_key:e,signature:t})}async check_signature(e,t,r){try{return await this.execute("check_signature",{message_digest:e,public_key:t,signature:r}),!0}catch(e){return!1}}async generate_borromean_signature(e,t,r){return this.execute("generate_borromean_signature",{message_digest:e,secret_ephemeral:t,public_keys:r})}async prepare_borromean_signature(e,t,r,n){return this.execute("prepare_borromean_signature",{message_digest:e,key_image:t,public_keys:r,real_output_index:n})}async complete_borromean_signature(e,t,r){return this.execute("complete_borromean_signature",{secret_ephemeral:e,real_output_index:t,signature:r})}async check_borromean_signature(e,t,r,n){try{return await this.execute("check_borromean_signature",{message_digest:e,key_image:t,public_keys:r,signature:n}),!0}catch(e){return!1}}async generate_clsag_signature(e,t,r,n,i,o,s){const a={message_digest:e,secret_ephemeral:t,public_keys:r};return n&&(a.input_blinding_factor=n),i&&(a.public_commitments=i),o&&(a.pseudo_blinding_factor=o),s&&(a.pseudo_commitment=s),this.execute("generate_clsag_signature",a)}async prepare_clsag_signature(e,t,r,n,i,o,s,a){const u={message_digest:e,key_image:t,public_keys:r,real_output_index:n};return i&&(u.input_blinding_factor=i),o&&(u.public_commitments=o),s&&(u.pseudo_blinding_factor=s),a&&(u.pseudo_commitment=a),this.execute("prepare_clsag_signature",u)}async complete_clsag_signature(e,t,r,n,i){return this.execute("complete_clsag_signature",{secret_ephemeral:e,real_output_index:t,signature:r,h:n,mu_P:i})}async check_clsag_signature(e,t,r,n,i){try{const o={message_digest:e,key_image:t,public_keys:r,signature:n};return i&&(o.commitments=i),await this.execute("check_clsag_signature",o),!0}catch(e){return!1}}async generate_triptych_signature(e,t,r,n,i,o,s){const a={message_digest:e,secret_ephemeral:t,public_keys:r};return n&&(a.input_blinding_factor=n),i&&(a.public_commitments=i),o&&(a.pseudo_blinding_factor=o),s&&(a.pseudo_commitment=s),this.execute("generate_triptych_signature",a)}async prepare_triptych_signature(e,t,r,n,i,o,s,a){const u={message_digest:e,key_image:t,public_keys:r,real_output_index:n};return i&&(u.input_blinding_factor=i),o&&(u.public_commitments=o),s&&(u.pseudo_blinding_factor=s),a&&(u.pseudo_commitment=a),this.execute("prepare_triptych_signature",u)}async complete_triptych_signature(e,t,r){return this.execute("complete_triptych_signature",{secret_ephemeral:e,signature:t,xpow:r})}async check_triptych_signature(e,t,r,n,i){try{const o={message_digest:e,key_image:t,public_keys:r,signature:n};return i&&(o.commitments=i),await this.execute("check_triptych_signature",o),!0}catch(e){return!1}}async generate_bulletproof(e,t,r=64){return this.execute("generate_bulletproof",{amounts:e,blinding_factors:t,N:r})}async check_bulletproof(e,t,r=64){try{return Array.isArray(e)&&Array.isArray(t[0])?await this.execute("check_bulletproof_batch",{proofs:e,commitments:t,N:r}):await this.execute("check_bulletproof",{proof:e,commitments:t,N:r}),!0}catch(e){return!1}}async generate_bulletproof_plus(e,t,r=64){return this.execute("generate_bulletproof",{amounts:e,blinding_factors:t,N:r})}async check_bulletproof_plus(e,t,r=64){try{return Array.isArray(e)&&Array.isArray(t[0])?await this.execute("check_bulletproof_batch",{proofs:e,commitments:t,N:r}):await this.execute("check_bulletproof",{proof:e,commitments:t,N:r}),!0}catch(e){return!1}}async check_commitments_parity(e,t,r){try{return await this.execute("check_commitments_parity",{pseudo_commitments:e,output_commitments:t,transaction_fee:r}),!0}catch(e){return!1}}async generate_amount_mask(e){return this.execute("generate_amount_mask",e)}async generate_commitment_blinding_factor(e){return this.execute("generate_commitment_blinding_factor",e)}async generate_pedersen_commitment(e,t){return this.execute("generate_pedersen_commitment",{blinding_factor:e,amount:t})}async generate_pseudo_commitments(e,t){return this.execute("generate_pseudo_commitments",{amounts:e,output_blinding_factors:t})}async toggle_masked_amount(e,t){"number"==typeof t?t=BigInt(t):"string"==typeof t&&(t=o.uint256.from(t).value);const r=await this.execute("toggle_masked_amount",{amount_mask:e,amount:(0,o.uint256)(t).toString()});return o.uint256.from(r).value}async generate_outputs_proof(e){return this.execute("generate_outputs_proof",{items:e})}async check_outputs_proof(e,t){return this.execute("check_outputs_proof",{public_ephemerals:e,proof:t})}async base58_encode(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("base58_encode",e.toString("hex"))}async base58_encode_check(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("base58_encode_check",e.toString("hex"))}async base58_decode(e){const t=await this.execute("base58_decode",e);return s.Buffer.from(t,"hex")}async base58_decode_check(e){const t=await this.execute("base58_decode_check",e);return s.Buffer.from(t,"hex")}async cn_base58_encode(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("cn_base58_encode",e.toString("hex"))}async cn_base58_encode_check(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("cn_base58_encode_check",e.toString("hex"))}async cn_base58_decode(e){const t=await this.execute("cn_base58_decode",e);return s.Buffer.from(t,"hex")}async cn_base58_decode_check(e){const t=await this.execute("cn_base58_decode_check",e);return s.Buffer.from(t,"hex")}async generate_transaction_fee_commitment(e){return this.generate_pedersen_commitment("".padEnd(64,"0"),e)}async check_scalar(e){try{return await this.execute("check_scalar",e),!0}catch(e){return!1}}async check_point(e){try{return await this.execute("check_point",e),!0}catch(e){return!1}}async mnemonics_encode(e,t=a.Language.ENGLISH){return(await this.execute("mnemonics_encode",{entropy:e,language:t})).split(" ")}async mnemonics_decode(e,t=a.Language.ENGLISH){return Array.isArray(e)&&(e=e.join(" ")),this.execute("mnemonics_decode",{input:e,language:t})}async mnemonics_word_index(e,t=a.Language.ENGLISH){return this.execute("mnemonics_word_index",{input:e,language:t})}async word_list(e=a.Language.ENGLISH){return(await this.execute("word_list",{language:e})).split(" ")}async word_list_trimmed(e=a.Language.ENGLISH){return(await this.execute("word_list_trimmed",{language:e})).split(" ")}async calculate_base2_exponent(e){return this.execute("calculate_base2_exponent",e)}async aes_encrypt(e,t,r){"string"!=typeof e&&(e=JSON.stringify(e));const n={input:e,password:t};return r&&(n.iterations=r),this.execute("aes_encrypt",n)}async aes_decrypt(e,t,r){const n={input:e,password:t};return r&&(n.iterations=r),this.execute("aes_decrypt",n)}async languages(){return this.execute("languages")}async generate_seed(e,t=""){return this.execute("generate_seed",{entropy:e,passphrase:t})}async generate_child_key(e,t,r,n,i,o,s="ed25519 seed"){const a={seed:e,hmac_key:s};return"string"==typeof t?a.path=t.toLowerCase():(void 0!==t&&(a.purpose=t),void 0!==r&&(a.coin_type=r),void 0!==n&&(a.account=n),void 0!==i&&(a.change=i),void 0!==o&&(a.address_index=o)),this.execute("generate_child_key",a)}make_path(e,t,r,n,i){if("string"==typeof e)return e.toLowerCase();let o="m";return void 0!==e&&(o+=`/${e}'`,void 0!==t&&(o+=`/${t}'`,void 0!==r&&(o+=`/${r}'`,void 0!==n&&(o+=`/${n}'`,void 0!==i&&(o+=`/${i}'`))))),o}async execute(e,t){var r;const n=(()=>void 0!==this.external_library[e]?this.external_library[e]:a.runtime_configuration.library&&void 0!==a.runtime_configuration.library[e]?a.runtime_configuration.library[e]:void 0)();if(!n)throw new Error(`0x01: Method Not Found. ${e}(${t?JSON.stringify(t):""})`);let i;i=t?await n(JSON.stringify(t)):await n();const o=JSON.parse(i);if(o.error)throw new Error(null!==(r=o.error_message)&&void 0!==r?r:`0x04: An unknown error occurred: ${e}(${t?JSON.stringify(t):""})`);return o.result}}t.CryptoModule=a,a.runtime_configuration={type:0},a._external_library={},function(e){let t,r;!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NODE=1]="NODE",e[e.WASM=2]="WASM",e[e.JS=3]="JS"}(t=e.Type||(e.Type={})),function(e){e[e.CHINESE_SIMPLIFIED=0]="CHINESE_SIMPLIFIED",e[e.CHINESE_TRADITIONAL=1]="CHINESE_TRADITIONAL",e[e.CZECH=2]="CZECH",e[e.ENGLISH=3]="ENGLISH",e[e.FRENCH=4]="FRENCH",e[e.ITALIAN=5]="ITALIAN",e[e.JAPANESE=6]="JAPANESE",e[e.KOREAN=7]="KOREAN",e[e.PORTUGUESE=8]="PORTUGUESE",e[e.SPANISH=9]="SPANISH"}(r=e.Language||(e.Language={}))}(a||(t.CryptoModule=a={})),t.default=a},429:(e,t)=>{"use strict";function r(e){return{value:e="number"==typeof e?BigInt(e):e,toString:(t=!0)=>{const r=new ArrayBuffer(32);new DataView(r).setBigUint64(0,e,t);let n="";return new Uint8Array(r).forEach((e=>{n+=e.toString(16).padStart(2,"0")})),n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.uint256=r,function(e){e.from=(t,r=!0)=>{if(!/^[0-9a-f]+$/i.test(t))throw new Error("Not a hexadecimal string");const n=t.match(/.{1,2}/g)||[];if(32!==n.length)throw new Error("Invalid hexadecimal length");const i=Uint8Array.from(n.map((e=>`0x${e}`))),o=new DataView(i.buffer).getBigUint64(0,r);return e(o)}}(r||(t.uint256=r={})),t.default=r},526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],u=o[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,u)),f=0,h=u>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[f++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,c=n-i;a<c;a+=s)o.push(u(e,a,a+s>c?c:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},672:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="20.0.1"}},t={},function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(156);var e,t}));
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(()=>{return e={526(e,t){"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=a(e),s=o[0],u=o[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,u)),f=0,h=u>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[f++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,c=n-i;a<c;a+=s)o.push(u(e,a,a+s>c?c:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},287(e,t,r){"use strict";const n=r(526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return l(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return l(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const i=function(e){if(u.isBuffer(e)){const t=0|y(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?a(0):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)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 h(e){return f(e),a(e<0?0:0|y(e))}function p(e){const t=e.length<0?0:0|y(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function l(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function y(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(e).length;default:if(i)return n?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function _(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function d(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(c(e,o)===c(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(c(e,o+n)!==c(t,n)){r=!1;break}if(r)return o}return-1}function w(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(Z(n))return s;e[r+s]=n}return s}function x(e,t,r,n){return K(W(t,e.length-r),e,r,n)}function E(e,t,r,n){return K(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return K(Y(t),e,r,n)}function B(e,t,r,n){return K(function(e,t){let r,n,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,u;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=k));return r}(n)}t.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){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(e,t,r){return c(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return f(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},u.allocUnsafe=function(e){return h(e)},u.allocUnsafeSlow=function(e){return h(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(V(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).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(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=u.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(V(t,Uint8Array))i+t.length>n.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)d(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)d(this,t,t+3),d(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)d(this,t,t+7),d(this,t+1,t+6),d(this,t+2,t+5),d(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):_.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),c=this.slice(n,i),f=e.slice(t,r);for(let e=0;e<a;++e)if(c[e]!==f[e]){o=c[e],s=f[e];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,t,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 k=4096;function S(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function O(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function N(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=q[e[n]];return i}function U(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function L(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function R(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function C(e,t,r,n,i){H(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function M(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return t=+t,r>>>=0,o||M(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=X((function(e){F(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||G(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||T(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||T(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=X((function(e,t=0){return R(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=X((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=X((function(e,t=0){return R(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=X((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return P(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return P(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=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===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=u.isBuffer(e)?e:u.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const $={};function J(e,t,r){$[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function D(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function H(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===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}`:`>= ${t}${n} and <= ${r}${n}`,new $.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){F(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||G(t,e.length-(r+1))}(n,i,o)}function F(e,t){if("number"!=typeof e)throw new $.ERR_INVALID_ARG_TYPE(t,"number",e)}function G(e,t,r){if(Math.floor(e)!==e)throw F(e,r),new $.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new $.ERR_BUFFER_OUT_OF_BOUNDS;throw new $.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}J("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),J("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),J("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" 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 ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=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((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Y(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,f=-7,h=r?i-1:0,p=r?-1:1,l=e[t+h];for(h+=p,o=l&(1<<-f)-1,l>>=-f,f+=a;f>0;o=256*o+e[t+h],h+=p,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+h],h+=p,f-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),o-=c}return(l?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,u,c=8*o-i-1,f=(1<<c)-1,h=f>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,y=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+h>=1?p/u:p*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=f?(a=0,s=f):s+h>=1?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;e[r+l]=255&a,l+=y,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+l]=255&s,l+=y,s/=256,c-=8);e[r+l-y]|=128*g}},319(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.CryptoModule=void 0;const o=r(429),s=r(287);i(r(274),t);class a{static runtime_configuration={type:0};constructor(){}static _external_library={};static get external_library(){return this._external_library}static set external_library(e){for(const t of Object.keys(e))this._external_library[t]=e[t]}set external_library(e){a.external_library=e}static get library_name(){return a.typeToString(this.runtime_configuration.type)}static get library_type(){return this.runtime_configuration.type}static get is_native(){return this.runtime_configuration.type===a.Type.NODE}get external_library(){return a.external_library}get library_name(){return a.library_name}get library_type(){return a.library_type}get is_native(){return a.is_native}static is_hex(e){return/^[0-9a-f]+$/i.test(e)}static make_module_result(e,t,r){const n={error:e,result:t};return r&&(n.error_message=r),JSON.stringify(n)}static languageToString(e){switch(e){case a.Language.CHINESE_SIMPLIFIED:return"Chinese (simplified)";case a.Language.CHINESE_TRADITIONAL:return"Chinese (traditional)";case a.Language.CZECH:return"Czech";case a.Language.ENGLISH:return"English";case a.Language.FRENCH:return"French";case a.Language.ITALIAN:return"Italian";case a.Language.JAPANESE:return"Japanese";case a.Language.KOREAN:return"Korean";case a.Language.PORTUGUESE:return"Portuguese";case a.Language.SPANISH:return"Spanish";default:return"Unknown"}}static typeToString(e){switch(e){case a.Type.NODE:return"Node C++ Addon";case a.Type.WASM:return"WASM.js Library";case a.Type.JS:return"Javascript asm.js (slow)";default:return"unknown"}}async base58_address_encode(e,t,r){return r?this.execute("base58_address_encode",{prefix:e,public_spend:t,public_view:r}):this.execute("base58_address_encode",{prefix:e,public_key:t})}async cn_base58_address_encode(e,t,r){return r?this.execute("cn_base58_address_encode",{prefix:e,public_spend:t,public_view:r}):this.execute("cn_base58_address_encode",{prefix:e,public_key:t})}async base58_address_decode(e){const t=await this.execute("base58_address_decode",e);return t.public_view&&o.uint256.from(t.public_view).value===BigInt(1)&&delete t.public_view,t}async cn_base58_address_decode(e){const t=await this.execute("cn_base58_address_decode",e);return t.public_view&&o.uint256.from(t.public_view).value===BigInt(1)&&delete t.public_view,t}async random_entropy(e,t=256,r=!0){return await this.execute("random_entropy",{entropy:e??"",bits:t,encode_timestamp:r})}async random_hash(){return await this.execute("random_hash")}async random_hashes(e=1){return await this.execute("random_hashes",e)}async random_scalar(){return await this.execute("random_scalar")}async random_scalars(e=1){return await this.execute("random_scalars",e)}async random_point(){return await this.execute("random_point")}async random_points(e=1){return await this.execute("random_points",e)}async sha256(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha256",e)}async sha384(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha384",e)}async sha512(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha512",e)}async sha3(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("sha3",e)}async sha3_slow(e,t=0){return this.execute("sha3_slow",{input:e,iterations:t})}async blake2b(e){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("blake2b",e)}async argon2i(e,t=1,r=256,n=1){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("argon2i",{input:e,iterations:t,memory:r,threads:n})}async argon2d(e,t=1,r=256,n=1){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("argon2d",{input:e,iterations:t,memory:r,threads:n})}async argon2id(e,t=1,r=256,n=1){return"string"!=typeof e&&(e=JSON.stringify(e)),this.execute("argon2id",{input:e,iterations:t,memory:r,threads:n})}async entropy_recover(e,t=a.Language.ENGLISH){return Array.isArray(e)&&(e=e.join(" ")),this.execute("entropy_recover",{input:e,language:t})}async generate_derivation(e,t){return this.execute("generate_derivation",{public_key:e,secret_key:t})}async generate_derivation_scalar(e,t=0){return this.execute("generate_derivation_scalar",{derivation:e,output_index:t})}async derive_public_key(e,t){return this.execute("derive_public_key",{derivation_scalar:e,public_key:t})}async derive_secret_key(e,t){return this.execute("derive_secret_key",{derivation_scalar:e,secret_key:t})}async generate_key_image(e,t){return this.execute("generate_key_image",{public_ephemeral:e,secret_ephemeral:t})}async generate_key_image_v2(e){return this.execute("generate_key_image_v2",e)}async generate_keys(){return this.execute("generate_keys")}async generate_keys_m(e=1){return this.execute("generate_keys_m",e)}async underive_public_key(e,t,r=0){return this.execute("underive_public_key",{derivation:e,output_index:r,public_ephemeral:t})}async secret_key_to_public_key(e){return this.execute("secret_key_to_public_key",e)}async private_key_to_keys(e){return this.execute("private_key_to_keys",e)}async hash_to_point(e){return e instanceof s.Buffer?this.execute("hash_to_point",e.toString("hex")):("string"!=typeof e&&(e=JSON.stringify(e)),this.execute("hash_to_point",e))}async hash_to_scalar(e){return e instanceof s.Buffer?this.execute("hash_to_scalar",e.toString("hex")):("string"!=typeof e&&(e=JSON.stringify(e)),this.execute("hash_to_scalar",e))}async scalar_reduce(e){return e instanceof s.Buffer?this.execute("scalar_reduce",e.subarray(0,32).toString("hex")):this.execute("scalar_reduce",e)}async tree_depth(e){return this.execute("tree_depth",e)}async root_hash(e){return this.execute("root_hash",{items:e})}async root_hash_from_branch(e,t,r=0,n=0){return this.execute("root_hash_from_branch",{branches:e,depth:r,leaf:t,path:n})}async tree_branch(e){return this.execute("tree_branch",{items:e})}async generate_rfc8032_signature(e,t){return this.execute("generate_rfc8032_signature",{message:e,secret_key:t})}async check_rfc8032_signature(e,t,r){try{return await this.execute("check_rfc8032_signature",{message:e,public_key:t,signature:r}),!0}catch{return!1}}async generate_signature(e,t){return this.execute("generate_signature",{message_digest:e,secret_key:t})}async prepare_signature(e,t){return this.execute("prepare_signature",{message_digest:e,public_key:t})}async complete_signature(e,t){return this.execute("complete_signature",{secret_key:e,signature:t})}async check_signature(e,t,r){try{return await this.execute("check_signature",{message_digest:e,public_key:t,signature:r}),!0}catch{return!1}}async generate_borromean_signature(e,t,r){return this.execute("generate_borromean_signature",{message_digest:e,secret_ephemeral:t,public_keys:r})}async prepare_borromean_signature(e,t,r,n){return this.execute("prepare_borromean_signature",{message_digest:e,key_image:t,public_keys:r,real_output_index:n})}async complete_borromean_signature(e,t,r){return this.execute("complete_borromean_signature",{secret_ephemeral:e,real_output_index:t,signature:r})}async check_borromean_signature(e,t,r,n){try{return await this.execute("check_borromean_signature",{message_digest:e,key_image:t,public_keys:r,signature:n}),!0}catch{return!1}}async generate_clsag_signature(e,t,r,n,i,o,s){const a={message_digest:e,secret_ephemeral:t,public_keys:r};return n&&(a.input_blinding_factor=n),i&&(a.public_commitments=i),o&&(a.pseudo_blinding_factor=o),s&&(a.pseudo_commitment=s),this.execute("generate_clsag_signature",a)}async prepare_clsag_signature(e,t,r,n,i,o,s,a){const u={message_digest:e,key_image:t,public_keys:r,real_output_index:n};return i&&(u.input_blinding_factor=i),o&&(u.public_commitments=o),s&&(u.pseudo_blinding_factor=s),a&&(u.pseudo_commitment=a),this.execute("prepare_clsag_signature",u)}async complete_clsag_signature(e,t,r,n,i){return this.execute("complete_clsag_signature",{secret_ephemeral:e,real_output_index:t,signature:r,h:n,mu_P:i})}async check_clsag_signature(e,t,r,n,i){try{const o={message_digest:e,key_image:t,public_keys:r,signature:n};return i&&(o.commitments=i),await this.execute("check_clsag_signature",o),!0}catch{return!1}}async generate_triptych_signature(e,t,r,n,i,o,s){const a={message_digest:e,secret_ephemeral:t,public_keys:r};return n&&(a.input_blinding_factor=n),i&&(a.public_commitments=i),o&&(a.pseudo_blinding_factor=o),s&&(a.pseudo_commitment=s),this.execute("generate_triptych_signature",a)}async prepare_triptych_signature(e,t,r,n,i,o,s,a){const u={message_digest:e,key_image:t,public_keys:r,real_output_index:n};return i&&(u.input_blinding_factor=i),o&&(u.public_commitments=o),s&&(u.pseudo_blinding_factor=s),a&&(u.pseudo_commitment=a),this.execute("prepare_triptych_signature",u)}async complete_triptych_signature(e,t,r){return this.execute("complete_triptych_signature",{secret_ephemeral:e,signature:t,xpow:r})}async check_triptych_signature(e,t,r,n,i){try{const o={message_digest:e,key_image:t,public_keys:r,signature:n};return i&&(o.commitments=i),await this.execute("check_triptych_signature",o),!0}catch{return!1}}async generate_bulletproof(e,t,r=64){return this.execute("generate_bulletproof",{amounts:e,blinding_factors:t,N:r})}async check_bulletproof(e,t,r=64){try{return Array.isArray(e)&&Array.isArray(t[0])?await this.execute("check_bulletproof_batch",{proofs:e,commitments:t,N:r}):await this.execute("check_bulletproof",{proof:e,commitments:t,N:r}),!0}catch{return!1}}async generate_bulletproof_plus(e,t,r=64){return this.execute("generate_bulletproof",{amounts:e,blinding_factors:t,N:r})}async check_bulletproof_plus(e,t,r=64){try{return Array.isArray(e)&&Array.isArray(t[0])?await this.execute("check_bulletproof_batch",{proofs:e,commitments:t,N:r}):await this.execute("check_bulletproof",{proof:e,commitments:t,N:r}),!0}catch{return!1}}async check_commitments_parity(e,t,r){try{return await this.execute("check_commitments_parity",{pseudo_commitments:e,output_commitments:t,transaction_fee:r}),!0}catch{return!1}}async generate_amount_mask(e){return this.execute("generate_amount_mask",e)}async generate_commitment_blinding_factor(e){return this.execute("generate_commitment_blinding_factor",e)}async generate_pedersen_commitment(e,t){return this.execute("generate_pedersen_commitment",{blinding_factor:e,amount:t})}async generate_pseudo_commitments(e,t){return this.execute("generate_pseudo_commitments",{amounts:e,output_blinding_factors:t})}async toggle_masked_amount(e,t){"number"==typeof t?t=BigInt(t):"string"==typeof t&&(t=o.uint256.from(t).value);const r=await this.execute("toggle_masked_amount",{amount_mask:e,amount:(0,o.uint256)(t).toString()});return o.uint256.from(r).value}async generate_outputs_proof(e){return this.execute("generate_outputs_proof",{items:e})}async check_outputs_proof(e,t){return this.execute("check_outputs_proof",{public_ephemerals:e,proof:t})}async base58_encode(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("base58_encode",e.toString("hex"))}async base58_encode_check(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("base58_encode_check",e.toString("hex"))}async base58_decode(e){const t=await this.execute("base58_decode",e);return s.Buffer.from(t,"hex")}async base58_decode_check(e){const t=await this.execute("base58_decode_check",e);return s.Buffer.from(t,"hex")}async cn_base58_encode(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("cn_base58_encode",e.toString("hex"))}async cn_base58_encode_check(e){return"string"==typeof e&&(e=s.Buffer.from(e,a.is_hex(e)?"hex":void 0)),this.execute("cn_base58_encode_check",e.toString("hex"))}async cn_base58_decode(e){const t=await this.execute("cn_base58_decode",e);return s.Buffer.from(t,"hex")}async cn_base58_decode_check(e){const t=await this.execute("cn_base58_decode_check",e);return s.Buffer.from(t,"hex")}async generate_transaction_fee_commitment(e){return this.generate_pedersen_commitment("".padEnd(64,"0"),e)}async check_scalar(e){try{return await this.execute("check_scalar",e),!0}catch{return!1}}async check_point(e){try{return await this.execute("check_point",e),!0}catch{return!1}}async mnemonics_encode(e,t=a.Language.ENGLISH){return(await this.execute("mnemonics_encode",{entropy:e,language:t})).split(" ")}async mnemonics_decode(e,t=a.Language.ENGLISH){return Array.isArray(e)&&(e=e.join(" ")),this.execute("mnemonics_decode",{input:e,language:t})}async mnemonics_word_index(e,t=a.Language.ENGLISH){return this.execute("mnemonics_word_index",{input:e,language:t})}async word_list(e=a.Language.ENGLISH){return(await this.execute("word_list",{language:e})).split(" ")}async word_list_trimmed(e=a.Language.ENGLISH){return(await this.execute("word_list_trimmed",{language:e})).split(" ")}async calculate_base2_exponent(e){return this.execute("calculate_base2_exponent",e)}async aes_encrypt(e,t,r){"string"!=typeof e&&(e=JSON.stringify(e));const n={input:e,password:t};return r&&(n.iterations=r),this.execute("aes_encrypt",n)}async aes_decrypt(e,t,r){const n={input:e,password:t};return r&&(n.iterations=r),this.execute("aes_decrypt",n)}async languages(){return this.execute("languages")}async generate_seed(e,t=""){return this.execute("generate_seed",{entropy:e,passphrase:t})}async generate_child_key(e,t,r,n,i,o,s="ed25519 seed"){const a={seed:e,hmac_key:s};return"string"==typeof t?a.path=t.toLowerCase():(void 0!==t&&(a.purpose=t),void 0!==r&&(a.coin_type=r),void 0!==n&&(a.account=n),void 0!==i&&(a.change=i),void 0!==o&&(a.address_index=o)),this.execute("generate_child_key",a)}make_path(e,t,r,n,i){if("string"==typeof e)return e.toLowerCase();let o="m";return void 0!==e&&(o+=`/${e}'`,void 0!==t&&(o+=`/${t}'`,void 0!==r&&(o+=`/${r}'`,void 0!==n&&(o+=`/${n}'`,void 0!==i&&(o+=`/${i}'`))))),o}async execute(e,t){const r=(()=>void 0!==this.external_library[e]?this.external_library[e]:a.runtime_configuration.library&&void 0!==a.runtime_configuration.library[e]?a.runtime_configuration.library[e]:void 0)();if(!r)throw new Error(`0x01: Method Not Found. ${e}(${t?JSON.stringify(t):""})`);let n;n=t?await r(JSON.stringify(t)):await r();const i=JSON.parse(n);if(i.error)throw new Error(i.error_message??`0x04: An unknown error occurred: ${e}(${t?JSON.stringify(t):""})`);return i.result}}t.CryptoModule=a,function(e){let t,r;!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NODE=1]="NODE",e[e.WASM=2]="WASM",e[e.JS=3]="JS"}(t=e.Type||(e.Type={})),function(e){e[e.CHINESE_SIMPLIFIED=0]="CHINESE_SIMPLIFIED",e[e.CHINESE_TRADITIONAL=1]="CHINESE_TRADITIONAL",e[e.CZECH=2]="CZECH",e[e.ENGLISH=3]="ENGLISH",e[e.FRENCH=4]="FRENCH",e[e.ITALIAN=5]="ITALIAN",e[e.JAPANESE=6]="JAPANESE",e[e.KOREAN=7]="KOREAN",e[e.PORTUGUESE=8]="PORTUGUESE",e[e.SPANISH=9]="SPANISH"}(r=e.Language||(e.Language={}))}(a||(t.CryptoModule=a={})),t.default=a},274(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},429(e,t){"use strict";function r(e){return{value:e="number"==typeof e?BigInt(e):e,toString:(t=!0)=>{const r=new ArrayBuffer(32);new DataView(r).setBigUint64(0,e,t);let n="";return new Uint8Array(r).forEach((e=>{n+=e.toString(16).padStart(2,"0")})),n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.uint256=r,function(e){e.from=(t,r=!0)=>{if(!/^[0-9a-f]+$/i.test(t))throw new Error("Not a hexadecimal string");const n=t.match(/.{1,2}/g)||[];if(32!==n.length)throw new Error("Invalid hexadecimal length");const i=Uint8Array.from(n.map((e=>`0x${e}`))),o=new DataView(i.buffer).getBigUint64(0,r);return e(o)}}(r||(t.uint256=r={})),t.default=r},156(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Crypto=void 0;const o=r(319),s=r(672);i(r(319),t);class a extends o.CryptoModule{constructor(){super()}static async init(e={}){if(this.external_library=e,!this.runtime_configuration.library){if(await this.load_wasm_library())return new a;if(await this.load_js_library())return new a;throw new Error("Could not initialize an underlying library")}return new a}static async force_js_library(){return this.load_js_library()}static async force_wasm_library(){return this.load_wasm_library()}static async load(e){return!!await a.url_exists(e)&&new Promise(((t,r)=>{const n=document.createElement("script");n.src=e,n.defer=!0,n.async=!1,n.crossOrigin="anonymous",n.referrerPolicy="no-referrer",n.addEventListener("load",(()=>t(!0))),n.addEventListener("error",(()=>function(e){return r(new Error(e.message))})),document.head.appendChild(n)}))}static async load_library(e,t){if(!await this.load(e))return!1;if(!window.CryptoModule)return!1;const r=await new window.CryptoModule;return 0!==Object.getOwnPropertyNames(r).length&&void 0!==r.sha3&&(o.CryptoModule.runtime_configuration={type:t,library:r},!0)}static async load_js_library(){return!!await this.load_library(`https://cdn.jsdelivr.net/npm/@gibme/crypto@${s.version}/dist/src/loaders/crypto-module.js`,o.CryptoModule.Type.JS)||this.load_library("https://testmodule.pages.dev/crypto-module.js",o.CryptoModule.Type.JS)}static async load_wasm_library(){return!!await this.load_library(`https://cdn.jsdelivr.net/npm/@gibme/crypto@${s.version}/dist/src/loaders/crypto-module-wasm.js`,o.CryptoModule.Type.WASM)||this.load_library("https://testmodule.pages.dev/crypto-module-wasm.js",o.CryptoModule.Type.WASM)}static async url_exists(e){return(await fetch(e,{method:"HEAD"})).ok}}t.default=a,t.Crypto=a},672(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="22.0.1"}},t={},function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(156);var e,t}));
|
|
3
3
|
//# sourceMappingURL=Crypto.min.js.map
|