@secux/app-eth
Version:
SecuX Hardware Wallet ETH API
2 lines • 736 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("ow"),require("@secux/transport"),require("@secux/utility"),require("@secux/protocol-transaction"));else if("function"==typeof define&&define.amd)define(["ow","@secux/transport","@secux/utility","@secux/protocol-transaction"],e);else{var r="object"==typeof exports?e(require("ow"),require("@secux/transport"),require("@secux/utility"),require("@secux/protocol-transaction")):e(t.ow,t["@secux/transport"],t["@secux/utility"],t["@secux/protocol-transaction"]);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(this,((t,e,r,n)=>(()=>{var i={46:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(r,n){function i(r){t.removeListener(e,o),n(r)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),r([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&m(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function f(t,e,r,n){var i,o,a,f;if(s(r),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),a=o[e]),void 0===a)a=o[e]=r,++t._eventsCount;else if("function"==typeof a?a=o[e]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=u(t))>0&&a.length>i&&!a.warned){a.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=a.length,f=h,console&&console.warn&&console.warn(f)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=h.bind(n);return i.listener=r,n.wrapFn=i,i}function l(t,e,r){var n=t._events;if(void 0===n)return[];var i=n[e];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(i):p(i,i.length)}function d(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function m(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){n.once&&t.removeEventListener(e,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)n(u,this,e);else{var f=u.length,h=p(u,f);for(r=0;r<f;++r)n(h[r],this,e)}return!0},o.prototype.addListener=function(t,e){return f(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return f(this,t,e,!0)},o.prototype.once=function(t,e){return s(e),this.on(t,c(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return s(e),this.prependListener(t,c(this,t,e)),this},o.prototype.removeListener=function(t,e){var r,n,i,o,a;if(s(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===e||r[o].listener===e){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,i),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,a||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},o.prototype.listeners=function(t){return l(this,t,!0)},o.prototype.rawListeners=function(t){return l(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},130:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.importPublic=e.privateToPublic=e.privateToAddress=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.isPrecompiled=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isZeroAddress=e.isValidAddress=e.zeroAddress=void 0;var n=r(6093),i=r(2321),o=r(832),a=r(2738),s=r(1982),u=r(9813);e.zeroAddress=function(){var t=s.zeros(20);return s.bufferToHex(t)},e.isValidAddress=function(t){return/^0x[0-9a-fA-F]{40}$/.test(t)},e.isZeroAddress=function(t){return e.zeroAddress()===s.addHexPrefix(t)},e.toChecksumAddress=function(t,e){t=i.stripHexPrefix(t).toLowerCase();for(var r=void 0!==e?e.toString()+"0x":"",n=u.keccak(r+t).toString("hex"),o="0x",a=0;a<t.length;a++)parseInt(n[a],16)>=8?o+=t[a].toUpperCase():o+=t[a];return o},e.isValidChecksumAddress=function(t,r){return e.isValidAddress(t)&&e.toChecksumAddress(t,r)===t},e.generateAddress=function(t,e){t=s.toBuffer(t);var r=new a(e);return r.isZero()?u.rlphash([t,null]).slice(-20):u.rlphash([t,Buffer.from(r.toArray())]).slice(-20)},e.generateAddress2=function(t,e,r){var i=s.toBuffer(t),o=s.toBuffer(e),a=s.toBuffer(r);return n(20===i.length),n(32===o.length),u.keccak256(Buffer.concat([Buffer.from("ff","hex"),i,o,u.keccak256(a)])).slice(-20)},e.isPrecompiled=function(t){var e=s.unpad(t);return 1===e.length&&e[0]>=1&&e[0]<=8},e.isValidPrivate=function(t){return o.privateKeyVerify(t)},e.isValidPublic=function(t,e){return void 0===e&&(e=!1),64===t.length?o.publicKeyVerify(Buffer.concat([Buffer.from([4]),t])):!!e&&o.publicKeyVerify(t)},e.pubToAddress=function(t,e){return void 0===e&&(e=!1),t=s.toBuffer(t),e&&64!==t.length&&(t=o.publicKeyConvert(t,!1).slice(1)),n(64===t.length),u.keccak(t).slice(-20)},e.publicToAddress=e.pubToAddress,e.privateToAddress=function(t){return e.publicToAddress(e.privateToPublic(t))},e.privateToPublic=function(t){return t=s.toBuffer(t),o.publicKeyCreate(t,!1).slice(1)},e.importPublic=function(t){return 64!==(t=s.toBuffer(t)).length&&(t=o.publicKeyConvert(t,!1).slice(1)),t}},133:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return i(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature_v4=e.recoverTypedSignature=e.signTypedData_v4=e.signTypedData=e.recoverTypedMessage=e.signTypedMessage=e.getEncryptionPublicKey=e.decryptSafely=e.decrypt=e.encryptSafely=e.encrypt=e.recoverTypedSignatureLegacy=e.signTypedDataLegacy=e.typedSignatureHash=e.extractPublicKey=e.recoverPersonalSignature=e.personalSign=e.normalize=e.concatSig=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=void 0;const a=o(r(9070)),s=o(r(8743)),u=o(r(2926)),f=o(r(665)),h={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]};e.TYPED_MESSAGE_SCHEMA=h;const c={encodeData(t,e,r,n=!0){const i=["bytes32"],o=[this.hashType(t,r)];if(n){const u=(t,e,i)=>{if(void 0!==r[e])return["bytes32",null==i?"0x0000000000000000000000000000000000000000000000000000000000000000":a.keccak(this.encodeData(e,i,r,n))];if(void 0===i)throw new Error(`missing value for field ${t} of type ${e}`);if("bytes"===e)return["bytes32",a.keccak(i)];if("string"===e)return"string"==typeof i&&(i=Buffer.from(i,"utf8")),["bytes32",a.keccak(i)];if(e.lastIndexOf("]")===e.length-1){const r=e.slice(0,e.lastIndexOf("[")),n=i.map((e=>u(t,r,e)));return["bytes32",a.keccak(s.rawEncode(n.map((([t])=>t)),n.map((([,t])=>t))))]}return[e,i]};for(const n of r[t]){const[t,r]=u(n.name,n.type,e[n.name]);i.push(t),o.push(r)}}else for(const s of r[t]){let t=e[s.name];if(void 0!==t)if("bytes"===s.type)i.push("bytes32"),t=a.keccak(t),o.push(t);else if("string"===s.type)i.push("bytes32"),"string"==typeof t&&(t=Buffer.from(t,"utf8")),t=a.keccak(t),o.push(t);else if(void 0!==r[s.type])i.push("bytes32"),t=a.keccak(this.encodeData(s.type,t,r,n)),o.push(t);else{if(s.type.lastIndexOf("]")===s.type.length-1)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");i.push(s.type),o.push(t)}}return s.rawEncode(i,o)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter((e=>e!==t));n=[t].concat(n.sort());for(const t of n){if(!e[t])throw new Error(`No type definition specified: ${t}`);r+=`${t}(${e[t].map((({name:t,type:e})=>`${e} ${t}`)).join(",")})`}return r},findTypeDependencies(t,e,r=[]){if([t]=t.match(/^\w*/u),r.includes(t)||void 0===e[t])return r;r.push(t);for(const n of e[t])for(const t of this.findTypeDependencies(n.type,e,r))!r.includes(t)&&r.push(t);return r},hashStruct(t,e,r,n=!0){return a.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return a.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in h.properties)t[r]&&(e[r]=t[r]);return"types"in e&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},sign(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),"EIP712Domain"!==r.primaryType&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),a.keccak(Buffer.concat(n))}};function l(t,e,r){const n=a.fromSigned(e),i=a.fromSigned(r),o=a.bufferToInt(t),s=E(a.toUnsigned(n).toString("hex"),64),u=E(a.toUnsigned(i).toString("hex"),64),f=a.stripHexPrefix(a.intToHex(o));return a.addHexPrefix(s.concat(u,f)).toString("hex")}function d(t,e){const r=M(e.data),n=a.ecsign(r,t);return a.bufferToHex(l(n.v,n.r,n.s))}function p(t){const e=_(M(t.data),t.sig),r=a.publicToAddress(e);return a.bufferToHex(r)}function m(t,e,r){if("x25519-xsalsa20-poly1305"===r){if("string"!=typeof e.data)throw new Error('Cannot detect secret message, message params should be of the form {data: "secret message"} ');const r=u.box.keyPair();let n;try{n=f.decodeBase64(t)}catch(t){throw new Error("Bad public key")}const i=f.decodeUTF8(e.data),o=u.randomBytes(u.box.nonceLength),a=u.box(i,o,n,r.secretKey);return{version:"x25519-xsalsa20-poly1305",nonce:f.encodeBase64(o),ephemPublicKey:f.encodeBase64(r.publicKey),ciphertext:f.encodeBase64(a)}}throw new Error("Encryption type/version not supported")}function g(t,e){if("x25519-xsalsa20-poly1305"===t.version){const r=S(e),n=u.box.keyPair.fromSecretKey(r).secretKey,i=f.decodeBase64(t.nonce),o=f.decodeBase64(t.ciphertext),a=f.decodeBase64(t.ephemPublicKey),s=u.box.open(o,i,a,n);let h;try{h=f.encodeUTF8(s)}catch(t){throw new Error("Decryption failed.")}if(h)return h;throw new Error("Decryption failed.")}throw new Error("Encryption type/version not supported.")}function y(t,e){const r=c.sign(e.data,!1),n=a.ecsign(r,t);return a.bufferToHex(l(n.v,n.r,n.s))}function b(t,e){const r=c.sign(e.data),n=a.ecsign(r,t);return a.bufferToHex(l(n.v,n.r,n.s))}function v(t){const e=_(c.sign(t.data,!1),t.sig),r=a.publicToAddress(e);return a.bufferToHex(r)}function w(t){const e=_(c.sign(t.data),t.sig),r=a.publicToAddress(e);return a.bufferToHex(r)}function M(t){const e=new Error("Expect argument to be non-empty array");if("object"!=typeof t||!("length"in t)||!t.length)throw e;const r=t.map((function(t){return"bytes"===t.type?a.toBuffer(t.value):t.value})),n=t.map((function(t){return t.type})),i=t.map((function(t){if(!t.name)throw e;return`${t.type} ${t.name}`}));return s.soliditySHA3(["bytes32","bytes32"],[s.soliditySHA3(new Array(t.length).fill("string"),i),s.soliditySHA3(n,r)])}function _(t,e){const r=a.toBuffer(e),n=a.fromRpcSig(r);return a.ecrecover(t,n.v,n.r,n.s)}function A(t){const e=a.toBuffer(t.data);return _(a.hashPersonalMessage(e),t.sig)}function E(t,e){let r=`${t}`;for(;r.length<e;)r=`0${r}`;return r}function S(t){const e=Buffer.from(t,"hex").toString("base64");return f.decodeBase64(e)}e.TypedDataUtils=c,e.concatSig=l,e.normalize=function(t){if(t){if("number"==typeof t){const e=a.toBuffer(t);t=a.bufferToHex(e)}if("string"!=typeof t){let e="eth-sig-util.normalize() requires hex string or integer input.";throw e+=` received ${typeof t}: ${t}`,new Error(e)}return a.addHexPrefix(t.toLowerCase())}},e.personalSign=function(t,e){const r=a.toBuffer(e.data),n=a.hashPersonalMessage(r),i=a.ecsign(n,t);return a.bufferToHex(l(i.v,i.r,i.s))},e.recoverPersonalSignature=function(t){const e=A(t),r=a.publicToAddress(e);return a.bufferToHex(r)},e.extractPublicKey=function(t){return`0x${A(t).toString("hex")}`},e.typedSignatureHash=function(t){const e=M(t);return a.bufferToHex(e)},e.signTypedDataLegacy=d,e.recoverTypedSignatureLegacy=p,e.encrypt=m,e.encryptSafely=function(t,e,r){const{data:n}=e;if(!n)throw new Error("Cannot encrypt empty msg.data");if("object"==typeof n&&"toJSON"in n)throw new Error("Cannot encrypt with toJSON property. Please remove toJSON property");const i={data:n,padding:""},o=Buffer.byteLength(JSON.stringify(i),"utf-8")%2048;let a=0;return o>0&&(a=2048-o-16),i.padding="0".repeat(a),m(t,{data:JSON.stringify(i)},r)},e.decrypt=g,e.decryptSafely=function(t,e){return JSON.parse(g(t,e)).data},e.getEncryptionPublicKey=function(t){const e=S(t),r=u.box.keyPair.fromSecretKey(e).publicKey;return f.encodeBase64(r)},e.signTypedMessage=function(t,e,r="V4"){switch(r){case"V1":return d(t,e);case"V3":return y(t,e);default:return b(t,e)}},e.recoverTypedMessage=function(t,e="V4"){switch(e){case"V1":return p(t);case"V3":return v(t);default:return w(t)}},e.signTypedData=y,e.signTypedData_v4=b,e.recoverTypedSignature=v,e.recoverTypedSignature_v4=w},169:t=>{"use strict";var e={};function r(t,r,n){n||(n=Error);var i=function(t){var e,n;function i(e,n,i){return t.call(this,function(t,e,n){return"string"==typeof r?r:r(t,e,n)}(e,n,i))||this}return n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=t,e[t]=i}function n(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,o,a,s,u;if("string"==typeof e&&(o="not ",e.substr(0,4)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-9,r)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(n(e,"type"));else{var f=("number"!=typeof u&&(u=0),u+1>(s=t).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(t,'" ').concat(f," ").concat(i," ").concat(n(e,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.F=e},181:function(t,e,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=e.rlp=e.BN=void 0;var o=r(832);e.secp256k1=o;var a=r(2321),s=r(2738);e.BN=s;var u=r(187);e.rlp=u,Object.assign(e,a),i(r(8828),e),i(r(130),e),i(r(9813),e),i(r(2907),e),i(r(1982),e),i(r(3334),e)},183:t=>{"use strict";t.exports={rE:"6.6.1"}},187:function(t,e,r){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLength=e.decode=e.encode=void 0;var i=n(r(2823));function o(t,e){if("0"===t[0]&&"0"===t[1])throw new Error("invalid RLP: extra zeros");return parseInt(t,e)}function a(t,e){if(t<56)return Buffer.from([t+e]);var r=f(t),n=f(e+55+r.length/2);return Buffer.from(n+r,"hex")}function s(t){var e,r,n,i,a,u=[],f=t[0];if(f<=127)return{data:t.slice(0,1),remainder:t.slice(1)};if(f<=183){if(e=f-127,n=128===f?Buffer.from([]):t.slice(1,e),2===e&&n[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:n,remainder:t.slice(e)}}if(f<=191){if(r=f-182,t.length-1<r)throw new Error("invalid RLP: not enough bytes for string length");if((e=o(t.slice(1,r).toString("hex"),16))<=55)throw new Error("invalid RLP: expected string length to be greater than 55");if((n=t.slice(r,e+r)).length<e)throw new Error("invalid RLP: not enough bytes for string");return{data:n,remainder:t.slice(e+r)}}if(f<=247){for(e=f-191,i=t.slice(1,e);i.length;)a=s(i),u.push(a.data),i=a.remainder;return{data:u,remainder:t.slice(e)}}var h=(r=f-246)+(e=o(t.slice(1,r).toString("hex"),16));if(h>t.length)throw new Error("invalid rlp: total length is larger than the data");if(0===(i=t.slice(r,h)).length)throw new Error("invalid rlp, List has a invalid length");for(;i.length;)a=s(i),u.push(a.data),i=a.remainder;return{data:u,remainder:t.slice(h)}}function u(t){return"0x"===t.slice(0,2)}function f(t){if(t<0)throw new Error("Invalid integer as argument, must be unsigned!");var e=t.toString(16);return e.length%2?"0"+e:e}function h(t){if(!Buffer.isBuffer(t)){if("string"==typeof t)return u(t)?Buffer.from((r="string"!=typeof(n=t)?n:u(n)?n.slice(2):n).length%2?"0"+r:r,"hex"):Buffer.from(t);if("number"==typeof t||"bigint"==typeof t)return t?(e=f(t),Buffer.from(e,"hex")):Buffer.from([]);if(null==t)return Buffer.from([]);if(t instanceof Uint8Array)return Buffer.from(t);if(i.default.isBN(t))return Buffer.from(t.toArray());throw new Error("invalid type")}var e,r,n;return t}e.encode=function t(e){if(Array.isArray(e)){for(var r=[],n=0;n<e.length;n++)r.push(t(e[n]));var i=Buffer.concat(r);return Buffer.concat([a(i.length,192),i])}var o=h(e);return 1===o.length&&o[0]<128?o:Buffer.concat([a(o.length,128),o])},e.decode=function(t,e){if(void 0===e&&(e=!1),!t||0===t.length)return Buffer.from([]);var r=s(h(t));if(e)return r;if(0!==r.remainder.length)throw new Error("invalid remainder");return r.data},e.getLength=function(t){if(!t||0===t.length)return Buffer.from([]);var e=h(t),r=e[0];if(r<=127)return e.length;if(r<=183)return r-127;if(r<=191)return r-182;if(r<=247)return r-191;var n=r-246;return n+o(e.slice(1,n).toString("hex"),16)}},277:(t,e,r)=>{"use strict";var n=r(1874),i=r(4845),o=r(5615),a=r(5174),s=n.assert;function u(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(t,e,r,n){a.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){a.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?r=o[0]:(r=o[1],s(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),r=new i(2).toRed(e).redInvm(),n=r.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,r,n,o,a,s,u,f,h,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),m=new i(0),g=new i(0),y=new i(1),b=0;0!==l.cmpn(0);){var v=d.div(l);f=d.sub(v.mul(l)),h=g.sub(v.mul(p));var w=y.sub(v.mul(m));if(!n&&f.cmp(c)<0)e=u.neg(),r=p,n=f.neg(),o=h;else if(n&&2==++b)break;u=f,d=l,l=f,g=p,p=h,y=m,m=w}a=f.neg(),s=h;var M=n.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(M)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:o},{a,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),f=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:u.add(f).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(e&&!o||!e&&o)&&(n=n.redNeg()),this.point(t,n)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var f=this._wnafMulAdd(1,n,i,2*o,r),h=0;h<2*o;h++)n[h]=null,i[h]=null;return f},o(f,a.BasePoint),u.prototype.point=function(t,e,r){return new f(this,t,e,r)},u.prototype.pointFromJSON=function(t,e){return f.fromJSON(this,t,e)},f.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(t,e,r){"string"==typeof e&&(e=JSON.parse(e));var n=t.point(e[0],e[1],r);if(!e[2])return n;function i(e){return t.point(e[0],e[1],r)}var o=e[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},f.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},f.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(h,a.BasePoint),u.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),h=f.redMul(s),c=n.redMul(f),l=u.redSqr().redIAdd(h).redISub(c).redISub(c),d=u.redMul(c.redISub(l)).redISub(o.redMul(h)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),h=r.redMul(u),c=s.redSqr().redIAdd(f).redISub(h).redISub(h),l=s.redMul(h.redISub(c)).redISub(i.redMul(f)),d=this.z.redMul(a);return this.curve.jpoint(c,l,d)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),f=a.redAdd(a);for(e=0;e<t;e++){var h=o.redSqr(),c=f.redSqr(),l=c.redSqr(),d=h.redAdd(h).redIAdd(h).redIAdd(n.redMul(u)),p=o.redMul(c),m=d.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=d.redMul(g);y=y.redIAdd(y).redISub(l);var b=f.redMul(s);e+1<t&&(u=u.redMul(l)),o=m,s=b,f=y}return this.curve.jpoint(o,f.redMul(i),s)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n),u=s.redSqr().redISub(a).redISub(a),f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),t=u,e=s.redMul(a.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.x.redSqr(),c=this.y.redSqr(),l=c.redSqr(),d=this.x.redAdd(c).redSqr().redISub(h).redISub(l);d=d.redIAdd(d);var p=h.redAdd(h).redIAdd(h),m=p.redSqr(),g=l.redIAdd(l);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(g),r=(r=this.y.redMul(this.z)).redIAdd(r)}return this.curve.jpoint(t,e,r)},h.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var s=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var f=o.redIAdd(o);f=(f=f.redIAdd(f)).redIAdd(f),e=s.redMul(a.redISub(u)).redISub(f),r=this.y.redAdd(this.y)}else{var h=this.z.redSqr(),c=this.y.redSqr(),l=this.x.redMul(c),d=this.x.redSub(h).redMul(this.x.redAdd(h));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),r=this.y.redAdd(this.z).redSqr().redISub(c).redISub(h);var g=c.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=d.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},h.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=e.redSqr(),a=r.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),f=(u=u.redIAdd(u)).redMul(a),h=s.redSqr().redISub(f.redAdd(f)),c=f.redISub(h),l=a.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=s.redMul(c).redISub(l),p=r.redAdd(r).redMul(n);return this.curve.jpoint(h,d,p)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(n),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=n.redIAdd(n);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var f=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),h=e.redMul(f);h=(h=h.redIAdd(h)).redIAdd(h);var c=this.x.redMul(s).redISub(h);c=(c=c.redIAdd(c)).redIAdd(c);var l=this.y.redMul(f.redMul(u.redISub(f)).redISub(a.redMul(s)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(a).redSqr().redISub(r).redISub(s);return this.curve.jpoint(c,l,d)},h.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},h.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},h.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(r))return!0;for(var n=t.clone(),i=this.curve.redN.redMul(e);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},377:t=>{"use strict";function e(t,e,r){var n=t[e]+t[r],i=t[e+1]+t[r+1];n>=4294967296&&i++,t[e]=n,t[e+1]=i}function r(t,e,r,n){var i=t[e]+r;r<0&&(i+=4294967296);var o=t[e+1]+n;i>=4294967296&&o++,t[e]=i,t[e+1]=o}function n(t,e){return t[e]^t[e+1]<<8^t[e+2]<<16^t[e+3]<<24}function i(t,n,i,o,a,f){var h=u[a],c=u[a+1],l=u[f],d=u[f+1];e(s,t,n),r(s,t,h,c);var p=s[o]^s[t],m=s[o+1]^s[t+1];s[o]=m,s[o+1]=p,e(s,i,o),p=s[n]^s[i],m=s[n+1]^s[i+1],s[n]=p>>>24^m<<8,s[n+1]=m>>>24^p<<8,e(s,t,n),r(s,t,l,d),p=s[o]^s[t],m=s[o+1]^s[t+1],s[o]=p>>>16^m<<16,s[o+1]=m>>>16^p<<16,e(s,i,o),p=s[n]^s[i],m=s[n+1]^s[i+1],s[n]=m>>>31^p<<1,s[n+1]=p>>>31^m<<1}var o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),a=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(t){return 2*t}))),s=new Uint32Array(32),u=new Uint32Array(32);function f(t,e){var r=0;for(r=0;r<16;r++)s[r]=t.h[r],s[r+16]=o[r];for(s[24]=s[24]^t.t,s[25]=s[25]^t.t/4294967296,e&&(s[28]=~s[28],s[29]=~s[29]),r=0;r<32;r++)u[r]=n(t.b,4*r);for(r=0;r<12;r++)i(0,8,16,24,a[16*r+0],a[16*r+1]),i(2,10,18,26,a[16*r+2],a[16*r+3]),i(4,12,20,28,a[16*r+4],a[16*r+5]),i(6,14,22,30,a[16*r+6],a[16*r+7]),i(0,10,20,30,a[16*r+8],a[16*r+9]),i(2,12,22,24,a[16*r+10],a[16*r+11]),i(4,14,16,26,a[16*r+12],a[16*r+13]),i(6,8,18,28,a[16*r+14],a[16*r+15]);for(r=0;r<16;r++)t.h[r]=t.h[r]^s[r]^s[r+16]}var h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function c(t,e,r,i){h.fill(0),this.b=new Uint8Array(128),this.h=new Uint32Array(16),this.t=0,this.c=0,this.outlen=t,h[0]=t,e&&(h[1]=e.length),h[2]=1,h[3]=1,r&&h.set(r,32),i&&h.set(i,48);for(var a=0;a<16;a++)this.h[a]=o[a]^n(h,4*a);e&&(l(this,e),this.c=128)}function l(t,e){for(var r=0;r<e.length;r++)128===t.c&&(t.t+=t.c,f(t,!1),t.c=0),t.b[t.c++]=e[r]}c.prototype.update=function(t){return l(this,t),this},c.prototype.digest=function(t){var e=t&&"binary"!==t&&"hex"!==t?t:new Uint8Array(this.outlen);return function(t,e){for(t.t+=t.c;t.c<128;)t.b[t.c++]=0;f(t,!0);for(var r=0;r<t.outlen;r++)e[r]=t.h[r>>2]>>8*(3&r)}(this,e),"hex"===t?function(t){for(var e="",r=0;r<t.length;r++)e+=(n=t[r])<16?"0"+n.toString(16):n.toString(16);var n;return e}(e):e},c.prototype.final=c.prototype.digest,t.exports=c},461:(t,e,r)=>{"use strict";var n=r(7784),i=r(5615);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)r.push(parseInt(t[i]+t[i+1],16))}else for(var n=0,i=0;i<t.length;i++){var a=t.charCodeAt(i);a<128?r[n++]=a:a<2048?(r[n++]=a>>6|192,r[n++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),r[n++]=a>>18|240,r[n++]=a>>12&63|128,r[n++]=a>>6&63|128,r[n++]=63&a|128):(r[n++]=a>>12|224,r[n++]=a>>6&63|128,r[n++]=63&a|128)}else for(i=0;i<t.length;i++)r[i]=0|t[i];return r},e.toHex=function(t){for(var e="",r=0;r<t.length;r++)e+=s(t[r].toString(16));return e},e.htonl=a,e.toHex32=function(t,e){for(var r="",n=0;n<t.length;n++){var i=t[n];"little"===e&&(i=a(i)),r+=u(i.toString(16))}return r},e.zero2=s,e.zero8=u,e.join32=function(t,e,r,i){var o=r-e;n(o%4==0);for(var a=new Array(o/4),s=0,u=e;s<a.length;s++,u+=4){var f;f="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],a[s]=f>>>0}return a},e.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n<t.length;n++,i+=4){var o=t[n];"big"===e?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,r){return t+e+r>>>0},e.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},e.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},e.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o<n?1:0)+r+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,r,n){return(e+n>>>0<e?1:0)+t+r>>>0},e.sum64_lo=function(t,e,r,n){return e+n>>>0},e.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,f=e;return u+=(f=f+n>>>0)<e?1:0,u+=(f=f+o>>>0)<o?1:0,t+r+i+a+(u+=(f=f+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},e.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,f){var h=0,c=e;return h+=(c=c+n>>>0)<e?1:0,h+=(c=c+o>>>0)<o?1:0,h+=(c=c+s>>>0)<s?1:0,t+r+i+a+u+(h+=(c=c+f>>>0)<f?1:0)>>>0},e.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,f){return e+n+o+s+f>>>0},e.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},e.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},e.shr64_hi=function(t,e,r){return t>>>r},e.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},528:(t,e,r)=>{"use strict";var n,i=r(9629),o=r(9838),a=r(9110),s=r(1155),u=r(4943),f=r(5731),h=r(3468),c=r(2140),l=r(8479),d=r(8449),p=r(8129),m=r(2387),g=r(5865),y=r(1319),b=r(6882),v=Function,w=function(t){try{return v('"use strict"; return ('+t+").constructor;")()}catch(t){}},M=r(9336),_=r(4940),A=function(){throw new h},E=M?function(){try{return A}catch(t){try{return M(arguments,"callee").get}catch(t){return A}}}():A,S=r(3558)(),x=r(6369),k=r(7345),B=r(7859),R=r(6095),O=r(4531),T={},I="undefined"!=typeof Uint8Array&&x?x(Uint8Array):n,P={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":S&&x?x([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":T,"%AsyncGenerator%":T,"%AsyncGeneratorFunction%":T,"%AsyncIteratorPrototype%":T,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o,"%eval%":eval,"%EvalError%":a,"%Float16Array%":"undefined"==typeof Float16Array?n:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":T,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":S&&x?x(x([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&S&&x?x((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":M,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":s,"%ReferenceError%":u,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&S&&x?x((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":S&&x?x(""[Symbol.iterator]()):n,"%Symbol%":S?Symbol:n,"%SyntaxError%":f,"%ThrowTypeError%":E,"%TypedArray%":I,"%TypeError%":h,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet,"%Function.prototype.call%":O,"%Function.prototype.apply%":R,"%Object.defineProperty%":_,"%Object.getPrototypeOf%":k,"%Math.abs%":l,"%Math.floor%":d,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":g,"%Math.round%":y,"%Math.sign%":b,"%Reflect.getPrototypeOf%":B};if(x)try{null.error}catch(t){var N=x(x(t));P["%Error.prototype%"]=N}var U=function t(e){var r;if("%AsyncFunction%"===e)r=w("async function () {}");else if("%GeneratorFunction%"===e)r=w("function* () {}");else if("%AsyncGeneratorFunction%"===e)r=w("async function* () {}");else if("%AsyncGenerator%"===e){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&x&&(r=x(i.prototype))}return P[e]=r,r},L={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},j=r(9138),C=r(8554),F=j.call(O,Array.prototype.concat),z=j.call(R,Array.prototype.splice),D=j.call(O,String.prototype.replace),q=j.call(O,String.prototype.slice),K=j.call(O,RegExp.prototype.exec),H=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,V=/\\(\\)?/g,W=function(t,e){var r,n=t;if(C(L,n)&&(n="%"+(r=L[n])[0]+"%"),C(P,n)){var i=P[n];if(i===T&&(i=U(n)),void 0===i&&!e)throw new h("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new f("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new h("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new h('"allowMissing" argument must be a boolean');if(null===K(/^%?[^%]*%?$/,t))throw new f("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(t){var e=q(t,0,1),r=q(t,-1);if("%"===e&&"%"!==r)throw new f("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==e)throw new f("invalid intrinsic syntax, expected opening `%`");var n=[];return D(t,H,(function(t,e,r,i){n[n.length]=r?D(i,V,"$1"):e||t})),n}(t),n=r.length>0?r[0]:"",i=W("%"+n+"%",e),o=i.name,a=i.value,s=!1,u=i.alias;u&&(n=u[0],z(r,F([0,1],u)));for(var c=1,l=!0;c<r.length;c+=1){var d=r[c],p=q(d,0,1),m=q(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===m||"'"===m||"`"===m)&&p!==m)throw new f("property names with quotes must have matching quotes");if("constructor"!==d&&l||(s=!0),C(P,o="%"+(n+="."+d)+"%"))a=P[o];else if(null!=a){if(!(d in a)){if(!e)throw new h("base intrinsic for "+t+" exists, but the property is not available.");return}if(M&&c+1>=r.length){var g=M(a,d);a=(l=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[d]}else l=C(a,d),a=a[d];l&&!s&&(P[o]=a)}}return a}},536:(t,e,r)=>{"use strict";var n=r(461),i=r(2191),o=r(600),a=r(7784),s=n.sum32,u=n.sum32_4,f=n.sum32_5,h=o.ch32,c=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,g=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}n.inherits(b,g),t.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=funct