@peerbit/server 1.0.5 → 1.0.7
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.
|
@@ -61,10 +61,10 @@ Error generating stack: `+rt.message+`
|
|
|
61
61
|
`,ethKeccak256Hash=i=>new Uint8Array(sha3.keccak256.update(concat$1([toUtf8Bytes(messagePrefix$1),toUtf8Bytes(String(i.length)),i])).arrayBuffer());var PreHash;(function(i){i[i.NONE=0]="NONE",i[i.SHA_256=1]="SHA_256",i[i.ETH_KECCAK_256=3]="ETH_KECCAK_256"})(PreHash||(PreHash={}));const prehashFn=(i,a)=>{if(a===PreHash.NONE)return i;if(a===PreHash.SHA_256)return sha256$3(i);if(a===PreHash.ETH_KECCAK_256)return ethKeccak256Hash(i);throw new Error("Unsupported")};function keccak256(i){return"0x"+sha3.keccak_256(arrayify(i))}const version$e="rlp/5.7.0",logger$e=new Logger(version$e);function arrayifyInteger(i){const a=[];for(;i;)a.unshift(i&255),i>>=8;return a}function _encode(i){if(Array.isArray(i)){let _=[];if(i.forEach(function(rt){_=_.concat(_encode(rt))}),_.length<=55)return _.unshift(192+_.length),_;const et=arrayifyInteger(_.length);return et.unshift(247+et.length),et.concat(_)}isBytesLike(i)||logger$e.throwArgumentError("RLP object must be BytesLike","object",i);const a=Array.prototype.slice.call(arrayify(i));if(a.length===1&&a[0]<=127)return a;if(a.length<=55)return a.unshift(128+a.length),a;const o=arrayifyInteger(a.length);return o.unshift(183+o.length),o.concat(a)}function encode$1(i){return hexlify(_encode(i))}const version$d="address/5.7.0",logger$d=new Logger(version$d);function getChecksumAddress(i){isHexString(i,20)||logger$d.throwArgumentError("invalid address","address",i),i=i.toLowerCase();const a=i.substring(2).split(""),o=new Uint8Array(40);for(let et=0;et<40;et++)o[et]=a[et].charCodeAt(0);const _=arrayify(keccak256(o));for(let et=0;et<40;et+=2)_[et>>1]>>4>=8&&(a[et]=a[et].toUpperCase()),(_[et>>1]&15)>=8&&(a[et+1]=a[et+1].toUpperCase());return"0x"+a.join("")}const MAX_SAFE_INTEGER=9007199254740991;function log10(i){return Math.log10?Math.log10(i):Math.log(i)/Math.LN10}const ibanLookup={};for(let i=0;i<10;i++)ibanLookup[String(i)]=String(i);for(let i=0;i<26;i++)ibanLookup[String.fromCharCode(65+i)]=String(10+i);const safeDigits=Math.floor(log10(MAX_SAFE_INTEGER));function ibanChecksum(i){i=i.toUpperCase(),i=i.substring(4)+i.substring(0,2)+"00";let a=i.split("").map(_=>ibanLookup[_]).join("");for(;a.length>=safeDigits;){let _=a.substring(0,safeDigits);a=parseInt(_,10)%97+a.substring(_.length)}let o=String(98-parseInt(a,10)%97);for(;o.length<2;)o="0"+o;return o}function getAddress(i){let a=null;if(typeof i!="string"&&logger$d.throwArgumentError("invalid address","address",i),i.match(/^(0x)?[0-9a-fA-F]{40}$/))i.substring(0,2)!=="0x"&&(i="0x"+i),a=getChecksumAddress(i),i.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&a!==i&&logger$d.throwArgumentError("bad address checksum","address",i);else if(i.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(i.substring(2,4)!==ibanChecksum(i)&&logger$d.throwArgumentError("bad icap checksum","address",i),a=_base36To16(i.substring(4));a.length<40;)a="0"+a;a=getChecksumAddress("0x"+a)}else logger$d.throwArgumentError("invalid address","address",i);return a}const version$c="properties/5.7.0";var __awaiter$5=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger$c=new Logger(version$c);function defineReadOnly(i,a,o){Object.defineProperty(i,a,{enumerable:!0,value:o,writable:!1})}function resolveProperties(i){return __awaiter$5(this,void 0,void 0,function*(){const a=Object.keys(i).map(_=>{const et=i[_];return Promise.resolve(et).then(rt=>({key:_,value:rt}))});return(yield Promise.all(a)).reduce((_,et)=>(_[et.key]=et.value,_),{})})}function checkProperties(i,a){(!i||typeof i!="object")&&logger$c.throwArgumentError("invalid object","object",i),Object.keys(i).forEach(o=>{a[o]||logger$c.throwArgumentError("invalid object key - "+o,"transaction:"+o,i)})}function shallowCopy(i){const a={};for(const o in i)a[o]=i[o];return a}const opaque={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function _isFrozen(i){if(i==null||opaque[typeof i])return!0;if(Array.isArray(i)||typeof i=="object"){if(!Object.isFrozen(i))return!1;const a=Object.keys(i);for(let o=0;o<a.length;o++){let _=null;try{_=i[a[o]]}catch{continue}if(!_isFrozen(_))return!1}return!0}return logger$c.throwArgumentError(`Cannot deepCopy ${typeof i}`,"object",i)}function _deepCopy(i){if(_isFrozen(i))return i;if(Array.isArray(i))return Object.freeze(i.map(a=>deepCopy(a)));if(typeof i=="object"){const a={};for(const o in i){const _=i[o];_!==void 0&&defineReadOnly(a,o,deepCopy(_))}return a}return logger$c.throwArgumentError(`Cannot deepCopy ${typeof i}`,"object",i)}function deepCopy(i){return _deepCopy(i)}class Description{constructor(a){for(const o in a)this[o]=deepCopy(a[o])}}const version$b="abstract-provider/5.7.0";var __awaiter$4=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger$b=new Logger(version$b);class Provider{constructor(){logger$b.checkAbstract(new.target,Provider),defineReadOnly(this,"_isProvider",!0)}getFeeData(){return __awaiter$4(this,void 0,void 0,function*(){const{block:a,gasPrice:o}=yield resolveProperties({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(ot=>null)});let _=null,et=null,rt=null;return a&&a.baseFeePerGas&&(_=a.baseFeePerGas,rt=BigNumber.from("1500000000"),et=a.baseFeePerGas.mul(2).add(rt)),{lastBaseFeePerGas:_,maxFeePerGas:et,maxPriorityFeePerGas:rt,gasPrice:o}})}addListener(a,o){return this.on(a,o)}removeListener(a,o){return this.off(a,o)}static isProvider(a){return!!(a&&a._isProvider)}}const version$a="abstract-signer/5.7.0";var __awaiter$3=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger$a=new Logger(version$a),allowedTransactionKeys$1=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],forwardErrors=[Logger.errors.INSUFFICIENT_FUNDS,Logger.errors.NONCE_EXPIRED,Logger.errors.REPLACEMENT_UNDERPRICED];class Signer{constructor(){logger$a.checkAbstract(new.target,Signer),defineReadOnly(this,"_isSigner",!0)}getBalance(a){return __awaiter$3(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),a)})}getTransactionCount(a){return __awaiter$3(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),a)})}estimateGas(a){return __awaiter$3(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const o=yield resolveProperties(this.checkTransaction(a));return yield this.provider.estimateGas(o)})}call(a,o){return __awaiter$3(this,void 0,void 0,function*(){this._checkProvider("call");const _=yield resolveProperties(this.checkTransaction(a));return yield this.provider.call(_,o)})}sendTransaction(a){return __awaiter$3(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const o=yield this.populateTransaction(a),_=yield this.signTransaction(o);return yield this.provider.sendTransaction(_)})}getChainId(){return __awaiter$3(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return __awaiter$3(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return __awaiter$3(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(a){return __awaiter$3(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(a)})}checkTransaction(a){for(const _ in a)allowedTransactionKeys$1.indexOf(_)===-1&&logger$a.throwArgumentError("invalid transaction key: "+_,"transaction",a);const o=shallowCopy(a);return o.from==null?o.from=this.getAddress():o.from=Promise.all([Promise.resolve(o.from),this.getAddress()]).then(_=>(_[0].toLowerCase()!==_[1].toLowerCase()&&logger$a.throwArgumentError("from address mismatch","transaction",a),_[0])),o}populateTransaction(a){return __awaiter$3(this,void 0,void 0,function*(){const o=yield resolveProperties(this.checkTransaction(a));o.to!=null&&(o.to=Promise.resolve(o.to).then(et=>__awaiter$3(this,void 0,void 0,function*(){if(et==null)return null;const rt=yield this.resolveName(et);return rt==null&&logger$a.throwArgumentError("provided ENS name resolves to null","tx.to",et),rt})),o.to.catch(et=>{}));const _=o.maxFeePerGas!=null||o.maxPriorityFeePerGas!=null;if(o.gasPrice!=null&&(o.type===2||_)?logger$a.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",a):(o.type===0||o.type===1)&&_&&logger$a.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",a),(o.type===2||o.type==null)&&o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)o.type=2;else if(o.type===0||o.type===1)o.gasPrice==null&&(o.gasPrice=this.getGasPrice());else{const et=yield this.getFeeData();if(o.type==null)if(et.maxFeePerGas!=null&&et.maxPriorityFeePerGas!=null)if(o.type=2,o.gasPrice!=null){const rt=o.gasPrice;delete o.gasPrice,o.maxFeePerGas=rt,o.maxPriorityFeePerGas=rt}else o.maxFeePerGas==null&&(o.maxFeePerGas=et.maxFeePerGas),o.maxPriorityFeePerGas==null&&(o.maxPriorityFeePerGas=et.maxPriorityFeePerGas);else et.gasPrice!=null?(_&&logger$a.throwError("network does not support EIP-1559",Logger.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),o.gasPrice==null&&(o.gasPrice=et.gasPrice),o.type=0):logger$a.throwError("failed to get consistent fee data",Logger.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else o.type===2&&(o.maxFeePerGas==null&&(o.maxFeePerGas=et.maxFeePerGas),o.maxPriorityFeePerGas==null&&(o.maxPriorityFeePerGas=et.maxPriorityFeePerGas))}return o.nonce==null&&(o.nonce=this.getTransactionCount("pending")),o.gasLimit==null&&(o.gasLimit=this.estimateGas(o).catch(et=>{if(forwardErrors.indexOf(et.code)>=0)throw et;return logger$a.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:et,tx:o})})),o.chainId==null?o.chainId=this.getChainId():o.chainId=Promise.all([Promise.resolve(o.chainId),this.getChainId()]).then(et=>(et[1]!==0&&et[0]!==et[1]&&logger$a.throwArgumentError("chainId address mismatch","transaction",a),et[0])),yield resolveProperties(o)})}_checkProvider(a){this.provider||logger$a.throwError("missing provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:a||"_checkProvider"})}static isSigner(a){return!!(a&&a._isSigner)}}function id(i){return keccak256(toUtf8Bytes(i))}const version$9="hash/5.7.0",messagePrefix=`Ethereum Signed Message:
|
|
62
62
|
`;function hashMessage(i){return typeof i=="string"&&(i=toUtf8Bytes(i)),keccak256(concat([toUtf8Bytes(messagePrefix),toUtf8Bytes(String(i.length)),i]))}var __awaiter$2=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger$9=new Logger(version$9),padding$1=new Uint8Array(32);padding$1.fill(0);const NegativeOne=BigNumber.from(-1),Zero=BigNumber.from(0),One=BigNumber.from(1),MaxUint256=BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function hexPadRight(i){const a=arrayify(i),o=a.length%32;return o?hexConcat([a,padding$1.slice(o)]):hexlify(a)}const hexTrue=hexZeroPad(One.toHexString(),32),hexFalse=hexZeroPad(Zero.toHexString(),32),domainFieldTypes={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},domainFieldNames=["name","version","chainId","verifyingContract","salt"];function checkString(i){return function(a){return typeof a!="string"&&logger$9.throwArgumentError(`invalid domain value for ${JSON.stringify(i)}`,`domain.${i}`,a),a}}const domainChecks={name:checkString("name"),version:checkString("version"),chainId:function(i){try{return BigNumber.from(i).toString()}catch{}return logger$9.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",i)},verifyingContract:function(i){try{return getAddress(i).toLowerCase()}catch{}return logger$9.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",i)},salt:function(i){try{const a=arrayify(i);if(a.length!==32)throw new Error("bad length");return hexlify(a)}catch{}return logger$9.throwArgumentError('invalid domain value "salt"',"domain.salt",i)}};function getBaseEncoder(i){{const a=i.match(/^(u?)int(\d*)$/);if(a){const o=a[1]==="",_=parseInt(a[2]||"256");(_%8!==0||_>256||a[2]&&a[2]!==String(_))&&logger$9.throwArgumentError("invalid numeric width","type",i);const et=MaxUint256.mask(o?_-1:_),rt=o?et.add(One).mul(NegativeOne):Zero;return function(ot){const ft=BigNumber.from(ot);return(ft.lt(rt)||ft.gt(et))&&logger$9.throwArgumentError(`value out-of-bounds for ${i}`,"value",ot),hexZeroPad(ft.toTwos(256).toHexString(),32)}}}{const a=i.match(/^bytes(\d+)$/);if(a){const o=parseInt(a[1]);return(o===0||o>32||a[1]!==String(o))&&logger$9.throwArgumentError("invalid bytes width","type",i),function(_){return arrayify(_).length!==o&&logger$9.throwArgumentError(`invalid length for ${i}`,"value",_),hexPadRight(_)}}}switch(i){case"address":return function(a){return hexZeroPad(getAddress(a),32)};case"bool":return function(a){return a?hexTrue:hexFalse};case"bytes":return function(a){return keccak256(a)};case"string":return function(a){return id(a)}}return null}function encodeType(i,a){return`${i}(${a.map(({name:o,type:_})=>_+" "+o).join(",")})`}class TypedDataEncoder{constructor(a){defineReadOnly(this,"types",Object.freeze(deepCopy(a))),defineReadOnly(this,"_encoderCache",{}),defineReadOnly(this,"_types",{});const o={},_={},et={};Object.keys(a).forEach(ft=>{o[ft]={},_[ft]=[],et[ft]={}});for(const ft in a){const lt={};a[ft].forEach(ht=>{lt[ht.name]&&logger$9.throwArgumentError(`duplicate variable name ${JSON.stringify(ht.name)} in ${JSON.stringify(ft)}`,"types",a),lt[ht.name]=!0;const vt=ht.type.match(/^([^\x5b]*)(\x5b|$)/)[1];vt===ft&&logger$9.throwArgumentError(`circular type reference to ${JSON.stringify(vt)}`,"types",a),!getBaseEncoder(vt)&&(_[vt]||logger$9.throwArgumentError(`unknown type ${JSON.stringify(vt)}`,"types",a),_[vt].push(ft),o[ft][vt]=!0)})}const rt=Object.keys(_).filter(ft=>_[ft].length===0);rt.length===0?logger$9.throwArgumentError("missing primary type","types",a):rt.length>1&&logger$9.throwArgumentError(`ambiguous primary types or unused types: ${rt.map(ft=>JSON.stringify(ft)).join(", ")}`,"types",a),defineReadOnly(this,"primaryType",rt[0]);function ot(ft,lt){lt[ft]&&logger$9.throwArgumentError(`circular type reference to ${JSON.stringify(ft)}`,"types",a),lt[ft]=!0,Object.keys(o[ft]).forEach(ht=>{_[ht]&&(ot(ht,lt),Object.keys(lt).forEach(vt=>{et[vt][ht]=!0}))}),delete lt[ft]}ot(this.primaryType,{});for(const ft in et){const lt=Object.keys(et[ft]);lt.sort(),this._types[ft]=encodeType(ft,a[ft])+lt.map(ht=>encodeType(ht,a[ht])).join("")}}getEncoder(a){let o=this._encoderCache[a];return o||(o=this._encoderCache[a]=this._getEncoder(a)),o}_getEncoder(a){{const et=getBaseEncoder(a);if(et)return et}const o=a.match(/^(.*)(\x5b(\d*)\x5d)$/);if(o){const et=o[1],rt=this.getEncoder(et),ot=parseInt(o[3]);return ft=>{ot>=0&&ft.length!==ot&&logger$9.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",ft);let lt=ft.map(rt);return this._types[et]&&(lt=lt.map(keccak256)),keccak256(hexConcat(lt))}}const _=this.types[a];if(_){const et=id(this._types[a]);return rt=>{const ot=_.map(({name:ft,type:lt})=>{const ht=this.getEncoder(lt)(rt[ft]);return this._types[lt]?keccak256(ht):ht});return ot.unshift(et),hexConcat(ot)}}return logger$9.throwArgumentError(`unknown type: ${a}`,"type",a)}encodeType(a){const o=this._types[a];return o||logger$9.throwArgumentError(`unknown type: ${JSON.stringify(a)}`,"name",a),o}encodeData(a,o){return this.getEncoder(a)(o)}hashStruct(a,o){return keccak256(this.encodeData(a,o))}encode(a){return this.encodeData(this.primaryType,a)}hash(a){return this.hashStruct(this.primaryType,a)}_visit(a,o,_){if(getBaseEncoder(a))return _(a,o);const et=a.match(/^(.*)(\x5b(\d*)\x5d)$/);if(et){const ot=et[1],ft=parseInt(et[3]);return ft>=0&&o.length!==ft&&logger$9.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",o),o.map(lt=>this._visit(ot,lt,_))}const rt=this.types[a];return rt?rt.reduce((ot,{name:ft,type:lt})=>(ot[ft]=this._visit(lt,o[ft],_),ot),{}):logger$9.throwArgumentError(`unknown type: ${a}`,"type",a)}visit(a,o){return this._visit(this.primaryType,a,o)}static from(a){return new TypedDataEncoder(a)}static getPrimaryType(a){return TypedDataEncoder.from(a).primaryType}static hashStruct(a,o,_){return TypedDataEncoder.from(o).hashStruct(a,_)}static hashDomain(a){const o=[];for(const _ in a){const et=domainFieldTypes[_];et||logger$9.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(_)}`,"domain",a),o.push({name:_,type:et})}return o.sort((_,et)=>domainFieldNames.indexOf(_.name)-domainFieldNames.indexOf(et.name)),TypedDataEncoder.hashStruct("EIP712Domain",{EIP712Domain:o},a)}static encode(a,o,_){return hexConcat(["0x1901",TypedDataEncoder.hashDomain(a),TypedDataEncoder.from(o).hash(_)])}static hash(a,o,_){return keccak256(TypedDataEncoder.encode(a,o,_))}static resolveNames(a,o,_,et){return __awaiter$2(this,void 0,void 0,function*(){a=shallowCopy(a);const rt={};a.verifyingContract&&!isHexString(a.verifyingContract,20)&&(rt[a.verifyingContract]="0x");const ot=TypedDataEncoder.from(o);ot.visit(_,(ft,lt)=>(ft==="address"&&!isHexString(lt,20)&&(rt[lt]="0x"),lt));for(const ft in rt)rt[ft]=yield et(ft);return a.verifyingContract&&rt[a.verifyingContract]&&(a.verifyingContract=rt[a.verifyingContract]),_=ot.visit(_,(ft,lt)=>ft==="address"&&rt[lt]?rt[lt]:lt),{domain:a,value:_}})}static getPayload(a,o,_){TypedDataEncoder.hashDomain(a);const et={},rt=[];domainFieldNames.forEach(lt=>{const ht=a[lt];ht!=null&&(et[lt]=domainChecks[lt](ht),rt.push({name:lt,type:domainFieldTypes[lt]}))});const ot=TypedDataEncoder.from(o),ft=shallowCopy(o);return ft.EIP712Domain?logger$9.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",o):ft.EIP712Domain=rt,ot.encode(_),{types:ft,domain:et,primaryType:ot.primaryType,message:ot.visit(_,(lt,ht)=>{if(lt.match(/^bytes(\d*)/))return hexlify(arrayify(ht));if(lt.match(/^u?int/))return BigNumber.from(ht).toString();switch(lt){case"address":return ht.toLowerCase();case"bool":return!!ht;case"string":return typeof ht!="string"&&logger$9.throwArgumentError("invalid string","value",ht),ht}return logger$9.throwArgumentError("unsupported type","type",lt)})}}}class BaseX{constructor(a){defineReadOnly(this,"alphabet",a),defineReadOnly(this,"base",a.length),defineReadOnly(this,"_alphabetMap",{}),defineReadOnly(this,"_leader",a.charAt(0));for(let o=0;o<a.length;o++)this._alphabetMap[a.charAt(o)]=o}encode(a){let o=arrayify(a);if(o.length===0)return"";let _=[0];for(let rt=0;rt<o.length;++rt){let ot=o[rt];for(let ft=0;ft<_.length;++ft)ot+=_[ft]<<8,_[ft]=ot%this.base,ot=ot/this.base|0;for(;ot>0;)_.push(ot%this.base),ot=ot/this.base|0}let et="";for(let rt=0;o[rt]===0&&rt<o.length-1;++rt)et+=this._leader;for(let rt=_.length-1;rt>=0;--rt)et+=this.alphabet[_[rt]];return et}decode(a){if(typeof a!="string")throw new TypeError("Expected String");let o=[];if(a.length===0)return new Uint8Array(o);o.push(0);for(let _=0;_<a.length;_++){let et=this._alphabetMap[a[_]];if(et===void 0)throw new Error("Non-base"+this.base+" character");let rt=et;for(let ot=0;ot<o.length;++ot)rt+=o[ot]*this.base,o[ot]=rt&255,rt>>=8;for(;rt>0;)o.push(rt&255),rt>>=8}for(let _=0;a[_]===this._leader&&_<a.length-1;++_)o.push(0);return arrayify(new Uint8Array(o.reverse()))}}new BaseX("abcdefghijklmnopqrstuvwxyz234567");const Base58=new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var hash$4={},utils$m={},minimalisticAssert$1=assert$g;function assert$g(i,a){if(!i)throw new Error(a||"Assertion failed")}assert$g.equal=function i(a,o,_){if(a!=o)throw new Error(_||"Assertion failed: "+a+" != "+o)};var inherits_browser$1={exports:{}};typeof Object.create=="function"?inherits_browser$1.exports=function(a,o){o&&(a.super_=o,a.prototype=Object.create(o.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser$1.exports=function(a,o){if(o){a.super_=o;var _=function(){};_.prototype=o.prototype,a.prototype=new _,a.prototype.constructor=a}};var inherits_browserExports=inherits_browser$1.exports,assert$f=minimalisticAssert$1,inherits$3=inherits_browserExports;utils$m.inherits=inherits$3;function isSurrogatePair(i,a){return(i.charCodeAt(a)&64512)!==55296||a<0||a+1>=i.length?!1:(i.charCodeAt(a+1)&64512)===56320}function toArray(i,a){if(Array.isArray(i))return i.slice();if(!i)return[];var o=[];if(typeof i=="string")if(a){if(a==="hex")for(i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i),et=0;et<i.length;et+=2)o.push(parseInt(i[et]+i[et+1],16))}else for(var _=0,et=0;et<i.length;et++){var rt=i.charCodeAt(et);rt<128?o[_++]=rt:rt<2048?(o[_++]=rt>>6|192,o[_++]=rt&63|128):isSurrogatePair(i,et)?(rt=65536+((rt&1023)<<10)+(i.charCodeAt(++et)&1023),o[_++]=rt>>18|240,o[_++]=rt>>12&63|128,o[_++]=rt>>6&63|128,o[_++]=rt&63|128):(o[_++]=rt>>12|224,o[_++]=rt>>6&63|128,o[_++]=rt&63|128)}else for(et=0;et<i.length;et++)o[et]=i[et]|0;return o}utils$m.toArray=toArray;function toHex(i){for(var a="",o=0;o<i.length;o++)a+=zero2(i[o].toString(16));return a}utils$m.toHex=toHex;function htonl(i){var a=i>>>24|i>>>8&65280|i<<8&16711680|(i&255)<<24;return a>>>0}utils$m.htonl=htonl;function toHex32(i,a){for(var o="",_=0;_<i.length;_++){var et=i[_];a==="little"&&(et=htonl(et)),o+=zero8(et.toString(16))}return o}utils$m.toHex32=toHex32;function zero2(i){return i.length===1?"0"+i:i}utils$m.zero2=zero2;function zero8(i){return i.length===7?"0"+i:i.length===6?"00"+i:i.length===5?"000"+i:i.length===4?"0000"+i:i.length===3?"00000"+i:i.length===2?"000000"+i:i.length===1?"0000000"+i:i}utils$m.zero8=zero8;function join32(i,a,o,_){var et=o-a;assert$f(et%4===0);for(var rt=new Array(et/4),ot=0,ft=a;ot<rt.length;ot++,ft+=4){var lt;_==="big"?lt=i[ft]<<24|i[ft+1]<<16|i[ft+2]<<8|i[ft+3]:lt=i[ft+3]<<24|i[ft+2]<<16|i[ft+1]<<8|i[ft],rt[ot]=lt>>>0}return rt}utils$m.join32=join32;function split32(i,a){for(var o=new Array(i.length*4),_=0,et=0;_<i.length;_++,et+=4){var rt=i[_];a==="big"?(o[et]=rt>>>24,o[et+1]=rt>>>16&255,o[et+2]=rt>>>8&255,o[et+3]=rt&255):(o[et+3]=rt>>>24,o[et+2]=rt>>>16&255,o[et+1]=rt>>>8&255,o[et]=rt&255)}return o}utils$m.split32=split32;function rotr32$1(i,a){return i>>>a|i<<32-a}utils$m.rotr32=rotr32$1;function rotl32$2(i,a){return i<<a|i>>>32-a}utils$m.rotl32=rotl32$2;function sum32$3(i,a){return i+a>>>0}utils$m.sum32=sum32$3;function sum32_3$1(i,a,o){return i+a+o>>>0}utils$m.sum32_3=sum32_3$1;function sum32_4$2(i,a,o,_){return i+a+o+_>>>0}utils$m.sum32_4=sum32_4$2;function sum32_5$2(i,a,o,_,et){return i+a+o+_+et>>>0}utils$m.sum32_5=sum32_5$2;function sum64$1(i,a,o,_){var et=i[a],rt=i[a+1],ot=_+rt>>>0,ft=(ot<_?1:0)+o+et;i[a]=ft>>>0,i[a+1]=ot}utils$m.sum64=sum64$1;function sum64_hi$1(i,a,o,_){var et=a+_>>>0,rt=(et<a?1:0)+i+o;return rt>>>0}utils$m.sum64_hi=sum64_hi$1;function sum64_lo$1(i,a,o,_){var et=a+_;return et>>>0}utils$m.sum64_lo=sum64_lo$1;function sum64_4_hi$1(i,a,o,_,et,rt,ot,ft){var lt=0,ht=a;ht=ht+_>>>0,lt+=ht<a?1:0,ht=ht+rt>>>0,lt+=ht<rt?1:0,ht=ht+ft>>>0,lt+=ht<ft?1:0;var vt=i+o+et+ot+lt;return vt>>>0}utils$m.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(i,a,o,_,et,rt,ot,ft){var lt=a+_+rt+ft;return lt>>>0}utils$m.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(i,a,o,_,et,rt,ot,ft,lt,ht){var vt=0,It=a;It=It+_>>>0,vt+=It<a?1:0,It=It+rt>>>0,vt+=It<rt?1:0,It=It+ft>>>0,vt+=It<ft?1:0,It=It+ht>>>0,vt+=It<ht?1:0;var Qt=i+o+et+ot+lt+vt;return Qt>>>0}utils$m.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(i,a,o,_,et,rt,ot,ft,lt,ht){var vt=a+_+rt+ft+ht;return vt>>>0}utils$m.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(i,a,o){var _=a<<32-o|i>>>o;return _>>>0}utils$m.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(i,a,o){var _=i<<32-o|a>>>o;return _>>>0}utils$m.rotr64_lo=rotr64_lo$1;function shr64_hi$1(i,a,o){return i>>>o}utils$m.shr64_hi=shr64_hi$1;function shr64_lo$1(i,a,o){var _=i<<32-o|a>>>o;return _>>>0}utils$m.shr64_lo=shr64_lo$1;var common$7={},utils$l=utils$m,assert$e=minimalisticAssert$1;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$7.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function i(a,o){if(a=utils$l.toArray(a,o),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;var _=a.length%this._delta8;this.pending=a.slice(a.length-_,a.length),this.pending.length===0&&(this.pending=null),a=utils$l.join32(a,0,a.length-_,this.endian);for(var et=0;et<a.length;et+=this._delta32)this._update(a,et,et+this._delta32)}return this};BlockHash$4.prototype.digest=function i(a){return this.update(this._pad()),assert$e(this.pending===null),this._digest(a)};BlockHash$4.prototype._pad=function i(){var a=this.pendingTotal,o=this._delta8,_=o-(a+this.padLength)%o,et=new Array(_+this.padLength);et[0]=128;for(var rt=1;rt<_;rt++)et[rt]=0;if(a<<=3,this.endian==="big"){for(var ot=8;ot<this.padLength;ot++)et[rt++]=0;et[rt++]=0,et[rt++]=0,et[rt++]=0,et[rt++]=0,et[rt++]=a>>>24&255,et[rt++]=a>>>16&255,et[rt++]=a>>>8&255,et[rt++]=a&255}else for(et[rt++]=a&255,et[rt++]=a>>>8&255,et[rt++]=a>>>16&255,et[rt++]=a>>>24&255,et[rt++]=0,et[rt++]=0,et[rt++]=0,et[rt++]=0,ot=8;ot<this.padLength;ot++)et[rt++]=0;return et};var sha={},common$6={},utils$k=utils$m,rotr32=utils$k.rotr32;function ft_1$1(i,a,o,_){if(i===0)return ch32$1(a,o,_);if(i===1||i===3)return p32(a,o,_);if(i===2)return maj32$1(a,o,_)}common$6.ft_1=ft_1$1;function ch32$1(i,a,o){return i&a^~i&o}common$6.ch32=ch32$1;function maj32$1(i,a,o){return i&a^i&o^a&o}common$6.maj32=maj32$1;function p32(i,a,o){return i^a^o}common$6.p32=p32;function s0_256$1(i){return rotr32(i,2)^rotr32(i,13)^rotr32(i,22)}common$6.s0_256=s0_256$1;function s1_256$1(i){return rotr32(i,6)^rotr32(i,11)^rotr32(i,25)}common$6.s1_256=s1_256$1;function g0_256$1(i){return rotr32(i,7)^rotr32(i,18)^i>>>3}common$6.g0_256=g0_256$1;function g1_256$1(i){return rotr32(i,17)^rotr32(i,19)^i>>>10}common$6.g1_256=g1_256$1;var utils$j=utils$m,common$5=common$7,shaCommon$1=common$6,rotl32$1=utils$j.rotl32,sum32$2=utils$j.sum32,sum32_5$1=utils$j.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$5.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$j.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function i(a,o){for(var _=this.W,et=0;et<16;et++)_[et]=a[o+et];for(;et<_.length;et++)_[et]=rotl32$1(_[et-3]^_[et-8]^_[et-14]^_[et-16],1);var rt=this.h[0],ot=this.h[1],ft=this.h[2],lt=this.h[3],ht=this.h[4];for(et=0;et<_.length;et++){var vt=~~(et/20),It=sum32_5$1(rotl32$1(rt,5),ft_1(vt,ot,ft,lt),ht,_[et],sha1_K[vt]);ht=lt,lt=ft,ft=rotl32$1(ot,30),ot=rt,rt=It}this.h[0]=sum32$2(this.h[0],rt),this.h[1]=sum32$2(this.h[1],ot),this.h[2]=sum32$2(this.h[2],ft),this.h[3]=sum32$2(this.h[3],lt),this.h[4]=sum32$2(this.h[4],ht)};SHA1.prototype._digest=function i(a){return a==="hex"?utils$j.toHex32(this.h,"big"):utils$j.split32(this.h,"big")};var utils$i=utils$m,common$4=common$7,shaCommon=common$6,assert$d=minimalisticAssert$1,sum32$1=utils$i.sum32,sum32_4$1=utils$i.sum32_4,sum32_5=utils$i.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$4.BlockHash,sha256_K=[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 SHA256$1(){if(!(this instanceof SHA256$1))return new SHA256$1;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$i.inherits(SHA256$1,BlockHash$2);var _256=SHA256$1;SHA256$1.blockSize=512;SHA256$1.outSize=256;SHA256$1.hmacStrength=192;SHA256$1.padLength=64;SHA256$1.prototype._update=function i(a,o){for(var _=this.W,et=0;et<16;et++)_[et]=a[o+et];for(;et<_.length;et++)_[et]=sum32_4$1(g1_256(_[et-2]),_[et-7],g0_256(_[et-15]),_[et-16]);var rt=this.h[0],ot=this.h[1],ft=this.h[2],lt=this.h[3],ht=this.h[4],vt=this.h[5],It=this.h[6],Qt=this.h[7];for(assert$d(this.k.length===_.length),et=0;et<_.length;et++){var mt=sum32_5(Qt,s1_256(ht),ch32(ht,vt,It),this.k[et],_[et]),Yt=sum32$1(s0_256(rt),maj32(rt,ot,ft));Qt=It,It=vt,vt=ht,ht=sum32$1(lt,mt),lt=ft,ft=ot,ot=rt,rt=sum32$1(mt,Yt)}this.h[0]=sum32$1(this.h[0],rt),this.h[1]=sum32$1(this.h[1],ot),this.h[2]=sum32$1(this.h[2],ft),this.h[3]=sum32$1(this.h[3],lt),this.h[4]=sum32$1(this.h[4],ht),this.h[5]=sum32$1(this.h[5],vt),this.h[6]=sum32$1(this.h[6],It),this.h[7]=sum32$1(this.h[7],Qt)};SHA256$1.prototype._digest=function i(a){return a==="hex"?utils$i.toHex32(this.h,"big"):utils$i.split32(this.h,"big")};var utils$h=utils$m,SHA256=_256;function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$h.inherits(SHA224,SHA256);var _224=SHA224;SHA224.blockSize=512;SHA224.outSize=224;SHA224.hmacStrength=192;SHA224.padLength=64;SHA224.prototype._digest=function i(a){return a==="hex"?utils$h.toHex32(this.h.slice(0,7),"big"):utils$h.split32(this.h.slice(0,7),"big")};var utils$g=utils$m,common$3=common$7,assert$c=minimalisticAssert$1,rotr64_hi=utils$g.rotr64_hi,rotr64_lo=utils$g.rotr64_lo,shr64_hi=utils$g.shr64_hi,shr64_lo=utils$g.shr64_lo,sum64=utils$g.sum64,sum64_hi=utils$g.sum64_hi,sum64_lo=utils$g.sum64_lo,sum64_4_hi=utils$g.sum64_4_hi,sum64_4_lo=utils$g.sum64_4_lo,sum64_5_hi=utils$g.sum64_5_hi,sum64_5_lo=utils$g.sum64_5_lo,BlockHash$1=common$3.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$1(){if(!(this instanceof SHA512$1))return new SHA512$1;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$g.inherits(SHA512$1,BlockHash$1);var _512=SHA512$1;SHA512$1.blockSize=1024;SHA512$1.outSize=512;SHA512$1.hmacStrength=192;SHA512$1.padLength=128;SHA512$1.prototype._prepareBlock=function i(a,o){for(var _=this.W,et=0;et<32;et++)_[et]=a[o+et];for(;et<_.length;et+=2){var rt=g1_512_hi(_[et-4],_[et-3]),ot=g1_512_lo(_[et-4],_[et-3]),ft=_[et-14],lt=_[et-13],ht=g0_512_hi(_[et-30],_[et-29]),vt=g0_512_lo(_[et-30],_[et-29]),It=_[et-32],Qt=_[et-31];_[et]=sum64_4_hi(rt,ot,ft,lt,ht,vt,It,Qt),_[et+1]=sum64_4_lo(rt,ot,ft,lt,ht,vt,It,Qt)}};SHA512$1.prototype._update=function i(a,o){this._prepareBlock(a,o);var _=this.W,et=this.h[0],rt=this.h[1],ot=this.h[2],ft=this.h[3],lt=this.h[4],ht=this.h[5],vt=this.h[6],It=this.h[7],Qt=this.h[8],mt=this.h[9],Yt=this.h[10],Rt=this.h[11],cr=this.h[12],Ut=this.h[13],zt=this.h[14],Gt=this.h[15];assert$c(this.k.length===_.length);for(var Dr=0;Dr<_.length;Dr+=2){var lr=zt,xr=Gt,hr=s1_512_hi(Qt,mt),Hr=s1_512_lo(Qt,mt),vr=ch64_hi(Qt,mt,Yt,Rt,cr),u0=ch64_lo(Qt,mt,Yt,Rt,cr,Ut),Br=this.k[Dr],Kt=this.k[Dr+1],Ft=_[Dr],bt=_[Dr+1],St=sum64_5_hi(lr,xr,hr,Hr,vr,u0,Br,Kt,Ft,bt),Jt=sum64_5_lo(lr,xr,hr,Hr,vr,u0,Br,Kt,Ft,bt);lr=s0_512_hi(et,rt),xr=s0_512_lo(et,rt),hr=maj64_hi(et,rt,ot,ft,lt),Hr=maj64_lo(et,rt,ot,ft,lt,ht);var er=sum64_hi(lr,xr,hr,Hr),sr=sum64_lo(lr,xr,hr,Hr);zt=cr,Gt=Ut,cr=Yt,Ut=Rt,Yt=Qt,Rt=mt,Qt=sum64_hi(vt,It,St,Jt),mt=sum64_lo(It,It,St,Jt),vt=lt,It=ht,lt=ot,ht=ft,ot=et,ft=rt,et=sum64_hi(St,Jt,er,sr),rt=sum64_lo(St,Jt,er,sr)}sum64(this.h,0,et,rt),sum64(this.h,2,ot,ft),sum64(this.h,4,lt,ht),sum64(this.h,6,vt,It),sum64(this.h,8,Qt,mt),sum64(this.h,10,Yt,Rt),sum64(this.h,12,cr,Ut),sum64(this.h,14,zt,Gt)};SHA512$1.prototype._digest=function i(a){return a==="hex"?utils$g.toHex32(this.h,"big"):utils$g.split32(this.h,"big")};function ch64_hi(i,a,o,_,et){var rt=i&o^~i&et;return rt<0&&(rt+=4294967296),rt}function ch64_lo(i,a,o,_,et,rt){var ot=a&_^~a&rt;return ot<0&&(ot+=4294967296),ot}function maj64_hi(i,a,o,_,et){var rt=i&o^i&et^o&et;return rt<0&&(rt+=4294967296),rt}function maj64_lo(i,a,o,_,et,rt){var ot=a&_^a&rt^_&rt;return ot<0&&(ot+=4294967296),ot}function s0_512_hi(i,a){var o=rotr64_hi(i,a,28),_=rotr64_hi(a,i,2),et=rotr64_hi(a,i,7),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function s0_512_lo(i,a){var o=rotr64_lo(i,a,28),_=rotr64_lo(a,i,2),et=rotr64_lo(a,i,7),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function s1_512_hi(i,a){var o=rotr64_hi(i,a,14),_=rotr64_hi(i,a,18),et=rotr64_hi(a,i,9),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function s1_512_lo(i,a){var o=rotr64_lo(i,a,14),_=rotr64_lo(i,a,18),et=rotr64_lo(a,i,9),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function g0_512_hi(i,a){var o=rotr64_hi(i,a,1),_=rotr64_hi(i,a,8),et=shr64_hi(i,a,7),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function g0_512_lo(i,a){var o=rotr64_lo(i,a,1),_=rotr64_lo(i,a,8),et=shr64_lo(i,a,7),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function g1_512_hi(i,a){var o=rotr64_hi(i,a,19),_=rotr64_hi(a,i,29),et=shr64_hi(i,a,6),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}function g1_512_lo(i,a){var o=rotr64_lo(i,a,19),_=rotr64_lo(a,i,29),et=shr64_lo(i,a,6),rt=o^_^et;return rt<0&&(rt+=4294967296),rt}var utils$f=utils$m,SHA512=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$f.inherits(SHA384,SHA512);var _384=SHA384;SHA384.blockSize=1024;SHA384.outSize=384;SHA384.hmacStrength=192;SHA384.padLength=128;SHA384.prototype._digest=function i(a){return a==="hex"?utils$f.toHex32(this.h.slice(0,12),"big"):utils$f.split32(this.h.slice(0,12),"big")};sha.sha1=_1;sha.sha224=_224;sha.sha256=_256;sha.sha384=_384;sha.sha512=_512;var ripemd={},utils$e=utils$m,common$2=common$7,rotl32=utils$e.rotl32,sum32=utils$e.sum32,sum32_3=utils$e.sum32_3,sum32_4=utils$e.sum32_4,BlockHash=common$2.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}utils$e.inherits(RIPEMD160,BlockHash);ripemd.ripemd160=RIPEMD160;RIPEMD160.blockSize=512;RIPEMD160.outSize=160;RIPEMD160.hmacStrength=192;RIPEMD160.padLength=64;RIPEMD160.prototype._update=function i(a,o){for(var _=this.h[0],et=this.h[1],rt=this.h[2],ot=this.h[3],ft=this.h[4],lt=_,ht=et,vt=rt,It=ot,Qt=ft,mt=0;mt<80;mt++){var Yt=sum32(rotl32(sum32_4(_,f$1(mt,et,rt,ot),a[r$3[mt]+o],K(mt)),s[mt]),ft);_=ft,ft=ot,ot=rotl32(rt,10),rt=et,et=Yt,Yt=sum32(rotl32(sum32_4(lt,f$1(79-mt,ht,vt,It),a[rh[mt]+o],Kh(mt)),sh[mt]),Qt),lt=Qt,Qt=It,It=rotl32(vt,10),vt=ht,ht=Yt}Yt=sum32_3(this.h[1],rt,It),this.h[1]=sum32_3(this.h[2],ot,Qt),this.h[2]=sum32_3(this.h[3],ft,lt),this.h[3]=sum32_3(this.h[4],_,ht),this.h[4]=sum32_3(this.h[0],et,vt),this.h[0]=Yt};RIPEMD160.prototype._digest=function i(a){return a==="hex"?utils$e.toHex32(this.h,"little"):utils$e.split32(this.h,"little")};function f$1(i,a,o,_){return i<=15?a^o^_:i<=31?a&o|~a&_:i<=47?(a|~o)^_:i<=63?a&_|o&~_:a^(o|~_)}function K(i){return i<=15?0:i<=31?1518500249:i<=47?1859775393:i<=63?2400959708:2840853838}function Kh(i){return i<=15?1352829926:i<=31?1548603684:i<=47?1836072691:i<=63?2053994217:0}var r$3=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],utils$d=utils$m,assert$b=minimalisticAssert$1;function Hmac(i,a,o){if(!(this instanceof Hmac))return new Hmac(i,a,o);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(utils$d.toArray(a,o))}var hmac=Hmac;Hmac.prototype._init=function i(a){a.length>this.blockSize&&(a=new this.Hash().update(a).digest()),assert$b(a.length<=this.blockSize);for(var o=a.length;o<this.blockSize;o++)a.push(0);for(o=0;o<a.length;o++)a[o]^=54;for(this.inner=new this.Hash().update(a),o=0;o<a.length;o++)a[o]^=106;this.outer=new this.Hash().update(a)};Hmac.prototype.update=function i(a,o){return this.inner.update(a,o),this};Hmac.prototype.digest=function i(a){return this.outer.update(this.inner.digest()),this.outer.digest(a)};(function(i){var a=i;a.utils=utils$m,a.common=common$7,a.sha=sha,a.ripemd=ripemd,a.hmac=hmac,a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160})(hash$4);const hash$3=getDefaultExportFromCjs(hash$4);var SupportedAlgorithm;(function(i){i.sha256="sha256",i.sha512="sha512"})(SupportedAlgorithm||(SupportedAlgorithm={}));const version$8="sha2/5.7.0",logger$8=new Logger(version$8);function ripemd160(i){return"0x"+hash$3.ripemd160().update(arrayify(i)).digest("hex")}function sha256(i){return"0x"+hash$3.sha256().update(arrayify(i)).digest("hex")}function computeHmac(i,a,o){return SupportedAlgorithm[i]||logger$8.throwError("unsupported algorithm "+i,Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:i}),"0x"+hash$3.hmac(hash$3[i],arrayify(a)).update(arrayify(o)).digest("hex")}function pbkdf2$1(i,a,o,_,et){i=arrayify(i),a=arrayify(a);let rt,ot=1;const ft=new Uint8Array(_),lt=new Uint8Array(a.length+4);lt.set(a);let ht,vt;for(let It=1;It<=ot;It++){lt[a.length]=It>>24&255,lt[a.length+1]=It>>16&255,lt[a.length+2]=It>>8&255,lt[a.length+3]=It&255;let Qt=arrayify(computeHmac(et,i,lt));rt||(rt=Qt.length,vt=new Uint8Array(rt),ot=Math.ceil(_/rt),ht=_-(ot-1)*rt),vt.set(Qt);for(let Rt=1;Rt<o;Rt++){Qt=arrayify(computeHmac(et,i,Qt));for(let cr=0;cr<rt;cr++)vt[cr]^=Qt[cr]}const mt=(It-1)*rt,Yt=It===ot?ht:rt;ft.set(arrayify(vt).slice(0,Yt),mt)}return hexlify(ft)}function createCommonjsModule(i,a,o){return o={path:a,exports:{},require:function(_,et){return commonjsRequire(_,et??o.path)}},i(o,o.exports),o.exports}function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var minimalisticAssert=assert$a;function assert$a(i,a){if(!i)throw new Error(a||"Assertion failed")}assert$a.equal=function i(a,o,_){if(a!=o)throw new Error(_||"Assertion failed: "+a+" != "+o)};var utils_1=createCommonjsModule(function(i,a){var o=a;function _(ot,ft){if(Array.isArray(ot))return ot.slice();if(!ot)return[];var lt=[];if(typeof ot!="string"){for(var ht=0;ht<ot.length;ht++)lt[ht]=ot[ht]|0;return lt}if(ft==="hex"){ot=ot.replace(/[^a-z0-9]+/ig,""),ot.length%2!==0&&(ot="0"+ot);for(var ht=0;ht<ot.length;ht+=2)lt.push(parseInt(ot[ht]+ot[ht+1],16))}else for(var ht=0;ht<ot.length;ht++){var vt=ot.charCodeAt(ht),It=vt>>8,Qt=vt&255;It?lt.push(It,Qt):lt.push(Qt)}return lt}o.toArray=_;function et(ot){return ot.length===1?"0"+ot:ot}o.zero2=et;function rt(ot){for(var ft="",lt=0;lt<ot.length;lt++)ft+=et(ot[lt].toString(16));return ft}o.toHex=rt,o.encode=function(ft,lt){return lt==="hex"?rt(ft):ft}}),utils_1$1=createCommonjsModule(function(i,a){var o=a;o.assert=minimalisticAssert,o.toArray=utils_1.toArray,o.zero2=utils_1.zero2,o.toHex=utils_1.toHex,o.encode=utils_1.encode;function _(lt,ht,vt){var It=new Array(Math.max(lt.bitLength(),vt)+1);It.fill(0);for(var Qt=1<<ht+1,mt=lt.clone(),Yt=0;Yt<It.length;Yt++){var Rt,cr=mt.andln(Qt-1);mt.isOdd()?(cr>(Qt>>1)-1?Rt=(Qt>>1)-cr:Rt=cr,mt.isubn(Rt)):Rt=0,It[Yt]=Rt,mt.iushrn(1)}return It}o.getNAF=_;function et(lt,ht){var vt=[[],[]];lt=lt.clone(),ht=ht.clone();for(var It=0,Qt=0,mt;lt.cmpn(-It)>0||ht.cmpn(-Qt)>0;){var Yt=lt.andln(3)+It&3,Rt=ht.andln(3)+Qt&3;Yt===3&&(Yt=-1),Rt===3&&(Rt=-1);var cr;Yt&1?(mt=lt.andln(7)+It&7,(mt===3||mt===5)&&Rt===2?cr=-Yt:cr=Yt):cr=0,vt[0].push(cr);var Ut;Rt&1?(mt=ht.andln(7)+Qt&7,(mt===3||mt===5)&&Yt===2?Ut=-Rt:Ut=Rt):Ut=0,vt[1].push(Ut),2*It===cr+1&&(It=1-It),2*Qt===Ut+1&&(Qt=1-Qt),lt.iushrn(1),ht.iushrn(1)}return vt}o.getJSF=et;function rt(lt,ht,vt){var It="_"+ht;lt.prototype[ht]=function(){return this[It]!==void 0?this[It]:this[It]=vt.call(this)}}o.cachedProperty=rt;function ot(lt){return typeof lt=="string"?o.toArray(lt,"hex"):lt}o.parseBytes=ot;function ft(lt){return new BN$9(lt,"hex","le")}o.intFromLE=ft}),getNAF$1=utils_1$1.getNAF,getJSF$1=utils_1$1.getJSF,assert$1$1=utils_1$1.assert;function BaseCurve$1(i,a){this.type=i,this.p=new BN$9(a.p,16),this.red=a.prime?BN$9.red(a.prime):BN$9.mont(this.p),this.zero=new BN$9(0).toRed(this.red),this.one=new BN$9(1).toRed(this.red),this.two=new BN$9(2).toRed(this.red),this.n=a.n&&new BN$9(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var o=this.n&&this.p.div(this.n);!o||o.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$1=BaseCurve$1;BaseCurve$1.prototype.point=function i(){throw new Error("Not implemented")};BaseCurve$1.prototype.validate=function i(){throw new Error("Not implemented")};BaseCurve$1.prototype._fixedNafMul=function i(a,o){assert$1$1(a.precomputed);var _=a._getDoubles(),et=getNAF$1(o,1,this._bitLength),rt=(1<<_.step+1)-(_.step%2===0?2:1);rt/=3;var ot=[],ft,lt;for(ft=0;ft<et.length;ft+=_.step){lt=0;for(var ht=ft+_.step-1;ht>=ft;ht--)lt=(lt<<1)+et[ht];ot.push(lt)}for(var vt=this.jpoint(null,null,null),It=this.jpoint(null,null,null),Qt=rt;Qt>0;Qt--){for(ft=0;ft<ot.length;ft++)lt=ot[ft],lt===Qt?It=It.mixedAdd(_.points[ft]):lt===-Qt&&(It=It.mixedAdd(_.points[ft].neg()));vt=vt.add(It)}return vt.toP()};BaseCurve$1.prototype._wnafMul=function i(a,o){var _=4,et=a._getNAFPoints(_);_=et.wnd;for(var rt=et.points,ot=getNAF$1(o,_,this._bitLength),ft=this.jpoint(null,null,null),lt=ot.length-1;lt>=0;lt--){for(var ht=0;lt>=0&&ot[lt]===0;lt--)ht++;if(lt>=0&&ht++,ft=ft.dblp(ht),lt<0)break;var vt=ot[lt];assert$1$1(vt!==0),a.type==="affine"?vt>0?ft=ft.mixedAdd(rt[vt-1>>1]):ft=ft.mixedAdd(rt[-vt-1>>1].neg()):vt>0?ft=ft.add(rt[vt-1>>1]):ft=ft.add(rt[-vt-1>>1].neg())}return a.type==="affine"?ft.toP():ft};BaseCurve$1.prototype._wnafMulAdd=function i(a,o,_,et,rt){var ot=this._wnafT1,ft=this._wnafT2,lt=this._wnafT3,ht=0,vt,It,Qt;for(vt=0;vt<et;vt++){Qt=o[vt];var mt=Qt._getNAFPoints(a);ot[vt]=mt.wnd,ft[vt]=mt.points}for(vt=et-1;vt>=1;vt-=2){var Yt=vt-1,Rt=vt;if(ot[Yt]!==1||ot[Rt]!==1){lt[Yt]=getNAF$1(_[Yt],ot[Yt],this._bitLength),lt[Rt]=getNAF$1(_[Rt],ot[Rt],this._bitLength),ht=Math.max(lt[Yt].length,ht),ht=Math.max(lt[Rt].length,ht);continue}var cr=[o[Yt],null,null,o[Rt]];o[Yt].y.cmp(o[Rt].y)===0?(cr[1]=o[Yt].add(o[Rt]),cr[2]=o[Yt].toJ().mixedAdd(o[Rt].neg())):o[Yt].y.cmp(o[Rt].y.redNeg())===0?(cr[1]=o[Yt].toJ().mixedAdd(o[Rt]),cr[2]=o[Yt].add(o[Rt].neg())):(cr[1]=o[Yt].toJ().mixedAdd(o[Rt]),cr[2]=o[Yt].toJ().mixedAdd(o[Rt].neg()));var Ut=[-3,-1,-5,-7,0,7,5,1,3],zt=getJSF$1(_[Yt],_[Rt]);for(ht=Math.max(zt[0].length,ht),lt[Yt]=new Array(ht),lt[Rt]=new Array(ht),It=0;It<ht;It++){var Gt=zt[0][It]|0,Dr=zt[1][It]|0;lt[Yt][It]=Ut[(Gt+1)*3+(Dr+1)],lt[Rt][It]=0,ft[Yt]=cr}}var lr=this.jpoint(null,null,null),xr=this._wnafT4;for(vt=ht;vt>=0;vt--){for(var hr=0;vt>=0;){var Hr=!0;for(It=0;It<et;It++)xr[It]=lt[It][vt]|0,xr[It]!==0&&(Hr=!1);if(!Hr)break;hr++,vt--}if(vt>=0&&hr++,lr=lr.dblp(hr),vt<0)break;for(It=0;It<et;It++){var vr=xr[It];vr!==0&&(vr>0?Qt=ft[It][vr-1>>1]:vr<0&&(Qt=ft[It][-vr-1>>1].neg()),Qt.type==="affine"?lr=lr.mixedAdd(Qt):lr=lr.add(Qt))}}for(vt=0;vt<et;vt++)ft[vt]=null;return rt?lr:lr.toP()};function BasePoint$1(i,a){this.curve=i,this.type=a,this.precomputed=null}BaseCurve$1.BasePoint=BasePoint$1;BasePoint$1.prototype.eq=function i(){throw new Error("Not implemented")};BasePoint$1.prototype.validate=function i(){return this.curve.validate(this)};BaseCurve$1.prototype.decodePoint=function i(a,o){a=utils_1$1.toArray(a,o);var _=this.p.byteLength();if((a[0]===4||a[0]===6||a[0]===7)&&a.length-1===2*_){a[0]===6?assert$1$1(a[a.length-1]%2===0):a[0]===7&&assert$1$1(a[a.length-1]%2===1);var et=this.point(a.slice(1,1+_),a.slice(1+_,1+2*_));return et}else if((a[0]===2||a[0]===3)&&a.length-1===_)return this.pointFromX(a.slice(1,1+_),a[0]===3);throw new Error("Unknown point format")};BasePoint$1.prototype.encodeCompressed=function i(a){return this.encode(a,!0)};BasePoint$1.prototype._encode=function i(a){var o=this.curve.p.byteLength(),_=this.getX().toArray("be",o);return a?[this.getY().isEven()?2:3].concat(_):[4].concat(_,this.getY().toArray("be",o))};BasePoint$1.prototype.encode=function i(a,o){return utils_1$1.encode(this._encode(o),a)};BasePoint$1.prototype.precompute=function i(a){if(this.precomputed)return this;var o={doubles:null,naf:null,beta:null};return o.naf=this._getNAFPoints(8),o.doubles=this._getDoubles(4,a),o.beta=this._getBeta(),this.precomputed=o,this};BasePoint$1.prototype._hasDoubles=function i(a){if(!this.precomputed)return!1;var o=this.precomputed.doubles;return o?o.points.length>=Math.ceil((a.bitLength()+1)/o.step):!1};BasePoint$1.prototype._getDoubles=function i(a,o){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var _=[this],et=this,rt=0;rt<o;rt+=a){for(var ot=0;ot<a;ot++)et=et.dbl();_.push(et)}return{step:a,points:_}};BasePoint$1.prototype._getNAFPoints=function i(a){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var o=[this],_=(1<<a)-1,et=_===1?null:this.dbl(),rt=1;rt<_;rt++)o[rt]=o[rt-1].add(et);return{wnd:a,points:o}};BasePoint$1.prototype._getBeta=function i(){return null};BasePoint$1.prototype.dblp=function i(a){for(var o=this,_=0;_<a;_++)o=o.dbl();return o};var inherits_browser=createCommonjsModule(function(i){typeof Object.create=="function"?i.exports=function(o,_){_&&(o.super_=_,o.prototype=Object.create(_.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:i.exports=function(o,_){if(_){o.super_=_;var et=function(){};et.prototype=_.prototype,o.prototype=new et,o.prototype.constructor=o}}}),assert$2$1=utils_1$1.assert;function ShortCurve$1(i){base$1.call(this,"short",i),this.a=new BN$9(i.a,16).toRed(this.red),this.b=new BN$9(i.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(i),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits_browser(ShortCurve$1,base$1);var short_1=ShortCurve$1;ShortCurve$1.prototype._getEndomorphism=function i(a){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var o,_;if(a.beta)o=new BN$9(a.beta,16).toRed(this.red);else{var et=this._getEndoRoots(this.p);o=et[0].cmp(et[1])<0?et[0]:et[1],o=o.toRed(this.red)}if(a.lambda)_=new BN$9(a.lambda,16);else{var rt=this._getEndoRoots(this.n);this.g.mul(rt[0]).x.cmp(this.g.x.redMul(o))===0?_=rt[0]:(_=rt[1],assert$2$1(this.g.mul(_).x.cmp(this.g.x.redMul(o))===0))}var ot;return a.basis?ot=a.basis.map(function(ft){return{a:new BN$9(ft.a,16),b:new BN$9(ft.b,16)}}):ot=this._getEndoBasis(_),{beta:o,lambda:_,basis:ot}}};ShortCurve$1.prototype._getEndoRoots=function i(a){var o=a===this.p?this.red:BN$9.mont(a),_=new BN$9(2).toRed(o).redInvm(),et=_.redNeg(),rt=new BN$9(3).toRed(o).redNeg().redSqrt().redMul(_),ot=et.redAdd(rt).fromRed(),ft=et.redSub(rt).fromRed();return[ot,ft]};ShortCurve$1.prototype._getEndoBasis=function i(a){for(var o=this.n.ushrn(Math.floor(this.n.bitLength()/2)),_=a,et=this.n.clone(),rt=new BN$9(1),ot=new BN$9(0),ft=new BN$9(0),lt=new BN$9(1),ht,vt,It,Qt,mt,Yt,Rt,cr=0,Ut,zt;_.cmpn(0)!==0;){var Gt=et.div(_);Ut=et.sub(Gt.mul(_)),zt=ft.sub(Gt.mul(rt));var Dr=lt.sub(Gt.mul(ot));if(!It&&Ut.cmp(o)<0)ht=Rt.neg(),vt=rt,It=Ut.neg(),Qt=zt;else if(It&&++cr===2)break;Rt=Ut,et=_,_=Ut,ft=rt,rt=zt,lt=ot,ot=Dr}mt=Ut.neg(),Yt=zt;var lr=It.sqr().add(Qt.sqr()),xr=mt.sqr().add(Yt.sqr());return xr.cmp(lr)>=0&&(mt=ht,Yt=vt),It.negative&&(It=It.neg(),Qt=Qt.neg()),mt.negative&&(mt=mt.neg(),Yt=Yt.neg()),[{a:It,b:Qt},{a:mt,b:Yt}]};ShortCurve$1.prototype._endoSplit=function i(a){var o=this.endo.basis,_=o[0],et=o[1],rt=et.b.mul(a).divRound(this.n),ot=_.b.neg().mul(a).divRound(this.n),ft=rt.mul(_.a),lt=ot.mul(et.a),ht=rt.mul(_.b),vt=ot.mul(et.b),It=a.sub(ft).sub(lt),Qt=ht.add(vt).neg();return{k1:It,k2:Qt}};ShortCurve$1.prototype.pointFromX=function i(a,o){a=new BN$9(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=_.redSqrt();if(et.redSqr().redSub(_).cmp(this.zero)!==0)throw new Error("invalid point");var rt=et.fromRed().isOdd();return(o&&!rt||!o&&rt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve$1.prototype.validate=function i(a){if(a.inf)return!0;var o=a.x,_=a.y,et=this.a.redMul(o),rt=o.redSqr().redMul(o).redIAdd(et).redIAdd(this.b);return _.redSqr().redISub(rt).cmpn(0)===0};ShortCurve$1.prototype._endoWnafMulAdd=function i(a,o,_){for(var et=this._endoWnafT1,rt=this._endoWnafT2,ot=0;ot<a.length;ot++){var ft=this._endoSplit(o[ot]),lt=a[ot],ht=lt._getBeta();ft.k1.negative&&(ft.k1.ineg(),lt=lt.neg(!0)),ft.k2.negative&&(ft.k2.ineg(),ht=ht.neg(!0)),et[ot*2]=lt,et[ot*2+1]=ht,rt[ot*2]=ft.k1,rt[ot*2+1]=ft.k2}for(var vt=this._wnafMulAdd(1,et,rt,ot*2,_),It=0;It<ot*2;It++)et[It]=null,rt[It]=null;return vt};function Point$3(i,a,o,_){base$1.BasePoint.call(this,i,"affine"),a===null&&o===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$9(a,16),this.y=new BN$9(o,16),_&&(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)}inherits_browser(Point$3,base$1.BasePoint);ShortCurve$1.prototype.point=function i(a,o,_){return new Point$3(this,a,o,_)};ShortCurve$1.prototype.pointFromJSON=function i(a,o){return Point$3.fromJSON(this,a,o)};Point$3.prototype._getBeta=function i(){if(this.curve.endo){var a=this.precomputed;if(a&&a.beta)return a.beta;var o=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(a){var _=this.curve,et=function(rt){return _.point(rt.x.redMul(_.endo.beta),rt.y)};a.beta=o,o.precomputed={beta:null,naf:a.naf&&{wnd:a.naf.wnd,points:a.naf.points.map(et)},doubles:a.doubles&&{step:a.doubles.step,points:a.doubles.points.map(et)}}}return o}};Point$3.prototype.toJSON=function i(){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]};Point$3.fromJSON=function i(a,o,_){typeof o=="string"&&(o=JSON.parse(o));var et=a.point(o[0],o[1],_);if(!o[2])return et;function rt(ft){return a.point(ft[0],ft[1],_)}var ot=o[2];return et.precomputed={beta:null,doubles:ot.doubles&&{step:ot.doubles.step,points:[et].concat(ot.doubles.points.map(rt))},naf:ot.naf&&{wnd:ot.naf.wnd,points:[et].concat(ot.naf.points.map(rt))}},et};Point$3.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point$3.prototype.isInfinity=function i(){return this.inf};Point$3.prototype.add=function i(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var o=this.y.redSub(a.y);o.cmpn(0)!==0&&(o=o.redMul(this.x.redSub(a.x).redInvm()));var _=o.redSqr().redISub(this.x).redISub(a.x),et=o.redMul(this.x.redSub(_)).redISub(this.y);return this.curve.point(_,et)};Point$3.prototype.dbl=function i(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var o=this.curve.a,_=this.x.redSqr(),et=a.redInvm(),rt=_.redAdd(_).redIAdd(_).redIAdd(o).redMul(et),ot=rt.redSqr().redISub(this.x.redAdd(this.x)),ft=rt.redMul(this.x.redSub(ot)).redISub(this.y);return this.curve.point(ot,ft)};Point$3.prototype.getX=function i(){return this.x.fromRed()};Point$3.prototype.getY=function i(){return this.y.fromRed()};Point$3.prototype.mul=function i(a){return a=new BN$9(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$3.prototype.mulAdd=function i(a,o,_){var et=[this,o],rt=[a,_];return this.curve.endo?this.curve._endoWnafMulAdd(et,rt):this.curve._wnafMulAdd(1,et,rt,2)};Point$3.prototype.jmulAdd=function i(a,o,_){var et=[this,o],rt=[a,_];return this.curve.endo?this.curve._endoWnafMulAdd(et,rt,!0):this.curve._wnafMulAdd(1,et,rt,2,!0)};Point$3.prototype.eq=function i(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$3.prototype.neg=function i(a){if(this.inf)return this;var o=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var _=this.precomputed,et=function(rt){return rt.neg()};o.precomputed={naf:_.naf&&{wnd:_.naf.wnd,points:_.naf.points.map(et)},doubles:_.doubles&&{step:_.doubles.step,points:_.doubles.points.map(et)}}}return o};Point$3.prototype.toJ=function i(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint$1(i,a,o,_){base$1.BasePoint.call(this,i,"jacobian"),a===null&&o===null&&_===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$9(0)):(this.x=new BN$9(a,16),this.y=new BN$9(o,16),this.z=new BN$9(_,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}inherits_browser(JPoint$1,base$1.BasePoint);ShortCurve$1.prototype.jpoint=function i(a,o,_){return new JPoint$1(this,a,o,_)};JPoint$1.prototype.toP=function i(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),o=a.redSqr(),_=this.x.redMul(o),et=this.y.redMul(o).redMul(a);return this.curve.point(_,et)};JPoint$1.prototype.neg=function i(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint$1.prototype.add=function i(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var o=a.z.redSqr(),_=this.z.redSqr(),et=this.x.redMul(o),rt=a.x.redMul(_),ot=this.y.redMul(o.redMul(a.z)),ft=a.y.redMul(_.redMul(this.z)),lt=et.redSub(rt),ht=ot.redSub(ft);if(lt.cmpn(0)===0)return ht.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var vt=lt.redSqr(),It=vt.redMul(lt),Qt=et.redMul(vt),mt=ht.redSqr().redIAdd(It).redISub(Qt).redISub(Qt),Yt=ht.redMul(Qt.redISub(mt)).redISub(ot.redMul(It)),Rt=this.z.redMul(a.z).redMul(lt);return this.curve.jpoint(mt,Yt,Rt)};JPoint$1.prototype.mixedAdd=function i(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var o=this.z.redSqr(),_=this.x,et=a.x.redMul(o),rt=this.y,ot=a.y.redMul(o).redMul(this.z),ft=_.redSub(et),lt=rt.redSub(ot);if(ft.cmpn(0)===0)return lt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ht=ft.redSqr(),vt=ht.redMul(ft),It=_.redMul(ht),Qt=lt.redSqr().redIAdd(vt).redISub(It).redISub(It),mt=lt.redMul(It.redISub(Qt)).redISub(rt.redMul(vt)),Yt=this.z.redMul(ft);return this.curve.jpoint(Qt,mt,Yt)};JPoint$1.prototype.dblp=function i(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var o;if(this.curve.zeroA||this.curve.threeA){var _=this;for(o=0;o<a;o++)_=_.dbl();return _}var et=this.curve.a,rt=this.curve.tinv,ot=this.x,ft=this.y,lt=this.z,ht=lt.redSqr().redSqr(),vt=ft.redAdd(ft);for(o=0;o<a;o++){var It=ot.redSqr(),Qt=vt.redSqr(),mt=Qt.redSqr(),Yt=It.redAdd(It).redIAdd(It).redIAdd(et.redMul(ht)),Rt=ot.redMul(Qt),cr=Yt.redSqr().redISub(Rt.redAdd(Rt)),Ut=Rt.redISub(cr),zt=Yt.redMul(Ut);zt=zt.redIAdd(zt).redISub(mt);var Gt=vt.redMul(lt);o+1<a&&(ht=ht.redMul(mt)),ot=cr,lt=Gt,vt=zt}return this.curve.jpoint(ot,vt.redMul(rt),lt)};JPoint$1.prototype.dbl=function i(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint$1.prototype._zeroDbl=function i(){var a,o,_;if(this.zOne){var et=this.x.redSqr(),rt=this.y.redSqr(),ot=rt.redSqr(),ft=this.x.redAdd(rt).redSqr().redISub(et).redISub(ot);ft=ft.redIAdd(ft);var lt=et.redAdd(et).redIAdd(et),ht=lt.redSqr().redISub(ft).redISub(ft),vt=ot.redIAdd(ot);vt=vt.redIAdd(vt),vt=vt.redIAdd(vt),a=ht,o=lt.redMul(ft.redISub(ht)).redISub(vt),_=this.y.redAdd(this.y)}else{var It=this.x.redSqr(),Qt=this.y.redSqr(),mt=Qt.redSqr(),Yt=this.x.redAdd(Qt).redSqr().redISub(It).redISub(mt);Yt=Yt.redIAdd(Yt);var Rt=It.redAdd(It).redIAdd(It),cr=Rt.redSqr(),Ut=mt.redIAdd(mt);Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),a=cr.redISub(Yt).redISub(Yt),o=Rt.redMul(Yt.redISub(a)).redISub(Ut),_=this.y.redMul(this.z),_=_.redIAdd(_)}return this.curve.jpoint(a,o,_)};JPoint$1.prototype._threeDbl=function i(){var a,o,_;if(this.zOne){var et=this.x.redSqr(),rt=this.y.redSqr(),ot=rt.redSqr(),ft=this.x.redAdd(rt).redSqr().redISub(et).redISub(ot);ft=ft.redIAdd(ft);var lt=et.redAdd(et).redIAdd(et).redIAdd(this.curve.a),ht=lt.redSqr().redISub(ft).redISub(ft);a=ht;var vt=ot.redIAdd(ot);vt=vt.redIAdd(vt),vt=vt.redIAdd(vt),o=lt.redMul(ft.redISub(ht)).redISub(vt),_=this.y.redAdd(this.y)}else{var It=this.z.redSqr(),Qt=this.y.redSqr(),mt=this.x.redMul(Qt),Yt=this.x.redSub(It).redMul(this.x.redAdd(It));Yt=Yt.redAdd(Yt).redIAdd(Yt);var Rt=mt.redIAdd(mt);Rt=Rt.redIAdd(Rt);var cr=Rt.redAdd(Rt);a=Yt.redSqr().redISub(cr),_=this.y.redAdd(this.z).redSqr().redISub(Qt).redISub(It);var Ut=Qt.redSqr();Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),o=Yt.redMul(Rt.redISub(a)).redISub(Ut)}return this.curve.jpoint(a,o,_)};JPoint$1.prototype._dbl=function i(){var a=this.curve.a,o=this.x,_=this.y,et=this.z,rt=et.redSqr().redSqr(),ot=o.redSqr(),ft=_.redSqr(),lt=ot.redAdd(ot).redIAdd(ot).redIAdd(a.redMul(rt)),ht=o.redAdd(o);ht=ht.redIAdd(ht);var vt=ht.redMul(ft),It=lt.redSqr().redISub(vt.redAdd(vt)),Qt=vt.redISub(It),mt=ft.redSqr();mt=mt.redIAdd(mt),mt=mt.redIAdd(mt),mt=mt.redIAdd(mt);var Yt=lt.redMul(Qt).redISub(mt),Rt=_.redAdd(_).redMul(et);return this.curve.jpoint(It,Yt,Rt)};JPoint$1.prototype.trpl=function i(){if(!this.curve.zeroA)return this.dbl().add(this);var a=this.x.redSqr(),o=this.y.redSqr(),_=this.z.redSqr(),et=o.redSqr(),rt=a.redAdd(a).redIAdd(a),ot=rt.redSqr(),ft=this.x.redAdd(o).redSqr().redISub(a).redISub(et);ft=ft.redIAdd(ft),ft=ft.redAdd(ft).redIAdd(ft),ft=ft.redISub(ot);var lt=ft.redSqr(),ht=et.redIAdd(et);ht=ht.redIAdd(ht),ht=ht.redIAdd(ht),ht=ht.redIAdd(ht);var vt=rt.redIAdd(ft).redSqr().redISub(ot).redISub(lt).redISub(ht),It=o.redMul(vt);It=It.redIAdd(It),It=It.redIAdd(It);var Qt=this.x.redMul(lt).redISub(It);Qt=Qt.redIAdd(Qt),Qt=Qt.redIAdd(Qt);var mt=this.y.redMul(vt.redMul(ht.redISub(vt)).redISub(ft.redMul(lt)));mt=mt.redIAdd(mt),mt=mt.redIAdd(mt),mt=mt.redIAdd(mt);var Yt=this.z.redAdd(ft).redSqr().redISub(_).redISub(lt);return this.curve.jpoint(Qt,mt,Yt)};JPoint$1.prototype.mul=function i(a,o){return a=new BN$9(a,o),this.curve._wnafMul(this,a)};JPoint$1.prototype.eq=function i(a){if(a.type==="affine")return this.eq(a.toJ());if(this===a)return!0;var o=this.z.redSqr(),_=a.z.redSqr();if(this.x.redMul(_).redISub(a.x.redMul(o)).cmpn(0)!==0)return!1;var et=o.redMul(this.z),rt=_.redMul(a.z);return this.y.redMul(rt).redISub(a.y.redMul(et)).cmpn(0)===0};JPoint$1.prototype.eqXToP=function i(a){var o=this.z.redSqr(),_=a.toRed(this.curve.red).redMul(o);if(this.x.cmp(_)===0)return!0;for(var et=a.clone(),rt=this.curve.redN.redMul(o);;){if(et.iadd(this.curve.n),et.cmp(this.curve.p)>=0)return!1;if(_.redIAdd(rt),this.x.cmp(_)===0)return!0}};JPoint$1.prototype.inspect=function i(){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)+">"};JPoint$1.prototype.isInfinity=function i(){return this.z.cmpn(0)===0};var curve_1=createCommonjsModule(function(i,a){var o=a;o.base=base$1,o.short=short_1,o.mont=null,o.edwards=null}),curves_1=createCommonjsModule(function(i,a){var o=a,_=utils_1$1.assert;function et(ft){ft.type==="short"?this.curve=new curve_1.short(ft):ft.type==="edwards"?this.curve=new curve_1.edwards(ft):this.curve=new curve_1.mont(ft),this.g=this.curve.g,this.n=this.curve.n,this.hash=ft.hash,_(this.g.validate(),"Invalid curve"),_(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o.PresetCurve=et;function rt(ft,lt){Object.defineProperty(o,ft,{configurable:!0,enumerable:!0,get:function(){var ht=new et(lt);return Object.defineProperty(o,ft,{configurable:!0,enumerable:!0,value:ht}),ht}})}rt("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash$3.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),rt("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash$3.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),rt("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash$3.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),rt("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash$3.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),rt("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash$3.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),rt("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$3.sha256,gRed:!1,g:["9"]}),rt("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$3.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var ot;try{ot=null.crash()}catch{ot=void 0}rt("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash$3.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",ot]})});function HmacDRBG$2(i){if(!(this instanceof HmacDRBG$2))return new HmacDRBG$2(i);this.hash=i.hash,this.predResist=!!i.predResist,this.outLen=this.hash.outSize,this.minEntropy=i.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=utils_1.toArray(i.entropy,i.entropyEnc||"hex"),o=utils_1.toArray(i.nonce,i.nonceEnc||"hex"),_=utils_1.toArray(i.pers,i.persEnc||"hex");minimalisticAssert(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,o,_)}var hmacDrbg$1=HmacDRBG$2;HmacDRBG$2.prototype._init=function i(a,o,_){var et=a.concat(o).concat(_);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var rt=0;rt<this.V.length;rt++)this.K[rt]=0,this.V[rt]=1;this._update(et),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG$2.prototype._hmac=function i(){return new hash$3.hmac(this.hash,this.K)};HmacDRBG$2.prototype._update=function i(a){var o=this._hmac().update(this.V).update([0]);a&&(o=o.update(a)),this.K=o.digest(),this.V=this._hmac().update(this.V).digest(),a&&(this.K=this._hmac().update(this.V).update([1]).update(a).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG$2.prototype.reseed=function i(a,o,_,et){typeof o!="string"&&(et=_,_=o,o=null),a=utils_1.toArray(a,o),_=utils_1.toArray(_,et),minimalisticAssert(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(_||[])),this._reseed=1};HmacDRBG$2.prototype.generate=function i(a,o,_,et){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(et=_,_=o,o=null),_&&(_=utils_1.toArray(_,et||"hex"),this._update(_));for(var rt=[];rt.length<a;)this.V=this._hmac().update(this.V).digest(),rt=rt.concat(this.V);var ot=rt.slice(0,a);return this._update(_),this._reseed++,utils_1.encode(ot,o)};var assert$3$1=utils_1$1.assert;function KeyPair$4(i,a){this.ec=i,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$2=KeyPair$4;KeyPair$4.fromPublic=function i(a,o,_){return o instanceof KeyPair$4?o:new KeyPair$4(a,{pub:o,pubEnc:_})};KeyPair$4.fromPrivate=function i(a,o,_){return o instanceof KeyPair$4?o:new KeyPair$4(a,{priv:o,privEnc:_})};KeyPair$4.prototype.validate=function i(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$4.prototype.getPublic=function i(a,o){return typeof a=="string"&&(o=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),o?this.pub.encode(o,a):this.pub};KeyPair$4.prototype.getPrivate=function i(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$4.prototype._importPrivate=function i(a,o){this.priv=new BN$9(a,o||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$4.prototype._importPublic=function i(a,o){if(a.x||a.y){this.ec.curve.type==="mont"?assert$3$1(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$3$1(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,o)};KeyPair$4.prototype.derive=function i(a){return a.validate()||assert$3$1(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$4.prototype.sign=function i(a,o,_){return this.ec.sign(a,this,o,_)};KeyPair$4.prototype.verify=function i(a,o){return this.ec.verify(a,o,this)};KeyPair$4.prototype.inspect=function i(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var assert$4$1=utils_1$1.assert;function Signature$4(i,a){if(i instanceof Signature$4)return i;this._importDER(i,a)||(assert$4$1(i.r&&i.s,"Signature without r or s"),this.r=new BN$9(i.r,16),this.s=new BN$9(i.s,16),i.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=i.recoveryParam)}var signature$2=Signature$4;function Position$1(){this.place=0}function getLength$1(i,a){var o=i[a.place++];if(!(o&128))return o;var _=o&15;if(_===0||_>4)return!1;for(var et=0,rt=0,ot=a.place;rt<_;rt++,ot++)et<<=8,et|=i[ot],et>>>=0;return et<=127?!1:(a.place=ot,et)}function rmPadding$1(i){for(var a=0,o=i.length-1;!i[a]&&!(i[a+1]&128)&&a<o;)a++;return a===0?i:i.slice(a)}Signature$4.prototype._importDER=function i(a,o){a=utils_1$1.toArray(a,o);var _=new Position$1;if(a[_.place++]!==48)return!1;var et=getLength$1(a,_);if(et===!1||et+_.place!==a.length||a[_.place++]!==2)return!1;var rt=getLength$1(a,_);if(rt===!1)return!1;var ot=a.slice(_.place,rt+_.place);if(_.place+=rt,a[_.place++]!==2)return!1;var ft=getLength$1(a,_);if(ft===!1||a.length!==ft+_.place)return!1;var lt=a.slice(_.place,ft+_.place);if(ot[0]===0)if(ot[1]&128)ot=ot.slice(1);else return!1;if(lt[0]===0)if(lt[1]&128)lt=lt.slice(1);else return!1;return this.r=new BN$9(ot),this.s=new BN$9(lt),this.recoveryParam=null,!0};function constructLength$1(i,a){if(a<128){i.push(a);return}var o=1+(Math.log(a)/Math.LN2>>>3);for(i.push(o|128);--o;)i.push(a>>>(o<<3)&255);i.push(a)}Signature$4.prototype.toDER=function i(a){var o=this.r.toArray(),_=this.s.toArray();for(o[0]&128&&(o=[0].concat(o)),_[0]&128&&(_=[0].concat(_)),o=rmPadding$1(o),_=rmPadding$1(_);!_[0]&&!(_[1]&128);)_=_.slice(1);var et=[2];constructLength$1(et,o.length),et=et.concat(o),et.push(2),constructLength$1(et,_.length);var rt=et.concat(_),ot=[48];return constructLength$1(ot,rt.length),ot=ot.concat(rt),utils_1$1.encode(ot,a)};var rand$1=function(){throw new Error("unsupported")},assert$5$1=utils_1$1.assert;function EC$2(i){if(!(this instanceof EC$2))return new EC$2(i);typeof i=="string"&&(assert$5$1(Object.prototype.hasOwnProperty.call(curves_1,i),"Unknown curve "+i),i=curves_1[i]),i instanceof curves_1.PresetCurve&&(i={curve:i}),this.curve=i.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=i.curve.g,this.g.precompute(i.curve.n.bitLength()+1),this.hash=i.hash||i.curve.hash}var ec$1=EC$2;EC$2.prototype.keyPair=function i(a){return new key$2(this,a)};EC$2.prototype.keyFromPrivate=function i(a,o){return key$2.fromPrivate(this,a,o)};EC$2.prototype.keyFromPublic=function i(a,o){return key$2.fromPublic(this,a,o)};EC$2.prototype.genKeyPair=function i(a){a||(a={});for(var o=new hmacDrbg$1({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand$1(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),_=this.n.byteLength(),et=this.n.sub(new BN$9(2));;){var rt=new BN$9(o.generate(_));if(!(rt.cmp(et)>0))return rt.iaddn(1),this.keyFromPrivate(rt)}};EC$2.prototype._truncateToN=function i(a,o){var _=a.byteLength()*8-this.n.bitLength();return _>0&&(a=a.ushrn(_)),!o&&a.cmp(this.n)>=0?a.sub(this.n):a};EC$2.prototype.sign=function i(a,o,_,et){typeof _=="object"&&(et=_,_=null),et||(et={}),o=this.keyFromPrivate(o,_),a=this._truncateToN(new BN$9(a,16));for(var rt=this.n.byteLength(),ot=o.getPrivate().toArray("be",rt),ft=a.toArray("be",rt),lt=new hmacDrbg$1({hash:this.hash,entropy:ot,nonce:ft,pers:et.pers,persEnc:et.persEnc||"utf8"}),ht=this.n.sub(new BN$9(1)),vt=0;;vt++){var It=et.k?et.k(vt):new BN$9(lt.generate(this.n.byteLength()));if(It=this._truncateToN(It,!0),!(It.cmpn(1)<=0||It.cmp(ht)>=0)){var Qt=this.g.mul(It);if(!Qt.isInfinity()){var mt=Qt.getX(),Yt=mt.umod(this.n);if(Yt.cmpn(0)!==0){var Rt=It.invm(this.n).mul(Yt.mul(o.getPrivate()).iadd(a));if(Rt=Rt.umod(this.n),Rt.cmpn(0)!==0){var cr=(Qt.getY().isOdd()?1:0)|(mt.cmp(Yt)!==0?2:0);return et.canonical&&Rt.cmp(this.nh)>0&&(Rt=this.n.sub(Rt),cr^=1),new signature$2({r:Yt,s:Rt,recoveryParam:cr})}}}}}};EC$2.prototype.verify=function i(a,o,_,et){a=this._truncateToN(new BN$9(a,16)),_=this.keyFromPublic(_,et),o=new signature$2(o,"hex");var rt=o.r,ot=o.s;if(rt.cmpn(1)<0||rt.cmp(this.n)>=0||ot.cmpn(1)<0||ot.cmp(this.n)>=0)return!1;var ft=ot.invm(this.n),lt=ft.mul(a).umod(this.n),ht=ft.mul(rt).umod(this.n),vt;return this.curve._maxwellTrick?(vt=this.g.jmulAdd(lt,_.getPublic(),ht),vt.isInfinity()?!1:vt.eqXToP(rt)):(vt=this.g.mulAdd(lt,_.getPublic(),ht),vt.isInfinity()?!1:vt.getX().umod(this.n).cmp(rt)===0)};EC$2.prototype.recoverPubKey=function(i,a,o,_){assert$5$1((3&o)===o,"The recovery param is more than two bits"),a=new signature$2(a,_);var et=this.n,rt=new BN$9(i),ot=a.r,ft=a.s,lt=o&1,ht=o>>1;if(ot.cmp(this.curve.p.umod(this.curve.n))>=0&&ht)throw new Error("Unable to find sencond key candinate");ht?ot=this.curve.pointFromX(ot.add(this.curve.n),lt):ot=this.curve.pointFromX(ot,lt);var vt=a.r.invm(et),It=et.sub(rt).mul(vt).umod(et),Qt=ft.mul(vt).umod(et);return this.g.mulAdd(It,ot,Qt)};EC$2.prototype.getKeyRecoveryParam=function(i,a,o,_){if(a=new signature$2(a,_),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var rt;try{rt=this.recoverPubKey(i,a,et)}catch{continue}if(rt.eq(o))return et}throw new Error("Unable to find valid recovery factor")};var elliptic_1=createCommonjsModule(function(i,a){var o=a;o.version="6.5.4",o.utils=utils_1$1,o.rand=function(){throw new Error("unsupported")},o.curve=curve_1,o.curves=curves_1,o.ec=ec$1,o.eddsa=null}),EC$1$1=elliptic_1.ec;const version$7="signing-key/5.7.0",logger$7=new Logger(version$7);let _curve$1=null;function getCurve$1(){return _curve$1||(_curve$1=new EC$1$1("secp256k1")),_curve$1}class SigningKey{constructor(a){defineReadOnly(this,"curve","secp256k1"),defineReadOnly(this,"privateKey",hexlify(a)),hexDataLength(this.privateKey)!==32&&logger$7.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const o=getCurve$1().keyFromPrivate(arrayify(this.privateKey));defineReadOnly(this,"publicKey","0x"+o.getPublic(!1,"hex")),defineReadOnly(this,"compressedPublicKey","0x"+o.getPublic(!0,"hex")),defineReadOnly(this,"_isSigningKey",!0)}_addPoint(a){const o=getCurve$1().keyFromPublic(arrayify(this.publicKey)),_=getCurve$1().keyFromPublic(arrayify(a));return"0x"+o.pub.add(_.pub).encodeCompressed("hex")}signDigest(a){const o=getCurve$1().keyFromPrivate(arrayify(this.privateKey)),_=arrayify(a);_.length!==32&&logger$7.throwArgumentError("bad digest length","digest",a);const et=o.sign(_,{canonical:!0});return splitSignature({recoveryParam:et.recoveryParam,r:hexZeroPad("0x"+et.r.toString(16),32),s:hexZeroPad("0x"+et.s.toString(16),32)})}computeSharedSecret(a){const o=getCurve$1().keyFromPrivate(arrayify(this.privateKey)),_=getCurve$1().keyFromPublic(arrayify(computePublicKey(a)));return hexZeroPad("0x"+o.derive(_.getPublic()).toString(16),32)}static isSigningKey(a){return!!(a&&a._isSigningKey)}}function computePublicKey(i,a){const o=arrayify(i);if(o.length===32){const _=new SigningKey(o);return a?"0x"+getCurve$1().keyFromPrivate(o).getPublic(!0,"hex"):_.publicKey}else{if(o.length===33)return a?hexlify(o):"0x"+getCurve$1().keyFromPublic(o).getPublic(!1,"hex");if(o.length===65)return a?"0x"+getCurve$1().keyFromPublic(o).getPublic(!0,"hex"):hexlify(o)}return logger$7.throwArgumentError("invalid public or private key","key","[REDACTED]")}const version$6="transactions/5.7.0",logger$6=new Logger(version$6);var TransactionTypes;(function(i){i[i.legacy=0]="legacy",i[i.eip2930=1]="eip2930",i[i.eip1559=2]="eip1559"})(TransactionTypes||(TransactionTypes={}));const transactionFields=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],allowedTransactionKeys={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function computeAddress(i){const a=computePublicKey(i);return getAddress(hexDataSlice(keccak256(hexDataSlice(a,1)),12))}function formatNumber(i,a){const o=stripZeros(BigNumber.from(i).toHexString());return o.length>32&&logger$6.throwArgumentError("invalid length for "+a,"transaction:"+a,i),o}function accessSetify(i,a){return{address:getAddress(i),storageKeys:(a||[]).map((o,_)=>(hexDataLength(o)!==32&&logger$6.throwArgumentError("invalid access list storageKey",`accessList[${i}:${_}]`,o),o.toLowerCase()))}}function accessListify(i){if(Array.isArray(i))return i.map((o,_)=>Array.isArray(o)?(o.length>2&&logger$6.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${_}]`,o),accessSetify(o[0],o[1])):accessSetify(o.address,o.storageKeys));const a=Object.keys(i).map(o=>{const _=i[o].reduce((et,rt)=>(et[rt]=!0,et),{});return accessSetify(o,Object.keys(_).sort())});return a.sort((o,_)=>o.address.localeCompare(_.address)),a}function formatAccessList(i){return accessListify(i).map(a=>[a.address,a.storageKeys])}function _serializeEip1559(i,a){if(i.gasPrice!=null){const _=BigNumber.from(i.gasPrice),et=BigNumber.from(i.maxFeePerGas||0);_.eq(et)||logger$6.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:_,maxFeePerGas:et})}const o=[formatNumber(i.chainId||0,"chainId"),formatNumber(i.nonce||0,"nonce"),formatNumber(i.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),formatNumber(i.maxFeePerGas||0,"maxFeePerGas"),formatNumber(i.gasLimit||0,"gasLimit"),i.to!=null?getAddress(i.to):"0x",formatNumber(i.value||0,"value"),i.data||"0x",formatAccessList(i.accessList||[])];if(a){const _=splitSignature(a);o.push(formatNumber(_.recoveryParam,"recoveryParam")),o.push(stripZeros(_.r)),o.push(stripZeros(_.s))}return hexConcat(["0x02",encode$1(o)])}function _serializeEip2930(i,a){const o=[formatNumber(i.chainId||0,"chainId"),formatNumber(i.nonce||0,"nonce"),formatNumber(i.gasPrice||0,"gasPrice"),formatNumber(i.gasLimit||0,"gasLimit"),i.to!=null?getAddress(i.to):"0x",formatNumber(i.value||0,"value"),i.data||"0x",formatAccessList(i.accessList||[])];if(a){const _=splitSignature(a);o.push(formatNumber(_.recoveryParam,"recoveryParam")),o.push(stripZeros(_.r)),o.push(stripZeros(_.s))}return hexConcat(["0x01",encode$1(o)])}function _serialize(i,a){checkProperties(i,allowedTransactionKeys);const o=[];transactionFields.forEach(function(ot){let ft=i[ot.name]||[];const lt={};ot.numeric&&(lt.hexPad="left"),ft=arrayify(hexlify(ft,lt)),ot.length&&ft.length!==ot.length&&ft.length>0&&logger$6.throwArgumentError("invalid length for "+ot.name,"transaction:"+ot.name,ft),ot.maxLength&&(ft=stripZeros(ft),ft.length>ot.maxLength&&logger$6.throwArgumentError("invalid length for "+ot.name,"transaction:"+ot.name,ft)),o.push(hexlify(ft))});let _=0;if(i.chainId!=null?(_=i.chainId,typeof _!="number"&&logger$6.throwArgumentError("invalid transaction.chainId","transaction",i)):a&&!isBytesLike(a)&&a.v>28&&(_=Math.floor((a.v-35)/2)),_!==0&&(o.push(hexlify(_)),o.push("0x"),o.push("0x")),!a)return encode$1(o);const et=splitSignature(a);let rt=27+et.recoveryParam;return _!==0?(o.pop(),o.pop(),o.pop(),rt+=_*2+8,et.v>28&&et.v!==rt&&logger$6.throwArgumentError("transaction.chainId/signature.v mismatch","signature",a)):et.v!==rt&&logger$6.throwArgumentError("transaction.chainId/signature.v mismatch","signature",a),o.push(hexlify(rt)),o.push(stripZeros(arrayify(et.r))),o.push(stripZeros(arrayify(et.s))),encode$1(o)}function serialize$1(i,a){if(i.type==null||i.type===0)return i.accessList!=null&&logger$6.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",i),_serialize(i,a);switch(i.type){case 1:return _serializeEip2930(i,a);case 2:return _serializeEip1559(i,a)}return logger$6.throwError(`unsupported transaction type: ${i.type}`,Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:i.type})}const version$5="wordlists/5.7.0",logger$5=new Logger(version$5);class Wordlist{constructor(a){logger$5.checkAbstract(new.target,Wordlist),defineReadOnly(this,"locale",a)}split(a){return a.toLowerCase().split(/ +/g)}join(a){return a.join(" ")}static check(a){const o=[];for(let _=0;_<2048;_++){const et=a.getWord(_);if(_!==a.getWordIndex(et))return"0x";o.push(et)}return id(o.join(`
|
|
63
63
|
`)+`
|
|
64
|
-
`)}static register(a,o){o||(o=a.locale)}}const words="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo";let wordlist=null;function loadWords(i){if(wordlist==null&&(wordlist=words.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Wordlist.check(i)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw wordlist=null,new Error("BIP39 Wordlist for en (English) FAILED")}class LangEn extends Wordlist{constructor(){super("en")}getWord(a){return loadWords(this),wordlist[a]}getWordIndex(a){return loadWords(this),wordlist.indexOf(a)}}const langEn=new LangEn;Wordlist.register(langEn);const wordlists={en:langEn},version$4="hdnode/5.7.0",logger$4=new Logger(version$4),N=BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),MasterSecret=toUtf8Bytes("Bitcoin seed"),HardenedBit=2147483648;function getUpperMask(i){return(1<<i)-1<<8-i}function getLowerMask(i){return(1<<i)-1}function bytes32(i){return hexZeroPad(hexlify(i),32)}function base58check(i){return Base58.encode(concat([i,hexDataSlice(sha256(sha256(i)),0,4)]))}function getWordlist(i){if(i==null)return wordlists.en;if(typeof i=="string"){const a=wordlists[i];return a==null&&logger$4.throwArgumentError("unknown locale","wordlist",i),a}return i}const _constructorGuard={},defaultPath="m/44'/60'/0'/0/0";class HDNode{constructor(a,o,_,et,rt,ot,ft,lt){if(a!==_constructorGuard)throw new Error("HDNode constructor cannot be called directly");if(o){const ht=new SigningKey(o);defineReadOnly(this,"privateKey",ht.privateKey),defineReadOnly(this,"publicKey",ht.compressedPublicKey)}else defineReadOnly(this,"privateKey",null),defineReadOnly(this,"publicKey",hexlify(_));defineReadOnly(this,"parentFingerprint",et),defineReadOnly(this,"fingerprint",hexDataSlice(ripemd160(sha256(this.publicKey)),0,4)),defineReadOnly(this,"address",computeAddress(this.publicKey)),defineReadOnly(this,"chainCode",rt),defineReadOnly(this,"index",ot),defineReadOnly(this,"depth",ft),lt==null?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",null)):typeof lt=="string"?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",lt)):(defineReadOnly(this,"mnemonic",lt),defineReadOnly(this,"path",lt.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return base58check(concat([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",hexlify(this.depth),this.parentFingerprint,hexZeroPad(hexlify(this.index),4),this.chainCode,this.privateKey!=null?concat(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new HDNode(_constructorGuard,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(a){if(a>4294967295)throw new Error("invalid index - "+String(a));let o=this.path;o&&(o+="/"+(a&~HardenedBit));const _=new Uint8Array(37);if(a&HardenedBit){if(!this.privateKey)throw new Error("cannot derive child of neutered node");_.set(arrayify(this.privateKey),1),o&&(o+="'")}else _.set(arrayify(this.publicKey));for(let It=24;It>=0;It-=8)_[33+(It>>3)]=a>>24-It&255;const et=arrayify(computeHmac(SupportedAlgorithm.sha512,this.chainCode,_)),rt=et.slice(0,32),ot=et.slice(32);let ft=null,lt=null;this.privateKey?ft=bytes32(BigNumber.from(rt).add(this.privateKey).mod(N)):lt=new SigningKey(hexlify(rt))._addPoint(this.publicKey);let ht=o;const vt=this.mnemonic;return vt&&(ht=Object.freeze({phrase:vt.phrase,path:o,locale:vt.locale||"en"})),new HDNode(_constructorGuard,ft,lt,this.fingerprint,bytes32(ot),a,this.depth+1,ht)}derivePath(a){const o=a.split("/");if(o.length===0||o[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+a);o[0]==="m"&&o.shift();let _=this;for(let et=0;et<o.length;et++){const rt=o[et];if(rt.match(/^[0-9]+'$/)){const ot=parseInt(rt.substring(0,rt.length-1));if(ot>=HardenedBit)throw new Error("invalid path index - "+rt);_=_._derive(HardenedBit+ot)}else if(rt.match(/^[0-9]+$/)){const ot=parseInt(rt);if(ot>=HardenedBit)throw new Error("invalid path index - "+rt);_=_._derive(ot)}else throw new Error("invalid path component - "+rt)}return _}static _fromSeed(a,o){const _=arrayify(a);if(_.length<16||_.length>64)throw new Error("invalid seed");const et=arrayify(computeHmac(SupportedAlgorithm.sha512,MasterSecret,_));return new HDNode(_constructorGuard,bytes32(et.slice(0,32)),null,"0x00000000",bytes32(et.slice(32)),0,0,o)}static fromMnemonic(a,o,_){return _=getWordlist(_),a=entropyToMnemonic(mnemonicToEntropy(a,_),_),HDNode._fromSeed(mnemonicToSeed(a,o),{phrase:a,path:"m",locale:_.locale})}static fromSeed(a){return HDNode._fromSeed(a,null)}static fromExtendedKey(a){const o=Base58.decode(a);(o.length!==82||base58check(o.slice(0,78))!==a)&&logger$4.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const _=o[4],et=hexlify(o.slice(5,9)),rt=parseInt(hexlify(o.slice(9,13)).substring(2),16),ot=hexlify(o.slice(13,45)),ft=o.slice(45,78);switch(hexlify(o.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new HDNode(_constructorGuard,null,hexlify(ft),et,ot,rt,_,null);case"0x0488ade4":case"0x04358394 ":if(ft[0]!==0)break;return new HDNode(_constructorGuard,hexlify(ft.slice(1)),null,et,ot,rt,_,null)}return logger$4.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function mnemonicToSeed(i,a){a||(a="");const o=toUtf8Bytes("mnemonic"+a,UnicodeNormalizationForm.NFKD);return pbkdf2$1(toUtf8Bytes(i,UnicodeNormalizationForm.NFKD),o,2048,64,"sha512")}function mnemonicToEntropy(i,a){a=getWordlist(a),logger$4.checkNormalize();const o=a.split(i);if(o.length%3!==0)throw new Error("invalid mnemonic");const _=arrayify(new Uint8Array(Math.ceil(11*o.length/8)));let et=0;for(let ht=0;ht<o.length;ht++){let vt=a.getWordIndex(o[ht].normalize("NFKD"));if(vt===-1)throw new Error("invalid mnemonic");for(let It=0;It<11;It++)vt&1<<10-It&&(_[et>>3]|=1<<7-et%8),et++}const rt=32*o.length/3,ot=o.length/3,ft=getUpperMask(ot);if((arrayify(sha256(_.slice(0,rt/8)))[0]&ft)!==(_[_.length-1]&ft))throw new Error("invalid checksum");return hexlify(_.slice(0,rt/8))}function entropyToMnemonic(i,a){if(a=getWordlist(a),i=arrayify(i),i.length%4!==0||i.length<16||i.length>32)throw new Error("invalid entropy");const o=[0];let _=11;for(let ot=0;ot<i.length;ot++)_>8?(o[o.length-1]<<=8,o[o.length-1]|=i[ot],_-=8):(o[o.length-1]<<=_,o[o.length-1]|=i[ot]>>8-_,o.push(i[ot]&getLowerMask(8-_)),_+=3);const et=i.length/4,rt=arrayify(sha256(i))[0]&getUpperMask(et);return o[o.length-1]<<=et,o[o.length-1]|=rt>>8-et,a.join(o.map(ot=>a.getWord(ot)))}const version$3="random/5.7.0",logger$3=new Logger(version$3);function getGlobal(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const anyGlobal=getGlobal();let crypto$2=anyGlobal.crypto||anyGlobal.msCrypto;(!crypto$2||!crypto$2.getRandomValues)&&(logger$3.warn("WARNING: Missing strong random number source"),crypto$2={getRandomValues:function(i){return logger$3.throwError("no secure random source avaialble",Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function randomBytes(i){(i<=0||i>1024||i%1||i!=i)&&logger$3.throwArgumentError("invalid length","length",i);const a=new Uint8Array(i);return crypto$2.getRandomValues(a),arrayify(a)}var aesJs={exports:{}};(function(i,a){(function(o){function _(Tt){return parseInt(Tt)===Tt}function et(Tt){if(!_(Tt.length))return!1;for(var Mt=0;Mt<Tt.length;Mt++)if(!_(Tt[Mt])||Tt[Mt]<0||Tt[Mt]>255)return!1;return!0}function rt(Tt,Mt){if(Tt.buffer&&ArrayBuffer.isView(Tt)&&Tt.name==="Uint8Array")return Mt&&(Tt.slice?Tt=Tt.slice():Tt=Array.prototype.slice.call(Tt)),Tt;if(Array.isArray(Tt)){if(!et(Tt))throw new Error("Array contains invalid value: "+Tt);return new Uint8Array(Tt)}if(_(Tt.length)&&et(Tt))return new Uint8Array(Tt);throw new Error("unsupported array-like object")}function ot(Tt){return new Uint8Array(Tt)}function ft(Tt,Mt,dr,Nr,qt){(Nr!=null||qt!=null)&&(Tt.slice?Tt=Tt.slice(Nr,qt):Tt=Array.prototype.slice.call(Tt,Nr,qt)),Mt.set(Tt,dr)}var lt=function(){function Tt(dr){var Nr=[],qt=0;for(dr=encodeURI(dr);qt<dr.length;){var Fr=dr.charCodeAt(qt++);Fr===37?(Nr.push(parseInt(dr.substr(qt,2),16)),qt+=2):Nr.push(Fr)}return rt(Nr)}function Mt(dr){for(var Nr=[],qt=0;qt<dr.length;){var Fr=dr[qt];Fr<128?(Nr.push(String.fromCharCode(Fr)),qt++):Fr>191&&Fr<224?(Nr.push(String.fromCharCode((Fr&31)<<6|dr[qt+1]&63)),qt+=2):(Nr.push(String.fromCharCode((Fr&15)<<12|(dr[qt+1]&63)<<6|dr[qt+2]&63)),qt+=3)}return Nr.join("")}return{toBytes:Tt,fromBytes:Mt}}(),ht=function(){function Tt(Nr){for(var qt=[],Fr=0;Fr<Nr.length;Fr+=2)qt.push(parseInt(Nr.substr(Fr,2),16));return qt}var Mt="0123456789abcdef";function dr(Nr){for(var qt=[],Fr=0;Fr<Nr.length;Fr++){var jr=Nr[Fr];qt.push(Mt[(jr&240)>>4]+Mt[jr&15])}return qt.join("")}return{toBytes:Tt,fromBytes:dr}}(),vt={16:10,24:12,32:14},It=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Qt=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],mt=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Yt=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Rt=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],cr=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Ut=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],zt=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Gt=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Dr=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],lr=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],xr=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],hr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Hr=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],vr=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function u0(Tt){for(var Mt=[],dr=0;dr<Tt.length;dr+=4)Mt.push(Tt[dr]<<24|Tt[dr+1]<<16|Tt[dr+2]<<8|Tt[dr+3]);return Mt}var Br=function(Tt){if(!(this instanceof Br))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:rt(Tt,!0)}),this._prepare()};Br.prototype._prepare=function(){var Tt=vt[this.key.length];if(Tt==null)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var Mt=0;Mt<=Tt;Mt++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var dr=(Tt+1)*4,Nr=this.key.length/4,qt=u0(this.key),Fr,Mt=0;Mt<Nr;Mt++)Fr=Mt>>2,this._Ke[Fr][Mt%4]=qt[Mt],this._Kd[Tt-Fr][Mt%4]=qt[Mt];for(var jr=0,Wr=Nr,Zr;Wr<dr;){if(Zr=qt[Nr-1],qt[0]^=Qt[Zr>>16&255]<<24^Qt[Zr>>8&255]<<16^Qt[Zr&255]<<8^Qt[Zr>>24&255]^It[jr]<<24,jr+=1,Nr!=8)for(var Mt=1;Mt<Nr;Mt++)qt[Mt]^=qt[Mt-1];else{for(var Mt=1;Mt<Nr/2;Mt++)qt[Mt]^=qt[Mt-1];Zr=qt[Nr/2-1],qt[Nr/2]^=Qt[Zr&255]^Qt[Zr>>8&255]<<8^Qt[Zr>>16&255]<<16^Qt[Zr>>24&255]<<24;for(var Mt=Nr/2+1;Mt<Nr;Mt++)qt[Mt]^=qt[Mt-1]}for(var Mt=0,b0,E0;Mt<Nr&&Wr<dr;)b0=Wr>>2,E0=Wr%4,this._Ke[b0][E0]=qt[Mt],this._Kd[Tt-b0][E0]=qt[Mt++],Wr++}for(var b0=1;b0<Tt;b0++)for(var E0=0;E0<4;E0++)Zr=this._Kd[b0][E0],this._Kd[b0][E0]=xr[Zr>>24&255]^hr[Zr>>16&255]^Hr[Zr>>8&255]^vr[Zr&255]},Br.prototype.encrypt=function(Tt){if(Tt.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var Mt=this._Ke.length-1,dr=[0,0,0,0],Nr=u0(Tt),qt=0;qt<4;qt++)Nr[qt]^=this._Ke[0][qt];for(var Fr=1;Fr<Mt;Fr++){for(var qt=0;qt<4;qt++)dr[qt]=Yt[Nr[qt]>>24&255]^Rt[Nr[(qt+1)%4]>>16&255]^cr[Nr[(qt+2)%4]>>8&255]^Ut[Nr[(qt+3)%4]&255]^this._Ke[Fr][qt];Nr=dr.slice()}for(var jr=ot(16),Wr,qt=0;qt<4;qt++)Wr=this._Ke[Mt][qt],jr[4*qt]=(Qt[Nr[qt]>>24&255]^Wr>>24)&255,jr[4*qt+1]=(Qt[Nr[(qt+1)%4]>>16&255]^Wr>>16)&255,jr[4*qt+2]=(Qt[Nr[(qt+2)%4]>>8&255]^Wr>>8)&255,jr[4*qt+3]=(Qt[Nr[(qt+3)%4]&255]^Wr)&255;return jr},Br.prototype.decrypt=function(Tt){if(Tt.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var Mt=this._Kd.length-1,dr=[0,0,0,0],Nr=u0(Tt),qt=0;qt<4;qt++)Nr[qt]^=this._Kd[0][qt];for(var Fr=1;Fr<Mt;Fr++){for(var qt=0;qt<4;qt++)dr[qt]=zt[Nr[qt]>>24&255]^Gt[Nr[(qt+3)%4]>>16&255]^Dr[Nr[(qt+2)%4]>>8&255]^lr[Nr[(qt+1)%4]&255]^this._Kd[Fr][qt];Nr=dr.slice()}for(var jr=ot(16),Wr,qt=0;qt<4;qt++)Wr=this._Kd[Mt][qt],jr[4*qt]=(mt[Nr[qt]>>24&255]^Wr>>24)&255,jr[4*qt+1]=(mt[Nr[(qt+3)%4]>>16&255]^Wr>>16)&255,jr[4*qt+2]=(mt[Nr[(qt+2)%4]>>8&255]^Wr>>8)&255,jr[4*qt+3]=(mt[Nr[(qt+1)%4]&255]^Wr)&255;return jr};var Kt=function(Tt){if(!(this instanceof Kt))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Br(Tt)};Kt.prototype.encrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16)ft(Tt,dr,0,Nr,Nr+16),dr=this._aes.encrypt(dr),ft(dr,Mt,Nr);return Mt},Kt.prototype.decrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16)ft(Tt,dr,0,Nr,Nr+16),dr=this._aes.decrypt(dr),ft(dr,Mt,Nr);return Mt};var Ft=function(Tt,Mt){if(!(this instanceof Ft))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!Mt)Mt=ot(16);else if(Mt.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=rt(Mt,!0),this._aes=new Br(Tt)};Ft.prototype.encrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16){ft(Tt,dr,0,Nr,Nr+16);for(var qt=0;qt<16;qt++)dr[qt]^=this._lastCipherblock[qt];this._lastCipherblock=this._aes.encrypt(dr),ft(this._lastCipherblock,Mt,Nr)}return Mt},Ft.prototype.decrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16){ft(Tt,dr,0,Nr,Nr+16),dr=this._aes.decrypt(dr);for(var qt=0;qt<16;qt++)Mt[Nr+qt]=dr[qt]^this._lastCipherblock[qt];ft(Tt,this._lastCipherblock,0,Nr,Nr+16)}return Mt};var bt=function(Tt,Mt,dr){if(!(this instanceof bt))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!Mt)Mt=ot(16);else if(Mt.length!=16)throw new Error("invalid initialation vector size (must be 16 size)");dr||(dr=1),this.segmentSize=dr,this._shiftRegister=rt(Mt,!0),this._aes=new Br(Tt)};bt.prototype.encrypt=function(Tt){if(Tt.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var Mt=rt(Tt,!0),dr,Nr=0;Nr<Mt.length;Nr+=this.segmentSize){dr=this._aes.encrypt(this._shiftRegister);for(var qt=0;qt<this.segmentSize;qt++)Mt[Nr+qt]^=dr[qt];ft(this._shiftRegister,this._shiftRegister,0,this.segmentSize),ft(Mt,this._shiftRegister,16-this.segmentSize,Nr,Nr+this.segmentSize)}return Mt},bt.prototype.decrypt=function(Tt){if(Tt.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var Mt=rt(Tt,!0),dr,Nr=0;Nr<Mt.length;Nr+=this.segmentSize){dr=this._aes.encrypt(this._shiftRegister);for(var qt=0;qt<this.segmentSize;qt++)Mt[Nr+qt]^=dr[qt];ft(this._shiftRegister,this._shiftRegister,0,this.segmentSize),ft(Tt,this._shiftRegister,16-this.segmentSize,Nr,Nr+this.segmentSize)}return Mt};var St=function(Tt,Mt){if(!(this instanceof St))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!Mt)Mt=ot(16);else if(Mt.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=rt(Mt,!0),this._lastPrecipherIndex=16,this._aes=new Br(Tt)};St.prototype.encrypt=function(Tt){for(var Mt=rt(Tt,!0),dr=0;dr<Mt.length;dr++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),Mt[dr]^=this._lastPrecipher[this._lastPrecipherIndex++];return Mt},St.prototype.decrypt=St.prototype.encrypt;var Jt=function(Tt){if(!(this instanceof Jt))throw Error("Counter must be instanitated with `new`");Tt!==0&&!Tt&&(Tt=1),typeof Tt=="number"?(this._counter=ot(16),this.setValue(Tt)):this.setBytes(Tt)};Jt.prototype.setValue=function(Tt){if(typeof Tt!="number"||parseInt(Tt)!=Tt)throw new Error("invalid counter value (must be an integer)");for(var Mt=15;Mt>=0;--Mt)this._counter[Mt]=Tt%256,Tt=Tt>>8},Jt.prototype.setBytes=function(Tt){if(Tt=rt(Tt,!0),Tt.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=Tt},Jt.prototype.increment=function(){for(var Tt=15;Tt>=0;Tt--)if(this._counter[Tt]===255)this._counter[Tt]=0;else{this._counter[Tt]++;break}};var er=function(Tt,Mt){if(!(this instanceof er))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",Mt instanceof Jt||(Mt=new Jt(Mt)),this._counter=Mt,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Br(Tt)};er.prototype.encrypt=function(Tt){for(var Mt=rt(Tt,!0),dr=0;dr<Mt.length;dr++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),Mt[dr]^=this._remainingCounter[this._remainingCounterIndex++];return Mt},er.prototype.decrypt=er.prototype.encrypt;function sr(Tt){Tt=rt(Tt,!0);var Mt=16-Tt.length%16,dr=ot(Tt.length+Mt);ft(Tt,dr);for(var Nr=Tt.length;Nr<dr.length;Nr++)dr[Nr]=Mt;return dr}function nr(Tt){if(Tt=rt(Tt,!0),Tt.length<16)throw new Error("PKCS#7 invalid length");var Mt=Tt[Tt.length-1];if(Mt>16)throw new Error("PKCS#7 padding byte out of range");for(var dr=Tt.length-Mt,Nr=0;Nr<Mt;Nr++)if(Tt[dr+Nr]!==Mt)throw new Error("PKCS#7 invalid padding byte");var qt=ot(dr);return ft(Tt,qt,0,0,dr),qt}var Dt={AES:Br,Counter:Jt,ModeOfOperation:{ecb:Kt,cbc:Ft,cfb:bt,ofb:St,ctr:er},utils:{hex:ht,utf8:lt},padding:{pkcs7:{pad:sr,strip:nr}},_arrayTest:{coerceArray:rt,createArray:ot,copyArray:ft}};i.exports=Dt})()})(aesJs);var aesJsExports=aesJs.exports;const aes=getDefaultExportFromCjs(aesJsExports),version$2="json-wallets/5.7.0";function looseArrayify(i){return typeof i=="string"&&i.substring(0,2)!=="0x"&&(i="0x"+i),arrayify(i)}function zpad(i,a){for(i=String(i);i.length<a;)i="0"+i;return i}function getPassword(i){return typeof i=="string"?toUtf8Bytes(i,UnicodeNormalizationForm.NFKC):arrayify(i)}function searchPath(i,a){let o=i;const _=a.toLowerCase().split("/");for(let et=0;et<_.length;et++){let rt=null;for(const ot in o)if(ot.toLowerCase()===_[et]){rt=o[ot];break}if(rt===null)return null;o=rt}return o}function uuidV4(i){const a=arrayify(i);a[6]=a[6]&15|64,a[8]=a[8]&63|128;const o=hexlify(a);return[o.substring(2,10),o.substring(10,14),o.substring(14,18),o.substring(18,22),o.substring(22,34)].join("-")}const logger$2=new Logger(version$2);class CrowdsaleAccount extends Description{isCrowdsaleAccount(a){return!!(a&&a._isCrowdsaleAccount)}}function decrypt$1(i,a){const o=JSON.parse(i);a=getPassword(a);const _=getAddress(searchPath(o,"ethaddr")),et=looseArrayify(searchPath(o,"encseed"));(!et||et.length%16!==0)&&logger$2.throwArgumentError("invalid encseed","json",i);const rt=arrayify(pbkdf2$1(a,a,2e3,32,"sha256")).slice(0,16),ot=et.slice(0,16),ft=et.slice(16),lt=new aes.ModeOfOperation.cbc(rt,ot),ht=aes.padding.pkcs7.strip(arrayify(lt.decrypt(ft)));let vt="";for(let mt=0;mt<ht.length;mt++)vt+=String.fromCharCode(ht[mt]);const It=toUtf8Bytes(vt),Qt=keccak256(It);return new CrowdsaleAccount({_isCrowdsaleAccount:!0,address:_,privateKey:Qt})}function isCrowdsaleWallet(i){let a=null;try{a=JSON.parse(i)}catch{return!1}return a.encseed&&a.ethaddr}function isKeystoreWallet(i){let a=null;try{a=JSON.parse(i)}catch{return!1}return!(!a.version||parseInt(a.version)!==a.version||parseInt(a.version)!==3)}var scrypt$1={exports:{}};(function(i,a){(function(o){function et(Rt){const cr=new Uint32Array([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]);let Ut=1779033703,zt=3144134277,Gt=1013904242,Dr=2773480762,lr=1359893119,xr=2600822924,hr=528734635,Hr=1541459225;const vr=new Uint32Array(64);function u0(er){let sr=0,nr=er.length;for(;nr>=64;){let Dt=Ut,Tt=zt,Mt=Gt,dr=Dr,Nr=lr,qt=xr,Fr=hr,jr=Hr,Wr,Zr,b0,E0,m0;for(Zr=0;Zr<16;Zr++)b0=sr+Zr*4,vr[Zr]=(er[b0]&255)<<24|(er[b0+1]&255)<<16|(er[b0+2]&255)<<8|er[b0+3]&255;for(Zr=16;Zr<64;Zr++)Wr=vr[Zr-2],E0=(Wr>>>17|Wr<<32-17)^(Wr>>>19|Wr<<32-19)^Wr>>>10,Wr=vr[Zr-15],m0=(Wr>>>7|Wr<<32-7)^(Wr>>>18|Wr<<32-18)^Wr>>>3,vr[Zr]=(E0+vr[Zr-7]|0)+(m0+vr[Zr-16]|0)|0;for(Zr=0;Zr<64;Zr++)E0=(((Nr>>>6|Nr<<32-6)^(Nr>>>11|Nr<<32-11)^(Nr>>>25|Nr<<32-25))+(Nr&qt^~Nr&Fr)|0)+(jr+(cr[Zr]+vr[Zr]|0)|0)|0,m0=((Dt>>>2|Dt<<32-2)^(Dt>>>13|Dt<<32-13)^(Dt>>>22|Dt<<32-22))+(Dt&Tt^Dt&Mt^Tt&Mt)|0,jr=Fr,Fr=qt,qt=Nr,Nr=dr+E0|0,dr=Mt,Mt=Tt,Tt=Dt,Dt=E0+m0|0;Ut=Ut+Dt|0,zt=zt+Tt|0,Gt=Gt+Mt|0,Dr=Dr+dr|0,lr=lr+Nr|0,xr=xr+qt|0,hr=hr+Fr|0,Hr=Hr+jr|0,sr+=64,nr-=64}}u0(Rt);let Br,Kt=Rt.length%64,Ft=Rt.length/536870912|0,bt=Rt.length<<3,St=Kt<56?56:120,Jt=Rt.slice(Rt.length-Kt,Rt.length);for(Jt.push(128),Br=Kt+1;Br<St;Br++)Jt.push(0);return Jt.push(Ft>>>24&255),Jt.push(Ft>>>16&255),Jt.push(Ft>>>8&255),Jt.push(Ft>>>0&255),Jt.push(bt>>>24&255),Jt.push(bt>>>16&255),Jt.push(bt>>>8&255),Jt.push(bt>>>0&255),u0(Jt),[Ut>>>24&255,Ut>>>16&255,Ut>>>8&255,Ut>>>0&255,zt>>>24&255,zt>>>16&255,zt>>>8&255,zt>>>0&255,Gt>>>24&255,Gt>>>16&255,Gt>>>8&255,Gt>>>0&255,Dr>>>24&255,Dr>>>16&255,Dr>>>8&255,Dr>>>0&255,lr>>>24&255,lr>>>16&255,lr>>>8&255,lr>>>0&255,xr>>>24&255,xr>>>16&255,xr>>>8&255,xr>>>0&255,hr>>>24&255,hr>>>16&255,hr>>>8&255,hr>>>0&255,Hr>>>24&255,Hr>>>16&255,Hr>>>8&255,Hr>>>0&255]}function rt(Rt,cr,Ut){Rt=Rt.length<=64?Rt:et(Rt);const zt=64+cr.length+4,Gt=new Array(zt),Dr=new Array(64);let lr,xr=[];for(lr=0;lr<64;lr++)Gt[lr]=54;for(lr=0;lr<Rt.length;lr++)Gt[lr]^=Rt[lr];for(lr=0;lr<cr.length;lr++)Gt[64+lr]=cr[lr];for(lr=zt-4;lr<zt;lr++)Gt[lr]=0;for(lr=0;lr<64;lr++)Dr[lr]=92;for(lr=0;lr<Rt.length;lr++)Dr[lr]^=Rt[lr];function hr(){for(let Hr=zt-1;Hr>=zt-4;Hr--){if(Gt[Hr]++,Gt[Hr]<=255)return;Gt[Hr]=0}}for(;Ut>=32;)hr(),xr=xr.concat(et(Dr.concat(et(Gt)))),Ut-=32;return Ut>0&&(hr(),xr=xr.concat(et(Dr.concat(et(Gt))).slice(0,Ut))),xr}function ot(Rt,cr,Ut,zt,Gt){let Dr;for(vt(Rt,(2*Ut-1)*16,Gt,0,16),Dr=0;Dr<2*Ut;Dr++)ht(Rt,Dr*16,Gt,16),lt(Gt,zt),vt(Gt,0,Rt,cr+Dr*16,16);for(Dr=0;Dr<Ut;Dr++)vt(Rt,cr+Dr*2*16,Rt,Dr*16,16);for(Dr=0;Dr<Ut;Dr++)vt(Rt,cr+(Dr*2+1)*16,Rt,(Dr+Ut)*16,16)}function ft(Rt,cr){return Rt<<cr|Rt>>>32-cr}function lt(Rt,cr){vt(Rt,0,cr,0,16);for(let Ut=8;Ut>0;Ut-=2)cr[4]^=ft(cr[0]+cr[12],7),cr[8]^=ft(cr[4]+cr[0],9),cr[12]^=ft(cr[8]+cr[4],13),cr[0]^=ft(cr[12]+cr[8],18),cr[9]^=ft(cr[5]+cr[1],7),cr[13]^=ft(cr[9]+cr[5],9),cr[1]^=ft(cr[13]+cr[9],13),cr[5]^=ft(cr[1]+cr[13],18),cr[14]^=ft(cr[10]+cr[6],7),cr[2]^=ft(cr[14]+cr[10],9),cr[6]^=ft(cr[2]+cr[14],13),cr[10]^=ft(cr[6]+cr[2],18),cr[3]^=ft(cr[15]+cr[11],7),cr[7]^=ft(cr[3]+cr[15],9),cr[11]^=ft(cr[7]+cr[3],13),cr[15]^=ft(cr[11]+cr[7],18),cr[1]^=ft(cr[0]+cr[3],7),cr[2]^=ft(cr[1]+cr[0],9),cr[3]^=ft(cr[2]+cr[1],13),cr[0]^=ft(cr[3]+cr[2],18),cr[6]^=ft(cr[5]+cr[4],7),cr[7]^=ft(cr[6]+cr[5],9),cr[4]^=ft(cr[7]+cr[6],13),cr[5]^=ft(cr[4]+cr[7],18),cr[11]^=ft(cr[10]+cr[9],7),cr[8]^=ft(cr[11]+cr[10],9),cr[9]^=ft(cr[8]+cr[11],13),cr[10]^=ft(cr[9]+cr[8],18),cr[12]^=ft(cr[15]+cr[14],7),cr[13]^=ft(cr[12]+cr[15],9),cr[14]^=ft(cr[13]+cr[12],13),cr[15]^=ft(cr[14]+cr[13],18);for(let Ut=0;Ut<16;++Ut)Rt[Ut]+=cr[Ut]}function ht(Rt,cr,Ut,zt){for(let Gt=0;Gt<zt;Gt++)Ut[Gt]^=Rt[cr+Gt]}function vt(Rt,cr,Ut,zt,Gt){for(;Gt--;)Ut[zt++]=Rt[cr++]}function It(Rt){if(!Rt||typeof Rt.length!="number")return!1;for(let cr=0;cr<Rt.length;cr++){const Ut=Rt[cr];if(typeof Ut!="number"||Ut%1||Ut<0||Ut>=256)return!1}return!0}function Qt(Rt,cr){if(typeof Rt!="number"||Rt%1)throw new Error("invalid "+cr);return Rt}function mt(Rt,cr,Ut,zt,Gt,Dr,lr){if(Ut=Qt(Ut,"N"),zt=Qt(zt,"r"),Gt=Qt(Gt,"p"),Dr=Qt(Dr,"dkLen"),Ut===0||Ut&Ut-1)throw new Error("N must be power of 2");if(Ut>2147483647/128/zt)throw new Error("N too large");if(zt>2147483647/128/Gt)throw new Error("r too large");if(!It(Rt))throw new Error("password must be an array or buffer");if(Rt=Array.prototype.slice.call(Rt),!It(cr))throw new Error("salt must be an array or buffer");cr=Array.prototype.slice.call(cr);let xr=rt(Rt,cr,Gt*128*zt);const hr=new Uint32Array(Gt*32*zt);for(let Nr=0;Nr<hr.length;Nr++){const qt=Nr*4;hr[Nr]=(xr[qt+3]&255)<<24|(xr[qt+2]&255)<<16|(xr[qt+1]&255)<<8|(xr[qt+0]&255)<<0}const Hr=new Uint32Array(64*zt),vr=new Uint32Array(32*zt*Ut),u0=32*zt,Br=new Uint32Array(16),Kt=new Uint32Array(16),Ft=Gt*Ut*2;let bt=0,St=null,Jt=!1,er=0,sr=0,nr,Dt;const Tt=lr?parseInt(1e3/zt):4294967295,Mt=typeof setImmediate<"u"?setImmediate:setTimeout,dr=function(){if(Jt)return lr(new Error("cancelled"),bt/Ft);let Nr;switch(er){case 0:Dt=sr*32*zt,vt(hr,Dt,Hr,0,u0),er=1,nr=0;case 1:Nr=Ut-nr,Nr>Tt&&(Nr=Tt);for(let Fr=0;Fr<Nr;Fr++)vt(Hr,0,vr,(nr+Fr)*u0,u0),ot(Hr,u0,zt,Br,Kt);if(nr+=Nr,bt+=Nr,lr){const Fr=parseInt(1e3*bt/Ft);if(Fr!==St){if(Jt=lr(null,bt/Ft),Jt)break;St=Fr}}if(nr<Ut)break;nr=0,er=2;case 2:Nr=Ut-nr,Nr>Tt&&(Nr=Tt);for(let Fr=0;Fr<Nr;Fr++){const jr=(2*zt-1)*16,Wr=Hr[jr]&Ut-1;ht(vr,Wr*u0,Hr,u0),ot(Hr,u0,zt,Br,Kt)}if(nr+=Nr,bt+=Nr,lr){const Fr=parseInt(1e3*bt/Ft);if(Fr!==St){if(Jt=lr(null,bt/Ft),Jt)break;St=Fr}}if(nr<Ut)break;if(vt(Hr,0,hr,Dt,u0),sr++,sr<Gt){er=0;break}xr=[];for(let Fr=0;Fr<hr.length;Fr++)xr.push(hr[Fr]>>0&255),xr.push(hr[Fr]>>8&255),xr.push(hr[Fr]>>16&255),xr.push(hr[Fr]>>24&255);const qt=rt(Rt,xr,Dr);return lr&&lr(null,1,qt),qt}lr&&Mt(dr)};if(!lr)for(;;){const Nr=dr();if(Nr!=null)return Nr}dr()}const Yt={scrypt:function(Rt,cr,Ut,zt,Gt,Dr,lr){return new Promise(function(xr,hr){let Hr=0;lr&&lr(0),mt(Rt,cr,Ut,zt,Gt,Dr,function(vr,u0,Br){if(vr)hr(vr);else if(Br)lr&&Hr!==1&&lr(1),xr(new Uint8Array(Br));else if(lr&&u0!==Hr)return Hr=u0,lr(u0)})})},syncScrypt:function(Rt,cr,Ut,zt,Gt,Dr){return new Uint8Array(mt(Rt,cr,Ut,zt,Gt,Dr))}};i.exports=Yt})()})(scrypt$1);var scryptExports=scrypt$1.exports;const scrypt=getDefaultExportFromCjs(scryptExports);var __awaiter$1=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger$1=new Logger(version$2);function hasMnemonic$1(i){return i!=null&&i.mnemonic&&i.mnemonic.phrase}class KeystoreAccount extends Description{isKeystoreAccount(a){return!!(a&&a._isKeystoreAccount)}}function _decrypt(i,a,o){if(searchPath(i,"crypto/cipher")==="aes-128-ctr"){const et=looseArrayify(searchPath(i,"crypto/cipherparams/iv")),rt=new aes.Counter(et),ot=new aes.ModeOfOperation.ctr(a,rt);return arrayify(ot.decrypt(o))}return null}function _getAccount(i,a){const o=looseArrayify(searchPath(i,"crypto/ciphertext"));if(hexlify(keccak256(concat([a.slice(16,32),o]))).substring(2)!==searchPath(i,"crypto/mac").toLowerCase())throw new Error("invalid password");const et=_decrypt(i,a.slice(0,16),o);et||logger$1.throwError("unsupported cipher",Logger.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const rt=a.slice(32,64),ot=computeAddress(et);if(i.address){let lt=i.address.toLowerCase();if(lt.substring(0,2)!=="0x"&&(lt="0x"+lt),getAddress(lt)!==ot)throw new Error("address mismatch")}const ft={_isKeystoreAccount:!0,address:ot,privateKey:hexlify(et)};if(searchPath(i,"x-ethers/version")==="0.1"){const lt=looseArrayify(searchPath(i,"x-ethers/mnemonicCiphertext")),ht=looseArrayify(searchPath(i,"x-ethers/mnemonicCounter")),vt=new aes.Counter(ht),It=new aes.ModeOfOperation.ctr(rt,vt),Qt=searchPath(i,"x-ethers/path")||defaultPath,mt=searchPath(i,"x-ethers/locale")||"en",Yt=arrayify(It.decrypt(lt));try{const Rt=entropyToMnemonic(Yt,mt),cr=HDNode.fromMnemonic(Rt,null,mt).derivePath(Qt);if(cr.privateKey!=ft.privateKey)throw new Error("mnemonic mismatch");ft.mnemonic=cr.mnemonic}catch(Rt){if(Rt.code!==Logger.errors.INVALID_ARGUMENT||Rt.argument!=="wordlist")throw Rt}}return new KeystoreAccount(ft)}function pbkdf2Sync(i,a,o,_,et){return arrayify(pbkdf2$1(i,a,o,_,et))}function pbkdf2(i,a,o,_,et){return Promise.resolve(pbkdf2Sync(i,a,o,_,et))}function _computeKdfKey(i,a,o,_,et){const rt=getPassword(a),ot=searchPath(i,"crypto/kdf");if(ot&&typeof ot=="string"){const ft=function(lt,ht){return logger$1.throwArgumentError("invalid key-derivation function parameters",lt,ht)};if(ot.toLowerCase()==="scrypt"){const lt=looseArrayify(searchPath(i,"crypto/kdfparams/salt")),ht=parseInt(searchPath(i,"crypto/kdfparams/n")),vt=parseInt(searchPath(i,"crypto/kdfparams/r")),It=parseInt(searchPath(i,"crypto/kdfparams/p"));(!ht||!vt||!It)&&ft("kdf",ot),ht&ht-1&&ft("N",ht);const Qt=parseInt(searchPath(i,"crypto/kdfparams/dklen"));return Qt!==32&&ft("dklen",Qt),_(rt,lt,ht,vt,It,64,et)}else if(ot.toLowerCase()==="pbkdf2"){const lt=looseArrayify(searchPath(i,"crypto/kdfparams/salt"));let ht=null;const vt=searchPath(i,"crypto/kdfparams/prf");vt==="hmac-sha256"?ht="sha256":vt==="hmac-sha512"?ht="sha512":ft("prf",vt);const It=parseInt(searchPath(i,"crypto/kdfparams/c")),Qt=parseInt(searchPath(i,"crypto/kdfparams/dklen"));return Qt!==32&&ft("dklen",Qt),o(rt,lt,It,Qt,ht)}}return logger$1.throwArgumentError("unsupported key-derivation function","kdf",ot)}function decryptSync(i,a){const o=JSON.parse(i),_=_computeKdfKey(o,a,pbkdf2Sync,scrypt.syncScrypt);return _getAccount(o,_)}function decrypt(i,a,o){return __awaiter$1(this,void 0,void 0,function*(){const _=JSON.parse(i),et=yield _computeKdfKey(_,a,pbkdf2,scrypt.scrypt,o);return _getAccount(_,et)})}function encrypt(i,a,o,_){try{if(getAddress(i.address)!==computeAddress(i.privateKey))throw new Error("address/privateKey mismatch");if(hasMnemonic$1(i)){const cr=i.mnemonic;if(HDNode.fromMnemonic(cr.phrase,null,cr.locale).derivePath(cr.path||defaultPath).privateKey!=i.privateKey)throw new Error("mnemonic mismatch")}}catch(cr){return Promise.reject(cr)}typeof o=="function"&&!_&&(_=o,o={}),o||(o={});const et=arrayify(i.privateKey),rt=getPassword(a);let ot=null,ft=null,lt=null;if(hasMnemonic$1(i)){const cr=i.mnemonic;ot=arrayify(mnemonicToEntropy(cr.phrase,cr.locale||"en")),ft=cr.path||defaultPath,lt=cr.locale||"en"}let ht=o.client;ht||(ht="ethers.js");let vt=null;o.salt?vt=arrayify(o.salt):vt=randomBytes(32);let It=null;if(o.iv){if(It=arrayify(o.iv),It.length!==16)throw new Error("invalid iv")}else It=randomBytes(16);let Qt=null;if(o.uuid){if(Qt=arrayify(o.uuid),Qt.length!==16)throw new Error("invalid uuid")}else Qt=randomBytes(16);let mt=1<<17,Yt=8,Rt=1;return o.scrypt&&(o.scrypt.N&&(mt=o.scrypt.N),o.scrypt.r&&(Yt=o.scrypt.r),o.scrypt.p&&(Rt=o.scrypt.p)),scrypt.scrypt(rt,vt,mt,Yt,Rt,64,_).then(cr=>{cr=arrayify(cr);const Ut=cr.slice(0,16),zt=cr.slice(16,32),Gt=cr.slice(32,64),Dr=new aes.Counter(It),lr=new aes.ModeOfOperation.ctr(Ut,Dr),xr=arrayify(lr.encrypt(et)),hr=keccak256(concat([zt,xr])),Hr={address:i.address.substring(2).toLowerCase(),id:uuidV4(Qt),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(It).substring(2)},ciphertext:hexlify(xr).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(vt).substring(2),n:mt,dklen:32,p:Rt,r:Yt},mac:hr.substring(2)}};if(ot){const vr=randomBytes(16),u0=new aes.Counter(vr),Br=new aes.ModeOfOperation.ctr(Gt,u0),Kt=arrayify(Br.encrypt(ot)),Ft=new Date,bt=Ft.getUTCFullYear()+"-"+zpad(Ft.getUTCMonth()+1,2)+"-"+zpad(Ft.getUTCDate(),2)+"T"+zpad(Ft.getUTCHours(),2)+"-"+zpad(Ft.getUTCMinutes(),2)+"-"+zpad(Ft.getUTCSeconds(),2)+".0Z";Hr["x-ethers"]={client:ht,gethFilename:"UTC--"+bt+"--"+Hr.address,mnemonicCounter:hexlify(vr).substring(2),mnemonicCiphertext:hexlify(Kt).substring(2),path:ft,locale:lt,version:"0.1"}}return JSON.stringify(Hr)})}function decryptJsonWallet(i,a,o){if(isCrowdsaleWallet(i)){o&&o(0);const _=decrypt$1(i,a);return o&&o(1),Promise.resolve(_)}return isKeystoreWallet(i)?decrypt(i,a,o):Promise.reject(new Error("invalid JSON wallet"))}function decryptJsonWalletSync(i,a){if(isCrowdsaleWallet(i))return decrypt$1(i,a);if(isKeystoreWallet(i))return decryptSync(i,a);throw new Error("invalid JSON wallet")}const version$1="wallet/5.7.0";var __awaiter=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger=new Logger(version$1);function isAccount(i){return i!=null&&isHexString(i.privateKey,32)&&i.address!=null}function hasMnemonic(i){const a=i.mnemonic;return a&&a.phrase}class Wallet extends Signer{constructor(a,o){if(super(),isAccount(a)){const _=new SigningKey(a.privateKey);if(defineReadOnly(this,"_signingKey",()=>_),defineReadOnly(this,"address",computeAddress(this.publicKey)),this.address!==getAddress(a.address)&&logger.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),hasMnemonic(a)){const et=a.mnemonic;defineReadOnly(this,"_mnemonic",()=>({phrase:et.phrase,path:et.path||defaultPath,locale:et.locale||"en"}));const rt=this.mnemonic,ot=HDNode.fromMnemonic(rt.phrase,null,rt.locale).derivePath(rt.path);computeAddress(ot.privateKey)!==this.address&&logger.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else defineReadOnly(this,"_mnemonic",()=>null)}else{if(SigningKey.isSigningKey(a))a.curve!=="secp256k1"&&logger.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),defineReadOnly(this,"_signingKey",()=>a);else{typeof a=="string"&&a.match(/^[0-9a-f]*$/i)&&a.length===64&&(a="0x"+a);const _=new SigningKey(a);defineReadOnly(this,"_signingKey",()=>_)}defineReadOnly(this,"_mnemonic",()=>null),defineReadOnly(this,"address",computeAddress(this.publicKey))}o&&!Provider.isProvider(o)&&logger.throwArgumentError("invalid provider","provider",o),defineReadOnly(this,"provider",o||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(a){return new Wallet(this,a)}signTransaction(a){return resolveProperties(a).then(o=>{o.from!=null&&(getAddress(o.from)!==this.address&&logger.throwArgumentError("transaction from address mismatch","transaction.from",a.from),delete o.from);const _=this._signingKey().signDigest(keccak256(serialize$1(o)));return serialize$1(o,_)})}signMessage(a){return __awaiter(this,void 0,void 0,function*(){return joinSignature(this._signingKey().signDigest(hashMessage(a)))})}_signTypedData(a,o,_){return __awaiter(this,void 0,void 0,function*(){const et=yield TypedDataEncoder.resolveNames(a,o,_,rt=>(this.provider==null&&logger.throwError("cannot resolve ENS names without a provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:rt}),this.provider.resolveName(rt)));return joinSignature(this._signingKey().signDigest(TypedDataEncoder.hash(et.domain,o,et.value)))})}encrypt(a,o,_){if(typeof o=="function"&&!_&&(_=o,o={}),_&&typeof _!="function")throw new Error("invalid callback");return o||(o={}),encrypt(this,a,o,_)}static createRandom(a){let o=randomBytes(16);a||(a={}),a.extraEntropy&&(o=arrayify(hexDataSlice(keccak256(concat([o,a.extraEntropy])),0,16)));const _=entropyToMnemonic(o,a.locale);return Wallet.fromMnemonic(_,a.path,a.locale)}static fromEncryptedJson(a,o,_){return decryptJsonWallet(a,o,_).then(et=>new Wallet(et))}static fromEncryptedJsonSync(a,o){return new Wallet(decryptJsonWalletSync(a,o))}static fromMnemonic(a,o,_){return o||(o=defaultPath),new Wallet(HDNode.fromMnemonic(a,null,_).derivePath(o))}}var elliptic={};const name="elliptic",version="6.5.4",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny <fedor@indutny.com>",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$c={},bn={exports:{}};bn.exports;(function(i){(function(a,o){function _(Br,Kt){if(!Br)throw new Error(Kt||"Assertion failed")}function et(Br,Kt){Br.super_=Kt;var Ft=function(){};Ft.prototype=Kt.prototype,Br.prototype=new Ft,Br.prototype.constructor=Br}function rt(Br,Kt,Ft){if(rt.isBN(Br))return Br;this.negative=0,this.words=null,this.length=0,this.red=null,Br!==null&&((Kt==="le"||Kt==="be")&&(Ft=Kt,Kt=10),this._init(Br||0,Kt||10,Ft||"be"))}typeof a=="object"?a.exports=rt:o.BN=rt,rt.BN=rt,rt.wordSize=26;var ot;try{typeof window<"u"&&typeof window.Buffer<"u"?ot=window.Buffer:ot=require$$1.Buffer}catch{}rt.isBN=function(Kt){return Kt instanceof rt?!0:Kt!==null&&typeof Kt=="object"&&Kt.constructor.wordSize===rt.wordSize&&Array.isArray(Kt.words)},rt.max=function(Kt,Ft){return Kt.cmp(Ft)>0?Kt:Ft},rt.min=function(Kt,Ft){return Kt.cmp(Ft)<0?Kt:Ft},rt.prototype._init=function(Kt,Ft,bt){if(typeof Kt=="number")return this._initNumber(Kt,Ft,bt);if(typeof Kt=="object")return this._initArray(Kt,Ft,bt);Ft==="hex"&&(Ft=16),_(Ft===(Ft|0)&&Ft>=2&&Ft<=36),Kt=Kt.toString().replace(/\s+/g,"");var St=0;Kt[0]==="-"&&(St++,this.negative=1),St<Kt.length&&(Ft===16?this._parseHex(Kt,St,bt):(this._parseBase(Kt,Ft,St),bt==="le"&&this._initArray(this.toArray(),Ft,bt)))},rt.prototype._initNumber=function(Kt,Ft,bt){Kt<0&&(this.negative=1,Kt=-Kt),Kt<67108864?(this.words=[Kt&67108863],this.length=1):Kt<4503599627370496?(this.words=[Kt&67108863,Kt/67108864&67108863],this.length=2):(_(Kt<9007199254740992),this.words=[Kt&67108863,Kt/67108864&67108863,1],this.length=3),bt==="le"&&this._initArray(this.toArray(),Ft,bt)},rt.prototype._initArray=function(Kt,Ft,bt){if(_(typeof Kt.length=="number"),Kt.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Kt.length/3),this.words=new Array(this.length);for(var St=0;St<this.length;St++)this.words[St]=0;var Jt,er,sr=0;if(bt==="be")for(St=Kt.length-1,Jt=0;St>=0;St-=3)er=Kt[St]|Kt[St-1]<<8|Kt[St-2]<<16,this.words[Jt]|=er<<sr&67108863,this.words[Jt+1]=er>>>26-sr&67108863,sr+=24,sr>=26&&(sr-=26,Jt++);else if(bt==="le")for(St=0,Jt=0;St<Kt.length;St+=3)er=Kt[St]|Kt[St+1]<<8|Kt[St+2]<<16,this.words[Jt]|=er<<sr&67108863,this.words[Jt+1]=er>>>26-sr&67108863,sr+=24,sr>=26&&(sr-=26,Jt++);return this.strip()};function ft(Br,Kt){var Ft=Br.charCodeAt(Kt);return Ft>=65&&Ft<=70?Ft-55:Ft>=97&&Ft<=102?Ft-87:Ft-48&15}function lt(Br,Kt,Ft){var bt=ft(Br,Ft);return Ft-1>=Kt&&(bt|=ft(Br,Ft-1)<<4),bt}rt.prototype._parseHex=function(Kt,Ft,bt){this.length=Math.ceil((Kt.length-Ft)/6),this.words=new Array(this.length);for(var St=0;St<this.length;St++)this.words[St]=0;var Jt=0,er=0,sr;if(bt==="be")for(St=Kt.length-1;St>=Ft;St-=2)sr=lt(Kt,Ft,St)<<Jt,this.words[er]|=sr&67108863,Jt>=18?(Jt-=18,er+=1,this.words[er]|=sr>>>26):Jt+=8;else{var nr=Kt.length-Ft;for(St=nr%2===0?Ft+1:Ft;St<Kt.length;St+=2)sr=lt(Kt,Ft,St)<<Jt,this.words[er]|=sr&67108863,Jt>=18?(Jt-=18,er+=1,this.words[er]|=sr>>>26):Jt+=8}this.strip()};function ht(Br,Kt,Ft,bt){for(var St=0,Jt=Math.min(Br.length,Ft),er=Kt;er<Jt;er++){var sr=Br.charCodeAt(er)-48;St*=bt,sr>=49?St+=sr-49+10:sr>=17?St+=sr-17+10:St+=sr}return St}rt.prototype._parseBase=function(Kt,Ft,bt){this.words=[0],this.length=1;for(var St=0,Jt=1;Jt<=67108863;Jt*=Ft)St++;St--,Jt=Jt/Ft|0;for(var er=Kt.length-bt,sr=er%St,nr=Math.min(er,er-sr)+bt,Dt=0,Tt=bt;Tt<nr;Tt+=St)Dt=ht(Kt,Tt,Tt+St,Ft),this.imuln(Jt),this.words[0]+Dt<67108864?this.words[0]+=Dt:this._iaddn(Dt);if(sr!==0){var Mt=1;for(Dt=ht(Kt,Tt,Kt.length,Ft),Tt=0;Tt<sr;Tt++)Mt*=Ft;this.imuln(Mt),this.words[0]+Dt<67108864?this.words[0]+=Dt:this._iaddn(Dt)}this.strip()},rt.prototype.copy=function(Kt){Kt.words=new Array(this.length);for(var Ft=0;Ft<this.length;Ft++)Kt.words[Ft]=this.words[Ft];Kt.length=this.length,Kt.negative=this.negative,Kt.red=this.red},rt.prototype.clone=function(){var Kt=new rt(null);return this.copy(Kt),Kt},rt.prototype._expand=function(Kt){for(;this.length<Kt;)this.words[this.length++]=0;return this},rt.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},rt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},rt.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var vt=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],It=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Qt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];rt.prototype.toString=function(Kt,Ft){Kt=Kt||10,Ft=Ft|0||1;var bt;if(Kt===16||Kt==="hex"){bt="";for(var St=0,Jt=0,er=0;er<this.length;er++){var sr=this.words[er],nr=((sr<<St|Jt)&16777215).toString(16);Jt=sr>>>24-St&16777215,Jt!==0||er!==this.length-1?bt=vt[6-nr.length]+nr+bt:bt=nr+bt,St+=2,St>=26&&(St-=26,er--)}for(Jt!==0&&(bt=Jt.toString(16)+bt);bt.length%Ft!==0;)bt="0"+bt;return this.negative!==0&&(bt="-"+bt),bt}if(Kt===(Kt|0)&&Kt>=2&&Kt<=36){var Dt=It[Kt],Tt=Qt[Kt];bt="";var Mt=this.clone();for(Mt.negative=0;!Mt.isZero();){var dr=Mt.modn(Tt).toString(Kt);Mt=Mt.idivn(Tt),Mt.isZero()?bt=dr+bt:bt=vt[Dt-dr.length]+dr+bt}for(this.isZero()&&(bt="0"+bt);bt.length%Ft!==0;)bt="0"+bt;return this.negative!==0&&(bt="-"+bt),bt}_(!1,"Base should be between 2 and 36")},rt.prototype.toNumber=function(){var Kt=this.words[0];return this.length===2?Kt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Kt+=4503599627370496+this.words[1]*67108864:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Kt:Kt},rt.prototype.toJSON=function(){return this.toString(16)},rt.prototype.toBuffer=function(Kt,Ft){return _(typeof ot<"u"),this.toArrayLike(ot,Kt,Ft)},rt.prototype.toArray=function(Kt,Ft){return this.toArrayLike(Array,Kt,Ft)},rt.prototype.toArrayLike=function(Kt,Ft,bt){var St=this.byteLength(),Jt=bt||Math.max(1,St);_(St<=Jt,"byte array longer than desired length"),_(Jt>0,"Requested array length <= 0"),this.strip();var er=Ft==="le",sr=new Kt(Jt),nr,Dt,Tt=this.clone();if(er){for(Dt=0;!Tt.isZero();Dt++)nr=Tt.andln(255),Tt.iushrn(8),sr[Dt]=nr;for(;Dt<Jt;Dt++)sr[Dt]=0}else{for(Dt=0;Dt<Jt-St;Dt++)sr[Dt]=0;for(Dt=0;!Tt.isZero();Dt++)nr=Tt.andln(255),Tt.iushrn(8),sr[Jt-Dt-1]=nr}return sr},Math.clz32?rt.prototype._countBits=function(Kt){return 32-Math.clz32(Kt)}:rt.prototype._countBits=function(Kt){var Ft=Kt,bt=0;return Ft>=4096&&(bt+=13,Ft>>>=13),Ft>=64&&(bt+=7,Ft>>>=7),Ft>=8&&(bt+=4,Ft>>>=4),Ft>=2&&(bt+=2,Ft>>>=2),bt+Ft},rt.prototype._zeroBits=function(Kt){if(Kt===0)return 26;var Ft=Kt,bt=0;return Ft&8191||(bt+=13,Ft>>>=13),Ft&127||(bt+=7,Ft>>>=7),Ft&15||(bt+=4,Ft>>>=4),Ft&3||(bt+=2,Ft>>>=2),Ft&1||bt++,bt},rt.prototype.bitLength=function(){var Kt=this.words[this.length-1],Ft=this._countBits(Kt);return(this.length-1)*26+Ft};function mt(Br){for(var Kt=new Array(Br.bitLength()),Ft=0;Ft<Kt.length;Ft++){var bt=Ft/26|0,St=Ft%26;Kt[Ft]=(Br.words[bt]&1<<St)>>>St}return Kt}rt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Kt=0,Ft=0;Ft<this.length;Ft++){var bt=this._zeroBits(this.words[Ft]);if(Kt+=bt,bt!==26)break}return Kt},rt.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},rt.prototype.toTwos=function(Kt){return this.negative!==0?this.abs().inotn(Kt).iaddn(1):this.clone()},rt.prototype.fromTwos=function(Kt){return this.testn(Kt-1)?this.notn(Kt).iaddn(1).ineg():this.clone()},rt.prototype.isNeg=function(){return this.negative!==0},rt.prototype.neg=function(){return this.clone().ineg()},rt.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},rt.prototype.iuor=function(Kt){for(;this.length<Kt.length;)this.words[this.length++]=0;for(var Ft=0;Ft<Kt.length;Ft++)this.words[Ft]=this.words[Ft]|Kt.words[Ft];return this.strip()},rt.prototype.ior=function(Kt){return _((this.negative|Kt.negative)===0),this.iuor(Kt)},rt.prototype.or=function(Kt){return this.length>Kt.length?this.clone().ior(Kt):Kt.clone().ior(this)},rt.prototype.uor=function(Kt){return this.length>Kt.length?this.clone().iuor(Kt):Kt.clone().iuor(this)},rt.prototype.iuand=function(Kt){var Ft;this.length>Kt.length?Ft=Kt:Ft=this;for(var bt=0;bt<Ft.length;bt++)this.words[bt]=this.words[bt]&Kt.words[bt];return this.length=Ft.length,this.strip()},rt.prototype.iand=function(Kt){return _((this.negative|Kt.negative)===0),this.iuand(Kt)},rt.prototype.and=function(Kt){return this.length>Kt.length?this.clone().iand(Kt):Kt.clone().iand(this)},rt.prototype.uand=function(Kt){return this.length>Kt.length?this.clone().iuand(Kt):Kt.clone().iuand(this)},rt.prototype.iuxor=function(Kt){var Ft,bt;this.length>Kt.length?(Ft=this,bt=Kt):(Ft=Kt,bt=this);for(var St=0;St<bt.length;St++)this.words[St]=Ft.words[St]^bt.words[St];if(this!==Ft)for(;St<Ft.length;St++)this.words[St]=Ft.words[St];return this.length=Ft.length,this.strip()},rt.prototype.ixor=function(Kt){return _((this.negative|Kt.negative)===0),this.iuxor(Kt)},rt.prototype.xor=function(Kt){return this.length>Kt.length?this.clone().ixor(Kt):Kt.clone().ixor(this)},rt.prototype.uxor=function(Kt){return this.length>Kt.length?this.clone().iuxor(Kt):Kt.clone().iuxor(this)},rt.prototype.inotn=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Math.ceil(Kt/26)|0,bt=Kt%26;this._expand(Ft),bt>0&&Ft--;for(var St=0;St<Ft;St++)this.words[St]=~this.words[St]&67108863;return bt>0&&(this.words[St]=~this.words[St]&67108863>>26-bt),this.strip()},rt.prototype.notn=function(Kt){return this.clone().inotn(Kt)},rt.prototype.setn=function(Kt,Ft){_(typeof Kt=="number"&&Kt>=0);var bt=Kt/26|0,St=Kt%26;return this._expand(bt+1),Ft?this.words[bt]=this.words[bt]|1<<St:this.words[bt]=this.words[bt]&~(1<<St),this.strip()},rt.prototype.iadd=function(Kt){var Ft;if(this.negative!==0&&Kt.negative===0)return this.negative=0,Ft=this.isub(Kt),this.negative^=1,this._normSign();if(this.negative===0&&Kt.negative!==0)return Kt.negative=0,Ft=this.isub(Kt),Kt.negative=1,Ft._normSign();var bt,St;this.length>Kt.length?(bt=this,St=Kt):(bt=Kt,St=this);for(var Jt=0,er=0;er<St.length;er++)Ft=(bt.words[er]|0)+(St.words[er]|0)+Jt,this.words[er]=Ft&67108863,Jt=Ft>>>26;for(;Jt!==0&&er<bt.length;er++)Ft=(bt.words[er]|0)+Jt,this.words[er]=Ft&67108863,Jt=Ft>>>26;if(this.length=bt.length,Jt!==0)this.words[this.length]=Jt,this.length++;else if(bt!==this)for(;er<bt.length;er++)this.words[er]=bt.words[er];return this},rt.prototype.add=function(Kt){var Ft;return Kt.negative!==0&&this.negative===0?(Kt.negative=0,Ft=this.sub(Kt),Kt.negative^=1,Ft):Kt.negative===0&&this.negative!==0?(this.negative=0,Ft=Kt.sub(this),this.negative=1,Ft):this.length>Kt.length?this.clone().iadd(Kt):Kt.clone().iadd(this)},rt.prototype.isub=function(Kt){if(Kt.negative!==0){Kt.negative=0;var Ft=this.iadd(Kt);return Kt.negative=1,Ft._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Kt),this.negative=1,this._normSign();var bt=this.cmp(Kt);if(bt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Jt;bt>0?(St=this,Jt=Kt):(St=Kt,Jt=this);for(var er=0,sr=0;sr<Jt.length;sr++)Ft=(St.words[sr]|0)-(Jt.words[sr]|0)+er,er=Ft>>26,this.words[sr]=Ft&67108863;for(;er!==0&&sr<St.length;sr++)Ft=(St.words[sr]|0)+er,er=Ft>>26,this.words[sr]=Ft&67108863;if(er===0&&sr<St.length&&St!==this)for(;sr<St.length;sr++)this.words[sr]=St.words[sr];return this.length=Math.max(this.length,sr),St!==this&&(this.negative=1),this.strip()},rt.prototype.sub=function(Kt){return this.clone().isub(Kt)};function Yt(Br,Kt,Ft){Ft.negative=Kt.negative^Br.negative;var bt=Br.length+Kt.length|0;Ft.length=bt,bt=bt-1|0;var St=Br.words[0]|0,Jt=Kt.words[0]|0,er=St*Jt,sr=er&67108863,nr=er/67108864|0;Ft.words[0]=sr;for(var Dt=1;Dt<bt;Dt++){for(var Tt=nr>>>26,Mt=nr&67108863,dr=Math.min(Dt,Kt.length-1),Nr=Math.max(0,Dt-Br.length+1);Nr<=dr;Nr++){var qt=Dt-Nr|0;St=Br.words[qt]|0,Jt=Kt.words[Nr]|0,er=St*Jt+Mt,Tt+=er/67108864|0,Mt=er&67108863}Ft.words[Dt]=Mt|0,nr=Tt|0}return nr!==0?Ft.words[Dt]=nr|0:Ft.length--,Ft.strip()}var Rt=function(Kt,Ft,bt){var St=Kt.words,Jt=Ft.words,er=bt.words,sr=0,nr,Dt,Tt,Mt=St[0]|0,dr=Mt&8191,Nr=Mt>>>13,qt=St[1]|0,Fr=qt&8191,jr=qt>>>13,Wr=St[2]|0,Zr=Wr&8191,b0=Wr>>>13,E0=St[3]|0,m0=E0&8191,vn=E0>>>13,N0=St[4]|0,L0=N0&8191,_i=N0>>>13,na=St[5]|0,Z0=na&8191,Rn=na>>>13,ga=St[6]|0,ln=ga&8191,e0=ga>>>13,v0=St[7]|0,y0=v0&8191,Q0=v0>>>13,R0=St[8]|0,Ot=R0&8191,J0=R0>>>13,sn=St[9]|0,M0=sn&8191,pn=sn>>>13,In=Jt[0]|0,nn=In&8191,Gn=In>>>13,Mn=Jt[1]|0,an=Mn&8191,Pn=Mn>>>13,Bn=Jt[2]|0,cn=Bn&8191,Ln=Bn>>>13,On=Jt[3]|0,en=On&8191,Yn=On>>>13,zn=Jt[4]|0,fn=zn&8191,jn=zn>>>13,Vn=Jt[5]|0,An=Vn&8191,qn=Vn>>>13,Kn=Jt[6]|0,hn=Kn&8191,Wn=Kn>>>13,Xn=Jt[7]|0,X0=Xn&8191,$n=Xn>>>13,wn=Jt[8]|0,G0=wn&8191,Jn=wn>>>13,Nn=Jt[9]|0,un=Nn&8191,Zn=Nn>>>13;bt.negative=Kt.negative^Ft.negative,bt.length=19,nr=Math.imul(dr,nn),Dt=Math.imul(dr,Gn),Dt=Dt+Math.imul(Nr,nn)|0,Tt=Math.imul(Nr,Gn);var Un=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(Un>>>26)|0,Un&=67108863,nr=Math.imul(Fr,nn),Dt=Math.imul(Fr,Gn),Dt=Dt+Math.imul(jr,nn)|0,Tt=Math.imul(jr,Gn),nr=nr+Math.imul(dr,an)|0,Dt=Dt+Math.imul(dr,Pn)|0,Dt=Dt+Math.imul(Nr,an)|0,Tt=Tt+Math.imul(Nr,Pn)|0;var Fn=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,nr=Math.imul(Zr,nn),Dt=Math.imul(Zr,Gn),Dt=Dt+Math.imul(b0,nn)|0,Tt=Math.imul(b0,Gn),nr=nr+Math.imul(Fr,an)|0,Dt=Dt+Math.imul(Fr,Pn)|0,Dt=Dt+Math.imul(jr,an)|0,Tt=Tt+Math.imul(jr,Pn)|0,nr=nr+Math.imul(dr,cn)|0,Dt=Dt+Math.imul(dr,Ln)|0,Dt=Dt+Math.imul(Nr,cn)|0,Tt=Tt+Math.imul(Nr,Ln)|0;var oo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(oo>>>26)|0,oo&=67108863,nr=Math.imul(m0,nn),Dt=Math.imul(m0,Gn),Dt=Dt+Math.imul(vn,nn)|0,Tt=Math.imul(vn,Gn),nr=nr+Math.imul(Zr,an)|0,Dt=Dt+Math.imul(Zr,Pn)|0,Dt=Dt+Math.imul(b0,an)|0,Tt=Tt+Math.imul(b0,Pn)|0,nr=nr+Math.imul(Fr,cn)|0,Dt=Dt+Math.imul(Fr,Ln)|0,Dt=Dt+Math.imul(jr,cn)|0,Tt=Tt+Math.imul(jr,Ln)|0,nr=nr+Math.imul(dr,en)|0,Dt=Dt+Math.imul(dr,Yn)|0,Dt=Dt+Math.imul(Nr,en)|0,Tt=Tt+Math.imul(Nr,Yn)|0;var Ao=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(Ao>>>26)|0,Ao&=67108863,nr=Math.imul(L0,nn),Dt=Math.imul(L0,Gn),Dt=Dt+Math.imul(_i,nn)|0,Tt=Math.imul(_i,Gn),nr=nr+Math.imul(m0,an)|0,Dt=Dt+Math.imul(m0,Pn)|0,Dt=Dt+Math.imul(vn,an)|0,Tt=Tt+Math.imul(vn,Pn)|0,nr=nr+Math.imul(Zr,cn)|0,Dt=Dt+Math.imul(Zr,Ln)|0,Dt=Dt+Math.imul(b0,cn)|0,Tt=Tt+Math.imul(b0,Ln)|0,nr=nr+Math.imul(Fr,en)|0,Dt=Dt+Math.imul(Fr,Yn)|0,Dt=Dt+Math.imul(jr,en)|0,Tt=Tt+Math.imul(jr,Yn)|0,nr=nr+Math.imul(dr,fn)|0,Dt=Dt+Math.imul(dr,jn)|0,Dt=Dt+Math.imul(Nr,fn)|0,Tt=Tt+Math.imul(Nr,jn)|0;var eo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(eo>>>26)|0,eo&=67108863,nr=Math.imul(Z0,nn),Dt=Math.imul(Z0,Gn),Dt=Dt+Math.imul(Rn,nn)|0,Tt=Math.imul(Rn,Gn),nr=nr+Math.imul(L0,an)|0,Dt=Dt+Math.imul(L0,Pn)|0,Dt=Dt+Math.imul(_i,an)|0,Tt=Tt+Math.imul(_i,Pn)|0,nr=nr+Math.imul(m0,cn)|0,Dt=Dt+Math.imul(m0,Ln)|0,Dt=Dt+Math.imul(vn,cn)|0,Tt=Tt+Math.imul(vn,Ln)|0,nr=nr+Math.imul(Zr,en)|0,Dt=Dt+Math.imul(Zr,Yn)|0,Dt=Dt+Math.imul(b0,en)|0,Tt=Tt+Math.imul(b0,Yn)|0,nr=nr+Math.imul(Fr,fn)|0,Dt=Dt+Math.imul(Fr,jn)|0,Dt=Dt+Math.imul(jr,fn)|0,Tt=Tt+Math.imul(jr,jn)|0,nr=nr+Math.imul(dr,An)|0,Dt=Dt+Math.imul(dr,qn)|0,Dt=Dt+Math.imul(Nr,An)|0,Tt=Tt+Math.imul(Nr,qn)|0;var to=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(to>>>26)|0,to&=67108863,nr=Math.imul(ln,nn),Dt=Math.imul(ln,Gn),Dt=Dt+Math.imul(e0,nn)|0,Tt=Math.imul(e0,Gn),nr=nr+Math.imul(Z0,an)|0,Dt=Dt+Math.imul(Z0,Pn)|0,Dt=Dt+Math.imul(Rn,an)|0,Tt=Tt+Math.imul(Rn,Pn)|0,nr=nr+Math.imul(L0,cn)|0,Dt=Dt+Math.imul(L0,Ln)|0,Dt=Dt+Math.imul(_i,cn)|0,Tt=Tt+Math.imul(_i,Ln)|0,nr=nr+Math.imul(m0,en)|0,Dt=Dt+Math.imul(m0,Yn)|0,Dt=Dt+Math.imul(vn,en)|0,Tt=Tt+Math.imul(vn,Yn)|0,nr=nr+Math.imul(Zr,fn)|0,Dt=Dt+Math.imul(Zr,jn)|0,Dt=Dt+Math.imul(b0,fn)|0,Tt=Tt+Math.imul(b0,jn)|0,nr=nr+Math.imul(Fr,An)|0,Dt=Dt+Math.imul(Fr,qn)|0,Dt=Dt+Math.imul(jr,An)|0,Tt=Tt+Math.imul(jr,qn)|0,nr=nr+Math.imul(dr,hn)|0,Dt=Dt+Math.imul(dr,Wn)|0,Dt=Dt+Math.imul(Nr,hn)|0,Tt=Tt+Math.imul(Nr,Wn)|0;var co=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(co>>>26)|0,co&=67108863,nr=Math.imul(y0,nn),Dt=Math.imul(y0,Gn),Dt=Dt+Math.imul(Q0,nn)|0,Tt=Math.imul(Q0,Gn),nr=nr+Math.imul(ln,an)|0,Dt=Dt+Math.imul(ln,Pn)|0,Dt=Dt+Math.imul(e0,an)|0,Tt=Tt+Math.imul(e0,Pn)|0,nr=nr+Math.imul(Z0,cn)|0,Dt=Dt+Math.imul(Z0,Ln)|0,Dt=Dt+Math.imul(Rn,cn)|0,Tt=Tt+Math.imul(Rn,Ln)|0,nr=nr+Math.imul(L0,en)|0,Dt=Dt+Math.imul(L0,Yn)|0,Dt=Dt+Math.imul(_i,en)|0,Tt=Tt+Math.imul(_i,Yn)|0,nr=nr+Math.imul(m0,fn)|0,Dt=Dt+Math.imul(m0,jn)|0,Dt=Dt+Math.imul(vn,fn)|0,Tt=Tt+Math.imul(vn,jn)|0,nr=nr+Math.imul(Zr,An)|0,Dt=Dt+Math.imul(Zr,qn)|0,Dt=Dt+Math.imul(b0,An)|0,Tt=Tt+Math.imul(b0,qn)|0,nr=nr+Math.imul(Fr,hn)|0,Dt=Dt+Math.imul(Fr,Wn)|0,Dt=Dt+Math.imul(jr,hn)|0,Tt=Tt+Math.imul(jr,Wn)|0,nr=nr+Math.imul(dr,X0)|0,Dt=Dt+Math.imul(dr,$n)|0,Dt=Dt+Math.imul(Nr,X0)|0,Tt=Tt+Math.imul(Nr,$n)|0;var xo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(xo>>>26)|0,xo&=67108863,nr=Math.imul(Ot,nn),Dt=Math.imul(Ot,Gn),Dt=Dt+Math.imul(J0,nn)|0,Tt=Math.imul(J0,Gn),nr=nr+Math.imul(y0,an)|0,Dt=Dt+Math.imul(y0,Pn)|0,Dt=Dt+Math.imul(Q0,an)|0,Tt=Tt+Math.imul(Q0,Pn)|0,nr=nr+Math.imul(ln,cn)|0,Dt=Dt+Math.imul(ln,Ln)|0,Dt=Dt+Math.imul(e0,cn)|0,Tt=Tt+Math.imul(e0,Ln)|0,nr=nr+Math.imul(Z0,en)|0,Dt=Dt+Math.imul(Z0,Yn)|0,Dt=Dt+Math.imul(Rn,en)|0,Tt=Tt+Math.imul(Rn,Yn)|0,nr=nr+Math.imul(L0,fn)|0,Dt=Dt+Math.imul(L0,jn)|0,Dt=Dt+Math.imul(_i,fn)|0,Tt=Tt+Math.imul(_i,jn)|0,nr=nr+Math.imul(m0,An)|0,Dt=Dt+Math.imul(m0,qn)|0,Dt=Dt+Math.imul(vn,An)|0,Tt=Tt+Math.imul(vn,qn)|0,nr=nr+Math.imul(Zr,hn)|0,Dt=Dt+Math.imul(Zr,Wn)|0,Dt=Dt+Math.imul(b0,hn)|0,Tt=Tt+Math.imul(b0,Wn)|0,nr=nr+Math.imul(Fr,X0)|0,Dt=Dt+Math.imul(Fr,$n)|0,Dt=Dt+Math.imul(jr,X0)|0,Tt=Tt+Math.imul(jr,$n)|0,nr=nr+Math.imul(dr,G0)|0,Dt=Dt+Math.imul(dr,Jn)|0,Dt=Dt+Math.imul(Nr,G0)|0,Tt=Tt+Math.imul(Nr,Jn)|0;var uo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(uo>>>26)|0,uo&=67108863,nr=Math.imul(M0,nn),Dt=Math.imul(M0,Gn),Dt=Dt+Math.imul(pn,nn)|0,Tt=Math.imul(pn,Gn),nr=nr+Math.imul(Ot,an)|0,Dt=Dt+Math.imul(Ot,Pn)|0,Dt=Dt+Math.imul(J0,an)|0,Tt=Tt+Math.imul(J0,Pn)|0,nr=nr+Math.imul(y0,cn)|0,Dt=Dt+Math.imul(y0,Ln)|0,Dt=Dt+Math.imul(Q0,cn)|0,Tt=Tt+Math.imul(Q0,Ln)|0,nr=nr+Math.imul(ln,en)|0,Dt=Dt+Math.imul(ln,Yn)|0,Dt=Dt+Math.imul(e0,en)|0,Tt=Tt+Math.imul(e0,Yn)|0,nr=nr+Math.imul(Z0,fn)|0,Dt=Dt+Math.imul(Z0,jn)|0,Dt=Dt+Math.imul(Rn,fn)|0,Tt=Tt+Math.imul(Rn,jn)|0,nr=nr+Math.imul(L0,An)|0,Dt=Dt+Math.imul(L0,qn)|0,Dt=Dt+Math.imul(_i,An)|0,Tt=Tt+Math.imul(_i,qn)|0,nr=nr+Math.imul(m0,hn)|0,Dt=Dt+Math.imul(m0,Wn)|0,Dt=Dt+Math.imul(vn,hn)|0,Tt=Tt+Math.imul(vn,Wn)|0,nr=nr+Math.imul(Zr,X0)|0,Dt=Dt+Math.imul(Zr,$n)|0,Dt=Dt+Math.imul(b0,X0)|0,Tt=Tt+Math.imul(b0,$n)|0,nr=nr+Math.imul(Fr,G0)|0,Dt=Dt+Math.imul(Fr,Jn)|0,Dt=Dt+Math.imul(jr,G0)|0,Tt=Tt+Math.imul(jr,Jn)|0,nr=nr+Math.imul(dr,un)|0,Dt=Dt+Math.imul(dr,Zn)|0,Dt=Dt+Math.imul(Nr,un)|0,Tt=Tt+Math.imul(Nr,Zn)|0;var po=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(po>>>26)|0,po&=67108863,nr=Math.imul(M0,an),Dt=Math.imul(M0,Pn),Dt=Dt+Math.imul(pn,an)|0,Tt=Math.imul(pn,Pn),nr=nr+Math.imul(Ot,cn)|0,Dt=Dt+Math.imul(Ot,Ln)|0,Dt=Dt+Math.imul(J0,cn)|0,Tt=Tt+Math.imul(J0,Ln)|0,nr=nr+Math.imul(y0,en)|0,Dt=Dt+Math.imul(y0,Yn)|0,Dt=Dt+Math.imul(Q0,en)|0,Tt=Tt+Math.imul(Q0,Yn)|0,nr=nr+Math.imul(ln,fn)|0,Dt=Dt+Math.imul(ln,jn)|0,Dt=Dt+Math.imul(e0,fn)|0,Tt=Tt+Math.imul(e0,jn)|0,nr=nr+Math.imul(Z0,An)|0,Dt=Dt+Math.imul(Z0,qn)|0,Dt=Dt+Math.imul(Rn,An)|0,Tt=Tt+Math.imul(Rn,qn)|0,nr=nr+Math.imul(L0,hn)|0,Dt=Dt+Math.imul(L0,Wn)|0,Dt=Dt+Math.imul(_i,hn)|0,Tt=Tt+Math.imul(_i,Wn)|0,nr=nr+Math.imul(m0,X0)|0,Dt=Dt+Math.imul(m0,$n)|0,Dt=Dt+Math.imul(vn,X0)|0,Tt=Tt+Math.imul(vn,$n)|0,nr=nr+Math.imul(Zr,G0)|0,Dt=Dt+Math.imul(Zr,Jn)|0,Dt=Dt+Math.imul(b0,G0)|0,Tt=Tt+Math.imul(b0,Jn)|0,nr=nr+Math.imul(Fr,un)|0,Dt=Dt+Math.imul(Fr,Zn)|0,Dt=Dt+Math.imul(jr,un)|0,Tt=Tt+Math.imul(jr,Zn)|0;var bo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(bo>>>26)|0,bo&=67108863,nr=Math.imul(M0,cn),Dt=Math.imul(M0,Ln),Dt=Dt+Math.imul(pn,cn)|0,Tt=Math.imul(pn,Ln),nr=nr+Math.imul(Ot,en)|0,Dt=Dt+Math.imul(Ot,Yn)|0,Dt=Dt+Math.imul(J0,en)|0,Tt=Tt+Math.imul(J0,Yn)|0,nr=nr+Math.imul(y0,fn)|0,Dt=Dt+Math.imul(y0,jn)|0,Dt=Dt+Math.imul(Q0,fn)|0,Tt=Tt+Math.imul(Q0,jn)|0,nr=nr+Math.imul(ln,An)|0,Dt=Dt+Math.imul(ln,qn)|0,Dt=Dt+Math.imul(e0,An)|0,Tt=Tt+Math.imul(e0,qn)|0,nr=nr+Math.imul(Z0,hn)|0,Dt=Dt+Math.imul(Z0,Wn)|0,Dt=Dt+Math.imul(Rn,hn)|0,Tt=Tt+Math.imul(Rn,Wn)|0,nr=nr+Math.imul(L0,X0)|0,Dt=Dt+Math.imul(L0,$n)|0,Dt=Dt+Math.imul(_i,X0)|0,Tt=Tt+Math.imul(_i,$n)|0,nr=nr+Math.imul(m0,G0)|0,Dt=Dt+Math.imul(m0,Jn)|0,Dt=Dt+Math.imul(vn,G0)|0,Tt=Tt+Math.imul(vn,Jn)|0,nr=nr+Math.imul(Zr,un)|0,Dt=Dt+Math.imul(Zr,Zn)|0,Dt=Dt+Math.imul(b0,un)|0,Tt=Tt+Math.imul(b0,Zn)|0;var mo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(mo>>>26)|0,mo&=67108863,nr=Math.imul(M0,en),Dt=Math.imul(M0,Yn),Dt=Dt+Math.imul(pn,en)|0,Tt=Math.imul(pn,Yn),nr=nr+Math.imul(Ot,fn)|0,Dt=Dt+Math.imul(Ot,jn)|0,Dt=Dt+Math.imul(J0,fn)|0,Tt=Tt+Math.imul(J0,jn)|0,nr=nr+Math.imul(y0,An)|0,Dt=Dt+Math.imul(y0,qn)|0,Dt=Dt+Math.imul(Q0,An)|0,Tt=Tt+Math.imul(Q0,qn)|0,nr=nr+Math.imul(ln,hn)|0,Dt=Dt+Math.imul(ln,Wn)|0,Dt=Dt+Math.imul(e0,hn)|0,Tt=Tt+Math.imul(e0,Wn)|0,nr=nr+Math.imul(Z0,X0)|0,Dt=Dt+Math.imul(Z0,$n)|0,Dt=Dt+Math.imul(Rn,X0)|0,Tt=Tt+Math.imul(Rn,$n)|0,nr=nr+Math.imul(L0,G0)|0,Dt=Dt+Math.imul(L0,Jn)|0,Dt=Dt+Math.imul(_i,G0)|0,Tt=Tt+Math.imul(_i,Jn)|0,nr=nr+Math.imul(m0,un)|0,Dt=Dt+Math.imul(m0,Zn)|0,Dt=Dt+Math.imul(vn,un)|0,Tt=Tt+Math.imul(vn,Zn)|0;var f0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(f0>>>26)|0,f0&=67108863,nr=Math.imul(M0,fn),Dt=Math.imul(M0,jn),Dt=Dt+Math.imul(pn,fn)|0,Tt=Math.imul(pn,jn),nr=nr+Math.imul(Ot,An)|0,Dt=Dt+Math.imul(Ot,qn)|0,Dt=Dt+Math.imul(J0,An)|0,Tt=Tt+Math.imul(J0,qn)|0,nr=nr+Math.imul(y0,hn)|0,Dt=Dt+Math.imul(y0,Wn)|0,Dt=Dt+Math.imul(Q0,hn)|0,Tt=Tt+Math.imul(Q0,Wn)|0,nr=nr+Math.imul(ln,X0)|0,Dt=Dt+Math.imul(ln,$n)|0,Dt=Dt+Math.imul(e0,X0)|0,Tt=Tt+Math.imul(e0,$n)|0,nr=nr+Math.imul(Z0,G0)|0,Dt=Dt+Math.imul(Z0,Jn)|0,Dt=Dt+Math.imul(Rn,G0)|0,Tt=Tt+Math.imul(Rn,Jn)|0,nr=nr+Math.imul(L0,un)|0,Dt=Dt+Math.imul(L0,Zn)|0,Dt=Dt+Math.imul(_i,un)|0,Tt=Tt+Math.imul(_i,Zn)|0;var k0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(k0>>>26)|0,k0&=67108863,nr=Math.imul(M0,An),Dt=Math.imul(M0,qn),Dt=Dt+Math.imul(pn,An)|0,Tt=Math.imul(pn,qn),nr=nr+Math.imul(Ot,hn)|0,Dt=Dt+Math.imul(Ot,Wn)|0,Dt=Dt+Math.imul(J0,hn)|0,Tt=Tt+Math.imul(J0,Wn)|0,nr=nr+Math.imul(y0,X0)|0,Dt=Dt+Math.imul(y0,$n)|0,Dt=Dt+Math.imul(Q0,X0)|0,Tt=Tt+Math.imul(Q0,$n)|0,nr=nr+Math.imul(ln,G0)|0,Dt=Dt+Math.imul(ln,Jn)|0,Dt=Dt+Math.imul(e0,G0)|0,Tt=Tt+Math.imul(e0,Jn)|0,nr=nr+Math.imul(Z0,un)|0,Dt=Dt+Math.imul(Z0,Zn)|0,Dt=Dt+Math.imul(Rn,un)|0,Tt=Tt+Math.imul(Rn,Zn)|0;var H0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(H0>>>26)|0,H0&=67108863,nr=Math.imul(M0,hn),Dt=Math.imul(M0,Wn),Dt=Dt+Math.imul(pn,hn)|0,Tt=Math.imul(pn,Wn),nr=nr+Math.imul(Ot,X0)|0,Dt=Dt+Math.imul(Ot,$n)|0,Dt=Dt+Math.imul(J0,X0)|0,Tt=Tt+Math.imul(J0,$n)|0,nr=nr+Math.imul(y0,G0)|0,Dt=Dt+Math.imul(y0,Jn)|0,Dt=Dt+Math.imul(Q0,G0)|0,Tt=Tt+Math.imul(Q0,Jn)|0,nr=nr+Math.imul(ln,un)|0,Dt=Dt+Math.imul(ln,Zn)|0,Dt=Dt+Math.imul(e0,un)|0,Tt=Tt+Math.imul(e0,Zn)|0;var T0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(T0>>>26)|0,T0&=67108863,nr=Math.imul(M0,X0),Dt=Math.imul(M0,$n),Dt=Dt+Math.imul(pn,X0)|0,Tt=Math.imul(pn,$n),nr=nr+Math.imul(Ot,G0)|0,Dt=Dt+Math.imul(Ot,Jn)|0,Dt=Dt+Math.imul(J0,G0)|0,Tt=Tt+Math.imul(J0,Jn)|0,nr=nr+Math.imul(y0,un)|0,Dt=Dt+Math.imul(y0,Zn)|0,Dt=Dt+Math.imul(Q0,un)|0,Tt=Tt+Math.imul(Q0,Zn)|0;var tn=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(tn>>>26)|0,tn&=67108863,nr=Math.imul(M0,G0),Dt=Math.imul(M0,Jn),Dt=Dt+Math.imul(pn,G0)|0,Tt=Math.imul(pn,Jn),nr=nr+Math.imul(Ot,un)|0,Dt=Dt+Math.imul(Ot,Zn)|0,Dt=Dt+Math.imul(J0,un)|0,Tt=Tt+Math.imul(J0,Zn)|0;var V0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(V0>>>26)|0,V0&=67108863,nr=Math.imul(M0,un),Dt=Math.imul(M0,Zn),Dt=Dt+Math.imul(pn,un)|0,Tt=Math.imul(pn,Zn);var dn=(sr+nr|0)+((Dt&8191)<<13)|0;return sr=(Tt+(Dt>>>13)|0)+(dn>>>26)|0,dn&=67108863,er[0]=Un,er[1]=Fn,er[2]=oo,er[3]=Ao,er[4]=eo,er[5]=to,er[6]=co,er[7]=xo,er[8]=uo,er[9]=po,er[10]=bo,er[11]=mo,er[12]=f0,er[13]=k0,er[14]=H0,er[15]=T0,er[16]=tn,er[17]=V0,er[18]=dn,sr!==0&&(er[19]=sr,bt.length++),bt};Math.imul||(Rt=Yt);function cr(Br,Kt,Ft){Ft.negative=Kt.negative^Br.negative,Ft.length=Br.length+Kt.length;for(var bt=0,St=0,Jt=0;Jt<Ft.length-1;Jt++){var er=St;St=0;for(var sr=bt&67108863,nr=Math.min(Jt,Kt.length-1),Dt=Math.max(0,Jt-Br.length+1);Dt<=nr;Dt++){var Tt=Jt-Dt,Mt=Br.words[Tt]|0,dr=Kt.words[Dt]|0,Nr=Mt*dr,qt=Nr&67108863;er=er+(Nr/67108864|0)|0,qt=qt+sr|0,sr=qt&67108863,er=er+(qt>>>26)|0,St+=er>>>26,er&=67108863}Ft.words[Jt]=sr,bt=er,er=St}return bt!==0?Ft.words[Jt]=bt:Ft.length--,Ft.strip()}function Ut(Br,Kt,Ft){var bt=new zt;return bt.mulp(Br,Kt,Ft)}rt.prototype.mulTo=function(Kt,Ft){var bt,St=this.length+Kt.length;return this.length===10&&Kt.length===10?bt=Rt(this,Kt,Ft):St<63?bt=Yt(this,Kt,Ft):St<1024?bt=cr(this,Kt,Ft):bt=Ut(this,Kt,Ft),bt};function zt(Br,Kt){this.x=Br,this.y=Kt}zt.prototype.makeRBT=function(Kt){for(var Ft=new Array(Kt),bt=rt.prototype._countBits(Kt)-1,St=0;St<Kt;St++)Ft[St]=this.revBin(St,bt,Kt);return Ft},zt.prototype.revBin=function(Kt,Ft,bt){if(Kt===0||Kt===bt-1)return Kt;for(var St=0,Jt=0;Jt<Ft;Jt++)St|=(Kt&1)<<Ft-Jt-1,Kt>>=1;return St},zt.prototype.permute=function(Kt,Ft,bt,St,Jt,er){for(var sr=0;sr<er;sr++)St[sr]=Ft[Kt[sr]],Jt[sr]=bt[Kt[sr]]},zt.prototype.transform=function(Kt,Ft,bt,St,Jt,er){this.permute(er,Kt,Ft,bt,St,Jt);for(var sr=1;sr<Jt;sr<<=1)for(var nr=sr<<1,Dt=Math.cos(2*Math.PI/nr),Tt=Math.sin(2*Math.PI/nr),Mt=0;Mt<Jt;Mt+=nr)for(var dr=Dt,Nr=Tt,qt=0;qt<sr;qt++){var Fr=bt[Mt+qt],jr=St[Mt+qt],Wr=bt[Mt+qt+sr],Zr=St[Mt+qt+sr],b0=dr*Wr-Nr*Zr;Zr=dr*Zr+Nr*Wr,Wr=b0,bt[Mt+qt]=Fr+Wr,St[Mt+qt]=jr+Zr,bt[Mt+qt+sr]=Fr-Wr,St[Mt+qt+sr]=jr-Zr,qt!==nr&&(b0=Dt*dr-Tt*Nr,Nr=Dt*Nr+Tt*dr,dr=b0)}},zt.prototype.guessLen13b=function(Kt,Ft){var bt=Math.max(Ft,Kt)|1,St=bt&1,Jt=0;for(bt=bt/2|0;bt;bt=bt>>>1)Jt++;return 1<<Jt+1+St},zt.prototype.conjugate=function(Kt,Ft,bt){if(!(bt<=1))for(var St=0;St<bt/2;St++){var Jt=Kt[St];Kt[St]=Kt[bt-St-1],Kt[bt-St-1]=Jt,Jt=Ft[St],Ft[St]=-Ft[bt-St-1],Ft[bt-St-1]=-Jt}},zt.prototype.normalize13b=function(Kt,Ft){for(var bt=0,St=0;St<Ft/2;St++){var Jt=Math.round(Kt[2*St+1]/Ft)*8192+Math.round(Kt[2*St]/Ft)+bt;Kt[St]=Jt&67108863,Jt<67108864?bt=0:bt=Jt/67108864|0}return Kt},zt.prototype.convert13b=function(Kt,Ft,bt,St){for(var Jt=0,er=0;er<Ft;er++)Jt=Jt+(Kt[er]|0),bt[2*er]=Jt&8191,Jt=Jt>>>13,bt[2*er+1]=Jt&8191,Jt=Jt>>>13;for(er=2*Ft;er<St;++er)bt[er]=0;_(Jt===0),_((Jt&-8192)===0)},zt.prototype.stub=function(Kt){for(var Ft=new Array(Kt),bt=0;bt<Kt;bt++)Ft[bt]=0;return Ft},zt.prototype.mulp=function(Kt,Ft,bt){var St=2*this.guessLen13b(Kt.length,Ft.length),Jt=this.makeRBT(St),er=this.stub(St),sr=new Array(St),nr=new Array(St),Dt=new Array(St),Tt=new Array(St),Mt=new Array(St),dr=new Array(St),Nr=bt.words;Nr.length=St,this.convert13b(Kt.words,Kt.length,sr,St),this.convert13b(Ft.words,Ft.length,Tt,St),this.transform(sr,er,nr,Dt,St,Jt),this.transform(Tt,er,Mt,dr,St,Jt);for(var qt=0;qt<St;qt++){var Fr=nr[qt]*Mt[qt]-Dt[qt]*dr[qt];Dt[qt]=nr[qt]*dr[qt]+Dt[qt]*Mt[qt],nr[qt]=Fr}return this.conjugate(nr,Dt,St),this.transform(nr,Dt,Nr,er,St,Jt),this.conjugate(Nr,er,St),this.normalize13b(Nr,St),bt.negative=Kt.negative^Ft.negative,bt.length=Kt.length+Ft.length,bt.strip()},rt.prototype.mul=function(Kt){var Ft=new rt(null);return Ft.words=new Array(this.length+Kt.length),this.mulTo(Kt,Ft)},rt.prototype.mulf=function(Kt){var Ft=new rt(null);return Ft.words=new Array(this.length+Kt.length),Ut(this,Kt,Ft)},rt.prototype.imul=function(Kt){return this.clone().mulTo(Kt,this)},rt.prototype.imuln=function(Kt){_(typeof Kt=="number"),_(Kt<67108864);for(var Ft=0,bt=0;bt<this.length;bt++){var St=(this.words[bt]|0)*Kt,Jt=(St&67108863)+(Ft&67108863);Ft>>=26,Ft+=St/67108864|0,Ft+=Jt>>>26,this.words[bt]=Jt&67108863}return Ft!==0&&(this.words[bt]=Ft,this.length++),this},rt.prototype.muln=function(Kt){return this.clone().imuln(Kt)},rt.prototype.sqr=function(){return this.mul(this)},rt.prototype.isqr=function(){return this.imul(this.clone())},rt.prototype.pow=function(Kt){var Ft=mt(Kt);if(Ft.length===0)return new rt(1);for(var bt=this,St=0;St<Ft.length&&Ft[St]===0;St++,bt=bt.sqr());if(++St<Ft.length)for(var Jt=bt.sqr();St<Ft.length;St++,Jt=Jt.sqr())Ft[St]!==0&&(bt=bt.mul(Jt));return bt},rt.prototype.iushln=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Kt%26,bt=(Kt-Ft)/26,St=67108863>>>26-Ft<<26-Ft,Jt;if(Ft!==0){var er=0;for(Jt=0;Jt<this.length;Jt++){var sr=this.words[Jt]&St,nr=(this.words[Jt]|0)-sr<<Ft;this.words[Jt]=nr|er,er=sr>>>26-Ft}er&&(this.words[Jt]=er,this.length++)}if(bt!==0){for(Jt=this.length-1;Jt>=0;Jt--)this.words[Jt+bt]=this.words[Jt];for(Jt=0;Jt<bt;Jt++)this.words[Jt]=0;this.length+=bt}return this.strip()},rt.prototype.ishln=function(Kt){return _(this.negative===0),this.iushln(Kt)},rt.prototype.iushrn=function(Kt,Ft,bt){_(typeof Kt=="number"&&Kt>=0);var St;Ft?St=(Ft-Ft%26)/26:St=0;var Jt=Kt%26,er=Math.min((Kt-Jt)/26,this.length),sr=67108863^67108863>>>Jt<<Jt,nr=bt;if(St-=er,St=Math.max(0,St),nr){for(var Dt=0;Dt<er;Dt++)nr.words[Dt]=this.words[Dt];nr.length=er}if(er!==0)if(this.length>er)for(this.length-=er,Dt=0;Dt<this.length;Dt++)this.words[Dt]=this.words[Dt+er];else this.words[0]=0,this.length=1;var Tt=0;for(Dt=this.length-1;Dt>=0&&(Tt!==0||Dt>=St);Dt--){var Mt=this.words[Dt]|0;this.words[Dt]=Tt<<26-Jt|Mt>>>Jt,Tt=Mt&sr}return nr&&Tt!==0&&(nr.words[nr.length++]=Tt),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},rt.prototype.ishrn=function(Kt,Ft,bt){return _(this.negative===0),this.iushrn(Kt,Ft,bt)},rt.prototype.shln=function(Kt){return this.clone().ishln(Kt)},rt.prototype.ushln=function(Kt){return this.clone().iushln(Kt)},rt.prototype.shrn=function(Kt){return this.clone().ishrn(Kt)},rt.prototype.ushrn=function(Kt){return this.clone().iushrn(Kt)},rt.prototype.testn=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Kt%26,bt=(Kt-Ft)/26,St=1<<Ft;if(this.length<=bt)return!1;var Jt=this.words[bt];return!!(Jt&St)},rt.prototype.imaskn=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Kt%26,bt=(Kt-Ft)/26;if(_(this.negative===0,"imaskn works only with positive numbers"),this.length<=bt)return this;if(Ft!==0&&bt++,this.length=Math.min(bt,this.length),Ft!==0){var St=67108863^67108863>>>Ft<<Ft;this.words[this.length-1]&=St}return this.strip()},rt.prototype.maskn=function(Kt){return this.clone().imaskn(Kt)},rt.prototype.iaddn=function(Kt){return _(typeof Kt=="number"),_(Kt<67108864),Kt<0?this.isubn(-Kt):this.negative!==0?this.length===1&&(this.words[0]|0)<Kt?(this.words[0]=Kt-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(Kt),this.negative=1,this):this._iaddn(Kt)},rt.prototype._iaddn=function(Kt){this.words[0]+=Kt;for(var Ft=0;Ft<this.length&&this.words[Ft]>=67108864;Ft++)this.words[Ft]-=67108864,Ft===this.length-1?this.words[Ft+1]=1:this.words[Ft+1]++;return this.length=Math.max(this.length,Ft+1),this},rt.prototype.isubn=function(Kt){if(_(typeof Kt=="number"),_(Kt<67108864),Kt<0)return this.iaddn(-Kt);if(this.negative!==0)return this.negative=0,this.iaddn(Kt),this.negative=1,this;if(this.words[0]-=Kt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Ft=0;Ft<this.length&&this.words[Ft]<0;Ft++)this.words[Ft]+=67108864,this.words[Ft+1]-=1;return this.strip()},rt.prototype.addn=function(Kt){return this.clone().iaddn(Kt)},rt.prototype.subn=function(Kt){return this.clone().isubn(Kt)},rt.prototype.iabs=function(){return this.negative=0,this},rt.prototype.abs=function(){return this.clone().iabs()},rt.prototype._ishlnsubmul=function(Kt,Ft,bt){var St=Kt.length+bt,Jt;this._expand(St);var er,sr=0;for(Jt=0;Jt<Kt.length;Jt++){er=(this.words[Jt+bt]|0)+sr;var nr=(Kt.words[Jt]|0)*Ft;er-=nr&67108863,sr=(er>>26)-(nr/67108864|0),this.words[Jt+bt]=er&67108863}for(;Jt<this.length-bt;Jt++)er=(this.words[Jt+bt]|0)+sr,sr=er>>26,this.words[Jt+bt]=er&67108863;if(sr===0)return this.strip();for(_(sr===-1),sr=0,Jt=0;Jt<this.length;Jt++)er=-(this.words[Jt]|0)+sr,sr=er>>26,this.words[Jt]=er&67108863;return this.negative=1,this.strip()},rt.prototype._wordDiv=function(Kt,Ft){var bt=this.length-Kt.length,St=this.clone(),Jt=Kt,er=Jt.words[Jt.length-1]|0,sr=this._countBits(er);bt=26-sr,bt!==0&&(Jt=Jt.ushln(bt),St.iushln(bt),er=Jt.words[Jt.length-1]|0);var nr=St.length-Jt.length,Dt;if(Ft!=="mod"){Dt=new rt(null),Dt.length=nr+1,Dt.words=new Array(Dt.length);for(var Tt=0;Tt<Dt.length;Tt++)Dt.words[Tt]=0}var Mt=St.clone()._ishlnsubmul(Jt,1,nr);Mt.negative===0&&(St=Mt,Dt&&(Dt.words[nr]=1));for(var dr=nr-1;dr>=0;dr--){var Nr=(St.words[Jt.length+dr]|0)*67108864+(St.words[Jt.length+dr-1]|0);for(Nr=Math.min(Nr/er|0,67108863),St._ishlnsubmul(Jt,Nr,dr);St.negative!==0;)Nr--,St.negative=0,St._ishlnsubmul(Jt,1,dr),St.isZero()||(St.negative^=1);Dt&&(Dt.words[dr]=Nr)}return Dt&&Dt.strip(),St.strip(),Ft!=="div"&&bt!==0&&St.iushrn(bt),{div:Dt||null,mod:St}},rt.prototype.divmod=function(Kt,Ft,bt){if(_(!Kt.isZero()),this.isZero())return{div:new rt(0),mod:new rt(0)};var St,Jt,er;return this.negative!==0&&Kt.negative===0?(er=this.neg().divmod(Kt,Ft),Ft!=="mod"&&(St=er.div.neg()),Ft!=="div"&&(Jt=er.mod.neg(),bt&&Jt.negative!==0&&Jt.iadd(Kt)),{div:St,mod:Jt}):this.negative===0&&Kt.negative!==0?(er=this.divmod(Kt.neg(),Ft),Ft!=="mod"&&(St=er.div.neg()),{div:St,mod:er.mod}):this.negative&Kt.negative?(er=this.neg().divmod(Kt.neg(),Ft),Ft!=="div"&&(Jt=er.mod.neg(),bt&&Jt.negative!==0&&Jt.isub(Kt)),{div:er.div,mod:Jt}):Kt.length>this.length||this.cmp(Kt)<0?{div:new rt(0),mod:this}:Kt.length===1?Ft==="div"?{div:this.divn(Kt.words[0]),mod:null}:Ft==="mod"?{div:null,mod:new rt(this.modn(Kt.words[0]))}:{div:this.divn(Kt.words[0]),mod:new rt(this.modn(Kt.words[0]))}:this._wordDiv(Kt,Ft)},rt.prototype.div=function(Kt){return this.divmod(Kt,"div",!1).div},rt.prototype.mod=function(Kt){return this.divmod(Kt,"mod",!1).mod},rt.prototype.umod=function(Kt){return this.divmod(Kt,"mod",!0).mod},rt.prototype.divRound=function(Kt){var Ft=this.divmod(Kt);if(Ft.mod.isZero())return Ft.div;var bt=Ft.div.negative!==0?Ft.mod.isub(Kt):Ft.mod,St=Kt.ushrn(1),Jt=Kt.andln(1),er=bt.cmp(St);return er<0||Jt===1&&er===0?Ft.div:Ft.div.negative!==0?Ft.div.isubn(1):Ft.div.iaddn(1)},rt.prototype.modn=function(Kt){_(Kt<=67108863);for(var Ft=(1<<26)%Kt,bt=0,St=this.length-1;St>=0;St--)bt=(Ft*bt+(this.words[St]|0))%Kt;return bt},rt.prototype.idivn=function(Kt){_(Kt<=67108863);for(var Ft=0,bt=this.length-1;bt>=0;bt--){var St=(this.words[bt]|0)+Ft*67108864;this.words[bt]=St/Kt|0,Ft=St%Kt}return this.strip()},rt.prototype.divn=function(Kt){return this.clone().idivn(Kt)},rt.prototype.egcd=function(Kt){_(Kt.negative===0),_(!Kt.isZero());var Ft=this,bt=Kt.clone();Ft.negative!==0?Ft=Ft.umod(Kt):Ft=Ft.clone();for(var St=new rt(1),Jt=new rt(0),er=new rt(0),sr=new rt(1),nr=0;Ft.isEven()&&bt.isEven();)Ft.iushrn(1),bt.iushrn(1),++nr;for(var Dt=bt.clone(),Tt=Ft.clone();!Ft.isZero();){for(var Mt=0,dr=1;!(Ft.words[0]&dr)&&Mt<26;++Mt,dr<<=1);if(Mt>0)for(Ft.iushrn(Mt);Mt-- >0;)(St.isOdd()||Jt.isOdd())&&(St.iadd(Dt),Jt.isub(Tt)),St.iushrn(1),Jt.iushrn(1);for(var Nr=0,qt=1;!(bt.words[0]&qt)&&Nr<26;++Nr,qt<<=1);if(Nr>0)for(bt.iushrn(Nr);Nr-- >0;)(er.isOdd()||sr.isOdd())&&(er.iadd(Dt),sr.isub(Tt)),er.iushrn(1),sr.iushrn(1);Ft.cmp(bt)>=0?(Ft.isub(bt),St.isub(er),Jt.isub(sr)):(bt.isub(Ft),er.isub(St),sr.isub(Jt))}return{a:er,b:sr,gcd:bt.iushln(nr)}},rt.prototype._invmp=function(Kt){_(Kt.negative===0),_(!Kt.isZero());var Ft=this,bt=Kt.clone();Ft.negative!==0?Ft=Ft.umod(Kt):Ft=Ft.clone();for(var St=new rt(1),Jt=new rt(0),er=bt.clone();Ft.cmpn(1)>0&&bt.cmpn(1)>0;){for(var sr=0,nr=1;!(Ft.words[0]&nr)&&sr<26;++sr,nr<<=1);if(sr>0)for(Ft.iushrn(sr);sr-- >0;)St.isOdd()&&St.iadd(er),St.iushrn(1);for(var Dt=0,Tt=1;!(bt.words[0]&Tt)&&Dt<26;++Dt,Tt<<=1);if(Dt>0)for(bt.iushrn(Dt);Dt-- >0;)Jt.isOdd()&&Jt.iadd(er),Jt.iushrn(1);Ft.cmp(bt)>=0?(Ft.isub(bt),St.isub(Jt)):(bt.isub(Ft),Jt.isub(St))}var Mt;return Ft.cmpn(1)===0?Mt=St:Mt=Jt,Mt.cmpn(0)<0&&Mt.iadd(Kt),Mt},rt.prototype.gcd=function(Kt){if(this.isZero())return Kt.abs();if(Kt.isZero())return this.abs();var Ft=this.clone(),bt=Kt.clone();Ft.negative=0,bt.negative=0;for(var St=0;Ft.isEven()&&bt.isEven();St++)Ft.iushrn(1),bt.iushrn(1);do{for(;Ft.isEven();)Ft.iushrn(1);for(;bt.isEven();)bt.iushrn(1);var Jt=Ft.cmp(bt);if(Jt<0){var er=Ft;Ft=bt,bt=er}else if(Jt===0||bt.cmpn(1)===0)break;Ft.isub(bt)}while(!0);return bt.iushln(St)},rt.prototype.invm=function(Kt){return this.egcd(Kt).a.umod(Kt)},rt.prototype.isEven=function(){return(this.words[0]&1)===0},rt.prototype.isOdd=function(){return(this.words[0]&1)===1},rt.prototype.andln=function(Kt){return this.words[0]&Kt},rt.prototype.bincn=function(Kt){_(typeof Kt=="number");var Ft=Kt%26,bt=(Kt-Ft)/26,St=1<<Ft;if(this.length<=bt)return this._expand(bt+1),this.words[bt]|=St,this;for(var Jt=St,er=bt;Jt!==0&&er<this.length;er++){var sr=this.words[er]|0;sr+=Jt,Jt=sr>>>26,sr&=67108863,this.words[er]=sr}return Jt!==0&&(this.words[er]=Jt,this.length++),this},rt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},rt.prototype.cmpn=function(Kt){var Ft=Kt<0;if(this.negative!==0&&!Ft)return-1;if(this.negative===0&&Ft)return 1;this.strip();var bt;if(this.length>1)bt=1;else{Ft&&(Kt=-Kt),_(Kt<=67108863,"Number is too big");var St=this.words[0]|0;bt=St===Kt?0:St<Kt?-1:1}return this.negative!==0?-bt|0:bt},rt.prototype.cmp=function(Kt){if(this.negative!==0&&Kt.negative===0)return-1;if(this.negative===0&&Kt.negative!==0)return 1;var Ft=this.ucmp(Kt);return this.negative!==0?-Ft|0:Ft},rt.prototype.ucmp=function(Kt){if(this.length>Kt.length)return 1;if(this.length<Kt.length)return-1;for(var Ft=0,bt=this.length-1;bt>=0;bt--){var St=this.words[bt]|0,Jt=Kt.words[bt]|0;if(St!==Jt){St<Jt?Ft=-1:St>Jt&&(Ft=1);break}}return Ft},rt.prototype.gtn=function(Kt){return this.cmpn(Kt)===1},rt.prototype.gt=function(Kt){return this.cmp(Kt)===1},rt.prototype.gten=function(Kt){return this.cmpn(Kt)>=0},rt.prototype.gte=function(Kt){return this.cmp(Kt)>=0},rt.prototype.ltn=function(Kt){return this.cmpn(Kt)===-1},rt.prototype.lt=function(Kt){return this.cmp(Kt)===-1},rt.prototype.lten=function(Kt){return this.cmpn(Kt)<=0},rt.prototype.lte=function(Kt){return this.cmp(Kt)<=0},rt.prototype.eqn=function(Kt){return this.cmpn(Kt)===0},rt.prototype.eq=function(Kt){return this.cmp(Kt)===0},rt.red=function(Kt){return new vr(Kt)},rt.prototype.toRed=function(Kt){return _(!this.red,"Already a number in reduction context"),_(this.negative===0,"red works only with positives"),Kt.convertTo(this)._forceRed(Kt)},rt.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},rt.prototype._forceRed=function(Kt){return this.red=Kt,this},rt.prototype.forceRed=function(Kt){return _(!this.red,"Already a number in reduction context"),this._forceRed(Kt)},rt.prototype.redAdd=function(Kt){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,Kt)},rt.prototype.redIAdd=function(Kt){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Kt)},rt.prototype.redSub=function(Kt){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,Kt)},rt.prototype.redISub=function(Kt){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,Kt)},rt.prototype.redShl=function(Kt){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,Kt)},rt.prototype.redMul=function(Kt){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,Kt),this.red.mul(this,Kt)},rt.prototype.redIMul=function(Kt){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,Kt),this.red.imul(this,Kt)},rt.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},rt.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},rt.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},rt.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},rt.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},rt.prototype.redPow=function(Kt){return _(this.red&&!Kt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Kt)};var Gt={k256:null,p224:null,p192:null,p25519:null};function Dr(Br,Kt){this.name=Br,this.p=new rt(Kt,16),this.n=this.p.bitLength(),this.k=new rt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Dr.prototype._tmp=function(){var Kt=new rt(null);return Kt.words=new Array(Math.ceil(this.n/13)),Kt},Dr.prototype.ireduce=function(Kt){var Ft=Kt,bt;do this.split(Ft,this.tmp),Ft=this.imulK(Ft),Ft=Ft.iadd(this.tmp),bt=Ft.bitLength();while(bt>this.n);var St=bt<this.n?-1:Ft.ucmp(this.p);return St===0?(Ft.words[0]=0,Ft.length=1):St>0?Ft.isub(this.p):Ft.strip!==void 0?Ft.strip():Ft._strip(),Ft},Dr.prototype.split=function(Kt,Ft){Kt.iushrn(this.n,0,Ft)},Dr.prototype.imulK=function(Kt){return Kt.imul(this.k)};function lr(){Dr.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(lr,Dr),lr.prototype.split=function(Kt,Ft){for(var bt=4194303,St=Math.min(Kt.length,9),Jt=0;Jt<St;Jt++)Ft.words[Jt]=Kt.words[Jt];if(Ft.length=St,Kt.length<=9){Kt.words[0]=0,Kt.length=1;return}var er=Kt.words[9];for(Ft.words[Ft.length++]=er&bt,Jt=10;Jt<Kt.length;Jt++){var sr=Kt.words[Jt]|0;Kt.words[Jt-10]=(sr&bt)<<4|er>>>22,er=sr}er>>>=22,Kt.words[Jt-10]=er,er===0&&Kt.length>10?Kt.length-=10:Kt.length-=9},lr.prototype.imulK=function(Kt){Kt.words[Kt.length]=0,Kt.words[Kt.length+1]=0,Kt.length+=2;for(var Ft=0,bt=0;bt<Kt.length;bt++){var St=Kt.words[bt]|0;Ft+=St*977,Kt.words[bt]=Ft&67108863,Ft=St*64+(Ft/67108864|0)}return Kt.words[Kt.length-1]===0&&(Kt.length--,Kt.words[Kt.length-1]===0&&Kt.length--),Kt};function xr(){Dr.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}et(xr,Dr);function hr(){Dr.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}et(hr,Dr);function Hr(){Dr.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}et(Hr,Dr),Hr.prototype.imulK=function(Kt){for(var Ft=0,bt=0;bt<Kt.length;bt++){var St=(Kt.words[bt]|0)*19+Ft,Jt=St&67108863;St>>>=26,Kt.words[bt]=Jt,Ft=St}return Ft!==0&&(Kt.words[Kt.length++]=Ft),Kt},rt._prime=function(Kt){if(Gt[Kt])return Gt[Kt];var Ft;if(Kt==="k256")Ft=new lr;else if(Kt==="p224")Ft=new xr;else if(Kt==="p192")Ft=new hr;else if(Kt==="p25519")Ft=new Hr;else throw new Error("Unknown prime "+Kt);return Gt[Kt]=Ft,Ft};function vr(Br){if(typeof Br=="string"){var Kt=rt._prime(Br);this.m=Kt.p,this.prime=Kt}else _(Br.gtn(1),"modulus must be greater than 1"),this.m=Br,this.prime=null}vr.prototype._verify1=function(Kt){_(Kt.negative===0,"red works only with positives"),_(Kt.red,"red works only with red numbers")},vr.prototype._verify2=function(Kt,Ft){_((Kt.negative|Ft.negative)===0,"red works only with positives"),_(Kt.red&&Kt.red===Ft.red,"red works only with red numbers")},vr.prototype.imod=function(Kt){return this.prime?this.prime.ireduce(Kt)._forceRed(this):Kt.umod(this.m)._forceRed(this)},vr.prototype.neg=function(Kt){return Kt.isZero()?Kt.clone():this.m.sub(Kt)._forceRed(this)},vr.prototype.add=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.add(Ft);return bt.cmp(this.m)>=0&&bt.isub(this.m),bt._forceRed(this)},vr.prototype.iadd=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.iadd(Ft);return bt.cmp(this.m)>=0&&bt.isub(this.m),bt},vr.prototype.sub=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.sub(Ft);return bt.cmpn(0)<0&&bt.iadd(this.m),bt._forceRed(this)},vr.prototype.isub=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.isub(Ft);return bt.cmpn(0)<0&&bt.iadd(this.m),bt},vr.prototype.shl=function(Kt,Ft){return this._verify1(Kt),this.imod(Kt.ushln(Ft))},vr.prototype.imul=function(Kt,Ft){return this._verify2(Kt,Ft),this.imod(Kt.imul(Ft))},vr.prototype.mul=function(Kt,Ft){return this._verify2(Kt,Ft),this.imod(Kt.mul(Ft))},vr.prototype.isqr=function(Kt){return this.imul(Kt,Kt.clone())},vr.prototype.sqr=function(Kt){return this.mul(Kt,Kt)},vr.prototype.sqrt=function(Kt){if(Kt.isZero())return Kt.clone();var Ft=this.m.andln(3);if(_(Ft%2===1),Ft===3){var bt=this.m.add(new rt(1)).iushrn(2);return this.pow(Kt,bt)}for(var St=this.m.subn(1),Jt=0;!St.isZero()&&St.andln(1)===0;)Jt++,St.iushrn(1);_(!St.isZero());var er=new rt(1).toRed(this),sr=er.redNeg(),nr=this.m.subn(1).iushrn(1),Dt=this.m.bitLength();for(Dt=new rt(2*Dt*Dt).toRed(this);this.pow(Dt,nr).cmp(sr)!==0;)Dt.redIAdd(sr);for(var Tt=this.pow(Dt,St),Mt=this.pow(Kt,St.addn(1).iushrn(1)),dr=this.pow(Kt,St),Nr=Jt;dr.cmp(er)!==0;){for(var qt=dr,Fr=0;qt.cmp(er)!==0;Fr++)qt=qt.redSqr();_(Fr<Nr);var jr=this.pow(Tt,new rt(1).iushln(Nr-Fr-1));Mt=Mt.redMul(jr),Tt=jr.redSqr(),dr=dr.redMul(Tt),Nr=Fr}return Mt},vr.prototype.invm=function(Kt){var Ft=Kt._invmp(this.m);return Ft.negative!==0?(Ft.negative=0,this.imod(Ft).redNeg()):this.imod(Ft)},vr.prototype.pow=function(Kt,Ft){if(Ft.isZero())return new rt(1).toRed(this);if(Ft.cmpn(1)===0)return Kt.clone();var bt=4,St=new Array(1<<bt);St[0]=new rt(1).toRed(this),St[1]=Kt;for(var Jt=2;Jt<St.length;Jt++)St[Jt]=this.mul(St[Jt-1],Kt);var er=St[0],sr=0,nr=0,Dt=Ft.bitLength()%26;for(Dt===0&&(Dt=26),Jt=Ft.length-1;Jt>=0;Jt--){for(var Tt=Ft.words[Jt],Mt=Dt-1;Mt>=0;Mt--){var dr=Tt>>Mt&1;if(er!==St[0]&&(er=this.sqr(er)),dr===0&&sr===0){nr=0;continue}sr<<=1,sr|=dr,nr++,!(nr!==bt&&(Jt!==0||Mt!==0))&&(er=this.mul(er,St[sr]),nr=0,sr=0)}Dt=26}return er},vr.prototype.convertTo=function(Kt){var Ft=Kt.umod(this.m);return Ft===Kt?Ft.clone():Ft},vr.prototype.convertFrom=function(Kt){var Ft=Kt.clone();return Ft.red=null,Ft},rt.mont=function(Kt){return new u0(Kt)};function u0(Br){vr.call(this,Br),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new rt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(u0,vr),u0.prototype.convertTo=function(Kt){return this.imod(Kt.ushln(this.shift))},u0.prototype.convertFrom=function(Kt){var Ft=this.imod(Kt.mul(this.rinv));return Ft.red=null,Ft},u0.prototype.imul=function(Kt,Ft){if(Kt.isZero()||Ft.isZero())return Kt.words[0]=0,Kt.length=1,Kt;var bt=Kt.imul(Ft),St=bt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Jt=bt.isub(St).iushrn(this.shift),er=Jt;return Jt.cmp(this.m)>=0?er=Jt.isub(this.m):Jt.cmpn(0)<0&&(er=Jt.iadd(this.m)),er._forceRed(this)},u0.prototype.mul=function(Kt,Ft){if(Kt.isZero()||Ft.isZero())return new rt(0)._forceRed(this);var bt=Kt.mul(Ft),St=bt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Jt=bt.isub(St).iushrn(this.shift),er=Jt;return Jt.cmp(this.m)>=0?er=Jt.isub(this.m):Jt.cmpn(0)<0&&(er=Jt.iadd(this.m)),er._forceRed(this)},u0.prototype.invm=function(Kt){var Ft=this.imod(Kt._invmp(this.m).mul(this.r2));return Ft._forceRed(this)}})(i,commonjsGlobal)})(bn);var bnExports=bn.exports,utils$b={};(function(i){var a=i;function o(rt,ot){if(Array.isArray(rt))return rt.slice();if(!rt)return[];var ft=[];if(typeof rt!="string"){for(var lt=0;lt<rt.length;lt++)ft[lt]=rt[lt]|0;return ft}if(ot==="hex"){rt=rt.replace(/[^a-z0-9]+/ig,""),rt.length%2!==0&&(rt="0"+rt);for(var lt=0;lt<rt.length;lt+=2)ft.push(parseInt(rt[lt]+rt[lt+1],16))}else for(var lt=0;lt<rt.length;lt++){var ht=rt.charCodeAt(lt),vt=ht>>8,It=ht&255;vt?ft.push(vt,It):ft.push(It)}return ft}a.toArray=o;function _(rt){return rt.length===1?"0"+rt:rt}a.zero2=_;function et(rt){for(var ot="",ft=0;ft<rt.length;ft++)ot+=_(rt[ft].toString(16));return ot}a.toHex=et,a.encode=function(ot,ft){return ft==="hex"?et(ot):ot}})(utils$b);(function(i){var a=i,o=bnExports,_=minimalisticAssert$1,et=utils$b;a.assert=_,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function rt(vt,It,Qt){var mt=new Array(Math.max(vt.bitLength(),Qt)+1);mt.fill(0);for(var Yt=1<<It+1,Rt=vt.clone(),cr=0;cr<mt.length;cr++){var Ut,zt=Rt.andln(Yt-1);Rt.isOdd()?(zt>(Yt>>1)-1?Ut=(Yt>>1)-zt:Ut=zt,Rt.isubn(Ut)):Ut=0,mt[cr]=Ut,Rt.iushrn(1)}return mt}a.getNAF=rt;function ot(vt,It){var Qt=[[],[]];vt=vt.clone(),It=It.clone();for(var mt=0,Yt=0,Rt;vt.cmpn(-mt)>0||It.cmpn(-Yt)>0;){var cr=vt.andln(3)+mt&3,Ut=It.andln(3)+Yt&3;cr===3&&(cr=-1),Ut===3&&(Ut=-1);var zt;cr&1?(Rt=vt.andln(7)+mt&7,(Rt===3||Rt===5)&&Ut===2?zt=-cr:zt=cr):zt=0,Qt[0].push(zt);var Gt;Ut&1?(Rt=It.andln(7)+Yt&7,(Rt===3||Rt===5)&&cr===2?Gt=-Ut:Gt=Ut):Gt=0,Qt[1].push(Gt),2*mt===zt+1&&(mt=1-mt),2*Yt===Gt+1&&(Yt=1-Yt),vt.iushrn(1),It.iushrn(1)}return Qt}a.getJSF=ot;function ft(vt,It,Qt){var mt="_"+It;vt.prototype[It]=function(){return this[mt]!==void 0?this[mt]:this[mt]=Qt.call(this)}}a.cachedProperty=ft;function lt(vt){return typeof vt=="string"?a.toArray(vt,"hex"):vt}a.parseBytes=lt;function ht(vt){return new o(vt,"hex","le")}a.intFromLE=ht})(utils$c);var brorand={exports:{}},r$2;brorand.exports=function i(a){return r$2||(r$2=new Rand(null)),r$2.generate(a)};function Rand(i){this.rand=i}brorand.exports.Rand=Rand;Rand.prototype.generate=function i(a){return this._rand(a)};Rand.prototype._rand=function i(a){if(this.rand.getBytes)return this.rand.getBytes(a);for(var o=new Uint8Array(a),_=0;_<o.length;_++)o[_]=this.rand.getByte();return o};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?Rand.prototype._rand=function(a){var o=new Uint8Array(a);return self.crypto.getRandomValues(o),o}:self.msCrypto&&self.msCrypto.getRandomValues?Rand.prototype._rand=function(a){var o=new Uint8Array(a);return self.msCrypto.getRandomValues(o),o}:typeof window=="object"&&(Rand.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var crypto$1=require$$1;if(typeof crypto$1.randomBytes!="function")throw new Error("Not supported");Rand.prototype._rand=function(a){return crypto$1.randomBytes(a)}}catch{}var brorandExports=brorand.exports,curve={},BN$7=bnExports,utils$a=utils$c,getNAF=utils$a.getNAF,getJSF=utils$a.getJSF,assert$9=utils$a.assert;function BaseCurve(i,a){this.type=i,this.p=new BN$7(a.p,16),this.red=a.prime?BN$7.red(a.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=a.n&&new BN$7(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var o=this.n&&this.p.div(this.n);!o||o.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base=BaseCurve;BaseCurve.prototype.point=function i(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function i(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function i(a,o){assert$9(a.precomputed);var _=a._getDoubles(),et=getNAF(o,1,this._bitLength),rt=(1<<_.step+1)-(_.step%2===0?2:1);rt/=3;var ot=[],ft,lt;for(ft=0;ft<et.length;ft+=_.step){lt=0;for(var ht=ft+_.step-1;ht>=ft;ht--)lt=(lt<<1)+et[ht];ot.push(lt)}for(var vt=this.jpoint(null,null,null),It=this.jpoint(null,null,null),Qt=rt;Qt>0;Qt--){for(ft=0;ft<ot.length;ft++)lt=ot[ft],lt===Qt?It=It.mixedAdd(_.points[ft]):lt===-Qt&&(It=It.mixedAdd(_.points[ft].neg()));vt=vt.add(It)}return vt.toP()};BaseCurve.prototype._wnafMul=function i(a,o){var _=4,et=a._getNAFPoints(_);_=et.wnd;for(var rt=et.points,ot=getNAF(o,_,this._bitLength),ft=this.jpoint(null,null,null),lt=ot.length-1;lt>=0;lt--){for(var ht=0;lt>=0&&ot[lt]===0;lt--)ht++;if(lt>=0&&ht++,ft=ft.dblp(ht),lt<0)break;var vt=ot[lt];assert$9(vt!==0),a.type==="affine"?vt>0?ft=ft.mixedAdd(rt[vt-1>>1]):ft=ft.mixedAdd(rt[-vt-1>>1].neg()):vt>0?ft=ft.add(rt[vt-1>>1]):ft=ft.add(rt[-vt-1>>1].neg())}return a.type==="affine"?ft.toP():ft};BaseCurve.prototype._wnafMulAdd=function i(a,o,_,et,rt){var ot=this._wnafT1,ft=this._wnafT2,lt=this._wnafT3,ht=0,vt,It,Qt;for(vt=0;vt<et;vt++){Qt=o[vt];var mt=Qt._getNAFPoints(a);ot[vt]=mt.wnd,ft[vt]=mt.points}for(vt=et-1;vt>=1;vt-=2){var Yt=vt-1,Rt=vt;if(ot[Yt]!==1||ot[Rt]!==1){lt[Yt]=getNAF(_[Yt],ot[Yt],this._bitLength),lt[Rt]=getNAF(_[Rt],ot[Rt],this._bitLength),ht=Math.max(lt[Yt].length,ht),ht=Math.max(lt[Rt].length,ht);continue}var cr=[o[Yt],null,null,o[Rt]];o[Yt].y.cmp(o[Rt].y)===0?(cr[1]=o[Yt].add(o[Rt]),cr[2]=o[Yt].toJ().mixedAdd(o[Rt].neg())):o[Yt].y.cmp(o[Rt].y.redNeg())===0?(cr[1]=o[Yt].toJ().mixedAdd(o[Rt]),cr[2]=o[Yt].add(o[Rt].neg())):(cr[1]=o[Yt].toJ().mixedAdd(o[Rt]),cr[2]=o[Yt].toJ().mixedAdd(o[Rt].neg()));var Ut=[-3,-1,-5,-7,0,7,5,1,3],zt=getJSF(_[Yt],_[Rt]);for(ht=Math.max(zt[0].length,ht),lt[Yt]=new Array(ht),lt[Rt]=new Array(ht),It=0;It<ht;It++){var Gt=zt[0][It]|0,Dr=zt[1][It]|0;lt[Yt][It]=Ut[(Gt+1)*3+(Dr+1)],lt[Rt][It]=0,ft[Yt]=cr}}var lr=this.jpoint(null,null,null),xr=this._wnafT4;for(vt=ht;vt>=0;vt--){for(var hr=0;vt>=0;){var Hr=!0;for(It=0;It<et;It++)xr[It]=lt[It][vt]|0,xr[It]!==0&&(Hr=!1);if(!Hr)break;hr++,vt--}if(vt>=0&&hr++,lr=lr.dblp(hr),vt<0)break;for(It=0;It<et;It++){var vr=xr[It];vr!==0&&(vr>0?Qt=ft[It][vr-1>>1]:vr<0&&(Qt=ft[It][-vr-1>>1].neg()),Qt.type==="affine"?lr=lr.mixedAdd(Qt):lr=lr.add(Qt))}}for(vt=0;vt<et;vt++)ft[vt]=null;return rt?lr:lr.toP()};function BasePoint(i,a){this.curve=i,this.type=a,this.precomputed=null}BaseCurve.BasePoint=BasePoint;BasePoint.prototype.eq=function i(){throw new Error("Not implemented")};BasePoint.prototype.validate=function i(){return this.curve.validate(this)};BaseCurve.prototype.decodePoint=function i(a,o){a=utils$a.toArray(a,o);var _=this.p.byteLength();if((a[0]===4||a[0]===6||a[0]===7)&&a.length-1===2*_){a[0]===6?assert$9(a[a.length-1]%2===0):a[0]===7&&assert$9(a[a.length-1]%2===1);var et=this.point(a.slice(1,1+_),a.slice(1+_,1+2*_));return et}else if((a[0]===2||a[0]===3)&&a.length-1===_)return this.pointFromX(a.slice(1,1+_),a[0]===3);throw new Error("Unknown point format")};BasePoint.prototype.encodeCompressed=function i(a){return this.encode(a,!0)};BasePoint.prototype._encode=function i(a){var o=this.curve.p.byteLength(),_=this.getX().toArray("be",o);return a?[this.getY().isEven()?2:3].concat(_):[4].concat(_,this.getY().toArray("be",o))};BasePoint.prototype.encode=function i(a,o){return utils$a.encode(this._encode(o),a)};BasePoint.prototype.precompute=function i(a){if(this.precomputed)return this;var o={doubles:null,naf:null,beta:null};return o.naf=this._getNAFPoints(8),o.doubles=this._getDoubles(4,a),o.beta=this._getBeta(),this.precomputed=o,this};BasePoint.prototype._hasDoubles=function i(a){if(!this.precomputed)return!1;var o=this.precomputed.doubles;return o?o.points.length>=Math.ceil((a.bitLength()+1)/o.step):!1};BasePoint.prototype._getDoubles=function i(a,o){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var _=[this],et=this,rt=0;rt<o;rt+=a){for(var ot=0;ot<a;ot++)et=et.dbl();_.push(et)}return{step:a,points:_}};BasePoint.prototype._getNAFPoints=function i(a){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var o=[this],_=(1<<a)-1,et=_===1?null:this.dbl(),rt=1;rt<_;rt++)o[rt]=o[rt-1].add(et);return{wnd:a,points:o}};BasePoint.prototype._getBeta=function i(){return null};BasePoint.prototype.dblp=function i(a){for(var o=this,_=0;_<a;_++)o=o.dbl();return o};var utils$9=utils$c,BN$6=bnExports,inherits$2=inherits_browserExports,Base$2=base,assert$8=utils$9.assert;function ShortCurve(i){Base$2.call(this,"short",i),this.a=new BN$6(i.a,16).toRed(this.red),this.b=new BN$6(i.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(i),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$2(ShortCurve,Base$2);var short=ShortCurve;ShortCurve.prototype._getEndomorphism=function i(a){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var o,_;if(a.beta)o=new BN$6(a.beta,16).toRed(this.red);else{var et=this._getEndoRoots(this.p);o=et[0].cmp(et[1])<0?et[0]:et[1],o=o.toRed(this.red)}if(a.lambda)_=new BN$6(a.lambda,16);else{var rt=this._getEndoRoots(this.n);this.g.mul(rt[0]).x.cmp(this.g.x.redMul(o))===0?_=rt[0]:(_=rt[1],assert$8(this.g.mul(_).x.cmp(this.g.x.redMul(o))===0))}var ot;return a.basis?ot=a.basis.map(function(ft){return{a:new BN$6(ft.a,16),b:new BN$6(ft.b,16)}}):ot=this._getEndoBasis(_),{beta:o,lambda:_,basis:ot}}};ShortCurve.prototype._getEndoRoots=function i(a){var o=a===this.p?this.red:BN$6.mont(a),_=new BN$6(2).toRed(o).redInvm(),et=_.redNeg(),rt=new BN$6(3).toRed(o).redNeg().redSqrt().redMul(_),ot=et.redAdd(rt).fromRed(),ft=et.redSub(rt).fromRed();return[ot,ft]};ShortCurve.prototype._getEndoBasis=function i(a){for(var o=this.n.ushrn(Math.floor(this.n.bitLength()/2)),_=a,et=this.n.clone(),rt=new BN$6(1),ot=new BN$6(0),ft=new BN$6(0),lt=new BN$6(1),ht,vt,It,Qt,mt,Yt,Rt,cr=0,Ut,zt;_.cmpn(0)!==0;){var Gt=et.div(_);Ut=et.sub(Gt.mul(_)),zt=ft.sub(Gt.mul(rt));var Dr=lt.sub(Gt.mul(ot));if(!It&&Ut.cmp(o)<0)ht=Rt.neg(),vt=rt,It=Ut.neg(),Qt=zt;else if(It&&++cr===2)break;Rt=Ut,et=_,_=Ut,ft=rt,rt=zt,lt=ot,ot=Dr}mt=Ut.neg(),Yt=zt;var lr=It.sqr().add(Qt.sqr()),xr=mt.sqr().add(Yt.sqr());return xr.cmp(lr)>=0&&(mt=ht,Yt=vt),It.negative&&(It=It.neg(),Qt=Qt.neg()),mt.negative&&(mt=mt.neg(),Yt=Yt.neg()),[{a:It,b:Qt},{a:mt,b:Yt}]};ShortCurve.prototype._endoSplit=function i(a){var o=this.endo.basis,_=o[0],et=o[1],rt=et.b.mul(a).divRound(this.n),ot=_.b.neg().mul(a).divRound(this.n),ft=rt.mul(_.a),lt=ot.mul(et.a),ht=rt.mul(_.b),vt=ot.mul(et.b),It=a.sub(ft).sub(lt),Qt=ht.add(vt).neg();return{k1:It,k2:Qt}};ShortCurve.prototype.pointFromX=function i(a,o){a=new BN$6(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=_.redSqrt();if(et.redSqr().redSub(_).cmp(this.zero)!==0)throw new Error("invalid point");var rt=et.fromRed().isOdd();return(o&&!rt||!o&&rt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve.prototype.validate=function i(a){if(a.inf)return!0;var o=a.x,_=a.y,et=this.a.redMul(o),rt=o.redSqr().redMul(o).redIAdd(et).redIAdd(this.b);return _.redSqr().redISub(rt).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function i(a,o,_){for(var et=this._endoWnafT1,rt=this._endoWnafT2,ot=0;ot<a.length;ot++){var ft=this._endoSplit(o[ot]),lt=a[ot],ht=lt._getBeta();ft.k1.negative&&(ft.k1.ineg(),lt=lt.neg(!0)),ft.k2.negative&&(ft.k2.ineg(),ht=ht.neg(!0)),et[ot*2]=lt,et[ot*2+1]=ht,rt[ot*2]=ft.k1,rt[ot*2+1]=ft.k2}for(var vt=this._wnafMulAdd(1,et,rt,ot*2,_),It=0;It<ot*2;It++)et[It]=null,rt[It]=null;return vt};function Point$2(i,a,o,_){Base$2.BasePoint.call(this,i,"affine"),a===null&&o===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$6(a,16),this.y=new BN$6(o,16),_&&(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)}inherits$2(Point$2,Base$2.BasePoint);ShortCurve.prototype.point=function i(a,o,_){return new Point$2(this,a,o,_)};ShortCurve.prototype.pointFromJSON=function i(a,o){return Point$2.fromJSON(this,a,o)};Point$2.prototype._getBeta=function i(){if(this.curve.endo){var a=this.precomputed;if(a&&a.beta)return a.beta;var o=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(a){var _=this.curve,et=function(rt){return _.point(rt.x.redMul(_.endo.beta),rt.y)};a.beta=o,o.precomputed={beta:null,naf:a.naf&&{wnd:a.naf.wnd,points:a.naf.points.map(et)},doubles:a.doubles&&{step:a.doubles.step,points:a.doubles.points.map(et)}}}return o}};Point$2.prototype.toJSON=function i(){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]};Point$2.fromJSON=function i(a,o,_){typeof o=="string"&&(o=JSON.parse(o));var et=a.point(o[0],o[1],_);if(!o[2])return et;function rt(ft){return a.point(ft[0],ft[1],_)}var ot=o[2];return et.precomputed={beta:null,doubles:ot.doubles&&{step:ot.doubles.step,points:[et].concat(ot.doubles.points.map(rt))},naf:ot.naf&&{wnd:ot.naf.wnd,points:[et].concat(ot.naf.points.map(rt))}},et};Point$2.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point$2.prototype.isInfinity=function i(){return this.inf};Point$2.prototype.add=function i(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var o=this.y.redSub(a.y);o.cmpn(0)!==0&&(o=o.redMul(this.x.redSub(a.x).redInvm()));var _=o.redSqr().redISub(this.x).redISub(a.x),et=o.redMul(this.x.redSub(_)).redISub(this.y);return this.curve.point(_,et)};Point$2.prototype.dbl=function i(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var o=this.curve.a,_=this.x.redSqr(),et=a.redInvm(),rt=_.redAdd(_).redIAdd(_).redIAdd(o).redMul(et),ot=rt.redSqr().redISub(this.x.redAdd(this.x)),ft=rt.redMul(this.x.redSub(ot)).redISub(this.y);return this.curve.point(ot,ft)};Point$2.prototype.getX=function i(){return this.x.fromRed()};Point$2.prototype.getY=function i(){return this.y.fromRed()};Point$2.prototype.mul=function i(a){return a=new BN$6(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$2.prototype.mulAdd=function i(a,o,_){var et=[this,o],rt=[a,_];return this.curve.endo?this.curve._endoWnafMulAdd(et,rt):this.curve._wnafMulAdd(1,et,rt,2)};Point$2.prototype.jmulAdd=function i(a,o,_){var et=[this,o],rt=[a,_];return this.curve.endo?this.curve._endoWnafMulAdd(et,rt,!0):this.curve._wnafMulAdd(1,et,rt,2,!0)};Point$2.prototype.eq=function i(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$2.prototype.neg=function i(a){if(this.inf)return this;var o=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var _=this.precomputed,et=function(rt){return rt.neg()};o.precomputed={naf:_.naf&&{wnd:_.naf.wnd,points:_.naf.points.map(et)},doubles:_.doubles&&{step:_.doubles.step,points:_.doubles.points.map(et)}}}return o};Point$2.prototype.toJ=function i(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint(i,a,o,_){Base$2.BasePoint.call(this,i,"jacobian"),a===null&&o===null&&_===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(a,16),this.y=new BN$6(o,16),this.z=new BN$6(_,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}inherits$2(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function i(a,o,_){return new JPoint(this,a,o,_)};JPoint.prototype.toP=function i(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),o=a.redSqr(),_=this.x.redMul(o),et=this.y.redMul(o).redMul(a);return this.curve.point(_,et)};JPoint.prototype.neg=function i(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function i(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var o=a.z.redSqr(),_=this.z.redSqr(),et=this.x.redMul(o),rt=a.x.redMul(_),ot=this.y.redMul(o.redMul(a.z)),ft=a.y.redMul(_.redMul(this.z)),lt=et.redSub(rt),ht=ot.redSub(ft);if(lt.cmpn(0)===0)return ht.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var vt=lt.redSqr(),It=vt.redMul(lt),Qt=et.redMul(vt),mt=ht.redSqr().redIAdd(It).redISub(Qt).redISub(Qt),Yt=ht.redMul(Qt.redISub(mt)).redISub(ot.redMul(It)),Rt=this.z.redMul(a.z).redMul(lt);return this.curve.jpoint(mt,Yt,Rt)};JPoint.prototype.mixedAdd=function i(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var o=this.z.redSqr(),_=this.x,et=a.x.redMul(o),rt=this.y,ot=a.y.redMul(o).redMul(this.z),ft=_.redSub(et),lt=rt.redSub(ot);if(ft.cmpn(0)===0)return lt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ht=ft.redSqr(),vt=ht.redMul(ft),It=_.redMul(ht),Qt=lt.redSqr().redIAdd(vt).redISub(It).redISub(It),mt=lt.redMul(It.redISub(Qt)).redISub(rt.redMul(vt)),Yt=this.z.redMul(ft);return this.curve.jpoint(Qt,mt,Yt)};JPoint.prototype.dblp=function i(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var o;if(this.curve.zeroA||this.curve.threeA){var _=this;for(o=0;o<a;o++)_=_.dbl();return _}var et=this.curve.a,rt=this.curve.tinv,ot=this.x,ft=this.y,lt=this.z,ht=lt.redSqr().redSqr(),vt=ft.redAdd(ft);for(o=0;o<a;o++){var It=ot.redSqr(),Qt=vt.redSqr(),mt=Qt.redSqr(),Yt=It.redAdd(It).redIAdd(It).redIAdd(et.redMul(ht)),Rt=ot.redMul(Qt),cr=Yt.redSqr().redISub(Rt.redAdd(Rt)),Ut=Rt.redISub(cr),zt=Yt.redMul(Ut);zt=zt.redIAdd(zt).redISub(mt);var Gt=vt.redMul(lt);o+1<a&&(ht=ht.redMul(mt)),ot=cr,lt=Gt,vt=zt}return this.curve.jpoint(ot,vt.redMul(rt),lt)};JPoint.prototype.dbl=function i(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint.prototype._zeroDbl=function i(){var a,o,_;if(this.zOne){var et=this.x.redSqr(),rt=this.y.redSqr(),ot=rt.redSqr(),ft=this.x.redAdd(rt).redSqr().redISub(et).redISub(ot);ft=ft.redIAdd(ft);var lt=et.redAdd(et).redIAdd(et),ht=lt.redSqr().redISub(ft).redISub(ft),vt=ot.redIAdd(ot);vt=vt.redIAdd(vt),vt=vt.redIAdd(vt),a=ht,o=lt.redMul(ft.redISub(ht)).redISub(vt),_=this.y.redAdd(this.y)}else{var It=this.x.redSqr(),Qt=this.y.redSqr(),mt=Qt.redSqr(),Yt=this.x.redAdd(Qt).redSqr().redISub(It).redISub(mt);Yt=Yt.redIAdd(Yt);var Rt=It.redAdd(It).redIAdd(It),cr=Rt.redSqr(),Ut=mt.redIAdd(mt);Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),a=cr.redISub(Yt).redISub(Yt),o=Rt.redMul(Yt.redISub(a)).redISub(Ut),_=this.y.redMul(this.z),_=_.redIAdd(_)}return this.curve.jpoint(a,o,_)};JPoint.prototype._threeDbl=function i(){var a,o,_;if(this.zOne){var et=this.x.redSqr(),rt=this.y.redSqr(),ot=rt.redSqr(),ft=this.x.redAdd(rt).redSqr().redISub(et).redISub(ot);ft=ft.redIAdd(ft);var lt=et.redAdd(et).redIAdd(et).redIAdd(this.curve.a),ht=lt.redSqr().redISub(ft).redISub(ft);a=ht;var vt=ot.redIAdd(ot);vt=vt.redIAdd(vt),vt=vt.redIAdd(vt),o=lt.redMul(ft.redISub(ht)).redISub(vt),_=this.y.redAdd(this.y)}else{var It=this.z.redSqr(),Qt=this.y.redSqr(),mt=this.x.redMul(Qt),Yt=this.x.redSub(It).redMul(this.x.redAdd(It));Yt=Yt.redAdd(Yt).redIAdd(Yt);var Rt=mt.redIAdd(mt);Rt=Rt.redIAdd(Rt);var cr=Rt.redAdd(Rt);a=Yt.redSqr().redISub(cr),_=this.y.redAdd(this.z).redSqr().redISub(Qt).redISub(It);var Ut=Qt.redSqr();Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),o=Yt.redMul(Rt.redISub(a)).redISub(Ut)}return this.curve.jpoint(a,o,_)};JPoint.prototype._dbl=function i(){var a=this.curve.a,o=this.x,_=this.y,et=this.z,rt=et.redSqr().redSqr(),ot=o.redSqr(),ft=_.redSqr(),lt=ot.redAdd(ot).redIAdd(ot).redIAdd(a.redMul(rt)),ht=o.redAdd(o);ht=ht.redIAdd(ht);var vt=ht.redMul(ft),It=lt.redSqr().redISub(vt.redAdd(vt)),Qt=vt.redISub(It),mt=ft.redSqr();mt=mt.redIAdd(mt),mt=mt.redIAdd(mt),mt=mt.redIAdd(mt);var Yt=lt.redMul(Qt).redISub(mt),Rt=_.redAdd(_).redMul(et);return this.curve.jpoint(It,Yt,Rt)};JPoint.prototype.trpl=function i(){if(!this.curve.zeroA)return this.dbl().add(this);var a=this.x.redSqr(),o=this.y.redSqr(),_=this.z.redSqr(),et=o.redSqr(),rt=a.redAdd(a).redIAdd(a),ot=rt.redSqr(),ft=this.x.redAdd(o).redSqr().redISub(a).redISub(et);ft=ft.redIAdd(ft),ft=ft.redAdd(ft).redIAdd(ft),ft=ft.redISub(ot);var lt=ft.redSqr(),ht=et.redIAdd(et);ht=ht.redIAdd(ht),ht=ht.redIAdd(ht),ht=ht.redIAdd(ht);var vt=rt.redIAdd(ft).redSqr().redISub(ot).redISub(lt).redISub(ht),It=o.redMul(vt);It=It.redIAdd(It),It=It.redIAdd(It);var Qt=this.x.redMul(lt).redISub(It);Qt=Qt.redIAdd(Qt),Qt=Qt.redIAdd(Qt);var mt=this.y.redMul(vt.redMul(ht.redISub(vt)).redISub(ft.redMul(lt)));mt=mt.redIAdd(mt),mt=mt.redIAdd(mt),mt=mt.redIAdd(mt);var Yt=this.z.redAdd(ft).redSqr().redISub(_).redISub(lt);return this.curve.jpoint(Qt,mt,Yt)};JPoint.prototype.mul=function i(a,o){return a=new BN$6(a,o),this.curve._wnafMul(this,a)};JPoint.prototype.eq=function i(a){if(a.type==="affine")return this.eq(a.toJ());if(this===a)return!0;var o=this.z.redSqr(),_=a.z.redSqr();if(this.x.redMul(_).redISub(a.x.redMul(o)).cmpn(0)!==0)return!1;var et=o.redMul(this.z),rt=_.redMul(a.z);return this.y.redMul(rt).redISub(a.y.redMul(et)).cmpn(0)===0};JPoint.prototype.eqXToP=function i(a){var o=this.z.redSqr(),_=a.toRed(this.curve.red).redMul(o);if(this.x.cmp(_)===0)return!0;for(var et=a.clone(),rt=this.curve.redN.redMul(o);;){if(et.iadd(this.curve.n),et.cmp(this.curve.p)>=0)return!1;if(_.redIAdd(rt),this.x.cmp(_)===0)return!0}};JPoint.prototype.inspect=function i(){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)+">"};JPoint.prototype.isInfinity=function i(){return this.z.cmpn(0)===0};var BN$5=bnExports,inherits$1=inherits_browserExports,Base$1=base,utils$8=utils$c;function MontCurve(i){Base$1.call(this,"mont",i),this.a=new BN$5(i.a,16).toRed(this.red),this.b=new BN$5(i.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$1(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function i(a){var o=a.normalize().x,_=o.redSqr(),et=_.redMul(o).redAdd(_.redMul(this.a)).redAdd(o),rt=et.redSqrt();return rt.redSqr().cmp(et)===0};function Point$1(i,a,o){Base$1.BasePoint.call(this,i,"projective"),a===null&&o===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(a,16),this.z=new BN$5(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$1(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function i(a,o){return this.point(utils$8.toArray(a,o),1)};MontCurve.prototype.point=function i(a,o){return new Point$1(this,a,o)};MontCurve.prototype.pointFromJSON=function i(a){return Point$1.fromJSON(this,a)};Point$1.prototype.precompute=function i(){};Point$1.prototype._encode=function i(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function i(a,o){return new Point$1(a,o[0],o[1]||a.one)};Point$1.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point$1.prototype.isInfinity=function i(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function i(){var a=this.x.redAdd(this.z),o=a.redSqr(),_=this.x.redSub(this.z),et=_.redSqr(),rt=o.redSub(et),ot=o.redMul(et),ft=rt.redMul(et.redAdd(this.curve.a24.redMul(rt)));return this.curve.point(ot,ft)};Point$1.prototype.add=function i(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function i(a,o){var _=this.x.redAdd(this.z),et=this.x.redSub(this.z),rt=a.x.redAdd(a.z),ot=a.x.redSub(a.z),ft=ot.redMul(_),lt=rt.redMul(et),ht=o.z.redMul(ft.redAdd(lt).redSqr()),vt=o.x.redMul(ft.redISub(lt).redSqr());return this.curve.point(ht,vt)};Point$1.prototype.mul=function i(a){for(var o=a.clone(),_=this,et=this.curve.point(null,null),rt=this,ot=[];o.cmpn(0)!==0;o.iushrn(1))ot.push(o.andln(1));for(var ft=ot.length-1;ft>=0;ft--)ot[ft]===0?(_=_.diffAdd(et,rt),et=et.dbl()):(et=_.diffAdd(et,rt),_=_.dbl());return et};Point$1.prototype.mulAdd=function i(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function i(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function i(a){return this.getX().cmp(a.getX())===0};Point$1.prototype.normalize=function i(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function i(){return this.normalize(),this.x.fromRed()};var utils$7=utils$c,BN$4=bnExports,inherits=inherits_browserExports,Base=base,assert$7=utils$7.assert;function EdwardsCurve(i){this.twisted=(i.a|0)!==1,this.mOneA=this.twisted&&(i.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",i),this.a=new BN$4(i.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(i.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(i.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(i.c|0)===1}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function i(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve.prototype._mulC=function i(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve.prototype.jpoint=function i(a,o,_,et){return this.point(a,o,_,et)};EdwardsCurve.prototype.pointFromX=function i(a,o){a=new BN$4(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr(),et=this.c2.redSub(this.a.redMul(_)),rt=this.one.redSub(this.c2.redMul(this.d).redMul(_)),ot=et.redMul(rt.redInvm()),ft=ot.redSqrt();if(ft.redSqr().redSub(ot).cmp(this.zero)!==0)throw new Error("invalid point");var lt=ft.fromRed().isOdd();return(o&&!lt||!o&<)&&(ft=ft.redNeg()),this.point(a,ft)};EdwardsCurve.prototype.pointFromY=function i(a,o){a=new BN$4(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr(),et=_.redSub(this.c2),rt=_.redMul(this.d).redMul(this.c2).redSub(this.a),ot=et.redMul(rt.redInvm());if(ot.cmp(this.zero)===0){if(o)throw new Error("invalid point");return this.point(this.zero,a)}var ft=ot.redSqrt();if(ft.redSqr().redSub(ot).cmp(this.zero)!==0)throw new Error("invalid point");return ft.fromRed().isOdd()!==o&&(ft=ft.redNeg()),this.point(ft,a)};EdwardsCurve.prototype.validate=function i(a){if(a.isInfinity())return!0;a.normalize();var o=a.x.redSqr(),_=a.y.redSqr(),et=o.redMul(this.a).redAdd(_),rt=this.c2.redMul(this.one.redAdd(this.d.redMul(o).redMul(_)));return et.cmp(rt)===0};function Point(i,a,o,_,et){Base.BasePoint.call(this,i,"projective"),a===null&&o===null&&_===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$4(a,16),this.y=new BN$4(o,16),this.z=_?new BN$4(_,16):this.curve.one,this.t=et&&new BN$4(et,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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function i(a){return Point.fromJSON(this,a)};EdwardsCurve.prototype.point=function i(a,o,_,et){return new Point(this,a,o,_,et)};Point.fromJSON=function i(a,o){return new Point(a,o[0],o[1],o[2])};Point.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point.prototype.isInfinity=function i(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function i(){var a=this.x.redSqr(),o=this.y.redSqr(),_=this.z.redSqr();_=_.redIAdd(_);var et=this.curve._mulA(a),rt=this.x.redAdd(this.y).redSqr().redISub(a).redISub(o),ot=et.redAdd(o),ft=ot.redSub(_),lt=et.redSub(o),ht=rt.redMul(ft),vt=ot.redMul(lt),It=rt.redMul(lt),Qt=ft.redMul(ot);return this.curve.point(ht,vt,Qt,It)};Point.prototype._projDbl=function i(){var a=this.x.redAdd(this.y).redSqr(),o=this.x.redSqr(),_=this.y.redSqr(),et,rt,ot,ft,lt,ht;if(this.curve.twisted){ft=this.curve._mulA(o);var vt=ft.redAdd(_);this.zOne?(et=a.redSub(o).redSub(_).redMul(vt.redSub(this.curve.two)),rt=vt.redMul(ft.redSub(_)),ot=vt.redSqr().redSub(vt).redSub(vt)):(lt=this.z.redSqr(),ht=vt.redSub(lt).redISub(lt),et=a.redSub(o).redISub(_).redMul(ht),rt=vt.redMul(ft.redSub(_)),ot=vt.redMul(ht))}else ft=o.redAdd(_),lt=this.curve._mulC(this.z).redSqr(),ht=ft.redSub(lt).redSub(lt),et=this.curve._mulC(a.redISub(ft)).redMul(ht),rt=this.curve._mulC(ft).redMul(o.redISub(_)),ot=ft.redMul(ht);return this.curve.point(et,rt,ot)};Point.prototype.dbl=function i(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function i(a){var o=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),_=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),rt=this.z.redMul(a.z.redAdd(a.z)),ot=_.redSub(o),ft=rt.redSub(et),lt=rt.redAdd(et),ht=_.redAdd(o),vt=ot.redMul(ft),It=lt.redMul(ht),Qt=ot.redMul(ht),mt=ft.redMul(lt);return this.curve.point(vt,It,mt,Qt)};Point.prototype._projAdd=function i(a){var o=this.z.redMul(a.z),_=o.redSqr(),et=this.x.redMul(a.x),rt=this.y.redMul(a.y),ot=this.curve.d.redMul(et).redMul(rt),ft=_.redSub(ot),lt=_.redAdd(ot),ht=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(rt),vt=o.redMul(ft).redMul(ht),It,Qt;return this.curve.twisted?(It=o.redMul(lt).redMul(rt.redSub(this.curve._mulA(et))),Qt=ft.redMul(lt)):(It=o.redMul(lt).redMul(rt.redSub(et)),Qt=this.curve._mulC(ft).redMul(lt)),this.curve.point(vt,It,Qt)};Point.prototype.add=function i(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point.prototype.mul=function i(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point.prototype.mulAdd=function i(a,o,_){return this.curve._wnafMulAdd(1,[this,o],[a,_],2,!1)};Point.prototype.jmulAdd=function i(a,o,_){return this.curve._wnafMulAdd(1,[this,o],[a,_],2,!0)};Point.prototype.normalize=function i(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function i(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function i(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function i(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function i(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point.prototype.eqXToP=function i(a){var o=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(o)===0)return!0;for(var _=a.clone(),et=this.curve.redN.redMul(this.z);;){if(_.iadd(this.curve.n),_.cmp(this.curve.p)>=0)return!1;if(o.redIAdd(et),this.x.cmp(o)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(i){var a=i;a.base=base,a.short=short,a.mont=mont,a.edwards=edwards})(curve);var curves$2={},secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1}(function(i){var a=i,o=hash$4,_=curve,et=utils$c,rt=et.assert;function ot(ht){ht.type==="short"?this.curve=new _.short(ht):ht.type==="edwards"?this.curve=new _.edwards(ht):this.curve=new _.mont(ht),this.g=this.curve.g,this.n=this.curve.n,this.hash=ht.hash,rt(this.g.validate(),"Invalid curve"),rt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=ot;function ft(ht,vt){Object.defineProperty(a,ht,{configurable:!0,enumerable:!0,get:function(){var It=new ot(vt);return Object.defineProperty(a,ht,{configurable:!0,enumerable:!0,value:It}),It}})}ft("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),ft("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),ft("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),ft("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),ft("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),ft("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),ft("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var lt;try{lt=requireSecp256k1()}catch{lt=void 0}ft("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",lt]})})(curves$2);var hash$2=hash$4,utils$6=utils$b,assert$6=minimalisticAssert$1;function HmacDRBG$1(i){if(!(this instanceof HmacDRBG$1))return new HmacDRBG$1(i);this.hash=i.hash,this.predResist=!!i.predResist,this.outLen=this.hash.outSize,this.minEntropy=i.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=utils$6.toArray(i.entropy,i.entropyEnc||"hex"),o=utils$6.toArray(i.nonce,i.nonceEnc||"hex"),_=utils$6.toArray(i.pers,i.persEnc||"hex");assert$6(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,o,_)}var hmacDrbg=HmacDRBG$1;HmacDRBG$1.prototype._init=function i(a,o,_){var et=a.concat(o).concat(_);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var rt=0;rt<this.V.length;rt++)this.K[rt]=0,this.V[rt]=1;this._update(et),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG$1.prototype._hmac=function i(){return new hash$2.hmac(this.hash,this.K)};HmacDRBG$1.prototype._update=function i(a){var o=this._hmac().update(this.V).update([0]);a&&(o=o.update(a)),this.K=o.digest(),this.V=this._hmac().update(this.V).digest(),a&&(this.K=this._hmac().update(this.V).update([1]).update(a).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG$1.prototype.reseed=function i(a,o,_,et){typeof o!="string"&&(et=_,_=o,o=null),a=utils$6.toArray(a,o),_=utils$6.toArray(_,et),assert$6(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(_||[])),this._reseed=1};HmacDRBG$1.prototype.generate=function i(a,o,_,et){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(et=_,_=o,o=null),_&&(_=utils$6.toArray(_,et||"hex"),this._update(_));for(var rt=[];rt.length<a;)this.V=this._hmac().update(this.V).digest(),rt=rt.concat(this.V);var ot=rt.slice(0,a);return this._update(_),this._reseed++,utils$6.encode(ot,o)};var BN$3=bnExports,utils$5=utils$c,assert$5=utils$5.assert;function KeyPair$3(i,a){this.ec=i,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function i(a,o,_){return o instanceof KeyPair$3?o:new KeyPair$3(a,{pub:o,pubEnc:_})};KeyPair$3.fromPrivate=function i(a,o,_){return o instanceof KeyPair$3?o:new KeyPair$3(a,{priv:o,privEnc:_})};KeyPair$3.prototype.validate=function i(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$3.prototype.getPublic=function i(a,o){return typeof a=="string"&&(o=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),o?this.pub.encode(o,a):this.pub};KeyPair$3.prototype.getPrivate=function i(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$3.prototype._importPrivate=function i(a,o){this.priv=new BN$3(a,o||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$3.prototype._importPublic=function i(a,o){if(a.x||a.y){this.ec.curve.type==="mont"?assert$5(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$5(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,o)};KeyPair$3.prototype.derive=function i(a){return a.validate()||assert$5(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$3.prototype.sign=function i(a,o,_){return this.ec.sign(a,this,o,_)};KeyPair$3.prototype.verify=function i(a,o){return this.ec.verify(a,o,this)};KeyPair$3.prototype.inspect=function i(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$2=bnExports,utils$4=utils$c,assert$4=utils$4.assert;function Signature$3(i,a){if(i instanceof Signature$3)return i;this._importDER(i,a)||(assert$4(i.r&&i.s,"Signature without r or s"),this.r=new BN$2(i.r,16),this.s=new BN$2(i.s,16),i.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=i.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(i,a){var o=i[a.place++];if(!(o&128))return o;var _=o&15;if(_===0||_>4)return!1;for(var et=0,rt=0,ot=a.place;rt<_;rt++,ot++)et<<=8,et|=i[ot],et>>>=0;return et<=127?!1:(a.place=ot,et)}function rmPadding(i){for(var a=0,o=i.length-1;!i[a]&&!(i[a+1]&128)&&a<o;)a++;return a===0?i:i.slice(a)}Signature$3.prototype._importDER=function i(a,o){a=utils$4.toArray(a,o);var _=new Position;if(a[_.place++]!==48)return!1;var et=getLength(a,_);if(et===!1||et+_.place!==a.length||a[_.place++]!==2)return!1;var rt=getLength(a,_);if(rt===!1)return!1;var ot=a.slice(_.place,rt+_.place);if(_.place+=rt,a[_.place++]!==2)return!1;var ft=getLength(a,_);if(ft===!1||a.length!==ft+_.place)return!1;var lt=a.slice(_.place,ft+_.place);if(ot[0]===0)if(ot[1]&128)ot=ot.slice(1);else return!1;if(lt[0]===0)if(lt[1]&128)lt=lt.slice(1);else return!1;return this.r=new BN$2(ot),this.s=new BN$2(lt),this.recoveryParam=null,!0};function constructLength(i,a){if(a<128){i.push(a);return}var o=1+(Math.log(a)/Math.LN2>>>3);for(i.push(o|128);--o;)i.push(a>>>(o<<3)&255);i.push(a)}Signature$3.prototype.toDER=function i(a){var o=this.r.toArray(),_=this.s.toArray();for(o[0]&128&&(o=[0].concat(o)),_[0]&128&&(_=[0].concat(_)),o=rmPadding(o),_=rmPadding(_);!_[0]&&!(_[1]&128);)_=_.slice(1);var et=[2];constructLength(et,o.length),et=et.concat(o),et.push(2),constructLength(et,_.length);var rt=et.concat(_),ot=[48];return constructLength(ot,rt.length),ot=ot.concat(rt),utils$4.encode(ot,a)};var BN$1=bnExports,HmacDRBG=hmacDrbg,utils$3=utils$c,curves$1=curves$2,rand=brorandExports,assert$3=utils$3.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC$1(i){if(!(this instanceof EC$1))return new EC$1(i);typeof i=="string"&&(assert$3(Object.prototype.hasOwnProperty.call(curves$1,i),"Unknown curve "+i),i=curves$1[i]),i instanceof curves$1.PresetCurve&&(i={curve:i}),this.curve=i.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=i.curve.g,this.g.precompute(i.curve.n.bitLength()+1),this.hash=i.hash||i.curve.hash}var ec=EC$1;EC$1.prototype.keyPair=function i(a){return new KeyPair$2(this,a)};EC$1.prototype.keyFromPrivate=function i(a,o){return KeyPair$2.fromPrivate(this,a,o)};EC$1.prototype.keyFromPublic=function i(a,o){return KeyPair$2.fromPublic(this,a,o)};EC$1.prototype.genKeyPair=function i(a){a||(a={});for(var o=new HmacDRBG({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),_=this.n.byteLength(),et=this.n.sub(new BN$1(2));;){var rt=new BN$1(o.generate(_));if(!(rt.cmp(et)>0))return rt.iaddn(1),this.keyFromPrivate(rt)}};EC$1.prototype._truncateToN=function i(a,o){var _=a.byteLength()*8-this.n.bitLength();return _>0&&(a=a.ushrn(_)),!o&&a.cmp(this.n)>=0?a.sub(this.n):a};EC$1.prototype.sign=function i(a,o,_,et){typeof _=="object"&&(et=_,_=null),et||(et={}),o=this.keyFromPrivate(o,_),a=this._truncateToN(new BN$1(a,16));for(var rt=this.n.byteLength(),ot=o.getPrivate().toArray("be",rt),ft=a.toArray("be",rt),lt=new HmacDRBG({hash:this.hash,entropy:ot,nonce:ft,pers:et.pers,persEnc:et.persEnc||"utf8"}),ht=this.n.sub(new BN$1(1)),vt=0;;vt++){var It=et.k?et.k(vt):new BN$1(lt.generate(this.n.byteLength()));if(It=this._truncateToN(It,!0),!(It.cmpn(1)<=0||It.cmp(ht)>=0)){var Qt=this.g.mul(It);if(!Qt.isInfinity()){var mt=Qt.getX(),Yt=mt.umod(this.n);if(Yt.cmpn(0)!==0){var Rt=It.invm(this.n).mul(Yt.mul(o.getPrivate()).iadd(a));if(Rt=Rt.umod(this.n),Rt.cmpn(0)!==0){var cr=(Qt.getY().isOdd()?1:0)|(mt.cmp(Yt)!==0?2:0);return et.canonical&&Rt.cmp(this.nh)>0&&(Rt=this.n.sub(Rt),cr^=1),new Signature$2({r:Yt,s:Rt,recoveryParam:cr})}}}}}};EC$1.prototype.verify=function i(a,o,_,et){a=this._truncateToN(new BN$1(a,16)),_=this.keyFromPublic(_,et),o=new Signature$2(o,"hex");var rt=o.r,ot=o.s;if(rt.cmpn(1)<0||rt.cmp(this.n)>=0||ot.cmpn(1)<0||ot.cmp(this.n)>=0)return!1;var ft=ot.invm(this.n),lt=ft.mul(a).umod(this.n),ht=ft.mul(rt).umod(this.n),vt;return this.curve._maxwellTrick?(vt=this.g.jmulAdd(lt,_.getPublic(),ht),vt.isInfinity()?!1:vt.eqXToP(rt)):(vt=this.g.mulAdd(lt,_.getPublic(),ht),vt.isInfinity()?!1:vt.getX().umod(this.n).cmp(rt)===0)};EC$1.prototype.recoverPubKey=function(i,a,o,_){assert$3((3&o)===o,"The recovery param is more than two bits"),a=new Signature$2(a,_);var et=this.n,rt=new BN$1(i),ot=a.r,ft=a.s,lt=o&1,ht=o>>1;if(ot.cmp(this.curve.p.umod(this.curve.n))>=0&&ht)throw new Error("Unable to find sencond key candinate");ht?ot=this.curve.pointFromX(ot.add(this.curve.n),lt):ot=this.curve.pointFromX(ot,lt);var vt=a.r.invm(et),It=et.sub(rt).mul(vt).umod(et),Qt=ft.mul(vt).umod(et);return this.g.mulAdd(It,ot,Qt)};EC$1.prototype.getKeyRecoveryParam=function(i,a,o,_){if(a=new Signature$2(a,_),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var rt;try{rt=this.recoverPubKey(i,a,et)}catch{continue}if(rt.eq(o))return et}throw new Error("Unable to find valid recovery factor")};var utils$2=utils$c,assert$2=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(i,a){this.eddsa=i,this._secret=parseBytes$2(a.secret),i.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$2(a.pub)}KeyPair$1.fromPublic=function i(a,o){return o instanceof KeyPair$1?o:new KeyPair$1(a,{pub:o})};KeyPair$1.fromSecret=function i(a,o){return o instanceof KeyPair$1?o:new KeyPair$1(a,{secret:o})};KeyPair$1.prototype.secret=function i(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function i(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function i(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function i(){var a=this.eddsa,o=this.hash(),_=a.encodingLength-1,et=o.slice(0,a.encodingLength);return et[0]&=248,et[_]&=127,et[_]|=64,et});cachedProperty$1(KeyPair$1,"priv",function i(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function i(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function i(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function i(a){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$1.prototype.verify=function i(a,o){return this.eddsa.verify(a,o,this)};KeyPair$1.prototype.getSecret=function i(a){return assert$2(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),a)};KeyPair$1.prototype.getPublic=function i(a){return utils$2.encode(this.pubBytes(),a)};var key=KeyPair$1,BN=bnExports,utils$1=utils$c,assert$1=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$1(i,a){this.eddsa=i,typeof a!="object"&&(a=parseBytes$1(a)),Array.isArray(a)&&(a={R:a.slice(0,i.encodingLength),S:a.slice(i.encodingLength)}),assert$1(a.R&&a.S,"Signature without R or S"),i.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty(Signature$1,"S",function i(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function i(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function i(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function i(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function i(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function i(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$4,curves=curves$2,utils=utils$c,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature=signature;function EDDSA(i){if(assert(i==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(i);i=curves[i].curve,this.curve=i,this.g=i.g,this.g.precompute(i.n.bitLength()+1),this.pointClass=i.point().constructor,this.encodingLength=Math.ceil(i.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function i(a,o){a=parseBytes(a);var _=this.keyFromSecret(o),et=this.hashInt(_.messagePrefix(),a),rt=this.g.mul(et),ot=this.encodePoint(rt),ft=this.hashInt(ot,_.pubBytes(),a).mul(_.priv()),lt=et.add(ft).umod(this.curve.n);return this.makeSignature({R:rt,S:lt,Rencoded:ot})};EDDSA.prototype.verify=function i(a,o,_){a=parseBytes(a),o=this.makeSignature(o);var et=this.keyFromPublic(_),rt=this.hashInt(o.Rencoded(),et.pubBytes(),a),ot=this.g.mul(o.S()),ft=o.R().add(et.pub().mul(rt));return ft.eq(ot)};EDDSA.prototype.hashInt=function i(){for(var a=this.hash(),o=0;o<arguments.length;o++)a.update(arguments[o]);return utils.intFromLE(a.digest()).umod(this.curve.n)};EDDSA.prototype.keyFromPublic=function i(a){return KeyPair.fromPublic(this,a)};EDDSA.prototype.keyFromSecret=function i(a){return KeyPair.fromSecret(this,a)};EDDSA.prototype.makeSignature=function i(a){return a instanceof Signature?a:new Signature(this,a)};EDDSA.prototype.encodePoint=function i(a){var o=a.getY().toArray("le",this.encodingLength);return o[this.encodingLength-1]|=a.getX().isOdd()?128:0,o};EDDSA.prototype.decodePoint=function i(a){a=utils.parseBytes(a);var o=a.length-1,_=a.slice(0,o).concat(a[o]&-129),et=(a[o]&128)!==0,rt=utils.intFromLE(_);return this.curve.pointFromY(rt,et)};EDDSA.prototype.encodeInt=function i(a){return a.toArray("le",this.encodingLength)};EDDSA.prototype.decodeInt=function i(a){return utils.intFromLE(a)};EDDSA.prototype.isPoint=function i(a){return a instanceof this.pointClass};(function(i){var a=i;a.version=require$$0.version,a.utils=utils$c,a.rand=brorandExports,a.curve=curve,a.curves=curves$2,a.ec=ec,a.eddsa=eddsa})(elliptic);const _ec=getDefaultExportFromCjs(elliptic);var __decorate$3=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata$3=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},Secp256k1PublicKey_1,Secp256k1PrivateKey_1,Secp256k1Keypair_1,EC=_ec.ec;let _curve,Secp256k1PublicKey=Secp256k1PublicKey_1=class extends PublicSignKey{constructor(o){super();En(this,"publicKey");if(o.publicKey.length!==33)throw new Error("Expecting key to have length 33");this.publicKey=o.publicKey}static async recover(o){const _=new Uint8Array([0]),et=await o.signMessage(_),rt=recoverPublicKeyFromSignature(await prehashFn(_,PreHash.ETH_KECCAK_256),et);return new Secp256k1PublicKey_1({publicKey:rt})}equals(o){return o instanceof Secp256k1PublicKey_1?equals(this.publicKey,o.publicKey):!1}toString(){return"sepc256k1/"+toHexString(this.publicKey)}static from(o){if(!o.publicKey)throw new Error("Missing public key");if(o.type==="secp256k1")return new Secp256k1PublicKey_1({publicKey:o.publicKey.slice(4)});throw new Error("Unsupported key type: "+o.type)}};__decorate$3([field({type:fixedArray("u8",33)}),__metadata$3("design:type",Uint8Array)],Secp256k1PublicKey.prototype,"publicKey",void 0);Secp256k1PublicKey=Secp256k1PublicKey_1=__decorate$3([variant(1),__metadata$3("design:paramtypes",[Object])],Secp256k1PublicKey);let Secp256k1PrivateKey=Secp256k1PrivateKey_1=class extends PrivateSignKey{constructor(o){super();En(this,"privateKey");if(o.privateKey.length!==32)throw new Error("Expecting key to have length 32");this.privateKey=o.privateKey}equals(o){return o instanceof Secp256k1PrivateKey_1?equals(this.privateKey,o.privateKey):!1}toString(){return"secp256k1s/"+toHexString(this.privateKey)}static from(o){if(!o.privateKey)throw new Error("Missing privateKey key");if(o.type==="secp256k1")return new Secp256k1PrivateKey_1({privateKey:coerce(o.privateKey.slice(4))});throw new Error("Unsupported key type: "+o.type)}};__decorate$3([field({type:Uint8Array}),__metadata$3("design:type",Uint8Array)],Secp256k1PrivateKey.prototype,"privateKey",void 0);Secp256k1PrivateKey=Secp256k1PrivateKey_1=__decorate$3([variant(1),__metadata$3("design:paramtypes",[Object])],Secp256k1PrivateKey);let Secp256k1Keypair=Secp256k1Keypair_1=class extends Keypair{constructor(o){super();En(this,"publicKey");En(this,"privateKey");En(this,"_wallet");this.privateKey=o.privateKey,this.publicKey=o.publicKey}static async create(){const o=await generateKeyPair("secp256k1");return new Secp256k1Keypair_1({publicKey:new Secp256k1PublicKey({publicKey:o.public.marshal()}),privateKey:new Secp256k1PrivateKey({privateKey:o.marshal()})})}async sign(o,_=PreHash.ETH_KECCAK_256){const et=await prehashFn(o,_),rt=joinSignature((this._wallet||(this._wallet=new Wallet(this.privateKey.privateKey)))._signingKey().signDigest(et)),ot=new Uint8Array(utf8$2.length(rt));return utf8$2.write(rt,ot,0),new SignatureWithKey({prehash:_,publicKey:this.publicKey,signature:ot})}equals(o){return o instanceof Secp256k1Keypair_1?this.publicKey.equals(o.publicKey)&&this.privateKey.equals(o.privateKey):!1}static fromPeerId(o){return new Secp256k1Keypair_1({privateKey:Secp256k1PrivateKey.from(o),publicKey:Secp256k1PublicKey.from(o)})}toPeerId(){return peerIdFromKeys(new supportedKeys.secp256k1.Secp256k1PublicKey(this.publicKey.publicKey).bytes,new supportedKeys.secp256k1.Secp256k1PrivateKey(this.privateKey.privateKey,this.publicKey.publicKey).bytes)}};__decorate$3([field({type:Secp256k1PublicKey}),__metadata$3("design:type",Secp256k1PublicKey)],Secp256k1Keypair.prototype,"publicKey",void 0);__decorate$3([field({type:Secp256k1PrivateKey}),__metadata$3("design:type",Secp256k1PrivateKey)],Secp256k1Keypair.prototype,"privateKey",void 0);Secp256k1Keypair=Secp256k1Keypair_1=__decorate$3([variant(2),__metadata$3("design:paramtypes",[Object])],Secp256k1Keypair);const decoder=new TextDecoder;function getCurve(){return _curve||(_curve=new EC("secp256k1")),_curve}const recoverPublicKeyFromSignature=(i,a)=>{const o=splitSignature(a),_={r:arrayify(o.r),s:arrayify(o.s)};return new Uint8Array(getCurve().recoverPubKey(arrayify(i),_,o.recoveryParam).encodeCompressed())},verifySignatureSecp256k1=async(i,a)=>{const o=await prehashFn(a,i.prehash),_=recoverPublicKeyFromSignature(arrayify(o),decoder.decode(i.signature));return equals(_,i.publicKey.publicKey)};var __decorate$2=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata$2=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)};let SignatureWithKey=class{constructor(a){En(this,"signature");En(this,"publicKey");En(this,"prehash",PreHash.NONE);a&&(this.signature=a.signature,this.publicKey=a.publicKey,this.prehash=a.prehash)}equals(a){return equals(this.signature,a.signature)?Buffer.compare(serialize$2(this.publicKey),serialize$2(a.publicKey))===0&&this.prehash==a.prehash:!1}};__decorate$2([field({type:Uint8Array}),__metadata$2("design:type",Uint8Array)],SignatureWithKey.prototype,"signature",void 0);__decorate$2([field({type:PublicSignKey}),__metadata$2("design:type",PublicSignKey)],SignatureWithKey.prototype,"publicKey",void 0);__decorate$2([field({type:"u8"}),__metadata$2("design:type",Number)],SignatureWithKey.prototype,"prehash",void 0);SignatureWithKey=__decorate$2([variant(0),__metadata$2("design:paramtypes",[Object])],SignatureWithKey);let MaybeSigned=class{constructor(a){En(this,"data");En(this,"signature");En(this,"_value");a&&(this.data=a.data,this.signature=a.signature,this._value=a.value)}getValue(a){return deserialize(this.data,a)}async verify(){return this.signature?verify(this.signature,this.data):!0}equals(a){return!equals(this.data,a.data)||!this.signature!=!a.signature?!1:this.signature&&a.signature?this.signature.equals(a.signature):!0}async sign(a){const o=await a(this.data);return this.signature=o,this}};__decorate$2([field({type:Uint8Array}),__metadata$2("design:type",Uint8Array)],MaybeSigned.prototype,"data",void 0);__decorate$2([field({type:option(SignatureWithKey)}),__metadata$2("design:type",SignatureWithKey)],MaybeSigned.prototype,"signature",void 0);MaybeSigned=__decorate$2([variant(0),__metadata$2("design:paramtypes",[Object])],MaybeSigned);const verify=async(i,a)=>i.publicKey instanceof Ed25519PublicKey?verifySignatureEd25519(i,a):i.publicKey instanceof Secp256k1PublicKey?verifySignatureSecp256k1(i,a):!1,sign=async(i,a,o)=>{const _=await prehashFn(i,o);return new SignatureWithKey({prehash:o,publicKey:a.publicKey,signature:sodium.crypto_sign_detached(_,a.privateKeyPublicKey)})},verifySignatureEd25519=async(i,a)=>{let o=!1;try{const _=await prehashFn(a,i.prehash);o=sodium.crypto_sign_verify_detached(i.signature,_,i.publicKey.publicKey)}catch{return!1}return o};var __decorate$1=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata$1=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},Ed25519PublicKey_1,Ed25519PrivateKey_1,Ed25519Keypair_1;let Ed25519PublicKey=Ed25519PublicKey_1=class extends PublicSignKey{constructor(o){super();En(this,"publicKey");if(this.publicKey=o.publicKey,o.publicKey.length!==32)throw new Error("Expecting key to have length 32")}equals(o){return o instanceof Ed25519PublicKey_1?equals(this.publicKey,o.publicKey):!1}toString(){return"ed25119p/"+toHexString(this.publicKey)}toPeerId(){return peerIdFromKeys(new supportedKeys.ed25519.Ed25519PublicKey(this.publicKey).bytes)}static fromPeerId(o){if(!o.publicKey)throw new Error("Missing public key");if(o.type==="Ed25519")return new Ed25519PublicKey_1({publicKey:coerce(o.publicKey.slice(4))});throw new Error("Unsupported key type: "+o.type)}};__decorate$1([field({type:fixedArray("u8",32)}),__metadata$1("design:type",Uint8Array)],Ed25519PublicKey.prototype,"publicKey",void 0);Ed25519PublicKey=Ed25519PublicKey_1=__decorate$1([variant(0),__metadata$1("design:paramtypes",[Object])],Ed25519PublicKey);let Ed25519PrivateKey=Ed25519PrivateKey_1=class extends PrivateSignKey{constructor(o){super();En(this,"privateKey");En(this,"keyObject");if(o.privateKey.length!==32)throw new Error("Expecting key to have length 32");this.privateKey=o.privateKey}equals(o){return o instanceof Ed25519PrivateKey_1?equals(this.privateKey,o.privateKey):!1}toString(){return"ed25119s/"+toHexString(this.privateKey)}static fromPeerID(o){if(!o.privateKey)throw new Error("Missing privateKey key");if(o.type==="Ed25519")return new Ed25519PrivateKey_1({privateKey:coerce(o.privateKey.slice(4,36))});throw new Error("Unsupported key type: "+o.type)}};__decorate$1([field({type:fixedArray("u8",32)}),__metadata$1("design:type",Uint8Array)],Ed25519PrivateKey.prototype,"privateKey",void 0);Ed25519PrivateKey=Ed25519PrivateKey_1=__decorate$1([variant(0),__metadata$1("design:paramtypes",[Object])],Ed25519PrivateKey);let Ed25519Keypair=Ed25519Keypair_1=class extends Keypair{constructor(o){super();En(this,"publicKey");En(this,"privateKey");En(this,"_privateKeyPublicKey");this.privateKey=o.privateKey,this.publicKey=o.publicKey}static async create(){await sodium.ready;const o=sodium.crypto_sign_keypair();return new Ed25519Keypair_1({publicKey:new Ed25519PublicKey({publicKey:o.publicKey}),privateKey:new Ed25519PrivateKey({privateKey:o.privateKey.slice(0,32)})})}sign(o,_=PreHash.NONE){return sign(o,this,_)}signer(o){return async _=>this.sign(_,o)}equals(o){return o instanceof Ed25519Keypair_1?this.publicKey.equals(o.publicKey)&&this.privateKey.equals(o.privateKey):!1}static fromPeerId(o){return new Ed25519Keypair_1({privateKey:Ed25519PrivateKey.fromPeerID(o),publicKey:Ed25519PublicKey.fromPeerId(o)})}get privateKeyPublicKey(){return this._privateKeyPublicKey||(this._privateKeyPublicKey=concat$1([this.privateKey.privateKey,this.publicKey.publicKey]))}toPeerId(){return peerIdFromKeys(new supportedKeys.ed25519.Ed25519PublicKey(this.publicKey.publicKey).bytes,new supportedKeys.ed25519.Ed25519PrivateKey(this.privateKeyPublicKey,this.publicKey.publicKey).bytes)}};__decorate$1([field({type:Ed25519PublicKey}),__metadata$1("design:type",Ed25519PublicKey)],Ed25519Keypair.prototype,"publicKey",void 0);__decorate$1([field({type:Ed25519PrivateKey}),__metadata$1("design:type",Ed25519PrivateKey)],Ed25519Keypair.prototype,"privateKey",void 0);Ed25519Keypair=Ed25519Keypair_1=__decorate$1([variant(0),__metadata$1("design:paramtypes",[Object])],Ed25519Keypair);const getPublicKeyFromPeerId=i=>{if(i.type==="Ed25519")return Ed25519PublicKey.fromPeerId(i);if(i.type==="secp256k1")return Secp256k1PublicKey.from(i);throw new Error("Unsupported key type")},MAX_PROTOTYPE_SEARCH=500,PROTOTYPE_DESERIALIZATION_HANDLER_OFFSET=500,PROTOTYPE_DEPENDENCY_HANDLER_OFFSET=PROTOTYPE_DESERIALIZATION_HANDLER_OFFSET+MAX_PROTOTYPE_SEARCH,getDependencies=(i,a)=>i.prototype[PROTOTYPE_DEPENDENCY_HANDLER_OFFSET+a],getSchemasBottomUp=i=>{var _;let a;const o=[];for(let et=0;et<1e3;et++){const rt=getSchema(i,et);if(rt)o.push(rt),a=rt;else if(a&&!((_=getDependencies(i,et))!=null&&_.length))return o}return o},getValuesWithType=(i,a,o)=>{const _=getSchemasBottomUp(i.constructor),et=[];for(const rt of _)for(const ot of rt.fields){const ft=i[ot.key];if(!ft)continue;const lt=ht=>{if(ht&&ht instanceof a)et.push(ht);else if(typeof ht=="object"){if(o&&ht instanceof o)return;getValuesWithType(ht,a,o).forEach(It=>{et.push(It)})}};if(Array.isArray(ft))for(const ht of ft)lt(ht);else lt(ft)}return et};var Mo,pA;let EventEmitter$1=(pA=class extends EventTarget{constructor(){super(...arguments);ps(this,Mo,new Map)}listenerCount(o){const _=fo(this,Mo).get(o);return _==null?0:_.length}addEventListener(o,_,et){super.addEventListener(o,_,et);let rt=fo(this,Mo).get(o);rt==null&&(rt=[],fo(this,Mo).set(o,rt)),rt.push({callback:_,once:(et!==!0&&et!==!1&&(et==null?void 0:et.once))??!1})}removeEventListener(o,_,et){super.removeEventListener(o.toString(),_??null,et);let rt=fo(this,Mo).get(o);rt!=null&&(rt=rt.filter(({callback:ot})=>ot!==_),fo(this,Mo).set(o,rt))}dispatchEvent(o){const _=super.dispatchEvent(o);let et=fo(this,Mo).get(o.type);return et==null||(et=et.filter(({once:rt})=>!rt),fo(this,Mo).set(o.type,et)),_}safeDispatchEvent(o,_){return this.dispatchEvent(new CustomEvent(o,_))}},Mo=new WeakMap,pA);class CustomEventPolyfill extends Event{constructor(o,_){super(o,_);En(this,"detail");this.detail=_==null?void 0:_.detail}}const CustomEvent=globalThis.CustomEvent??CustomEventPolyfill;class TimeoutError extends Error{constructor(a){super(a)}}const delay=(i,a)=>new Promise(o=>{const _=setTimeout(o,i);a!=null&&a.stopperCallback&&(a==null||a.stopperCallback(()=>{clearTimeout(_),o()}))}),waitForAsync=async(i,a={timeout:10*1e3,delayInterval:50})=>{const o=+new Date;let _=!1;if(a.stopperCallback){const et=()=>{_=!0};a.stopperCallback(et)}for(;+new Date-o<a.timeout;){if(_)return;const et=await i();if(et)return et;await delay(a.delayInterval,a)}throw new TimeoutError(a.timeoutMessage?"Timed out: "+a.timeoutMessage:"Timed out")};var events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function i(a,o,_){return Function.prototype.apply.call(a,o,_)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:ReflectOwnKeys=function(a){return Object.getOwnPropertyNames(a)};function ProcessEmitWarning(i){console&&console.warn&&console.warn(i)}var NumberIsNaN=Number.isNaN||function i(a){return a!==a};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(i){if(typeof i!="number"||i<0||NumberIsNaN(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");defaultMaxListeners=i}});EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};EventEmitter.prototype.setMaxListeners=function i(a){if(typeof a!="number"||a<0||NumberIsNaN(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function _getMaxListeners(i){return i._maxListeners===void 0?EventEmitter.defaultMaxListeners:i._maxListeners}EventEmitter.prototype.getMaxListeners=function i(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function i(a){for(var o=[],_=1;_<arguments.length;_++)o.push(arguments[_]);var et=a==="error",rt=this._events;if(rt!==void 0)et=et&&rt.error===void 0;else if(!et)return!1;if(et){var ot;if(o.length>0&&(ot=o[0]),ot instanceof Error)throw ot;var ft=new Error("Unhandled error."+(ot?" ("+ot.message+")":""));throw ft.context=ot,ft}var lt=rt[a];if(lt===void 0)return!1;if(typeof lt=="function")ReflectApply(lt,this,o);else for(var ht=lt.length,vt=arrayClone(lt,ht),_=0;_<ht;++_)ReflectApply(vt[_],this,o);return!0};function _addListener(i,a,o,_){var et,rt,ot;if(checkListener(o),rt=i._events,rt===void 0?(rt=i._events=Object.create(null),i._eventsCount=0):(rt.newListener!==void 0&&(i.emit("newListener",a,o.listener?o.listener:o),rt=i._events),ot=rt[a]),ot===void 0)ot=rt[a]=o,++i._eventsCount;else if(typeof ot=="function"?ot=rt[a]=_?[o,ot]:[ot,o]:_?ot.unshift(o):ot.push(o),et=_getMaxListeners(i),et>0&&ot.length>et&&!ot.warned){ot.warned=!0;var ft=new Error("Possible EventEmitter memory leak detected. "+ot.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");ft.name="MaxListenersExceededWarning",ft.emitter=i,ft.type=a,ft.count=ot.length,ProcessEmitWarning(ft)}return i}EventEmitter.prototype.addListener=function i(a,o){return _addListener(this,a,o,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function i(a,o){return _addListener(this,a,o,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(i,a,o){var _={fired:!1,wrapFn:void 0,target:i,type:a,listener:o},et=onceWrapper.bind(_);return et.listener=o,_.wrapFn=et,et}EventEmitter.prototype.once=function i(a,o){return checkListener(o),this.on(a,_onceWrap(this,a,o)),this};EventEmitter.prototype.prependOnceListener=function i(a,o){return checkListener(o),this.prependListener(a,_onceWrap(this,a,o)),this};EventEmitter.prototype.removeListener=function i(a,o){var _,et,rt,ot,ft;if(checkListener(o),et=this._events,et===void 0)return this;if(_=et[a],_===void 0)return this;if(_===o||_.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete et[a],et.removeListener&&this.emit("removeListener",a,_.listener||o));else if(typeof _!="function"){for(rt=-1,ot=_.length-1;ot>=0;ot--)if(_[ot]===o||_[ot].listener===o){ft=_[ot].listener,rt=ot;break}if(rt<0)return this;rt===0?_.shift():spliceOne(_,rt),_.length===1&&(et[a]=_[0]),et.removeListener!==void 0&&this.emit("removeListener",a,ft||o)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function i(a){var o,_,et;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[a]),this;if(arguments.length===0){var rt=Object.keys(_),ot;for(et=0;et<rt.length;++et)ot=rt[et],ot!=="removeListener"&&this.removeAllListeners(ot);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=_[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(et=o.length-1;et>=0;et--)this.removeListener(a,o[et]);return this};function _listeners(i,a,o){var _=i._events;if(_===void 0)return[];var et=_[a];return et===void 0?[]:typeof et=="function"?o?[et.listener||et]:[et]:o?unwrapListeners(et):arrayClone(et,et.length)}EventEmitter.prototype.listeners=function i(a){return _listeners(this,a,!0)};EventEmitter.prototype.rawListeners=function i(a){return _listeners(this,a,!1)};EventEmitter.listenerCount=function(i,a){return typeof i.listenerCount=="function"?i.listenerCount(a):listenerCount.call(i,a)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(i){var a=this._events;if(a!==void 0){var o=a[i];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}EventEmitter.prototype.eventNames=function i(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(i,a){for(var o=new Array(a),_=0;_<a;++_)o[_]=i[_];return o}function spliceOne(i,a){for(;a+1<i.length;a++)i[a]=i[a+1];i.pop()}function unwrapListeners(i){for(var a=new Array(i.length),o=0;o<a.length;++o)a[o]=i[o].listener||i[o];return a}function once(i,a){return new Promise(function(o,_){function et(ot){i.removeListener(a,rt),_(ot)}function rt(){typeof i.removeListener=="function"&&i.removeListener("error",et),o([].slice.call(arguments))}eventTargetAgnosticAddListener(i,a,rt,{once:!0}),a!=="error"&&addErrorHandlerIfEventEmitter(i,et,{once:!0})})}function addErrorHandlerIfEventEmitter(i,a,o){typeof i.on=="function"&&eventTargetAgnosticAddListener(i,"error",a,o)}function eventTargetAgnosticAddListener(i,a,o,_){if(typeof i.on=="function")_.once?i.once(a,o):i.on(a,o);else if(typeof i.addEventListener=="function")i.addEventListener(a,function et(rt){_.once&&i.removeEventListener(a,et),o(rt)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}var eventsExports=events.exports,__decorate=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},AbstractProgram_1,Program_1;eventsExports.setMaxListeners(1/0);const intersection=(i,a)=>{const o=new Set;for(const _ of a)(!i||i.has(_))&&o.add(_);return o},getAllParentAddresses=i=>getAllParent(i,[]).filter(a=>a instanceof Program).map(a=>a.address),getAllParent=(i,a=[],o=!1)=>{if(o&&a.push(i),i.parents)for(const _ of i.parents)_&&getAllParent(_,a,!0);return a};let AbstractProgram=AbstractProgram_1=class{constructor(){En(this,"_node");En(this,"_allPrograms");En(this,"_events");En(this,"_closed");En(this,"parents");En(this,"children");En(this,"_eventOptions");En(this,"_subscriptionEventListener");En(this,"_unsubscriptionEventListener")}addParent(a){(this.parents||(this.parents=[])).push(a),a&&(a.children||(a.children=[])).push(this)}get events(){return this._events||(this._events=new EventEmitter$1)}get closed(){return this._closed==null?!0:this._closed}set closed(a){this._closed=a}get node(){return this._node}set node(a){this._node=a}async beforeOpen(a,o){if(this.closed)this.addParent(o==null?void 0:o.parent);else return this.addParent(o==null?void 0:o.parent),this;this._eventOptions=o,this.node=a;const _=this.programs;for(const et of _)await et.beforeOpen(a,{...o,parent:this});return this.node.services.pubsub.addEventListener("subscribe",this._subscriptionEventListener||(this._subscriptionEventListener=et=>!this.closed&&this._emitJoinNetworkEvents(et.detail))),this.node.services.pubsub.addEventListener("unsubscribe",this._unsubscriptionEventListener||(this._unsubscriptionEventListener=et=>!this.closed&&this._emitLeaveNetworkEvents(et.detail))),this}async afterOpen(){var o,_;this.emitEvent(new CustomEvent("open",{detail:this}),!0),(_=(o=this._eventOptions)==null?void 0:o.onOpen)==null||_.call(o,this),this.closed=!1;const a=this.programs;for(const et of a)await et.afterOpen();return this}_clear(){this._allPrograms=void 0}async _emitJoinNetworkEvents(a){var _;const o=this.programs.map(et=>{var rt;return(rt=et.getTopics)==null?void 0:rt.call(et)}).filter(et=>et).flat();for(const et of o)if(!((_=this.node.services.pubsub.getSubscribers(et))!=null&&_.has(a.from.hashcode())))return;this.events.dispatchEvent(new CustomEvent("join",{detail:a.from}))}async _emitLeaveNetworkEvents(a){var _;const o=this.programs.map(et=>{var rt;return(rt=et.getTopics)==null?void 0:rt.call(et)}).filter(et=>et).flat();for(const et of o)if((_=this.node.services.pubsub.getSubscribers(et))!=null&&_.has(a.from.hashcode()))return;this.events.dispatchEvent(new CustomEvent("leave",{detail:a.from}))}async _end(a){var o,_,et,rt;if(this.closed)return this._clear(),!0;{if(this.emitEvent(new CustomEvent(a,{detail:this}),!0),a==="close")(_=(o=this._eventOptions)==null?void 0:o.onClose)==null||_.call(o,this);else if(a==="drop")(rt=(et=this._eventOptions)==null?void 0:et.onDrop)==null||rt.call(et,this);else throw new Error("Unsupported event type: "+a);const ot=[];if(this.children){for(const ft of this.children)ot.push(ft[a](this));this.children=[]}return await Promise.all(ot),this._clear(),this.closed=!0,!0}}async close(a){var rt,ot;if(this.closed)return!0;let o=-1,_=!0;if(this.parents){if(o=this.parents.findIndex(ft=>ft==a),o!==-1)this.parents.length===1?_=!0:(this.parents.splice(o,1),_=!1);else if(a)throw new Error("Could not find from in parents")}const et=_&&await this._end("close");return et&&((rt=this.node)==null||rt.services.pubsub.removeEventListener("subscribe",this._subscriptionEventListener),(ot=this.node)==null||ot.services.pubsub.removeEventListener("unsubscribe",this._unsubscriptionEventListener),this._eventOptions=void 0,o!==-1&&this.parents.splice(o,1)),et}async drop(){await this._end("drop")}emitEvent(a,o=!1){if(this.events.dispatchEvent(a),o&&this.parents)for(const _ of this.parents)_==null||_.emitEvent(a)}async waitFor(...a){const o=new Set(a.map(_=>_ instanceof PublicSignKey?_.hashcode():getPublicKeyFromPeerId(_).hashcode()));await waitForAsync(async()=>intersection(o,await this.getReady()).size===o.size,{delayInterval:200,timeout:10*1e3})}async getReady(){let a;for(const o of this.allPrograms)if(o.getTopics){const _=o.getTopics();for(const et of _){const rt=await this.node.services.pubsub.getSubscribers(et);if(!rt)throw new Error("client is not subscriber to topic data, do not have any info about peer readiness");a=intersection(a,rt.keys())}}if(a==null)throw new Error("Do not have any info about peer readiness");return a}get allPrograms(){if(this._allPrograms)return this._allPrograms;const a=this.programs,o=this.programs;for(const _ of o)a.push(..._.allPrograms);return this._allPrograms=a,this._allPrograms}get programs(){return getValuesWithType(this,AbstractProgram_1)}clone(){return deserialize(serialize$2(this),this.constructor)}};AbstractProgram=AbstractProgram_1=__decorate([variant(0)],AbstractProgram);let Program=Program_1=class extends AbstractProgram{constructor(){super();En(this,"_address")}get address(){if(!this._address)throw new Error("Address does not exist, please open or save this program once to obtain it");return this._address}set address(o){this._address=o}async beforeOpen(o,_){const et=getSchema(this.constructor);if(!et||typeof et.variant!="string")throw new Error(`Expecting class to be decorated with a string variant. Example:
|
|
64
|
+
`)}static register(a,o){o||(o=a.locale)}}const words="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo";let wordlist=null;function loadWords(i){if(wordlist==null&&(wordlist=words.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Wordlist.check(i)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw wordlist=null,new Error("BIP39 Wordlist for en (English) FAILED")}class LangEn extends Wordlist{constructor(){super("en")}getWord(a){return loadWords(this),wordlist[a]}getWordIndex(a){return loadWords(this),wordlist.indexOf(a)}}const langEn=new LangEn;Wordlist.register(langEn);const wordlists={en:langEn},version$4="hdnode/5.7.0",logger$4=new Logger(version$4),N=BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),MasterSecret=toUtf8Bytes("Bitcoin seed"),HardenedBit=2147483648;function getUpperMask(i){return(1<<i)-1<<8-i}function getLowerMask(i){return(1<<i)-1}function bytes32(i){return hexZeroPad(hexlify(i),32)}function base58check(i){return Base58.encode(concat([i,hexDataSlice(sha256(sha256(i)),0,4)]))}function getWordlist(i){if(i==null)return wordlists.en;if(typeof i=="string"){const a=wordlists[i];return a==null&&logger$4.throwArgumentError("unknown locale","wordlist",i),a}return i}const _constructorGuard={},defaultPath="m/44'/60'/0'/0/0";class HDNode{constructor(a,o,_,et,rt,ot,ft,lt){if(a!==_constructorGuard)throw new Error("HDNode constructor cannot be called directly");if(o){const ht=new SigningKey(o);defineReadOnly(this,"privateKey",ht.privateKey),defineReadOnly(this,"publicKey",ht.compressedPublicKey)}else defineReadOnly(this,"privateKey",null),defineReadOnly(this,"publicKey",hexlify(_));defineReadOnly(this,"parentFingerprint",et),defineReadOnly(this,"fingerprint",hexDataSlice(ripemd160(sha256(this.publicKey)),0,4)),defineReadOnly(this,"address",computeAddress(this.publicKey)),defineReadOnly(this,"chainCode",rt),defineReadOnly(this,"index",ot),defineReadOnly(this,"depth",ft),lt==null?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",null)):typeof lt=="string"?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",lt)):(defineReadOnly(this,"mnemonic",lt),defineReadOnly(this,"path",lt.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return base58check(concat([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",hexlify(this.depth),this.parentFingerprint,hexZeroPad(hexlify(this.index),4),this.chainCode,this.privateKey!=null?concat(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new HDNode(_constructorGuard,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(a){if(a>4294967295)throw new Error("invalid index - "+String(a));let o=this.path;o&&(o+="/"+(a&~HardenedBit));const _=new Uint8Array(37);if(a&HardenedBit){if(!this.privateKey)throw new Error("cannot derive child of neutered node");_.set(arrayify(this.privateKey),1),o&&(o+="'")}else _.set(arrayify(this.publicKey));for(let It=24;It>=0;It-=8)_[33+(It>>3)]=a>>24-It&255;const et=arrayify(computeHmac(SupportedAlgorithm.sha512,this.chainCode,_)),rt=et.slice(0,32),ot=et.slice(32);let ft=null,lt=null;this.privateKey?ft=bytes32(BigNumber.from(rt).add(this.privateKey).mod(N)):lt=new SigningKey(hexlify(rt))._addPoint(this.publicKey);let ht=o;const vt=this.mnemonic;return vt&&(ht=Object.freeze({phrase:vt.phrase,path:o,locale:vt.locale||"en"})),new HDNode(_constructorGuard,ft,lt,this.fingerprint,bytes32(ot),a,this.depth+1,ht)}derivePath(a){const o=a.split("/");if(o.length===0||o[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+a);o[0]==="m"&&o.shift();let _=this;for(let et=0;et<o.length;et++){const rt=o[et];if(rt.match(/^[0-9]+'$/)){const ot=parseInt(rt.substring(0,rt.length-1));if(ot>=HardenedBit)throw new Error("invalid path index - "+rt);_=_._derive(HardenedBit+ot)}else if(rt.match(/^[0-9]+$/)){const ot=parseInt(rt);if(ot>=HardenedBit)throw new Error("invalid path index - "+rt);_=_._derive(ot)}else throw new Error("invalid path component - "+rt)}return _}static _fromSeed(a,o){const _=arrayify(a);if(_.length<16||_.length>64)throw new Error("invalid seed");const et=arrayify(computeHmac(SupportedAlgorithm.sha512,MasterSecret,_));return new HDNode(_constructorGuard,bytes32(et.slice(0,32)),null,"0x00000000",bytes32(et.slice(32)),0,0,o)}static fromMnemonic(a,o,_){return _=getWordlist(_),a=entropyToMnemonic(mnemonicToEntropy(a,_),_),HDNode._fromSeed(mnemonicToSeed(a,o),{phrase:a,path:"m",locale:_.locale})}static fromSeed(a){return HDNode._fromSeed(a,null)}static fromExtendedKey(a){const o=Base58.decode(a);(o.length!==82||base58check(o.slice(0,78))!==a)&&logger$4.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const _=o[4],et=hexlify(o.slice(5,9)),rt=parseInt(hexlify(o.slice(9,13)).substring(2),16),ot=hexlify(o.slice(13,45)),ft=o.slice(45,78);switch(hexlify(o.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new HDNode(_constructorGuard,null,hexlify(ft),et,ot,rt,_,null);case"0x0488ade4":case"0x04358394 ":if(ft[0]!==0)break;return new HDNode(_constructorGuard,hexlify(ft.slice(1)),null,et,ot,rt,_,null)}return logger$4.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function mnemonicToSeed(i,a){a||(a="");const o=toUtf8Bytes("mnemonic"+a,UnicodeNormalizationForm.NFKD);return pbkdf2$1(toUtf8Bytes(i,UnicodeNormalizationForm.NFKD),o,2048,64,"sha512")}function mnemonicToEntropy(i,a){a=getWordlist(a),logger$4.checkNormalize();const o=a.split(i);if(o.length%3!==0)throw new Error("invalid mnemonic");const _=arrayify(new Uint8Array(Math.ceil(11*o.length/8)));let et=0;for(let ht=0;ht<o.length;ht++){let vt=a.getWordIndex(o[ht].normalize("NFKD"));if(vt===-1)throw new Error("invalid mnemonic");for(let It=0;It<11;It++)vt&1<<10-It&&(_[et>>3]|=1<<7-et%8),et++}const rt=32*o.length/3,ot=o.length/3,ft=getUpperMask(ot);if((arrayify(sha256(_.slice(0,rt/8)))[0]&ft)!==(_[_.length-1]&ft))throw new Error("invalid checksum");return hexlify(_.slice(0,rt/8))}function entropyToMnemonic(i,a){if(a=getWordlist(a),i=arrayify(i),i.length%4!==0||i.length<16||i.length>32)throw new Error("invalid entropy");const o=[0];let _=11;for(let ot=0;ot<i.length;ot++)_>8?(o[o.length-1]<<=8,o[o.length-1]|=i[ot],_-=8):(o[o.length-1]<<=_,o[o.length-1]|=i[ot]>>8-_,o.push(i[ot]&getLowerMask(8-_)),_+=3);const et=i.length/4,rt=arrayify(sha256(i))[0]&getUpperMask(et);return o[o.length-1]<<=et,o[o.length-1]|=rt>>8-et,a.join(o.map(ot=>a.getWord(ot)))}const version$3="random/5.7.0",logger$3=new Logger(version$3);function getGlobal(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const anyGlobal=getGlobal();let crypto$2=anyGlobal.crypto||anyGlobal.msCrypto;(!crypto$2||!crypto$2.getRandomValues)&&(logger$3.warn("WARNING: Missing strong random number source"),crypto$2={getRandomValues:function(i){return logger$3.throwError("no secure random source avaialble",Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function randomBytes(i){(i<=0||i>1024||i%1||i!=i)&&logger$3.throwArgumentError("invalid length","length",i);const a=new Uint8Array(i);return crypto$2.getRandomValues(a),arrayify(a)}var aesJs={exports:{}};(function(i,a){(function(o){function _(Tt){return parseInt(Tt)===Tt}function et(Tt){if(!_(Tt.length))return!1;for(var Mt=0;Mt<Tt.length;Mt++)if(!_(Tt[Mt])||Tt[Mt]<0||Tt[Mt]>255)return!1;return!0}function rt(Tt,Mt){if(Tt.buffer&&ArrayBuffer.isView(Tt)&&Tt.name==="Uint8Array")return Mt&&(Tt.slice?Tt=Tt.slice():Tt=Array.prototype.slice.call(Tt)),Tt;if(Array.isArray(Tt)){if(!et(Tt))throw new Error("Array contains invalid value: "+Tt);return new Uint8Array(Tt)}if(_(Tt.length)&&et(Tt))return new Uint8Array(Tt);throw new Error("unsupported array-like object")}function ot(Tt){return new Uint8Array(Tt)}function ft(Tt,Mt,dr,Nr,qt){(Nr!=null||qt!=null)&&(Tt.slice?Tt=Tt.slice(Nr,qt):Tt=Array.prototype.slice.call(Tt,Nr,qt)),Mt.set(Tt,dr)}var lt=function(){function Tt(dr){var Nr=[],qt=0;for(dr=encodeURI(dr);qt<dr.length;){var Fr=dr.charCodeAt(qt++);Fr===37?(Nr.push(parseInt(dr.substr(qt,2),16)),qt+=2):Nr.push(Fr)}return rt(Nr)}function Mt(dr){for(var Nr=[],qt=0;qt<dr.length;){var Fr=dr[qt];Fr<128?(Nr.push(String.fromCharCode(Fr)),qt++):Fr>191&&Fr<224?(Nr.push(String.fromCharCode((Fr&31)<<6|dr[qt+1]&63)),qt+=2):(Nr.push(String.fromCharCode((Fr&15)<<12|(dr[qt+1]&63)<<6|dr[qt+2]&63)),qt+=3)}return Nr.join("")}return{toBytes:Tt,fromBytes:Mt}}(),ht=function(){function Tt(Nr){for(var qt=[],Fr=0;Fr<Nr.length;Fr+=2)qt.push(parseInt(Nr.substr(Fr,2),16));return qt}var Mt="0123456789abcdef";function dr(Nr){for(var qt=[],Fr=0;Fr<Nr.length;Fr++){var jr=Nr[Fr];qt.push(Mt[(jr&240)>>4]+Mt[jr&15])}return qt.join("")}return{toBytes:Tt,fromBytes:dr}}(),vt={16:10,24:12,32:14},It=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Qt=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],mt=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Yt=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Rt=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],cr=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Ut=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],zt=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Gt=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Dr=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],lr=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],xr=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],hr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Hr=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],vr=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function u0(Tt){for(var Mt=[],dr=0;dr<Tt.length;dr+=4)Mt.push(Tt[dr]<<24|Tt[dr+1]<<16|Tt[dr+2]<<8|Tt[dr+3]);return Mt}var Br=function(Tt){if(!(this instanceof Br))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:rt(Tt,!0)}),this._prepare()};Br.prototype._prepare=function(){var Tt=vt[this.key.length];if(Tt==null)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var Mt=0;Mt<=Tt;Mt++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var dr=(Tt+1)*4,Nr=this.key.length/4,qt=u0(this.key),Fr,Mt=0;Mt<Nr;Mt++)Fr=Mt>>2,this._Ke[Fr][Mt%4]=qt[Mt],this._Kd[Tt-Fr][Mt%4]=qt[Mt];for(var jr=0,Wr=Nr,Zr;Wr<dr;){if(Zr=qt[Nr-1],qt[0]^=Qt[Zr>>16&255]<<24^Qt[Zr>>8&255]<<16^Qt[Zr&255]<<8^Qt[Zr>>24&255]^It[jr]<<24,jr+=1,Nr!=8)for(var Mt=1;Mt<Nr;Mt++)qt[Mt]^=qt[Mt-1];else{for(var Mt=1;Mt<Nr/2;Mt++)qt[Mt]^=qt[Mt-1];Zr=qt[Nr/2-1],qt[Nr/2]^=Qt[Zr&255]^Qt[Zr>>8&255]<<8^Qt[Zr>>16&255]<<16^Qt[Zr>>24&255]<<24;for(var Mt=Nr/2+1;Mt<Nr;Mt++)qt[Mt]^=qt[Mt-1]}for(var Mt=0,b0,E0;Mt<Nr&&Wr<dr;)b0=Wr>>2,E0=Wr%4,this._Ke[b0][E0]=qt[Mt],this._Kd[Tt-b0][E0]=qt[Mt++],Wr++}for(var b0=1;b0<Tt;b0++)for(var E0=0;E0<4;E0++)Zr=this._Kd[b0][E0],this._Kd[b0][E0]=xr[Zr>>24&255]^hr[Zr>>16&255]^Hr[Zr>>8&255]^vr[Zr&255]},Br.prototype.encrypt=function(Tt){if(Tt.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var Mt=this._Ke.length-1,dr=[0,0,0,0],Nr=u0(Tt),qt=0;qt<4;qt++)Nr[qt]^=this._Ke[0][qt];for(var Fr=1;Fr<Mt;Fr++){for(var qt=0;qt<4;qt++)dr[qt]=Yt[Nr[qt]>>24&255]^Rt[Nr[(qt+1)%4]>>16&255]^cr[Nr[(qt+2)%4]>>8&255]^Ut[Nr[(qt+3)%4]&255]^this._Ke[Fr][qt];Nr=dr.slice()}for(var jr=ot(16),Wr,qt=0;qt<4;qt++)Wr=this._Ke[Mt][qt],jr[4*qt]=(Qt[Nr[qt]>>24&255]^Wr>>24)&255,jr[4*qt+1]=(Qt[Nr[(qt+1)%4]>>16&255]^Wr>>16)&255,jr[4*qt+2]=(Qt[Nr[(qt+2)%4]>>8&255]^Wr>>8)&255,jr[4*qt+3]=(Qt[Nr[(qt+3)%4]&255]^Wr)&255;return jr},Br.prototype.decrypt=function(Tt){if(Tt.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var Mt=this._Kd.length-1,dr=[0,0,0,0],Nr=u0(Tt),qt=0;qt<4;qt++)Nr[qt]^=this._Kd[0][qt];for(var Fr=1;Fr<Mt;Fr++){for(var qt=0;qt<4;qt++)dr[qt]=zt[Nr[qt]>>24&255]^Gt[Nr[(qt+3)%4]>>16&255]^Dr[Nr[(qt+2)%4]>>8&255]^lr[Nr[(qt+1)%4]&255]^this._Kd[Fr][qt];Nr=dr.slice()}for(var jr=ot(16),Wr,qt=0;qt<4;qt++)Wr=this._Kd[Mt][qt],jr[4*qt]=(mt[Nr[qt]>>24&255]^Wr>>24)&255,jr[4*qt+1]=(mt[Nr[(qt+3)%4]>>16&255]^Wr>>16)&255,jr[4*qt+2]=(mt[Nr[(qt+2)%4]>>8&255]^Wr>>8)&255,jr[4*qt+3]=(mt[Nr[(qt+1)%4]&255]^Wr)&255;return jr};var Kt=function(Tt){if(!(this instanceof Kt))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Br(Tt)};Kt.prototype.encrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16)ft(Tt,dr,0,Nr,Nr+16),dr=this._aes.encrypt(dr),ft(dr,Mt,Nr);return Mt},Kt.prototype.decrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16)ft(Tt,dr,0,Nr,Nr+16),dr=this._aes.decrypt(dr),ft(dr,Mt,Nr);return Mt};var Ft=function(Tt,Mt){if(!(this instanceof Ft))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!Mt)Mt=ot(16);else if(Mt.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=rt(Mt,!0),this._aes=new Br(Tt)};Ft.prototype.encrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16){ft(Tt,dr,0,Nr,Nr+16);for(var qt=0;qt<16;qt++)dr[qt]^=this._lastCipherblock[qt];this._lastCipherblock=this._aes.encrypt(dr),ft(this._lastCipherblock,Mt,Nr)}return Mt},Ft.prototype.decrypt=function(Tt){if(Tt=rt(Tt),Tt.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Mt=ot(Tt.length),dr=ot(16),Nr=0;Nr<Tt.length;Nr+=16){ft(Tt,dr,0,Nr,Nr+16),dr=this._aes.decrypt(dr);for(var qt=0;qt<16;qt++)Mt[Nr+qt]=dr[qt]^this._lastCipherblock[qt];ft(Tt,this._lastCipherblock,0,Nr,Nr+16)}return Mt};var bt=function(Tt,Mt,dr){if(!(this instanceof bt))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!Mt)Mt=ot(16);else if(Mt.length!=16)throw new Error("invalid initialation vector size (must be 16 size)");dr||(dr=1),this.segmentSize=dr,this._shiftRegister=rt(Mt,!0),this._aes=new Br(Tt)};bt.prototype.encrypt=function(Tt){if(Tt.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var Mt=rt(Tt,!0),dr,Nr=0;Nr<Mt.length;Nr+=this.segmentSize){dr=this._aes.encrypt(this._shiftRegister);for(var qt=0;qt<this.segmentSize;qt++)Mt[Nr+qt]^=dr[qt];ft(this._shiftRegister,this._shiftRegister,0,this.segmentSize),ft(Mt,this._shiftRegister,16-this.segmentSize,Nr,Nr+this.segmentSize)}return Mt},bt.prototype.decrypt=function(Tt){if(Tt.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var Mt=rt(Tt,!0),dr,Nr=0;Nr<Mt.length;Nr+=this.segmentSize){dr=this._aes.encrypt(this._shiftRegister);for(var qt=0;qt<this.segmentSize;qt++)Mt[Nr+qt]^=dr[qt];ft(this._shiftRegister,this._shiftRegister,0,this.segmentSize),ft(Tt,this._shiftRegister,16-this.segmentSize,Nr,Nr+this.segmentSize)}return Mt};var St=function(Tt,Mt){if(!(this instanceof St))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!Mt)Mt=ot(16);else if(Mt.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=rt(Mt,!0),this._lastPrecipherIndex=16,this._aes=new Br(Tt)};St.prototype.encrypt=function(Tt){for(var Mt=rt(Tt,!0),dr=0;dr<Mt.length;dr++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),Mt[dr]^=this._lastPrecipher[this._lastPrecipherIndex++];return Mt},St.prototype.decrypt=St.prototype.encrypt;var Jt=function(Tt){if(!(this instanceof Jt))throw Error("Counter must be instanitated with `new`");Tt!==0&&!Tt&&(Tt=1),typeof Tt=="number"?(this._counter=ot(16),this.setValue(Tt)):this.setBytes(Tt)};Jt.prototype.setValue=function(Tt){if(typeof Tt!="number"||parseInt(Tt)!=Tt)throw new Error("invalid counter value (must be an integer)");for(var Mt=15;Mt>=0;--Mt)this._counter[Mt]=Tt%256,Tt=Tt>>8},Jt.prototype.setBytes=function(Tt){if(Tt=rt(Tt,!0),Tt.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=Tt},Jt.prototype.increment=function(){for(var Tt=15;Tt>=0;Tt--)if(this._counter[Tt]===255)this._counter[Tt]=0;else{this._counter[Tt]++;break}};var er=function(Tt,Mt){if(!(this instanceof er))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",Mt instanceof Jt||(Mt=new Jt(Mt)),this._counter=Mt,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Br(Tt)};er.prototype.encrypt=function(Tt){for(var Mt=rt(Tt,!0),dr=0;dr<Mt.length;dr++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),Mt[dr]^=this._remainingCounter[this._remainingCounterIndex++];return Mt},er.prototype.decrypt=er.prototype.encrypt;function sr(Tt){Tt=rt(Tt,!0);var Mt=16-Tt.length%16,dr=ot(Tt.length+Mt);ft(Tt,dr);for(var Nr=Tt.length;Nr<dr.length;Nr++)dr[Nr]=Mt;return dr}function nr(Tt){if(Tt=rt(Tt,!0),Tt.length<16)throw new Error("PKCS#7 invalid length");var Mt=Tt[Tt.length-1];if(Mt>16)throw new Error("PKCS#7 padding byte out of range");for(var dr=Tt.length-Mt,Nr=0;Nr<Mt;Nr++)if(Tt[dr+Nr]!==Mt)throw new Error("PKCS#7 invalid padding byte");var qt=ot(dr);return ft(Tt,qt,0,0,dr),qt}var Dt={AES:Br,Counter:Jt,ModeOfOperation:{ecb:Kt,cbc:Ft,cfb:bt,ofb:St,ctr:er},utils:{hex:ht,utf8:lt},padding:{pkcs7:{pad:sr,strip:nr}},_arrayTest:{coerceArray:rt,createArray:ot,copyArray:ft}};i.exports=Dt})()})(aesJs);var aesJsExports=aesJs.exports;const aes=getDefaultExportFromCjs(aesJsExports),version$2="json-wallets/5.7.0";function looseArrayify(i){return typeof i=="string"&&i.substring(0,2)!=="0x"&&(i="0x"+i),arrayify(i)}function zpad(i,a){for(i=String(i);i.length<a;)i="0"+i;return i}function getPassword(i){return typeof i=="string"?toUtf8Bytes(i,UnicodeNormalizationForm.NFKC):arrayify(i)}function searchPath(i,a){let o=i;const _=a.toLowerCase().split("/");for(let et=0;et<_.length;et++){let rt=null;for(const ot in o)if(ot.toLowerCase()===_[et]){rt=o[ot];break}if(rt===null)return null;o=rt}return o}function uuidV4(i){const a=arrayify(i);a[6]=a[6]&15|64,a[8]=a[8]&63|128;const o=hexlify(a);return[o.substring(2,10),o.substring(10,14),o.substring(14,18),o.substring(18,22),o.substring(22,34)].join("-")}const logger$2=new Logger(version$2);class CrowdsaleAccount extends Description{isCrowdsaleAccount(a){return!!(a&&a._isCrowdsaleAccount)}}function decrypt$1(i,a){const o=JSON.parse(i);a=getPassword(a);const _=getAddress(searchPath(o,"ethaddr")),et=looseArrayify(searchPath(o,"encseed"));(!et||et.length%16!==0)&&logger$2.throwArgumentError("invalid encseed","json",i);const rt=arrayify(pbkdf2$1(a,a,2e3,32,"sha256")).slice(0,16),ot=et.slice(0,16),ft=et.slice(16),lt=new aes.ModeOfOperation.cbc(rt,ot),ht=aes.padding.pkcs7.strip(arrayify(lt.decrypt(ft)));let vt="";for(let mt=0;mt<ht.length;mt++)vt+=String.fromCharCode(ht[mt]);const It=toUtf8Bytes(vt),Qt=keccak256(It);return new CrowdsaleAccount({_isCrowdsaleAccount:!0,address:_,privateKey:Qt})}function isCrowdsaleWallet(i){let a=null;try{a=JSON.parse(i)}catch{return!1}return a.encseed&&a.ethaddr}function isKeystoreWallet(i){let a=null;try{a=JSON.parse(i)}catch{return!1}return!(!a.version||parseInt(a.version)!==a.version||parseInt(a.version)!==3)}var scrypt$1={exports:{}};(function(i,a){(function(o){function et(Rt){const cr=new Uint32Array([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]);let Ut=1779033703,zt=3144134277,Gt=1013904242,Dr=2773480762,lr=1359893119,xr=2600822924,hr=528734635,Hr=1541459225;const vr=new Uint32Array(64);function u0(er){let sr=0,nr=er.length;for(;nr>=64;){let Dt=Ut,Tt=zt,Mt=Gt,dr=Dr,Nr=lr,qt=xr,Fr=hr,jr=Hr,Wr,Zr,b0,E0,m0;for(Zr=0;Zr<16;Zr++)b0=sr+Zr*4,vr[Zr]=(er[b0]&255)<<24|(er[b0+1]&255)<<16|(er[b0+2]&255)<<8|er[b0+3]&255;for(Zr=16;Zr<64;Zr++)Wr=vr[Zr-2],E0=(Wr>>>17|Wr<<32-17)^(Wr>>>19|Wr<<32-19)^Wr>>>10,Wr=vr[Zr-15],m0=(Wr>>>7|Wr<<32-7)^(Wr>>>18|Wr<<32-18)^Wr>>>3,vr[Zr]=(E0+vr[Zr-7]|0)+(m0+vr[Zr-16]|0)|0;for(Zr=0;Zr<64;Zr++)E0=(((Nr>>>6|Nr<<32-6)^(Nr>>>11|Nr<<32-11)^(Nr>>>25|Nr<<32-25))+(Nr&qt^~Nr&Fr)|0)+(jr+(cr[Zr]+vr[Zr]|0)|0)|0,m0=((Dt>>>2|Dt<<32-2)^(Dt>>>13|Dt<<32-13)^(Dt>>>22|Dt<<32-22))+(Dt&Tt^Dt&Mt^Tt&Mt)|0,jr=Fr,Fr=qt,qt=Nr,Nr=dr+E0|0,dr=Mt,Mt=Tt,Tt=Dt,Dt=E0+m0|0;Ut=Ut+Dt|0,zt=zt+Tt|0,Gt=Gt+Mt|0,Dr=Dr+dr|0,lr=lr+Nr|0,xr=xr+qt|0,hr=hr+Fr|0,Hr=Hr+jr|0,sr+=64,nr-=64}}u0(Rt);let Br,Kt=Rt.length%64,Ft=Rt.length/536870912|0,bt=Rt.length<<3,St=Kt<56?56:120,Jt=Rt.slice(Rt.length-Kt,Rt.length);for(Jt.push(128),Br=Kt+1;Br<St;Br++)Jt.push(0);return Jt.push(Ft>>>24&255),Jt.push(Ft>>>16&255),Jt.push(Ft>>>8&255),Jt.push(Ft>>>0&255),Jt.push(bt>>>24&255),Jt.push(bt>>>16&255),Jt.push(bt>>>8&255),Jt.push(bt>>>0&255),u0(Jt),[Ut>>>24&255,Ut>>>16&255,Ut>>>8&255,Ut>>>0&255,zt>>>24&255,zt>>>16&255,zt>>>8&255,zt>>>0&255,Gt>>>24&255,Gt>>>16&255,Gt>>>8&255,Gt>>>0&255,Dr>>>24&255,Dr>>>16&255,Dr>>>8&255,Dr>>>0&255,lr>>>24&255,lr>>>16&255,lr>>>8&255,lr>>>0&255,xr>>>24&255,xr>>>16&255,xr>>>8&255,xr>>>0&255,hr>>>24&255,hr>>>16&255,hr>>>8&255,hr>>>0&255,Hr>>>24&255,Hr>>>16&255,Hr>>>8&255,Hr>>>0&255]}function rt(Rt,cr,Ut){Rt=Rt.length<=64?Rt:et(Rt);const zt=64+cr.length+4,Gt=new Array(zt),Dr=new Array(64);let lr,xr=[];for(lr=0;lr<64;lr++)Gt[lr]=54;for(lr=0;lr<Rt.length;lr++)Gt[lr]^=Rt[lr];for(lr=0;lr<cr.length;lr++)Gt[64+lr]=cr[lr];for(lr=zt-4;lr<zt;lr++)Gt[lr]=0;for(lr=0;lr<64;lr++)Dr[lr]=92;for(lr=0;lr<Rt.length;lr++)Dr[lr]^=Rt[lr];function hr(){for(let Hr=zt-1;Hr>=zt-4;Hr--){if(Gt[Hr]++,Gt[Hr]<=255)return;Gt[Hr]=0}}for(;Ut>=32;)hr(),xr=xr.concat(et(Dr.concat(et(Gt)))),Ut-=32;return Ut>0&&(hr(),xr=xr.concat(et(Dr.concat(et(Gt))).slice(0,Ut))),xr}function ot(Rt,cr,Ut,zt,Gt){let Dr;for(vt(Rt,(2*Ut-1)*16,Gt,0,16),Dr=0;Dr<2*Ut;Dr++)ht(Rt,Dr*16,Gt,16),lt(Gt,zt),vt(Gt,0,Rt,cr+Dr*16,16);for(Dr=0;Dr<Ut;Dr++)vt(Rt,cr+Dr*2*16,Rt,Dr*16,16);for(Dr=0;Dr<Ut;Dr++)vt(Rt,cr+(Dr*2+1)*16,Rt,(Dr+Ut)*16,16)}function ft(Rt,cr){return Rt<<cr|Rt>>>32-cr}function lt(Rt,cr){vt(Rt,0,cr,0,16);for(let Ut=8;Ut>0;Ut-=2)cr[4]^=ft(cr[0]+cr[12],7),cr[8]^=ft(cr[4]+cr[0],9),cr[12]^=ft(cr[8]+cr[4],13),cr[0]^=ft(cr[12]+cr[8],18),cr[9]^=ft(cr[5]+cr[1],7),cr[13]^=ft(cr[9]+cr[5],9),cr[1]^=ft(cr[13]+cr[9],13),cr[5]^=ft(cr[1]+cr[13],18),cr[14]^=ft(cr[10]+cr[6],7),cr[2]^=ft(cr[14]+cr[10],9),cr[6]^=ft(cr[2]+cr[14],13),cr[10]^=ft(cr[6]+cr[2],18),cr[3]^=ft(cr[15]+cr[11],7),cr[7]^=ft(cr[3]+cr[15],9),cr[11]^=ft(cr[7]+cr[3],13),cr[15]^=ft(cr[11]+cr[7],18),cr[1]^=ft(cr[0]+cr[3],7),cr[2]^=ft(cr[1]+cr[0],9),cr[3]^=ft(cr[2]+cr[1],13),cr[0]^=ft(cr[3]+cr[2],18),cr[6]^=ft(cr[5]+cr[4],7),cr[7]^=ft(cr[6]+cr[5],9),cr[4]^=ft(cr[7]+cr[6],13),cr[5]^=ft(cr[4]+cr[7],18),cr[11]^=ft(cr[10]+cr[9],7),cr[8]^=ft(cr[11]+cr[10],9),cr[9]^=ft(cr[8]+cr[11],13),cr[10]^=ft(cr[9]+cr[8],18),cr[12]^=ft(cr[15]+cr[14],7),cr[13]^=ft(cr[12]+cr[15],9),cr[14]^=ft(cr[13]+cr[12],13),cr[15]^=ft(cr[14]+cr[13],18);for(let Ut=0;Ut<16;++Ut)Rt[Ut]+=cr[Ut]}function ht(Rt,cr,Ut,zt){for(let Gt=0;Gt<zt;Gt++)Ut[Gt]^=Rt[cr+Gt]}function vt(Rt,cr,Ut,zt,Gt){for(;Gt--;)Ut[zt++]=Rt[cr++]}function It(Rt){if(!Rt||typeof Rt.length!="number")return!1;for(let cr=0;cr<Rt.length;cr++){const Ut=Rt[cr];if(typeof Ut!="number"||Ut%1||Ut<0||Ut>=256)return!1}return!0}function Qt(Rt,cr){if(typeof Rt!="number"||Rt%1)throw new Error("invalid "+cr);return Rt}function mt(Rt,cr,Ut,zt,Gt,Dr,lr){if(Ut=Qt(Ut,"N"),zt=Qt(zt,"r"),Gt=Qt(Gt,"p"),Dr=Qt(Dr,"dkLen"),Ut===0||Ut&Ut-1)throw new Error("N must be power of 2");if(Ut>2147483647/128/zt)throw new Error("N too large");if(zt>2147483647/128/Gt)throw new Error("r too large");if(!It(Rt))throw new Error("password must be an array or buffer");if(Rt=Array.prototype.slice.call(Rt),!It(cr))throw new Error("salt must be an array or buffer");cr=Array.prototype.slice.call(cr);let xr=rt(Rt,cr,Gt*128*zt);const hr=new Uint32Array(Gt*32*zt);for(let Nr=0;Nr<hr.length;Nr++){const qt=Nr*4;hr[Nr]=(xr[qt+3]&255)<<24|(xr[qt+2]&255)<<16|(xr[qt+1]&255)<<8|(xr[qt+0]&255)<<0}const Hr=new Uint32Array(64*zt),vr=new Uint32Array(32*zt*Ut),u0=32*zt,Br=new Uint32Array(16),Kt=new Uint32Array(16),Ft=Gt*Ut*2;let bt=0,St=null,Jt=!1,er=0,sr=0,nr,Dt;const Tt=lr?parseInt(1e3/zt):4294967295,Mt=typeof setImmediate<"u"?setImmediate:setTimeout,dr=function(){if(Jt)return lr(new Error("cancelled"),bt/Ft);let Nr;switch(er){case 0:Dt=sr*32*zt,vt(hr,Dt,Hr,0,u0),er=1,nr=0;case 1:Nr=Ut-nr,Nr>Tt&&(Nr=Tt);for(let Fr=0;Fr<Nr;Fr++)vt(Hr,0,vr,(nr+Fr)*u0,u0),ot(Hr,u0,zt,Br,Kt);if(nr+=Nr,bt+=Nr,lr){const Fr=parseInt(1e3*bt/Ft);if(Fr!==St){if(Jt=lr(null,bt/Ft),Jt)break;St=Fr}}if(nr<Ut)break;nr=0,er=2;case 2:Nr=Ut-nr,Nr>Tt&&(Nr=Tt);for(let Fr=0;Fr<Nr;Fr++){const jr=(2*zt-1)*16,Wr=Hr[jr]&Ut-1;ht(vr,Wr*u0,Hr,u0),ot(Hr,u0,zt,Br,Kt)}if(nr+=Nr,bt+=Nr,lr){const Fr=parseInt(1e3*bt/Ft);if(Fr!==St){if(Jt=lr(null,bt/Ft),Jt)break;St=Fr}}if(nr<Ut)break;if(vt(Hr,0,hr,Dt,u0),sr++,sr<Gt){er=0;break}xr=[];for(let Fr=0;Fr<hr.length;Fr++)xr.push(hr[Fr]>>0&255),xr.push(hr[Fr]>>8&255),xr.push(hr[Fr]>>16&255),xr.push(hr[Fr]>>24&255);const qt=rt(Rt,xr,Dr);return lr&&lr(null,1,qt),qt}lr&&Mt(dr)};if(!lr)for(;;){const Nr=dr();if(Nr!=null)return Nr}dr()}const Yt={scrypt:function(Rt,cr,Ut,zt,Gt,Dr,lr){return new Promise(function(xr,hr){let Hr=0;lr&&lr(0),mt(Rt,cr,Ut,zt,Gt,Dr,function(vr,u0,Br){if(vr)hr(vr);else if(Br)lr&&Hr!==1&&lr(1),xr(new Uint8Array(Br));else if(lr&&u0!==Hr)return Hr=u0,lr(u0)})})},syncScrypt:function(Rt,cr,Ut,zt,Gt,Dr){return new Uint8Array(mt(Rt,cr,Ut,zt,Gt,Dr))}};i.exports=Yt})()})(scrypt$1);var scryptExports=scrypt$1.exports;const scrypt=getDefaultExportFromCjs(scryptExports);var __awaiter$1=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger$1=new Logger(version$2);function hasMnemonic$1(i){return i!=null&&i.mnemonic&&i.mnemonic.phrase}class KeystoreAccount extends Description{isKeystoreAccount(a){return!!(a&&a._isKeystoreAccount)}}function _decrypt(i,a,o){if(searchPath(i,"crypto/cipher")==="aes-128-ctr"){const et=looseArrayify(searchPath(i,"crypto/cipherparams/iv")),rt=new aes.Counter(et),ot=new aes.ModeOfOperation.ctr(a,rt);return arrayify(ot.decrypt(o))}return null}function _getAccount(i,a){const o=looseArrayify(searchPath(i,"crypto/ciphertext"));if(hexlify(keccak256(concat([a.slice(16,32),o]))).substring(2)!==searchPath(i,"crypto/mac").toLowerCase())throw new Error("invalid password");const et=_decrypt(i,a.slice(0,16),o);et||logger$1.throwError("unsupported cipher",Logger.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const rt=a.slice(32,64),ot=computeAddress(et);if(i.address){let lt=i.address.toLowerCase();if(lt.substring(0,2)!=="0x"&&(lt="0x"+lt),getAddress(lt)!==ot)throw new Error("address mismatch")}const ft={_isKeystoreAccount:!0,address:ot,privateKey:hexlify(et)};if(searchPath(i,"x-ethers/version")==="0.1"){const lt=looseArrayify(searchPath(i,"x-ethers/mnemonicCiphertext")),ht=looseArrayify(searchPath(i,"x-ethers/mnemonicCounter")),vt=new aes.Counter(ht),It=new aes.ModeOfOperation.ctr(rt,vt),Qt=searchPath(i,"x-ethers/path")||defaultPath,mt=searchPath(i,"x-ethers/locale")||"en",Yt=arrayify(It.decrypt(lt));try{const Rt=entropyToMnemonic(Yt,mt),cr=HDNode.fromMnemonic(Rt,null,mt).derivePath(Qt);if(cr.privateKey!=ft.privateKey)throw new Error("mnemonic mismatch");ft.mnemonic=cr.mnemonic}catch(Rt){if(Rt.code!==Logger.errors.INVALID_ARGUMENT||Rt.argument!=="wordlist")throw Rt}}return new KeystoreAccount(ft)}function pbkdf2Sync(i,a,o,_,et){return arrayify(pbkdf2$1(i,a,o,_,et))}function pbkdf2(i,a,o,_,et){return Promise.resolve(pbkdf2Sync(i,a,o,_,et))}function _computeKdfKey(i,a,o,_,et){const rt=getPassword(a),ot=searchPath(i,"crypto/kdf");if(ot&&typeof ot=="string"){const ft=function(lt,ht){return logger$1.throwArgumentError("invalid key-derivation function parameters",lt,ht)};if(ot.toLowerCase()==="scrypt"){const lt=looseArrayify(searchPath(i,"crypto/kdfparams/salt")),ht=parseInt(searchPath(i,"crypto/kdfparams/n")),vt=parseInt(searchPath(i,"crypto/kdfparams/r")),It=parseInt(searchPath(i,"crypto/kdfparams/p"));(!ht||!vt||!It)&&ft("kdf",ot),ht&ht-1&&ft("N",ht);const Qt=parseInt(searchPath(i,"crypto/kdfparams/dklen"));return Qt!==32&&ft("dklen",Qt),_(rt,lt,ht,vt,It,64,et)}else if(ot.toLowerCase()==="pbkdf2"){const lt=looseArrayify(searchPath(i,"crypto/kdfparams/salt"));let ht=null;const vt=searchPath(i,"crypto/kdfparams/prf");vt==="hmac-sha256"?ht="sha256":vt==="hmac-sha512"?ht="sha512":ft("prf",vt);const It=parseInt(searchPath(i,"crypto/kdfparams/c")),Qt=parseInt(searchPath(i,"crypto/kdfparams/dklen"));return Qt!==32&&ft("dklen",Qt),o(rt,lt,It,Qt,ht)}}return logger$1.throwArgumentError("unsupported key-derivation function","kdf",ot)}function decryptSync(i,a){const o=JSON.parse(i),_=_computeKdfKey(o,a,pbkdf2Sync,scrypt.syncScrypt);return _getAccount(o,_)}function decrypt(i,a,o){return __awaiter$1(this,void 0,void 0,function*(){const _=JSON.parse(i),et=yield _computeKdfKey(_,a,pbkdf2,scrypt.scrypt,o);return _getAccount(_,et)})}function encrypt(i,a,o,_){try{if(getAddress(i.address)!==computeAddress(i.privateKey))throw new Error("address/privateKey mismatch");if(hasMnemonic$1(i)){const cr=i.mnemonic;if(HDNode.fromMnemonic(cr.phrase,null,cr.locale).derivePath(cr.path||defaultPath).privateKey!=i.privateKey)throw new Error("mnemonic mismatch")}}catch(cr){return Promise.reject(cr)}typeof o=="function"&&!_&&(_=o,o={}),o||(o={});const et=arrayify(i.privateKey),rt=getPassword(a);let ot=null,ft=null,lt=null;if(hasMnemonic$1(i)){const cr=i.mnemonic;ot=arrayify(mnemonicToEntropy(cr.phrase,cr.locale||"en")),ft=cr.path||defaultPath,lt=cr.locale||"en"}let ht=o.client;ht||(ht="ethers.js");let vt=null;o.salt?vt=arrayify(o.salt):vt=randomBytes(32);let It=null;if(o.iv){if(It=arrayify(o.iv),It.length!==16)throw new Error("invalid iv")}else It=randomBytes(16);let Qt=null;if(o.uuid){if(Qt=arrayify(o.uuid),Qt.length!==16)throw new Error("invalid uuid")}else Qt=randomBytes(16);let mt=1<<17,Yt=8,Rt=1;return o.scrypt&&(o.scrypt.N&&(mt=o.scrypt.N),o.scrypt.r&&(Yt=o.scrypt.r),o.scrypt.p&&(Rt=o.scrypt.p)),scrypt.scrypt(rt,vt,mt,Yt,Rt,64,_).then(cr=>{cr=arrayify(cr);const Ut=cr.slice(0,16),zt=cr.slice(16,32),Gt=cr.slice(32,64),Dr=new aes.Counter(It),lr=new aes.ModeOfOperation.ctr(Ut,Dr),xr=arrayify(lr.encrypt(et)),hr=keccak256(concat([zt,xr])),Hr={address:i.address.substring(2).toLowerCase(),id:uuidV4(Qt),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(It).substring(2)},ciphertext:hexlify(xr).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(vt).substring(2),n:mt,dklen:32,p:Rt,r:Yt},mac:hr.substring(2)}};if(ot){const vr=randomBytes(16),u0=new aes.Counter(vr),Br=new aes.ModeOfOperation.ctr(Gt,u0),Kt=arrayify(Br.encrypt(ot)),Ft=new Date,bt=Ft.getUTCFullYear()+"-"+zpad(Ft.getUTCMonth()+1,2)+"-"+zpad(Ft.getUTCDate(),2)+"T"+zpad(Ft.getUTCHours(),2)+"-"+zpad(Ft.getUTCMinutes(),2)+"-"+zpad(Ft.getUTCSeconds(),2)+".0Z";Hr["x-ethers"]={client:ht,gethFilename:"UTC--"+bt+"--"+Hr.address,mnemonicCounter:hexlify(vr).substring(2),mnemonicCiphertext:hexlify(Kt).substring(2),path:ft,locale:lt,version:"0.1"}}return JSON.stringify(Hr)})}function decryptJsonWallet(i,a,o){if(isCrowdsaleWallet(i)){o&&o(0);const _=decrypt$1(i,a);return o&&o(1),Promise.resolve(_)}return isKeystoreWallet(i)?decrypt(i,a,o):Promise.reject(new Error("invalid JSON wallet"))}function decryptJsonWalletSync(i,a){if(isCrowdsaleWallet(i))return decrypt$1(i,a);if(isKeystoreWallet(i))return decryptSync(i,a);throw new Error("invalid JSON wallet")}const version$1="wallet/5.7.0";var __awaiter=globalThis&&globalThis.__awaiter||function(i,a,o,_){function et(rt){return rt instanceof o?rt:new o(function(ot){ot(rt)})}return new(o||(o=Promise))(function(rt,ot){function ft(vt){try{ht(_.next(vt))}catch(It){ot(It)}}function lt(vt){try{ht(_.throw(vt))}catch(It){ot(It)}}function ht(vt){vt.done?rt(vt.value):et(vt.value).then(ft,lt)}ht((_=_.apply(i,a||[])).next())})};const logger=new Logger(version$1);function isAccount(i){return i!=null&&isHexString(i.privateKey,32)&&i.address!=null}function hasMnemonic(i){const a=i.mnemonic;return a&&a.phrase}class Wallet extends Signer{constructor(a,o){if(super(),isAccount(a)){const _=new SigningKey(a.privateKey);if(defineReadOnly(this,"_signingKey",()=>_),defineReadOnly(this,"address",computeAddress(this.publicKey)),this.address!==getAddress(a.address)&&logger.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),hasMnemonic(a)){const et=a.mnemonic;defineReadOnly(this,"_mnemonic",()=>({phrase:et.phrase,path:et.path||defaultPath,locale:et.locale||"en"}));const rt=this.mnemonic,ot=HDNode.fromMnemonic(rt.phrase,null,rt.locale).derivePath(rt.path);computeAddress(ot.privateKey)!==this.address&&logger.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else defineReadOnly(this,"_mnemonic",()=>null)}else{if(SigningKey.isSigningKey(a))a.curve!=="secp256k1"&&logger.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),defineReadOnly(this,"_signingKey",()=>a);else{typeof a=="string"&&a.match(/^[0-9a-f]*$/i)&&a.length===64&&(a="0x"+a);const _=new SigningKey(a);defineReadOnly(this,"_signingKey",()=>_)}defineReadOnly(this,"_mnemonic",()=>null),defineReadOnly(this,"address",computeAddress(this.publicKey))}o&&!Provider.isProvider(o)&&logger.throwArgumentError("invalid provider","provider",o),defineReadOnly(this,"provider",o||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(a){return new Wallet(this,a)}signTransaction(a){return resolveProperties(a).then(o=>{o.from!=null&&(getAddress(o.from)!==this.address&&logger.throwArgumentError("transaction from address mismatch","transaction.from",a.from),delete o.from);const _=this._signingKey().signDigest(keccak256(serialize$1(o)));return serialize$1(o,_)})}signMessage(a){return __awaiter(this,void 0,void 0,function*(){return joinSignature(this._signingKey().signDigest(hashMessage(a)))})}_signTypedData(a,o,_){return __awaiter(this,void 0,void 0,function*(){const et=yield TypedDataEncoder.resolveNames(a,o,_,rt=>(this.provider==null&&logger.throwError("cannot resolve ENS names without a provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:rt}),this.provider.resolveName(rt)));return joinSignature(this._signingKey().signDigest(TypedDataEncoder.hash(et.domain,o,et.value)))})}encrypt(a,o,_){if(typeof o=="function"&&!_&&(_=o,o={}),_&&typeof _!="function")throw new Error("invalid callback");return o||(o={}),encrypt(this,a,o,_)}static createRandom(a){let o=randomBytes(16);a||(a={}),a.extraEntropy&&(o=arrayify(hexDataSlice(keccak256(concat([o,a.extraEntropy])),0,16)));const _=entropyToMnemonic(o,a.locale);return Wallet.fromMnemonic(_,a.path,a.locale)}static fromEncryptedJson(a,o,_){return decryptJsonWallet(a,o,_).then(et=>new Wallet(et))}static fromEncryptedJsonSync(a,o){return new Wallet(decryptJsonWalletSync(a,o))}static fromMnemonic(a,o,_){return o||(o=defaultPath),new Wallet(HDNode.fromMnemonic(a,null,_).derivePath(o))}}var elliptic={};const name="elliptic",version="6.5.4",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny <fedor@indutny.com>",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$c={},bn={exports:{}};bn.exports;(function(i){(function(a,o){function _(Br,Kt){if(!Br)throw new Error(Kt||"Assertion failed")}function et(Br,Kt){Br.super_=Kt;var Ft=function(){};Ft.prototype=Kt.prototype,Br.prototype=new Ft,Br.prototype.constructor=Br}function rt(Br,Kt,Ft){if(rt.isBN(Br))return Br;this.negative=0,this.words=null,this.length=0,this.red=null,Br!==null&&((Kt==="le"||Kt==="be")&&(Ft=Kt,Kt=10),this._init(Br||0,Kt||10,Ft||"be"))}typeof a=="object"?a.exports=rt:o.BN=rt,rt.BN=rt,rt.wordSize=26;var ot;try{typeof window<"u"&&typeof window.Buffer<"u"?ot=window.Buffer:ot=require$$1.Buffer}catch{}rt.isBN=function(Kt){return Kt instanceof rt?!0:Kt!==null&&typeof Kt=="object"&&Kt.constructor.wordSize===rt.wordSize&&Array.isArray(Kt.words)},rt.max=function(Kt,Ft){return Kt.cmp(Ft)>0?Kt:Ft},rt.min=function(Kt,Ft){return Kt.cmp(Ft)<0?Kt:Ft},rt.prototype._init=function(Kt,Ft,bt){if(typeof Kt=="number")return this._initNumber(Kt,Ft,bt);if(typeof Kt=="object")return this._initArray(Kt,Ft,bt);Ft==="hex"&&(Ft=16),_(Ft===(Ft|0)&&Ft>=2&&Ft<=36),Kt=Kt.toString().replace(/\s+/g,"");var St=0;Kt[0]==="-"&&(St++,this.negative=1),St<Kt.length&&(Ft===16?this._parseHex(Kt,St,bt):(this._parseBase(Kt,Ft,St),bt==="le"&&this._initArray(this.toArray(),Ft,bt)))},rt.prototype._initNumber=function(Kt,Ft,bt){Kt<0&&(this.negative=1,Kt=-Kt),Kt<67108864?(this.words=[Kt&67108863],this.length=1):Kt<4503599627370496?(this.words=[Kt&67108863,Kt/67108864&67108863],this.length=2):(_(Kt<9007199254740992),this.words=[Kt&67108863,Kt/67108864&67108863,1],this.length=3),bt==="le"&&this._initArray(this.toArray(),Ft,bt)},rt.prototype._initArray=function(Kt,Ft,bt){if(_(typeof Kt.length=="number"),Kt.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(Kt.length/3),this.words=new Array(this.length);for(var St=0;St<this.length;St++)this.words[St]=0;var Jt,er,sr=0;if(bt==="be")for(St=Kt.length-1,Jt=0;St>=0;St-=3)er=Kt[St]|Kt[St-1]<<8|Kt[St-2]<<16,this.words[Jt]|=er<<sr&67108863,this.words[Jt+1]=er>>>26-sr&67108863,sr+=24,sr>=26&&(sr-=26,Jt++);else if(bt==="le")for(St=0,Jt=0;St<Kt.length;St+=3)er=Kt[St]|Kt[St+1]<<8|Kt[St+2]<<16,this.words[Jt]|=er<<sr&67108863,this.words[Jt+1]=er>>>26-sr&67108863,sr+=24,sr>=26&&(sr-=26,Jt++);return this.strip()};function ft(Br,Kt){var Ft=Br.charCodeAt(Kt);return Ft>=65&&Ft<=70?Ft-55:Ft>=97&&Ft<=102?Ft-87:Ft-48&15}function lt(Br,Kt,Ft){var bt=ft(Br,Ft);return Ft-1>=Kt&&(bt|=ft(Br,Ft-1)<<4),bt}rt.prototype._parseHex=function(Kt,Ft,bt){this.length=Math.ceil((Kt.length-Ft)/6),this.words=new Array(this.length);for(var St=0;St<this.length;St++)this.words[St]=0;var Jt=0,er=0,sr;if(bt==="be")for(St=Kt.length-1;St>=Ft;St-=2)sr=lt(Kt,Ft,St)<<Jt,this.words[er]|=sr&67108863,Jt>=18?(Jt-=18,er+=1,this.words[er]|=sr>>>26):Jt+=8;else{var nr=Kt.length-Ft;for(St=nr%2===0?Ft+1:Ft;St<Kt.length;St+=2)sr=lt(Kt,Ft,St)<<Jt,this.words[er]|=sr&67108863,Jt>=18?(Jt-=18,er+=1,this.words[er]|=sr>>>26):Jt+=8}this.strip()};function ht(Br,Kt,Ft,bt){for(var St=0,Jt=Math.min(Br.length,Ft),er=Kt;er<Jt;er++){var sr=Br.charCodeAt(er)-48;St*=bt,sr>=49?St+=sr-49+10:sr>=17?St+=sr-17+10:St+=sr}return St}rt.prototype._parseBase=function(Kt,Ft,bt){this.words=[0],this.length=1;for(var St=0,Jt=1;Jt<=67108863;Jt*=Ft)St++;St--,Jt=Jt/Ft|0;for(var er=Kt.length-bt,sr=er%St,nr=Math.min(er,er-sr)+bt,Dt=0,Tt=bt;Tt<nr;Tt+=St)Dt=ht(Kt,Tt,Tt+St,Ft),this.imuln(Jt),this.words[0]+Dt<67108864?this.words[0]+=Dt:this._iaddn(Dt);if(sr!==0){var Mt=1;for(Dt=ht(Kt,Tt,Kt.length,Ft),Tt=0;Tt<sr;Tt++)Mt*=Ft;this.imuln(Mt),this.words[0]+Dt<67108864?this.words[0]+=Dt:this._iaddn(Dt)}this.strip()},rt.prototype.copy=function(Kt){Kt.words=new Array(this.length);for(var Ft=0;Ft<this.length;Ft++)Kt.words[Ft]=this.words[Ft];Kt.length=this.length,Kt.negative=this.negative,Kt.red=this.red},rt.prototype.clone=function(){var Kt=new rt(null);return this.copy(Kt),Kt},rt.prototype._expand=function(Kt){for(;this.length<Kt;)this.words[this.length++]=0;return this},rt.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},rt.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},rt.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var vt=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],It=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Qt=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];rt.prototype.toString=function(Kt,Ft){Kt=Kt||10,Ft=Ft|0||1;var bt;if(Kt===16||Kt==="hex"){bt="";for(var St=0,Jt=0,er=0;er<this.length;er++){var sr=this.words[er],nr=((sr<<St|Jt)&16777215).toString(16);Jt=sr>>>24-St&16777215,Jt!==0||er!==this.length-1?bt=vt[6-nr.length]+nr+bt:bt=nr+bt,St+=2,St>=26&&(St-=26,er--)}for(Jt!==0&&(bt=Jt.toString(16)+bt);bt.length%Ft!==0;)bt="0"+bt;return this.negative!==0&&(bt="-"+bt),bt}if(Kt===(Kt|0)&&Kt>=2&&Kt<=36){var Dt=It[Kt],Tt=Qt[Kt];bt="";var Mt=this.clone();for(Mt.negative=0;!Mt.isZero();){var dr=Mt.modn(Tt).toString(Kt);Mt=Mt.idivn(Tt),Mt.isZero()?bt=dr+bt:bt=vt[Dt-dr.length]+dr+bt}for(this.isZero()&&(bt="0"+bt);bt.length%Ft!==0;)bt="0"+bt;return this.negative!==0&&(bt="-"+bt),bt}_(!1,"Base should be between 2 and 36")},rt.prototype.toNumber=function(){var Kt=this.words[0];return this.length===2?Kt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Kt+=4503599627370496+this.words[1]*67108864:this.length>2&&_(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Kt:Kt},rt.prototype.toJSON=function(){return this.toString(16)},rt.prototype.toBuffer=function(Kt,Ft){return _(typeof ot<"u"),this.toArrayLike(ot,Kt,Ft)},rt.prototype.toArray=function(Kt,Ft){return this.toArrayLike(Array,Kt,Ft)},rt.prototype.toArrayLike=function(Kt,Ft,bt){var St=this.byteLength(),Jt=bt||Math.max(1,St);_(St<=Jt,"byte array longer than desired length"),_(Jt>0,"Requested array length <= 0"),this.strip();var er=Ft==="le",sr=new Kt(Jt),nr,Dt,Tt=this.clone();if(er){for(Dt=0;!Tt.isZero();Dt++)nr=Tt.andln(255),Tt.iushrn(8),sr[Dt]=nr;for(;Dt<Jt;Dt++)sr[Dt]=0}else{for(Dt=0;Dt<Jt-St;Dt++)sr[Dt]=0;for(Dt=0;!Tt.isZero();Dt++)nr=Tt.andln(255),Tt.iushrn(8),sr[Jt-Dt-1]=nr}return sr},Math.clz32?rt.prototype._countBits=function(Kt){return 32-Math.clz32(Kt)}:rt.prototype._countBits=function(Kt){var Ft=Kt,bt=0;return Ft>=4096&&(bt+=13,Ft>>>=13),Ft>=64&&(bt+=7,Ft>>>=7),Ft>=8&&(bt+=4,Ft>>>=4),Ft>=2&&(bt+=2,Ft>>>=2),bt+Ft},rt.prototype._zeroBits=function(Kt){if(Kt===0)return 26;var Ft=Kt,bt=0;return Ft&8191||(bt+=13,Ft>>>=13),Ft&127||(bt+=7,Ft>>>=7),Ft&15||(bt+=4,Ft>>>=4),Ft&3||(bt+=2,Ft>>>=2),Ft&1||bt++,bt},rt.prototype.bitLength=function(){var Kt=this.words[this.length-1],Ft=this._countBits(Kt);return(this.length-1)*26+Ft};function mt(Br){for(var Kt=new Array(Br.bitLength()),Ft=0;Ft<Kt.length;Ft++){var bt=Ft/26|0,St=Ft%26;Kt[Ft]=(Br.words[bt]&1<<St)>>>St}return Kt}rt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Kt=0,Ft=0;Ft<this.length;Ft++){var bt=this._zeroBits(this.words[Ft]);if(Kt+=bt,bt!==26)break}return Kt},rt.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},rt.prototype.toTwos=function(Kt){return this.negative!==0?this.abs().inotn(Kt).iaddn(1):this.clone()},rt.prototype.fromTwos=function(Kt){return this.testn(Kt-1)?this.notn(Kt).iaddn(1).ineg():this.clone()},rt.prototype.isNeg=function(){return this.negative!==0},rt.prototype.neg=function(){return this.clone().ineg()},rt.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},rt.prototype.iuor=function(Kt){for(;this.length<Kt.length;)this.words[this.length++]=0;for(var Ft=0;Ft<Kt.length;Ft++)this.words[Ft]=this.words[Ft]|Kt.words[Ft];return this.strip()},rt.prototype.ior=function(Kt){return _((this.negative|Kt.negative)===0),this.iuor(Kt)},rt.prototype.or=function(Kt){return this.length>Kt.length?this.clone().ior(Kt):Kt.clone().ior(this)},rt.prototype.uor=function(Kt){return this.length>Kt.length?this.clone().iuor(Kt):Kt.clone().iuor(this)},rt.prototype.iuand=function(Kt){var Ft;this.length>Kt.length?Ft=Kt:Ft=this;for(var bt=0;bt<Ft.length;bt++)this.words[bt]=this.words[bt]&Kt.words[bt];return this.length=Ft.length,this.strip()},rt.prototype.iand=function(Kt){return _((this.negative|Kt.negative)===0),this.iuand(Kt)},rt.prototype.and=function(Kt){return this.length>Kt.length?this.clone().iand(Kt):Kt.clone().iand(this)},rt.prototype.uand=function(Kt){return this.length>Kt.length?this.clone().iuand(Kt):Kt.clone().iuand(this)},rt.prototype.iuxor=function(Kt){var Ft,bt;this.length>Kt.length?(Ft=this,bt=Kt):(Ft=Kt,bt=this);for(var St=0;St<bt.length;St++)this.words[St]=Ft.words[St]^bt.words[St];if(this!==Ft)for(;St<Ft.length;St++)this.words[St]=Ft.words[St];return this.length=Ft.length,this.strip()},rt.prototype.ixor=function(Kt){return _((this.negative|Kt.negative)===0),this.iuxor(Kt)},rt.prototype.xor=function(Kt){return this.length>Kt.length?this.clone().ixor(Kt):Kt.clone().ixor(this)},rt.prototype.uxor=function(Kt){return this.length>Kt.length?this.clone().iuxor(Kt):Kt.clone().iuxor(this)},rt.prototype.inotn=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Math.ceil(Kt/26)|0,bt=Kt%26;this._expand(Ft),bt>0&&Ft--;for(var St=0;St<Ft;St++)this.words[St]=~this.words[St]&67108863;return bt>0&&(this.words[St]=~this.words[St]&67108863>>26-bt),this.strip()},rt.prototype.notn=function(Kt){return this.clone().inotn(Kt)},rt.prototype.setn=function(Kt,Ft){_(typeof Kt=="number"&&Kt>=0);var bt=Kt/26|0,St=Kt%26;return this._expand(bt+1),Ft?this.words[bt]=this.words[bt]|1<<St:this.words[bt]=this.words[bt]&~(1<<St),this.strip()},rt.prototype.iadd=function(Kt){var Ft;if(this.negative!==0&&Kt.negative===0)return this.negative=0,Ft=this.isub(Kt),this.negative^=1,this._normSign();if(this.negative===0&&Kt.negative!==0)return Kt.negative=0,Ft=this.isub(Kt),Kt.negative=1,Ft._normSign();var bt,St;this.length>Kt.length?(bt=this,St=Kt):(bt=Kt,St=this);for(var Jt=0,er=0;er<St.length;er++)Ft=(bt.words[er]|0)+(St.words[er]|0)+Jt,this.words[er]=Ft&67108863,Jt=Ft>>>26;for(;Jt!==0&&er<bt.length;er++)Ft=(bt.words[er]|0)+Jt,this.words[er]=Ft&67108863,Jt=Ft>>>26;if(this.length=bt.length,Jt!==0)this.words[this.length]=Jt,this.length++;else if(bt!==this)for(;er<bt.length;er++)this.words[er]=bt.words[er];return this},rt.prototype.add=function(Kt){var Ft;return Kt.negative!==0&&this.negative===0?(Kt.negative=0,Ft=this.sub(Kt),Kt.negative^=1,Ft):Kt.negative===0&&this.negative!==0?(this.negative=0,Ft=Kt.sub(this),this.negative=1,Ft):this.length>Kt.length?this.clone().iadd(Kt):Kt.clone().iadd(this)},rt.prototype.isub=function(Kt){if(Kt.negative!==0){Kt.negative=0;var Ft=this.iadd(Kt);return Kt.negative=1,Ft._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Kt),this.negative=1,this._normSign();var bt=this.cmp(Kt);if(bt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var St,Jt;bt>0?(St=this,Jt=Kt):(St=Kt,Jt=this);for(var er=0,sr=0;sr<Jt.length;sr++)Ft=(St.words[sr]|0)-(Jt.words[sr]|0)+er,er=Ft>>26,this.words[sr]=Ft&67108863;for(;er!==0&&sr<St.length;sr++)Ft=(St.words[sr]|0)+er,er=Ft>>26,this.words[sr]=Ft&67108863;if(er===0&&sr<St.length&&St!==this)for(;sr<St.length;sr++)this.words[sr]=St.words[sr];return this.length=Math.max(this.length,sr),St!==this&&(this.negative=1),this.strip()},rt.prototype.sub=function(Kt){return this.clone().isub(Kt)};function Yt(Br,Kt,Ft){Ft.negative=Kt.negative^Br.negative;var bt=Br.length+Kt.length|0;Ft.length=bt,bt=bt-1|0;var St=Br.words[0]|0,Jt=Kt.words[0]|0,er=St*Jt,sr=er&67108863,nr=er/67108864|0;Ft.words[0]=sr;for(var Dt=1;Dt<bt;Dt++){for(var Tt=nr>>>26,Mt=nr&67108863,dr=Math.min(Dt,Kt.length-1),Nr=Math.max(0,Dt-Br.length+1);Nr<=dr;Nr++){var qt=Dt-Nr|0;St=Br.words[qt]|0,Jt=Kt.words[Nr]|0,er=St*Jt+Mt,Tt+=er/67108864|0,Mt=er&67108863}Ft.words[Dt]=Mt|0,nr=Tt|0}return nr!==0?Ft.words[Dt]=nr|0:Ft.length--,Ft.strip()}var Rt=function(Kt,Ft,bt){var St=Kt.words,Jt=Ft.words,er=bt.words,sr=0,nr,Dt,Tt,Mt=St[0]|0,dr=Mt&8191,Nr=Mt>>>13,qt=St[1]|0,Fr=qt&8191,jr=qt>>>13,Wr=St[2]|0,Zr=Wr&8191,b0=Wr>>>13,E0=St[3]|0,m0=E0&8191,vn=E0>>>13,N0=St[4]|0,L0=N0&8191,_i=N0>>>13,na=St[5]|0,Z0=na&8191,Rn=na>>>13,ga=St[6]|0,ln=ga&8191,e0=ga>>>13,v0=St[7]|0,y0=v0&8191,Q0=v0>>>13,R0=St[8]|0,Ot=R0&8191,J0=R0>>>13,sn=St[9]|0,M0=sn&8191,pn=sn>>>13,In=Jt[0]|0,nn=In&8191,Gn=In>>>13,Mn=Jt[1]|0,an=Mn&8191,Pn=Mn>>>13,Bn=Jt[2]|0,cn=Bn&8191,Ln=Bn>>>13,On=Jt[3]|0,en=On&8191,Yn=On>>>13,zn=Jt[4]|0,fn=zn&8191,jn=zn>>>13,Vn=Jt[5]|0,An=Vn&8191,qn=Vn>>>13,Kn=Jt[6]|0,hn=Kn&8191,Wn=Kn>>>13,Xn=Jt[7]|0,X0=Xn&8191,$n=Xn>>>13,wn=Jt[8]|0,G0=wn&8191,Jn=wn>>>13,Nn=Jt[9]|0,un=Nn&8191,Zn=Nn>>>13;bt.negative=Kt.negative^Ft.negative,bt.length=19,nr=Math.imul(dr,nn),Dt=Math.imul(dr,Gn),Dt=Dt+Math.imul(Nr,nn)|0,Tt=Math.imul(Nr,Gn);var Un=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(Un>>>26)|0,Un&=67108863,nr=Math.imul(Fr,nn),Dt=Math.imul(Fr,Gn),Dt=Dt+Math.imul(jr,nn)|0,Tt=Math.imul(jr,Gn),nr=nr+Math.imul(dr,an)|0,Dt=Dt+Math.imul(dr,Pn)|0,Dt=Dt+Math.imul(Nr,an)|0,Tt=Tt+Math.imul(Nr,Pn)|0;var Fn=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,nr=Math.imul(Zr,nn),Dt=Math.imul(Zr,Gn),Dt=Dt+Math.imul(b0,nn)|0,Tt=Math.imul(b0,Gn),nr=nr+Math.imul(Fr,an)|0,Dt=Dt+Math.imul(Fr,Pn)|0,Dt=Dt+Math.imul(jr,an)|0,Tt=Tt+Math.imul(jr,Pn)|0,nr=nr+Math.imul(dr,cn)|0,Dt=Dt+Math.imul(dr,Ln)|0,Dt=Dt+Math.imul(Nr,cn)|0,Tt=Tt+Math.imul(Nr,Ln)|0;var oo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(oo>>>26)|0,oo&=67108863,nr=Math.imul(m0,nn),Dt=Math.imul(m0,Gn),Dt=Dt+Math.imul(vn,nn)|0,Tt=Math.imul(vn,Gn),nr=nr+Math.imul(Zr,an)|0,Dt=Dt+Math.imul(Zr,Pn)|0,Dt=Dt+Math.imul(b0,an)|0,Tt=Tt+Math.imul(b0,Pn)|0,nr=nr+Math.imul(Fr,cn)|0,Dt=Dt+Math.imul(Fr,Ln)|0,Dt=Dt+Math.imul(jr,cn)|0,Tt=Tt+Math.imul(jr,Ln)|0,nr=nr+Math.imul(dr,en)|0,Dt=Dt+Math.imul(dr,Yn)|0,Dt=Dt+Math.imul(Nr,en)|0,Tt=Tt+Math.imul(Nr,Yn)|0;var Ao=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(Ao>>>26)|0,Ao&=67108863,nr=Math.imul(L0,nn),Dt=Math.imul(L0,Gn),Dt=Dt+Math.imul(_i,nn)|0,Tt=Math.imul(_i,Gn),nr=nr+Math.imul(m0,an)|0,Dt=Dt+Math.imul(m0,Pn)|0,Dt=Dt+Math.imul(vn,an)|0,Tt=Tt+Math.imul(vn,Pn)|0,nr=nr+Math.imul(Zr,cn)|0,Dt=Dt+Math.imul(Zr,Ln)|0,Dt=Dt+Math.imul(b0,cn)|0,Tt=Tt+Math.imul(b0,Ln)|0,nr=nr+Math.imul(Fr,en)|0,Dt=Dt+Math.imul(Fr,Yn)|0,Dt=Dt+Math.imul(jr,en)|0,Tt=Tt+Math.imul(jr,Yn)|0,nr=nr+Math.imul(dr,fn)|0,Dt=Dt+Math.imul(dr,jn)|0,Dt=Dt+Math.imul(Nr,fn)|0,Tt=Tt+Math.imul(Nr,jn)|0;var eo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(eo>>>26)|0,eo&=67108863,nr=Math.imul(Z0,nn),Dt=Math.imul(Z0,Gn),Dt=Dt+Math.imul(Rn,nn)|0,Tt=Math.imul(Rn,Gn),nr=nr+Math.imul(L0,an)|0,Dt=Dt+Math.imul(L0,Pn)|0,Dt=Dt+Math.imul(_i,an)|0,Tt=Tt+Math.imul(_i,Pn)|0,nr=nr+Math.imul(m0,cn)|0,Dt=Dt+Math.imul(m0,Ln)|0,Dt=Dt+Math.imul(vn,cn)|0,Tt=Tt+Math.imul(vn,Ln)|0,nr=nr+Math.imul(Zr,en)|0,Dt=Dt+Math.imul(Zr,Yn)|0,Dt=Dt+Math.imul(b0,en)|0,Tt=Tt+Math.imul(b0,Yn)|0,nr=nr+Math.imul(Fr,fn)|0,Dt=Dt+Math.imul(Fr,jn)|0,Dt=Dt+Math.imul(jr,fn)|0,Tt=Tt+Math.imul(jr,jn)|0,nr=nr+Math.imul(dr,An)|0,Dt=Dt+Math.imul(dr,qn)|0,Dt=Dt+Math.imul(Nr,An)|0,Tt=Tt+Math.imul(Nr,qn)|0;var to=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(to>>>26)|0,to&=67108863,nr=Math.imul(ln,nn),Dt=Math.imul(ln,Gn),Dt=Dt+Math.imul(e0,nn)|0,Tt=Math.imul(e0,Gn),nr=nr+Math.imul(Z0,an)|0,Dt=Dt+Math.imul(Z0,Pn)|0,Dt=Dt+Math.imul(Rn,an)|0,Tt=Tt+Math.imul(Rn,Pn)|0,nr=nr+Math.imul(L0,cn)|0,Dt=Dt+Math.imul(L0,Ln)|0,Dt=Dt+Math.imul(_i,cn)|0,Tt=Tt+Math.imul(_i,Ln)|0,nr=nr+Math.imul(m0,en)|0,Dt=Dt+Math.imul(m0,Yn)|0,Dt=Dt+Math.imul(vn,en)|0,Tt=Tt+Math.imul(vn,Yn)|0,nr=nr+Math.imul(Zr,fn)|0,Dt=Dt+Math.imul(Zr,jn)|0,Dt=Dt+Math.imul(b0,fn)|0,Tt=Tt+Math.imul(b0,jn)|0,nr=nr+Math.imul(Fr,An)|0,Dt=Dt+Math.imul(Fr,qn)|0,Dt=Dt+Math.imul(jr,An)|0,Tt=Tt+Math.imul(jr,qn)|0,nr=nr+Math.imul(dr,hn)|0,Dt=Dt+Math.imul(dr,Wn)|0,Dt=Dt+Math.imul(Nr,hn)|0,Tt=Tt+Math.imul(Nr,Wn)|0;var co=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(co>>>26)|0,co&=67108863,nr=Math.imul(y0,nn),Dt=Math.imul(y0,Gn),Dt=Dt+Math.imul(Q0,nn)|0,Tt=Math.imul(Q0,Gn),nr=nr+Math.imul(ln,an)|0,Dt=Dt+Math.imul(ln,Pn)|0,Dt=Dt+Math.imul(e0,an)|0,Tt=Tt+Math.imul(e0,Pn)|0,nr=nr+Math.imul(Z0,cn)|0,Dt=Dt+Math.imul(Z0,Ln)|0,Dt=Dt+Math.imul(Rn,cn)|0,Tt=Tt+Math.imul(Rn,Ln)|0,nr=nr+Math.imul(L0,en)|0,Dt=Dt+Math.imul(L0,Yn)|0,Dt=Dt+Math.imul(_i,en)|0,Tt=Tt+Math.imul(_i,Yn)|0,nr=nr+Math.imul(m0,fn)|0,Dt=Dt+Math.imul(m0,jn)|0,Dt=Dt+Math.imul(vn,fn)|0,Tt=Tt+Math.imul(vn,jn)|0,nr=nr+Math.imul(Zr,An)|0,Dt=Dt+Math.imul(Zr,qn)|0,Dt=Dt+Math.imul(b0,An)|0,Tt=Tt+Math.imul(b0,qn)|0,nr=nr+Math.imul(Fr,hn)|0,Dt=Dt+Math.imul(Fr,Wn)|0,Dt=Dt+Math.imul(jr,hn)|0,Tt=Tt+Math.imul(jr,Wn)|0,nr=nr+Math.imul(dr,X0)|0,Dt=Dt+Math.imul(dr,$n)|0,Dt=Dt+Math.imul(Nr,X0)|0,Tt=Tt+Math.imul(Nr,$n)|0;var xo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(xo>>>26)|0,xo&=67108863,nr=Math.imul(Ot,nn),Dt=Math.imul(Ot,Gn),Dt=Dt+Math.imul(J0,nn)|0,Tt=Math.imul(J0,Gn),nr=nr+Math.imul(y0,an)|0,Dt=Dt+Math.imul(y0,Pn)|0,Dt=Dt+Math.imul(Q0,an)|0,Tt=Tt+Math.imul(Q0,Pn)|0,nr=nr+Math.imul(ln,cn)|0,Dt=Dt+Math.imul(ln,Ln)|0,Dt=Dt+Math.imul(e0,cn)|0,Tt=Tt+Math.imul(e0,Ln)|0,nr=nr+Math.imul(Z0,en)|0,Dt=Dt+Math.imul(Z0,Yn)|0,Dt=Dt+Math.imul(Rn,en)|0,Tt=Tt+Math.imul(Rn,Yn)|0,nr=nr+Math.imul(L0,fn)|0,Dt=Dt+Math.imul(L0,jn)|0,Dt=Dt+Math.imul(_i,fn)|0,Tt=Tt+Math.imul(_i,jn)|0,nr=nr+Math.imul(m0,An)|0,Dt=Dt+Math.imul(m0,qn)|0,Dt=Dt+Math.imul(vn,An)|0,Tt=Tt+Math.imul(vn,qn)|0,nr=nr+Math.imul(Zr,hn)|0,Dt=Dt+Math.imul(Zr,Wn)|0,Dt=Dt+Math.imul(b0,hn)|0,Tt=Tt+Math.imul(b0,Wn)|0,nr=nr+Math.imul(Fr,X0)|0,Dt=Dt+Math.imul(Fr,$n)|0,Dt=Dt+Math.imul(jr,X0)|0,Tt=Tt+Math.imul(jr,$n)|0,nr=nr+Math.imul(dr,G0)|0,Dt=Dt+Math.imul(dr,Jn)|0,Dt=Dt+Math.imul(Nr,G0)|0,Tt=Tt+Math.imul(Nr,Jn)|0;var uo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(uo>>>26)|0,uo&=67108863,nr=Math.imul(M0,nn),Dt=Math.imul(M0,Gn),Dt=Dt+Math.imul(pn,nn)|0,Tt=Math.imul(pn,Gn),nr=nr+Math.imul(Ot,an)|0,Dt=Dt+Math.imul(Ot,Pn)|0,Dt=Dt+Math.imul(J0,an)|0,Tt=Tt+Math.imul(J0,Pn)|0,nr=nr+Math.imul(y0,cn)|0,Dt=Dt+Math.imul(y0,Ln)|0,Dt=Dt+Math.imul(Q0,cn)|0,Tt=Tt+Math.imul(Q0,Ln)|0,nr=nr+Math.imul(ln,en)|0,Dt=Dt+Math.imul(ln,Yn)|0,Dt=Dt+Math.imul(e0,en)|0,Tt=Tt+Math.imul(e0,Yn)|0,nr=nr+Math.imul(Z0,fn)|0,Dt=Dt+Math.imul(Z0,jn)|0,Dt=Dt+Math.imul(Rn,fn)|0,Tt=Tt+Math.imul(Rn,jn)|0,nr=nr+Math.imul(L0,An)|0,Dt=Dt+Math.imul(L0,qn)|0,Dt=Dt+Math.imul(_i,An)|0,Tt=Tt+Math.imul(_i,qn)|0,nr=nr+Math.imul(m0,hn)|0,Dt=Dt+Math.imul(m0,Wn)|0,Dt=Dt+Math.imul(vn,hn)|0,Tt=Tt+Math.imul(vn,Wn)|0,nr=nr+Math.imul(Zr,X0)|0,Dt=Dt+Math.imul(Zr,$n)|0,Dt=Dt+Math.imul(b0,X0)|0,Tt=Tt+Math.imul(b0,$n)|0,nr=nr+Math.imul(Fr,G0)|0,Dt=Dt+Math.imul(Fr,Jn)|0,Dt=Dt+Math.imul(jr,G0)|0,Tt=Tt+Math.imul(jr,Jn)|0,nr=nr+Math.imul(dr,un)|0,Dt=Dt+Math.imul(dr,Zn)|0,Dt=Dt+Math.imul(Nr,un)|0,Tt=Tt+Math.imul(Nr,Zn)|0;var po=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(po>>>26)|0,po&=67108863,nr=Math.imul(M0,an),Dt=Math.imul(M0,Pn),Dt=Dt+Math.imul(pn,an)|0,Tt=Math.imul(pn,Pn),nr=nr+Math.imul(Ot,cn)|0,Dt=Dt+Math.imul(Ot,Ln)|0,Dt=Dt+Math.imul(J0,cn)|0,Tt=Tt+Math.imul(J0,Ln)|0,nr=nr+Math.imul(y0,en)|0,Dt=Dt+Math.imul(y0,Yn)|0,Dt=Dt+Math.imul(Q0,en)|0,Tt=Tt+Math.imul(Q0,Yn)|0,nr=nr+Math.imul(ln,fn)|0,Dt=Dt+Math.imul(ln,jn)|0,Dt=Dt+Math.imul(e0,fn)|0,Tt=Tt+Math.imul(e0,jn)|0,nr=nr+Math.imul(Z0,An)|0,Dt=Dt+Math.imul(Z0,qn)|0,Dt=Dt+Math.imul(Rn,An)|0,Tt=Tt+Math.imul(Rn,qn)|0,nr=nr+Math.imul(L0,hn)|0,Dt=Dt+Math.imul(L0,Wn)|0,Dt=Dt+Math.imul(_i,hn)|0,Tt=Tt+Math.imul(_i,Wn)|0,nr=nr+Math.imul(m0,X0)|0,Dt=Dt+Math.imul(m0,$n)|0,Dt=Dt+Math.imul(vn,X0)|0,Tt=Tt+Math.imul(vn,$n)|0,nr=nr+Math.imul(Zr,G0)|0,Dt=Dt+Math.imul(Zr,Jn)|0,Dt=Dt+Math.imul(b0,G0)|0,Tt=Tt+Math.imul(b0,Jn)|0,nr=nr+Math.imul(Fr,un)|0,Dt=Dt+Math.imul(Fr,Zn)|0,Dt=Dt+Math.imul(jr,un)|0,Tt=Tt+Math.imul(jr,Zn)|0;var bo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(bo>>>26)|0,bo&=67108863,nr=Math.imul(M0,cn),Dt=Math.imul(M0,Ln),Dt=Dt+Math.imul(pn,cn)|0,Tt=Math.imul(pn,Ln),nr=nr+Math.imul(Ot,en)|0,Dt=Dt+Math.imul(Ot,Yn)|0,Dt=Dt+Math.imul(J0,en)|0,Tt=Tt+Math.imul(J0,Yn)|0,nr=nr+Math.imul(y0,fn)|0,Dt=Dt+Math.imul(y0,jn)|0,Dt=Dt+Math.imul(Q0,fn)|0,Tt=Tt+Math.imul(Q0,jn)|0,nr=nr+Math.imul(ln,An)|0,Dt=Dt+Math.imul(ln,qn)|0,Dt=Dt+Math.imul(e0,An)|0,Tt=Tt+Math.imul(e0,qn)|0,nr=nr+Math.imul(Z0,hn)|0,Dt=Dt+Math.imul(Z0,Wn)|0,Dt=Dt+Math.imul(Rn,hn)|0,Tt=Tt+Math.imul(Rn,Wn)|0,nr=nr+Math.imul(L0,X0)|0,Dt=Dt+Math.imul(L0,$n)|0,Dt=Dt+Math.imul(_i,X0)|0,Tt=Tt+Math.imul(_i,$n)|0,nr=nr+Math.imul(m0,G0)|0,Dt=Dt+Math.imul(m0,Jn)|0,Dt=Dt+Math.imul(vn,G0)|0,Tt=Tt+Math.imul(vn,Jn)|0,nr=nr+Math.imul(Zr,un)|0,Dt=Dt+Math.imul(Zr,Zn)|0,Dt=Dt+Math.imul(b0,un)|0,Tt=Tt+Math.imul(b0,Zn)|0;var mo=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(mo>>>26)|0,mo&=67108863,nr=Math.imul(M0,en),Dt=Math.imul(M0,Yn),Dt=Dt+Math.imul(pn,en)|0,Tt=Math.imul(pn,Yn),nr=nr+Math.imul(Ot,fn)|0,Dt=Dt+Math.imul(Ot,jn)|0,Dt=Dt+Math.imul(J0,fn)|0,Tt=Tt+Math.imul(J0,jn)|0,nr=nr+Math.imul(y0,An)|0,Dt=Dt+Math.imul(y0,qn)|0,Dt=Dt+Math.imul(Q0,An)|0,Tt=Tt+Math.imul(Q0,qn)|0,nr=nr+Math.imul(ln,hn)|0,Dt=Dt+Math.imul(ln,Wn)|0,Dt=Dt+Math.imul(e0,hn)|0,Tt=Tt+Math.imul(e0,Wn)|0,nr=nr+Math.imul(Z0,X0)|0,Dt=Dt+Math.imul(Z0,$n)|0,Dt=Dt+Math.imul(Rn,X0)|0,Tt=Tt+Math.imul(Rn,$n)|0,nr=nr+Math.imul(L0,G0)|0,Dt=Dt+Math.imul(L0,Jn)|0,Dt=Dt+Math.imul(_i,G0)|0,Tt=Tt+Math.imul(_i,Jn)|0,nr=nr+Math.imul(m0,un)|0,Dt=Dt+Math.imul(m0,Zn)|0,Dt=Dt+Math.imul(vn,un)|0,Tt=Tt+Math.imul(vn,Zn)|0;var f0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(f0>>>26)|0,f0&=67108863,nr=Math.imul(M0,fn),Dt=Math.imul(M0,jn),Dt=Dt+Math.imul(pn,fn)|0,Tt=Math.imul(pn,jn),nr=nr+Math.imul(Ot,An)|0,Dt=Dt+Math.imul(Ot,qn)|0,Dt=Dt+Math.imul(J0,An)|0,Tt=Tt+Math.imul(J0,qn)|0,nr=nr+Math.imul(y0,hn)|0,Dt=Dt+Math.imul(y0,Wn)|0,Dt=Dt+Math.imul(Q0,hn)|0,Tt=Tt+Math.imul(Q0,Wn)|0,nr=nr+Math.imul(ln,X0)|0,Dt=Dt+Math.imul(ln,$n)|0,Dt=Dt+Math.imul(e0,X0)|0,Tt=Tt+Math.imul(e0,$n)|0,nr=nr+Math.imul(Z0,G0)|0,Dt=Dt+Math.imul(Z0,Jn)|0,Dt=Dt+Math.imul(Rn,G0)|0,Tt=Tt+Math.imul(Rn,Jn)|0,nr=nr+Math.imul(L0,un)|0,Dt=Dt+Math.imul(L0,Zn)|0,Dt=Dt+Math.imul(_i,un)|0,Tt=Tt+Math.imul(_i,Zn)|0;var k0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(k0>>>26)|0,k0&=67108863,nr=Math.imul(M0,An),Dt=Math.imul(M0,qn),Dt=Dt+Math.imul(pn,An)|0,Tt=Math.imul(pn,qn),nr=nr+Math.imul(Ot,hn)|0,Dt=Dt+Math.imul(Ot,Wn)|0,Dt=Dt+Math.imul(J0,hn)|0,Tt=Tt+Math.imul(J0,Wn)|0,nr=nr+Math.imul(y0,X0)|0,Dt=Dt+Math.imul(y0,$n)|0,Dt=Dt+Math.imul(Q0,X0)|0,Tt=Tt+Math.imul(Q0,$n)|0,nr=nr+Math.imul(ln,G0)|0,Dt=Dt+Math.imul(ln,Jn)|0,Dt=Dt+Math.imul(e0,G0)|0,Tt=Tt+Math.imul(e0,Jn)|0,nr=nr+Math.imul(Z0,un)|0,Dt=Dt+Math.imul(Z0,Zn)|0,Dt=Dt+Math.imul(Rn,un)|0,Tt=Tt+Math.imul(Rn,Zn)|0;var H0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(H0>>>26)|0,H0&=67108863,nr=Math.imul(M0,hn),Dt=Math.imul(M0,Wn),Dt=Dt+Math.imul(pn,hn)|0,Tt=Math.imul(pn,Wn),nr=nr+Math.imul(Ot,X0)|0,Dt=Dt+Math.imul(Ot,$n)|0,Dt=Dt+Math.imul(J0,X0)|0,Tt=Tt+Math.imul(J0,$n)|0,nr=nr+Math.imul(y0,G0)|0,Dt=Dt+Math.imul(y0,Jn)|0,Dt=Dt+Math.imul(Q0,G0)|0,Tt=Tt+Math.imul(Q0,Jn)|0,nr=nr+Math.imul(ln,un)|0,Dt=Dt+Math.imul(ln,Zn)|0,Dt=Dt+Math.imul(e0,un)|0,Tt=Tt+Math.imul(e0,Zn)|0;var T0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(T0>>>26)|0,T0&=67108863,nr=Math.imul(M0,X0),Dt=Math.imul(M0,$n),Dt=Dt+Math.imul(pn,X0)|0,Tt=Math.imul(pn,$n),nr=nr+Math.imul(Ot,G0)|0,Dt=Dt+Math.imul(Ot,Jn)|0,Dt=Dt+Math.imul(J0,G0)|0,Tt=Tt+Math.imul(J0,Jn)|0,nr=nr+Math.imul(y0,un)|0,Dt=Dt+Math.imul(y0,Zn)|0,Dt=Dt+Math.imul(Q0,un)|0,Tt=Tt+Math.imul(Q0,Zn)|0;var tn=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(tn>>>26)|0,tn&=67108863,nr=Math.imul(M0,G0),Dt=Math.imul(M0,Jn),Dt=Dt+Math.imul(pn,G0)|0,Tt=Math.imul(pn,Jn),nr=nr+Math.imul(Ot,un)|0,Dt=Dt+Math.imul(Ot,Zn)|0,Dt=Dt+Math.imul(J0,un)|0,Tt=Tt+Math.imul(J0,Zn)|0;var V0=(sr+nr|0)+((Dt&8191)<<13)|0;sr=(Tt+(Dt>>>13)|0)+(V0>>>26)|0,V0&=67108863,nr=Math.imul(M0,un),Dt=Math.imul(M0,Zn),Dt=Dt+Math.imul(pn,un)|0,Tt=Math.imul(pn,Zn);var dn=(sr+nr|0)+((Dt&8191)<<13)|0;return sr=(Tt+(Dt>>>13)|0)+(dn>>>26)|0,dn&=67108863,er[0]=Un,er[1]=Fn,er[2]=oo,er[3]=Ao,er[4]=eo,er[5]=to,er[6]=co,er[7]=xo,er[8]=uo,er[9]=po,er[10]=bo,er[11]=mo,er[12]=f0,er[13]=k0,er[14]=H0,er[15]=T0,er[16]=tn,er[17]=V0,er[18]=dn,sr!==0&&(er[19]=sr,bt.length++),bt};Math.imul||(Rt=Yt);function cr(Br,Kt,Ft){Ft.negative=Kt.negative^Br.negative,Ft.length=Br.length+Kt.length;for(var bt=0,St=0,Jt=0;Jt<Ft.length-1;Jt++){var er=St;St=0;for(var sr=bt&67108863,nr=Math.min(Jt,Kt.length-1),Dt=Math.max(0,Jt-Br.length+1);Dt<=nr;Dt++){var Tt=Jt-Dt,Mt=Br.words[Tt]|0,dr=Kt.words[Dt]|0,Nr=Mt*dr,qt=Nr&67108863;er=er+(Nr/67108864|0)|0,qt=qt+sr|0,sr=qt&67108863,er=er+(qt>>>26)|0,St+=er>>>26,er&=67108863}Ft.words[Jt]=sr,bt=er,er=St}return bt!==0?Ft.words[Jt]=bt:Ft.length--,Ft.strip()}function Ut(Br,Kt,Ft){var bt=new zt;return bt.mulp(Br,Kt,Ft)}rt.prototype.mulTo=function(Kt,Ft){var bt,St=this.length+Kt.length;return this.length===10&&Kt.length===10?bt=Rt(this,Kt,Ft):St<63?bt=Yt(this,Kt,Ft):St<1024?bt=cr(this,Kt,Ft):bt=Ut(this,Kt,Ft),bt};function zt(Br,Kt){this.x=Br,this.y=Kt}zt.prototype.makeRBT=function(Kt){for(var Ft=new Array(Kt),bt=rt.prototype._countBits(Kt)-1,St=0;St<Kt;St++)Ft[St]=this.revBin(St,bt,Kt);return Ft},zt.prototype.revBin=function(Kt,Ft,bt){if(Kt===0||Kt===bt-1)return Kt;for(var St=0,Jt=0;Jt<Ft;Jt++)St|=(Kt&1)<<Ft-Jt-1,Kt>>=1;return St},zt.prototype.permute=function(Kt,Ft,bt,St,Jt,er){for(var sr=0;sr<er;sr++)St[sr]=Ft[Kt[sr]],Jt[sr]=bt[Kt[sr]]},zt.prototype.transform=function(Kt,Ft,bt,St,Jt,er){this.permute(er,Kt,Ft,bt,St,Jt);for(var sr=1;sr<Jt;sr<<=1)for(var nr=sr<<1,Dt=Math.cos(2*Math.PI/nr),Tt=Math.sin(2*Math.PI/nr),Mt=0;Mt<Jt;Mt+=nr)for(var dr=Dt,Nr=Tt,qt=0;qt<sr;qt++){var Fr=bt[Mt+qt],jr=St[Mt+qt],Wr=bt[Mt+qt+sr],Zr=St[Mt+qt+sr],b0=dr*Wr-Nr*Zr;Zr=dr*Zr+Nr*Wr,Wr=b0,bt[Mt+qt]=Fr+Wr,St[Mt+qt]=jr+Zr,bt[Mt+qt+sr]=Fr-Wr,St[Mt+qt+sr]=jr-Zr,qt!==nr&&(b0=Dt*dr-Tt*Nr,Nr=Dt*Nr+Tt*dr,dr=b0)}},zt.prototype.guessLen13b=function(Kt,Ft){var bt=Math.max(Ft,Kt)|1,St=bt&1,Jt=0;for(bt=bt/2|0;bt;bt=bt>>>1)Jt++;return 1<<Jt+1+St},zt.prototype.conjugate=function(Kt,Ft,bt){if(!(bt<=1))for(var St=0;St<bt/2;St++){var Jt=Kt[St];Kt[St]=Kt[bt-St-1],Kt[bt-St-1]=Jt,Jt=Ft[St],Ft[St]=-Ft[bt-St-1],Ft[bt-St-1]=-Jt}},zt.prototype.normalize13b=function(Kt,Ft){for(var bt=0,St=0;St<Ft/2;St++){var Jt=Math.round(Kt[2*St+1]/Ft)*8192+Math.round(Kt[2*St]/Ft)+bt;Kt[St]=Jt&67108863,Jt<67108864?bt=0:bt=Jt/67108864|0}return Kt},zt.prototype.convert13b=function(Kt,Ft,bt,St){for(var Jt=0,er=0;er<Ft;er++)Jt=Jt+(Kt[er]|0),bt[2*er]=Jt&8191,Jt=Jt>>>13,bt[2*er+1]=Jt&8191,Jt=Jt>>>13;for(er=2*Ft;er<St;++er)bt[er]=0;_(Jt===0),_((Jt&-8192)===0)},zt.prototype.stub=function(Kt){for(var Ft=new Array(Kt),bt=0;bt<Kt;bt++)Ft[bt]=0;return Ft},zt.prototype.mulp=function(Kt,Ft,bt){var St=2*this.guessLen13b(Kt.length,Ft.length),Jt=this.makeRBT(St),er=this.stub(St),sr=new Array(St),nr=new Array(St),Dt=new Array(St),Tt=new Array(St),Mt=new Array(St),dr=new Array(St),Nr=bt.words;Nr.length=St,this.convert13b(Kt.words,Kt.length,sr,St),this.convert13b(Ft.words,Ft.length,Tt,St),this.transform(sr,er,nr,Dt,St,Jt),this.transform(Tt,er,Mt,dr,St,Jt);for(var qt=0;qt<St;qt++){var Fr=nr[qt]*Mt[qt]-Dt[qt]*dr[qt];Dt[qt]=nr[qt]*dr[qt]+Dt[qt]*Mt[qt],nr[qt]=Fr}return this.conjugate(nr,Dt,St),this.transform(nr,Dt,Nr,er,St,Jt),this.conjugate(Nr,er,St),this.normalize13b(Nr,St),bt.negative=Kt.negative^Ft.negative,bt.length=Kt.length+Ft.length,bt.strip()},rt.prototype.mul=function(Kt){var Ft=new rt(null);return Ft.words=new Array(this.length+Kt.length),this.mulTo(Kt,Ft)},rt.prototype.mulf=function(Kt){var Ft=new rt(null);return Ft.words=new Array(this.length+Kt.length),Ut(this,Kt,Ft)},rt.prototype.imul=function(Kt){return this.clone().mulTo(Kt,this)},rt.prototype.imuln=function(Kt){_(typeof Kt=="number"),_(Kt<67108864);for(var Ft=0,bt=0;bt<this.length;bt++){var St=(this.words[bt]|0)*Kt,Jt=(St&67108863)+(Ft&67108863);Ft>>=26,Ft+=St/67108864|0,Ft+=Jt>>>26,this.words[bt]=Jt&67108863}return Ft!==0&&(this.words[bt]=Ft,this.length++),this},rt.prototype.muln=function(Kt){return this.clone().imuln(Kt)},rt.prototype.sqr=function(){return this.mul(this)},rt.prototype.isqr=function(){return this.imul(this.clone())},rt.prototype.pow=function(Kt){var Ft=mt(Kt);if(Ft.length===0)return new rt(1);for(var bt=this,St=0;St<Ft.length&&Ft[St]===0;St++,bt=bt.sqr());if(++St<Ft.length)for(var Jt=bt.sqr();St<Ft.length;St++,Jt=Jt.sqr())Ft[St]!==0&&(bt=bt.mul(Jt));return bt},rt.prototype.iushln=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Kt%26,bt=(Kt-Ft)/26,St=67108863>>>26-Ft<<26-Ft,Jt;if(Ft!==0){var er=0;for(Jt=0;Jt<this.length;Jt++){var sr=this.words[Jt]&St,nr=(this.words[Jt]|0)-sr<<Ft;this.words[Jt]=nr|er,er=sr>>>26-Ft}er&&(this.words[Jt]=er,this.length++)}if(bt!==0){for(Jt=this.length-1;Jt>=0;Jt--)this.words[Jt+bt]=this.words[Jt];for(Jt=0;Jt<bt;Jt++)this.words[Jt]=0;this.length+=bt}return this.strip()},rt.prototype.ishln=function(Kt){return _(this.negative===0),this.iushln(Kt)},rt.prototype.iushrn=function(Kt,Ft,bt){_(typeof Kt=="number"&&Kt>=0);var St;Ft?St=(Ft-Ft%26)/26:St=0;var Jt=Kt%26,er=Math.min((Kt-Jt)/26,this.length),sr=67108863^67108863>>>Jt<<Jt,nr=bt;if(St-=er,St=Math.max(0,St),nr){for(var Dt=0;Dt<er;Dt++)nr.words[Dt]=this.words[Dt];nr.length=er}if(er!==0)if(this.length>er)for(this.length-=er,Dt=0;Dt<this.length;Dt++)this.words[Dt]=this.words[Dt+er];else this.words[0]=0,this.length=1;var Tt=0;for(Dt=this.length-1;Dt>=0&&(Tt!==0||Dt>=St);Dt--){var Mt=this.words[Dt]|0;this.words[Dt]=Tt<<26-Jt|Mt>>>Jt,Tt=Mt&sr}return nr&&Tt!==0&&(nr.words[nr.length++]=Tt),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},rt.prototype.ishrn=function(Kt,Ft,bt){return _(this.negative===0),this.iushrn(Kt,Ft,bt)},rt.prototype.shln=function(Kt){return this.clone().ishln(Kt)},rt.prototype.ushln=function(Kt){return this.clone().iushln(Kt)},rt.prototype.shrn=function(Kt){return this.clone().ishrn(Kt)},rt.prototype.ushrn=function(Kt){return this.clone().iushrn(Kt)},rt.prototype.testn=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Kt%26,bt=(Kt-Ft)/26,St=1<<Ft;if(this.length<=bt)return!1;var Jt=this.words[bt];return!!(Jt&St)},rt.prototype.imaskn=function(Kt){_(typeof Kt=="number"&&Kt>=0);var Ft=Kt%26,bt=(Kt-Ft)/26;if(_(this.negative===0,"imaskn works only with positive numbers"),this.length<=bt)return this;if(Ft!==0&&bt++,this.length=Math.min(bt,this.length),Ft!==0){var St=67108863^67108863>>>Ft<<Ft;this.words[this.length-1]&=St}return this.strip()},rt.prototype.maskn=function(Kt){return this.clone().imaskn(Kt)},rt.prototype.iaddn=function(Kt){return _(typeof Kt=="number"),_(Kt<67108864),Kt<0?this.isubn(-Kt):this.negative!==0?this.length===1&&(this.words[0]|0)<Kt?(this.words[0]=Kt-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(Kt),this.negative=1,this):this._iaddn(Kt)},rt.prototype._iaddn=function(Kt){this.words[0]+=Kt;for(var Ft=0;Ft<this.length&&this.words[Ft]>=67108864;Ft++)this.words[Ft]-=67108864,Ft===this.length-1?this.words[Ft+1]=1:this.words[Ft+1]++;return this.length=Math.max(this.length,Ft+1),this},rt.prototype.isubn=function(Kt){if(_(typeof Kt=="number"),_(Kt<67108864),Kt<0)return this.iaddn(-Kt);if(this.negative!==0)return this.negative=0,this.iaddn(Kt),this.negative=1,this;if(this.words[0]-=Kt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Ft=0;Ft<this.length&&this.words[Ft]<0;Ft++)this.words[Ft]+=67108864,this.words[Ft+1]-=1;return this.strip()},rt.prototype.addn=function(Kt){return this.clone().iaddn(Kt)},rt.prototype.subn=function(Kt){return this.clone().isubn(Kt)},rt.prototype.iabs=function(){return this.negative=0,this},rt.prototype.abs=function(){return this.clone().iabs()},rt.prototype._ishlnsubmul=function(Kt,Ft,bt){var St=Kt.length+bt,Jt;this._expand(St);var er,sr=0;for(Jt=0;Jt<Kt.length;Jt++){er=(this.words[Jt+bt]|0)+sr;var nr=(Kt.words[Jt]|0)*Ft;er-=nr&67108863,sr=(er>>26)-(nr/67108864|0),this.words[Jt+bt]=er&67108863}for(;Jt<this.length-bt;Jt++)er=(this.words[Jt+bt]|0)+sr,sr=er>>26,this.words[Jt+bt]=er&67108863;if(sr===0)return this.strip();for(_(sr===-1),sr=0,Jt=0;Jt<this.length;Jt++)er=-(this.words[Jt]|0)+sr,sr=er>>26,this.words[Jt]=er&67108863;return this.negative=1,this.strip()},rt.prototype._wordDiv=function(Kt,Ft){var bt=this.length-Kt.length,St=this.clone(),Jt=Kt,er=Jt.words[Jt.length-1]|0,sr=this._countBits(er);bt=26-sr,bt!==0&&(Jt=Jt.ushln(bt),St.iushln(bt),er=Jt.words[Jt.length-1]|0);var nr=St.length-Jt.length,Dt;if(Ft!=="mod"){Dt=new rt(null),Dt.length=nr+1,Dt.words=new Array(Dt.length);for(var Tt=0;Tt<Dt.length;Tt++)Dt.words[Tt]=0}var Mt=St.clone()._ishlnsubmul(Jt,1,nr);Mt.negative===0&&(St=Mt,Dt&&(Dt.words[nr]=1));for(var dr=nr-1;dr>=0;dr--){var Nr=(St.words[Jt.length+dr]|0)*67108864+(St.words[Jt.length+dr-1]|0);for(Nr=Math.min(Nr/er|0,67108863),St._ishlnsubmul(Jt,Nr,dr);St.negative!==0;)Nr--,St.negative=0,St._ishlnsubmul(Jt,1,dr),St.isZero()||(St.negative^=1);Dt&&(Dt.words[dr]=Nr)}return Dt&&Dt.strip(),St.strip(),Ft!=="div"&&bt!==0&&St.iushrn(bt),{div:Dt||null,mod:St}},rt.prototype.divmod=function(Kt,Ft,bt){if(_(!Kt.isZero()),this.isZero())return{div:new rt(0),mod:new rt(0)};var St,Jt,er;return this.negative!==0&&Kt.negative===0?(er=this.neg().divmod(Kt,Ft),Ft!=="mod"&&(St=er.div.neg()),Ft!=="div"&&(Jt=er.mod.neg(),bt&&Jt.negative!==0&&Jt.iadd(Kt)),{div:St,mod:Jt}):this.negative===0&&Kt.negative!==0?(er=this.divmod(Kt.neg(),Ft),Ft!=="mod"&&(St=er.div.neg()),{div:St,mod:er.mod}):this.negative&Kt.negative?(er=this.neg().divmod(Kt.neg(),Ft),Ft!=="div"&&(Jt=er.mod.neg(),bt&&Jt.negative!==0&&Jt.isub(Kt)),{div:er.div,mod:Jt}):Kt.length>this.length||this.cmp(Kt)<0?{div:new rt(0),mod:this}:Kt.length===1?Ft==="div"?{div:this.divn(Kt.words[0]),mod:null}:Ft==="mod"?{div:null,mod:new rt(this.modn(Kt.words[0]))}:{div:this.divn(Kt.words[0]),mod:new rt(this.modn(Kt.words[0]))}:this._wordDiv(Kt,Ft)},rt.prototype.div=function(Kt){return this.divmod(Kt,"div",!1).div},rt.prototype.mod=function(Kt){return this.divmod(Kt,"mod",!1).mod},rt.prototype.umod=function(Kt){return this.divmod(Kt,"mod",!0).mod},rt.prototype.divRound=function(Kt){var Ft=this.divmod(Kt);if(Ft.mod.isZero())return Ft.div;var bt=Ft.div.negative!==0?Ft.mod.isub(Kt):Ft.mod,St=Kt.ushrn(1),Jt=Kt.andln(1),er=bt.cmp(St);return er<0||Jt===1&&er===0?Ft.div:Ft.div.negative!==0?Ft.div.isubn(1):Ft.div.iaddn(1)},rt.prototype.modn=function(Kt){_(Kt<=67108863);for(var Ft=(1<<26)%Kt,bt=0,St=this.length-1;St>=0;St--)bt=(Ft*bt+(this.words[St]|0))%Kt;return bt},rt.prototype.idivn=function(Kt){_(Kt<=67108863);for(var Ft=0,bt=this.length-1;bt>=0;bt--){var St=(this.words[bt]|0)+Ft*67108864;this.words[bt]=St/Kt|0,Ft=St%Kt}return this.strip()},rt.prototype.divn=function(Kt){return this.clone().idivn(Kt)},rt.prototype.egcd=function(Kt){_(Kt.negative===0),_(!Kt.isZero());var Ft=this,bt=Kt.clone();Ft.negative!==0?Ft=Ft.umod(Kt):Ft=Ft.clone();for(var St=new rt(1),Jt=new rt(0),er=new rt(0),sr=new rt(1),nr=0;Ft.isEven()&&bt.isEven();)Ft.iushrn(1),bt.iushrn(1),++nr;for(var Dt=bt.clone(),Tt=Ft.clone();!Ft.isZero();){for(var Mt=0,dr=1;!(Ft.words[0]&dr)&&Mt<26;++Mt,dr<<=1);if(Mt>0)for(Ft.iushrn(Mt);Mt-- >0;)(St.isOdd()||Jt.isOdd())&&(St.iadd(Dt),Jt.isub(Tt)),St.iushrn(1),Jt.iushrn(1);for(var Nr=0,qt=1;!(bt.words[0]&qt)&&Nr<26;++Nr,qt<<=1);if(Nr>0)for(bt.iushrn(Nr);Nr-- >0;)(er.isOdd()||sr.isOdd())&&(er.iadd(Dt),sr.isub(Tt)),er.iushrn(1),sr.iushrn(1);Ft.cmp(bt)>=0?(Ft.isub(bt),St.isub(er),Jt.isub(sr)):(bt.isub(Ft),er.isub(St),sr.isub(Jt))}return{a:er,b:sr,gcd:bt.iushln(nr)}},rt.prototype._invmp=function(Kt){_(Kt.negative===0),_(!Kt.isZero());var Ft=this,bt=Kt.clone();Ft.negative!==0?Ft=Ft.umod(Kt):Ft=Ft.clone();for(var St=new rt(1),Jt=new rt(0),er=bt.clone();Ft.cmpn(1)>0&&bt.cmpn(1)>0;){for(var sr=0,nr=1;!(Ft.words[0]&nr)&&sr<26;++sr,nr<<=1);if(sr>0)for(Ft.iushrn(sr);sr-- >0;)St.isOdd()&&St.iadd(er),St.iushrn(1);for(var Dt=0,Tt=1;!(bt.words[0]&Tt)&&Dt<26;++Dt,Tt<<=1);if(Dt>0)for(bt.iushrn(Dt);Dt-- >0;)Jt.isOdd()&&Jt.iadd(er),Jt.iushrn(1);Ft.cmp(bt)>=0?(Ft.isub(bt),St.isub(Jt)):(bt.isub(Ft),Jt.isub(St))}var Mt;return Ft.cmpn(1)===0?Mt=St:Mt=Jt,Mt.cmpn(0)<0&&Mt.iadd(Kt),Mt},rt.prototype.gcd=function(Kt){if(this.isZero())return Kt.abs();if(Kt.isZero())return this.abs();var Ft=this.clone(),bt=Kt.clone();Ft.negative=0,bt.negative=0;for(var St=0;Ft.isEven()&&bt.isEven();St++)Ft.iushrn(1),bt.iushrn(1);do{for(;Ft.isEven();)Ft.iushrn(1);for(;bt.isEven();)bt.iushrn(1);var Jt=Ft.cmp(bt);if(Jt<0){var er=Ft;Ft=bt,bt=er}else if(Jt===0||bt.cmpn(1)===0)break;Ft.isub(bt)}while(!0);return bt.iushln(St)},rt.prototype.invm=function(Kt){return this.egcd(Kt).a.umod(Kt)},rt.prototype.isEven=function(){return(this.words[0]&1)===0},rt.prototype.isOdd=function(){return(this.words[0]&1)===1},rt.prototype.andln=function(Kt){return this.words[0]&Kt},rt.prototype.bincn=function(Kt){_(typeof Kt=="number");var Ft=Kt%26,bt=(Kt-Ft)/26,St=1<<Ft;if(this.length<=bt)return this._expand(bt+1),this.words[bt]|=St,this;for(var Jt=St,er=bt;Jt!==0&&er<this.length;er++){var sr=this.words[er]|0;sr+=Jt,Jt=sr>>>26,sr&=67108863,this.words[er]=sr}return Jt!==0&&(this.words[er]=Jt,this.length++),this},rt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},rt.prototype.cmpn=function(Kt){var Ft=Kt<0;if(this.negative!==0&&!Ft)return-1;if(this.negative===0&&Ft)return 1;this.strip();var bt;if(this.length>1)bt=1;else{Ft&&(Kt=-Kt),_(Kt<=67108863,"Number is too big");var St=this.words[0]|0;bt=St===Kt?0:St<Kt?-1:1}return this.negative!==0?-bt|0:bt},rt.prototype.cmp=function(Kt){if(this.negative!==0&&Kt.negative===0)return-1;if(this.negative===0&&Kt.negative!==0)return 1;var Ft=this.ucmp(Kt);return this.negative!==0?-Ft|0:Ft},rt.prototype.ucmp=function(Kt){if(this.length>Kt.length)return 1;if(this.length<Kt.length)return-1;for(var Ft=0,bt=this.length-1;bt>=0;bt--){var St=this.words[bt]|0,Jt=Kt.words[bt]|0;if(St!==Jt){St<Jt?Ft=-1:St>Jt&&(Ft=1);break}}return Ft},rt.prototype.gtn=function(Kt){return this.cmpn(Kt)===1},rt.prototype.gt=function(Kt){return this.cmp(Kt)===1},rt.prototype.gten=function(Kt){return this.cmpn(Kt)>=0},rt.prototype.gte=function(Kt){return this.cmp(Kt)>=0},rt.prototype.ltn=function(Kt){return this.cmpn(Kt)===-1},rt.prototype.lt=function(Kt){return this.cmp(Kt)===-1},rt.prototype.lten=function(Kt){return this.cmpn(Kt)<=0},rt.prototype.lte=function(Kt){return this.cmp(Kt)<=0},rt.prototype.eqn=function(Kt){return this.cmpn(Kt)===0},rt.prototype.eq=function(Kt){return this.cmp(Kt)===0},rt.red=function(Kt){return new vr(Kt)},rt.prototype.toRed=function(Kt){return _(!this.red,"Already a number in reduction context"),_(this.negative===0,"red works only with positives"),Kt.convertTo(this)._forceRed(Kt)},rt.prototype.fromRed=function(){return _(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},rt.prototype._forceRed=function(Kt){return this.red=Kt,this},rt.prototype.forceRed=function(Kt){return _(!this.red,"Already a number in reduction context"),this._forceRed(Kt)},rt.prototype.redAdd=function(Kt){return _(this.red,"redAdd works only with red numbers"),this.red.add(this,Kt)},rt.prototype.redIAdd=function(Kt){return _(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Kt)},rt.prototype.redSub=function(Kt){return _(this.red,"redSub works only with red numbers"),this.red.sub(this,Kt)},rt.prototype.redISub=function(Kt){return _(this.red,"redISub works only with red numbers"),this.red.isub(this,Kt)},rt.prototype.redShl=function(Kt){return _(this.red,"redShl works only with red numbers"),this.red.shl(this,Kt)},rt.prototype.redMul=function(Kt){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,Kt),this.red.mul(this,Kt)},rt.prototype.redIMul=function(Kt){return _(this.red,"redMul works only with red numbers"),this.red._verify2(this,Kt),this.red.imul(this,Kt)},rt.prototype.redSqr=function(){return _(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},rt.prototype.redISqr=function(){return _(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},rt.prototype.redSqrt=function(){return _(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},rt.prototype.redInvm=function(){return _(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},rt.prototype.redNeg=function(){return _(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},rt.prototype.redPow=function(Kt){return _(this.red&&!Kt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Kt)};var Gt={k256:null,p224:null,p192:null,p25519:null};function Dr(Br,Kt){this.name=Br,this.p=new rt(Kt,16),this.n=this.p.bitLength(),this.k=new rt(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Dr.prototype._tmp=function(){var Kt=new rt(null);return Kt.words=new Array(Math.ceil(this.n/13)),Kt},Dr.prototype.ireduce=function(Kt){var Ft=Kt,bt;do this.split(Ft,this.tmp),Ft=this.imulK(Ft),Ft=Ft.iadd(this.tmp),bt=Ft.bitLength();while(bt>this.n);var St=bt<this.n?-1:Ft.ucmp(this.p);return St===0?(Ft.words[0]=0,Ft.length=1):St>0?Ft.isub(this.p):Ft.strip!==void 0?Ft.strip():Ft._strip(),Ft},Dr.prototype.split=function(Kt,Ft){Kt.iushrn(this.n,0,Ft)},Dr.prototype.imulK=function(Kt){return Kt.imul(this.k)};function lr(){Dr.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(lr,Dr),lr.prototype.split=function(Kt,Ft){for(var bt=4194303,St=Math.min(Kt.length,9),Jt=0;Jt<St;Jt++)Ft.words[Jt]=Kt.words[Jt];if(Ft.length=St,Kt.length<=9){Kt.words[0]=0,Kt.length=1;return}var er=Kt.words[9];for(Ft.words[Ft.length++]=er&bt,Jt=10;Jt<Kt.length;Jt++){var sr=Kt.words[Jt]|0;Kt.words[Jt-10]=(sr&bt)<<4|er>>>22,er=sr}er>>>=22,Kt.words[Jt-10]=er,er===0&&Kt.length>10?Kt.length-=10:Kt.length-=9},lr.prototype.imulK=function(Kt){Kt.words[Kt.length]=0,Kt.words[Kt.length+1]=0,Kt.length+=2;for(var Ft=0,bt=0;bt<Kt.length;bt++){var St=Kt.words[bt]|0;Ft+=St*977,Kt.words[bt]=Ft&67108863,Ft=St*64+(Ft/67108864|0)}return Kt.words[Kt.length-1]===0&&(Kt.length--,Kt.words[Kt.length-1]===0&&Kt.length--),Kt};function xr(){Dr.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}et(xr,Dr);function hr(){Dr.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}et(hr,Dr);function Hr(){Dr.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}et(Hr,Dr),Hr.prototype.imulK=function(Kt){for(var Ft=0,bt=0;bt<Kt.length;bt++){var St=(Kt.words[bt]|0)*19+Ft,Jt=St&67108863;St>>>=26,Kt.words[bt]=Jt,Ft=St}return Ft!==0&&(Kt.words[Kt.length++]=Ft),Kt},rt._prime=function(Kt){if(Gt[Kt])return Gt[Kt];var Ft;if(Kt==="k256")Ft=new lr;else if(Kt==="p224")Ft=new xr;else if(Kt==="p192")Ft=new hr;else if(Kt==="p25519")Ft=new Hr;else throw new Error("Unknown prime "+Kt);return Gt[Kt]=Ft,Ft};function vr(Br){if(typeof Br=="string"){var Kt=rt._prime(Br);this.m=Kt.p,this.prime=Kt}else _(Br.gtn(1),"modulus must be greater than 1"),this.m=Br,this.prime=null}vr.prototype._verify1=function(Kt){_(Kt.negative===0,"red works only with positives"),_(Kt.red,"red works only with red numbers")},vr.prototype._verify2=function(Kt,Ft){_((Kt.negative|Ft.negative)===0,"red works only with positives"),_(Kt.red&&Kt.red===Ft.red,"red works only with red numbers")},vr.prototype.imod=function(Kt){return this.prime?this.prime.ireduce(Kt)._forceRed(this):Kt.umod(this.m)._forceRed(this)},vr.prototype.neg=function(Kt){return Kt.isZero()?Kt.clone():this.m.sub(Kt)._forceRed(this)},vr.prototype.add=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.add(Ft);return bt.cmp(this.m)>=0&&bt.isub(this.m),bt._forceRed(this)},vr.prototype.iadd=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.iadd(Ft);return bt.cmp(this.m)>=0&&bt.isub(this.m),bt},vr.prototype.sub=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.sub(Ft);return bt.cmpn(0)<0&&bt.iadd(this.m),bt._forceRed(this)},vr.prototype.isub=function(Kt,Ft){this._verify2(Kt,Ft);var bt=Kt.isub(Ft);return bt.cmpn(0)<0&&bt.iadd(this.m),bt},vr.prototype.shl=function(Kt,Ft){return this._verify1(Kt),this.imod(Kt.ushln(Ft))},vr.prototype.imul=function(Kt,Ft){return this._verify2(Kt,Ft),this.imod(Kt.imul(Ft))},vr.prototype.mul=function(Kt,Ft){return this._verify2(Kt,Ft),this.imod(Kt.mul(Ft))},vr.prototype.isqr=function(Kt){return this.imul(Kt,Kt.clone())},vr.prototype.sqr=function(Kt){return this.mul(Kt,Kt)},vr.prototype.sqrt=function(Kt){if(Kt.isZero())return Kt.clone();var Ft=this.m.andln(3);if(_(Ft%2===1),Ft===3){var bt=this.m.add(new rt(1)).iushrn(2);return this.pow(Kt,bt)}for(var St=this.m.subn(1),Jt=0;!St.isZero()&&St.andln(1)===0;)Jt++,St.iushrn(1);_(!St.isZero());var er=new rt(1).toRed(this),sr=er.redNeg(),nr=this.m.subn(1).iushrn(1),Dt=this.m.bitLength();for(Dt=new rt(2*Dt*Dt).toRed(this);this.pow(Dt,nr).cmp(sr)!==0;)Dt.redIAdd(sr);for(var Tt=this.pow(Dt,St),Mt=this.pow(Kt,St.addn(1).iushrn(1)),dr=this.pow(Kt,St),Nr=Jt;dr.cmp(er)!==0;){for(var qt=dr,Fr=0;qt.cmp(er)!==0;Fr++)qt=qt.redSqr();_(Fr<Nr);var jr=this.pow(Tt,new rt(1).iushln(Nr-Fr-1));Mt=Mt.redMul(jr),Tt=jr.redSqr(),dr=dr.redMul(Tt),Nr=Fr}return Mt},vr.prototype.invm=function(Kt){var Ft=Kt._invmp(this.m);return Ft.negative!==0?(Ft.negative=0,this.imod(Ft).redNeg()):this.imod(Ft)},vr.prototype.pow=function(Kt,Ft){if(Ft.isZero())return new rt(1).toRed(this);if(Ft.cmpn(1)===0)return Kt.clone();var bt=4,St=new Array(1<<bt);St[0]=new rt(1).toRed(this),St[1]=Kt;for(var Jt=2;Jt<St.length;Jt++)St[Jt]=this.mul(St[Jt-1],Kt);var er=St[0],sr=0,nr=0,Dt=Ft.bitLength()%26;for(Dt===0&&(Dt=26),Jt=Ft.length-1;Jt>=0;Jt--){for(var Tt=Ft.words[Jt],Mt=Dt-1;Mt>=0;Mt--){var dr=Tt>>Mt&1;if(er!==St[0]&&(er=this.sqr(er)),dr===0&&sr===0){nr=0;continue}sr<<=1,sr|=dr,nr++,!(nr!==bt&&(Jt!==0||Mt!==0))&&(er=this.mul(er,St[sr]),nr=0,sr=0)}Dt=26}return er},vr.prototype.convertTo=function(Kt){var Ft=Kt.umod(this.m);return Ft===Kt?Ft.clone():Ft},vr.prototype.convertFrom=function(Kt){var Ft=Kt.clone();return Ft.red=null,Ft},rt.mont=function(Kt){return new u0(Kt)};function u0(Br){vr.call(this,Br),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new rt(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}et(u0,vr),u0.prototype.convertTo=function(Kt){return this.imod(Kt.ushln(this.shift))},u0.prototype.convertFrom=function(Kt){var Ft=this.imod(Kt.mul(this.rinv));return Ft.red=null,Ft},u0.prototype.imul=function(Kt,Ft){if(Kt.isZero()||Ft.isZero())return Kt.words[0]=0,Kt.length=1,Kt;var bt=Kt.imul(Ft),St=bt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Jt=bt.isub(St).iushrn(this.shift),er=Jt;return Jt.cmp(this.m)>=0?er=Jt.isub(this.m):Jt.cmpn(0)<0&&(er=Jt.iadd(this.m)),er._forceRed(this)},u0.prototype.mul=function(Kt,Ft){if(Kt.isZero()||Ft.isZero())return new rt(0)._forceRed(this);var bt=Kt.mul(Ft),St=bt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Jt=bt.isub(St).iushrn(this.shift),er=Jt;return Jt.cmp(this.m)>=0?er=Jt.isub(this.m):Jt.cmpn(0)<0&&(er=Jt.iadd(this.m)),er._forceRed(this)},u0.prototype.invm=function(Kt){var Ft=this.imod(Kt._invmp(this.m).mul(this.r2));return Ft._forceRed(this)}})(i,commonjsGlobal)})(bn);var bnExports=bn.exports,utils$b={};(function(i){var a=i;function o(rt,ot){if(Array.isArray(rt))return rt.slice();if(!rt)return[];var ft=[];if(typeof rt!="string"){for(var lt=0;lt<rt.length;lt++)ft[lt]=rt[lt]|0;return ft}if(ot==="hex"){rt=rt.replace(/[^a-z0-9]+/ig,""),rt.length%2!==0&&(rt="0"+rt);for(var lt=0;lt<rt.length;lt+=2)ft.push(parseInt(rt[lt]+rt[lt+1],16))}else for(var lt=0;lt<rt.length;lt++){var ht=rt.charCodeAt(lt),vt=ht>>8,It=ht&255;vt?ft.push(vt,It):ft.push(It)}return ft}a.toArray=o;function _(rt){return rt.length===1?"0"+rt:rt}a.zero2=_;function et(rt){for(var ot="",ft=0;ft<rt.length;ft++)ot+=_(rt[ft].toString(16));return ot}a.toHex=et,a.encode=function(ot,ft){return ft==="hex"?et(ot):ot}})(utils$b);(function(i){var a=i,o=bnExports,_=minimalisticAssert$1,et=utils$b;a.assert=_,a.toArray=et.toArray,a.zero2=et.zero2,a.toHex=et.toHex,a.encode=et.encode;function rt(vt,It,Qt){var mt=new Array(Math.max(vt.bitLength(),Qt)+1);mt.fill(0);for(var Yt=1<<It+1,Rt=vt.clone(),cr=0;cr<mt.length;cr++){var Ut,zt=Rt.andln(Yt-1);Rt.isOdd()?(zt>(Yt>>1)-1?Ut=(Yt>>1)-zt:Ut=zt,Rt.isubn(Ut)):Ut=0,mt[cr]=Ut,Rt.iushrn(1)}return mt}a.getNAF=rt;function ot(vt,It){var Qt=[[],[]];vt=vt.clone(),It=It.clone();for(var mt=0,Yt=0,Rt;vt.cmpn(-mt)>0||It.cmpn(-Yt)>0;){var cr=vt.andln(3)+mt&3,Ut=It.andln(3)+Yt&3;cr===3&&(cr=-1),Ut===3&&(Ut=-1);var zt;cr&1?(Rt=vt.andln(7)+mt&7,(Rt===3||Rt===5)&&Ut===2?zt=-cr:zt=cr):zt=0,Qt[0].push(zt);var Gt;Ut&1?(Rt=It.andln(7)+Yt&7,(Rt===3||Rt===5)&&cr===2?Gt=-Ut:Gt=Ut):Gt=0,Qt[1].push(Gt),2*mt===zt+1&&(mt=1-mt),2*Yt===Gt+1&&(Yt=1-Yt),vt.iushrn(1),It.iushrn(1)}return Qt}a.getJSF=ot;function ft(vt,It,Qt){var mt="_"+It;vt.prototype[It]=function(){return this[mt]!==void 0?this[mt]:this[mt]=Qt.call(this)}}a.cachedProperty=ft;function lt(vt){return typeof vt=="string"?a.toArray(vt,"hex"):vt}a.parseBytes=lt;function ht(vt){return new o(vt,"hex","le")}a.intFromLE=ht})(utils$c);var brorand={exports:{}},r$2;brorand.exports=function i(a){return r$2||(r$2=new Rand(null)),r$2.generate(a)};function Rand(i){this.rand=i}brorand.exports.Rand=Rand;Rand.prototype.generate=function i(a){return this._rand(a)};Rand.prototype._rand=function i(a){if(this.rand.getBytes)return this.rand.getBytes(a);for(var o=new Uint8Array(a),_=0;_<o.length;_++)o[_]=this.rand.getByte();return o};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?Rand.prototype._rand=function(a){var o=new Uint8Array(a);return self.crypto.getRandomValues(o),o}:self.msCrypto&&self.msCrypto.getRandomValues?Rand.prototype._rand=function(a){var o=new Uint8Array(a);return self.msCrypto.getRandomValues(o),o}:typeof window=="object"&&(Rand.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var crypto$1=require$$1;if(typeof crypto$1.randomBytes!="function")throw new Error("Not supported");Rand.prototype._rand=function(a){return crypto$1.randomBytes(a)}}catch{}var brorandExports=brorand.exports,curve={},BN$7=bnExports,utils$a=utils$c,getNAF=utils$a.getNAF,getJSF=utils$a.getJSF,assert$9=utils$a.assert;function BaseCurve(i,a){this.type=i,this.p=new BN$7(a.p,16),this.red=a.prime?BN$7.red(a.prime):BN$7.mont(this.p),this.zero=new BN$7(0).toRed(this.red),this.one=new BN$7(1).toRed(this.red),this.two=new BN$7(2).toRed(this.red),this.n=a.n&&new BN$7(a.n,16),this.g=a.g&&this.pointFromJSON(a.g,a.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var o=this.n&&this.p.div(this.n);!o||o.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base=BaseCurve;BaseCurve.prototype.point=function i(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function i(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function i(a,o){assert$9(a.precomputed);var _=a._getDoubles(),et=getNAF(o,1,this._bitLength),rt=(1<<_.step+1)-(_.step%2===0?2:1);rt/=3;var ot=[],ft,lt;for(ft=0;ft<et.length;ft+=_.step){lt=0;for(var ht=ft+_.step-1;ht>=ft;ht--)lt=(lt<<1)+et[ht];ot.push(lt)}for(var vt=this.jpoint(null,null,null),It=this.jpoint(null,null,null),Qt=rt;Qt>0;Qt--){for(ft=0;ft<ot.length;ft++)lt=ot[ft],lt===Qt?It=It.mixedAdd(_.points[ft]):lt===-Qt&&(It=It.mixedAdd(_.points[ft].neg()));vt=vt.add(It)}return vt.toP()};BaseCurve.prototype._wnafMul=function i(a,o){var _=4,et=a._getNAFPoints(_);_=et.wnd;for(var rt=et.points,ot=getNAF(o,_,this._bitLength),ft=this.jpoint(null,null,null),lt=ot.length-1;lt>=0;lt--){for(var ht=0;lt>=0&&ot[lt]===0;lt--)ht++;if(lt>=0&&ht++,ft=ft.dblp(ht),lt<0)break;var vt=ot[lt];assert$9(vt!==0),a.type==="affine"?vt>0?ft=ft.mixedAdd(rt[vt-1>>1]):ft=ft.mixedAdd(rt[-vt-1>>1].neg()):vt>0?ft=ft.add(rt[vt-1>>1]):ft=ft.add(rt[-vt-1>>1].neg())}return a.type==="affine"?ft.toP():ft};BaseCurve.prototype._wnafMulAdd=function i(a,o,_,et,rt){var ot=this._wnafT1,ft=this._wnafT2,lt=this._wnafT3,ht=0,vt,It,Qt;for(vt=0;vt<et;vt++){Qt=o[vt];var mt=Qt._getNAFPoints(a);ot[vt]=mt.wnd,ft[vt]=mt.points}for(vt=et-1;vt>=1;vt-=2){var Yt=vt-1,Rt=vt;if(ot[Yt]!==1||ot[Rt]!==1){lt[Yt]=getNAF(_[Yt],ot[Yt],this._bitLength),lt[Rt]=getNAF(_[Rt],ot[Rt],this._bitLength),ht=Math.max(lt[Yt].length,ht),ht=Math.max(lt[Rt].length,ht);continue}var cr=[o[Yt],null,null,o[Rt]];o[Yt].y.cmp(o[Rt].y)===0?(cr[1]=o[Yt].add(o[Rt]),cr[2]=o[Yt].toJ().mixedAdd(o[Rt].neg())):o[Yt].y.cmp(o[Rt].y.redNeg())===0?(cr[1]=o[Yt].toJ().mixedAdd(o[Rt]),cr[2]=o[Yt].add(o[Rt].neg())):(cr[1]=o[Yt].toJ().mixedAdd(o[Rt]),cr[2]=o[Yt].toJ().mixedAdd(o[Rt].neg()));var Ut=[-3,-1,-5,-7,0,7,5,1,3],zt=getJSF(_[Yt],_[Rt]);for(ht=Math.max(zt[0].length,ht),lt[Yt]=new Array(ht),lt[Rt]=new Array(ht),It=0;It<ht;It++){var Gt=zt[0][It]|0,Dr=zt[1][It]|0;lt[Yt][It]=Ut[(Gt+1)*3+(Dr+1)],lt[Rt][It]=0,ft[Yt]=cr}}var lr=this.jpoint(null,null,null),xr=this._wnafT4;for(vt=ht;vt>=0;vt--){for(var hr=0;vt>=0;){var Hr=!0;for(It=0;It<et;It++)xr[It]=lt[It][vt]|0,xr[It]!==0&&(Hr=!1);if(!Hr)break;hr++,vt--}if(vt>=0&&hr++,lr=lr.dblp(hr),vt<0)break;for(It=0;It<et;It++){var vr=xr[It];vr!==0&&(vr>0?Qt=ft[It][vr-1>>1]:vr<0&&(Qt=ft[It][-vr-1>>1].neg()),Qt.type==="affine"?lr=lr.mixedAdd(Qt):lr=lr.add(Qt))}}for(vt=0;vt<et;vt++)ft[vt]=null;return rt?lr:lr.toP()};function BasePoint(i,a){this.curve=i,this.type=a,this.precomputed=null}BaseCurve.BasePoint=BasePoint;BasePoint.prototype.eq=function i(){throw new Error("Not implemented")};BasePoint.prototype.validate=function i(){return this.curve.validate(this)};BaseCurve.prototype.decodePoint=function i(a,o){a=utils$a.toArray(a,o);var _=this.p.byteLength();if((a[0]===4||a[0]===6||a[0]===7)&&a.length-1===2*_){a[0]===6?assert$9(a[a.length-1]%2===0):a[0]===7&&assert$9(a[a.length-1]%2===1);var et=this.point(a.slice(1,1+_),a.slice(1+_,1+2*_));return et}else if((a[0]===2||a[0]===3)&&a.length-1===_)return this.pointFromX(a.slice(1,1+_),a[0]===3);throw new Error("Unknown point format")};BasePoint.prototype.encodeCompressed=function i(a){return this.encode(a,!0)};BasePoint.prototype._encode=function i(a){var o=this.curve.p.byteLength(),_=this.getX().toArray("be",o);return a?[this.getY().isEven()?2:3].concat(_):[4].concat(_,this.getY().toArray("be",o))};BasePoint.prototype.encode=function i(a,o){return utils$a.encode(this._encode(o),a)};BasePoint.prototype.precompute=function i(a){if(this.precomputed)return this;var o={doubles:null,naf:null,beta:null};return o.naf=this._getNAFPoints(8),o.doubles=this._getDoubles(4,a),o.beta=this._getBeta(),this.precomputed=o,this};BasePoint.prototype._hasDoubles=function i(a){if(!this.precomputed)return!1;var o=this.precomputed.doubles;return o?o.points.length>=Math.ceil((a.bitLength()+1)/o.step):!1};BasePoint.prototype._getDoubles=function i(a,o){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var _=[this],et=this,rt=0;rt<o;rt+=a){for(var ot=0;ot<a;ot++)et=et.dbl();_.push(et)}return{step:a,points:_}};BasePoint.prototype._getNAFPoints=function i(a){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var o=[this],_=(1<<a)-1,et=_===1?null:this.dbl(),rt=1;rt<_;rt++)o[rt]=o[rt-1].add(et);return{wnd:a,points:o}};BasePoint.prototype._getBeta=function i(){return null};BasePoint.prototype.dblp=function i(a){for(var o=this,_=0;_<a;_++)o=o.dbl();return o};var utils$9=utils$c,BN$6=bnExports,inherits$2=inherits_browserExports,Base$2=base,assert$8=utils$9.assert;function ShortCurve(i){Base$2.call(this,"short",i),this.a=new BN$6(i.a,16).toRed(this.red),this.b=new BN$6(i.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(i),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits$2(ShortCurve,Base$2);var short=ShortCurve;ShortCurve.prototype._getEndomorphism=function i(a){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var o,_;if(a.beta)o=new BN$6(a.beta,16).toRed(this.red);else{var et=this._getEndoRoots(this.p);o=et[0].cmp(et[1])<0?et[0]:et[1],o=o.toRed(this.red)}if(a.lambda)_=new BN$6(a.lambda,16);else{var rt=this._getEndoRoots(this.n);this.g.mul(rt[0]).x.cmp(this.g.x.redMul(o))===0?_=rt[0]:(_=rt[1],assert$8(this.g.mul(_).x.cmp(this.g.x.redMul(o))===0))}var ot;return a.basis?ot=a.basis.map(function(ft){return{a:new BN$6(ft.a,16),b:new BN$6(ft.b,16)}}):ot=this._getEndoBasis(_),{beta:o,lambda:_,basis:ot}}};ShortCurve.prototype._getEndoRoots=function i(a){var o=a===this.p?this.red:BN$6.mont(a),_=new BN$6(2).toRed(o).redInvm(),et=_.redNeg(),rt=new BN$6(3).toRed(o).redNeg().redSqrt().redMul(_),ot=et.redAdd(rt).fromRed(),ft=et.redSub(rt).fromRed();return[ot,ft]};ShortCurve.prototype._getEndoBasis=function i(a){for(var o=this.n.ushrn(Math.floor(this.n.bitLength()/2)),_=a,et=this.n.clone(),rt=new BN$6(1),ot=new BN$6(0),ft=new BN$6(0),lt=new BN$6(1),ht,vt,It,Qt,mt,Yt,Rt,cr=0,Ut,zt;_.cmpn(0)!==0;){var Gt=et.div(_);Ut=et.sub(Gt.mul(_)),zt=ft.sub(Gt.mul(rt));var Dr=lt.sub(Gt.mul(ot));if(!It&&Ut.cmp(o)<0)ht=Rt.neg(),vt=rt,It=Ut.neg(),Qt=zt;else if(It&&++cr===2)break;Rt=Ut,et=_,_=Ut,ft=rt,rt=zt,lt=ot,ot=Dr}mt=Ut.neg(),Yt=zt;var lr=It.sqr().add(Qt.sqr()),xr=mt.sqr().add(Yt.sqr());return xr.cmp(lr)>=0&&(mt=ht,Yt=vt),It.negative&&(It=It.neg(),Qt=Qt.neg()),mt.negative&&(mt=mt.neg(),Yt=Yt.neg()),[{a:It,b:Qt},{a:mt,b:Yt}]};ShortCurve.prototype._endoSplit=function i(a){var o=this.endo.basis,_=o[0],et=o[1],rt=et.b.mul(a).divRound(this.n),ot=_.b.neg().mul(a).divRound(this.n),ft=rt.mul(_.a),lt=ot.mul(et.a),ht=rt.mul(_.b),vt=ot.mul(et.b),It=a.sub(ft).sub(lt),Qt=ht.add(vt).neg();return{k1:It,k2:Qt}};ShortCurve.prototype.pointFromX=function i(a,o){a=new BN$6(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),et=_.redSqrt();if(et.redSqr().redSub(_).cmp(this.zero)!==0)throw new Error("invalid point");var rt=et.fromRed().isOdd();return(o&&!rt||!o&&rt)&&(et=et.redNeg()),this.point(a,et)};ShortCurve.prototype.validate=function i(a){if(a.inf)return!0;var o=a.x,_=a.y,et=this.a.redMul(o),rt=o.redSqr().redMul(o).redIAdd(et).redIAdd(this.b);return _.redSqr().redISub(rt).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function i(a,o,_){for(var et=this._endoWnafT1,rt=this._endoWnafT2,ot=0;ot<a.length;ot++){var ft=this._endoSplit(o[ot]),lt=a[ot],ht=lt._getBeta();ft.k1.negative&&(ft.k1.ineg(),lt=lt.neg(!0)),ft.k2.negative&&(ft.k2.ineg(),ht=ht.neg(!0)),et[ot*2]=lt,et[ot*2+1]=ht,rt[ot*2]=ft.k1,rt[ot*2+1]=ft.k2}for(var vt=this._wnafMulAdd(1,et,rt,ot*2,_),It=0;It<ot*2;It++)et[It]=null,rt[It]=null;return vt};function Point$2(i,a,o,_){Base$2.BasePoint.call(this,i,"affine"),a===null&&o===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$6(a,16),this.y=new BN$6(o,16),_&&(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)}inherits$2(Point$2,Base$2.BasePoint);ShortCurve.prototype.point=function i(a,o,_){return new Point$2(this,a,o,_)};ShortCurve.prototype.pointFromJSON=function i(a,o){return Point$2.fromJSON(this,a,o)};Point$2.prototype._getBeta=function i(){if(this.curve.endo){var a=this.precomputed;if(a&&a.beta)return a.beta;var o=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(a){var _=this.curve,et=function(rt){return _.point(rt.x.redMul(_.endo.beta),rt.y)};a.beta=o,o.precomputed={beta:null,naf:a.naf&&{wnd:a.naf.wnd,points:a.naf.points.map(et)},doubles:a.doubles&&{step:a.doubles.step,points:a.doubles.points.map(et)}}}return o}};Point$2.prototype.toJSON=function i(){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]};Point$2.fromJSON=function i(a,o,_){typeof o=="string"&&(o=JSON.parse(o));var et=a.point(o[0],o[1],_);if(!o[2])return et;function rt(ft){return a.point(ft[0],ft[1],_)}var ot=o[2];return et.precomputed={beta:null,doubles:ot.doubles&&{step:ot.doubles.step,points:[et].concat(ot.doubles.points.map(rt))},naf:ot.naf&&{wnd:ot.naf.wnd,points:[et].concat(ot.naf.points.map(rt))}},et};Point$2.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point$2.prototype.isInfinity=function i(){return this.inf};Point$2.prototype.add=function i(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(this.x.cmp(a.x)===0)return this.curve.point(null,null);var o=this.y.redSub(a.y);o.cmpn(0)!==0&&(o=o.redMul(this.x.redSub(a.x).redInvm()));var _=o.redSqr().redISub(this.x).redISub(a.x),et=o.redMul(this.x.redSub(_)).redISub(this.y);return this.curve.point(_,et)};Point$2.prototype.dbl=function i(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(a.cmpn(0)===0)return this.curve.point(null,null);var o=this.curve.a,_=this.x.redSqr(),et=a.redInvm(),rt=_.redAdd(_).redIAdd(_).redIAdd(o).redMul(et),ot=rt.redSqr().redISub(this.x.redAdd(this.x)),ft=rt.redMul(this.x.redSub(ot)).redISub(this.y);return this.curve.point(ot,ft)};Point$2.prototype.getX=function i(){return this.x.fromRed()};Point$2.prototype.getY=function i(){return this.y.fromRed()};Point$2.prototype.mul=function i(a){return a=new BN$6(a,16),this.isInfinity()?this:this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)};Point$2.prototype.mulAdd=function i(a,o,_){var et=[this,o],rt=[a,_];return this.curve.endo?this.curve._endoWnafMulAdd(et,rt):this.curve._wnafMulAdd(1,et,rt,2)};Point$2.prototype.jmulAdd=function i(a,o,_){var et=[this,o],rt=[a,_];return this.curve.endo?this.curve._endoWnafMulAdd(et,rt,!0):this.curve._wnafMulAdd(1,et,rt,2,!0)};Point$2.prototype.eq=function i(a){return this===a||this.inf===a.inf&&(this.inf||this.x.cmp(a.x)===0&&this.y.cmp(a.y)===0)};Point$2.prototype.neg=function i(a){if(this.inf)return this;var o=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var _=this.precomputed,et=function(rt){return rt.neg()};o.precomputed={naf:_.naf&&{wnd:_.naf.wnd,points:_.naf.points.map(et)},doubles:_.doubles&&{step:_.doubles.step,points:_.doubles.points.map(et)}}}return o};Point$2.prototype.toJ=function i(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a};function JPoint(i,a,o,_){Base$2.BasePoint.call(this,i,"jacobian"),a===null&&o===null&&_===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$6(0)):(this.x=new BN$6(a,16),this.y=new BN$6(o,16),this.z=new BN$6(_,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}inherits$2(JPoint,Base$2.BasePoint);ShortCurve.prototype.jpoint=function i(a,o,_){return new JPoint(this,a,o,_)};JPoint.prototype.toP=function i(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),o=a.redSqr(),_=this.x.redMul(o),et=this.y.redMul(o).redMul(a);return this.curve.point(_,et)};JPoint.prototype.neg=function i(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function i(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var o=a.z.redSqr(),_=this.z.redSqr(),et=this.x.redMul(o),rt=a.x.redMul(_),ot=this.y.redMul(o.redMul(a.z)),ft=a.y.redMul(_.redMul(this.z)),lt=et.redSub(rt),ht=ot.redSub(ft);if(lt.cmpn(0)===0)return ht.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var vt=lt.redSqr(),It=vt.redMul(lt),Qt=et.redMul(vt),mt=ht.redSqr().redIAdd(It).redISub(Qt).redISub(Qt),Yt=ht.redMul(Qt.redISub(mt)).redISub(ot.redMul(It)),Rt=this.z.redMul(a.z).redMul(lt);return this.curve.jpoint(mt,Yt,Rt)};JPoint.prototype.mixedAdd=function i(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var o=this.z.redSqr(),_=this.x,et=a.x.redMul(o),rt=this.y,ot=a.y.redMul(o).redMul(this.z),ft=_.redSub(et),lt=rt.redSub(ot);if(ft.cmpn(0)===0)return lt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ht=ft.redSqr(),vt=ht.redMul(ft),It=_.redMul(ht),Qt=lt.redSqr().redIAdd(vt).redISub(It).redISub(It),mt=lt.redMul(It.redISub(Qt)).redISub(rt.redMul(vt)),Yt=this.z.redMul(ft);return this.curve.jpoint(Qt,mt,Yt)};JPoint.prototype.dblp=function i(a){if(a===0)return this;if(this.isInfinity())return this;if(!a)return this.dbl();var o;if(this.curve.zeroA||this.curve.threeA){var _=this;for(o=0;o<a;o++)_=_.dbl();return _}var et=this.curve.a,rt=this.curve.tinv,ot=this.x,ft=this.y,lt=this.z,ht=lt.redSqr().redSqr(),vt=ft.redAdd(ft);for(o=0;o<a;o++){var It=ot.redSqr(),Qt=vt.redSqr(),mt=Qt.redSqr(),Yt=It.redAdd(It).redIAdd(It).redIAdd(et.redMul(ht)),Rt=ot.redMul(Qt),cr=Yt.redSqr().redISub(Rt.redAdd(Rt)),Ut=Rt.redISub(cr),zt=Yt.redMul(Ut);zt=zt.redIAdd(zt).redISub(mt);var Gt=vt.redMul(lt);o+1<a&&(ht=ht.redMul(mt)),ot=cr,lt=Gt,vt=zt}return this.curve.jpoint(ot,vt.redMul(rt),lt)};JPoint.prototype.dbl=function i(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint.prototype._zeroDbl=function i(){var a,o,_;if(this.zOne){var et=this.x.redSqr(),rt=this.y.redSqr(),ot=rt.redSqr(),ft=this.x.redAdd(rt).redSqr().redISub(et).redISub(ot);ft=ft.redIAdd(ft);var lt=et.redAdd(et).redIAdd(et),ht=lt.redSqr().redISub(ft).redISub(ft),vt=ot.redIAdd(ot);vt=vt.redIAdd(vt),vt=vt.redIAdd(vt),a=ht,o=lt.redMul(ft.redISub(ht)).redISub(vt),_=this.y.redAdd(this.y)}else{var It=this.x.redSqr(),Qt=this.y.redSqr(),mt=Qt.redSqr(),Yt=this.x.redAdd(Qt).redSqr().redISub(It).redISub(mt);Yt=Yt.redIAdd(Yt);var Rt=It.redAdd(It).redIAdd(It),cr=Rt.redSqr(),Ut=mt.redIAdd(mt);Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),a=cr.redISub(Yt).redISub(Yt),o=Rt.redMul(Yt.redISub(a)).redISub(Ut),_=this.y.redMul(this.z),_=_.redIAdd(_)}return this.curve.jpoint(a,o,_)};JPoint.prototype._threeDbl=function i(){var a,o,_;if(this.zOne){var et=this.x.redSqr(),rt=this.y.redSqr(),ot=rt.redSqr(),ft=this.x.redAdd(rt).redSqr().redISub(et).redISub(ot);ft=ft.redIAdd(ft);var lt=et.redAdd(et).redIAdd(et).redIAdd(this.curve.a),ht=lt.redSqr().redISub(ft).redISub(ft);a=ht;var vt=ot.redIAdd(ot);vt=vt.redIAdd(vt),vt=vt.redIAdd(vt),o=lt.redMul(ft.redISub(ht)).redISub(vt),_=this.y.redAdd(this.y)}else{var It=this.z.redSqr(),Qt=this.y.redSqr(),mt=this.x.redMul(Qt),Yt=this.x.redSub(It).redMul(this.x.redAdd(It));Yt=Yt.redAdd(Yt).redIAdd(Yt);var Rt=mt.redIAdd(mt);Rt=Rt.redIAdd(Rt);var cr=Rt.redAdd(Rt);a=Yt.redSqr().redISub(cr),_=this.y.redAdd(this.z).redSqr().redISub(Qt).redISub(It);var Ut=Qt.redSqr();Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),Ut=Ut.redIAdd(Ut),o=Yt.redMul(Rt.redISub(a)).redISub(Ut)}return this.curve.jpoint(a,o,_)};JPoint.prototype._dbl=function i(){var a=this.curve.a,o=this.x,_=this.y,et=this.z,rt=et.redSqr().redSqr(),ot=o.redSqr(),ft=_.redSqr(),lt=ot.redAdd(ot).redIAdd(ot).redIAdd(a.redMul(rt)),ht=o.redAdd(o);ht=ht.redIAdd(ht);var vt=ht.redMul(ft),It=lt.redSqr().redISub(vt.redAdd(vt)),Qt=vt.redISub(It),mt=ft.redSqr();mt=mt.redIAdd(mt),mt=mt.redIAdd(mt),mt=mt.redIAdd(mt);var Yt=lt.redMul(Qt).redISub(mt),Rt=_.redAdd(_).redMul(et);return this.curve.jpoint(It,Yt,Rt)};JPoint.prototype.trpl=function i(){if(!this.curve.zeroA)return this.dbl().add(this);var a=this.x.redSqr(),o=this.y.redSqr(),_=this.z.redSqr(),et=o.redSqr(),rt=a.redAdd(a).redIAdd(a),ot=rt.redSqr(),ft=this.x.redAdd(o).redSqr().redISub(a).redISub(et);ft=ft.redIAdd(ft),ft=ft.redAdd(ft).redIAdd(ft),ft=ft.redISub(ot);var lt=ft.redSqr(),ht=et.redIAdd(et);ht=ht.redIAdd(ht),ht=ht.redIAdd(ht),ht=ht.redIAdd(ht);var vt=rt.redIAdd(ft).redSqr().redISub(ot).redISub(lt).redISub(ht),It=o.redMul(vt);It=It.redIAdd(It),It=It.redIAdd(It);var Qt=this.x.redMul(lt).redISub(It);Qt=Qt.redIAdd(Qt),Qt=Qt.redIAdd(Qt);var mt=this.y.redMul(vt.redMul(ht.redISub(vt)).redISub(ft.redMul(lt)));mt=mt.redIAdd(mt),mt=mt.redIAdd(mt),mt=mt.redIAdd(mt);var Yt=this.z.redAdd(ft).redSqr().redISub(_).redISub(lt);return this.curve.jpoint(Qt,mt,Yt)};JPoint.prototype.mul=function i(a,o){return a=new BN$6(a,o),this.curve._wnafMul(this,a)};JPoint.prototype.eq=function i(a){if(a.type==="affine")return this.eq(a.toJ());if(this===a)return!0;var o=this.z.redSqr(),_=a.z.redSqr();if(this.x.redMul(_).redISub(a.x.redMul(o)).cmpn(0)!==0)return!1;var et=o.redMul(this.z),rt=_.redMul(a.z);return this.y.redMul(rt).redISub(a.y.redMul(et)).cmpn(0)===0};JPoint.prototype.eqXToP=function i(a){var o=this.z.redSqr(),_=a.toRed(this.curve.red).redMul(o);if(this.x.cmp(_)===0)return!0;for(var et=a.clone(),rt=this.curve.redN.redMul(o);;){if(et.iadd(this.curve.n),et.cmp(this.curve.p)>=0)return!1;if(_.redIAdd(rt),this.x.cmp(_)===0)return!0}};JPoint.prototype.inspect=function i(){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)+">"};JPoint.prototype.isInfinity=function i(){return this.z.cmpn(0)===0};var BN$5=bnExports,inherits$1=inherits_browserExports,Base$1=base,utils$8=utils$c;function MontCurve(i){Base$1.call(this,"mont",i),this.a=new BN$5(i.a,16).toRed(this.red),this.b=new BN$5(i.b,16).toRed(this.red),this.i4=new BN$5(4).toRed(this.red).redInvm(),this.two=new BN$5(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits$1(MontCurve,Base$1);var mont=MontCurve;MontCurve.prototype.validate=function i(a){var o=a.normalize().x,_=o.redSqr(),et=_.redMul(o).redAdd(_.redMul(this.a)).redAdd(o),rt=et.redSqrt();return rt.redSqr().cmp(et)===0};function Point$1(i,a,o){Base$1.BasePoint.call(this,i,"projective"),a===null&&o===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$5(a,16),this.z=new BN$5(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}inherits$1(Point$1,Base$1.BasePoint);MontCurve.prototype.decodePoint=function i(a,o){return this.point(utils$8.toArray(a,o),1)};MontCurve.prototype.point=function i(a,o){return new Point$1(this,a,o)};MontCurve.prototype.pointFromJSON=function i(a){return Point$1.fromJSON(this,a)};Point$1.prototype.precompute=function i(){};Point$1.prototype._encode=function i(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function i(a,o){return new Point$1(a,o[0],o[1]||a.one)};Point$1.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point$1.prototype.isInfinity=function i(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function i(){var a=this.x.redAdd(this.z),o=a.redSqr(),_=this.x.redSub(this.z),et=_.redSqr(),rt=o.redSub(et),ot=o.redMul(et),ft=rt.redMul(et.redAdd(this.curve.a24.redMul(rt)));return this.curve.point(ot,ft)};Point$1.prototype.add=function i(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.diffAdd=function i(a,o){var _=this.x.redAdd(this.z),et=this.x.redSub(this.z),rt=a.x.redAdd(a.z),ot=a.x.redSub(a.z),ft=ot.redMul(_),lt=rt.redMul(et),ht=o.z.redMul(ft.redAdd(lt).redSqr()),vt=o.x.redMul(ft.redISub(lt).redSqr());return this.curve.point(ht,vt)};Point$1.prototype.mul=function i(a){for(var o=a.clone(),_=this,et=this.curve.point(null,null),rt=this,ot=[];o.cmpn(0)!==0;o.iushrn(1))ot.push(o.andln(1));for(var ft=ot.length-1;ft>=0;ft--)ot[ft]===0?(_=_.diffAdd(et,rt),et=et.dbl()):(et=_.diffAdd(et,rt),_=_.dbl());return et};Point$1.prototype.mulAdd=function i(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function i(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function i(a){return this.getX().cmp(a.getX())===0};Point$1.prototype.normalize=function i(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function i(){return this.normalize(),this.x.fromRed()};var utils$7=utils$c,BN$4=bnExports,inherits=inherits_browserExports,Base=base,assert$7=utils$7.assert;function EdwardsCurve(i){this.twisted=(i.a|0)!==1,this.mOneA=this.twisted&&(i.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",i),this.a=new BN$4(i.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$4(i.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$4(i.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(i.c|0)===1}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function i(a){return this.mOneA?a.redNeg():this.a.redMul(a)};EdwardsCurve.prototype._mulC=function i(a){return this.oneC?a:this.c.redMul(a)};EdwardsCurve.prototype.jpoint=function i(a,o,_,et){return this.point(a,o,_,et)};EdwardsCurve.prototype.pointFromX=function i(a,o){a=new BN$4(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr(),et=this.c2.redSub(this.a.redMul(_)),rt=this.one.redSub(this.c2.redMul(this.d).redMul(_)),ot=et.redMul(rt.redInvm()),ft=ot.redSqrt();if(ft.redSqr().redSub(ot).cmp(this.zero)!==0)throw new Error("invalid point");var lt=ft.fromRed().isOdd();return(o&&!lt||!o&<)&&(ft=ft.redNeg()),this.point(a,ft)};EdwardsCurve.prototype.pointFromY=function i(a,o){a=new BN$4(a,16),a.red||(a=a.toRed(this.red));var _=a.redSqr(),et=_.redSub(this.c2),rt=_.redMul(this.d).redMul(this.c2).redSub(this.a),ot=et.redMul(rt.redInvm());if(ot.cmp(this.zero)===0){if(o)throw new Error("invalid point");return this.point(this.zero,a)}var ft=ot.redSqrt();if(ft.redSqr().redSub(ot).cmp(this.zero)!==0)throw new Error("invalid point");return ft.fromRed().isOdd()!==o&&(ft=ft.redNeg()),this.point(ft,a)};EdwardsCurve.prototype.validate=function i(a){if(a.isInfinity())return!0;a.normalize();var o=a.x.redSqr(),_=a.y.redSqr(),et=o.redMul(this.a).redAdd(_),rt=this.c2.redMul(this.one.redAdd(this.d.redMul(o).redMul(_)));return et.cmp(rt)===0};function Point(i,a,o,_,et){Base.BasePoint.call(this,i,"projective"),a===null&&o===null&&_===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new BN$4(a,16),this.y=new BN$4(o,16),this.z=_?new BN$4(_,16):this.curve.one,this.t=et&&new BN$4(et,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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}inherits(Point,Base.BasePoint);EdwardsCurve.prototype.pointFromJSON=function i(a){return Point.fromJSON(this,a)};EdwardsCurve.prototype.point=function i(a,o,_,et){return new Point(this,a,o,_,et)};Point.fromJSON=function i(a,o){return new Point(a,o[0],o[1],o[2])};Point.prototype.inspect=function i(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Point.prototype.isInfinity=function i(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Point.prototype._extDbl=function i(){var a=this.x.redSqr(),o=this.y.redSqr(),_=this.z.redSqr();_=_.redIAdd(_);var et=this.curve._mulA(a),rt=this.x.redAdd(this.y).redSqr().redISub(a).redISub(o),ot=et.redAdd(o),ft=ot.redSub(_),lt=et.redSub(o),ht=rt.redMul(ft),vt=ot.redMul(lt),It=rt.redMul(lt),Qt=ft.redMul(ot);return this.curve.point(ht,vt,Qt,It)};Point.prototype._projDbl=function i(){var a=this.x.redAdd(this.y).redSqr(),o=this.x.redSqr(),_=this.y.redSqr(),et,rt,ot,ft,lt,ht;if(this.curve.twisted){ft=this.curve._mulA(o);var vt=ft.redAdd(_);this.zOne?(et=a.redSub(o).redSub(_).redMul(vt.redSub(this.curve.two)),rt=vt.redMul(ft.redSub(_)),ot=vt.redSqr().redSub(vt).redSub(vt)):(lt=this.z.redSqr(),ht=vt.redSub(lt).redISub(lt),et=a.redSub(o).redISub(_).redMul(ht),rt=vt.redMul(ft.redSub(_)),ot=vt.redMul(ht))}else ft=o.redAdd(_),lt=this.curve._mulC(this.z).redSqr(),ht=ft.redSub(lt).redSub(lt),et=this.curve._mulC(a.redISub(ft)).redMul(ht),rt=this.curve._mulC(ft).redMul(o.redISub(_)),ot=ft.redMul(ht);return this.curve.point(et,rt,ot)};Point.prototype.dbl=function i(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function i(a){var o=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),_=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),et=this.t.redMul(this.curve.dd).redMul(a.t),rt=this.z.redMul(a.z.redAdd(a.z)),ot=_.redSub(o),ft=rt.redSub(et),lt=rt.redAdd(et),ht=_.redAdd(o),vt=ot.redMul(ft),It=lt.redMul(ht),Qt=ot.redMul(ht),mt=ft.redMul(lt);return this.curve.point(vt,It,mt,Qt)};Point.prototype._projAdd=function i(a){var o=this.z.redMul(a.z),_=o.redSqr(),et=this.x.redMul(a.x),rt=this.y.redMul(a.y),ot=this.curve.d.redMul(et).redMul(rt),ft=_.redSub(ot),lt=_.redAdd(ot),ht=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(et).redISub(rt),vt=o.redMul(ft).redMul(ht),It,Qt;return this.curve.twisted?(It=o.redMul(lt).redMul(rt.redSub(this.curve._mulA(et))),Qt=ft.redMul(lt)):(It=o.redMul(lt).redMul(rt.redSub(et)),Qt=this.curve._mulC(ft).redMul(lt)),this.curve.point(vt,It,Qt)};Point.prototype.add=function i(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)};Point.prototype.mul=function i(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)};Point.prototype.mulAdd=function i(a,o,_){return this.curve._wnafMulAdd(1,[this,o],[a,_],2,!1)};Point.prototype.jmulAdd=function i(a,o,_){return this.curve._wnafMulAdd(1,[this,o],[a,_],2,!0)};Point.prototype.normalize=function i(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function i(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function i(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function i(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function i(a){return this===a||this.getX().cmp(a.getX())===0&&this.getY().cmp(a.getY())===0};Point.prototype.eqXToP=function i(a){var o=a.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(o)===0)return!0;for(var _=a.clone(),et=this.curve.redN.redMul(this.z);;){if(_.iadd(this.curve.n),_.cmp(this.curve.p)>=0)return!1;if(o.redIAdd(et),this.x.cmp(o)===0)return!0}};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add;(function(i){var a=i;a.base=base,a.short=short,a.mont=mont,a.edwards=edwards})(curve);var curves$2={},secp256k1,hasRequiredSecp256k1;function requireSecp256k1(){return hasRequiredSecp256k1||(hasRequiredSecp256k1=1,secp256k1={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),secp256k1}(function(i){var a=i,o=hash$4,_=curve,et=utils$c,rt=et.assert;function ot(ht){ht.type==="short"?this.curve=new _.short(ht):ht.type==="edwards"?this.curve=new _.edwards(ht):this.curve=new _.mont(ht),this.g=this.curve.g,this.n=this.curve.n,this.hash=ht.hash,rt(this.g.validate(),"Invalid curve"),rt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}a.PresetCurve=ot;function ft(ht,vt){Object.defineProperty(a,ht,{configurable:!0,enumerable:!0,get:function(){var It=new ot(vt);return Object.defineProperty(a,ht,{configurable:!0,enumerable:!0,value:It}),It}})}ft("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),ft("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),ft("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),ft("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),ft("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),ft("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),ft("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var lt;try{lt=requireSecp256k1()}catch{lt=void 0}ft("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",lt]})})(curves$2);var hash$2=hash$4,utils$6=utils$b,assert$6=minimalisticAssert$1;function HmacDRBG$1(i){if(!(this instanceof HmacDRBG$1))return new HmacDRBG$1(i);this.hash=i.hash,this.predResist=!!i.predResist,this.outLen=this.hash.outSize,this.minEntropy=i.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var a=utils$6.toArray(i.entropy,i.entropyEnc||"hex"),o=utils$6.toArray(i.nonce,i.nonceEnc||"hex"),_=utils$6.toArray(i.pers,i.persEnc||"hex");assert$6(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(a,o,_)}var hmacDrbg=HmacDRBG$1;HmacDRBG$1.prototype._init=function i(a,o,_){var et=a.concat(o).concat(_);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var rt=0;rt<this.V.length;rt++)this.K[rt]=0,this.V[rt]=1;this._update(et),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG$1.prototype._hmac=function i(){return new hash$2.hmac(this.hash,this.K)};HmacDRBG$1.prototype._update=function i(a){var o=this._hmac().update(this.V).update([0]);a&&(o=o.update(a)),this.K=o.digest(),this.V=this._hmac().update(this.V).digest(),a&&(this.K=this._hmac().update(this.V).update([1]).update(a).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG$1.prototype.reseed=function i(a,o,_,et){typeof o!="string"&&(et=_,_=o,o=null),a=utils$6.toArray(a,o),_=utils$6.toArray(_,et),assert$6(a.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(_||[])),this._reseed=1};HmacDRBG$1.prototype.generate=function i(a,o,_,et){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(et=_,_=o,o=null),_&&(_=utils$6.toArray(_,et||"hex"),this._update(_));for(var rt=[];rt.length<a;)this.V=this._hmac().update(this.V).digest(),rt=rt.concat(this.V);var ot=rt.slice(0,a);return this._update(_),this._reseed++,utils$6.encode(ot,o)};var BN$3=bnExports,utils$5=utils$c,assert$5=utils$5.assert;function KeyPair$3(i,a){this.ec=i,this.priv=null,this.pub=null,a.priv&&this._importPrivate(a.priv,a.privEnc),a.pub&&this._importPublic(a.pub,a.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function i(a,o,_){return o instanceof KeyPair$3?o:new KeyPair$3(a,{pub:o,pubEnc:_})};KeyPair$3.fromPrivate=function i(a,o,_){return o instanceof KeyPair$3?o:new KeyPair$3(a,{priv:o,privEnc:_})};KeyPair$3.prototype.validate=function i(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$3.prototype.getPublic=function i(a,o){return typeof a=="string"&&(o=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),o?this.pub.encode(o,a):this.pub};KeyPair$3.prototype.getPrivate=function i(a){return a==="hex"?this.priv.toString(16,2):this.priv};KeyPair$3.prototype._importPrivate=function i(a,o){this.priv=new BN$3(a,o||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$3.prototype._importPublic=function i(a,o){if(a.x||a.y){this.ec.curve.type==="mont"?assert$5(a.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$5(a.x&&a.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(a.x,a.y);return}this.pub=this.ec.curve.decodePoint(a,o)};KeyPair$3.prototype.derive=function i(a){return a.validate()||assert$5(a.validate(),"public point not validated"),a.mul(this.priv).getX()};KeyPair$3.prototype.sign=function i(a,o,_){return this.ec.sign(a,this,o,_)};KeyPair$3.prototype.verify=function i(a,o){return this.ec.verify(a,o,this)};KeyPair$3.prototype.inspect=function i(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var BN$2=bnExports,utils$4=utils$c,assert$4=utils$4.assert;function Signature$3(i,a){if(i instanceof Signature$3)return i;this._importDER(i,a)||(assert$4(i.r&&i.s,"Signature without r or s"),this.r=new BN$2(i.r,16),this.s=new BN$2(i.s,16),i.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=i.recoveryParam)}var signature$1=Signature$3;function Position(){this.place=0}function getLength(i,a){var o=i[a.place++];if(!(o&128))return o;var _=o&15;if(_===0||_>4)return!1;for(var et=0,rt=0,ot=a.place;rt<_;rt++,ot++)et<<=8,et|=i[ot],et>>>=0;return et<=127?!1:(a.place=ot,et)}function rmPadding(i){for(var a=0,o=i.length-1;!i[a]&&!(i[a+1]&128)&&a<o;)a++;return a===0?i:i.slice(a)}Signature$3.prototype._importDER=function i(a,o){a=utils$4.toArray(a,o);var _=new Position;if(a[_.place++]!==48)return!1;var et=getLength(a,_);if(et===!1||et+_.place!==a.length||a[_.place++]!==2)return!1;var rt=getLength(a,_);if(rt===!1)return!1;var ot=a.slice(_.place,rt+_.place);if(_.place+=rt,a[_.place++]!==2)return!1;var ft=getLength(a,_);if(ft===!1||a.length!==ft+_.place)return!1;var lt=a.slice(_.place,ft+_.place);if(ot[0]===0)if(ot[1]&128)ot=ot.slice(1);else return!1;if(lt[0]===0)if(lt[1]&128)lt=lt.slice(1);else return!1;return this.r=new BN$2(ot),this.s=new BN$2(lt),this.recoveryParam=null,!0};function constructLength(i,a){if(a<128){i.push(a);return}var o=1+(Math.log(a)/Math.LN2>>>3);for(i.push(o|128);--o;)i.push(a>>>(o<<3)&255);i.push(a)}Signature$3.prototype.toDER=function i(a){var o=this.r.toArray(),_=this.s.toArray();for(o[0]&128&&(o=[0].concat(o)),_[0]&128&&(_=[0].concat(_)),o=rmPadding(o),_=rmPadding(_);!_[0]&&!(_[1]&128);)_=_.slice(1);var et=[2];constructLength(et,o.length),et=et.concat(o),et.push(2),constructLength(et,_.length);var rt=et.concat(_),ot=[48];return constructLength(ot,rt.length),ot=ot.concat(rt),utils$4.encode(ot,a)};var BN$1=bnExports,HmacDRBG=hmacDrbg,utils$3=utils$c,curves$1=curves$2,rand=brorandExports,assert$3=utils$3.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC$1(i){if(!(this instanceof EC$1))return new EC$1(i);typeof i=="string"&&(assert$3(Object.prototype.hasOwnProperty.call(curves$1,i),"Unknown curve "+i),i=curves$1[i]),i instanceof curves$1.PresetCurve&&(i={curve:i}),this.curve=i.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=i.curve.g,this.g.precompute(i.curve.n.bitLength()+1),this.hash=i.hash||i.curve.hash}var ec=EC$1;EC$1.prototype.keyPair=function i(a){return new KeyPair$2(this,a)};EC$1.prototype.keyFromPrivate=function i(a,o){return KeyPair$2.fromPrivate(this,a,o)};EC$1.prototype.keyFromPublic=function i(a,o){return KeyPair$2.fromPublic(this,a,o)};EC$1.prototype.genKeyPair=function i(a){a||(a={});for(var o=new HmacDRBG({hash:this.hash,pers:a.pers,persEnc:a.persEnc||"utf8",entropy:a.entropy||rand(this.hash.hmacStrength),entropyEnc:a.entropy&&a.entropyEnc||"utf8",nonce:this.n.toArray()}),_=this.n.byteLength(),et=this.n.sub(new BN$1(2));;){var rt=new BN$1(o.generate(_));if(!(rt.cmp(et)>0))return rt.iaddn(1),this.keyFromPrivate(rt)}};EC$1.prototype._truncateToN=function i(a,o){var _=a.byteLength()*8-this.n.bitLength();return _>0&&(a=a.ushrn(_)),!o&&a.cmp(this.n)>=0?a.sub(this.n):a};EC$1.prototype.sign=function i(a,o,_,et){typeof _=="object"&&(et=_,_=null),et||(et={}),o=this.keyFromPrivate(o,_),a=this._truncateToN(new BN$1(a,16));for(var rt=this.n.byteLength(),ot=o.getPrivate().toArray("be",rt),ft=a.toArray("be",rt),lt=new HmacDRBG({hash:this.hash,entropy:ot,nonce:ft,pers:et.pers,persEnc:et.persEnc||"utf8"}),ht=this.n.sub(new BN$1(1)),vt=0;;vt++){var It=et.k?et.k(vt):new BN$1(lt.generate(this.n.byteLength()));if(It=this._truncateToN(It,!0),!(It.cmpn(1)<=0||It.cmp(ht)>=0)){var Qt=this.g.mul(It);if(!Qt.isInfinity()){var mt=Qt.getX(),Yt=mt.umod(this.n);if(Yt.cmpn(0)!==0){var Rt=It.invm(this.n).mul(Yt.mul(o.getPrivate()).iadd(a));if(Rt=Rt.umod(this.n),Rt.cmpn(0)!==0){var cr=(Qt.getY().isOdd()?1:0)|(mt.cmp(Yt)!==0?2:0);return et.canonical&&Rt.cmp(this.nh)>0&&(Rt=this.n.sub(Rt),cr^=1),new Signature$2({r:Yt,s:Rt,recoveryParam:cr})}}}}}};EC$1.prototype.verify=function i(a,o,_,et){a=this._truncateToN(new BN$1(a,16)),_=this.keyFromPublic(_,et),o=new Signature$2(o,"hex");var rt=o.r,ot=o.s;if(rt.cmpn(1)<0||rt.cmp(this.n)>=0||ot.cmpn(1)<0||ot.cmp(this.n)>=0)return!1;var ft=ot.invm(this.n),lt=ft.mul(a).umod(this.n),ht=ft.mul(rt).umod(this.n),vt;return this.curve._maxwellTrick?(vt=this.g.jmulAdd(lt,_.getPublic(),ht),vt.isInfinity()?!1:vt.eqXToP(rt)):(vt=this.g.mulAdd(lt,_.getPublic(),ht),vt.isInfinity()?!1:vt.getX().umod(this.n).cmp(rt)===0)};EC$1.prototype.recoverPubKey=function(i,a,o,_){assert$3((3&o)===o,"The recovery param is more than two bits"),a=new Signature$2(a,_);var et=this.n,rt=new BN$1(i),ot=a.r,ft=a.s,lt=o&1,ht=o>>1;if(ot.cmp(this.curve.p.umod(this.curve.n))>=0&&ht)throw new Error("Unable to find sencond key candinate");ht?ot=this.curve.pointFromX(ot.add(this.curve.n),lt):ot=this.curve.pointFromX(ot,lt);var vt=a.r.invm(et),It=et.sub(rt).mul(vt).umod(et),Qt=ft.mul(vt).umod(et);return this.g.mulAdd(It,ot,Qt)};EC$1.prototype.getKeyRecoveryParam=function(i,a,o,_){if(a=new Signature$2(a,_),a.recoveryParam!==null)return a.recoveryParam;for(var et=0;et<4;et++){var rt;try{rt=this.recoverPubKey(i,a,et)}catch{continue}if(rt.eq(o))return et}throw new Error("Unable to find valid recovery factor")};var utils$2=utils$c,assert$2=utils$2.assert,parseBytes$2=utils$2.parseBytes,cachedProperty$1=utils$2.cachedProperty;function KeyPair$1(i,a){this.eddsa=i,this._secret=parseBytes$2(a.secret),i.isPoint(a.pub)?this._pub=a.pub:this._pubBytes=parseBytes$2(a.pub)}KeyPair$1.fromPublic=function i(a,o){return o instanceof KeyPair$1?o:new KeyPair$1(a,{pub:o})};KeyPair$1.fromSecret=function i(a,o){return o instanceof KeyPair$1?o:new KeyPair$1(a,{secret:o})};KeyPair$1.prototype.secret=function i(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function i(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function i(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function i(){var a=this.eddsa,o=this.hash(),_=a.encodingLength-1,et=o.slice(0,a.encodingLength);return et[0]&=248,et[_]&=127,et[_]|=64,et});cachedProperty$1(KeyPair$1,"priv",function i(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function i(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function i(){return this.hash().slice(this.eddsa.encodingLength)});KeyPair$1.prototype.sign=function i(a){return assert$2(this._secret,"KeyPair can only verify"),this.eddsa.sign(a,this)};KeyPair$1.prototype.verify=function i(a,o){return this.eddsa.verify(a,o,this)};KeyPair$1.prototype.getSecret=function i(a){return assert$2(this._secret,"KeyPair is public only"),utils$2.encode(this.secret(),a)};KeyPair$1.prototype.getPublic=function i(a){return utils$2.encode(this.pubBytes(),a)};var key=KeyPair$1,BN=bnExports,utils$1=utils$c,assert$1=utils$1.assert,cachedProperty=utils$1.cachedProperty,parseBytes$1=utils$1.parseBytes;function Signature$1(i,a){this.eddsa=i,typeof a!="object"&&(a=parseBytes$1(a)),Array.isArray(a)&&(a={R:a.slice(0,i.encodingLength),S:a.slice(i.encodingLength)}),assert$1(a.R&&a.S,"Signature without R or S"),i.isPoint(a.R)&&(this._R=a.R),a.S instanceof BN&&(this._S=a.S),this._Rencoded=Array.isArray(a.R)?a.R:a.Rencoded,this._Sencoded=Array.isArray(a.S)?a.S:a.Sencoded}cachedProperty(Signature$1,"S",function i(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function i(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function i(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function i(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function i(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function i(){return utils$1.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$4,curves=curves$2,utils=utils$c,assert=utils.assert,parseBytes=utils.parseBytes,KeyPair=key,Signature=signature;function EDDSA(i){if(assert(i==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(i);i=curves[i].curve,this.curve=i,this.g=i.g,this.g.precompute(i.n.bitLength()+1),this.pointClass=i.point().constructor,this.encodingLength=Math.ceil(i.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function i(a,o){a=parseBytes(a);var _=this.keyFromSecret(o),et=this.hashInt(_.messagePrefix(),a),rt=this.g.mul(et),ot=this.encodePoint(rt),ft=this.hashInt(ot,_.pubBytes(),a).mul(_.priv()),lt=et.add(ft).umod(this.curve.n);return this.makeSignature({R:rt,S:lt,Rencoded:ot})};EDDSA.prototype.verify=function i(a,o,_){a=parseBytes(a),o=this.makeSignature(o);var et=this.keyFromPublic(_),rt=this.hashInt(o.Rencoded(),et.pubBytes(),a),ot=this.g.mul(o.S()),ft=o.R().add(et.pub().mul(rt));return ft.eq(ot)};EDDSA.prototype.hashInt=function i(){for(var a=this.hash(),o=0;o<arguments.length;o++)a.update(arguments[o]);return utils.intFromLE(a.digest()).umod(this.curve.n)};EDDSA.prototype.keyFromPublic=function i(a){return KeyPair.fromPublic(this,a)};EDDSA.prototype.keyFromSecret=function i(a){return KeyPair.fromSecret(this,a)};EDDSA.prototype.makeSignature=function i(a){return a instanceof Signature?a:new Signature(this,a)};EDDSA.prototype.encodePoint=function i(a){var o=a.getY().toArray("le",this.encodingLength);return o[this.encodingLength-1]|=a.getX().isOdd()?128:0,o};EDDSA.prototype.decodePoint=function i(a){a=utils.parseBytes(a);var o=a.length-1,_=a.slice(0,o).concat(a[o]&-129),et=(a[o]&128)!==0,rt=utils.intFromLE(_);return this.curve.pointFromY(rt,et)};EDDSA.prototype.encodeInt=function i(a){return a.toArray("le",this.encodingLength)};EDDSA.prototype.decodeInt=function i(a){return utils.intFromLE(a)};EDDSA.prototype.isPoint=function i(a){return a instanceof this.pointClass};(function(i){var a=i;a.version=require$$0.version,a.utils=utils$c,a.rand=brorandExports,a.curve=curve,a.curves=curves$2,a.ec=ec,a.eddsa=eddsa})(elliptic);const _ec=getDefaultExportFromCjs(elliptic);var __decorate$3=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata$3=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},Secp256k1PublicKey_1,Secp256k1PrivateKey_1,Secp256k1Keypair_1,EC=_ec.ec;let _curve,Secp256k1PublicKey=Secp256k1PublicKey_1=class extends PublicSignKey{constructor(o){super();En(this,"publicKey");if(o.publicKey.length!==33)throw new Error("Expecting key to have length 33");this.publicKey=o.publicKey}static async recover(o){const _=new Uint8Array([0]),et=await o.signMessage(_),rt=recoverPublicKeyFromSignature(await prehashFn(_,PreHash.ETH_KECCAK_256),et);return new Secp256k1PublicKey_1({publicKey:rt})}equals(o){return o instanceof Secp256k1PublicKey_1?equals(this.publicKey,o.publicKey):!1}toString(){return"sepc256k1/"+toHexString(this.publicKey)}static from(o){if(!o.publicKey)throw new Error("Missing public key");if(o.type==="secp256k1")return new Secp256k1PublicKey_1({publicKey:o.publicKey.slice(4)});throw new Error("Unsupported key type: "+o.type)}};__decorate$3([field({type:fixedArray("u8",33)}),__metadata$3("design:type",Uint8Array)],Secp256k1PublicKey.prototype,"publicKey",void 0);Secp256k1PublicKey=Secp256k1PublicKey_1=__decorate$3([variant(1),__metadata$3("design:paramtypes",[Object])],Secp256k1PublicKey);let Secp256k1PrivateKey=Secp256k1PrivateKey_1=class extends PrivateSignKey{constructor(o){super();En(this,"privateKey");if(o.privateKey.length!==32)throw new Error("Expecting key to have length 32");this.privateKey=o.privateKey}equals(o){return o instanceof Secp256k1PrivateKey_1?equals(this.privateKey,o.privateKey):!1}toString(){return"secp256k1s/"+toHexString(this.privateKey)}static from(o){if(!o.privateKey)throw new Error("Missing privateKey key");if(o.type==="secp256k1")return new Secp256k1PrivateKey_1({privateKey:coerce(o.privateKey.slice(4))});throw new Error("Unsupported key type: "+o.type)}};__decorate$3([field({type:Uint8Array}),__metadata$3("design:type",Uint8Array)],Secp256k1PrivateKey.prototype,"privateKey",void 0);Secp256k1PrivateKey=Secp256k1PrivateKey_1=__decorate$3([variant(1),__metadata$3("design:paramtypes",[Object])],Secp256k1PrivateKey);let Secp256k1Keypair=Secp256k1Keypair_1=class extends Keypair{constructor(o){super();En(this,"publicKey");En(this,"privateKey");En(this,"_wallet");this.privateKey=o.privateKey,this.publicKey=o.publicKey}static async create(){const o=await generateKeyPair("secp256k1");return new Secp256k1Keypair_1({publicKey:new Secp256k1PublicKey({publicKey:o.public.marshal()}),privateKey:new Secp256k1PrivateKey({privateKey:o.marshal()})})}async sign(o,_=PreHash.ETH_KECCAK_256){const et=await prehashFn(o,_),rt=joinSignature((this._wallet||(this._wallet=new Wallet(this.privateKey.privateKey)))._signingKey().signDigest(et)),ot=new Uint8Array(utf8$2.length(rt));return utf8$2.write(rt,ot,0),new SignatureWithKey({prehash:_,publicKey:this.publicKey,signature:ot})}equals(o){return o instanceof Secp256k1Keypair_1?this.publicKey.equals(o.publicKey)&&this.privateKey.equals(o.privateKey):!1}static fromPeerId(o){return new Secp256k1Keypair_1({privateKey:Secp256k1PrivateKey.from(o),publicKey:Secp256k1PublicKey.from(o)})}toPeerId(){return peerIdFromKeys(new supportedKeys.secp256k1.Secp256k1PublicKey(this.publicKey.publicKey).bytes,new supportedKeys.secp256k1.Secp256k1PrivateKey(this.privateKey.privateKey,this.publicKey.publicKey).bytes)}};__decorate$3([field({type:Secp256k1PublicKey}),__metadata$3("design:type",Secp256k1PublicKey)],Secp256k1Keypair.prototype,"publicKey",void 0);__decorate$3([field({type:Secp256k1PrivateKey}),__metadata$3("design:type",Secp256k1PrivateKey)],Secp256k1Keypair.prototype,"privateKey",void 0);Secp256k1Keypair=Secp256k1Keypair_1=__decorate$3([variant(2),__metadata$3("design:paramtypes",[Object])],Secp256k1Keypair);const decoder=new TextDecoder;function getCurve(){return _curve||(_curve=new EC("secp256k1")),_curve}const recoverPublicKeyFromSignature=(i,a)=>{const o=splitSignature(a),_={r:arrayify(o.r),s:arrayify(o.s)};return new Uint8Array(getCurve().recoverPubKey(arrayify(i),_,o.recoveryParam).encodeCompressed())},verifySignatureSecp256k1=async(i,a)=>{const o=await prehashFn(a,i.prehash),_=recoverPublicKeyFromSignature(arrayify(o),decoder.decode(i.signature));return equals(_,i.publicKey.publicKey)};var __decorate$2=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata$2=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)};let SignatureWithKey=class{constructor(a){En(this,"signature");En(this,"publicKey");En(this,"prehash",PreHash.NONE);a&&(this.signature=a.signature,this.publicKey=a.publicKey,this.prehash=a.prehash)}equals(a){return equals(this.signature,a.signature)?Buffer.compare(serialize$2(this.publicKey),serialize$2(a.publicKey))===0&&this.prehash==a.prehash:!1}};__decorate$2([field({type:Uint8Array}),__metadata$2("design:type",Uint8Array)],SignatureWithKey.prototype,"signature",void 0);__decorate$2([field({type:PublicSignKey}),__metadata$2("design:type",PublicSignKey)],SignatureWithKey.prototype,"publicKey",void 0);__decorate$2([field({type:"u8"}),__metadata$2("design:type",Number)],SignatureWithKey.prototype,"prehash",void 0);SignatureWithKey=__decorate$2([variant(0),__metadata$2("design:paramtypes",[Object])],SignatureWithKey);let MaybeSigned=class{constructor(a){En(this,"data");En(this,"signature");En(this,"_value");a&&(this.data=a.data,this.signature=a.signature,this._value=a.value)}getValue(a){return deserialize(this.data,a)}async verify(){return this.signature?verify(this.signature,this.data):!0}equals(a){return!equals(this.data,a.data)||!this.signature!=!a.signature?!1:this.signature&&a.signature?this.signature.equals(a.signature):!0}async sign(a){const o=await a(this.data);return this.signature=o,this}};__decorate$2([field({type:Uint8Array}),__metadata$2("design:type",Uint8Array)],MaybeSigned.prototype,"data",void 0);__decorate$2([field({type:option(SignatureWithKey)}),__metadata$2("design:type",SignatureWithKey)],MaybeSigned.prototype,"signature",void 0);MaybeSigned=__decorate$2([variant(0),__metadata$2("design:paramtypes",[Object])],MaybeSigned);const verify=async(i,a)=>i.publicKey instanceof Ed25519PublicKey?verifySignatureEd25519(i,a):i.publicKey instanceof Secp256k1PublicKey?verifySignatureSecp256k1(i,a):!1,sign=async(i,a,o)=>{const _=await prehashFn(i,o);return new SignatureWithKey({prehash:o,publicKey:a.publicKey,signature:sodium.crypto_sign_detached(_,a.privateKeyPublicKey)})},verifySignatureEd25519=async(i,a)=>{let o=!1;try{const _=await prehashFn(a,i.prehash);o=sodium.crypto_sign_verify_detached(i.signature,_,i.publicKey.publicKey)}catch{return!1}return o};var __decorate$1=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata$1=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},Ed25519PublicKey_1,Ed25519PrivateKey_1,Ed25519Keypair_1;let Ed25519PublicKey=Ed25519PublicKey_1=class extends PublicSignKey{constructor(o){super();En(this,"publicKey");if(this.publicKey=o.publicKey,o.publicKey.length!==32)throw new Error("Expecting key to have length 32")}equals(o){return o instanceof Ed25519PublicKey_1?equals(this.publicKey,o.publicKey):!1}toString(){return"ed25119p/"+toHexString(this.publicKey)}toPeerId(){return peerIdFromKeys(new supportedKeys.ed25519.Ed25519PublicKey(this.publicKey).bytes)}static fromPeerId(o){if(!o.publicKey)throw new Error("Missing public key");if(o.type==="Ed25519")return new Ed25519PublicKey_1({publicKey:coerce(o.publicKey.slice(4))});throw new Error("Unsupported key type: "+o.type)}};__decorate$1([field({type:fixedArray("u8",32)}),__metadata$1("design:type",Uint8Array)],Ed25519PublicKey.prototype,"publicKey",void 0);Ed25519PublicKey=Ed25519PublicKey_1=__decorate$1([variant(0),__metadata$1("design:paramtypes",[Object])],Ed25519PublicKey);let Ed25519PrivateKey=Ed25519PrivateKey_1=class extends PrivateSignKey{constructor(o){super();En(this,"privateKey");En(this,"keyObject");if(o.privateKey.length!==32)throw new Error("Expecting key to have length 32");this.privateKey=o.privateKey}equals(o){return o instanceof Ed25519PrivateKey_1?equals(this.privateKey,o.privateKey):!1}toString(){return"ed25119s/"+toHexString(this.privateKey)}static fromPeerID(o){if(!o.privateKey)throw new Error("Missing privateKey key");if(o.type==="Ed25519")return new Ed25519PrivateKey_1({privateKey:coerce(o.privateKey.slice(4,36))});throw new Error("Unsupported key type: "+o.type)}};__decorate$1([field({type:fixedArray("u8",32)}),__metadata$1("design:type",Uint8Array)],Ed25519PrivateKey.prototype,"privateKey",void 0);Ed25519PrivateKey=Ed25519PrivateKey_1=__decorate$1([variant(0),__metadata$1("design:paramtypes",[Object])],Ed25519PrivateKey);let Ed25519Keypair=Ed25519Keypair_1=class extends Keypair{constructor(o){super();En(this,"publicKey");En(this,"privateKey");En(this,"_privateKeyPublicKey");this.privateKey=o.privateKey,this.publicKey=o.publicKey}static async create(){await sodium.ready;const o=sodium.crypto_sign_keypair();return new Ed25519Keypair_1({publicKey:new Ed25519PublicKey({publicKey:o.publicKey}),privateKey:new Ed25519PrivateKey({privateKey:o.privateKey.slice(0,32)})})}sign(o,_=PreHash.NONE){return sign(o,this,_)}signer(o){return async _=>this.sign(_,o)}equals(o){return o instanceof Ed25519Keypair_1?this.publicKey.equals(o.publicKey)&&this.privateKey.equals(o.privateKey):!1}static fromPeerId(o){return new Ed25519Keypair_1({privateKey:Ed25519PrivateKey.fromPeerID(o),publicKey:Ed25519PublicKey.fromPeerId(o)})}get privateKeyPublicKey(){return this._privateKeyPublicKey||(this._privateKeyPublicKey=concat$1([this.privateKey.privateKey,this.publicKey.publicKey]))}toPeerId(){return peerIdFromKeys(new supportedKeys.ed25519.Ed25519PublicKey(this.publicKey.publicKey).bytes,new supportedKeys.ed25519.Ed25519PrivateKey(this.privateKeyPublicKey,this.publicKey.publicKey).bytes)}};__decorate$1([field({type:Ed25519PublicKey}),__metadata$1("design:type",Ed25519PublicKey)],Ed25519Keypair.prototype,"publicKey",void 0);__decorate$1([field({type:Ed25519PrivateKey}),__metadata$1("design:type",Ed25519PrivateKey)],Ed25519Keypair.prototype,"privateKey",void 0);Ed25519Keypair=Ed25519Keypair_1=__decorate$1([variant(0),__metadata$1("design:paramtypes",[Object])],Ed25519Keypair);const getPublicKeyFromPeerId=i=>{if(i.type==="Ed25519")return Ed25519PublicKey.fromPeerId(i);if(i.type==="secp256k1")return Secp256k1PublicKey.from(i);throw new Error("Unsupported key type")},MAX_PROTOTYPE_SEARCH=500,PROTOTYPE_DESERIALIZATION_HANDLER_OFFSET=500,PROTOTYPE_DEPENDENCY_HANDLER_OFFSET=PROTOTYPE_DESERIALIZATION_HANDLER_OFFSET+MAX_PROTOTYPE_SEARCH,getDependencies=(i,a)=>i.prototype[PROTOTYPE_DEPENDENCY_HANDLER_OFFSET+a],getSchemasBottomUp=i=>{var _;let a;const o=[];for(let et=0;et<1e3;et++){const rt=getSchema(i,et);if(rt)o.push(rt),a=rt;else if(a&&!((_=getDependencies(i,et))!=null&&_.length))return o}return o},getValuesWithType=(i,a,o)=>{const _=getSchemasBottomUp(i.constructor),et=[];for(const rt of _)for(const ot of rt.fields){const ft=i[ot.key];if(!ft)continue;const lt=ht=>{if(ht&&ht instanceof a)et.push(ht);else if(typeof ht=="object"){if(o&&ht instanceof o)return;getValuesWithType(ht,a,o).forEach(It=>{et.push(It)})}};if(Array.isArray(ft))for(const ht of ft)lt(ht);else lt(ft)}return et};var Mo,pA;let EventEmitter$1=(pA=class extends EventTarget{constructor(){super(...arguments);ps(this,Mo,new Map)}listenerCount(o){const _=fo(this,Mo).get(o);return _==null?0:_.length}addEventListener(o,_,et){super.addEventListener(o,_,et);let rt=fo(this,Mo).get(o);rt==null&&(rt=[],fo(this,Mo).set(o,rt)),rt.push({callback:_,once:(et!==!0&&et!==!1&&(et==null?void 0:et.once))??!1})}removeEventListener(o,_,et){super.removeEventListener(o.toString(),_??null,et);let rt=fo(this,Mo).get(o);rt!=null&&(rt=rt.filter(({callback:ot})=>ot!==_),fo(this,Mo).set(o,rt))}dispatchEvent(o){const _=super.dispatchEvent(o);let et=fo(this,Mo).get(o.type);return et==null||(et=et.filter(({once:rt})=>!rt),fo(this,Mo).set(o.type,et)),_}safeDispatchEvent(o,_){return this.dispatchEvent(new CustomEvent(o,_))}},Mo=new WeakMap,pA);class CustomEventPolyfill extends Event{constructor(o,_){super(o,_);En(this,"detail");this.detail=_==null?void 0:_.detail}}const CustomEvent=globalThis.CustomEvent??CustomEventPolyfill;class TimeoutError extends Error{constructor(a){super(a)}}const delay=(i,a)=>new Promise(o=>{const _=setTimeout(o,i);a!=null&&a.stopperCallback&&(a==null||a.stopperCallback(()=>{clearTimeout(_),o()}))}),waitForAsync=async(i,a={timeout:10*1e3,delayInterval:50})=>{const o=+new Date;let _=!1;if(a.stopperCallback){const et=()=>{_=!0};a.stopperCallback(et)}for(;+new Date-o<a.timeout;){if(_)return;const et=await i();if(et)return et;await delay(a.delayInterval,a)}throw new TimeoutError(a.timeoutMessage?"Timed out: "+a.timeoutMessage:"Timed out")};var __decorate=globalThis&&globalThis.__decorate||function(i,a,o,_){var et=arguments.length,rt=et<3?a:_===null?_=Object.getOwnPropertyDescriptor(a,o):_,ot;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")rt=Reflect.decorate(i,a,o,_);else for(var ft=i.length-1;ft>=0;ft--)(ot=i[ft])&&(rt=(et<3?ot(rt):et>3?ot(a,o,rt):ot(a,o))||rt);return et>3&&rt&&Object.defineProperty(a,o,rt),rt},__metadata=globalThis&&globalThis.__metadata||function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},AbstractProgram_1,Program_1;const intersection=(i,a)=>{const o=new Set;for(const _ of a)(!i||i.has(_))&&o.add(_);return o},getAllParentAddresses=i=>getAllParent(i,[]).filter(a=>a instanceof Program).map(a=>a.address),getAllParent=(i,a=[],o=!1)=>{if(o&&a.push(i),i.parents)for(const _ of i.parents)_&&getAllParent(_,a,!0);return a};let AbstractProgram=AbstractProgram_1=class{constructor(){En(this,"_node");En(this,"_allPrograms");En(this,"_events");En(this,"_closed");En(this,"parents");En(this,"children");En(this,"_eventOptions");En(this,"_subscriptionEventListener");En(this,"_unsubscriptionEventListener")}addParent(a){(this.parents||(this.parents=[])).push(a),a&&(a.children||(a.children=[])).push(this)}get events(){return this._events||(this._events=new EventEmitter$1)}get closed(){return this._closed==null?!0:this._closed}set closed(a){this._closed=a}get node(){return this._node}set node(a){this._node=a}async beforeOpen(a,o){if(this.closed)this.addParent(o==null?void 0:o.parent);else return this.addParent(o==null?void 0:o.parent),this;this._eventOptions=o,this.node=a;const _=this.programs;for(const et of _)await et.beforeOpen(a,{...o,parent:this});return this.node.services.pubsub.addEventListener("subscribe",this._subscriptionEventListener||(this._subscriptionEventListener=et=>!this.closed&&this._emitJoinNetworkEvents(et.detail))),this.node.services.pubsub.addEventListener("unsubscribe",this._unsubscriptionEventListener||(this._unsubscriptionEventListener=et=>!this.closed&&this._emitLeaveNetworkEvents(et.detail))),this}async afterOpen(){var o,_;this.emitEvent(new CustomEvent("open",{detail:this}),!0),(_=(o=this._eventOptions)==null?void 0:o.onOpen)==null||_.call(o,this),this.closed=!1;const a=this.programs;for(const et of a)await et.afterOpen();return this}_clear(){this._allPrograms=void 0}async _emitJoinNetworkEvents(a){var _;const o=this.programs.map(et=>{var rt;return(rt=et.getTopics)==null?void 0:rt.call(et)}).filter(et=>et).flat();for(const et of o)if(!((_=this.node.services.pubsub.getSubscribers(et))!=null&&_.has(a.from.hashcode())))return;this.events.dispatchEvent(new CustomEvent("join",{detail:a.from}))}async _emitLeaveNetworkEvents(a){var _;const o=this.programs.map(et=>{var rt;return(rt=et.getTopics)==null?void 0:rt.call(et)}).filter(et=>et).flat();for(const et of o)if((_=this.node.services.pubsub.getSubscribers(et))!=null&&_.has(a.from.hashcode()))return;this.events.dispatchEvent(new CustomEvent("leave",{detail:a.from}))}async _end(a){var o,_,et,rt;if(this.closed)return this._clear(),!0;{if(this.emitEvent(new CustomEvent(a,{detail:this}),!0),a==="close")(_=(o=this._eventOptions)==null?void 0:o.onClose)==null||_.call(o,this);else if(a==="drop")(rt=(et=this._eventOptions)==null?void 0:et.onDrop)==null||rt.call(et,this);else throw new Error("Unsupported event type: "+a);const ot=[];if(this.children){for(const ft of this.children)ot.push(ft[a](this));this.children=[]}return await Promise.all(ot),this._clear(),this.closed=!0,!0}}async close(a){var rt,ot;if(this.closed)return!0;let o=-1,_=!0;if(this.parents){if(o=this.parents.findIndex(ft=>ft==a),o!==-1)this.parents.length===1?_=!0:(this.parents.splice(o,1),_=!1);else if(a)throw new Error("Could not find from in parents")}const et=_&&await this._end("close");return et&&((rt=this.node)==null||rt.services.pubsub.removeEventListener("subscribe",this._subscriptionEventListener),(ot=this.node)==null||ot.services.pubsub.removeEventListener("unsubscribe",this._unsubscriptionEventListener),this._eventOptions=void 0,o!==-1&&this.parents.splice(o,1)),et}async drop(){await this._end("drop")}emitEvent(a,o=!1){if(this.events.dispatchEvent(a),o&&this.parents)for(const _ of this.parents)_==null||_.emitEvent(a)}async waitFor(...a){const o=new Set(a.map(_=>_ instanceof PublicSignKey?_.hashcode():getPublicKeyFromPeerId(_).hashcode()));await waitForAsync(async()=>intersection(o,await this.getReady()).size===o.size,{delayInterval:200,timeout:10*1e3})}async getReady(){let a;for(const o of this.allPrograms)if(o.getTopics){const _=o.getTopics();for(const et of _){const rt=await this.node.services.pubsub.getSubscribers(et);if(!rt)throw new Error("client is not subscriber to topic data, do not have any info about peer readiness");a=intersection(a,rt.keys())}}if(a==null)throw new Error("Do not have any info about peer readiness");return a}get allPrograms(){if(this._allPrograms)return this._allPrograms;const a=this.programs,o=this.programs;for(const _ of o)a.push(..._.allPrograms);return this._allPrograms=a,this._allPrograms}get programs(){return getValuesWithType(this,AbstractProgram_1)}clone(){return deserialize(serialize$2(this),this.constructor)}};AbstractProgram=AbstractProgram_1=__decorate([variant(0)],AbstractProgram);let Program=Program_1=class extends AbstractProgram{constructor(){super();En(this,"_address")}get address(){if(!this._address)throw new Error("Address does not exist, please open or save this program once to obtain it");return this._address}set address(o){this._address=o}async beforeOpen(o,_){const et=getSchema(this.constructor);if(!et||typeof et.variant!="string")throw new Error(`Expecting class to be decorated with a string variant. Example:
|
|
65
65
|
'import { variant } "@dao-xyz/borsh"
|
|
66
66
|
@variant("example-db")
|
|
67
|
-
class ${this.constructor.name} { ...`);if(await this.save(o.services.blocks),getAllParentAddresses(this).includes(this.address))throw new Error("Subprogram has same address as some parent program. This is not currently supported");return super.beforeOpen(o,_)}static async open(o,_,et){const rt=await Program_1.load(o,_.services.blocks);if(!rt)throw new Error("Failed to load program");return await _.open(rt,et),rt}async save(o=this.node.services.blocks){const _=this._address,et=await o.put(serialize$2(this));if(this._address=et,!this.address)throw new Error("Unexpected");if(_&&_!==this.address)throw new Error("Program properties has been changed after constructor so that the hash has changed. Make sure that the 'setup(...)' function does not modify any properties that are to be serialized");return this._address}async delete(){if(this.address)return this.node.services.blocks.rm(this.address)}static async load(o,_,et){const rt=await _.get(o,et);if(!rt)return;const ot=deserialize(rt,Program_1);return ot.address=o,ot}async drop(){return await super.drop(),this.delete()}};Program=Program_1=__decorate([variant(0),__metadata("design:paramtypes",[])],Program);let ComposableProgram=class extends AbstractProgram{};ComposableProgram=__decorate([variant(1)],ComposableProgram);var encode_1=encode,MSB$1=128,REST$1=127,MSBALL=~REST$1,INT=Math.pow(2,31);function encode(i,a,o){if(Number.MAX_SAFE_INTEGER&&i>Number.MAX_SAFE_INTEGER)throw encode.bytes=0,new RangeError("Could not encode varint");a=a||[],o=o||0;for(var _=o;i>=INT;)a[o++]=i&255|MSB$1,i/=128;for(;i&MSBALL;)a[o++]=i&255|MSB$1,i>>>=7;return a[o]=i|0,encode.bytes=o-_+1,a}var decode=read,MSB=128,REST=127;function read(i,_){var o=0,_=_||0,et=0,rt=_,ot,ft=i.length;do{if(rt>=ft||et>49)throw read.bytes=0,new RangeError("Could not decode varint");ot=i[rt++],o+=et<28?(ot&REST)<<et:(ot&REST)*Math.pow(2,et),et+=7}while(ot>=MSB);return read.bytes=rt-_,o}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length$1=function(i){return i<N1?1:i<N2?2:i<N3?3:i<N4?4:i<N5?5:i<N6?6:i<N7?7:i<N8?8:i<N9?9:10},varint={encode:encode_1,decode,encodingLength:length$1};const varint$1=getDefaultExportFromCjs(varint);class Parser{constructor(){En(this,"index",0);En(this,"input","")}new(a){return this.index=0,this.input=a,this}readAtomically(a){const o=this.index,_=a();return _===void 0&&(this.index=o),_}parseWith(a){const o=a();if(this.index===this.input.length)return o}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(a){return this.readAtomically(()=>{const o=this.readChar();if(o===a)return o})}readSeparator(a,o,_){return this.readAtomically(()=>{if(!(o>0&&this.readGivenChar(a)===void 0))return _()})}readNumber(a,o,_,et){return this.readAtomically(()=>{let rt=0,ot=0;const ft=this.peekChar();if(ft===void 0)return;const lt=ft==="0",ht=2**(8*et)-1;for(;;){const vt=this.readAtomically(()=>{const It=this.readChar();if(It===void 0)return;const Qt=Number.parseInt(It,a);if(!Number.isNaN(Qt))return Qt});if(vt===void 0)break;if(rt*=a,rt+=vt,rt>ht||(ot+=1,o!==void 0&&ot>o))return}if(ot!==0)return!_&<&&ot>1?void 0:rt})}readIPv4Addr(){return this.readAtomically(()=>{const a=new Uint8Array(4);for(let o=0;o<a.length;o++){const _=this.readSeparator(".",o,()=>this.readNumber(10,3,!1,1));if(_===void 0)return;a[o]=_}return a})}readIPv6Addr(){const a=o=>{for(let _=0;_<o.length/2;_++){const et=_*2;if(_<o.length-3){const ot=this.readSeparator(":",_,()=>this.readIPv4Addr());if(ot!==void 0)return o[et]=ot[0],o[et+1]=ot[1],o[et+2]=ot[2],o[et+3]=ot[3],[et+4,!0]}const rt=this.readSeparator(":",_,()=>this.readNumber(16,4,!0,2));if(rt===void 0)return[et,!1];o[et]=rt>>8,o[et+1]=rt&255}return[o.length,!1]};return this.readAtomically(()=>{const o=new Uint8Array(16),[_,et]=a(o);if(_===16)return o;if(et||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const rt=new Uint8Array(14),ot=16-(_+2),[ft]=a(rt.subarray(0,ot));return o.set(rt.subarray(0,ft),16-ft),o})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const MAX_IPV6_LENGTH=45,MAX_IPV4_LENGTH=15,parser=new Parser;function parseIPv4(i){if(!(i.length>MAX_IPV4_LENGTH))return parser.new(i).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(i){if(!(i.length>MAX_IPV6_LENGTH))return parser.new(i).parseWith(()=>parser.readIPv6Addr())}function parseIP(i){if(!(i.length>MAX_IPV6_LENGTH))return parser.new(i).parseWith(()=>parser.readIPAddr())}function isIPv4(i){return!!parseIPv4(i)}function isIPv6(i){return!!parseIPv6(i)}function isIP(i){return!!parseIP(i)}const isV4=isIPv4,isV6=isIPv6,toBytes=function(i){let a=0;if(i=i.toString().trim(),isV4(i)){const o=new Uint8Array(a+4);return i.split(/\./g).forEach(_=>{o[a++]=parseInt(_,10)&255}),o}if(isV6(i)){const o=i.split(":",8);let _;for(_=0;_<o.length;_++){const rt=isV4(o[_]);let ot;rt&&(ot=toBytes(o[_]),o[_]=toString$1(ot.slice(0,2),"base16")),ot!=null&&++_<8&&o.splice(_,0,toString$1(ot.slice(2,4),"base16"))}if(o[0]==="")for(;o.length<8;)o.unshift("0");else if(o[o.length-1]==="")for(;o.length<8;)o.push("0");else if(o.length<8){for(_=0;_<o.length&&o[_]!=="";_++);const rt=[_,1];for(_=9-o.length;_>0;_--)rt.push("0");o.splice.apply(o,rt)}const et=new Uint8Array(a+16);for(_=0;_<o.length;_++){const rt=parseInt(o[_],16);et[a++]=rt>>8&255,et[a++]=rt&255}return et}throw new Error("invalid ip address")},toString=function(i,a=0,o){a=~~a,o=o??i.length-a;const _=new DataView(i.buffer);if(o===4){const et=[];for(let rt=0;rt<o;rt++)et.push(i[a+rt]);return et.join(".")}if(o===16){const et=[];for(let rt=0;rt<o;rt+=2)et.push(_.getUint16(a+rt).toString(16));return et.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},V=-1,names={},codes={},table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,V,"ip6zone"],[43,8,"ipcidr"],[53,V,"dns",!0],[54,V,"dns4",!0],[55,V,"dns6",!0],[56,V,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,V,"unix",!1,!0],[421,V,"ipfs"],[421,V,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,V,"garlic64"],[448,0,"tls"],[449,V,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,V,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,V,"memory"]];table.forEach(i=>{const a=createProtocol(...i);codes[a.code]=a,names[a.name]=a});function createProtocol(i,a,o,_,et){return{code:i,size:a,name:o,resolvable:!!_,path:!!et}}function getProtocol(i){if(typeof i=="number"){if(codes[i]!=null)return codes[i];throw new Error(`no protocol with code: ${i}`)}else if(typeof i=="string"){if(names[i]!=null)return names[i];throw new Error(`no protocol with name: ${i}`)}throw new Error(`invalid protocol id type: ${typeof i}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(i,a){switch(getProtocol(i).code){case 4:case 41:return bytes2ip(a);case 42:return bytes2str(a);case 6:case 273:case 33:case 132:return bytes2port(a).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(a);case 421:return bytes2mh(a);case 444:return bytes2onion(a);case 445:return bytes2onion(a);case 466:return bytes2mb(a);default:return toString$1(a,"base16")}}function convertToBytes(i,a){switch(getProtocol(i).code){case 4:return ip2bytes(a);case 41:return ip2bytes(a);case 42:return str2bytes(a);case 6:case 273:case 33:case 132:return port2bytes(parseInt(a,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(a);case 421:return mh2bytes(a);case 444:return onion2bytes(a);case 445:return onion32bytes(a);case 466:return mb2bytes(a);default:return fromString$1(a,"base16")}}const decoders=Object.values(bases).map(i=>i.decoder),anybaseDecoder=function(){let i=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(a=>i=i.or(a)),i}();function ip2bytes(i){if(!isIP(i))throw new Error("invalid ip address");return toBytes(i)}function bytes2ip(i){const a=toString(i,0,i.length);if(a==null)throw new Error("ipBuff is required");if(!isIP(a))throw new Error("invalid ip address");return a}function port2bytes(i){const a=new ArrayBuffer(2);return new DataView(a).setUint16(0,i),new Uint8Array(a)}function bytes2port(i){return new DataView(i.buffer).getUint16(i.byteOffset)}function str2bytes(i){const a=fromString$1(i),o=Uint8Array.from(varint$1.encode(a.length));return concat$1([o,a],o.length+a.length)}function bytes2str(i){const a=varint$1.decode(i);if(i=i.slice(varint$1.decode.bytes),i.length!==a)throw new Error("inconsistent lengths");return toString$1(i)}function mh2bytes(i){let a;i[0]==="Q"||i[0]==="1"?a=decode$1(base58btc.decode(`z${i}`)).bytes:a=CID.parse(i).multihash.bytes;const o=Uint8Array.from(varint$1.encode(a.length));return concat$1([o,a],o.length+a.length)}function mb2bytes(i){const a=anybaseDecoder.decode(i),o=Uint8Array.from(varint$1.encode(a.length));return concat$1([o,a],o.length+a.length)}function bytes2mb(i){const a=varint$1.decode(i),o=i.slice(varint$1.decode.bytes);if(o.length!==a)throw new Error("inconsistent lengths");return"u"+toString$1(o,"base64url")}function bytes2mh(i){const a=varint$1.decode(i),o=i.slice(varint$1.decode.bytes);if(o.length!==a)throw new Error("inconsistent lengths");return toString$1(o,"base58btc")}function onion2bytes(i){const a=i.split(":");if(a.length!==2)throw new Error(`failed to parse onion addr: ["'${a.join('", "')}'"]' does not contain a port number`);if(a[0].length!==16)throw new Error(`failed to parse onion addr: ${a[0]} not a Tor onion address.`);const o=base32.decode("b"+a[0]),_=parseInt(a[1],10);if(_<1||_>65536)throw new Error("Port number is not in range(1, 65536)");const et=port2bytes(_);return concat$1([o,et],o.length+et.length)}function onion32bytes(i){const a=i.split(":");if(a.length!==2)throw new Error(`failed to parse onion addr: ["'${a.join('", "')}'"]' does not contain a port number`);if(a[0].length!==56)throw new Error(`failed to parse onion addr: ${a[0]} not a Tor onion3 address.`);const o=base32.decode(`b${a[0]}`),_=parseInt(a[1],10);if(_<1||_>65536)throw new Error("Port number is not in range(1, 65536)");const et=port2bytes(_);return concat$1([o,et],o.length+et.length)}function bytes2onion(i){const a=i.slice(0,i.length-2),o=i.slice(i.length-2),_=toString$1(a,"base32"),et=bytes2port(o);return`${_}:${et}`}function stringToStringTuples(i){const a=[],o=i.split("/").slice(1);if(o.length===1&&o[0]==="")return[];for(let _=0;_<o.length;_++){const et=o[_],rt=getProtocol(et);if(rt.size===0){a.push([et]);continue}if(_++,_>=o.length)throw ParseError("invalid address: "+i);if(rt.path===!0){a.push([et,cleanPath(o.slice(_).join("/"))]);break}a.push([et,o[_]])}return a}function stringTuplesToString(i){const a=[];return i.map(o=>{const _=protoFromTuple(o);return a.push(_.name),o.length>1&&o[1]!=null&&a.push(o[1]),null}),cleanPath(a.join("/"))}function stringTuplesToTuples(i){return i.map(a=>{Array.isArray(a)||(a=[a]);const o=protoFromTuple(a);return a.length>1?[o.code,convertToBytes(o.code,a[1])]:[o.code]})}function tuplesToStringTuples(i){return i.map(a=>{const o=protoFromTuple(a);return a[1]!=null?[o.code,convertToString(o.code,a[1])]:[o.code]})}function tuplesToBytes(i){return fromBytes(concat$1(i.map(a=>{const o=protoFromTuple(a);let _=Uint8Array.from(varint$1.encode(o.code));return a.length>1&&a[1]!=null&&(_=concat$1([_,a[1]])),_})))}function sizeForAddr(i,a){return i.size>0?i.size/8:i.size===0?0:varint$1.decode(a)+(varint$1.decode.bytes??0)}function bytesToTuples(i){const a=[];let o=0;for(;o<i.length;){const _=varint$1.decode(i,o),et=varint$1.decode.bytes??0,rt=getProtocol(_),ot=sizeForAddr(rt,i.slice(o+et));if(ot===0){a.push([_]),o+=et;continue}const ft=i.slice(o+et,o+et+ot);if(o+=ot+et,o>i.length)throw ParseError("Invalid address Uint8Array: "+toString$1(i,"base16"));a.push([_,ft])}return a}function bytesToString(i){const a=bytesToTuples(i),o=tuplesToStringTuples(a);return stringTuplesToString(o)}function stringToBytes(i){i=cleanPath(i);const a=stringToStringTuples(i),o=stringTuplesToTuples(a);return tuplesToBytes(o)}function fromString(i){return stringToBytes(i)}function fromBytes(i){const a=validateBytes(i);if(a!=null)throw a;return Uint8Array.from(i)}function validateBytes(i){try{bytesToTuples(i)}catch(a){return a}}function cleanPath(i){return"/"+i.trim().split("/").filter(a=>a).join("/")}function ParseError(i){return new Error("Error parsing address: "+i)}function protoFromTuple(i){return getProtocol(i[0])}const inspect=Symbol.for("nodejs.util.inspect.custom"),DNS_CODES=[getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code],resolvers=new Map,symbol=Symbol.for("@multiformats/js-multiaddr/multiaddr");function isMultiaddr(i){return!!(i!=null&&i[symbol])}var ys,vs,ms,Ko,xA;const ns=class{constructor(a){En(this,"bytes");ps(this,ys,void 0);ps(this,vs,void 0);ps(this,ms,void 0);ps(this,Ko,void 0);En(this,xA,!0);if(a==null&&(a=""),a instanceof Uint8Array)this.bytes=fromBytes(a);else if(typeof a=="string"){if(a.length>0&&a.charAt(0)!=="/")throw new Error(`multiaddr "${a}" must start with a "/"`);this.bytes=fromString(a)}else if(isMultiaddr(a))this.bytes=fromBytes(a.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return fo(this,ys)==null&&rs(this,ys,bytesToString(this.bytes)),fo(this,ys)}toJSON(){return this.toString()}toOptions(){let a,o,_,et,rt="";const ot=getProtocol("tcp"),ft=getProtocol("udp"),lt=getProtocol("ip4"),ht=getProtocol("ip6"),vt=getProtocol("dns6"),It=getProtocol("ip6zone");for(const[mt,Yt]of this.stringTuples())mt===It.code&&(rt=`%${Yt??""}`),DNS_CODES.includes(mt)&&(o=ot.name,et=443,_=`${Yt??""}${rt}`,a=mt===vt.code?6:4),(mt===ot.code||mt===ft.code)&&(o=getProtocol(mt).name,et=parseInt(Yt??"")),(mt===lt.code||mt===ht.code)&&(o=getProtocol(mt).name,_=`${Yt??""}${rt}`,a=mt===ht.code?6:4);if(a==null||o==null||_==null||et==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:a,host:_,transport:o,port:et}}protos(){return this.protoCodes().map(a=>Object.assign({},getProtocol(a)))}protoCodes(){const a=[],o=this.bytes;let _=0;for(;_<o.length;){const et=varint$1.decode(o,_),rt=varint$1.decode.bytes??0,ot=getProtocol(et),ft=sizeForAddr(ot,o.slice(_+rt));_+=ft+rt,a.push(et)}return a}protoNames(){return this.protos().map(a=>a.name)}tuples(){return fo(this,vs)==null&&rs(this,vs,bytesToTuples(this.bytes)),fo(this,vs)}stringTuples(){return fo(this,ms)==null&&rs(this,ms,tuplesToStringTuples(this.tuples())),fo(this,ms)}encapsulate(a){return a=new ns(a),new ns(this.toString()+a.toString())}decapsulate(a){const o=a.toString(),_=this.toString(),et=_.lastIndexOf(o);if(et<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${a.toString()}`);return new ns(_.slice(0,et))}decapsulateCode(a){const o=this.tuples();for(let _=o.length-1;_>=0;_--)if(o[_][0]===a)return new ns(tuplesToBytes(o.slice(0,_)));return this}getPeerId(){try{const o=this.stringTuples().filter(_=>_[0]===names.ipfs.code).pop();if((o==null?void 0:o[1])!=null){const _=o[1];return _[0]==="Q"||_[0]==="1"?toString$1(base58btc.decode(`z${_}`),"base58btc"):toString$1(CID.parse(_).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(fo(this,Ko)===void 0)try{rs(this,Ko,this.stringTuples().filter(a=>getProtocol(a[0]).path===!0)[0][1]),fo(this,Ko)==null&&rs(this,Ko,null)}catch{rs(this,Ko,null)}return fo(this,Ko)}equals(a){return equals$3(this.bytes,a.bytes)}async resolve(a){const o=this.protos().find(rt=>rt.resolvable);if(o==null)return[this];const _=resolvers.get(o.name);if(_==null)throw new CodeError(`no available resolver for ${o.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await _(this,a)).map(rt=>new ns(rt))}nodeAddress(){const a=this.toOptions();if(a.transport!=="tcp"&&a.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${a.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:a.family,address:a.host,port:a.port}}isThinWaistAddress(a){const o=(a??this).protos();return!(o.length!==2||o[0].code!==4&&o[0].code!==41||o[1].code!==6&&o[1].code!==273)}[(xA=symbol,inspect)](){return`Multiaddr(${bytesToString(this.bytes)})`}};let DefaultMultiaddr=ns;ys=new WeakMap,vs=new WeakMap,ms=new WeakMap,Ko=new WeakMap;function multiaddr(i){return new DefaultMultiaddr(i)}const getConfigDir=async()=>{const i=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0),a=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0);return i.join(a.homedir(),".peerbit")},getCredentialsPath=async i=>(await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0)).join(i,"credentials");class NotFoundError extends Error{}const SSL_PORT=9002,LOCAL_PORT=8082,getPort=i=>{if(i==="https:")return SSL_PORT;if(i==="http:")return LOCAL_PORT;throw new Error("Unsupported protocol: "+i)},PEER_ID_PATH="/peer/id",ADDRESS_PATH="/peer/address",PROGRAM_PATH="/program",LIBRARY_PATH="/library",checkExistPath=async i=>{const a=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0);try{return a.existsSync(i)?!0:(a.accessSync(i,a.constants.W_OK),!1)}catch(o){if(o.message.indexOf("no such file"))return!1;throw new Error("Can not access path")}},loadPassword=async()=>{const i=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0),a=await getConfigDir(),o=await getCredentialsPath(a);if(!await checkExistPath(o))throw new NotFoundError("Credentials file does not exist");const _=JSON.parse(i.readFileSync(o,"utf-8")).password;if(!_||_.length===0)throw new NotFoundError("Password not found");return _},client=async(i="http://localhost:"+LOCAL_PORT)=>{const{default:a}=await __vitePreload(()=>import("./index-bd766cd9.js"),[]),o=ft=>ft>=200&&ft<300||ft==404,_=ft=>{if(ft.status!==200)throw new Error(ft.data);return ft},et=ft=>{if(ft.status!==404){if(ft.status==200)return ft.data;throw new Error(typeof ft.data=="string"?ft.data:ft.data.toString())}},rt=async()=>_(await a.get(i+PEER_ID_PATH,{validateStatus:o})).data,ot=async()=>({authorization:"Basic admin:"+await loadPassword()});return{peer:{id:{get:rt},addresses:{get:async()=>_(await a.get(i+ADDRESS_PATH,{validateStatus:o,headers:await ot()})).data.map(ft=>multiaddr(ft))}},program:{get:async ft=>{const lt=et(await a.get(i+PROGRAM_PATH+"/"+encodeURIComponent(ft.toString()),{validateStatus:o,headers:await ot()}));return lt?deserialize(fromBase64(lt),Program):void 0},put:async ft=>{const lt=ft instanceof Program?toBase64(serialize$2(ft)):ft;return _(await a.put(i+PROGRAM_PATH,lt,{validateStatus:o,headers:await ot()})).data}},library:{put:async ft=>{_(await a.put(i+LIBRARY_PATH,ft,{validateStatus:o,headers:await ot()}))}}}},common={black:"#000",white:"#fff"},common$1=common,red={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},red$1=red,purple={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},purple$1=purple,blue={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},blue$1=blue,lightBlue={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},lightBlue$1=lightBlue,green={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},green$1=green,orange={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},orange$1=orange,grey={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},grey$1=grey;function _extends(){return _extends=Object.assign?Object.assign.bind():function(i){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var _ in o)Object.prototype.hasOwnProperty.call(o,_)&&(i[_]=o[_])}return i},_extends.apply(this,arguments)}function isPlainObject(i){return i!==null&&typeof i=="object"&&i.constructor===Object}function deepClone(i){if(!isPlainObject(i))return i;const a={};return Object.keys(i).forEach(o=>{a[o]=deepClone(i[o])}),a}function deepmerge(i,a,o={clone:!0}){const _=o.clone?_extends({},i):i;return isPlainObject(i)&&isPlainObject(a)&&Object.keys(a).forEach(et=>{et!=="__proto__"&&(isPlainObject(a[et])&&et in i&&isPlainObject(i[et])?_[et]=deepmerge(i[et],a[et],o):o.clone?_[et]=isPlainObject(a[et])?deepClone(a[et]):a[et]:_[et]=a[et])}),_}function formatMuiErrorMessage(i){let a="https://mui.com/production-error/?code="+i;for(let o=1;o<arguments.length;o+=1)a+="&args[]="+encodeURIComponent(arguments[o]);return"Minified MUI error #"+i+"; visit "+a+" for the full message."}function capitalize(i){if(typeof i!="string")throw new Error(formatMuiErrorMessage(7));return i.charAt(0).toUpperCase()+i.slice(1)}function resolveProps(i,a){const o=_extends({},a);return Object.keys(i).forEach(_=>{if(_.toString().match(/^(components|slots)$/))o[_]=_extends({},i[_],o[_]);else if(_.toString().match(/^(componentsProps|slotProps)$/)){const et=i[_]||{},rt=a[_];o[_]={},!rt||!Object.keys(rt)?o[_]=et:!et||!Object.keys(et)?o[_]=rt:(o[_]=_extends({},rt),Object.keys(et).forEach(ot=>{o[_][ot]=resolveProps(et[ot],rt[ot])}))}else o[_]===void 0&&(o[_]=i[_])}),o}function composeClasses(i,a,o=void 0){const _={};return Object.keys(i).forEach(et=>{_[et]=i[et].reduce((rt,ot)=>{if(ot){const ft=a(ot);ft!==""&&rt.push(ft),o&&o[ot]&&rt.push(o[ot])}return rt},[]).join(" ")}),_}const defaultGenerator=i=>i,createClassNameGenerator=()=>{let i=defaultGenerator;return{configure(a){i=a},generate(a){return i(a)},reset(){i=defaultGenerator}}},ClassNameGenerator=createClassNameGenerator(),ClassNameGenerator$1=ClassNameGenerator,globalStateClassesMapping={active:"active",checked:"checked",completed:"completed",disabled:"disabled",readOnly:"readOnly",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",required:"required",selected:"selected"};function generateUtilityClass(i,a,o="Mui"){const _=globalStateClassesMapping[a];return _?`${o}-${_}`:`${ClassNameGenerator$1.generate(i)}-${a}`}function generateUtilityClasses(i,a,o="Mui"){const _={};return a.forEach(et=>{_[et]=generateUtilityClass(i,et,o)}),_}const THEME_ID="$$material";function _objectWithoutPropertiesLoose(i,a){if(i==null)return{};var o={},_=Object.keys(i),et,rt;for(rt=0;rt<_.length;rt++)et=_[rt],!(a.indexOf(et)>=0)&&(o[et]=i[et]);return o}function memoize$1(i){var a=Object.create(null);return function(o){return a[o]===void 0&&(a[o]=i(o)),a[o]}}var reactPropsRegex=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,isPropValid=memoize$1(function(i){return reactPropsRegex.test(i)||i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)<91});function sheetForTag(i){if(i.sheet)return i.sheet;for(var a=0;a<document.styleSheets.length;a++)if(document.styleSheets[a].ownerNode===i)return document.styleSheets[a]}function createStyleElement(i){var a=document.createElement("style");return a.setAttribute("data-emotion",i.key),i.nonce!==void 0&&a.setAttribute("nonce",i.nonce),a.appendChild(document.createTextNode("")),a.setAttribute("data-s",""),a}var StyleSheet=function(){function i(o){var _=this;this._insertTag=function(et){var rt;_.tags.length===0?_.insertionPoint?rt=_.insertionPoint.nextSibling:_.prepend?rt=_.container.firstChild:rt=_.before:rt=_.tags[_.tags.length-1].nextSibling,_.container.insertBefore(et,rt),_.tags.push(et)},this.isSpeedy=o.speedy===void 0?!0:o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var a=i.prototype;return a.hydrate=function(_){_.forEach(this._insertTag)},a.insert=function(_){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(createStyleElement(this));var et=this.tags[this.tags.length-1];if(this.isSpeedy){var rt=sheetForTag(et);try{rt.insertRule(_,rt.cssRules.length)}catch{}}else et.appendChild(document.createTextNode(_));this.ctr++},a.flush=function(){this.tags.forEach(function(_){return _.parentNode&&_.parentNode.removeChild(_)}),this.tags=[],this.ctr=0},i}(),MS="-ms-",MOZ="-moz-",WEBKIT="-webkit-",COMMENT="comm",RULESET="rule",DECLARATION="decl",IMPORT="@import",KEYFRAMES="@keyframes",LAYER="@layer",abs=Math.abs,from=String.fromCharCode,assign=Object.assign;function hash(i,a){return charat(i,0)^45?(((a<<2^charat(i,0))<<2^charat(i,1))<<2^charat(i,2))<<2^charat(i,3):0}function trim(i){return i.trim()}function match(i,a){return(i=a.exec(i))?i[0]:i}function replace(i,a,o){return i.replace(a,o)}function indexof(i,a){return i.indexOf(a)}function charat(i,a){return i.charCodeAt(a)|0}function substr(i,a,o){return i.slice(a,o)}function strlen(i){return i.length}function sizeof(i){return i.length}function append(i,a){return a.push(i),i}function combine(i,a){return i.map(a).join("")}var line=1,column=1,length=0,position=0,character=0,characters="";function node(i,a,o,_,et,rt,ot){return{value:i,root:a,parent:o,type:_,props:et,children:rt,line,column,length:ot,return:""}}function copy(i,a){return assign(node("",null,null,"",null,null,0),i,{length:-i.length},a)}function char(){return character}function prev(){return character=position>0?charat(characters,--position):0,column--,character===10&&(column=1,line--),character}function next(){return character=position<length?charat(characters,position++):0,column++,character===10&&(column=1,line++),character}function peek(){return charat(characters,position)}function caret(){return position}function slice(i,a){return substr(characters,i,a)}function token(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function alloc(i){return line=column=1,length=strlen(characters=i),position=0,[]}function dealloc(i){return characters="",i}function delimit(i){return trim(slice(position-1,delimiter(i===91?i+2:i===40?i+1:i)))}function whitespace(i){for(;(character=peek())&&character<33;)next();return token(i)>2||token(character)>3?"":" "}function escaping(i,a){for(;--a&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice(i,caret()+(a<6&&peek()==32&&next()==32))}function delimiter(i){for(;next();)switch(character){case i:return position;case 34:case 39:i!==34&&i!==39&&delimiter(character);break;case 40:i===41&&delimiter(i);break;case 92:next();break}return position}function commenter(i,a){for(;next()&&i+character!==47+10;)if(i+character===42+42&&peek()===47)break;return"/*"+slice(a,position-1)+"*"+from(i===47?i:next())}function identifier(i){for(;!token(peek());)next();return slice(i,position)}function compile(i){return dealloc(parse("",null,null,null,[""],i=alloc(i),0,[0],i))}function parse(i,a,o,_,et,rt,ot,ft,lt){for(var ht=0,vt=0,It=ot,Qt=0,mt=0,Yt=0,Rt=1,cr=1,Ut=1,zt=0,Gt="",Dr=et,lr=rt,xr=_,hr=Gt;cr;)switch(Yt=zt,zt=next()){case 40:if(Yt!=108&&charat(hr,It-1)==58){indexof(hr+=replace(delimit(zt),"&","&\f"),"&\f")!=-1&&(Ut=-1);break}case 34:case 39:case 91:hr+=delimit(zt);break;case 9:case 10:case 13:case 32:hr+=whitespace(Yt);break;case 92:hr+=escaping(caret()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next(),caret()),a,o),lt);break;default:hr+="/"}break;case 123*Rt:ft[ht++]=strlen(hr)*Ut;case 125*Rt:case 59:case 0:switch(zt){case 0:case 125:cr=0;case 59+vt:Ut==-1&&(hr=replace(hr,/\f/g,"")),mt>0&&strlen(hr)-It&&append(mt>32?declaration(hr+";",_,o,It-1):declaration(replace(hr," ","")+";",_,o,It-2),lt);break;case 59:hr+=";";default:if(append(xr=ruleset(hr,a,o,ht,vt,et,ft,Gt,Dr=[],lr=[],It),rt),zt===123)if(vt===0)parse(hr,a,xr,xr,Dr,rt,It,ft,lr);else switch(Qt===99&&charat(hr,3)===110?100:Qt){case 100:case 108:case 109:case 115:parse(i,xr,xr,_&&append(ruleset(i,xr,xr,0,0,et,ft,Gt,et,Dr=[],It),lr),et,lr,It,ft,_?Dr:lr);break;default:parse(hr,xr,xr,xr,[""],lr,0,ft,lr)}}ht=vt=mt=0,Rt=Ut=1,Gt=hr="",It=ot;break;case 58:It=1+strlen(hr),mt=Yt;default:if(Rt<1){if(zt==123)--Rt;else if(zt==125&&Rt++==0&&prev()==125)continue}switch(hr+=from(zt),zt*Rt){case 38:Ut=vt>0?1:(hr+="\f",-1);break;case 44:ft[ht++]=(strlen(hr)-1)*Ut,Ut=1;break;case 64:peek()===45&&(hr+=delimit(next())),Qt=peek(),vt=It=strlen(Gt=hr+=identifier(caret())),zt++;break;case 45:Yt===45&&strlen(hr)==2&&(Rt=0)}}return rt}function ruleset(i,a,o,_,et,rt,ot,ft,lt,ht,vt){for(var It=et-1,Qt=et===0?rt:[""],mt=sizeof(Qt),Yt=0,Rt=0,cr=0;Yt<_;++Yt)for(var Ut=0,zt=substr(i,It+1,It=abs(Rt=ot[Yt])),Gt=i;Ut<mt;++Ut)(Gt=trim(Rt>0?Qt[Ut]+" "+zt:replace(zt,/&\f/g,Qt[Ut])))&&(lt[cr++]=Gt);return node(i,a,o,et===0?RULESET:ft,lt,ht,vt)}function comment(i,a,o){return node(i,a,o,COMMENT,from(char()),substr(i,2,-2),0)}function declaration(i,a,o,_){return node(i,a,o,DECLARATION,substr(i,0,_),substr(i,_+1,-1),_)}function serialize(i,a){for(var o="",_=sizeof(i),et=0;et<_;et++)o+=a(i[et],et,i,a)||"";return o}function stringify(i,a,o,_){switch(i.type){case LAYER:if(i.children.length)break;case IMPORT:case DECLARATION:return i.return=i.return||i.value;case COMMENT:return"";case KEYFRAMES:return i.return=i.value+"{"+serialize(i.children,_)+"}";case RULESET:i.value=i.props.join(",")}return strlen(o=serialize(i.children,_))?i.return=i.value+"{"+o+"}":""}function middleware(i){var a=sizeof(i);return function(o,_,et,rt){for(var ot="",ft=0;ft<a;ft++)ot+=i[ft](o,_,et,rt)||"";return ot}}function rulesheet(i){return function(a){a.root||(a=a.return)&&i(a)}}var identifierWithPointTracking=function i(a,o,_){for(var et=0,rt=0;et=rt,rt=peek(),et===38&&rt===12&&(o[_]=1),!token(rt);)next();return slice(a,position)},toRules=function i(a,o){var _=-1,et=44;do switch(token(et)){case 0:et===38&&peek()===12&&(o[_]=1),a[_]+=identifierWithPointTracking(position-1,o,_);break;case 2:a[_]+=delimit(et);break;case 4:if(et===44){a[++_]=peek()===58?"&\f":"",o[_]=a[_].length;break}default:a[_]+=from(et)}while(et=next());return a},getRules=function i(a,o){return dealloc(toRules(alloc(a),o))},fixedElements=new WeakMap,compat=function i(a){if(!(a.type!=="rule"||!a.parent||a.length<1)){for(var o=a.value,_=a.parent,et=a.column===_.column&&a.line===_.line;_.type!=="rule";)if(_=_.parent,!_)return;if(!(a.props.length===1&&o.charCodeAt(0)!==58&&!fixedElements.get(_))&&!et){fixedElements.set(a,!0);for(var rt=[],ot=getRules(o,rt),ft=_.props,lt=0,ht=0;lt<ot.length;lt++)for(var vt=0;vt<ft.length;vt++,ht++)a.props[ht]=rt[lt]?ot[lt].replace(/&\f/g,ft[vt]):ft[vt]+" "+ot[lt]}}},removeLabel=function i(a){if(a.type==="decl"){var o=a.value;o.charCodeAt(0)===108&&o.charCodeAt(2)===98&&(a.return="",a.value="")}};function prefix(i,a){switch(hash(i,a)){case 5103:return WEBKIT+"print-"+i+i;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return WEBKIT+i+i;case 5349:case 4246:case 4810:case 6968:case 2756:return WEBKIT+i+MOZ+i+MS+i+i;case 6828:case 4268:return WEBKIT+i+MS+i+i;case 6165:return WEBKIT+i+MS+"flex-"+i+i;case 5187:return WEBKIT+i+replace(i,/(\w+).+(:[^]+)/,WEBKIT+"box-$1$2"+MS+"flex-$1$2")+i;case 5443:return WEBKIT+i+MS+"flex-item-"+replace(i,/flex-|-self/,"")+i;case 4675:return WEBKIT+i+MS+"flex-line-pack"+replace(i,/align-content|flex-|-self/,"")+i;case 5548:return WEBKIT+i+MS+replace(i,"shrink","negative")+i;case 5292:return WEBKIT+i+MS+replace(i,"basis","preferred-size")+i;case 6060:return WEBKIT+"box-"+replace(i,"-grow","")+WEBKIT+i+MS+replace(i,"grow","positive")+i;case 4554:return WEBKIT+replace(i,/([^-])(transform)/g,"$1"+WEBKIT+"$2")+i;case 6187:return replace(replace(replace(i,/(zoom-|grab)/,WEBKIT+"$1"),/(image-set)/,WEBKIT+"$1"),i,"")+i;case 5495:case 3959:return replace(i,/(image-set\([^]*)/,WEBKIT+"$1$`$1");case 4968:return replace(replace(i,/(.+:)(flex-)?(.*)/,WEBKIT+"box-pack:$3"+MS+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+WEBKIT+i+i;case 4095:case 3583:case 4068:case 2532:return replace(i,/(.+)-inline(.+)/,WEBKIT+"$1$2")+i;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(strlen(i)-1-a>6)switch(charat(i,a+1)){case 109:if(charat(i,a+4)!==45)break;case 102:return replace(i,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(i,a+3)==108?"$3":"$2-$3"))+i;case 115:return~indexof(i,"stretch")?prefix(replace(i,"stretch","fill-available"),a)+i:i}break;case 4949:if(charat(i,a+1)!==115)break;case 6444:switch(charat(i,strlen(i)-3-(~indexof(i,"!important")&&10))){case 107:return replace(i,":",":"+WEBKIT)+i;case 101:return replace(i,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(i,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+i}break;case 5936:switch(charat(i,a+11)){case 114:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"lr")+i}return WEBKIT+i+MS+i+i}return i}var prefixer=function i(a,o,_,et){if(a.length>-1&&!a.return)switch(a.type){case DECLARATION:a.return=prefix(a.value,a.length);break;case KEYFRAMES:return serialize([copy(a,{value:replace(a.value,"@","@"+WEBKIT)})],et);case RULESET:if(a.length)return combine(a.props,function(rt){switch(match(rt,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(a,{props:[replace(rt,/:(read-\w+)/,":"+MOZ+"$1")]})],et);case"::placeholder":return serialize([copy(a,{props:[replace(rt,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy(a,{props:[replace(rt,/:(plac\w+)/,":"+MOZ+"$1")]}),copy(a,{props:[replace(rt,/:(plac\w+)/,MS+"input-$1")]})],et)}return""})}},defaultStylisPlugins=[prefixer],createCache=function i(a){var o=a.key;if(o==="css"){var _=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(_,function(Rt){var cr=Rt.getAttribute("data-emotion");cr.indexOf(" ")!==-1&&(document.head.appendChild(Rt),Rt.setAttribute("data-s",""))})}var et=a.stylisPlugins||defaultStylisPlugins,rt={},ot,ft=[];ot=a.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+o+' "]'),function(Rt){for(var cr=Rt.getAttribute("data-emotion").split(" "),Ut=1;Ut<cr.length;Ut++)rt[cr[Ut]]=!0;ft.push(Rt)});var lt,ht=[compat,removeLabel];{var vt,It=[stringify,rulesheet(function(Rt){vt.insert(Rt)})],Qt=middleware(ht.concat(et,It)),mt=function(cr){return serialize(compile(cr),Qt)};lt=function(cr,Ut,zt,Gt){vt=zt,mt(cr?cr+"{"+Ut.styles+"}":Ut.styles),Gt&&(Yt.inserted[Ut.name]=!0)}}var Yt={key:o,sheet:new StyleSheet({key:o,container:ot,nonce:a.nonce,speedy:a.speedy,prepend:a.prepend,insertionPoint:a.insertionPoint}),nonce:a.nonce,inserted:rt,registered:{},insert:lt};return Yt.sheet.hydrate(ft),Yt},reactIs$1={exports:{}},reactIs_production_min={};/** @license React v16.13.1
|
|
67
|
+
class ${this.constructor.name} { ...`);if(await this.save(o.services.blocks),getAllParentAddresses(this).includes(this.address))throw new Error("Subprogram has same address as some parent program. This is not currently supported");return super.beforeOpen(o,_)}static async open(o,_,et){const rt=await Program_1.load(o,_.services.blocks);if(!rt)throw new Error("Failed to load program");return await _.open(rt,et),rt}async save(o=this.node.services.blocks){const _=this._address,et=await o.put(serialize$2(this));if(this._address=et,!this.address)throw new Error("Unexpected");if(_&&_!==this.address)throw new Error("Program properties has been changed after constructor so that the hash has changed. Make sure that the 'setup(...)' function does not modify any properties that are to be serialized");return this._address}async delete(){if(this.address)return this.node.services.blocks.rm(this.address)}static async load(o,_,et){const rt=await _.get(o,et);if(!rt)return;const ot=deserialize(rt,Program_1);return ot.address=o,ot}async drop(){return await super.drop(),this.delete()}};Program=Program_1=__decorate([variant(0),__metadata("design:paramtypes",[])],Program);let ComposableProgram=class extends AbstractProgram{};ComposableProgram=__decorate([variant(1)],ComposableProgram);var encode_1=encode,MSB$1=128,REST$1=127,MSBALL=~REST$1,INT=Math.pow(2,31);function encode(i,a,o){if(Number.MAX_SAFE_INTEGER&&i>Number.MAX_SAFE_INTEGER)throw encode.bytes=0,new RangeError("Could not encode varint");a=a||[],o=o||0;for(var _=o;i>=INT;)a[o++]=i&255|MSB$1,i/=128;for(;i&MSBALL;)a[o++]=i&255|MSB$1,i>>>=7;return a[o]=i|0,encode.bytes=o-_+1,a}var decode=read,MSB=128,REST=127;function read(i,_){var o=0,_=_||0,et=0,rt=_,ot,ft=i.length;do{if(rt>=ft||et>49)throw read.bytes=0,new RangeError("Could not decode varint");ot=i[rt++],o+=et<28?(ot&REST)<<et:(ot&REST)*Math.pow(2,et),et+=7}while(ot>=MSB);return read.bytes=rt-_,o}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length$1=function(i){return i<N1?1:i<N2?2:i<N3?3:i<N4?4:i<N5?5:i<N6?6:i<N7?7:i<N8?8:i<N9?9:10},varint={encode:encode_1,decode,encodingLength:length$1};const varint$1=getDefaultExportFromCjs(varint);class Parser{constructor(){En(this,"index",0);En(this,"input","")}new(a){return this.index=0,this.input=a,this}readAtomically(a){const o=this.index,_=a();return _===void 0&&(this.index=o),_}parseWith(a){const o=a();if(this.index===this.input.length)return o}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(a){return this.readAtomically(()=>{const o=this.readChar();if(o===a)return o})}readSeparator(a,o,_){return this.readAtomically(()=>{if(!(o>0&&this.readGivenChar(a)===void 0))return _()})}readNumber(a,o,_,et){return this.readAtomically(()=>{let rt=0,ot=0;const ft=this.peekChar();if(ft===void 0)return;const lt=ft==="0",ht=2**(8*et)-1;for(;;){const vt=this.readAtomically(()=>{const It=this.readChar();if(It===void 0)return;const Qt=Number.parseInt(It,a);if(!Number.isNaN(Qt))return Qt});if(vt===void 0)break;if(rt*=a,rt+=vt,rt>ht||(ot+=1,o!==void 0&&ot>o))return}if(ot!==0)return!_&<&&ot>1?void 0:rt})}readIPv4Addr(){return this.readAtomically(()=>{const a=new Uint8Array(4);for(let o=0;o<a.length;o++){const _=this.readSeparator(".",o,()=>this.readNumber(10,3,!1,1));if(_===void 0)return;a[o]=_}return a})}readIPv6Addr(){const a=o=>{for(let _=0;_<o.length/2;_++){const et=_*2;if(_<o.length-3){const ot=this.readSeparator(":",_,()=>this.readIPv4Addr());if(ot!==void 0)return o[et]=ot[0],o[et+1]=ot[1],o[et+2]=ot[2],o[et+3]=ot[3],[et+4,!0]}const rt=this.readSeparator(":",_,()=>this.readNumber(16,4,!0,2));if(rt===void 0)return[et,!1];o[et]=rt>>8,o[et+1]=rt&255}return[o.length,!1]};return this.readAtomically(()=>{const o=new Uint8Array(16),[_,et]=a(o);if(_===16)return o;if(et||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const rt=new Uint8Array(14),ot=16-(_+2),[ft]=a(rt.subarray(0,ot));return o.set(rt.subarray(0,ft),16-ft),o})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const MAX_IPV6_LENGTH=45,MAX_IPV4_LENGTH=15,parser=new Parser;function parseIPv4(i){if(!(i.length>MAX_IPV4_LENGTH))return parser.new(i).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(i){if(!(i.length>MAX_IPV6_LENGTH))return parser.new(i).parseWith(()=>parser.readIPv6Addr())}function parseIP(i){if(!(i.length>MAX_IPV6_LENGTH))return parser.new(i).parseWith(()=>parser.readIPAddr())}function isIPv4(i){return!!parseIPv4(i)}function isIPv6(i){return!!parseIPv6(i)}function isIP(i){return!!parseIP(i)}const isV4=isIPv4,isV6=isIPv6,toBytes=function(i){let a=0;if(i=i.toString().trim(),isV4(i)){const o=new Uint8Array(a+4);return i.split(/\./g).forEach(_=>{o[a++]=parseInt(_,10)&255}),o}if(isV6(i)){const o=i.split(":",8);let _;for(_=0;_<o.length;_++){const rt=isV4(o[_]);let ot;rt&&(ot=toBytes(o[_]),o[_]=toString$1(ot.slice(0,2),"base16")),ot!=null&&++_<8&&o.splice(_,0,toString$1(ot.slice(2,4),"base16"))}if(o[0]==="")for(;o.length<8;)o.unshift("0");else if(o[o.length-1]==="")for(;o.length<8;)o.push("0");else if(o.length<8){for(_=0;_<o.length&&o[_]!=="";_++);const rt=[_,1];for(_=9-o.length;_>0;_--)rt.push("0");o.splice.apply(o,rt)}const et=new Uint8Array(a+16);for(_=0;_<o.length;_++){const rt=parseInt(o[_],16);et[a++]=rt>>8&255,et[a++]=rt&255}return et}throw new Error("invalid ip address")},toString=function(i,a=0,o){a=~~a,o=o??i.length-a;const _=new DataView(i.buffer);if(o===4){const et=[];for(let rt=0;rt<o;rt++)et.push(i[a+rt]);return et.join(".")}if(o===16){const et=[];for(let rt=0;rt<o;rt+=2)et.push(_.getUint16(a+rt).toString(16));return et.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""},V=-1,names={},codes={},table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,V,"ip6zone"],[43,8,"ipcidr"],[53,V,"dns",!0],[54,V,"dns4",!0],[55,V,"dns6",!0],[56,V,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,V,"unix",!1,!0],[421,V,"ipfs"],[421,V,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,V,"garlic64"],[448,0,"tls"],[449,V,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,V,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,V,"memory"]];table.forEach(i=>{const a=createProtocol(...i);codes[a.code]=a,names[a.name]=a});function createProtocol(i,a,o,_,et){return{code:i,size:a,name:o,resolvable:!!_,path:!!et}}function getProtocol(i){if(typeof i=="number"){if(codes[i]!=null)return codes[i];throw new Error(`no protocol with code: ${i}`)}else if(typeof i=="string"){if(names[i]!=null)return names[i];throw new Error(`no protocol with name: ${i}`)}throw new Error(`invalid protocol id type: ${typeof i}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(i,a){switch(getProtocol(i).code){case 4:case 41:return bytes2ip(a);case 42:return bytes2str(a);case 6:case 273:case 33:case 132:return bytes2port(a).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(a);case 421:return bytes2mh(a);case 444:return bytes2onion(a);case 445:return bytes2onion(a);case 466:return bytes2mb(a);default:return toString$1(a,"base16")}}function convertToBytes(i,a){switch(getProtocol(i).code){case 4:return ip2bytes(a);case 41:return ip2bytes(a);case 42:return str2bytes(a);case 6:case 273:case 33:case 132:return port2bytes(parseInt(a,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(a);case 421:return mh2bytes(a);case 444:return onion2bytes(a);case 445:return onion32bytes(a);case 466:return mb2bytes(a);default:return fromString$1(a,"base16")}}const decoders=Object.values(bases).map(i=>i.decoder),anybaseDecoder=function(){let i=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(a=>i=i.or(a)),i}();function ip2bytes(i){if(!isIP(i))throw new Error("invalid ip address");return toBytes(i)}function bytes2ip(i){const a=toString(i,0,i.length);if(a==null)throw new Error("ipBuff is required");if(!isIP(a))throw new Error("invalid ip address");return a}function port2bytes(i){const a=new ArrayBuffer(2);return new DataView(a).setUint16(0,i),new Uint8Array(a)}function bytes2port(i){return new DataView(i.buffer).getUint16(i.byteOffset)}function str2bytes(i){const a=fromString$1(i),o=Uint8Array.from(varint$1.encode(a.length));return concat$1([o,a],o.length+a.length)}function bytes2str(i){const a=varint$1.decode(i);if(i=i.slice(varint$1.decode.bytes),i.length!==a)throw new Error("inconsistent lengths");return toString$1(i)}function mh2bytes(i){let a;i[0]==="Q"||i[0]==="1"?a=decode$1(base58btc.decode(`z${i}`)).bytes:a=CID.parse(i).multihash.bytes;const o=Uint8Array.from(varint$1.encode(a.length));return concat$1([o,a],o.length+a.length)}function mb2bytes(i){const a=anybaseDecoder.decode(i),o=Uint8Array.from(varint$1.encode(a.length));return concat$1([o,a],o.length+a.length)}function bytes2mb(i){const a=varint$1.decode(i),o=i.slice(varint$1.decode.bytes);if(o.length!==a)throw new Error("inconsistent lengths");return"u"+toString$1(o,"base64url")}function bytes2mh(i){const a=varint$1.decode(i),o=i.slice(varint$1.decode.bytes);if(o.length!==a)throw new Error("inconsistent lengths");return toString$1(o,"base58btc")}function onion2bytes(i){const a=i.split(":");if(a.length!==2)throw new Error(`failed to parse onion addr: ["'${a.join('", "')}'"]' does not contain a port number`);if(a[0].length!==16)throw new Error(`failed to parse onion addr: ${a[0]} not a Tor onion address.`);const o=base32.decode("b"+a[0]),_=parseInt(a[1],10);if(_<1||_>65536)throw new Error("Port number is not in range(1, 65536)");const et=port2bytes(_);return concat$1([o,et],o.length+et.length)}function onion32bytes(i){const a=i.split(":");if(a.length!==2)throw new Error(`failed to parse onion addr: ["'${a.join('", "')}'"]' does not contain a port number`);if(a[0].length!==56)throw new Error(`failed to parse onion addr: ${a[0]} not a Tor onion3 address.`);const o=base32.decode(`b${a[0]}`),_=parseInt(a[1],10);if(_<1||_>65536)throw new Error("Port number is not in range(1, 65536)");const et=port2bytes(_);return concat$1([o,et],o.length+et.length)}function bytes2onion(i){const a=i.slice(0,i.length-2),o=i.slice(i.length-2),_=toString$1(a,"base32"),et=bytes2port(o);return`${_}:${et}`}function stringToStringTuples(i){const a=[],o=i.split("/").slice(1);if(o.length===1&&o[0]==="")return[];for(let _=0;_<o.length;_++){const et=o[_],rt=getProtocol(et);if(rt.size===0){a.push([et]);continue}if(_++,_>=o.length)throw ParseError("invalid address: "+i);if(rt.path===!0){a.push([et,cleanPath(o.slice(_).join("/"))]);break}a.push([et,o[_]])}return a}function stringTuplesToString(i){const a=[];return i.map(o=>{const _=protoFromTuple(o);return a.push(_.name),o.length>1&&o[1]!=null&&a.push(o[1]),null}),cleanPath(a.join("/"))}function stringTuplesToTuples(i){return i.map(a=>{Array.isArray(a)||(a=[a]);const o=protoFromTuple(a);return a.length>1?[o.code,convertToBytes(o.code,a[1])]:[o.code]})}function tuplesToStringTuples(i){return i.map(a=>{const o=protoFromTuple(a);return a[1]!=null?[o.code,convertToString(o.code,a[1])]:[o.code]})}function tuplesToBytes(i){return fromBytes(concat$1(i.map(a=>{const o=protoFromTuple(a);let _=Uint8Array.from(varint$1.encode(o.code));return a.length>1&&a[1]!=null&&(_=concat$1([_,a[1]])),_})))}function sizeForAddr(i,a){return i.size>0?i.size/8:i.size===0?0:varint$1.decode(a)+(varint$1.decode.bytes??0)}function bytesToTuples(i){const a=[];let o=0;for(;o<i.length;){const _=varint$1.decode(i,o),et=varint$1.decode.bytes??0,rt=getProtocol(_),ot=sizeForAddr(rt,i.slice(o+et));if(ot===0){a.push([_]),o+=et;continue}const ft=i.slice(o+et,o+et+ot);if(o+=ot+et,o>i.length)throw ParseError("Invalid address Uint8Array: "+toString$1(i,"base16"));a.push([_,ft])}return a}function bytesToString(i){const a=bytesToTuples(i),o=tuplesToStringTuples(a);return stringTuplesToString(o)}function stringToBytes(i){i=cleanPath(i);const a=stringToStringTuples(i),o=stringTuplesToTuples(a);return tuplesToBytes(o)}function fromString(i){return stringToBytes(i)}function fromBytes(i){const a=validateBytes(i);if(a!=null)throw a;return Uint8Array.from(i)}function validateBytes(i){try{bytesToTuples(i)}catch(a){return a}}function cleanPath(i){return"/"+i.trim().split("/").filter(a=>a).join("/")}function ParseError(i){return new Error("Error parsing address: "+i)}function protoFromTuple(i){return getProtocol(i[0])}const inspect=Symbol.for("nodejs.util.inspect.custom"),DNS_CODES=[getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code],resolvers=new Map,symbol=Symbol.for("@multiformats/js-multiaddr/multiaddr");function isMultiaddr(i){return!!(i!=null&&i[symbol])}var ys,vs,ms,Ko,xA;const ns=class{constructor(a){En(this,"bytes");ps(this,ys,void 0);ps(this,vs,void 0);ps(this,ms,void 0);ps(this,Ko,void 0);En(this,xA,!0);if(a==null&&(a=""),a instanceof Uint8Array)this.bytes=fromBytes(a);else if(typeof a=="string"){if(a.length>0&&a.charAt(0)!=="/")throw new Error(`multiaddr "${a}" must start with a "/"`);this.bytes=fromString(a)}else if(isMultiaddr(a))this.bytes=fromBytes(a.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr")}toString(){return fo(this,ys)==null&&rs(this,ys,bytesToString(this.bytes)),fo(this,ys)}toJSON(){return this.toString()}toOptions(){let a,o,_,et,rt="";const ot=getProtocol("tcp"),ft=getProtocol("udp"),lt=getProtocol("ip4"),ht=getProtocol("ip6"),vt=getProtocol("dns6"),It=getProtocol("ip6zone");for(const[mt,Yt]of this.stringTuples())mt===It.code&&(rt=`%${Yt??""}`),DNS_CODES.includes(mt)&&(o=ot.name,et=443,_=`${Yt??""}${rt}`,a=mt===vt.code?6:4),(mt===ot.code||mt===ft.code)&&(o=getProtocol(mt).name,et=parseInt(Yt??"")),(mt===lt.code||mt===ht.code)&&(o=getProtocol(mt).name,_=`${Yt??""}${rt}`,a=mt===ht.code?6:4);if(a==null||o==null||_==null||et==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:a,host:_,transport:o,port:et}}protos(){return this.protoCodes().map(a=>Object.assign({},getProtocol(a)))}protoCodes(){const a=[],o=this.bytes;let _=0;for(;_<o.length;){const et=varint$1.decode(o,_),rt=varint$1.decode.bytes??0,ot=getProtocol(et),ft=sizeForAddr(ot,o.slice(_+rt));_+=ft+rt,a.push(et)}return a}protoNames(){return this.protos().map(a=>a.name)}tuples(){return fo(this,vs)==null&&rs(this,vs,bytesToTuples(this.bytes)),fo(this,vs)}stringTuples(){return fo(this,ms)==null&&rs(this,ms,tuplesToStringTuples(this.tuples())),fo(this,ms)}encapsulate(a){return a=new ns(a),new ns(this.toString()+a.toString())}decapsulate(a){const o=a.toString(),_=this.toString(),et=_.lastIndexOf(o);if(et<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${a.toString()}`);return new ns(_.slice(0,et))}decapsulateCode(a){const o=this.tuples();for(let _=o.length-1;_>=0;_--)if(o[_][0]===a)return new ns(tuplesToBytes(o.slice(0,_)));return this}getPeerId(){try{const o=this.stringTuples().filter(_=>_[0]===names.ipfs.code).pop();if((o==null?void 0:o[1])!=null){const _=o[1];return _[0]==="Q"||_[0]==="1"?toString$1(base58btc.decode(`z${_}`),"base58btc"):toString$1(CID.parse(_).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){if(fo(this,Ko)===void 0)try{rs(this,Ko,this.stringTuples().filter(a=>getProtocol(a[0]).path===!0)[0][1]),fo(this,Ko)==null&&rs(this,Ko,null)}catch{rs(this,Ko,null)}return fo(this,Ko)}equals(a){return equals$3(this.bytes,a.bytes)}async resolve(a){const o=this.protos().find(rt=>rt.resolvable);if(o==null)return[this];const _=resolvers.get(o.name);if(_==null)throw new CodeError(`no available resolver for ${o.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await _(this,a)).map(rt=>new ns(rt))}nodeAddress(){const a=this.toOptions();if(a.transport!=="tcp"&&a.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${a.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:a.family,address:a.host,port:a.port}}isThinWaistAddress(a){const o=(a??this).protos();return!(o.length!==2||o[0].code!==4&&o[0].code!==41||o[1].code!==6&&o[1].code!==273)}[(xA=symbol,inspect)](){return`Multiaddr(${bytesToString(this.bytes)})`}};let DefaultMultiaddr=ns;ys=new WeakMap,vs=new WeakMap,ms=new WeakMap,Ko=new WeakMap;function multiaddr(i){return new DefaultMultiaddr(i)}const getConfigDir=async()=>{const i=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0),a=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0);return i.join(a.homedir(),".peerbit")},getCredentialsPath=async i=>(await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0)).join(i,"credentials");class NotFoundError extends Error{}var events={exports:{}},R=typeof Reflect=="object"?Reflect:null,ReflectApply=R&&typeof R.apply=="function"?R.apply:function i(a,o,_){return Function.prototype.apply.call(a,o,_)},ReflectOwnKeys;R&&typeof R.ownKeys=="function"?ReflectOwnKeys=R.ownKeys:Object.getOwnPropertySymbols?ReflectOwnKeys=function(a){return Object.getOwnPropertyNames(a).concat(Object.getOwnPropertySymbols(a))}:ReflectOwnKeys=function(a){return Object.getOwnPropertyNames(a)};function ProcessEmitWarning(i){console&&console.warn&&console.warn(i)}var NumberIsNaN=Number.isNaN||function i(a){return a!==a};function EventEmitter(){EventEmitter.init.call(this)}events.exports=EventEmitter;events.exports.once=once;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=void 0;EventEmitter.prototype._eventsCount=0;EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(i){if(typeof i!="number"||i<0||NumberIsNaN(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");defaultMaxListeners=i}});EventEmitter.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};EventEmitter.prototype.setMaxListeners=function i(a){if(typeof a!="number"||a<0||NumberIsNaN(a))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+a+".");return this._maxListeners=a,this};function _getMaxListeners(i){return i._maxListeners===void 0?EventEmitter.defaultMaxListeners:i._maxListeners}EventEmitter.prototype.getMaxListeners=function i(){return _getMaxListeners(this)};EventEmitter.prototype.emit=function i(a){for(var o=[],_=1;_<arguments.length;_++)o.push(arguments[_]);var et=a==="error",rt=this._events;if(rt!==void 0)et=et&&rt.error===void 0;else if(!et)return!1;if(et){var ot;if(o.length>0&&(ot=o[0]),ot instanceof Error)throw ot;var ft=new Error("Unhandled error."+(ot?" ("+ot.message+")":""));throw ft.context=ot,ft}var lt=rt[a];if(lt===void 0)return!1;if(typeof lt=="function")ReflectApply(lt,this,o);else for(var ht=lt.length,vt=arrayClone(lt,ht),_=0;_<ht;++_)ReflectApply(vt[_],this,o);return!0};function _addListener(i,a,o,_){var et,rt,ot;if(checkListener(o),rt=i._events,rt===void 0?(rt=i._events=Object.create(null),i._eventsCount=0):(rt.newListener!==void 0&&(i.emit("newListener",a,o.listener?o.listener:o),rt=i._events),ot=rt[a]),ot===void 0)ot=rt[a]=o,++i._eventsCount;else if(typeof ot=="function"?ot=rt[a]=_?[o,ot]:[ot,o]:_?ot.unshift(o):ot.push(o),et=_getMaxListeners(i),et>0&&ot.length>et&&!ot.warned){ot.warned=!0;var ft=new Error("Possible EventEmitter memory leak detected. "+ot.length+" "+String(a)+" listeners added. Use emitter.setMaxListeners() to increase limit");ft.name="MaxListenersExceededWarning",ft.emitter=i,ft.type=a,ft.count=ot.length,ProcessEmitWarning(ft)}return i}EventEmitter.prototype.addListener=function i(a,o){return _addListener(this,a,o,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function i(a,o){return _addListener(this,a,o,!0)};function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(i,a,o){var _={fired:!1,wrapFn:void 0,target:i,type:a,listener:o},et=onceWrapper.bind(_);return et.listener=o,_.wrapFn=et,et}EventEmitter.prototype.once=function i(a,o){return checkListener(o),this.on(a,_onceWrap(this,a,o)),this};EventEmitter.prototype.prependOnceListener=function i(a,o){return checkListener(o),this.prependListener(a,_onceWrap(this,a,o)),this};EventEmitter.prototype.removeListener=function i(a,o){var _,et,rt,ot,ft;if(checkListener(o),et=this._events,et===void 0)return this;if(_=et[a],_===void 0)return this;if(_===o||_.listener===o)--this._eventsCount===0?this._events=Object.create(null):(delete et[a],et.removeListener&&this.emit("removeListener",a,_.listener||o));else if(typeof _!="function"){for(rt=-1,ot=_.length-1;ot>=0;ot--)if(_[ot]===o||_[ot].listener===o){ft=_[ot].listener,rt=ot;break}if(rt<0)return this;rt===0?_.shift():spliceOne(_,rt),_.length===1&&(et[a]=_[0]),et.removeListener!==void 0&&this.emit("removeListener",a,ft||o)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function i(a){var o,_,et;if(_=this._events,_===void 0)return this;if(_.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):_[a]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete _[a]),this;if(arguments.length===0){var rt=Object.keys(_),ot;for(et=0;et<rt.length;++et)ot=rt[et],ot!=="removeListener"&&this.removeAllListeners(ot);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(o=_[a],typeof o=="function")this.removeListener(a,o);else if(o!==void 0)for(et=o.length-1;et>=0;et--)this.removeListener(a,o[et]);return this};function _listeners(i,a,o){var _=i._events;if(_===void 0)return[];var et=_[a];return et===void 0?[]:typeof et=="function"?o?[et.listener||et]:[et]:o?unwrapListeners(et):arrayClone(et,et.length)}EventEmitter.prototype.listeners=function i(a){return _listeners(this,a,!0)};EventEmitter.prototype.rawListeners=function i(a){return _listeners(this,a,!1)};EventEmitter.listenerCount=function(i,a){return typeof i.listenerCount=="function"?i.listenerCount(a):listenerCount.call(i,a)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(i){var a=this._events;if(a!==void 0){var o=a[i];if(typeof o=="function")return 1;if(o!==void 0)return o.length}return 0}EventEmitter.prototype.eventNames=function i(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(i,a){for(var o=new Array(a),_=0;_<a;++_)o[_]=i[_];return o}function spliceOne(i,a){for(;a+1<i.length;a++)i[a]=i[a+1];i.pop()}function unwrapListeners(i){for(var a=new Array(i.length),o=0;o<a.length;++o)a[o]=i[o].listener||i[o];return a}function once(i,a){return new Promise(function(o,_){function et(ot){i.removeListener(a,rt),_(ot)}function rt(){typeof i.removeListener=="function"&&i.removeListener("error",et),o([].slice.call(arguments))}eventTargetAgnosticAddListener(i,a,rt,{once:!0}),a!=="error"&&addErrorHandlerIfEventEmitter(i,et,{once:!0})})}function addErrorHandlerIfEventEmitter(i,a,o){typeof i.on=="function"&&eventTargetAgnosticAddListener(i,"error",a,o)}function eventTargetAgnosticAddListener(i,a,o,_){if(typeof i.on=="function")_.once?i.once(a,o):i.on(a,o);else if(typeof i.addEventListener=="function")i.addEventListener(a,function et(rt){_.once&&i.removeEventListener(a,et),o(rt)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}const SSL_PORT=9002,LOCAL_PORT=8082,getPort=i=>{if(i==="https:")return SSL_PORT;if(i==="http:")return LOCAL_PORT;throw new Error("Unsupported protocol: "+i)},PEER_ID_PATH="/peer/id",ADDRESS_PATH="/peer/address",PROGRAM_PATH="/program",LIBRARY_PATH="/library",checkExistPath=async i=>{const a=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0);try{return a.existsSync(i)?!0:(a.accessSync(i,a.constants.W_OK),!1)}catch(o){if(o.message.indexOf("no such file"))return!1;throw new Error("Can not access path")}},loadPassword=async()=>{const i=await __vitePreload(()=>Promise.resolve().then(()=>nodeCrypto),void 0),a=await getConfigDir(),o=await getCredentialsPath(a);if(!await checkExistPath(o))throw new NotFoundError("Credentials file does not exist");const _=JSON.parse(i.readFileSync(o,"utf-8")).password;if(!_||_.length===0)throw new NotFoundError("Password not found");return _},client=async(i="http://localhost:"+LOCAL_PORT)=>{const{default:a}=await __vitePreload(()=>import("./index-bd766cd9.js"),[]),o=ft=>ft>=200&&ft<300||ft==404,_=ft=>{if(ft.status!==200)throw new Error(ft.data);return ft},et=ft=>{if(ft.status!==404){if(ft.status==200)return ft.data;throw new Error(typeof ft.data=="string"?ft.data:ft.data.toString())}},rt=async()=>_(await a.get(i+PEER_ID_PATH,{validateStatus:o})).data,ot=async()=>({authorization:"Basic admin:"+await loadPassword()});return{peer:{id:{get:rt},addresses:{get:async()=>_(await a.get(i+ADDRESS_PATH,{validateStatus:o,headers:await ot()})).data.map(ft=>multiaddr(ft))}},program:{get:async ft=>{const lt=et(await a.get(i+PROGRAM_PATH+"/"+encodeURIComponent(ft.toString()),{validateStatus:o,headers:await ot()}));return lt?deserialize(fromBase64(lt),Program):void 0},put:async ft=>{const lt=ft instanceof Program?toBase64(serialize$2(ft)):ft;return _(await a.put(i+PROGRAM_PATH,lt,{validateStatus:o,headers:await ot()})).data}},library:{put:async ft=>{_(await a.put(i+LIBRARY_PATH,ft,{validateStatus:o,headers:await ot()}))}}}},common={black:"#000",white:"#fff"},common$1=common,red={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},red$1=red,purple={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},purple$1=purple,blue={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},blue$1=blue,lightBlue={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},lightBlue$1=lightBlue,green={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"},green$1=green,orange={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},orange$1=orange,grey={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},grey$1=grey;function _extends(){return _extends=Object.assign?Object.assign.bind():function(i){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var _ in o)Object.prototype.hasOwnProperty.call(o,_)&&(i[_]=o[_])}return i},_extends.apply(this,arguments)}function isPlainObject(i){return i!==null&&typeof i=="object"&&i.constructor===Object}function deepClone(i){if(!isPlainObject(i))return i;const a={};return Object.keys(i).forEach(o=>{a[o]=deepClone(i[o])}),a}function deepmerge(i,a,o={clone:!0}){const _=o.clone?_extends({},i):i;return isPlainObject(i)&&isPlainObject(a)&&Object.keys(a).forEach(et=>{et!=="__proto__"&&(isPlainObject(a[et])&&et in i&&isPlainObject(i[et])?_[et]=deepmerge(i[et],a[et],o):o.clone?_[et]=isPlainObject(a[et])?deepClone(a[et]):a[et]:_[et]=a[et])}),_}function formatMuiErrorMessage(i){let a="https://mui.com/production-error/?code="+i;for(let o=1;o<arguments.length;o+=1)a+="&args[]="+encodeURIComponent(arguments[o]);return"Minified MUI error #"+i+"; visit "+a+" for the full message."}function capitalize(i){if(typeof i!="string")throw new Error(formatMuiErrorMessage(7));return i.charAt(0).toUpperCase()+i.slice(1)}function resolveProps(i,a){const o=_extends({},a);return Object.keys(i).forEach(_=>{if(_.toString().match(/^(components|slots)$/))o[_]=_extends({},i[_],o[_]);else if(_.toString().match(/^(componentsProps|slotProps)$/)){const et=i[_]||{},rt=a[_];o[_]={},!rt||!Object.keys(rt)?o[_]=et:!et||!Object.keys(et)?o[_]=rt:(o[_]=_extends({},rt),Object.keys(et).forEach(ot=>{o[_][ot]=resolveProps(et[ot],rt[ot])}))}else o[_]===void 0&&(o[_]=i[_])}),o}function composeClasses(i,a,o=void 0){const _={};return Object.keys(i).forEach(et=>{_[et]=i[et].reduce((rt,ot)=>{if(ot){const ft=a(ot);ft!==""&&rt.push(ft),o&&o[ot]&&rt.push(o[ot])}return rt},[]).join(" ")}),_}const defaultGenerator=i=>i,createClassNameGenerator=()=>{let i=defaultGenerator;return{configure(a){i=a},generate(a){return i(a)},reset(){i=defaultGenerator}}},ClassNameGenerator=createClassNameGenerator(),ClassNameGenerator$1=ClassNameGenerator,globalStateClassesMapping={active:"active",checked:"checked",completed:"completed",disabled:"disabled",readOnly:"readOnly",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",required:"required",selected:"selected"};function generateUtilityClass(i,a,o="Mui"){const _=globalStateClassesMapping[a];return _?`${o}-${_}`:`${ClassNameGenerator$1.generate(i)}-${a}`}function generateUtilityClasses(i,a,o="Mui"){const _={};return a.forEach(et=>{_[et]=generateUtilityClass(i,et,o)}),_}const THEME_ID="$$material";function _objectWithoutPropertiesLoose(i,a){if(i==null)return{};var o={},_=Object.keys(i),et,rt;for(rt=0;rt<_.length;rt++)et=_[rt],!(a.indexOf(et)>=0)&&(o[et]=i[et]);return o}function memoize$1(i){var a=Object.create(null);return function(o){return a[o]===void 0&&(a[o]=i(o)),a[o]}}var reactPropsRegex=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,isPropValid=memoize$1(function(i){return reactPropsRegex.test(i)||i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)<91});function sheetForTag(i){if(i.sheet)return i.sheet;for(var a=0;a<document.styleSheets.length;a++)if(document.styleSheets[a].ownerNode===i)return document.styleSheets[a]}function createStyleElement(i){var a=document.createElement("style");return a.setAttribute("data-emotion",i.key),i.nonce!==void 0&&a.setAttribute("nonce",i.nonce),a.appendChild(document.createTextNode("")),a.setAttribute("data-s",""),a}var StyleSheet=function(){function i(o){var _=this;this._insertTag=function(et){var rt;_.tags.length===0?_.insertionPoint?rt=_.insertionPoint.nextSibling:_.prepend?rt=_.container.firstChild:rt=_.before:rt=_.tags[_.tags.length-1].nextSibling,_.container.insertBefore(et,rt),_.tags.push(et)},this.isSpeedy=o.speedy===void 0?!0:o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var a=i.prototype;return a.hydrate=function(_){_.forEach(this._insertTag)},a.insert=function(_){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(createStyleElement(this));var et=this.tags[this.tags.length-1];if(this.isSpeedy){var rt=sheetForTag(et);try{rt.insertRule(_,rt.cssRules.length)}catch{}}else et.appendChild(document.createTextNode(_));this.ctr++},a.flush=function(){this.tags.forEach(function(_){return _.parentNode&&_.parentNode.removeChild(_)}),this.tags=[],this.ctr=0},i}(),MS="-ms-",MOZ="-moz-",WEBKIT="-webkit-",COMMENT="comm",RULESET="rule",DECLARATION="decl",IMPORT="@import",KEYFRAMES="@keyframes",LAYER="@layer",abs=Math.abs,from=String.fromCharCode,assign=Object.assign;function hash(i,a){return charat(i,0)^45?(((a<<2^charat(i,0))<<2^charat(i,1))<<2^charat(i,2))<<2^charat(i,3):0}function trim(i){return i.trim()}function match(i,a){return(i=a.exec(i))?i[0]:i}function replace(i,a,o){return i.replace(a,o)}function indexof(i,a){return i.indexOf(a)}function charat(i,a){return i.charCodeAt(a)|0}function substr(i,a,o){return i.slice(a,o)}function strlen(i){return i.length}function sizeof(i){return i.length}function append(i,a){return a.push(i),i}function combine(i,a){return i.map(a).join("")}var line=1,column=1,length=0,position=0,character=0,characters="";function node(i,a,o,_,et,rt,ot){return{value:i,root:a,parent:o,type:_,props:et,children:rt,line,column,length:ot,return:""}}function copy(i,a){return assign(node("",null,null,"",null,null,0),i,{length:-i.length},a)}function char(){return character}function prev(){return character=position>0?charat(characters,--position):0,column--,character===10&&(column=1,line--),character}function next(){return character=position<length?charat(characters,position++):0,column++,character===10&&(column=1,line++),character}function peek(){return charat(characters,position)}function caret(){return position}function slice(i,a){return substr(characters,i,a)}function token(i){switch(i){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function alloc(i){return line=column=1,length=strlen(characters=i),position=0,[]}function dealloc(i){return characters="",i}function delimit(i){return trim(slice(position-1,delimiter(i===91?i+2:i===40?i+1:i)))}function whitespace(i){for(;(character=peek())&&character<33;)next();return token(i)>2||token(character)>3?"":" "}function escaping(i,a){for(;--a&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice(i,caret()+(a<6&&peek()==32&&next()==32))}function delimiter(i){for(;next();)switch(character){case i:return position;case 34:case 39:i!==34&&i!==39&&delimiter(character);break;case 40:i===41&&delimiter(i);break;case 92:next();break}return position}function commenter(i,a){for(;next()&&i+character!==47+10;)if(i+character===42+42&&peek()===47)break;return"/*"+slice(a,position-1)+"*"+from(i===47?i:next())}function identifier(i){for(;!token(peek());)next();return slice(i,position)}function compile(i){return dealloc(parse("",null,null,null,[""],i=alloc(i),0,[0],i))}function parse(i,a,o,_,et,rt,ot,ft,lt){for(var ht=0,vt=0,It=ot,Qt=0,mt=0,Yt=0,Rt=1,cr=1,Ut=1,zt=0,Gt="",Dr=et,lr=rt,xr=_,hr=Gt;cr;)switch(Yt=zt,zt=next()){case 40:if(Yt!=108&&charat(hr,It-1)==58){indexof(hr+=replace(delimit(zt),"&","&\f"),"&\f")!=-1&&(Ut=-1);break}case 34:case 39:case 91:hr+=delimit(zt);break;case 9:case 10:case 13:case 32:hr+=whitespace(Yt);break;case 92:hr+=escaping(caret()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next(),caret()),a,o),lt);break;default:hr+="/"}break;case 123*Rt:ft[ht++]=strlen(hr)*Ut;case 125*Rt:case 59:case 0:switch(zt){case 0:case 125:cr=0;case 59+vt:Ut==-1&&(hr=replace(hr,/\f/g,"")),mt>0&&strlen(hr)-It&&append(mt>32?declaration(hr+";",_,o,It-1):declaration(replace(hr," ","")+";",_,o,It-2),lt);break;case 59:hr+=";";default:if(append(xr=ruleset(hr,a,o,ht,vt,et,ft,Gt,Dr=[],lr=[],It),rt),zt===123)if(vt===0)parse(hr,a,xr,xr,Dr,rt,It,ft,lr);else switch(Qt===99&&charat(hr,3)===110?100:Qt){case 100:case 108:case 109:case 115:parse(i,xr,xr,_&&append(ruleset(i,xr,xr,0,0,et,ft,Gt,et,Dr=[],It),lr),et,lr,It,ft,_?Dr:lr);break;default:parse(hr,xr,xr,xr,[""],lr,0,ft,lr)}}ht=vt=mt=0,Rt=Ut=1,Gt=hr="",It=ot;break;case 58:It=1+strlen(hr),mt=Yt;default:if(Rt<1){if(zt==123)--Rt;else if(zt==125&&Rt++==0&&prev()==125)continue}switch(hr+=from(zt),zt*Rt){case 38:Ut=vt>0?1:(hr+="\f",-1);break;case 44:ft[ht++]=(strlen(hr)-1)*Ut,Ut=1;break;case 64:peek()===45&&(hr+=delimit(next())),Qt=peek(),vt=It=strlen(Gt=hr+=identifier(caret())),zt++;break;case 45:Yt===45&&strlen(hr)==2&&(Rt=0)}}return rt}function ruleset(i,a,o,_,et,rt,ot,ft,lt,ht,vt){for(var It=et-1,Qt=et===0?rt:[""],mt=sizeof(Qt),Yt=0,Rt=0,cr=0;Yt<_;++Yt)for(var Ut=0,zt=substr(i,It+1,It=abs(Rt=ot[Yt])),Gt=i;Ut<mt;++Ut)(Gt=trim(Rt>0?Qt[Ut]+" "+zt:replace(zt,/&\f/g,Qt[Ut])))&&(lt[cr++]=Gt);return node(i,a,o,et===0?RULESET:ft,lt,ht,vt)}function comment(i,a,o){return node(i,a,o,COMMENT,from(char()),substr(i,2,-2),0)}function declaration(i,a,o,_){return node(i,a,o,DECLARATION,substr(i,0,_),substr(i,_+1,-1),_)}function serialize(i,a){for(var o="",_=sizeof(i),et=0;et<_;et++)o+=a(i[et],et,i,a)||"";return o}function stringify(i,a,o,_){switch(i.type){case LAYER:if(i.children.length)break;case IMPORT:case DECLARATION:return i.return=i.return||i.value;case COMMENT:return"";case KEYFRAMES:return i.return=i.value+"{"+serialize(i.children,_)+"}";case RULESET:i.value=i.props.join(",")}return strlen(o=serialize(i.children,_))?i.return=i.value+"{"+o+"}":""}function middleware(i){var a=sizeof(i);return function(o,_,et,rt){for(var ot="",ft=0;ft<a;ft++)ot+=i[ft](o,_,et,rt)||"";return ot}}function rulesheet(i){return function(a){a.root||(a=a.return)&&i(a)}}var identifierWithPointTracking=function i(a,o,_){for(var et=0,rt=0;et=rt,rt=peek(),et===38&&rt===12&&(o[_]=1),!token(rt);)next();return slice(a,position)},toRules=function i(a,o){var _=-1,et=44;do switch(token(et)){case 0:et===38&&peek()===12&&(o[_]=1),a[_]+=identifierWithPointTracking(position-1,o,_);break;case 2:a[_]+=delimit(et);break;case 4:if(et===44){a[++_]=peek()===58?"&\f":"",o[_]=a[_].length;break}default:a[_]+=from(et)}while(et=next());return a},getRules=function i(a,o){return dealloc(toRules(alloc(a),o))},fixedElements=new WeakMap,compat=function i(a){if(!(a.type!=="rule"||!a.parent||a.length<1)){for(var o=a.value,_=a.parent,et=a.column===_.column&&a.line===_.line;_.type!=="rule";)if(_=_.parent,!_)return;if(!(a.props.length===1&&o.charCodeAt(0)!==58&&!fixedElements.get(_))&&!et){fixedElements.set(a,!0);for(var rt=[],ot=getRules(o,rt),ft=_.props,lt=0,ht=0;lt<ot.length;lt++)for(var vt=0;vt<ft.length;vt++,ht++)a.props[ht]=rt[lt]?ot[lt].replace(/&\f/g,ft[vt]):ft[vt]+" "+ot[lt]}}},removeLabel=function i(a){if(a.type==="decl"){var o=a.value;o.charCodeAt(0)===108&&o.charCodeAt(2)===98&&(a.return="",a.value="")}};function prefix(i,a){switch(hash(i,a)){case 5103:return WEBKIT+"print-"+i+i;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return WEBKIT+i+i;case 5349:case 4246:case 4810:case 6968:case 2756:return WEBKIT+i+MOZ+i+MS+i+i;case 6828:case 4268:return WEBKIT+i+MS+i+i;case 6165:return WEBKIT+i+MS+"flex-"+i+i;case 5187:return WEBKIT+i+replace(i,/(\w+).+(:[^]+)/,WEBKIT+"box-$1$2"+MS+"flex-$1$2")+i;case 5443:return WEBKIT+i+MS+"flex-item-"+replace(i,/flex-|-self/,"")+i;case 4675:return WEBKIT+i+MS+"flex-line-pack"+replace(i,/align-content|flex-|-self/,"")+i;case 5548:return WEBKIT+i+MS+replace(i,"shrink","negative")+i;case 5292:return WEBKIT+i+MS+replace(i,"basis","preferred-size")+i;case 6060:return WEBKIT+"box-"+replace(i,"-grow","")+WEBKIT+i+MS+replace(i,"grow","positive")+i;case 4554:return WEBKIT+replace(i,/([^-])(transform)/g,"$1"+WEBKIT+"$2")+i;case 6187:return replace(replace(replace(i,/(zoom-|grab)/,WEBKIT+"$1"),/(image-set)/,WEBKIT+"$1"),i,"")+i;case 5495:case 3959:return replace(i,/(image-set\([^]*)/,WEBKIT+"$1$`$1");case 4968:return replace(replace(i,/(.+:)(flex-)?(.*)/,WEBKIT+"box-pack:$3"+MS+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+WEBKIT+i+i;case 4095:case 3583:case 4068:case 2532:return replace(i,/(.+)-inline(.+)/,WEBKIT+"$1$2")+i;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(strlen(i)-1-a>6)switch(charat(i,a+1)){case 109:if(charat(i,a+4)!==45)break;case 102:return replace(i,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(i,a+3)==108?"$3":"$2-$3"))+i;case 115:return~indexof(i,"stretch")?prefix(replace(i,"stretch","fill-available"),a)+i:i}break;case 4949:if(charat(i,a+1)!==115)break;case 6444:switch(charat(i,strlen(i)-3-(~indexof(i,"!important")&&10))){case 107:return replace(i,":",":"+WEBKIT)+i;case 101:return replace(i,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(i,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+i}break;case 5936:switch(charat(i,a+11)){case 114:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"tb")+i;case 108:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"tb-rl")+i;case 45:return WEBKIT+i+MS+replace(i,/[svh]\w+-[tblr]{2}/,"lr")+i}return WEBKIT+i+MS+i+i}return i}var prefixer=function i(a,o,_,et){if(a.length>-1&&!a.return)switch(a.type){case DECLARATION:a.return=prefix(a.value,a.length);break;case KEYFRAMES:return serialize([copy(a,{value:replace(a.value,"@","@"+WEBKIT)})],et);case RULESET:if(a.length)return combine(a.props,function(rt){switch(match(rt,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(a,{props:[replace(rt,/:(read-\w+)/,":"+MOZ+"$1")]})],et);case"::placeholder":return serialize([copy(a,{props:[replace(rt,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy(a,{props:[replace(rt,/:(plac\w+)/,":"+MOZ+"$1")]}),copy(a,{props:[replace(rt,/:(plac\w+)/,MS+"input-$1")]})],et)}return""})}},defaultStylisPlugins=[prefixer],createCache=function i(a){var o=a.key;if(o==="css"){var _=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(_,function(Rt){var cr=Rt.getAttribute("data-emotion");cr.indexOf(" ")!==-1&&(document.head.appendChild(Rt),Rt.setAttribute("data-s",""))})}var et=a.stylisPlugins||defaultStylisPlugins,rt={},ot,ft=[];ot=a.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+o+' "]'),function(Rt){for(var cr=Rt.getAttribute("data-emotion").split(" "),Ut=1;Ut<cr.length;Ut++)rt[cr[Ut]]=!0;ft.push(Rt)});var lt,ht=[compat,removeLabel];{var vt,It=[stringify,rulesheet(function(Rt){vt.insert(Rt)})],Qt=middleware(ht.concat(et,It)),mt=function(cr){return serialize(compile(cr),Qt)};lt=function(cr,Ut,zt,Gt){vt=zt,mt(cr?cr+"{"+Ut.styles+"}":Ut.styles),Gt&&(Yt.inserted[Ut.name]=!0)}}var Yt={key:o,sheet:new StyleSheet({key:o,container:ot,nonce:a.nonce,speedy:a.speedy,prepend:a.prepend,insertionPoint:a.insertionPoint}),nonce:a.nonce,inserted:rt,registered:{},insert:lt};return Yt.sheet.hydrate(ft),Yt},reactIs$1={exports:{}},reactIs_production_min={};/** @license React v16.13.1
|
|
68
68
|
* react-is.production.min.js
|
|
69
69
|
*
|
|
70
70
|
* Copyright (c) Facebook, Inc. and its affiliates.
|