@bsv/sdk 2.1.5 → 2.1.6

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.
Files changed (30) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/compat/Utxo.js +1 -1
  3. package/dist/cjs/src/compat/Utxo.js.map +1 -1
  4. package/dist/cjs/src/primitives/Hash.js +4 -2
  5. package/dist/cjs/src/primitives/Hash.js.map +1 -1
  6. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  7. package/dist/esm/src/compat/Utxo.js +1 -1
  8. package/dist/esm/src/compat/Utxo.js.map +1 -1
  9. package/dist/esm/src/primitives/Hash.js +4 -2
  10. package/dist/esm/src/primitives/Hash.js.map +1 -1
  11. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  12. package/dist/types/src/primitives/Hash.d.ts.map +1 -1
  13. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  14. package/dist/umd/bundle.js +1 -1
  15. package/package.json +1 -1
  16. package/src/compat/Utxo.ts +1 -1
  17. package/src/compat/__tests/Mnemonic.additional.test.ts +1 -1
  18. package/src/compat/__tests/Mnemonic.test.ts +1 -1
  19. package/src/overlay-tools/__tests/Historian.test.ts +1 -1
  20. package/src/overlay-tools/__tests/HostReputationTracker.additional.test.ts +1 -1
  21. package/src/primitives/Hash.ts +4 -2
  22. package/src/primitives/__tests/BigNumber.constructor.test.ts +1 -1
  23. package/src/primitives/__tests/DRBG.test.ts +4 -12
  24. package/src/primitives/__tests/Point.additional.test.ts +2 -2
  25. package/src/primitives/__tests/Point.test.ts +1 -1
  26. package/src/primitives/__tests/SymmetricKeyCompatibility.test.ts +4 -4
  27. package/src/registry/__tests/RegistryClient.additional.test.ts +4 -4
  28. package/src/registry/__tests/RegistryClient.test.ts +2 -2
  29. package/src/storage/__tests/StorageUploader.test.ts +7 -7
  30. package/src/transaction/__tests/Transaction.test.ts +3 -3
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bsv=t():e.bsv=t()}(this,()=>(()=>{"use strict";let e,t,i,r,n;var s,a,o,l,c,h,d,u,f={};f.d=(e,t,i)=>{var r=(t,i)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,[i]:t[r]})};r(t,"get"),r(i,"value")},f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};f.r(p),f.d(p,{ARC:()=>rs,ATOMIC_BEEF:()=>ru,AuthFetch:()=>n6,BEEF_V1:()=>rh,BEEF_V2:()=>rd,BSM:()=>v,Beef:()=>rp,BeefParty:()=>rb,BeefTx:()=>rf,BigNumber:()=>A,BlockHeadersService:()=>rE,Brc29RemittanceModule:()=>sW,CachedKeyDeriver:()=>rj,Certificate:()=>r1,CompletedProtoWallet:()=>nY,Curve:()=>t1,DEFAULT_IDENTITY_CLIENT_OPTIONS:()=>sw,DEFAULT_REMITTANCE_MESSAGEBOX:()=>sL,DEFAULT_SLAP_TRACKERS:()=>si,DEFAULT_TESTNET_SLAP_TRACKERS:()=>sr,DEFAULT_UHRP_SERVERS:()=>sp,DefaultLockingScriptProvider:()=>sz,DefaultNonceProvider:()=>s$,ECDSA:()=>m,ECIES:()=>rK,EncryptedMessage:()=>w,FetchHttpClient:()=>ri,GlobalKVStore:()=>sU,HD:()=>rU,HTTPSOverlayBroadcastFacilitator:()=>sa,HTTPSOverlayLookupFacilitator:()=>sn,HTTPWalletJSON:()=>nt,HTTPWalletWire:()=>r5,Hash:()=>g,IdentityClient:()=>sA,InvoiceHandle:()=>sM,InvokableWalletBase:()=>rQ,KNOWN_IDENTITY_TYPES:()=>sv,KeyDeriver:()=>rW,KeyShares:()=>ic,LivePolicy:()=>i7,LocalKVStore:()=>sP,LockingScript:()=>ij,LookupResolver:()=>ss,MasterCertificate:()=>nG,MerklePath:()=>rc,Mnemonic:()=>rD,NodejsHttpClient:()=>rt,OP:()=>iC,OverlayAdminTokenTemplate:()=>n4,P2PKH:()=>i3,Peer:()=>n8,Point:()=>t0,PointInFiniteField:()=>io,Polynomial:()=>il,PrivateKey:()=>ih,ProtoWallet:()=>rX,PublicKey:()=>ii,PushDrop:()=>i4,REMITTANCE_STATE_TRANSITIONS:()=>sF,RPuzzle:()=>i5,Random:()=>ia,ReactNativeWebView:()=>ni,RegistryClient:()=>sT,RemittanceManager:()=>sV,RenewResiliencyError:()=>sg,SAT_UNIT:()=>sD,SHIPBroadcaster:()=>so,SHIPCast:()=>so,SatoshisPerKilobyte:()=>i9,Schnorr:()=>iL,Script:()=>iU,ScriptEvaluationError:()=>iX,Secp256r1:()=>iW,SecurityLevels:()=>h,SessionManager:()=>nJ,Signature:()=>t2,SignedMessage:()=>b,SimplifiedFetchTransport:()=>n5,Spend:()=>i0,StorageDownloader:()=>sm,StorageUploader:()=>sy,StorageUtils:()=>k,SymmetricKey:()=>i_,TOTP:()=>r$,TX_DATA_FORMAT:()=>c,Teranode:()=>rS,ThreadHandle:()=>sH,TopicBroadcaster:()=>so,Transaction:()=>rg,TransactionSignature:()=>iD,UnlockingScript:()=>iG,Utils:()=>y,Validation:()=>I,VerifiableCertificate:()=>nX,WERR_INSUFFICIENT_FUNDS:()=>ne,WERR_INVALID_PARAMETER:()=>r7,WERR_REVIEW_ACTIONS:()=>r4,WalletClient:()=>nW,WalletError:()=>rJ,WalletErrors:()=>rZ,WalletWireProcessor:()=>nj,WalletWireTransceiver:()=>r3,WhatsOnChain:()=>ro,WhatsOnChainBroadcaster:()=>rw,WindowCWISubstrate:()=>rY,XDM:()=>r0,binaryHttpClient:()=>rk,createNonce:()=>nQ,defaultBroadcaster:()=>ra,defaultChainTracker:()=>rl,defaultHttpClient:()=>rr,defaultIdentity:()=>sb,deserializeWalletProtocol:()=>sO,fromUtxo:()=>rq,getVerifiableCertificates:()=>n0,isBroadcastFailure:()=>rm,isBroadcastResponse:()=>ry,validateCertificates:()=>n1,verifyNonce:()=>nZ,walletErrors:()=>d,withDoubleSpendRetry:()=>sl});var g={};f.r(g),f.d(g,{RIPEMD160:()=>ec,SHA1:()=>ed,SHA1HMAC:()=>ep,SHA256:()=>eh,SHA256HMAC:()=>ef,SHA512:()=>eu,SHA512HMAC:()=>eg,hash160:()=>eS,hash256:()=>ek,htonl:()=>L,pbkdf2:()=>tn,realHtonl:()=>to,ripemd160:()=>eb,sha1:()=>ew,sha256:()=>ev,sha256hmac:()=>eE,sha512:()=>eI,sha512hmac:()=>ex,swapBytes32:()=>ts,toArray:()=>D});var y={};f.r(y),f.d(y,{Reader:()=>tN,ReaderUint8Array:()=>tc,Writer:()=>tP,WriterUint8Array:()=>tl,base64ToArray:()=>tv,constantTimeEquals:()=>tU,encode:()=>tk,fromBase58:()=>tx,fromBase58Check:()=>tO,minimallyEncode:()=>t_,toArray:()=>tm,toBase58:()=>tA,toBase58Check:()=>tT,toBase64:()=>tS,toHex:()=>tg,toUTF8:()=>tI,toUint8Array:()=>ty,verifyNotNull:()=>tB,zero2:()=>tu});var m={};f.r(m),f.d(m,{sign:()=>ie,verify:()=>it});var b={};f.r(b),f.d(b,{sign:()=>rA,verify:()=>rT});var w={};f.r(w),f.d(w,{decrypt:()=>rN,encrypt:()=>rP});var v={};f.r(v),f.d(v,{magicHash:()=>rR,sign:()=>rC,verify:()=>rB});var I={};f.r(I),f.d(I,{isHexString:()=>nw,parseWalletOutpoint:()=>nr,specOpThrowReviewActions:()=>nz,validateAbortActionArgs:()=>nA,validateAcquireDirectCertificateArgs:()=>nV,validateAcquireIssuanceCertificateArgs:()=>nL,validateBase64String:()=>ny,validateBasketInsertion:()=>nO,validateCreateActionArgs:()=>nS,validateCreateActionInput:()=>nv,validateCreateActionOptions:()=>nk,validateCreateActionOutput:()=>nI,validateDiscoverByAttributesArgs:()=>nK,validateDiscoverByIdentityKeyArgs:()=>nM,validateInteger:()=>nl,validateInternalizeActionArgs:()=>n_,validateInternalizeOutput:()=>nP,validateListActionsArgs:()=>n$,validateListCertificatesArgs:()=>nF,validateListOutputsArgs:()=>nq,validateOptionalInteger:()=>no,validateOptionalOutpointString:()=>nR,validateOriginator:()=>nN,validateOutpointString:()=>nC,validatePositiveIntegerOrZero:()=>nc,validateProveCertificateArgs:()=>nH,validateRelinquishCertificateArgs:()=>nU,validateRelinquishOutputArgs:()=>nB,validateSatoshis:()=>na,validateSignActionArgs:()=>nx,validateSignActionOptions:()=>nE,validateStringLength:()=>nh,validateWalletPayment:()=>nT});var k={};f.r(k),f.d(k,{getHashFromURL:()=>su,getURLForFile:()=>sd,getURLForHash:()=>sh,isValidURL:()=>sf,normalizeURL:()=>sc});let S="u"<typeof globalThis?void 0:globalThis.Buffer,E=null!=S&&"function"==typeof S.from,x=new Int8Array(256).fill(-1);for(let e=0;e<10;e++)x[48+e]=e;for(let e=0;e<6;e++)x[65+e]=10+e,x[97+e]=10+e;class A{static zeros=["","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"];static groupSizes=[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];static groupBases=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];static wordSize=26;static WORD_SIZE_BIGINT=BigInt(A.wordSize);static WORD_MASK=(1n<<A.WORD_SIZE_BIGINT)-1n;static MAX_SAFE_INTEGER_BIGINT=BigInt(Number.MAX_SAFE_INTEGER);static MIN_SAFE_INTEGER_BIGINT=BigInt(Number.MIN_SAFE_INTEGER);static MAX_IMULN_ARG=0x3ffffff;static MAX_NUMBER_CONSTRUCTOR_MAG_BIGINT=(1n<<53n)-1n;_magnitude=0n;_sign=0;_nominalWordLength=1;red;get negative(){return this._sign}set negative(e){this.assert(0===e||1===e,"Negative property must be 0 or 1"),0n===this._magnitude?this._sign=0:this._sign=+(1===e)}get _computedWordsArray(){if(0n===this._magnitude)return[0];let e=[],t=this._magnitude;for(;t>0n;)e.push(Number(t&A.WORD_MASK)),t>>=A.WORD_SIZE_BIGINT;return e.length>0?e:[0]}get words(){let e=this._computedWordsArray;if(this._nominalWordLength<=e.length)return e;let t=Array(this._nominalWordLength).fill(0);for(let i=0;i<e.length;i++)t[i]=e[i];return t}set words(e){let t=this._sign,i=0n,r=e.length>0?e.length:1;for(let t=r-1;t>=0;t--){let r=e[t]??0;i=i<<A.WORD_SIZE_BIGINT|BigInt(r&Number(A.WORD_MASK))}this._magnitude=i,this._sign=t,this._nominalWordLength=r,this.normSign()}get length(){return Math.max(1,this._nominalWordLength)}static isBN(e){return e instanceof A||null!==e&&"object"==typeof e&&e.constructor?.wordSize===A.wordSize&&Array.isArray(e.words)}static max(e,t){return e.cmp(t)>0?e:t}static min(e,t){return 0>e.cmp(t)?e:t}constructor(e=0,t=10,i="be"){if(this.red=null,null===(e??=0))return void this._initializeState(0n,0);if("bigint"==typeof e){this._initializeState(e<0n?-e:e,+(e<0n)),this.normSign();return}let r=t,n=i;if(("le"===t||"be"===t)&&(n=t,r=10),"number"==typeof e)return void this.initNumber(e,n);if(Array.isArray(e))return void this.initArray(e,n);if("string"==typeof e)return void this._initFromString(e,r,n);0!==e?this.assert(!1,"Unsupported input type for BigNumber constructor"):this._initializeState(0n,0)}_initFromString(e,t,i){"hex"===t&&(t=16),this.assert("number"==typeof t&&t===(0|t)&&t>=2&&t<=36,"Base must be an integer between 2 and 36");let r=e.toString().replace(/\s+/g,""),n=0,s=0;r.startsWith("-")?(n++,s=1):r.startsWith("+")&&n++;let a=r.substring(n);if(0===a.length){this._initializeState(0n,1===s&&r.startsWith("-")?1:0),this.normSign();return}16===t?this._initFromHexString(a,s,i):this._initFromNonHexString(a,t,s,i)}_initFromHexString(e,t,i){if("le"===i){let i=[],r=e;r.length%2!=0&&(r="0"+r);for(let e=0;e<r.length;e+=2){let t=Number.parseInt(r.substring(e,e+2),16);if(Number.isNaN(t))throw Error("Invalid character in "+r);i.push(t)}this.initArray(i,"le"),this._sign=t,this.normSign()}else{let i;try{i=BigInt("0x"+e)}catch(t){throw Error("Invalid character in "+e)}this._initializeState(i,t),this.normSign()}}_initFromNonHexString(e,t,i,r){try{if(this._parseBaseString(e,t),this._sign=i,this.normSign(),"le"===r){let e=this._sign;this.initArray(this.toArray("be"),"le"),this._sign=e,this.normSign()}}catch(e){if(e.message.includes("Invalid character in string")||e.message.includes("Invalid digit for base")||e.message.startsWith("Invalid character:"))throw Error("Invalid character");throw e}}_bigIntToStringInBase(e,t){if(0n===e)return"0";if(t<2||t>36)throw Error("Base must be between 2 and 36");let i="",r=e>0n?e:-e,n=BigInt(t);for(;r>0n;)i="0123456789abcdefghijklmnopqrstuvwxyz"[Number(r%n)]+i,r/=n;return i}_parseBaseString(e,t){if(0===e.length){this._magnitude=0n,this._finishInitialization();return}this._magnitude=0n;let i=BigInt(t),r=A.groupSizes[t],n=BigInt(A.groupBases[t]);(0===r||0n===n)&&(0===(r=Math.floor(Math.log(0x3ffffff)/Math.log(t)))&&(r=1),n=i**BigInt(r));let s=0,a=e.length,o=a%r;if(0===o&&a>0&&(o=r),o>0){let i=e.substring(s,s+o);this._magnitude=BigInt(this._parseBaseWord(i,t)),s+=o}for(;s<a;){let i=e.substring(s,s+r),a=BigInt(this._parseBaseWord(i,t));this._magnitude=this._magnitude*n+a,s+=r}this._finishInitialization()}_parseBaseWord(e,t){let i=0;for(let r=0;r<e.length;r++){let n,s=e.codePointAt(r);if(s>=48&&s<=57)n=s-48;else if(s>=65&&s<=90)n=s-65+10;else if(s>=97&&s<=122)n=s-97+10;else throw Error("Invalid character: "+e[r]);if(n>=t)throw Error("Invalid character");i=i*t+n}return i}_initializeState(e,t){this._magnitude=e,this._sign=0n===e?0:t,this._finishInitialization()}_finishInitialization(){if(0n===this._magnitude)this._nominalWordLength=1,this._sign=0;else{let e=this._magnitude.toString(2).length;this._nominalWordLength=Math.max(1,Math.ceil(e/A.wordSize))}}assert(e,t="Assertion failed"){if(!e)throw Error(t)}initNumber(e,t="be"){if(this.assert(BigInt(Math.abs(e))<=A.MAX_NUMBER_CONSTRUCTOR_MAG_BIGINT,"The number is larger than 2 ^ 53 (unsafe)"),this.assert(e%1==0,"Number must be an integer for BigNumber conversion"),this._initializeState(BigInt(Math.abs(e)),+(e<0)),"le"===t){let e=this._sign,t=this.toArray("be");this.initArray(t,"le"),this._sign=e,this.normSign()}return this}initArray(e,t){if(0===e.length)return this._initializeState(0n,0),this;let i=0n;if("be"===t)for(let t of e)i=i<<8n|BigInt(255&t);else for(let t=e.length-1;t>=0;t--)i=i<<8n|BigInt(255&e[t]);return this._initializeState(i,0),this}copy(e){e._magnitude=this._magnitude,e._sign=this._sign,e._nominalWordLength=this._nominalWordLength,e.red=this.red}static move(e,t){e._magnitude=t._magnitude,e._sign=t._sign,e._nominalWordLength=t._nominalWordLength,e.red=t.red}clone(){let e=new A(0n);return this.copy(e),e}expand(e){return this.assert(e>=0,"Expand size must be non-negative"),this._nominalWordLength=Math.max(this._nominalWordLength,e,1),this}strip(){return this._finishInitialization(),this.normSign()}normSign(){return 0n===this._magnitude&&(this._sign=0),this}inspect(){return(null===this.red?"<BN: ":"<BN-R: ")+this.toString(16)+">"}_getMinimalHex(){return 0n===this._magnitude?"0":this._magnitude.toString(16)}toString(e=10,t=1){if(16===e||"hex"===e){let e=this._getMinimalHex();if(t>1)for("0"!==e&&e.length%2!=0&&(e="0"+e);e.length%t!=0;)e="0"+e;return(this.isNeg()?"-":"")+e}if("number"!=typeof e||e<2||e>36||e%1!=0)throw Error("Base should be an integer between 2 and 36");return this.toBaseString(e,t)}toBaseString(e,t){if(0n===this._magnitude){let e="0";if(t>1)for(;e.length<t;)e="0"+e;return e}let i=A.groupSizes[e],r=BigInt(A.groupBases[e]);(0===i||0n===r)&&(0===(i=Math.floor(Math.log(Number.MAX_SAFE_INTEGER)/Math.log(e)))&&(i=1),r=BigInt(e)**BigInt(i));let n="",s=this._magnitude;for(;s>0n;){let t=s%r;s/=r;let a=this._bigIntToStringInBase(t,e);n=(s>0n?this._zeroPaddedChunk(a,i):a)+n}if(t>0)for(;n.length<t;)n="0"+n;return(1===this._sign?"-":"")+n}_zeroPaddedChunk(e,t){let i=t-e.length;return i<=0?e:i<A.zeros.length?A.zeros[i]+e:"0".repeat(i)+e}toNumber(){let e=this._getSignedValue();if(e>A.MAX_SAFE_INTEGER_BIGINT||e<A.MIN_SAFE_INTEGER_BIGINT)throw Error("Number can only safely store up to 53 bits");return Number(e)}toBigInt(){return this._getSignedValue()}toJSON(){let e=this._getMinimalHex();return(this.isNeg()?"-":"")+e}toArrayLikeGeneric(e,t){let i=this._magnitude,r=t?0:e.length-1,n=t?1:-1;for(let t=0;t<e.length;++t){if(0n===i&&r>=0&&r<e.length)e[r]=0;else if(r>=0&&r<e.length)e[r]=Number(255n&i);else break;i>>=8n,r+=n}}toArray(e="be",t){this.strip();let i=this.byteLength(),r=t??Math.max(1,i);this.assert(i<=r,"byte array longer than desired length"),this.assert(r>0,"Requested array length <= 0");let n=Array(r).fill(0);return 0n===this._magnitude&&r>0?n:0n===this._magnitude&&0===r?[]:(this.toArrayLikeGeneric(n,"le"===e),n)}bitLength(){return 0n===this._magnitude?0:this._magnitude.toString(2).length}static toBitArray(e){let t=e.bitLength();if(0===t)return[];let i=Array(t),r=e._magnitude;for(let e=0;e<t;e++)i[e]=+((r>>BigInt(e)&1n)!==0n);return i}toBitArray(){return A.toBitArray(this)}zeroBits(){if(0n===this._magnitude)return 0;let e=0,t=this._magnitude;for(;(1n&t)===0n&&0n!==t;)e++,t>>=1n;return e}byteLength(){return 0n===this._magnitude?0:Math.ceil(this.bitLength()/8)}_getSignedValue(){return 1===this._sign?-this._magnitude:this._magnitude}_setValueFromSigned(e){e<0n?(this._magnitude=-e,this._sign=1):(this._magnitude=e,this._sign=0),this._finishInitialization(),this.normSign()}toTwos(e){this.assert(e>=0);let t=BigInt(e),i=this._getSignedValue();1===this._sign&&0n!==this._magnitude&&(i=(1n<<t)+i),i&=(1n<<t)-1n;let r=new A(0n);return r._initializeState(i,0),r}fromTwos(e){this.assert(e>=0);let t=BigInt(e),i=this._magnitude;if(e>0&&(i>>t-1n&1n)!==0n&&0===this._sign){let e=new A(0n);return e._setValueFromSigned(i-(1n<<t)),e}return this.clone()}isNeg(){return 1===this._sign&&0n!==this._magnitude}neg(){return this.clone().ineg()}ineg(){return 0n!==this._magnitude&&(this._sign=+(1!==this._sign)),this}_iuop(e,t,i=!1){let r=t(this._magnitude,e._magnitude),n=this._nominalWordLength;return i&&(n=Math.max(this.length,e.length)),this._magnitude=r,this._finishInitialization(),i&&(this._nominalWordLength=Math.max(this._nominalWordLength,n)),this.strip()}iuor(e){return this._iuop(e,(e,t)=>e|t)}iuand(e){return this._iuop(e,(e,t)=>e&t)}iuxor(e){return this._iuop(e,(e,t)=>e^t,!0)}_iop(e,t,i=!1){return this.assert(0===this._sign&&0===e._sign),this._iuop(e,t,i)}ior(e){return this._iop(e,(e,t)=>e|t)}iand(e){return this._iop(e,(e,t)=>e&t)}ixor(e){return this._iop(e,(e,t)=>e^t,!0)}_uop_new(e,t){return this.length>=e.length?this.clone()[t](e):e.clone()[t](this)}or(e){return this.assert(0===this._sign&&0===e._sign),this._uop_new(e,"iuor")}uor(e){return this._uop_new(e,"iuor")}and(e){return this.assert(0===this._sign&&0===e._sign),this._uop_new(e,"iuand")}uand(e){return this._uop_new(e,"iuand")}xor(e){return this.assert(0===this._sign&&0===e._sign),this._uop_new(e,"iuxor")}uxor(e){return this._uop_new(e,"iuxor")}inotn(e){this.assert("number"==typeof e&&e>=0);let t=BigInt(e);this._magnitude=~this._magnitude&(1n<<t)-1n;let i=0===e?1:Math.ceil(e/A.wordSize);return this._nominalWordLength=Math.max(1,i),this.strip(),this._nominalWordLength=Math.max(this._nominalWordLength,Math.max(1,i)),this}notn(e){return this.clone().inotn(e)}setn(e,t){this.assert("number"==typeof e&&e>=0);let i=BigInt(e);1===t||!0===t?this._magnitude|=1n<<i:this._magnitude&=~(1n<<i);let r=Math.floor(e/A.wordSize)+1;return this._nominalWordLength=Math.max(this._nominalWordLength,r),this._finishInitialization(),this.strip()}iadd(e){return this._setValueFromSigned(this._getSignedValue()+e._getSignedValue()),this}add(e){let t=new A(0n);return t._setValueFromSigned(this._getSignedValue()+e._getSignedValue()),t}isub(e){return this._setValueFromSigned(this._getSignedValue()-e._getSignedValue()),this}sub(e){let t=new A(0n);return t._setValueFromSigned(this._getSignedValue()-e._getSignedValue()),t}mul(e){let t=new A(0n);return t._magnitude=this._magnitude*e._magnitude,t._sign=0n===t._magnitude?0:this._sign^e._sign,t._nominalWordLength=this.length+e.length,t.red=null,t.normSign()}imul(e){return this._magnitude*=e._magnitude,this._sign=0n===this._magnitude?0:this._sign^e._sign,this._nominalWordLength=this.length+e.length,this.red=null,this.normSign()}imuln(e){return this.assert("number"==typeof e,"Assertion failed"),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"Assertion failed"),this._setValueFromSigned(this._getSignedValue()*BigInt(e)),this}muln(e){return this.clone().imuln(e)}sqr(){let e=new A(0n);return e._magnitude=this._magnitude*this._magnitude,e._sign=0,e._nominalWordLength=2*this.length,e.red=null,e}isqr(){return this._magnitude*=this._magnitude,this._sign=0,this._nominalWordLength=2*this.length,this.red=null,this}pow(e){if(this.assert(0===e._sign,"Exponent for pow must be non-negative"),e.isZero())return new A(1n);let t=new A(1n),i=this.clone(),r=e.clone(),n=i.isNeg(),s=r.isOdd();for(n&&i.ineg();!r.isZero();)r.isOdd()&&t.imul(i),i.isqr(),r.iushrn(1);return n&&s&&t.ineg(),t}static normalizeNonNegativeBigInt(e,t){if("number"==typeof e){if(!Number.isFinite(e)||!Number.isInteger(e)||e<0)throw Error(`${t} must be a non-negative integer`);return BigInt(e)}if(e<0n)throw Error(`${t} must be a non-negative integer`);return e}iushln(e){let t=A.normalizeNonNegativeBigInt(e,"Shift bits");return 0n===t?this:(this._magnitude<<=t,this._finishInitialization(),this.strip())}ishln(e){return this.assert(0===this._sign,"ishln requires positive number"),this.iushln(e)}iushrn(e,t,i){let r=A.normalizeNonNegativeBigInt(e,"Shift bits");if(0n===r)return null!=i&&i._initializeState(0n,0),this;if(null!=i){let e=this._magnitude&(1n<<r)-1n;i._initializeState(e,0)}return this._magnitude>>=r,this._finishInitialization(),this.strip()}ishrn(e,t,i){return this.assert(0===this._sign,"ishrn requires positive number"),this.iushrn(e,t,i)}shln(e){return this.clone().ishln(e)}ushln(e){return this.clone().iushln(e)}shrn(e){return this.clone().ishrn(e)}ushrn(e){return this.clone().iushrn(e)}testn(e){return this.assert("number"==typeof e&&e>=0),(this._magnitude>>BigInt(e)&1n)!==0n}imaskn(e){this.assert("number"==typeof e&&e>=0),this.assert(0===this._sign,"imaskn works only with positive numbers");let t=BigInt(e);this._magnitude&=0n===t?0n:(1n<<t)-1n;let i=0===e?1:Math.max(1,Math.ceil(e/A.wordSize));return this._nominalWordLength=i,this._finishInitialization(),this._nominalWordLength=Math.max(this._nominalWordLength,i),this.strip()}maskn(e){return this.clone().imaskn(e)}iaddn(e){return this.assert("number"==typeof e),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"num is too large"),this._setValueFromSigned(this._getSignedValue()+BigInt(e)),this}_iaddn(e){return this.iaddn(e)}isubn(e){return this.assert("number"==typeof e),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"Assertion failed"),this._setValueFromSigned(this._getSignedValue()-BigInt(e)),this}addn(e){return this.clone().iaddn(e)}subn(e){return this.clone().isubn(e)}iabs(){return this._sign=0,this}abs(){return this.clone().iabs()}divmod(e,t,i){if(this.assert(!e.isZero(),"Division by zero"),this.isZero()){let e=new A(0n);return{div:"mod"===t?null:e,mod:"div"===t?null:e}}let r=this._getSignedValue(),n=e._getSignedValue(),s="mod"!==t?r/n:null,a=this._computeMod(r,n,t,i);return{div:this._bigNumberFromSigned(s),mod:this._bigNumberFromSigned(a)}}_computeMod(e,t,i,r){if("div"===i)return null;let n=e%t;return!0===r&&n<0n&&(n+=t<0n?-t:t),n}_bigNumberFromSigned(e){if(null===e)return null;let t=new A(0n);return t._setValueFromSigned(e),t}div(e){return this.divmod(e,"div",!1).div}mod(e){return this.divmod(e,"mod",!1).mod}umod(e){return this.divmod(e,"mod",!0).mod}divRound(e){this.assert(!e.isZero());let t=this._getSignedValue(),i=e._getSignedValue(),r=t/i,n=t%i;if(0n===n){let e=new A(0n);return e._setValueFromSigned(r),e}2n*(n<0n?-n:n)>=(i<0n?-i:i)&&(t>0n&&i>0n||t<0n&&i<0n?r+=1n:r-=1n);let s=new A(0n);return s._setValueFromSigned(r),s}modrn(e){this.assert(0!==e,"Division by zero in modrn");let t=BigInt(Math.abs(e));if(0n===t)throw Error("Division by zero in modrn");let i=this._magnitude%t;return e<0?Number(-i):Number(i)}idivn(e){return this.assert(0!==e),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"num is too large"),this._setValueFromSigned(this._getSignedValue()/BigInt(e)),this}divn(e){return this.clone().idivn(e)}egcd(e){this.assert(0===e._sign,"p must not be negative"),this.assert(!e.isZero(),"p must not be zero");let t=this._getSignedValue(),i=e._magnitude,r=1n,n=0n,s=0n,a=1n;for(;0n!==i;){let e=t/i,o=i;i=t%i,t=o,o=n,n=r-e*n,r=o,o=a,a=s-e*a,s=o}let o=new A(0n);o._setValueFromSigned(r);let l=new A(0n);l._setValueFromSigned(s);let c=new A(0n);return c._initializeState(t<0n?-t:t,0),{a:o,b:l,gcd:c}}gcd(e){let t=this._magnitude,i=e._magnitude;if(0n===t){let e=new A(0n);return e._setValueFromSigned(i),e.iabs()}if(0n===i){let e=new A(0n);return e._setValueFromSigned(t),e.iabs()}for(;0n!==i;){let e=t%i;t=i,i=e}let r=new A(0n);return r._initializeState(t,0),r}invm(e){this.assert(!e.isZero()&&0===e._sign,"Modulus for invm must be positive and non-zero");let t=this.egcd(e);if(!t.gcd.eqn(1))throw Error("Inverse does not exist (numbers are not coprime).");return t.a.umod(e)}isEven(){return this._magnitude%2n===0n}isOdd(){return this._magnitude%2n===1n}andln(e){return this.assert(e>=0),Number(this._magnitude&BigInt(e))}bincn(e){this.assert("number"==typeof e&&e>=0);let t=1n<<BigInt(e);return this._setValueFromSigned(this._getSignedValue()+t),this}isZero(){return 0n===this._magnitude}cmpn(e){this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"Number is too big");let t=this._getSignedValue(),i=BigInt(e);return t<i?-1:+(t>i)}cmp(e){let t=this._getSignedValue(),i=e._getSignedValue();return t<i?-1:+(t>i)}ucmp(e){return this._magnitude<e._magnitude?-1:+(this._magnitude>e._magnitude)}gtn(e){return 1===this.cmpn(e)}gt(e){return 1===this.cmp(e)}gten(e){return this.cmpn(e)>=0}gte(e){return this.cmp(e)>=0}ltn(e){return -1===this.cmpn(e)}lt(e){return -1===this.cmp(e)}lten(e){return 0>=this.cmpn(e)}lte(e){return 0>=this.cmp(e)}eqn(e){return 0===this.cmpn(e)}eq(e){return 0===this.cmp(e)}toRed(e){return this.assert(null==this.red,"Already a number in reduction context"),this.assert(0===this._sign,"toRed works only with positives"),e.convertTo(this).forceRed(e)}fromRed(){return this.assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)}forceRed(e){return this.red=e,this}redAdd(e){return this.assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)}redIAdd(e){return this.assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)}redSub(e){return this.assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)}redISub(e){return this.assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)}redShl(e){return this.assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)}redMul(e){return this.assert(this.red,"redMul works only with red numbers"),this.red.verify2(this,e),this.red.mul(this,e)}redIMul(e){return this.assert(this.red,"redIMul works only with red numbers"),this.red.verify2(this,e),this.red.imul(this,e)}redSqr(){return this.assert(this.red,"redSqr works only with red numbers"),this.red.verify1(this),this.red.sqr(this)}redISqr(){return this.assert(this.red,"redISqr works only with red numbers"),this.red.verify1(this),this.red.isqr(this)}redSqrt(){return this.assert(this.red,"redSqrt works only with red numbers"),this.red.verify1(this),this.red.sqrt(this)}redInvm(){return this.assert(this.red,"redInvm works only with red numbers"),this.red.verify1(this),this.red.invm(this)}redNeg(){return this.assert(this.red,"redNeg works only with red numbers"),this.red.verify1(this),this.red.neg(this)}redPow(e){return this.assert(null!=this.red&&null==e.red,"redPow(normalNum)"),this.red.verify1(this),this.red.pow(this,e)}static fromHex(e,t){let i="be";return("little"===t||"le"===t)&&(i="le"),new A(e,16,i)}toHex(e=0){if(this.isZero()&&0===e)return"";let t=this._getMinimalHex();"0"!==t&&t.length%2!=0&&(t="0"+t);let i=2*e;for(;t.length<i;)t="0"+t;return(this.isNeg()?"-":"")+t}static fromJSON(e){return new A(e,16)}static fromNumber(e){return new A(e)}static fromString(e,t){return new A(e,t)}static fromSm(e,t="big"){let i;if(0===e.length)return new A(0n);let r=e.slice();"little"===t&&r.reverse();let n=0;if(r.length>0&&(128&r[0])!=0&&(n=1,r[0]&=127),E)i=S.from(r).toString("hex");else for(let e of(i="",r))i+=e<16?"0"+e.toString(16):e.toString(16);let s=0===i.length?0n:BigInt("0x"+i),a=new A(0n);return a._initializeState(s,n),a}toSm(e="big"){let t;if(0n===this._magnitude)return 1===this._sign?[128]:[];let i=this._getMinimalHex();i.length%2!=0&&(i="0"+i);let r=Array(i.length/2);for(let e=0,t=0;e<i.length;e+=2){let n=x[i.codePointAt(e)],s=x[i.codePointAt(e+1)];r[t++]=(15&n)<<4|15&s}return 1===this._sign?(128&r[0])==0?(t=r.slice(),t[0]|=128):t=[128,...r]:t=(128&r[0])==0?r.slice():[0,...r],"little"===e?t.reverse():t}static fromBits(e,t=!1){let i=e>>>24,r=8388607&e,n=(8388608&e)!=0;if(t&&n)throw Error("negative bit set");if(0===i&&0===r){if(n&&t)throw Error("negative bit set for zero value");return new A(0n)}let s=new A(r);return i<=3?s.iushrn((3-i)*8):s.iushln((i-3)*8),n&&s.ineg(),s}toBits(){let e;if(this.strip(),this.isZero()&&!this.isNeg())return 0;let t=this.isNeg(),i=this.abs(),r=i.toArray("be"),n=0;for(;n<r.length-1&&0===r[n];)n++;let s=(r=r.slice(n)).length;if(0!==s||i.isZero()||(r=[0],s=1),i.isZero()&&(s=0,r=[]),0===s)e=0;else if(s<=3){e=0;for(let t=0;t<s;t++)e=e<<8|r[t]}else e=r[0]<<16|r[1]<<8|r[2];(8388608&e)!=0&&s<=255&&(e>>>=8,s++);let a=s<<24|e;return t&&(a|=8388608),a>>>0}static fromScriptNum(e,t=!1,i){if(void 0!==i&&e.length>i)throw Error("script number overflow");if(0===e.length)return new A(0n);if(t&&(127&e.at(-1))==0&&(e.length<=1||(128&e.at(-2))==0))throw Error("non-minimally encoded script number");return A.fromSm(e,"little")}toScriptNum(){return this.toSm("little")}_invmp(e){this.assert(0===e._sign,"p must not be negative for _invmp"),this.assert(!e.isZero(),"p must not be zero for _invmp");let t=this.umod(e),i=e.subn(2);if(null!==t.red)return t.redPow(i);let r=new A(1n),n=t.clone(),s=i.clone();for(;!s.isZero();)s.isOdd()&&(r=r.mul(n).umod(e)),n=n.sqr().umod(e),s.iushrn(1);return r}mulTo(e,t){return t._magnitude=this._magnitude*e._magnitude,t._sign=0n===t._magnitude?0:this._sign^e._sign,t._nominalWordLength=this.length+e.length,t.red=null,t.normSign(),t}}class T{name;p;k;n;tmp;constructor(e,t){this.name=e,this.p=new A(t,16),this.n=this.p.bitLength(),this.k=new A(BigInt(1)).iushln(this.n).isub(this.p),this.tmp=this._tmp()}_tmp(){let e=new A(BigInt(0)),t=Math.ceil(this.n/A.wordSize);return e.expand(Math.max(1,t)),e}ireduce(e){let t;do this.split(e,this.tmp),this.imulK(e),e.iadd(this.tmp),t=e.bitLength();while(t>this.n);let i=t<this.n?-1:e.ucmp(this.p);return 0===i?e.words=[0]:i>0&&e.isub(this.p),e.strip(),e}split(e,t){e.iushrn(this.n,0,t)}imulK(e){return e.imul(this.k)}}class O extends T{constructor(){super("k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}split(e,t){let i=e.words,r=e.length,n=Math.min(r,9),s=Array(n+ +(r>9)).fill(0);for(let e=0;e<n;e++)s[e]=i[e];let a=n;if(r<=9){let i=Array(a);for(let e=0;e<a;++e)i[e]=s[e];t.words=i,e.words=[0];return}let o=i[9];s[a++]=4194303&o;let l=Array(a);for(let e=0;e<a;++e)l[e]=s[e];t.words=l;let c=Array(Math.max(1,r-9)).fill(0),h=0;for(let e=10;e<r;e++){let t=Math.trunc(i[e]);h<c.length&&(c[h++]=(4194303&t)<<4|o>>>22),o=t}o>>>=22,h<c.length?c[h++]=o:0!==o&&c.length;let d=Array(h);for(let e=0;e<h;++e)d[e]=c[e];e.words=d}imulK(e){let t=e.words,i=e.length,r=i+2,n=Array(r).fill(0);for(let e=0;e<i;e++)n[e]=t[e];let s=0;for(let e=0;e<r;e++){let t=Math.trunc(n[e]);s+=977*t,n[e]=0x3ffffff&s,s=64*t+Math.trunc(s/0x4000000)}return e.words=n,e}}class P{prime;m;constructor(e){if("k256"===e){const e=new O;this.m=e.p,this.prime=e}else this.assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}assert(e,t="Assertion failed"){if(!e)throw Error(t)}verify1(e){this.assert(0===e.negative,"red works only with positives"),this.assert(e.red,"red works only with red numbers")}verify2(e,t){this.assert((e.negative|t.negative)==0,"red works only with positives"),this.assert(null!=e.red&&e.red===t.red,"red works only with red numbers")}imod(e){return null!=this.prime?this.prime.ireduce(e).forceRed(this):(A.move(e,e.umod(this.m).forceRed(this)),e)}neg(e){return e.isZero()?e.clone():this.m.sub(e).forceRed(this)}add(e,t){this.verify2(e,t);let i=e.clone();return i.iadd(t),i.isub(this.m),i.isNeg()&&i.iadd(this.m),i}iadd(e,t){return this.verify2(e,t),e.iadd(t),e.isub(this.m),e.isNeg()&&e.iadd(this.m),e}sub(e,t){this.verify2(e,t);let i=e.sub(t);return 0>i.cmpn(0)&&i.iadd(this.m),i.forceRed(this)}isub(e,t){this.verify2(e,t);let i=e.isub(t);return 0>i.cmpn(0)&&i.iadd(this.m),i}shl(e,t){return this.verify1(e),this.imod(e.ushln(t))}imul(e,t){return this.verify2(e,t),this.imod(e.imul(t))}mul(e,t){return this.verify2(e,t),this.imod(e.mul(t))}isqr(e){return this.imul(e,e.clone())}sqr(e){return this.mul(e,e)}sqrt(e){if(e.isZero())return e.clone();let t=this.m.andln(3);if(this.assert(t%2==1),3===t){let t=this.m.add(new A(1)).iushrn(2);return this.pow(e,t)}let i=this.m.subn(1),r=0;for(;!i.isZero()&&0===i.andln(1);)r++,i.iushrn(1);this.assert(!i.isZero());let n=new A(1).toRed(this),s=n.redNeg(),a=this.m.subn(1).iushrn(1),o=this.m.bitLength(),l=new A(2*o*o).toRed(this);for(;0!==this.pow(l,a).cmp(s);)l.redIAdd(s);let c=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),u=r;for(;0!==d.cmp(n);){let e=d,t=0;for(;0!==e.cmp(n);t++)e=e.redSqr();this.assert(t<u);let i=this.pow(c,new A(1).iushln(u-t-1));h=h.redMul(i),c=i.redSqr(),d=d.redMul(c),u=t}return h}invm(e){let t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)}pow(e,t){if(this.verify1(e),t.isZero())return new A(1).toRed(this);let i=new A(1).toRed(this),r=e.clone(),n=t.bitLength();for(let e=n-1;e>=0;e--)i=this.sqr(i),t.testn(e)&&(i=this.mul(i,r));return i}convertTo(e){let t=e.umod(this.m);return t===e?t.clone():t}convertFrom(e){let t=e.clone();return t.red=null,t}}class N extends P{shift;r;r2;rinv;minv;constructor(e){super(e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new A(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)}convertTo(e){return this.imod(e.ushln(this.shift))}convertFrom(e){let t=this.imod(e.mul(this.rinv));return t.red=null,t}imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;let i=e.imul(t),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s.forceRed(this)}mul(e,t){if(e.isZero()||t.isZero())return new A(0).forceRed(this);let i=e.mul(t),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s.forceRed(this)}invm(e){return this.imod(e._invmp(this.m).mul(this.r2)).forceRed(this)}}class _{curve;type;precomputed;constructor(e){this.curve=new t1,this.type=e,this.precomputed=null}}class R extends _{x;y;z;zOne;constructor(e,t,i){super("jacobian"),null===e&&null===t&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new A(0)):(A.isBN(e)||(e=new A(e,16)),this.x=e,A.isBN(t)||(t=new A(t,16)),this.y=t,A.isBN(i)||(i=new A(i,16)),this.z=i),null==this.x.red&&(this.x=this.x.toRed(this.curve.red)),null==this.y.red&&(this.y=this.y.toRed(this.curve.red)),null==this.z.red&&(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.isInfinity()&&(this.x=this.curve.one,this.y=this.curve.one,this.z=new A(0).toRed(this.curve.red),this.zOne=!1)}toP(){if(this.isInfinity())return new t0(null,null);let e=this.z.redInvm(),t=e.redSqr();return new t0(this.x.redMul(t),this.y.redMul(t).redMul(e))}neg(){return new R(this.x,this.y.redNeg(),this.z)}add(e){if(this.isInfinity())return e;if(e.isInfinity())return this;let t=e.z.redSqr(),i=this.z.redSqr(),r=this.x.redMul(t),n=e.x.redMul(i),s=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),o=r.redSub(n),l=s.redSub(a);if(0===o.cmpn(0))if(0===l.cmpn(0))return this.dbl();else return new R(null,null,null);let c=o.redSqr(),h=c.redMul(o),d=r.redMul(c),u=l.redSqr().redIAdd(h).redISub(d).redISub(d),f=l.redMul(d.redISub(u)).redISub(s.redMul(h));return new R(u,f,this.z.redMul(e.z).redMul(o))}mixedAdd(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;if(null===e.x||null===e.y)throw Error("Point coordinates cannot be null");let t=this.z.redSqr(),i=this.x,r=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),a=i.redSub(r),o=n.redSub(s);if(0===a.cmpn(0))if(0===o.cmpn(0))return this.dbl();else return new R(null,null,null);let l=a.redSqr(),c=l.redMul(a),h=i.redMul(l),d=o.redSqr().redIAdd(c).redISub(h).redISub(h),u=o.redMul(h.redISub(d)).redISub(n.redMul(c));return new R(d,u,this.z.redMul(a))}dblp(e){if(0===e||this.isInfinity())return this;if(void 0===e)return this.dbl();let t=this;for(let i=0;i<e;i++)t=t.dbl();return t}dbl(){let e,t,i;if(this.isInfinity())return this;if(this.zOne){let r=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(r).redISub(s);a=a.redIAdd(a);let o=r.redAdd(r).redIAdd(r),l=o.redSqr().redISub(a).redISub(a),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l,t=o.redMul(a.redISub(l)).redISub(c),i=this.y.redAdd(this.y)}else{let r=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(r).redISub(s);a=a.redIAdd(a);let o=r.redAdd(r).redIAdd(r),l=o.redSqr(),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l.redISub(a).redISub(a),t=o.redMul(a.redISub(e)).redISub(c),i=(i=this.y.redMul(this.z)).redIAdd(i)}return new R(e,t,i)}eq(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e||this.isInfinity()&&e.isInfinity())return!0;if(this.isInfinity()!==e.isInfinity())return!1;let t=this.z.redSqr(),i=e.z.redSqr();if(0!==this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0))return!1;let r=t.redMul(this.z),n=i.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(r)).cmpn(0)}eqXToP(e){let t=this.z.redSqr(),i=e.toRed(this.curve?.red).redMul(t);if(0===this.x.cmp(i))return!0;let r=e.clone();if(this.curve?.redN==null)throw Error("Curve or redN is not initialized.");let n=this.curve.redN.redMul(t);for(;0>r.cmp(this.curve.p)&&(r.iadd(this.curve.n),!(r.cmp(this.curve.p)>=0));)if(i.redIAdd(n),0===this.x.cmp(i))return!0;return!1}inspect(){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)+">"}isInfinity(){return 0===this.z.cmpn(0)}}let C=/^[0-9a-fA-F]*$/;function B(e){if("string"!=typeof e)throw TypeError("Invalid hex string");if(0!==e.length&&!C.test(e))throw Error("Invalid hex string")}let U=(e,t="Hash assertion failed")=>{if(!e)throw Error(t)};class F{pending;pendingTotal;blockSize;outSize;endian;_delta8;_delta32;padLength;hmacStrength;constructor(e,t,i,r){this.pending=null,this.pendingTotal=0,this.blockSize=e,this.outSize=t,this.hmacStrength=i,this.padLength=r/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_update(e,t){throw Error("Not implemented")}_digest(){throw Error("Not implemented")}_digestHex(){throw Error("Not implemented")}update(e,t){if(e=D(e,t),null==this.pending?this.pending=e:this.pending=this.pending.concat(e),this.pendingTotal+=e.length,this.pending.length>=this._delta8){let t=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-t,e.length),0===this.pending.length&&(this.pending=null),e=function(e,t,i){let r=t-0;U(r%4==0);let n=Array(r/4);for(let t=0,r=0;t<n.length;t++,r+=4){let s;s="big"===i?e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]:e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r],n[t]=s>>>0}return n}(e,e.length-t,this.endian);for(let t=0;t<e.length;t+=this._delta32)this._update(e,t)}return this}digest(){return this.update(this._pad()),U(null===this.pending),this._digest()}digestHex(){return this.update(this._pad()),U(null===this.pending),this._digestHex()}_pad(){let e,t=this.pendingTotal;if(!Number.isSafeInteger(t)||t<0)throw Error("Message too long for this hash function");let i=this._delta8,r=i-(t+this.padLength)%i,n=Array(r+this.padLength);for(n[0]=128,e=1;e<r;e++)n[e]=0;let s=this.padLength,a=1n<<BigInt(8*s),o=8n*BigInt(t);if(o>=a)throw Error("Message too long for this hash function");if("big"===this.endian){let t=Array(s);for(let e=s-1;e>=0;e--)t[e]=Number(255n&o),o>>=8n;for(let i=0;i<s;i++)n[e++]=t[i]}else for(let t=0;t<s;t++)n[e++]=Number(255n&o),o>>=8n;return n}}function D(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];if("string"==typeof e)return"hex"===t?function(e){B(e);let t=function(e){if(B(e),0===e.length)return"";let t=e.toLowerCase();return t.length%2!=0&&(t="0"+t),t}(e),i=[];for(let e=0;e<t.length;e+=2)i.push(Number.parseInt(t[e]+t[e+1],16));return i}(e):function(e){let t=[];for(let i=0;i<e.length;i++)i=function(e,t,i){let r=e.charCodeAt(t);return r<128?(i.push(r),t):r<2048?(i.push(r>>6|192,63&r|128),t):(64512&e.charCodeAt(t))!=55296||t<0||t+1>=e.length||(64512&e.charCodeAt(t+1))!=56320?(i.push(r>>12|224,r>>6&63|128,63&r|128),t):(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(t+1)),i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128),t+1)}(e,i,t);return t}(e);let i=[];for(let t=0;t<e.length;t++)i[t]=Math.trunc(e[t]);return i}function L(e){return ts(e)}function V(e,t){let i="";for(let r of e)"little"===t&&(r=ts(r)),i+=function(e){if(7===e.length)return"0"+e;if(6===e.length)return"00"+e;if(5===e.length)return"000"+e;if(4===e.length)return"0000"+e;if(3===e.length)return"00000"+e;else if(2===e.length)return"000000"+e;else if(1===e.length)return"0000000"+e;else return e}(r.toString(16));return i}let H="u"<typeof globalThis?void 0:globalThis.Buffer,M=null!=H&&"function"==typeof H.from,K="0123456789abcdef",q=Array(256);for(let e=0;e<q.length;e++)q[e]=K[e>>4&15]+K[15&e];let $=(()=>{let e="u"<typeof globalThis?void 0:globalThis.process,t=e?.getBuiltinModule;if("function"==typeof t)try{let i=t.call(e,"node:crypto");if(null!=i)return i}catch{}try{if("function"==typeof require)return require("node:crypto")}catch{}})();function z(e,t){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):Uint8Array.from(D(e,t))}function W(e){return"string"==typeof e?z(e,"hex"):z(e)}function j(e,t,i){null!=e?e.update(i):null!=t&&t.update(i)}function G(e,t){return null!=e?Array.from(e.digest()):null!=t?Array.from(t.digest()):[]}function X(e,t){if(null!=e)return e.digest("hex");if(null!=t){var i=t.digest();if(M)return H.from(i).toString("hex");let e=Array(i.length);for(let t=0;t<i.length;t++)e[t]=q[i[t]];return e.join("")}return""}function Y(e){let t=$?.createHash;if("function"==typeof t)try{return t(e)}catch{return}}function J(e,t){let i=$?.createHmac;if("function"==typeof i)try{return i(e,t)}catch{return}}function Z(e,t,i){let r=Y(e);if(null!=r)return r.update(z(t,i)),r.digest()}function Q(e,t,i,r){let n=J(e,W(t));if(null!=n)return n.update(z(i,r)),n.digest()}function ee(e,t){let i=Array(4*e.length);for(let r=0,n=0;r<e.length;r++,n+=4){let s=e[r];"big"===t?(i[n]=s>>>24,i[n+1]=s>>>16&255,i[n+2]=s>>>8&255,i[n+3]=255&s):(i[n+3]=s>>>24,i[n+2]=s>>>16&255,i[n+1]=s>>>8&255,i[n]=255&s)}return i}function et(e,t){return e>>>t|e<<32-t}function ei(e,t){return e<<t|e>>>32-t}function er(e,t){return e+t>>>0}let en=[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],es=[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],ea=[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],eo=[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];function el(e,t,i,r){return e<=15?t^i^r:e<=31?t&i|~t&r:e<=47?(t|~i)^r:e<=63?t&r|i&~r:t^(i|~r)}class ec extends F{h;constructor(){super(512,160,192,64),this.endian="little",this.h=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],this.endian="little"}_update(e,t){var i,r,n,s,a,o;let l,c=this.h[0],h=this.h[1],d=this.h[2],u=this.h[3],f=this.h[4],p=c,g=h,y=d,m=u,b=f;for(let w=0;w<80;w++){l=er(ei((i=c,r=el(w,h,d,u),i+r+e[en[w]+t]+((a=w)<=15?0:a<=31?0x5a827999:a<=47?0x6ed9eba1:a<=63?0x8f1bbcdc:0xa953fd4e)>>>0),ea[w]),f),c=f,f=u,u=ei(d,10),d=h,h=l,l=er(ei((n=p,s=el(79-w,g,y,m),n+s+e[es[w]+t]+((o=w)<=15?0x50a28be6:o<=31?0x5c4dd124:o<=47?0x6d703ef3:0x7a6d76e9*!!(o<=63))>>>0),eo[w]),b),p=b,b=m,m=ei(y,10),y=g,g=l}l=this.h[1]+d+m>>>0,this.h[1]=this.h[2]+u+b>>>0,this.h[2]=this.h[3]+f+p>>>0,this.h[3]=this.h[4]+c+g>>>0,this.h[4]=this.h[0]+h+y>>>0,this.h[0]=l}_digest(){return ee(this.h,"little")}_digestHex(){return V(this.h,"little")}}class eh{h;native;constructor(){this.native=Y("sha256"),null==this.native&&(this.h=new e2)}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}class ed extends F{h;W;k;constructor(){super(512,160,80,64),this.k=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6],this.h=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],this.W=Array(80)}_update(e,t){let i,r=this.W;for(void 0===t&&(t=0),i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=ei(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);let n=this.h[0],s=this.h[1],a=this.h[2],o=this.h[3],l=this.h[4];for(i=0;i<r.length;i++){var c,h,d,u,f,p,g,y,m;let e=Math.trunc(i/20),t=(u=ei(n,5),c=s,h=a,d=o,f=0===e?(p=c)&h^~p&d:1===e||3===e?c^h^d:2===e?(g=c)&(y=h)^g&(m=d)^y&m:0,u+f+l+r[i]+this.k[e]>>>0);l=o,o=a,a=ei(s,30),s=n,n=t}this.h[0]=er(this.h[0],n),this.h[1]=er(this.h[1],s),this.h[2]=er(this.h[2],a),this.h[3]=er(this.h[3],o),this.h[4]=er(this.h[4],l)}_digest(){return ee(this.h,"big")}_digestHex(){return V(this.h,"big")}}class eu{h;native;constructor(){this.native=Y("sha512"),null==this.native&&(this.h=new te)}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}class ef{h;native;blockSize=64;outSize=32;constructor(e){const t=W(e);this.native=J("sha256",t),null==this.native&&(this.h=new ti(e8,t))}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}class ep{inner;outer;blockSize=64;constructor(e){let t;for((e=D(e,"hex")).length>this.blockSize&&(e=new ed().update(e).digest()),t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new ed().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new ed().update(e)}update(e,t){return this.inner.update(e,t),this}digest(){return this.outer.update(this.inner.digest()),this.outer.digest()}digestHex(){return this.outer.update(this.inner.digest()),this.outer.digestHex()}}class eg{h;native;blockSize=128;outSize=32;constructor(e){const t=W(e);this.native=J("sha512",t),null==this.native&&(this.h=new ti(tt,t))}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}function ey(e,t){let i=Z("sha256",e,t);return null!=i?i:new e2().update(z(e,t)).digest()}function em(e,t){return Z("ripemd160",e,t)}let eb=(e,t)=>{let i=em(e,t);return null!=i?Array.from(i):new ec().update(e,t).digest()},ew=(e,t)=>new ed().update(e,t).digest(),ev=(e,t)=>Array.from(ey(e,t)),eI=(e,t)=>{let i;return Array.from(null!=(i=Z("sha512",e,t))?i:new te().update(z(e,t)).digest())},ek=(e,t)=>Array.from(ey(ey(e,t))),eS=(e,t)=>{let i=ey(e,t),r=em(i);return null!=r?Array.from(r):new ec().update(i).digest()},eE=(e,t,i)=>{let r=Q("sha256",e,t,i);return null!=r?Array.from(r):new ef(e).update(t,i).digest()},ex=(e,t,i)=>{let r=Q("sha512",e,t,i);return null!=r?Array.from(r):new eg(e).update(t,i).digest()};function eA(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got ${e}`)}function eT(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length)){let i=t.join(",");throw Error(`Uint8Array expected of length ${i}, got length=${e.length}`)}}function eO(e){if("function"!=typeof e||"function"!=typeof e.create)throw TypeError("Hash should be wrapped by utils.createHasher");eA(e.outputLen),eA(e.blockLen)}function eP(e,t=!0){if(!0===e.destroyed)throw Error("Hash instance has been destroyed");if(t&&!0===e.finished)throw Error("Hash#digest() has already been called")}function eN(...e){for(let t of e)t.fill(0)}function e_(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function eR(e){return"string"==typeof e&&(e=eC(e)),eT(e),e}function eC(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function eB(e){return"string"==typeof e&&(e=eC(e)),eT(e),e}class eU{}function eF(e){let t=t=>e().update(eR(t)).digest(),i=e();return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=()=>e(),t}let eD=BigInt(0x100000000-1),eL=BigInt(32),eV=(e,t,i)=>e>>>i,eH=(e,t,i)=>e<<32-i|t>>>i,eM=(e,t,i)=>e>>>i|t<<32-i,eK=(e,t,i)=>e<<32-i|t>>>i,eq=(e,t,i)=>e<<64-i|t>>>i-32,e$=(e,t,i)=>e>>>i-32|t<<64-i;function ez(e,t,i,r){let n=(t>>>0)+(r>>>0);return{h:e+i+(n/0x100000000|0)|0,l:0|n}}let eW=(e,t,i)=>(e>>>0)+(t>>>0)+(i>>>0),ej=(e,t,i,r)=>t+i+r+(e/0x100000000|0)|0,eG=(e,t,i,r)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),eX=(e,t,i,r,n)=>t+i+r+n+(e/0x100000000|0)|0,eY=(e,t,i,r,n)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0)+(n>>>0),eJ=(e,t,i,r,n,s)=>t+i+r+n+s+(e/0x100000000|0)|0;class eZ extends eU{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,i,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(e),this.view=e_(this.buffer)}update(e){eP(this),eT(e=eR(e));let{view:t,buffer:i,blockLen:r}=this,n=e.length;for(let s=0;s<n;){let a=Math.min(r-this.pos,n-s);if(a===r){let t=e_(e);for(;r<=n-s;s+=r)this.process(t,s);continue}i.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){eP(this);eT(e);let t=this.outputLen;if(e.length<t)throw Error(`digestInto() expects output buffer of length at least ${t}`);this.finished=!0;let{buffer:i,view:r,blockLen:n,isLE:s}=this,{pos:a}=this;i[a++]=128,eN(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)i[e]=0;(function(e,t,i,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,i,r);let n=BigInt(32),s=BigInt(0xffffffff),a=Number(i>>n&s),o=Number(i&s),l=4*!!r,c=4*!r;e.setUint32(t+l,a,r),e.setUint32(t+c,o,r)})(r,n-8,BigInt(8*this.length),s),this.process(r,0);let o=e_(e),l=this.outputLen;if(l%4!=0)throw Error("_sha2: outputLen should be aligned to 32bit");let c=l/4,h=this.get();if(c>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,h[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){(e||=new this.constructor).set(...this.get());let{blockLen:t,buffer:i,length:r,finished:n,destroyed:s,pos:a}=this;return e.destroyed=s,e.finished=n,e.length=r,e.pos=a,r%t!=0&&e.buffer.set(i),e}clone(){return this._cloneInto()}}let eQ=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),e0=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),e1=new Uint32Array(64);class e2 extends eZ{A=0|eQ[0];B=0|eQ[1];C=0|eQ[2];D=0|eQ[3];E=0|eQ[4];F=0|eQ[5];G=0|eQ[6];H=0|eQ[7];constructor(e=32){super(64,e,8,!1)}get(){let{A:e,B:t,C:i,D:r,E:n,F:s,G:a,H:o}=this;return[e,t,i,r,n,s,a,o]}set(e,t,i,r,n,s,a,o){this.A=0|e,this.B=0|t,this.C=0|i,this.D=0|r,this.E=0|n,this.F=0|s,this.G=0|a,this.H=0|o}process(e,t){var i,r,n,s,a,o,l,c,h;for(let i=0;i<16;i++,t+=4)e1[i]=e.getUint32(t);for(let e=16;e<64;e++){let t=e1[e-15],i=e1[e-2],r=et(t,7)^et(t,18)^t>>>3,n=et(i,17)^et(i,19)^i>>>10;e1[e]=er(er(r,e1[e-7]),er(n,e1[e-16]))}let{A:d,B:u,C:f,D:p,E:g,F:y,G:m,H:b}=this;for(let e=0;e<64;e++){let t=(n=b,s=et(i=g,6)^et(i,11)^et(i,25),a=(r=g)&y^~r&m,n+s+a+e0[e]+e1[e]>>>0),w=er(et(o=d,2)^et(o,13)^et(o,22),(l=d)&(c=u)^l&(h=f)^c&h);b=m,m=y,y=g,g=er(p,t),p=f,f=u,u=d,d=er(t,w)}this.A=er(this.A,d),this.B=er(this.B,u),this.C=er(this.C,f),this.D=er(this.D,p),this.E=er(this.E,g),this.F=er(this.F,y),this.G=er(this.G,m),this.H=er(this.H,b)}roundClean(){eN(e1)}destroy(){eN(this.buffer),this.set(0,0,0,0,0,0,0,0)}}let e8=eF(()=>new e2),e3=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),e5=function(e,t=!1){let i=e.length,r=new Uint32Array(i),n=new Uint32Array(i);for(let s=0;s<i;s++){let{h:i,l:a}=function(e,t=!1){return t?{h:Number(e&eD),l:Number(e>>eL&eD)}:{h:0|Number(e>>eL&eD),l:0|Number(e&eD)}}(e[s],t);r[s]=i,n[s]=a}return[r,n]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(BigInt)),e6=e5[0],e4=e5[1],e9=new Uint32Array(80),e7=new Uint32Array(80);class te extends eZ{Ah=0|e3[0];Al=0|e3[1];Bh=0|e3[2];Bl=0|e3[3];Ch=0|e3[4];Cl=0|e3[5];Dh=0|e3[6];Dl=0|e3[7];Eh=0|e3[8];El=0|e3[9];Fh=0|e3[10];Fl=0|e3[11];Gh=0|e3[12];Gl=0|e3[13];Hh=0|e3[14];Hl=0|e3[15];constructor(e=64){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:i,Bl:r,Ch:n,Cl:s,Dh:a,Dl:o,Eh:l,El:c,Fh:h,Fl:d,Gh:u,Gl:f,Hh:p,Hl:g}=this;return[e,t,i,r,n,s,a,o,l,c,h,d,u,f,p,g]}set(e,t,i,r,n,s,a,o,l,c,h,d,u,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|i,this.Bl=0|r,this.Ch=0|n,this.Cl=0|s,this.Dh=0|a,this.Dl=0|o,this.Eh=0|l,this.El=0|c,this.Fh=0|h,this.Fl=0|d,this.Gh=0|u,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let i=0;i<16;i++,t+=8)e9[i]=e.getUint32(t),e7[i]=e.getUint32(t+4);for(let e=16;e<80;e++){let t=0|e9[e-15],i=0|e7[e-15],r=eM(t,i,1)^eM(t,i,8)^eV(t,i,7),n=eK(t,i,1)^eK(t,i,8)^eH(t,i,7),s=0|e9[e-2],a=0|e7[e-2],o=eM(s,a,19)^eq(s,a,61)^eV(s,a,6),l=eG(n,eK(s,a,19)^e$(s,a,61)^eH(s,a,6),e7[e-7],e7[e-16]),c=eX(l,r,o,e9[e-7],e9[e-16]);e9[e]=0|c,e7[e]=0|l}let{Ah:i,Al:r,Bh:n,Bl:s,Ch:a,Cl:o,Dh:l,Dl:c,Eh:h,El:d,Fh:u,Fl:f,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let e=0;e<80;e++){let t=eM(h,d,14)^eM(h,d,18)^eq(h,d,41),b=eK(h,d,14)^eK(h,d,18)^e$(h,d,41),w=h&u^~h&p,v=eY(m,b,d&f^~d&g,e4[e],e7[e]),I=eJ(v,y,t,w,e6[e],e9[e]),k=0|v,S=eM(i,r,28)^eq(i,r,34)^eq(i,r,39),E=eK(i,r,28)^e$(i,r,34)^e$(i,r,39),x=i&n^i&a^n&a,A=r&s^r&o^s&o;y=0|p,m=0|g,p=0|u,g=0|f,u=0|h,f=0|d,({h:h,l:d}=ez(0|l,0|c,0|I,0|k)),l=0|a,c=0|o,a=0|n,o=0|s,n=0|i,s=0|r;let T=eW(E,A,k);i=ej(T,S,x,I),r=0|T}({h:i,l:r}=ez(i,r,this.Ah,this.Al)),({h:n,l:s}=ez(n,s,this.Bh,this.Bl)),({h:a,l:o}=ez(a,o,this.Ch,this.Cl)),({h:l,l:c}=ez(l,c,this.Dh,this.Dl)),({h:h,l:d}=ez(h,d,this.Eh,this.El)),({h:u,l:f}=ez(u,f,this.Fh,this.Fl)),({h:p,l:g}=ez(p,g,this.Gh,this.Gl)),({h:y,l:m}=ez(y,m,this.Hh,this.Hl)),this.set(i,r,n,s,a,o,l,c,h,d,u,f,p,g,y,m)}roundClean(){eN(e9,e7)}destroy(){eN(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let tt=eF(()=>new te);class ti extends eU{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){super(),eO(e);const i=eR(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(i.length>r?e.create().update(i).digest():i);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),eN(n)}update(e){return eP(this),this.iHash.update(e),this}digestInto(e){eP(this),eT(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:i,finished:r,destroyed:n,blockLen:s,outputLen:a}=this;return e.finished=r,e.destroyed=n,e.blockLen=s,e.outputLen=a,e.oHash=t._cloneInto(e.oHash??void 0),e.iHash=i._cloneInto(e.iHash??void 0),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let tr=(e,t,i)=>new ti(e,t).update(i).digest();function tn(e,t,i,r,n="sha512"){if("sha512"!==n)throw Error("Only sha512 is supported in this PBKDF2 implementation");let s=$?.pbkdf2Sync;return"function"==typeof s?Array.from(s(z(e),z(t),i,r,n)):Array.from(function(e,t,i,r){let n;eO(e);let{c:s,dkLen:a}=Object.assign({dkLen:32},r);if(eA(s),eA(a),s<1)throw Error("iterations (c) should be >= 1");let o=eB(t),l=eB(i),c=new Uint8Array(a),h=tr.create(e,o),d=h._cloneInto().update(l),u=new Uint8Array(4),f=e_(u),p=new Uint8Array(h.outputLen);for(let e=1,t=0;t<a;e++,t+=h.outputLen){let i=c.subarray(t,t+h.outputLen);f.setInt32(0,e,!1),(n=d._cloneInto(n)).update(u).digestInto(p),i.set(p.subarray(0,i.length));for(let e=1;e<s;e++){h._cloneInto(n).update(p).digestInto(p);for(let e=0;e<i.length;e++)i[e]^=p[e]}}return h.destroy(),d.destroy(),null!=n&&n.destroy(),eN(p),c}(tt,Uint8Array.from(e),Uint8Array.from(t),{c:i,dkLen:r}))}function ts(e){return(e>>>24|e>>>8&65280|e<<8&0xff0000|(255&e)<<24)>>>0}tr.create=(e,t)=>new ti(e,t);let ta=(i=new Uint32Array(t=new ArrayBuffer(4)),r=new Uint8Array(t),i[0]=0x1020304,4===r[0]);function to(e){return ta?ts(e):e>>>0}class tl{buffer;pos;capacity;constructor(e,t=256){if(null!=e&&e.length>0&&(t=Math.max(t,e.reduce((e,t)=>e+t.length,0))),this.buffer=new Uint8Array(t),this.pos=0,this.capacity=t,null!=e)for(const t of e)this.write(t)}getLength(){return this.pos}toUint8Array(){return this.buffer.slice(0,this.pos)}toArray(){return Array.from(this.toUint8Array())}toUint8ArrayZeroCopy(){return this.buffer.subarray(0,this.pos)}ensureCapacity(e){if(this.pos+e>this.capacity){let t=2*this.capacity;for(;this.pos+e>t;)t*=2;let i=new Uint8Array(t);i.set(this.buffer),this.buffer=i,this.capacity=t}}write(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}writeReverse(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);this.ensureCapacity(t.length);for(let e=t.length-1;e>=0;e--)this.buffer[this.pos]=t[e],this.pos+=1;return this}writeUInt8(e){return this.ensureCapacity(1),this.buffer[this.pos]=255&e,this.pos+=1,this}writeInt8(e){return this.writeUInt8(e),this}writeUInt16LE(e){return this.ensureCapacity(2),this.buffer[this.pos]=255&e,this.buffer[this.pos+1]=e>>8&255,this.pos+=2,this}writeUInt16BE(e){return this.ensureCapacity(2),this.buffer[this.pos]=e>>8&255,this.buffer[this.pos+1]=255&e,this.pos+=2,this}writeInt16LE(e){return this.writeUInt16LE(65535&e),this}writeInt16BE(e){return this.writeUInt16BE(65535&e),this}writeUInt32LE(e){return this.ensureCapacity(4),this.buffer[this.pos]=255&e,this.buffer[this.pos+1]=e>>8&255,this.buffer[this.pos+2]=e>>16&255,this.buffer[this.pos+3]=e>>24&255,this.pos+=4,this}writeUInt32BE(e){return this.ensureCapacity(4),this.buffer[this.pos]=e>>24&255,this.buffer[this.pos+1]=e>>16&255,this.buffer[this.pos+2]=e>>8&255,this.buffer[this.pos+3]=255&e,this.pos+=4,this}writeInt32LE(e){return this.writeUInt32LE(e>>>0),this}writeInt32BE(e){return this.writeUInt32BE(e>>>0),this}writeUInt64BEBn(e){let t=e.toArray("be",8);return this.write(t),this}writeUInt64LEBn(e){let t=e.toArray("be",8);return this.writeReverse(t),this}writeUInt64LE(e){let t=new A(e).toArray("be",8);return this.writeReverse(t),this}writeVarIntNum(e){let t=tP.varIntNum(e);return this.write(t),this}writeVarIntBn(e){let t=tP.varIntBn(e);return this.write(t),this}reset(){this.pos=0}}class tc{bin;pos;length;static makeReader(e,t=0){if(e instanceof Uint8Array)return new tc(e,t);if(Array.isArray(e))return new tN(e,t);throw Error("ReaderUint8Array.makeReader: bin must be Uint8Array or number[]")}constructor(e=new Uint8Array(0),t=0){if(e instanceof Uint8Array)this.bin=e;else if(Array.isArray(e))this.bin=new Uint8Array(e);else throw TypeError("ReaderUint8Array constructor: bin must be Uint8Array or number[]");this.pos=t,this.length=this.bin.length}eof(){return this.pos>=this.length}read(e=this.length){let t=this.pos,i=this.pos+e;return this.pos=i,this.bin.slice(t,i)}readReverse(e=this.length){let t=new Uint8Array(e);for(let i=0;i<e;i++)t[i]=this.bin[this.pos+e-1-i];return this.pos+=e,t}readUInt8(){let e=this.bin[this.pos];return this.pos+=1,e}readInt8(){let e=this.bin[this.pos];return this.pos+=1,(128&e)==0?e:e-256}readUInt16BE(){let e=this.bin[this.pos]<<8|this.bin[this.pos+1];return this.pos+=2,e}readInt16BE(){let e=this.readUInt16BE();return(32768&e)==0?e:e-65536}readUInt16LE(){let e=this.bin[this.pos]|this.bin[this.pos+1]<<8;return this.pos+=2,e}readInt16LE(){let e=this.readUInt16LE();return(32768&e)==0?e:e-65536}readUInt32BE(){let e=0x1000000*this.bin[this.pos]+(this.bin[this.pos+1]<<16|this.bin[this.pos+2]<<8|this.bin[this.pos+3]);return this.pos+=4,e}readInt32BE(){let e=this.readUInt32BE();return(0x80000000&e)==0?e:e-0x100000000}readUInt32LE(){let e=(this.bin[this.pos]|this.bin[this.pos+1]<<8|this.bin[this.pos+2]<<16|this.bin[this.pos+3]<<24)>>>0;return this.pos+=4,e}readInt32LE(){let e=this.readUInt32LE();return(0x80000000&e)==0?e:e-0x100000000}readUInt64BEBn(){let e=new A(Array.from(this.bin.slice(this.pos,this.pos+8)));return this.pos=this.pos+8,e}readUInt64LEBn(){return new A(Array.from(this.readReverse(8)))}readInt64LEBn(){let e=new A(2).pow(new A(63)),t=new A(2).pow(new A(64)),i=new A(Array.from(this.readReverse(8)));return i.gte(e)&&(i=i.sub(t)),i}readVarIntNum(e=!0){let t,i=this.readUInt8();switch(i){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:if((t=e?this.readInt64LEBn():this.readUInt64LEBn()).lte(new A(2).pow(new A(53))))return t.toNumber();throw Error("number too large to retain precision - use readVarIntBn");default:return i}}readVarInt(){switch(this.bin[this.pos]){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}}readVarIntBn(){let e=this.readUInt8();switch(e){case 253:return new A(this.readUInt16LE());case 254:return new A(this.readUInt32LE());case 255:return this.readUInt64LEBn();default:return new A(e)}}}let th="u"<typeof globalThis?void 0:globalThis.Buffer,td=null!=th&&"function"==typeof th.from,tu=e=>e.length%2==1?"0"+e:e,tf="0123456789abcdef",tp=Array(256);for(let e=0;e<256;e++)tp[e]=tf[e>>4&15]+tf[15&e];let tg=e=>{if(td)return th.from(e).toString("hex");if(0===e.length)return"";let t=Array(e.length);for(let i=0;i<e.length;i++)t[i]=tp[255&e[i]];return t.join("")},ty=(e,t)=>e instanceof Uint8Array?e:new Uint8Array(tm(e,t)),tm=(e,t)=>{if(Array.isArray(e))return e.slice();if(void 0===e)return[];if("string"!=typeof e)return Array.from(e,e=>Math.trunc(e));switch(t){case"hex":return tw(e);case"base64":return tv(e);default:var i;return i=e,Array.from(new TextEncoder().encode(i))}},tb=new Int8Array(256).fill(-1);for(let e=0;e<10;e++)tb[48+e]=e;for(let e=0;e<6;e++)tb[65+e]=10+e,tb[97+e]=10+e;let tw=e=>{B(e);let t=e.length%2==0?e:"0"+e;if(td)return Array.from(th.from(t,"hex"));let i=Array(t.length/2),r=0;for(let e=0;e<t.length;e+=2){let n=tb[t.codePointAt(e)],s=tb[t.codePointAt(e+1)];i[r++]=n<<4|s}return i};function tv(e){if("string"!=typeof e)throw TypeError("msg must be a string");let t=e.trim().replaceAll(/[\r\n\t\f\v ]+/g,""),i=(t=t.replaceAll("-","+").replaceAll("_","/")).indexOf("=");if(-1!==i){let e=t.slice(i);if(!/^={1,2}$/.test(e)||t.slice(0,i).includes("="))throw Error("Invalid base64 padding");t=t.slice(0,i)}let r=[],n=0,s=0;for(let e=0;e<t.length;e++){let i=t.codePointAt(e),a=-1;if(i>=65&&i<=90)a=i-65;else if(i>=97&&i<=122)a=i-97+26;else if(i>=48&&i<=57)a=i-48+52;else if(43===i)a=62;else if(47===i)a=63;else throw Error(`Invalid base64 character at index ${e}`);for(n=n<<6|a,s+=6;s>=8;)s-=8,r.push(n>>s&255),n&=(1<<s)-1}return r}let tI=e=>new TextDecoder().decode(new Uint8Array(e)),tk=(e,t)=>{switch(t){case"hex":return tg(e);case"utf8":return tI(e);default:return e}};function tS(e){let t,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="";for(t=0;t<e.length;t+=3){let n=e[t],s=t+1<e.length?e[t+1]:0,a=t+2<e.length?e[t+2]:0,o=n>>2,l=(3&n)<<4|s>>4,c=(15&s)<<2|a>>6,h=63&a;r+=i.charAt(o)+i.charAt(l),r+=t+1<e.length?i.charAt(c):"=",r+=t+2<e.length?i.charAt(h):"="}return r}let tE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",tx=e=>{let t;if(""===e||"string"!=typeof e)throw Error(`Expected base58 string but got “${e}”`);let i=e.match(/[IOl0]/gmu);if(null!==i)throw Error(`Invalid base58 character “${i.join("")}”`);let r=e.match(/^1+/gmu),n=null===r?0:r[0].length,s=(e.length-n)*(Math.log(58)/Math.log(256))+1>>>0;return[...new Uint8Array([...new Uint8Array(n),...(e.match(/./gmu)??[]).map(e=>tE.indexOf(e)).reduce((e,t)=>e=e.map(e=>{let i=58*e+t;return t=i>>8,i}),new Uint8Array(s)).reverse().filter((t=!1,e=>t=t||e))])]},tA=e=>{let t=Array(256).fill(-1);for(let e=0;e<tE.length;++e)t[tE.codePointAt(e)]=e;let i=[];for(let r of e){let e=r;for(let r=0;r<i.length;++r){let n=(t[i[r]]<<8)+e;i[r]=tE.codePointAt(n%58),e=Math.trunc(n/58)}for(;0!==e;)i.push(tE.codePointAt(e%58)),e=Math.trunc(e/58)}for(let t of e)if(0===t)i.push(49);else break;return i.reverse(),String.fromCodePoint(...i)},tT=(e,t=[0])=>{let i=ek([...t,...e]);return tA(i=[...t,...e,...i.slice(0,4)])},tO=(e,t,i=1)=>{let r=tx(e),n=r.slice(0,i),s=r.slice(i,-4),a=[...n,...s];return a=ek(a),r.slice(-4).forEach((e,t)=>{if(e!==a[t])throw Error("Invalid checksum")}),"hex"===t&&(n=tg(n),s=tg(s)),{prefix:n,data:s}};class tP{bufs;length;constructor(e){for(const t of(this.bufs=e??[],this.length=0,this.bufs))this.length+=t.length}getLength(){return this.length}toUint8Array(){let e=new Uint8Array(this.length),t=0;for(let i of this.bufs)e.set(i,t),t+=i.length;return e}toArray(){let e=Array(this.length),t=0;for(let i of this.bufs)if(i instanceof Uint8Array)for(let r of i)e[t++]=r;else for(let r of i)e[t++]=r;return e}toHex(){return this.toArray().map(e=>e.toString(16).padStart(2,"0")).join("")}write(e){return this.bufs.push(e),this.length+=e.length,this}writeReverse(e){let t=Array(e.length);for(let i=0;i<t.length;i++)t[i]=e[e.length-1-i];return this.write(t)}writeUInt8(e){let t=[,];return t[0]=255&e,this.write(t),this}writeInt8(e){return this.writeUInt8(e)}writeUInt16BE(e){return this.write([e>>8&255,255&e])}writeInt16BE(e){return this.writeUInt16BE(65535&e)}writeUInt16LE(e){return this.write([255&e,e>>8&255])}writeInt16LE(e){return this.writeUInt16LE(65535&e)}writeUInt32BE(e){return this.write([e>>24&255,e>>16&255,e>>8&255,255&e])}writeInt32BE(e){return this.writeUInt32BE(e>>>0)}writeUInt32LE(e){return this.write([255&e,e>>8&255,e>>16&255,e>>24&255])}writeInt32LE(e){return this.writeUInt32LE(e>>>0)}writeUInt64BEBn(e){let t=e.toArray("be",8);return this.write(t),this}writeUInt64LEBn(e){let t=e.toArray("be",8);return this.writeReverse(t),this}writeUInt64LE(e){if(-1===e)this.write(Array(8).fill(255));else{let t=new A(e).toArray("be",8);this.writeReverse(t)}return this}writeVarIntNum(e){let t=tP.varIntNum(e);return this.write(t),this}writeVarIntBn(e){let t=tP.varIntBn(e);return this.write(t),this}static varIntNum(e){let t;if(e<0)return this.varIntBn(new A(e));if(e<253)t=[e];else if(e<65536)t=[253,255&e,e>>8&255];else if(e<0x100000000)t=[254,255&e,e>>8&255,e>>16&255,e>>24&255];else{let i=0|e,r=0|Math.floor(e/0x100000000);t=[255,255&i,i>>8&255,i>>16&255,i>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]}return t}static varIntBn(e){let t;if(e.isNeg()&&(e=e.add(tC)),e.ltn(253))t=[e.toNumber()];else if(e.ltn(65536)){let i=e.toNumber();t=[253,255&i,i>>8&255]}else if(e.lt(new A(0x100000000))){let i=e.toNumber();t=[254,255&i,i>>8&255,i>>16&255,i>>24&255]}else{let i=new tP;i.writeUInt8(255),i.writeUInt64LEBn(e),t=i.toArray()}return t}}class tN{bin;pos;length;constructor(e=[],t=0){this.bin=e,this.pos=t,this.length=e.length}eof(){return this.pos>=this.length}read(e=this.length){let t=this.pos,i=this.pos+e;return this.pos=i,this.bin.slice(t,i)}readReverse(e=this.length){let t=Array(e);for(let i=0;i<e;i++)t[i]=this.bin[this.pos+e-1-i];return this.pos+=e,t}readUInt8(){let e=this.bin[this.pos];return this.pos+=1,e}readInt8(){let e=this.bin[this.pos];return this.pos+=1,(128&e)==0?e:e-256}readUInt16BE(){let e=this.bin[this.pos]<<8|this.bin[this.pos+1];return this.pos+=2,e}readInt16BE(){let e=this.readUInt16BE();return(32768&e)==0?e:e-65536}readUInt16LE(){let e=this.bin[this.pos]|this.bin[this.pos+1]<<8;return this.pos+=2,e}readInt16LE(){let e=this.readUInt16LE();return(32768&e)==0?e:e-65536}readUInt32BE(){let e=0x1000000*this.bin[this.pos]+(this.bin[this.pos+1]<<16|this.bin[this.pos+2]<<8|this.bin[this.pos+3]);return this.pos+=4,e}readInt32BE(){let e=this.readUInt32BE();return(0x80000000&e)==0?e:e-0x100000000}readUInt32LE(){let e=(this.bin[this.pos]|this.bin[this.pos+1]<<8|this.bin[this.pos+2]<<16|this.bin[this.pos+3]<<24)>>>0;return this.pos+=4,e}readInt32LE(){let e=this.readUInt32LE();return(0x80000000&e)==0?e:e-0x100000000}readUInt64BEBn(){let e=new A(this.bin.slice(this.pos,this.pos+8));return this.pos=this.pos+8,e}readUInt64LEBn(){return new A(this.readReverse(8))}readInt64LEBn(){let e=new A(this.readReverse(8));return e.gte(tR)&&(e=e.sub(tC)),e}readVarIntNum(e=!0){let t,i=this.readUInt8();switch(i){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:if((t=e?this.readInt64LEBn():this.readUInt64LEBn()).lte(new A(2).pow(new A(53))))return t.toNumber();throw Error("number too large to retain precision - use readVarIntBn");default:return i}}readVarInt(){switch(this.bin[this.pos]){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}}readVarIntBn(){let e=this.readUInt8();switch(e){case 253:return new A(this.readUInt16LE());case 254:return new A(this.readUInt32LE());case 255:return this.readUInt64LEBn();default:return new A(e)}}}let t_=e=>{if(0===e.length)return e;let t=e.at(-1);if((127&t)!=0)return e;if(1===e.length)return[];if((128&e.at(-2))!=0)return e;for(let i=e.length-1;i>0;i--)if(0!==e[i-1])if((128&e[i-1])==0)return e[i-1]|=t,e.slice(0,i);else return e[i]=t,e.slice(0,i+1);return[]},tR=new A(2).pow(new A(63)),tC=new A(2).pow(new A(64));function tB(e,t="Expected a valid value, but got undefined or null."){if(null==e)throw Error(t);return e}function tU(e,t){if(e.length!==t.length)return!1;let i=0;for(let r=0;r<e.length;r++)i|=e[r]^t[r];return 0===i}function tF(e,t,i){let r=-e,n=(t.X^i.X)&r,s=(t.Y^i.Y)&r,a=(t.Z^i.Z)&r;t.X^=n,i.X^=n,t.Y^=s,i.Y^=s,t.Z^=a,i.Z^=a}let tD=(1n<<256n)-1n;function tL(e){let t=e>>256n;return t=(e=(e&tD)+(t<<32n)+977n*t)>>256n,(e=(e&tD)+(t<<32n)+977n*t)>=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn&&(e-=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn),e}let tV=e=>tL((e%0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn+0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn)%0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn),tH=(e,t)=>e>=t?e-t:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn-(t-e),tM=(e,t)=>tL(e*t),tK=e=>{let t=1n,i=0n,r=tV(e),n=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;for(;r>1n;){let e=n/r;[t,i]=[i-t*e,t],[r,n]=[n-r*e,r]}return tV(t)},tq=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn+1n>>2n,t$=BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),tz=BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),tW=new Map,tj=e=>{let{X:t,Y:i,Z:r}=e;if(0n===i)return{X:0n,Y:1n,Z:0n};let n=tM(i,i),s=tM(4n,tM(t,n)),a=tM(3n,tM(t,t)),o=tH(tM(a,a),tM(2n,s)),l=tH(tM(a,tH(s,o)),tM(8n,tM(n,n)));return{X:o,Y:l,Z:tM(2n,tM(i,r))}},tG=(e,t)=>{if(0n===e.Z)return t;if(0n===t.Z)return e;let i=tM(e.Z,e.Z),r=tM(t.Z,t.Z),n=tM(e.X,r),s=tM(t.X,i),a=tM(e.Y,tM(r,t.Z)),o=tM(t.Y,tM(i,e.Z)),l=tH(s,n),c=tH(o,a);if(0n===l)return 0n===c?tj(e):{X:0n,Y:1n,Z:0n};let h=tM(l,l),d=tM(l,h),u=tM(n,h),f=tH(tH(tM(c,c),d),tM(2n,u)),p=tH(tM(c,tH(u,f)),tM(a,d));return{X:f,Y:p,Z:tM(l,tM(e.Z,t.Z))}},tX=e=>0n===e.Z?e:{X:e.X,Y:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn-e.Y,Z:e.Z},tY=(e,t,i=5)=>{let r=`${i}:${t.x.toString(16)}:${t.y.toString(16)}`,n=tW.get(r);if(void 0===n){let e=1<<i-1;n=Array(e);let s={X:t.x,Y:t.y,Z:1n};n[0]=s;let a=tj(s);for(let t=1;t<e;t++)n[t]=tG(n[t-1],a);tW.set(r,n)}let s=[],a=1n<<BigInt(i),o=a>>1n,l=e;for(;l>0n;)if((1n&l)===0n)s.push(0),l>>=1n;else{let e=l&a-1n;e>o&&(e-=a),s.push(Number(e)),l-=e,l>>=1n}let c={X:0n,Y:1n,Z:0n};for(let e=s.length-1;e>=0;e--){c=tj(c);let t=s[e];if(0!==t){let e=Math.abs(t)>>1;c=tG(c,t>0?n[e]:tX(n[e]))}}return c},tJ=e=>{let t=e%0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;return t<0n&&(t+=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n),t},tZ=(e,t)=>tJ(e*t),tQ=e=>{let t=1n,i=0n,r=tJ(e),n=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;for(;r>1n;){let e=n/r;[t,i]=[i-t*e,t],[r,n]=[n-r*e,r]}return tJ(t)};class t0 extends _{x;y;inf;static _assertOnCurve(e){if(!e.validate())throw Error("Invalid point");return e}static fromDER(e){if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==64){if(6===e[0]){if(e.at(-1)%2!=0)throw Error("Point string value is wrong length")}else if(7===e[0]&&e.at(-1)%2!=1)throw Error("Point string value is wrong length");let t=new t0(e.slice(1,33),e.slice(33,65));return t0._assertOnCurve(t)}if((2===e[0]||3===e[0])&&e.length-1==32)return t0._assertOnCurve(t0.fromX(e.slice(1,33),3===e[0]));throw Error("Unknown point format")}static fromString(e){let t=tm(e,"hex");return t0._assertOnCurve(t0.fromDER(t))}static fromX(e,t){var i;let r,n,s=A.isBN(e)?BigInt("0x"+e.toString(16)):"string"==typeof e?BigInt("0x"+e):Array.isArray(e)?BigInt("0x"+tg(e)):BigInt(e),a=(n=((e,t)=>{let i=1n;for(e=tV(e);t>0n;)(1n&t)!==0n&&(i=tM(i,e)),e=tM(e,e),t>>=1n;return i})(i=tL(tM(tM(r=s=tV(s),r),s)+7n),tq),tM(n,n)!==tV(i)?null:n);if(null===a)throw Error("Invalid point");let o=a;(1n&o)!==(t?1n:0n)&&(o=tH(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,o));let l=new A(s.toString(16),16),c=new A(o.toString(16),16);return t0._assertOnCurve(new t0(l,c))}static fromJSON(e,t){"string"==typeof e&&(e=JSON.parse(e));let i=new t0(e[0],e[1],t);if(i=t0._assertOnCurve(i),"object"!=typeof e[2]||null===e[2])return i;let r=e[2],n=e=>{let i=new t0(e[0],e[1],t);return t0._assertOnCurve(i)};return i.precomputed={beta:null,doubles:"object"==typeof r.doubles&&null!==r.doubles?{step:r.doubles.step,points:[i].concat(r.doubles.points.map(n))}:void 0,naf:"object"==typeof r.naf&&null!==r.naf?{wnd:r.naf.wnd,points:[i].concat(r.naf.points.map(n))}:void 0},i}constructor(e,t,i=!0){super("affine"),this.precomputed=null,null===e&&null===t?(this.x=null,this.y=null,this.inf=!0):(A.isBN(e)||(e=new A(e,16)),this.x=e,A.isBN(t)||(t=new A(t,16)),this.y=t,i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),null===this.x.red&&(this.x=this.x.toRed(this.curve.red)),null===this.y.red&&(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}validate(){if(this.inf||null==this.x||null==this.y)return!1;try{let e,t=BigInt("0x"+this.x.fromRed().toString(16)),i=BigInt("0x"+this.y.fromRed().toString(16)),r=tM(i,i),n=(e=tM(tM(t,t),t),tL(e+7n));return r===n}catch{return!1}}encode(e=!0,t){let i;if(this.inf)return"hex"===t?"00":[0];let r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return(i=e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r)),"hex"===t)?tg(i):i}toString(){return this.encode(!0,"hex")}toJSON(){return null==this.precomputed?[this.x,this.y]:[this.x,this.y,"object"==typeof this.precomputed&&null!==this.precomputed?{doubles:null==this.precomputed.doubles?void 0:{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:null==this.precomputed.naf?void 0:{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}:void 0]}inspect(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+(this.x?.fromRed()?.toString(16,2)??"undefined")+" y: "+(this.y?.fromRed()?.toString(16,2)??"undefined")+">"}isInfinity(){return this.inf}add(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||this.x?.cmp(e.x??new A(0))===0)return new t0(null,null);let t=tG({X:BigInt("0x"+this.x.fromRed().toString(16)),Y:BigInt("0x"+this.y.fromRed().toString(16)),Z:1n},{X:BigInt("0x"+e.x.fromRed().toString(16)),Y:BigInt("0x"+e.y.fromRed().toString(16)),Z:1n});if(0n===t.Z)return new t0(null,null);let i=tK(t.Z),r=tM(i,i),n=tM(t.X,r),s=tM(t.Y,tM(r,i));return new t0(n.toString(16),s.toString(16))}dbl(){if(this.inf)return this;if(null===this.x||null===this.y)throw Error("Point coordinates cannot be null");let e=BigInt("0x"+this.x.fromRed().toString(16)),t=BigInt("0x"+this.y.fromRed().toString(16));if(0n===t)return new t0(null,null);let i=tj({X:e,Y:t,Z:1n}),r=tK(i.Z),n=tM(r,r),s=tM(i.X,n),a=tM(i.Y,tM(n,r));return new t0(s.toString(16),a.toString(16))}getX(){return(this.x??new A(0)).fromRed()}getY(){return(this.y??new A(0)).fromRed()}mul(e){let t,i;if(A.isBN(e)||(e=new A(e,16)),this.inf)return this;let r=e.isNeg(),n=BigInt("0x"+(r?e.neg():e).toString(16));if(0n===(n=tV(n))||0n===n)return new t0(null,null);if(null===this.x||null===this.y)throw Error("Point coordinates cannot be null");this===this.curve.g?(t=t$,i=tz):(t=BigInt("0x"+this.x.fromRed().toString(16)),i=BigInt("0x"+this.y.fromRed().toString(16)));let s=tY(n,{x:t,y:i});if(0n===s.Z)return new t0(null,null);let a=tK(s.Z),o=tM(a,a),l=tM(s.X,o),c=tM(s.Y,tM(o,a)),h=new t0(new A(l.toString(16),16),new A(c.toString(16),16));return r?h.neg():h}mulCT(e){if(A.isBN(e)||(e=new A(e,16)),this.inf)return new t0(null,null);let t=e.isNeg(),i=BigInt("0x"+(t?e.neg():e).toString(16));if(0n===(i=tV(i)))return new t0(null,null);let r=this===this.curve.g?t$:BigInt("0x"+this.getX().toString(16)),n=this===this.curve.g?tz:BigInt("0x"+this.getY().toString(16)),s={X:0n,Y:1n,Z:0n},a={X:r,Y:n,Z:1n};for(let e of i.toString(2)){let t="1"===e?1n:0n;tF(t,s,a),a=tG(s,a),tF(t,s=tj(s),a)}if(0n===s.Z)return new t0(null,null);let o=tK(s.Z),l=tM(o,o),c=tM(s.X,l),h=tM(s.Y,tM(l,o)),d=new t0(c.toString(16),h.toString(16));return t?d.neg():d}mulAdd(e,t,i){return this._endoWnafMulAdd([this,t],[e,i])}jmulAdd(e,t,i){return this._endoWnafMulAdd([this,t],[e,i],!0)}eq(e){return this===e||this.inf===e.inf&&(this.inf||0===(this.x??new A(0)).cmp(e.x??new A(0))&&0===(this.y??new A(0)).cmp(e.y??new A(0)))}neg(e){if(this.inf)return this;let t=new t0(this.x,(this.y??new A(0)).redNeg());if(!0===e&&null!=this.precomputed){let e=this.precomputed;t.precomputed={naf:null==e.naf?void 0:{wnd:e.naf.wnd,points:e.naf.points.map(e=>e.neg())},doubles:null==e.doubles?void 0:{step:e.doubles.step,points:e.doubles.points.map(e=>e.neg())},beta:void 0}}return t}dblp(e){let t=this;for(let i=0;i<e;i++)t=t.dbl();return t}toJ(){return this.inf?new R(null,null,null):new R(this.x,this.y,this.curve.one)}_getBeta(){if("object"!=typeof this.curve.endo)return;let e=this.precomputed;if("object"==typeof e&&null!==e&&"object"==typeof e.beta&&null!==e.beta)return e.beta;let t=new t0((this.x??new A(0)).redMul(this.curve.endo.beta),this.y);if(null!=e){let i=this.curve,r=e=>{if(null===e.x)throw Error("p.x is null");if(void 0===i.endo||null===i.endo)throw Error("curve.endo is undefined");return new t0(e.x.redMul(i.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:null==e.naf?void 0:{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:null==e.doubles?void 0:{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}_fixedNafMul(e){if("object"!=typeof this.precomputed||null===this.precomputed)throw Error("_fixedNafMul requires precomputed values for the point");let t=this._getDoubles(),i=this.curve.getNAF(e,1,this.curve._bitLength),r=(1<<t.step+1)-(t.step%2==0?2:1);r/=3;let n=[];for(let e=0;e<i.length;e+=t.step){let r=0;for(let n=e+t.step-1;n>=e;n--)r=(r<<1)+i[n];n.push(r)}let s=new R(null,null,null),a=new R(null,null,null);for(let e=r;e>0;e--){for(let i=0;i<n.length;i++){let r=n[i];r===e?a=a.mixedAdd(t.points[i]):r===-e&&(a=a.mixedAdd(t.points[i].neg()))}s=s.add(a)}return s.toP()}_wnafMulAdd(e,t,i,r,n){let s=this.curve._wnafT1.map(e=>e.toNumber()),a=this.curve._wnafT2.map(()=>[]),o=this.curve._wnafT3.map(()=>[]),l=0;for(let i=0;i<r;i++){let r=t[i]._getNAFPoints(e);s[i]=r.wnd,a[i]=r.points}for(let e=r-1;e>=1;e-=2){let r=e-1,n=e;if(1!==s[r]||1!==s[n]){o[r]=this.curve.getNAF(i[r],s[r],this.curve._bitLength),o[n]=this.curve.getNAF(i[n],s[n],this.curve._bitLength),l=Math.max(o[r].length,l),l=Math.max(o[n].length,l);continue}let c=[t[r],null,null,t[n]];0===(t[r].y??new A(0)).cmp(t[n].y??new A(0))?(c[1]=t[r].add(t[n]),c[2]=t[r].toJ().mixedAdd(t[n].neg())):0===(t[r].y??new A(0)).cmp((t[n].y??new A(0)).redNeg())?(c[1]=t[r].toJ().mixedAdd(t[n]),c[2]=t[r].add(t[n].neg())):(c[1]=t[r].toJ().mixedAdd(t[n]),c[2]=t[r].toJ().mixedAdd(t[n].neg()));let h=[-3,-1,-5,-7,0,7,5,1,3],d=this.curve.getJSF(i[r],i[n]);l=Math.max(d[0].length,l),o[r]=Array(l),o[n]=Array(l);for(let e=0;e<l;e++){let t=Math.trunc(d[0][e]),i=Math.trunc(d[1][e]);o[r][e]=h[(t+1)*3+(i+1)],o[n][e]=0,a[r]=c}}let c=new R(null,null,null),h=this.curve._wnafT4;for(let e=l;e>=0;e--){let t=0;for(;e>=0;){let i=!0;for(let t=0;t<r;t++)h[t]=new A("number"==typeof o[t][e]?o[t][e]:0),h[t].isZero()||(i=!1);if(!i)break;t++,e--}if(e>=0&&t++,c=c.dblp(t),e<0)break;let i=new A(1),n=new A(2);for(let e=0;e<r;e++){let t,r=h[e];0!==r.cmpn(0)&&(c="affine"===(t=r.isNeg()?a[e][r.neg().sub(i).div(n).toNumber()].neg():a[e][r.sub(i).div(n).toNumber()]).type?c.mixedAdd(t):c.add(t))}}for(let e=0;e<r;e++)a[e]=[];return!0===n?c:c.toP()}_endoWnafMulAdd(e,t,i){let r,n=Array(2*e.length),s=Array(2*e.length);for(r=0;r<e.length;r++){let i=this.curve._endoSplit(t[r]),a=e[r],o=a._getBeta()??new t0(null,null);0!==i.k1.negative&&(i.k1.ineg(),a=a.neg(!0)),0!==i.k2.negative&&(i.k2.ineg(),o=o.neg(!0)),n[2*r]=a,n[2*r+1]=o,s[2*r]=i.k1,s[2*r+1]=i.k2}let a=this._wnafMulAdd(1,n,s,2*r,i);for(let e=0;e<2*r;e++)n[e]=null,s[e]=null;return a}_hasDoubles(e){if(null==this.precomputed)return!1;let t=this.precomputed.doubles;return"object"==typeof t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)}_getDoubles(e,t){if("object"==typeof this.precomputed&&null!==this.precomputed&&"object"==typeof this.precomputed.doubles&&null!==this.precomputed.doubles)return this.precomputed.doubles;let i=[this],r=this;for(let n=0;n<(t??0);n+=e??1){for(let t=0;t<(e??1);t++)r=r.dbl();i.push(r)}return{step:e??1,points:i}}_getNAFPoints(e){if("object"==typeof this.precomputed&&null!==this.precomputed&&"object"==typeof this.precomputed.naf&&null!==this.precomputed.naf)return this.precomputed.naf;let t=[this],i=(1<<e)-1,r=1===i?null:this.dbl();for(let e=1;e<i;e++)null!==r&&(t[e]=t[e-1].add(r));return{wnd:e,points:t}}}class t1{p;red;redN;zero;one;two;g;n;a;b;tinv;zeroA;threeA;endo;_endoWnafT1;_endoWnafT2;_wnafT1;_wnafT2;_wnafT3;_wnafT4;_bitLength;static assert(e,t="Elliptic curve assertion failed"){if(!e)throw Error(t)}getNAF(e,t,i){let r=Array(Math.max(e.bitLength(),i)+1);r.fill(0);let n=1<<t+1,s=e.clone();for(let e=0;e<r.length;e++){let t,i=s.andln(n-1);s.isOdd()?(t=i>(n>>1)-1?(n>>1)-i:i,s.isubn(t)):t=0,r[e]=t,s.iushrn(1)}return r}getJSF(e,t){let i=[[],[]];e=e.clone(),t=t.clone();let r=0,n=0;for(;e.cmpn(-r)>0||t.cmpn(-n)>0;){let s,a,o=e.andln(3)+r&3,l=t.andln(3)+n&3;if(3===o&&(o=-1),3===l&&(l=-1),(1&o)==0)s=0;else{let t=e.andln(7)+r&7;s=(3===t||5===t)&&2===l?-o:o}if(i[0].push(s),(1&l)==0)a=0;else{let e=t.andln(7)+n&7;a=(3===e||5===e)&&2===o?-l:l}i[1].push(a),2*r===s+1&&(r=1-r),2*n===a+1&&(n=1-n),e.iushrn(1),t.iushrn(1)}return i}static cachedProperty(e,t,i){let r="_"+t;e.prototype[t]=function(){return void 0===this[r]&&(this[r]=i.call(this)),this[r]}}static parseBytes(e){return"string"==typeof e?tm(e,"hex"):e}static intFromLE(e){return new A(e,"hex","le")}constructor(){if(void 0!==e)return e;e=this;const t={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",beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",{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"]]}}]};this.p=new A(t.p,16),this.red=new P(t.prime),this.zero=new A(0).toRed(this.red),this.one=new A(1).toRed(this.red),this.two=new A(2).toRed(this.red),this.n=new A(t.n,16),this.g=t0.fromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n.bitLength(),this.redN=this.n.toRed(this.red),this.a=new A(t.a,16).toRed(this.red),this.b=new A(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}_getEndomorphism(e){let t,i,r;if(this.zeroA&&1===this.p.modrn(3)){if(void 0===e.beta){let e=this._getEndoRoots(this.p);if(null===e)throw Error("Failed to get endomorphism roots for beta.");t=(t=0>e[0].cmp(e[1])?e[0]:e[1]).toRed(this.red)}else t=new A(e.beta,16).toRed(this.red);if(void 0===e.lambda){let e=this._getEndoRoots(this.n);if(null===e)throw Error("Failed to get endomorphism roots for lambda.");if(null==this.g)throw Error("Curve generator point (g) is not defined.");let r=this.g.mul(e[0])?.x,n=null==this.g.x?void 0:this.g.x.redMul(t);if(null!=r&&null!=n&&0===r.cmp(n))i=e[0];else{if(i=e[1],null==this.g)throw Error("Curve generator point (g) is not defined.");let r=this.g.mul(i)?.x,n=null==this.g.x?void 0:this.g.x.redMul(t);if(null==r||null==n)throw Error("Lambda computation failed: g.mul(lambda).x or g.x.redMul(beta) is undefined.");t1.assert(0===r.cmp(n),"Lambda selection does not match computed beta.")}}else i=new A(e.lambda,16);return r="object"==typeof e.basis&&null!==e.basis?e.basis.map(function(e){return{a:new A(e.a,16),b:new A(e.b,16)}}):this._getEndoBasis(i),{beta:t,lambda:i,basis:r}}}_getEndoRoots(e){let t=e===this.p?this.red:new N(e),i=new A(2).toRed(t).redInvm(),r=i.redNeg(),n=new A(3).toRed(t).redNeg().redSqrt().redMul(i);return[r.redAdd(n).fromRed(),r.redSub(n).fromRed()]}_getEndoBasis(e){let t,i,r,n,s,a,o=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,c=this.n.clone(),h=new A(1),d=new A(0),u=new A(0),f=new A(1),p=new A(0),g=0,y=new A(0),m=new A(0);for(;0!==l.cmpn(0);){let e=c.div(l);y=c.sub(e.mul(l)),m=u.sub(e.mul(h));let s=f.sub(e.mul(d));if(void 0===r&&0>y.cmp(o))t=p.neg(),i=h,r=y.neg(),n=m;else if(void 0!==r&&2==++g)break;p=y,c=l,l=y,u=h,h=m,f=d,d=s}if(void 0===t||void 0===i||void 0===r||void 0===n)throw Error("Failed to compute Endo Basis values");s=y.neg(),a=m;let b=r.sqr().add(n.sqr());return s.sqr().add(a.sqr()).cmp(b)>=0&&(s=t,a=i),0!==r.negative&&(r=r.neg(),n=n.neg()),0!==s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:n},{a:s,b:a}]}_endoSplit(e){if(null==this.endo)throw Error("Endomorphism is not defined.");let t=this.endo.basis,i=t[0],r=t[1],n=r.b.mul(e).divRound(this.n),s=i.b.neg().mul(e).divRound(this.n),a=n.mul(i.a),o=s.mul(r.a),l=n.mul(i.b),c=s.mul(r.b);return{k1:e.sub(a).sub(o),k2:l.add(c).neg()}}validate(e){if(e.inf)return!0;let t=e.x,i=e.y;if(null===t||null===i)throw Error("Point coordinates cannot be null");let r=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===i.redSqr().redISub(n).cmpn(0)}}class t2{r;s;static fromDER(e,t){let i=(e,t)=>{let i=e[t.place++];if((128&i)==0)return i;throw Error("Invalid DER entity length")};e=tm(e,t);let r=new class{place;constructor(){this.place=0}};if(48!==e[r.place++])throw Error("Signature DER must start with 0x30");if(i(e,r)+r.place!==e.length||2!==e[r.place++])throw Error("Signature DER invalid");let n=i(e,r),s=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])throw Error("Signature DER invalid");let a=i(e,r);if(e.length!==a+r.place)throw Error("Invalid R-length in signature DER");let o=e.slice(r.place,a+r.place);if(0===s[0])if((128&s[1])==0)throw Error("Invalid R-value in signature DER");else s=s.slice(1);if(0===o[0])if((128&o[1])==0)throw Error("Invalid S-value in signature DER");else o=o.slice(1);return new t2(new A(s),new A(o))}static fromCompact(e,t){if(65!==(e=tm(e,t)).length)throw Error("Invalid Compact Signature");let i=e[0];if(i<27||i>=35)throw Error("Invalid Compact Byte");return new t2(new A(e.slice(1,33)),new A(e.slice(33,65)))}constructor(e,t){this.r=e,this.s=t}verify(e,t,i){return it(new A(ev(e,i),16),this,t)}toString(e){return this.toDER(e)}toDER(e){let t=(e,t)=>{if(t<128)e.push(t);else throw Error("len must be < 0x80")},i=e=>{let t=0,i=e.length-1;for(;0===e[t]&&(128&e[t+1])==0&&t<i;)t++;return 0===t?e:e.slice(t)},r=this.r.toArray(),n=this.s.toArray();for((128&r[0])!=0&&(r=[0].concat(r)),(128&n[0])!=0&&(n=[0].concat(n)),r=i(r),n=i(n);0===n[0]&&(128&n[1])==0;)n=n.slice(1);let s=[2];t(s,r.length),(s=s.concat(r)).push(2),t(s,n.length);let a=s.concat(n),o=[48];return(t(o,a.length),o=o.concat(a),"hex"===e)?tg(o):"base64"===e?tS(o):o}toCompact(e,t,i){if(e<0||e>3)throw Error("Invalid recovery param");if("boolean"!=typeof t)throw TypeError("Invalid compressed param");let r=27+e;t&&(r+=4);let n=[r];return(n=(n=n.concat(this.r.toArray("be",32))).concat(this.s.toArray("be",32)),"hex"===i)?tg(n):"base64"===i?tS(n):n}RecoverPublicKey(e,t){let i=this.r,r=this.s,n=new t1,s=n.n,a=n.g,o=0==e>>1?i:i.add(s),l=t0.fromX(o,(1&e)!=0);if(!l.mul(s).isInfinity())throw Error("nR is not at infinity");let c=t.neg().umod(s),h=i.invm(s),d=h.mul(r).umod(s),u=h.mul(c).umod(s),f=new ii(a.mul(u).add(l.mul(d)));return f.validate(),f}CalculateRecoveryFactor(e,t){for(let i=0;i<4;i++){let r;try{r=this.RecoverPublicKey(i,t)}catch{continue}if(e.eq(r))return i}throw Error("Unable to find valid recovery factor")}}class t8{K;V;constructor(e,t){const i=tm(e,"hex"),r=tm(t,"hex");if(32!==i.length)throw Error("Entropy must be exactly 32 bytes (256 bits)");if(32!==r.length)throw Error("Nonce must be exactly 32 bytes (256 bits)");const n=i.concat(r);this.K=Array(32),this.V=Array(32);for(let e=0;e<32;e++)this.K[e]=0,this.V[e]=1;this.update(n)}hmac(){return new ef(this.K)}update(e){let t=this.hmac().update(this.V).update([0]);void 0!==e&&(t=t.update(e)),this.K=t.digest(),this.V=this.hmac().update(this.V).digest(),void 0!==e&&(this.K=this.hmac().update(this.V).update([1]).update(e).digest(),this.V=this.hmac().update(this.V).digest())}generate(e){let t=[];for(;t.length<e;)this.V=this.hmac().update(this.V).digest(),t=t.concat(this.V);let i=t.slice(0,e);return this.update(),tg(i)}}function t3(e,t,i=new t1){let r=8*e.byteLength()-i.n.bitLength();return(r>0&&e.iushrn(r),!0!==t&&e.cmp(i.n)>=0)?e.sub(i.n):e}function t5(e){let t=e.toArray("be"),i=0n;for(let e of t)i=i<<8n|BigInt(e);return i}let t6=new t1,t4=t6.n.byteLength(),t9=t6.n.subn(1),t7=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n>>1n,ie=(e,t,i=!1,r)=>{let n=t6.n.bitLength();if(e.bitLength()>n)throw Error(`ECDSA message is too large: expected <= ${n} bits. Callers must hash messages before signing.`);let s=t5(e=t3(e)),a=t5(t),o=new t8(t.toArray("be",t4),e.toArray("be",t4));for(let e=0;;e++){let t;if(null==(t="function"==typeof r?r(e):A.isBN(r)?r:new A(o.generate(t4),16)))throw Error("k is undefined");if(0>(t=t3(t,!0)).cmpn(1)||t.cmp(t9)>0){if(A.isBN(r))throw Error("Invalid fixed custom K value (must be >1 and <N-1)");continue}let n=t6.g.mulCT(t);if(n.isInfinity()){if(A.isBN(r))throw Error("Invalid fixed custom K value (k\xb7G at infinity)");continue}let l=tJ(BigInt("0x"+n.getX().toString(16)));if(0n===l){if(A.isBN(r))throw Error("Invalid fixed custom K value (r == 0)");continue}let c=tQ(BigInt("0x"+t.toString(16))),h=tJ(s+tZ(l,a)),d=tZ(c,h);if(0n===d){if(A.isBN(r))throw Error("Invalid fixed custom K value (s == 0)");continue}return i&&d>t7&&(d=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n-d),new t2(new A(l.toString(16),16),new A(d.toString(16),16))}},it=(e,t,i)=>{let r=t6.n.bitLength();if(e.bitLength()>r)return!1;let n=t5(e);if(null==i.x||null==i.y)throw Error("Invalid public key: missing coordinates.");let s={x:t5(i.x),y:t5(i.y)},{r:a,s:o}={r:t5(t.r),s:t5(t.s)};if(a<=0n||a>=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n||o<=0n||o>=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n)return!1;let l=tQ(o);if(0n===l)return!1;let c=tZ(n,l),h=tZ(a,l),d=tG(tY(c,{x:t$,y:tz}),tY(h,s));if(0n===d.Z)return!1;let u=tK(d.Z),f=tM(u,u);return tJ(tM(d.X,f))===a};class ii extends t0{static fromPrivateKey(e){let t=new t1().g.mul(e);return new ii(t.x,t.y)}static fromString(e){let t=t0.fromString(e);return new ii(t.x,t.y)}static fromDER(e){let t=t0.fromDER(e);return new ii(t.x,t.y)}constructor(e,t=null,i=!0){if(e instanceof t0)super(e.getX(),e.getY());else{if(null===t&&i&&"string"==typeof e&&(66===e.length||130===e.length))throw Error('You are using the "new PublicKey()" constructor with a DER hex string. You need to use "PublicKey.fromString()" instead.');super(e,t,i)}}deriveSharedSecret(e){if(!this.validate())throw Error("Public key not valid for ECDH secret derivation");return this.mulCT(e)}verify(e,t,i){return it(new A(ev(e,i),16),t,this)}toDER(e){return"hex"===e?this.encode(!0,e):this.encode(!0)}toHash(e){let t=eS(this.encode(!0));return"hex"===e?tg(t):t}toAddress(e=[0]){if("string"==typeof e)if("testnet"===e||"test"===e)e=[111];else if("mainnet"===e||"main"===e)e=[0];else throw Error(`Invalid prefix ${e}`);return tT(this.toHash(),e)}deriveChild(e,t,i,r){let n;if("function"==typeof r){let t=r(e,this);void 0===t?(n=this.deriveSharedSecret(e),"function"==typeof i&&i(e,this,n)):n=t}else n=this.deriveSharedSecret(e);let s=tm(t,"utf8"),a=eE(n.encode(!0),s),o=new t1().g.mul(new A(a)),l=this.add(o);return new ii(l.x,l.y)}static fromMsgHashAndCompactSignature(e,t,i){let r=tm(t,i);if(65!==r.length)throw Error("Invalid Compact Signature");let n=r[0];if(n<27||n>=35)throw Error("Invalid Compact Byte");let s=r[0]-27;return s>3&&(s-=4),new t2(new A(r.slice(1,33)),new A(r.slice(33,65))).RecoverPublicKey(s,e)}}class ir{_rand;getRandomValues(e,t){let i=new Uint8Array(t);return e.crypto.getRandomValues(i),Array.from(i)}constructor(){const e=()=>{throw Error("No secure random number generator is available in this environment.")};if(this._rand=e,"u">typeof globalThis&&"function"==typeof globalThis.crypto?.getRandomValues){this._rand=e=>this.getRandomValues(globalThis,e);return}if("u">typeof process&&process.release?.name==="node")try{const e=require("node:crypto");if("function"==typeof e.randomBytes){this._rand=t=>Array.from(e.randomBytes(t));return}}catch(e){}if(void 0!==globalThis.self&&"function"==typeof globalThis.self.crypto?.getRandomValues){this._rand=e=>this.getRandomValues(globalThis.self,e);return}if(void 0!==globalThis.window&&"function"==typeof globalThis.window.crypto?.getRandomValues){this._rand=e=>this.getRandomValues(globalThis.window,e);return}this._rand=e}generate(e){return this._rand(e)}}let is=null,ia=e=>(is??=new ir).generate(e);class io{x;y;constructor(e,t){const i=new t1().p;this.x=e.umod(i),this.y=t.umod(i)}toString(){return tA(this.x.toArray())+"."+tA(this.y.toArray())}static fromString(e){let[t,i]=e.split(".");return new io(new A(tx(t)),new A(tx(i)))}}class il{points;threshold;constructor(e,t){this.points=e,this.threshold=t??e.length}static fromPrivateKey(e,t){let i=new t1().p,r=[new io(new A(0),new A(e.toArray()))];for(let e=1;e<t;e++){let e=new A(ia(32)).umod(i),t=new A(ia(32)).umod(i);r.push(new io(e,t))}return new il(r)}valueAt(e){let t=new t1().p,i=new A(0);for(let r=0;r<this.threshold;r++){let n=this.points[r].y;for(let i=0;i<this.threshold;i++)if(r!==i){let s=this.points[i].x,a=this.points[r].x,o=e.sub(s).umod(t),l=a.sub(s).umod(t).invm(t),c=o.mul(l).umod(t);n=n.mul(c).umod(t)}i=i.add(n).umod(t)}return i}}class ic{points;threshold;integrity;constructor(e,t,i){this.points=e,this.threshold=t,this.integrity=i}static fromBackupFormat(e){let t=0,i="";return new ic(e.map((e,r)=>{let n=e.split(".");if(4!==n.length)throw Error("Invalid share format in share "+r.toString()+'. Expected format: "x.y.t.i" - received '+e);let[s,a,o,l]=n;if(void 0===o)throw Error("Threshold not found in share "+r.toString());if(void 0===l)throw Error("Integrity not found in share "+r.toString());let c=Number.parseInt(o,10);if(0!==r&&t!==c)throw Error("Threshold mismatch in share "+r.toString());if(0!==r&&i!==l)throw Error("Integrity mismatch in share "+r.toString());return t=c,i=l,io.fromString([s,a].join("."))}),t,i)}toBackupFormat(){return this.points.map(e=>e.toString()+"."+this.threshold.toString()+"."+this.integrity)}}class ih extends A{static fromRandom(){return new ih(ia(32))}static fromString(e,t="hex"){return new ih(super.fromString(e,t).toArray())}static fromHex(e){return new ih(super.fromHex(e,"big"))}static fromWif(e,t=1){let i=tO(e,void 0,t);if(33!==i.data.length)throw Error("Invalid WIF length");if(1!==i.data[32])throw Error("Invalid WIF padding");return new ih(i.data.slice(0,32))}constructor(e=0,t=10,i="be",r="apply"){if(e instanceof A?(super(),e.copy(this)):super(e,t,i),"nocheck"!==r){const e=this.checkInField();if(!e.inField){if("error"===r)throw Error("Input is out of field");A.move(this,e.modN)}}}checkInField(){let e=new t1,t=this.mod(e.n);return{inField:0===this.cmp(t),modN:t}}isValid(){return this.checkInField().inField}sign(e,t,i=!0,r){return ie(new A(ev(e,t),16),this,i,r)}verify(e,t,i){return it(new A(ev(e,i),16),t,this.toPublicKey())}toPublicKey(){let e=new t1().g.mulCT(this);return new ii(e.x,e.y)}toWif(e=[128]){if(!this.isValid())throw Error("Value is out of field");return tT([...this.toArray("be",32),1],e)}toAddress(e=[0]){return this.toPublicKey().toAddress(e)}toHex(){return super.toHex(32)}toString(e="hex",t=64){return super.toString(e,t)}deriveSharedSecret(e){if(!e.validate())throw Error("Public key not valid for ECDH secret derivation");return e.mulCT(this)}deriveChild(e,t,i,r){let n;if("function"==typeof r){let t=r(this,e);void 0===t?(n=this.deriveSharedSecret(e),"function"==typeof i&&i(this,e,n)):n=t}else n=this.deriveSharedSecret(e);let s=tm(t,"utf8"),a=eE(n.encode(!0),s),o=new t1;return new ih(this.add(new A(a)).mod(o.n).toArray())}toKeyShares(e,t){if("number"!=typeof e||"number"!=typeof t)throw TypeError("threshold and totalShares must be numbers");if(e<2)throw Error("threshold must be at least 2");if(t<2)throw Error("totalShares must be at least 2");if(e>t)throw Error("threshold should be less than or equal to totalShares");let i=il.fromPrivateKey(this,e),r=[],n=new Set,s=new t1,a=ia(64);for(let e=0;e<t;e++){let t,o=0;do if(t=new A(ex(a,[e,o,...ia(32)])).umod(s.p),++o>5)throw Error("Failed to generate unique x coordinate after 5 attempts");while(t.isZero()||n.has(t.toString()));n.add(t.toString());let l=i.valueAt(t);r.push(new io(t,l))}return new ic(r,e,this.toPublicKey().toHash("hex").slice(0,8))}toBackupShares(e,t){return this.toKeyShares(e,t).toBackupFormat()}static fromBackupShares(e){return ih.fromKeyShares(ic.fromBackupFormat(e))}static fromKeyShares(e){let{points:t,threshold:i,integrity:r}=e;if(i<2)throw Error("threshold must be at least 2");if(t.length<i)throw Error(`At least ${i} shares are required to reconstruct the private key`);for(let e=0;e<i;e++)for(let r=e+1;r<i;r++)if(t[e].x.eq(t[r].x))throw Error("Duplicate share detected, each must be unique.");let n=new ih(new il(t,i).valueAt(new A(0)).toArray());if(n.toPublicKey().toHash("hex").slice(0,8)!==r)throw Error("Integrity hash mismatch");return n}}let id=new Uint8Array([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]),iu=[[0,0,0,0],[1,0,0,0],[2,0,0,0],[4,0,0,0],[8,0,0,0],[16,0,0,0],[32,0,0,0],[64,0,0,0],[128,0,0,0],[27,0,0,0],[54,0,0,0]].map(e=>new Uint8Array(e)),ip=new Uint8Array(256),ig=new Uint8Array(256);for(let e=0;e<256;e++){let t=(e<<1^27*((128&e)!=0))&255;ip[e]=t,ig[e]=t^e}function iy(e,t,i){for(let r=0;r<4;r++){let n=t[i+r];for(let t=0;t<4;t++)e[t][r]^=n[t]}}function im(e){for(let t=0;t<4;t++)e[t]=id[e[t]]}function ib(e,t){let i,r,n,s,a=[[],[],[],[]],o=[],l=Array.from(t);if(16===l.length)s=11;else if(24===l.length)s=13;else if(32===l.length)s=15;else throw Error("Illegal key length: "+String(l.length));let c=function(e,t){let i=t.length/4,r=[];for(let e=0;e<t.length;e++)e%4==0&&r.push([]),r[e>>2].push(t[e]);for(let t=i;t<4*e;t++){r[t]=[];let e=r[t-1].slice();if(t%i==0){!function(e){let t=e[0];e[0]=e[1],e[1]=e[2],e[2]=e[3],e[3]=t}(e),im(e);let r=iu[t/i];for(let t=0;t<4;t++)e[t]^=r[t]}else i>6&&t%i==4&&im(e);for(let n=0;n<4;n++)r[t][n]=r[t-i][n]^e[n]}return r}(s,l);for(let t=0;t<4;t++)a[0][t]=e[4*t],a[1][t]=e[4*t+1],a[2][t]=e[4*t+2],a[3][t]=e[4*t+3];for(iy(a,c,0),n=1;n<s;n++){for(let e=0;e<4;e++)for(let t=0;t<4;t++)a[e][t]=id[a[e][t]];!function(e){let t=e[1][0];e[1][0]=e[1][1],e[1][1]=e[1][2],e[1][2]=e[1][3],e[1][3]=t,t=e[2][0];let i=e[2][1];e[2][0]=e[2][2],e[2][1]=e[2][3],e[2][2]=t,e[2][3]=i,t=e[3][3],e[3][3]=e[3][2],e[3][2]=e[3][1],e[3][1]=e[3][0],e[3][0]=t}(a),n+1<s&&function(e){for(let t=0;t<4;t++){let i=e[0][t],r=e[1][t],n=e[2][t],s=e[3][t];e[0][t]=ip[i]^ig[r]^n^s,e[1][t]=i^ip[r]^ig[n]^s,e[2][t]=i^r^ip[n]^ig[s],e[3][t]=ig[i]^r^n^ip[s]}}(a),iy(a,c,4*n)}for(i=0;i<4;i++)for(r=0;r<4;r++)o.push(a[r][i]);return o}let iw=function(e){if(e<0||e>Number.MAX_SAFE_INTEGER)throw Error("getBytes64: value out of range");let t=Math.floor(e/0x100000000),i=e>>>0;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i]},iv=function(e){return new Uint8Array(e)},iI=((n=new Uint8Array(16))[0]=225,n),ik=(...e)=>{let t=0;for(let i of e)t+=i.length;let i=new Uint8Array(t),r=0;for(let t of e)i.set(t,r),r+=t.length;return i},iS=function(e){let t=0,i=0;for(let r=0;r<e.length;r++)i=t,t=1&e[r],e[r]=e[r]>>1,0!==i&&(e[r]=128|e[r]);return e},iE=function(e,t){let i=t.slice(),r=iv(16);for(let t=0;t<16;t++){let n=e[t];for(let e=7;e>=0;e--){let t=255&-(n>>e&1);for(let e=0;e<16;e++)r[e]^=i[e]&t;let s=255&-(1&i[15]);iS(i);for(let e=0;e<16;e++)i[e]^=iI[e]&s}}return r},ix=function(e){let t=e.slice();for(let e=15;e>11&&(t[e]=t[e]+1&255,0===t[e]);e--);return t};function iA(e,t){let i=iv(16),r=new Uint8Array(16);for(let n=0;n<e.length;n+=16){r.set(i);for(let t=0;t<16;t++)r[t]^=e[n+t]??0;i=iE(r,t)}return i}function iT(e,t,i){if(0===e.length)return new Uint8Array(0);let r=new Uint8Array(e.length),n=t.slice(),s=0,a=Math.ceil(e.length/16);for(let t=0;t<a;t++){let o=ib(n,i),l=Math.min(16,e.length-s);for(let t=0;t<l;t++)r[s]=e[s]^o[t],s++;t+1<a&&(n=ix(n))}return r}function iO(e){let t,i,r=8*e.length;t=0===e.length?16:e.length%16==0?0:16-e.length%16;let n=new Uint8Array(16+e.length+t+16);i=16,n.set(e,i),i+=e.length,i+=t;let s=iw(0);n.set(s,i),i+=8;let a=iw(r);return n.set(a,i),n}let iP=(()=>{let e="u"<typeof globalThis?void 0:globalThis.process,t=e?.getBuiltinModule;if("function"==typeof t)try{let i=t.call(e,"node:crypto");if(null!=i)return i}catch{}try{if("function"==typeof require)return require("node:crypto")}catch{}})(),iN=null!=iP&&"function"==typeof iP.createCipheriv&&"function"==typeof iP.createDecipheriv;class i_ extends A{static fromRandom(){return new i_(ia(32))}encrypt(e,t){let i=new Uint8Array(ia(32)),r=new Uint8Array(tm(e,t)),n=new Uint8Array(this.toArray("be",32));if(iN){let e=function(e,t,i){try{let r=iP.createCipheriv("aes-256-gcm",Buffer.from(i.buffer,i.byteOffset,i.byteLength),Buffer.from(t.buffer,t.byteOffset,t.byteLength)),n=Buffer.concat([r.update(Buffer.from(e.buffer,e.byteOffset,e.byteLength)),r.final()]),s=r.getAuthTag(),a=new Uint8Array(t.length+n.length+s.length),o=0;return a.set(t,o),o+=t.length,a.set(n,o),o+=n.length,a.set(s,o),a}catch{return null}}(r,i,n);if(null!==e)return tk(Array.from(e),t)}let{result:s,authenticationTag:a}=function(e,t,i){let r;if(0===t.length)throw Error("Initialization vector must not be empty");if(0===i.length)throw Error("Key must not be empty");let n=new Uint8Array(ib(iv(16),i));if(12===t.length)r=ik(t,iv(3),new Uint8Array([1]));else{let e=t;e.length%16!=0&&(e=ik(e,iv(16-e.length%16)));let i=iw(8*t.length);r=iA(ik(e,iv(8),new Uint8Array(i)),n)}let s=iT(e,ix(r),i),a=iT(iA(iO(s),n),r,i);return{result:s,authenticationTag:a}}(r,i,n),o=new Uint8Array(i.length+s.length+a.length),l=0;return o.set(i,l),l+=i.length,o.set(s,l),l+=s.length,o.set(a,l),tk(Array.from(o),t)}decrypt(e,t){let i=new Uint8Array(tm(e,t));if(i.length<48)throw Error("Ciphertext too short");let r=new Uint8Array(this.toArray("be",32));if(iN){let e=function(e,t){try{let i=e.slice(0,32),r=e.length-16,n=e.slice(32,r),s=e.slice(r),a=iP.createDecipheriv("aes-256-gcm",Buffer.from(t.buffer,t.byteOffset,t.byteLength),Buffer.from(i.buffer,i.byteOffset,i.byteLength));a.setAuthTag(Buffer.from(s.buffer,s.byteOffset,s.byteLength));let o=Buffer.concat([a.update(Buffer.from(n.buffer,n.byteOffset,n.byteLength)),a.final()]);return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}catch{return null}}(i,r);if(void 0!==e){if(null===e)throw Error("Decryption failed!");return tk(Array.from(e),t)}}let n=i.slice(0,32),s=i.length-16,a=function(e,t,i,r){let n;if(0===e.length)throw Error("Cipher text must not be empty");if(0===t.length)throw Error("Initialization vector must not be empty");if(0===r.length)throw Error("Key must not be empty");let s=new Uint8Array(ib(iv(16),r));if(12===t.length)n=ik(t,iv(3),new Uint8Array([1]));else{let e=t;e.length%16!=0&&(e=ik(e,iv(16-e.length%16)));let i=iw(8*t.length);n=iA(ik(e,iv(8),new Uint8Array(i)),s)}let a=iT(e,ix(n),r),o=iT(iA(iO(e),s),n,r);if(o.length!==i.length)return null;let l=0;for(let e=0;e<o.length;e++)l|=o[e]^i[e];return 0!==l?null:a}(i.slice(32,s),n,i.slice(s),r);if(null===a)throw Error("Decryption failed!");return tk(Array.from(a),t)}}let iR={OP_0:0,OP_FALSE:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_1:81,OP_TRUE:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP2:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP3:178,OP_SUBSTR:179,OP_NOP4:179,OP_LEFT:180,OP_NOP5:180,OP_RIGHT:181,OP_NOP6:181,OP_LSHIFTNUM:182,OP_NOP7:182,OP_RSHIFTNUM:183,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_NOP11:186,OP_NOP12:187,OP_NOP13:188,OP_NOP14:189,OP_NOP15:190,OP_NOP16:191,OP_NOP17:192,OP_NOP18:193,OP_NOP19:194,OP_NOP20:195,OP_NOP21:196,OP_NOP22:197,OP_NOP23:198,OP_NOP24:199,OP_NOP25:200,OP_NOP26:201,OP_NOP27:202,OP_NOP28:203,OP_NOP29:204,OP_NOP30:205,OP_NOP31:206,OP_NOP32:207,OP_NOP33:208,OP_NOP34:209,OP_NOP35:210,OP_NOP36:211,OP_NOP37:212,OP_NOP38:213,OP_NOP39:214,OP_NOP40:215,OP_NOP41:216,OP_NOP42:217,OP_NOP43:218,OP_NOP44:219,OP_NOP45:220,OP_NOP46:221,OP_NOP47:222,OP_NOP48:223,OP_NOP49:224,OP_NOP50:225,OP_NOP51:226,OP_NOP52:227,OP_NOP53:228,OP_NOP54:229,OP_NOP55:230,OP_NOP56:231,OP_NOP57:232,OP_NOP58:233,OP_NOP59:234,OP_NOP60:235,OP_NOP61:236,OP_NOP62:237,OP_NOP63:238,OP_NOP64:239,OP_NOP65:240,OP_NOP66:241,OP_NOP67:242,OP_NOP68:243,OP_NOP69:244,OP_NOP70:245,OP_NOP71:246,OP_NOP72:247,OP_NOP73:248,OP_NOP77:252,OP_SMALLDATA:249,OP_SMALLINTEGER:250,OP_PUBKEYS:251,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};for(let e in iR)void 0===iR[iR[e]]&&(iR[iR[e]]=e);let iC=iR,iB="u"<typeof globalThis?void 0:globalThis.Buffer;class iU{_chunks;parsed;rawBytesCache;hexCache;static fromASM(e){let t=[],i=e.split(" "),r=0;for(;r<i.length;){let{chunk:e,advance:n}=iU.parseASMToken(i,r);t.push(e),r+=n}return new iU(t)}static pushdataOpCodeNum(e){return e>=0&&e<iC.OP_PUSHDATA1?e:e<256?iC.OP_PUSHDATA1:e<65536?iC.OP_PUSHDATA2:iC.OP_PUSHDATA4}static parseASMToken(e,t){let i=e[t];if("0"===i)return{chunk:{op:0},advance:1};if("-1"===i)return{chunk:{op:iC.OP_1NEGATE},advance:1};let r=i.startsWith("OP_")&&void 0!==iC[i],n=r?iC[i]:0;if(n===iC.OP_PUSHDATA1||n===iC.OP_PUSHDATA2||n===iC.OP_PUSHDATA4)return{chunk:{data:tm(e[t+2],"hex"),op:n},advance:3};if(!r){let e=i;e.length%2!=0&&(e="0"+e);let t=tm(e,"hex");if(tk(t,"hex")!==e)throw Error("invalid hex string in script");return{chunk:{data:t,op:iU.pushdataOpCodeNum(t.length)},advance:1}}return{chunk:{op:n},advance:1}}static fromHex(e){if(0===e.length)return iU.fromBinary([]);if(e.length%2!=0)throw Error("There is an uneven number of characters in the string which suggests it is not hex encoded.");if(!/^[0-9a-fA-F]+$/.test(e))throw Error("Some elements in this string are not hex encoded.");let t=tm(e,"hex");return new iU([],Uint8Array.from(t),e.toLowerCase(),!1)}static fromBinary(e){return new iU([],Uint8Array.from(e),void 0,!1)}constructor(e=[],t,i,r=!0){this._chunks=e,this.parsed=r,this.rawBytesCache=t,this.hexCache=i}get chunks(){return this.ensureParsed(),this._chunks}set chunks(e){this._chunks=e,this.parsed=!0,this.invalidateSerializationCaches()}ensureParsed(){this.parsed||(null!=this.rawBytesCache?this._chunks=iU.parseChunks(this.rawBytesCache):this._chunks=[],this.parsed=!0)}toASM(){let e="";for(let t of this.chunks)e+=this._chunkToString(t);return e.slice(1)}toHex(){if(null!=this.hexCache)return this.hexCache;this.rawBytesCache??=this.serializeChunksToBytes();let e=null==iB?tk(Array.from(this.rawBytesCache),"hex"):iB.from(this.rawBytesCache).toString("hex");return this.hexCache=e,e}toBinary(){return Array.from(this.toUint8Array())}toUint8Array(){return this.rawBytesCache??=this.serializeChunksToBytes(),this.rawBytesCache}writeScript(e){return this.invalidateSerializationCaches(),this.chunks=this.chunks.concat(e.chunks),this}writeOpCode(e){return this.invalidateSerializationCaches(),this.chunks.push({op:e}),this}setChunkOpCode(e,t){return this.invalidateSerializationCaches(),this.chunks[e]={op:t},this}writeBn(e){if(this.invalidateSerializationCaches(),e.cmpn(0)===iC.OP_0)this.chunks.push({op:iC.OP_0});else if(0===e.cmpn(-1))this.chunks.push({op:iC.OP_1NEGATE});else if(e.cmpn(1)>=0&&0>=e.cmpn(16))this.chunks.push({op:e.toNumber()+iC.OP_1-1});else{let t=e.toSm("little");this.writeBin(t)}return this}writeBin(e){let t;this.invalidateSerializationCaches();let i=e.length>0?e:void 0;if(e.length>0&&e.length<iC.OP_PUSHDATA1)t=e.length;else if(0===e.length)t=iC.OP_0;else if(e.length<256)t=iC.OP_PUSHDATA1;else if(e.length<65536)t=iC.OP_PUSHDATA2;else if(e.length<0x100000000)t=iC.OP_PUSHDATA4;else throw Error("You can't push that much data");return this.chunks.push({data:i,op:t}),this}writeNumber(e){return this.invalidateSerializationCaches(),this.writeBn(new A(e)),this}removeCodeseparators(){let e=this.toUint8Array();return this.rawBytesCache=Uint8Array.from(iU.removeOpcodeBytes(e,iC.OP_CODESEPARATOR)),this.hexCache=void 0,this._chunks=[],this.parsed=!1,this}findAndDelete(e){this.invalidateSerializationCaches();let t=e.toUint8Array(),i=t.length;if(0===i)return this;let r=t[0]??0,n=e=>{if(e.op!==r)return!1;let n=e.data??[],s=n.length;if(0===s)return 1===i;if(e.op===iC.OP_RETURN||e.op<iC.OP_PUSHDATA1){if(i!==1+s)return!1;for(let e=0;e<s;e++)if(t[1+e]!==n[e])return!1;return!0}if(e.op===iC.OP_PUSHDATA1){if(i!==2+s||t[1]!==(255&s))return!1;for(let e=0;e<s;e++)if(t[2+e]!==n[e])return!1;return!0}if(e.op===iC.OP_PUSHDATA2){if(i!==3+s||t[1]!==(255&s)||t[2]!==(s>>8&255))return!1;for(let e=0;e<s;e++)if(t[3+e]!==n[e])return!1;return!0}if(e.op===iC.OP_PUSHDATA4){if(i!==5+s)return!1;let e=s>>>0;if(t[1]!==(255&e)||t[2]!==(e>>8&255)||t[3]!==(e>>16&255)||t[4]!==(e>>24&255))return!1;for(let e=0;e<s;e++)if(t[5+e]!==n[e])return!1;return!0}return!1};for(let e=0;e<this.chunks.length;)n(this.chunks[e])?this.chunks.splice(e,1):e++;return this}isPushOnly(){for(let e of this.chunks)if(e.op>iC.OP_16)return!1;return!0}isLockingScript(){throw Error("Not implemented")}isUnlockingScript(){throw Error("Not implemented")}static computeSerializedLength(e){let t=0;for(let i of e){if(t+=1,null==i.data)continue;let e=i.data.length;if(i.op===iC.OP_RETURN){t+=e;break}i.op<iC.OP_PUSHDATA1?t+=e:i.op===iC.OP_PUSHDATA1?t+=1+e:i.op===iC.OP_PUSHDATA2?t+=2+e:i.op===iC.OP_PUSHDATA4&&(t+=4+e)}return t}serializeChunksToBytes(){let e=this.chunks,t=new Uint8Array(iU.computeSerializedLength(e)),i=0;for(let r of e)if(t[i++]=r.op,null!=r.data){if(r.op===iC.OP_RETURN){t.set(r.data,i);break}i=iU.writeChunkData(t,i,r.op,r.data)}return t}invalidateSerializationCaches(){this.rawBytesCache=void 0,this.hexCache=void 0}static writeChunkData(e,t,i,r){let n=r.length;if(i<iC.OP_PUSHDATA1)return e.set(r,t),t+n;if(i===iC.OP_PUSHDATA1)return e[t++]=255&n,e.set(r,t),t+n;if(i===iC.OP_PUSHDATA2)return e[t++]=255&n,e[t++]=n>>8&255,e.set(r,t),t+n;if(i===iC.OP_PUSHDATA4){let i=n>>>0;return e[t++]=255&i,e[t++]=i>>8&255,e[t++]=i>>16&255,e[t++]=i>>24&255,e.set(r,t),t+n}return t}static readPushdataLength(e,t,i,r){if(e>0&&e<iC.OP_PUSHDATA1)return{len:e,newPos:i,hasLength:!0};if(e===iC.OP_PUSHDATA1){let e=i<r;return{len:e?t[i++]??0:0,newPos:i,hasLength:e}}if(e===iC.OP_PUSHDATA2){let e=i+1<r;return{len:(t[i]??0)|(t[i+1]??0)<<8,newPos:Math.min(i+2,r),hasLength:e}}let n=i+3<r;return{len:((t[i]??0)|(t[i+1]??0)<<8|(t[i+2]??0)<<16|(t[i+3]??0)<<24)>>>0,newPos:Math.min(i+4,r),hasLength:n}}static parseChunks(e){let t=[],i=e.length,r=0,n=0;for(;r<i;){let s=e[r++]??0;if(s===iC.OP_RETURN&&0===n){t.push({op:s,data:iU.copyRange(e,r,i)});break}if(s===iC.OP_IF||s===iC.OP_NOTIF||s===iC.OP_VERIF||s===iC.OP_VERNOTIF?n++:s===iC.OP_ENDIF&&n--,s>0&&s<=iC.OP_PUSHDATA4){let{len:n,newPos:a,hasLength:o}=iU.readPushdataLength(s,e,r,i),l=Math.min((r=a)+n,i),c=!o||l-r!==n;t.push({data:iU.copyRange(e,r,l),op:s,invalidLength:c}),r=l}else t.push({op:s})}return t}static removeOpcodeBytes(e,t){let i=[],r=e.length,n=0;for(;n<r;){let s=n,a=e[n++]??0;if(a>0&&a<=iC.OP_PUSHDATA4){let{len:o,newPos:l}=iU.readPushdataLength(a,e,n,r),c=Math.min((n=l)+o,r);if(a!==t)for(let t=s;t<c;t++)i.push(e[t]??0);n=c}else a!==t&&i.push(a)}return i}static copyRange(e,t,i){let r=Math.max(i-t,0),n=Array(r);for(let i=0;i<r;i++)n[i]=e[t+i]??0;return n}_chunkToString(e){let t=e.op,i="";if(void 0===e.data){let e=iC[t];i=`${i} ${e}`}else i=`${i} ${tg(e.data)}`;return i}}let iF=new Uint8Array(0);class iD extends t2{static SIGHASH_ALL=1;static SIGHASH_NONE=2;static SIGHASH_SINGLE=3;static SIGHASH_CHRONICLE=32;static SIGHASH_FORKID=64;static SIGHASH_ANYONECANPAY=128;scope;static formatOTDA(e){let t=(e.scope&iD.SIGHASH_ANYONECANPAY)===iD.SIGHASH_ANYONECANPAY,i=(31&e.scope)===iD.SIGHASH_SINGLE,r=(31&e.scope)===iD.SIGHASH_NONE,n=(31&e.scope)===iD.SIGHASH_ALL||!i&&!r,s=iU.fromBinary(e.subscript.toBinary());s.removeCodeseparators();let a={sourceTXID:e.sourceTXID,sourceOutputIndex:e.sourceOutputIndex,sequence:e.inputSequence,script:s.toBinary()},o=new tP;function l(e){for(let t of(o.writeVarIntNum(e.length),e))o.writeReverse(tm(t.sourceTXID,"hex")),o.writeUInt32LE(t.sourceOutputIndex),o.writeVarIntNum(t.script.length),o.write(t.script),o.writeUInt32LE(t.sequence)}function c(e){for(let t of(o.writeVarIntNum(e.length),e))o.writeUInt64LE(t.satoshis),o.writeVarIntNum(t.script.length),o.write(t.script)}o.writeInt32LE(e.transactionVersion);let h=new iU().toBinary();if(t)t&&l([a]);else{let t=e.otherInputs.map(e=>({sourceTXID:e.sourceTXID??e.sourceTransaction?.id("hex")??"",sourceOutputIndex:e.sourceOutputIndex,sequence:i||r?0:e.sequence??0xffffffff,script:h}));t.splice(e.inputIndex,0,a),l(t)}if(n)c(e.outputs.map(e=>({satoshis:e.satoshis??0,script:e.lockingScript.toBinary()})));else if(i){let t=[];for(let i=0;i<e.inputIndex;i++)t.push({satoshis:-1,script:h});let i=e.outputs[e.inputIndex];void 0!==i&&t.push({satoshis:i.satoshis??0,script:i.lockingScript.toBinary()}),c(t)}else r&&c([]);return o.writeUInt32LE(e.lockTime),o.writeUInt32LE(e.scope>>>0),o.toUint8Array()}static formatBip143(e){let t=e.cache,i={sourceTXID:e.sourceTXID,sourceOutputIndex:e.sourceOutputIndex,sequence:e.inputSequence},r=[...e.otherInputs];function n(t){let i=new tP;if(void 0===t)for(let t of e.outputs){let e=t.satoshis??0;i.writeUInt64LE(e);let r=t.lockingScript?.toUint8Array()??iF;i.writeVarIntNum(r.length),i.write(r)}else{let r=e.outputs[t];if(void 0===r)throw Error(`Output at index ${t} does not exist`);let n=r.satoshis??0;i.writeUInt64LE(n);let s=r.lockingScript?.toUint8Array()??iF;i.writeVarIntNum(s.length),i.write(s)}return ek(i.toUint8Array())}r.splice(e.inputIndex,0,i);let s=Array(32).fill(0),a=Array(32).fill(0),o=Array(32).fill(0);if((e.scope&iD.SIGHASH_ANYONECANPAY)==0&&(t?.hashPrevouts==null?(s=(()=>{let e=new tP;for(let t of r){if(void 0===t.sourceTXID){if(null==t.sourceTransaction)throw Error("Missing sourceTransaction for input");e.write(t.sourceTransaction.hash())}else e.writeReverse(tm(t.sourceTXID,"hex"));e.writeUInt32LE(t.sourceOutputIndex)}return ek(e.toUint8Array())})(),null!=t&&(t.hashPrevouts=s)):s=t.hashPrevouts),(e.scope&iD.SIGHASH_ANYONECANPAY)==0&&(31&e.scope)!==iD.SIGHASH_SINGLE&&(31&e.scope)!==iD.SIGHASH_NONE&&(t?.hashSequence==null?(a=(()=>{let e=new tP;for(let t of r){let i=t.sequence??0xffffffff;e.writeUInt32LE(i)}return ek(e.toUint8Array())})(),null!=t&&(t.hashSequence=a)):a=t.hashSequence),(31&e.scope)!==iD.SIGHASH_SINGLE&&(31&e.scope)!==iD.SIGHASH_NONE)t?.hashOutputsAll==null?(o=n(),null!=t&&(t.hashOutputsAll=o)):o=t.hashOutputsAll;else if((31&e.scope)===iD.SIGHASH_SINGLE&&e.inputIndex<e.outputs.length){let i=e.inputIndex,r=t?.hashOutputsSingle?.get(i);null==r?(o=n(i),null!=t&&(t.hashOutputsSingle??=new Map,t.hashOutputsSingle.set(i,o))):o=r}let l=new tP;l.writeInt32LE(e.transactionVersion),l.write(s),l.write(a),l.writeReverse(tm(e.sourceTXID,"hex")),l.writeUInt32LE(e.sourceOutputIndex);let c=e.subscript.toUint8Array();l.writeVarIntNum(c.length),l.write(c),l.writeUInt64LE(e.sourceSatoshis);let h=i.sequence;return l.writeUInt32LE(h),l.write(o),l.writeUInt32LE(e.lockTime),l.writeUInt32LE(e.scope>>>0),l.toUint8Array()}static format(e){return Array.from(this.formatBytes(e))}static formatBytes(e){let t=(e.scope&iD.SIGHASH_FORKID)!=0,i=!0!==e.ignoreChronicle&&(e.scope&iD.SIGHASH_CHRONICLE)!=0;return t&&!i?iD.formatBip143(e):!t||t&&i?iD.formatOTDA(e):new Uint8Array(0)}static usesOtdaSingleBug(e){let t=(e.scope&iD.SIGHASH_FORKID)!=0,i=!0!==e.ignoreChronicle&&(e.scope&iD.SIGHASH_CHRONICLE)!=0;return(!t||t&&i)&&(31&e.scope)===iD.SIGHASH_SINGLE&&e.inputIndex>=e.outputs.length}static fromChecksigFormat(e){if(0===e.length)return new iD(new A(1),new A(1),1);let t=e.at(-1),i=e.slice(0,e.length-1),r=t2.fromDER(i);return new iD(r.r,r.s,t)}constructor(e,t,i){super(e,t),this.scope=i}hasLowS(){return!(this.s.ltn(1)||this.s.gt(new A("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))}toChecksigFormat(){return[...this.toDER(),this.scope]}}class iL{curve;constructor(){this.curve=new t1}generateProof(e,t,i,r){let n=ih.fromRandom(),s=n.toPublicKey(),a=i.mul(n),o=this.computeChallenge(t,i,r,a,s);return{R:s,SPrime:a,z:n.add(o.mul(e)).umod(this.curve.n)}}verifyProof(e,t,i,r){let{R:n,SPrime:s,z:a}=r,o=this.computeChallenge(e,t,i,s,n),l=this.curve.g.mul(a),c=n.add(e.mul(o));if(!l.eq(c))return!1;let h=t.mul(a),d=s.add(i.mul(o));return!!h.eq(d)}computeChallenge(e,t,i,r,n){return new A(ev([...e.encode(!0),...t.encode(!0),...i.encode(!0),...r.encode(!0),...n.encode(!0)])).umod(this.curve.n)}}let iV=/^[0-9a-fA-F]+$/,iH=BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),iM=BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),iK=iH-3n,iq=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),i$={x:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),y:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},iz=iM>>1n;class iW{p=iH;n=iM;a=iK;b=iq;g=i$;mod(e,t=this.p){let i=e%t;return i>=0n?i:i+t}modInv(e,t){if(0n===e||t<=0n)throw Error("Invalid mod inverse input");let[i,r]=[this.mod(e,t),t],[n,s]=[1n,0n];for(;0n!==r;){let e=i/r;[i,r]=[r,i-e*r],[n,s]=[s,n-e*s]}if(1n!==i)throw Error("Inverse does not exist");return this.mod(n,t)}modPow(e,t,i){if(1n===i)return 0n;let r=1n,n=this.mod(e,i),s=t;for(;s>0n;)(1n&s)===1n&&(r=this.mod(r*n,i)),s>>=1n,n=this.mod(n*n,i);return r}isInfinity(e){return null===e}assertOnCurve(e){if(this.isInfinity(e))return;let{x:t,y:i}=e;if(this.mod(i*i)!==this.mod(this.mod(t*t*t+this.a*t)+this.b))throw Error("Point is not on secp256r1")}pointFromAffine(e,t){let i={x:this.mod(e),y:this.mod(t)};return this.assertOnCurve(i),i}pointFromHex(e){if(e.startsWith("04")){let t=BigInt("0x"+e.slice(2,66)),i=BigInt("0x"+e.slice(66));return this.pointFromAffine(t,i)}if(e.startsWith("02")||e.startsWith("03")){let t=BigInt("0x"+e.slice(2)),i=this.mod(this.mod(t*t*t+this.a*t)+this.b),r=this.modPow(i,this.p+1n>>2n,this.p),n=(1n&r)===1n===e.startsWith("03")?r:this.p-r;return this.pointFromAffine(t,n)}throw Error("Invalid point encoding")}pointToHex(e,t=!1){if(this.isInfinity(e))return"00";let i=this.to32BytesHex(e.x),r=this.to32BytesHex(e.y);return t?((1n&e.y)===0n?"02":"03")+i:"04"+i+r}addPoints(e,t){if(this.isInfinity(e))return t;if(this.isInfinity(t))return e;let{x:i,y:r}=e,{x:n,y:s}=t;if(i===n)return r===s?this.doublePoint(e):null;let a=this.mod((s-r)*this.modInv(n-i,this.p)),o=this.mod(a*a-i-n),l=this.mod(a*(i-o)-r);return{x:o,y:l}}doublePoint(e){if(this.isInfinity(e))return e;if(0n===e.y)return null;let t=this.mod((3n*e.x*e.x+this.a)*this.modInv(2n*e.y,this.p)),i=this.mod(t*t-2n*e.x),r=this.mod(t*(e.x-i)-e.y);return{x:i,y:r}}add(e,t){return this.addPoints(e,t)}multiply(e,t){if(0n===t||this.isInfinity(e))return null;let i=this.mod(t,this.n),r=null,n=e;for(;i>0n;)(1n&i)===1n&&(r=this.addPoints(r,n)),n=this.doublePoint(n),i>>=1n;return r}multiplyBase(e){return this.multiply(this.g,e)}isOnCurve(e){try{return this.assertOnCurve(e),!0}catch(e){return!1}}generatePrivateKeyHex(){return this.to32BytesHex(this.randomScalar())}randomScalar(){for(;;){let e=BigInt("0x"+tg(ia(32)));if(e>0n&&e<this.n)return e}}normalizePrivateKey(e){let t=this.mod(e,this.n);if(0n===t)throw Error("Invalid private key");return t}toScalar(e){if("bigint"==typeof e)return this.normalizePrivateKey(e);let t=e.startsWith("0x")?e.slice(2):e;if(!iV.test(t)||0===t.length||t.length>64)throw Error("Private key must be a hex string <= 32 bytes");let i=BigInt("0x"+t.padStart(64,"0"));return this.normalizePrivateKey(i)}publicKeyFromPrivate(e){let t=this.toScalar(e);return this.multiplyBase(t)}sign(e,t,i={}){let{prehashed:r=!1,nonce:n}=i,s=this.toScalar(t),a=this.normalizeMessage(e,r),o=this.bytesToScalar(a),l=n??this.deterministicNonce(s,a);for(;;){let e=this.multiplyBase(l);if(this.isInfinity(e)){l=n??this.deterministicNonce(s,a);continue}let t=this.mod(e.x,this.n);if(0n===t){l=n??this.deterministicNonce(s,a);continue}let i=this.modInv(l,this.n),r=this.mod(i*(o+t*s),this.n);if(0n===r){l=n??this.deterministicNonce(s,a);continue}return r>iz&&(r=this.n-r),{r:this.to32BytesHex(t),s:this.to32BytesHex(r)}}}verify(e,t,i,r={}){let n,{prehashed:s=!1}=r;try{n="string"==typeof i?this.pointFromHex(i):i}catch{return!1}if(null==n||!this.isOnCurve(n))return!1;let a="bigint"==typeof t.r?t.r:BigInt("0x"+t.r),o="bigint"==typeof t.s?t.s:BigInt("0x"+t.s);if(a<=0n||a>=this.n||o<=0n||o>=this.n)return!1;let l=this.bytesToScalar(this.normalizeMessage(e,s)),c=this.modInv(o,this.n),h=this.mod(l*c,this.n),d=this.mod(a*c,this.n),u=this.addPoints(this.multiplyBase(h),this.multiply(n,d));return!this.isInfinity(u)&&this.mod(u.x,this.n)===a}normalizeMessage(e,t){let i=this.toBytes(e);return t?i:new Uint8Array(ev(i))}bytesToScalar(e){return BigInt("0x"+tg(Array.from(e)))%this.n}deterministicNonce(e,t){let i=tm(this.to32BytesHex(e),"hex"),r=0;for(;r<1024;){let e=BigInt("0x"+tg(eE(i,0===r?Array.from(t):Array.from(t).concat([255&r]))))%this.n;if(e>0n)return e;r++}throw Error("Failed to derive deterministic nonce")}toBytes(e){if("string"==typeof e){let t=iV.test(e)&&e.length%2==0;return Uint8Array.from(tm(e,t?"hex":"utf8"))}if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unsupported message format")}to32BytesHex(e){return e.toString(16).padStart(64,"0")}}class ij extends iU{isLockingScript(){return!0}isUnlockingScript(){return!1}}class iG extends iU{isLockingScript(){return!1}isUnlockingScript(){return!0}}class iX extends Error{txid;outputIndex;context;programCounter;stackState;altStackState;ifStackState;stackMem;altStackMem;constructor(e){const t=e.stackState.map(e=>null!=e&&void 0!==e.length?tg(e):null==e?"null/undef":"INVALID_STACK_ITEM").join(", "),i=e.altStackState.map(e=>null!=e&&void 0!==e.length?tg(e):null==e?"null/undef":"INVALID_STACK_ITEM").join(", "),r=`Context: ${e.context}, PC: ${e.programCounter}`,n=`Stack: [${t}] (len: ${e.stackState.length}, mem: ${e.stackMem})`,s=`AltStack: [${i}] (len: ${e.altStackState.length}, mem: ${e.altStackMem})`,a=`IfStack: [${e.ifStackState.join(", ")}]`;super(`Script evaluation error: ${e.message}
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bsv=t():e.bsv=t()}(this,()=>(()=>{"use strict";let e,t,i,r,n;var s,a,o,l,c,h,d,u,f={};f.d=(e,t,i)=>{var r=(t,i)=>{for(var r in t)f.o(t,r)&&!f.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,[i]:t[r]})};r(t,"get"),r(i,"value")},f.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),f.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};f.r(p),f.d(p,{ARC:()=>rs,ATOMIC_BEEF:()=>ru,AuthFetch:()=>n6,BEEF_V1:()=>rh,BEEF_V2:()=>rd,BSM:()=>v,Beef:()=>rp,BeefParty:()=>rb,BeefTx:()=>rf,BigNumber:()=>A,BlockHeadersService:()=>rE,Brc29RemittanceModule:()=>sW,CachedKeyDeriver:()=>rj,Certificate:()=>r1,CompletedProtoWallet:()=>nY,Curve:()=>t1,DEFAULT_IDENTITY_CLIENT_OPTIONS:()=>sw,DEFAULT_REMITTANCE_MESSAGEBOX:()=>sL,DEFAULT_SLAP_TRACKERS:()=>si,DEFAULT_TESTNET_SLAP_TRACKERS:()=>sr,DEFAULT_UHRP_SERVERS:()=>sp,DefaultLockingScriptProvider:()=>sz,DefaultNonceProvider:()=>s$,ECDSA:()=>m,ECIES:()=>rK,EncryptedMessage:()=>w,FetchHttpClient:()=>ri,GlobalKVStore:()=>sU,HD:()=>rU,HTTPSOverlayBroadcastFacilitator:()=>sa,HTTPSOverlayLookupFacilitator:()=>sn,HTTPWalletJSON:()=>nt,HTTPWalletWire:()=>r5,Hash:()=>g,IdentityClient:()=>sA,InvoiceHandle:()=>sM,InvokableWalletBase:()=>rQ,KNOWN_IDENTITY_TYPES:()=>sv,KeyDeriver:()=>rW,KeyShares:()=>ic,LivePolicy:()=>i7,LocalKVStore:()=>sP,LockingScript:()=>ij,LookupResolver:()=>ss,MasterCertificate:()=>nG,MerklePath:()=>rc,Mnemonic:()=>rD,NodejsHttpClient:()=>rt,OP:()=>iC,OverlayAdminTokenTemplate:()=>n4,P2PKH:()=>i3,Peer:()=>n8,Point:()=>t0,PointInFiniteField:()=>io,Polynomial:()=>il,PrivateKey:()=>ih,ProtoWallet:()=>rX,PublicKey:()=>ii,PushDrop:()=>i4,REMITTANCE_STATE_TRANSITIONS:()=>sF,RPuzzle:()=>i5,Random:()=>ia,ReactNativeWebView:()=>ni,RegistryClient:()=>sT,RemittanceManager:()=>sV,RenewResiliencyError:()=>sg,SAT_UNIT:()=>sD,SHIPBroadcaster:()=>so,SHIPCast:()=>so,SatoshisPerKilobyte:()=>i9,Schnorr:()=>iL,Script:()=>iU,ScriptEvaluationError:()=>iX,Secp256r1:()=>iW,SecurityLevels:()=>h,SessionManager:()=>nJ,Signature:()=>t2,SignedMessage:()=>b,SimplifiedFetchTransport:()=>n5,Spend:()=>i0,StorageDownloader:()=>sm,StorageUploader:()=>sy,StorageUtils:()=>k,SymmetricKey:()=>i_,TOTP:()=>r$,TX_DATA_FORMAT:()=>c,Teranode:()=>rS,ThreadHandle:()=>sH,TopicBroadcaster:()=>so,Transaction:()=>rg,TransactionSignature:()=>iD,UnlockingScript:()=>iG,Utils:()=>y,Validation:()=>I,VerifiableCertificate:()=>nX,WERR_INSUFFICIENT_FUNDS:()=>ne,WERR_INVALID_PARAMETER:()=>r7,WERR_REVIEW_ACTIONS:()=>r4,WalletClient:()=>nW,WalletError:()=>rJ,WalletErrors:()=>rZ,WalletWireProcessor:()=>nj,WalletWireTransceiver:()=>r3,WhatsOnChain:()=>ro,WhatsOnChainBroadcaster:()=>rw,WindowCWISubstrate:()=>rY,XDM:()=>r0,binaryHttpClient:()=>rk,createNonce:()=>nQ,defaultBroadcaster:()=>ra,defaultChainTracker:()=>rl,defaultHttpClient:()=>rr,defaultIdentity:()=>sb,deserializeWalletProtocol:()=>sO,fromUtxo:()=>rq,getVerifiableCertificates:()=>n0,isBroadcastFailure:()=>rm,isBroadcastResponse:()=>ry,validateCertificates:()=>n1,verifyNonce:()=>nZ,walletErrors:()=>d,withDoubleSpendRetry:()=>sl});var g={};f.r(g),f.d(g,{RIPEMD160:()=>ec,SHA1:()=>ed,SHA1HMAC:()=>ep,SHA256:()=>eh,SHA256HMAC:()=>ef,SHA512:()=>eu,SHA512HMAC:()=>eg,hash160:()=>eS,hash256:()=>ek,htonl:()=>L,pbkdf2:()=>tn,realHtonl:()=>to,ripemd160:()=>eb,sha1:()=>ew,sha256:()=>ev,sha256hmac:()=>eE,sha512:()=>eI,sha512hmac:()=>ex,swapBytes32:()=>ts,toArray:()=>D});var y={};f.r(y),f.d(y,{Reader:()=>tN,ReaderUint8Array:()=>tc,Writer:()=>tP,WriterUint8Array:()=>tl,base64ToArray:()=>tv,constantTimeEquals:()=>tU,encode:()=>tk,fromBase58:()=>tx,fromBase58Check:()=>tO,minimallyEncode:()=>t_,toArray:()=>tm,toBase58:()=>tA,toBase58Check:()=>tT,toBase64:()=>tS,toHex:()=>tg,toUTF8:()=>tI,toUint8Array:()=>ty,verifyNotNull:()=>tB,zero2:()=>tu});var m={};f.r(m),f.d(m,{sign:()=>ie,verify:()=>it});var b={};f.r(b),f.d(b,{sign:()=>rA,verify:()=>rT});var w={};f.r(w),f.d(w,{decrypt:()=>rN,encrypt:()=>rP});var v={};f.r(v),f.d(v,{magicHash:()=>rR,sign:()=>rC,verify:()=>rB});var I={};f.r(I),f.d(I,{isHexString:()=>nw,parseWalletOutpoint:()=>nr,specOpThrowReviewActions:()=>nz,validateAbortActionArgs:()=>nA,validateAcquireDirectCertificateArgs:()=>nV,validateAcquireIssuanceCertificateArgs:()=>nL,validateBase64String:()=>ny,validateBasketInsertion:()=>nO,validateCreateActionArgs:()=>nS,validateCreateActionInput:()=>nv,validateCreateActionOptions:()=>nk,validateCreateActionOutput:()=>nI,validateDiscoverByAttributesArgs:()=>nK,validateDiscoverByIdentityKeyArgs:()=>nM,validateInteger:()=>nl,validateInternalizeActionArgs:()=>n_,validateInternalizeOutput:()=>nP,validateListActionsArgs:()=>n$,validateListCertificatesArgs:()=>nF,validateListOutputsArgs:()=>nq,validateOptionalInteger:()=>no,validateOptionalOutpointString:()=>nR,validateOriginator:()=>nN,validateOutpointString:()=>nC,validatePositiveIntegerOrZero:()=>nc,validateProveCertificateArgs:()=>nH,validateRelinquishCertificateArgs:()=>nU,validateRelinquishOutputArgs:()=>nB,validateSatoshis:()=>na,validateSignActionArgs:()=>nx,validateSignActionOptions:()=>nE,validateStringLength:()=>nh,validateWalletPayment:()=>nT});var k={};f.r(k),f.d(k,{getHashFromURL:()=>su,getURLForFile:()=>sd,getURLForHash:()=>sh,isValidURL:()=>sf,normalizeURL:()=>sc});let S="u"<typeof globalThis?void 0:globalThis.Buffer,E=null!=S&&"function"==typeof S.from,x=new Int8Array(256).fill(-1);for(let e=0;e<10;e++)x[48+e]=e;for(let e=0;e<6;e++)x[65+e]=10+e,x[97+e]=10+e;class A{static zeros=["","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"];static groupSizes=[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];static groupBases=[0,0,0x2000000,0x290d741,0x1000000,0x2e90edd,0x39aa400,0x267bf47,0x1000000,0x290d741,1e7,0x12959c3,0x222c000,0x3bd7765,7529536,0xadcea1,0x1000000,0x1704f61,0x206fc40,0x2cddcf9,64e6,4084101,5153632,6436343,7962624,9765625,0xb54ba0,0xdaf26b,0x1069c00,0x138f9ad,243e5,0x1b4d89f,0x2000000,0x25528a1,0x2b54a20,0x3216b93,0x39aa400];static wordSize=26;static WORD_SIZE_BIGINT=BigInt(A.wordSize);static WORD_MASK=(1n<<A.WORD_SIZE_BIGINT)-1n;static MAX_SAFE_INTEGER_BIGINT=BigInt(Number.MAX_SAFE_INTEGER);static MIN_SAFE_INTEGER_BIGINT=BigInt(Number.MIN_SAFE_INTEGER);static MAX_IMULN_ARG=0x3ffffff;static MAX_NUMBER_CONSTRUCTOR_MAG_BIGINT=(1n<<53n)-1n;_magnitude=0n;_sign=0;_nominalWordLength=1;red;get negative(){return this._sign}set negative(e){this.assert(0===e||1===e,"Negative property must be 0 or 1"),0n===this._magnitude?this._sign=0:this._sign=+(1===e)}get _computedWordsArray(){if(0n===this._magnitude)return[0];let e=[],t=this._magnitude;for(;t>0n;)e.push(Number(t&A.WORD_MASK)),t>>=A.WORD_SIZE_BIGINT;return e.length>0?e:[0]}get words(){let e=this._computedWordsArray;if(this._nominalWordLength<=e.length)return e;let t=Array(this._nominalWordLength).fill(0);for(let i=0;i<e.length;i++)t[i]=e[i];return t}set words(e){let t=this._sign,i=0n,r=e.length>0?e.length:1;for(let t=r-1;t>=0;t--){let r=e[t]??0;i=i<<A.WORD_SIZE_BIGINT|BigInt(r&Number(A.WORD_MASK))}this._magnitude=i,this._sign=t,this._nominalWordLength=r,this.normSign()}get length(){return Math.max(1,this._nominalWordLength)}static isBN(e){return e instanceof A||null!==e&&"object"==typeof e&&e.constructor?.wordSize===A.wordSize&&Array.isArray(e.words)}static max(e,t){return e.cmp(t)>0?e:t}static min(e,t){return 0>e.cmp(t)?e:t}constructor(e=0,t=10,i="be"){if(this.red=null,null===(e??=0))return void this._initializeState(0n,0);if("bigint"==typeof e){this._initializeState(e<0n?-e:e,+(e<0n)),this.normSign();return}let r=t,n=i;if(("le"===t||"be"===t)&&(n=t,r=10),"number"==typeof e)return void this.initNumber(e,n);if(Array.isArray(e))return void this.initArray(e,n);if("string"==typeof e)return void this._initFromString(e,r,n);0!==e?this.assert(!1,"Unsupported input type for BigNumber constructor"):this._initializeState(0n,0)}_initFromString(e,t,i){"hex"===t&&(t=16),this.assert("number"==typeof t&&t===(0|t)&&t>=2&&t<=36,"Base must be an integer between 2 and 36");let r=e.toString().replace(/\s+/g,""),n=0,s=0;r.startsWith("-")?(n++,s=1):r.startsWith("+")&&n++;let a=r.substring(n);if(0===a.length){this._initializeState(0n,1===s&&r.startsWith("-")?1:0),this.normSign();return}16===t?this._initFromHexString(a,s,i):this._initFromNonHexString(a,t,s,i)}_initFromHexString(e,t,i){if("le"===i){let i=[],r=e;r.length%2!=0&&(r="0"+r);for(let e=0;e<r.length;e+=2){let t=Number.parseInt(r.substring(e,e+2),16);if(Number.isNaN(t))throw Error("Invalid character in "+r);i.push(t)}this.initArray(i,"le"),this._sign=t,this.normSign()}else{let i;try{i=BigInt("0x"+e)}catch(t){throw Error("Invalid character in "+e)}this._initializeState(i,t),this.normSign()}}_initFromNonHexString(e,t,i,r){try{if(this._parseBaseString(e,t),this._sign=i,this.normSign(),"le"===r){let e=this._sign;this.initArray(this.toArray("be"),"le"),this._sign=e,this.normSign()}}catch(e){if(e.message.includes("Invalid character in string")||e.message.includes("Invalid digit for base")||e.message.startsWith("Invalid character:"))throw Error("Invalid character");throw e}}_bigIntToStringInBase(e,t){if(0n===e)return"0";if(t<2||t>36)throw Error("Base must be between 2 and 36");let i="",r=e>0n?e:-e,n=BigInt(t);for(;r>0n;)i="0123456789abcdefghijklmnopqrstuvwxyz"[Number(r%n)]+i,r/=n;return i}_parseBaseString(e,t){if(0===e.length){this._magnitude=0n,this._finishInitialization();return}this._magnitude=0n;let i=BigInt(t),r=A.groupSizes[t],n=BigInt(A.groupBases[t]);(0===r||0n===n)&&(0===(r=Math.floor(Math.log(0x3ffffff)/Math.log(t)))&&(r=1),n=i**BigInt(r));let s=0,a=e.length,o=a%r;if(0===o&&a>0&&(o=r),o>0){let i=e.substring(s,s+o);this._magnitude=BigInt(this._parseBaseWord(i,t)),s+=o}for(;s<a;){let i=e.substring(s,s+r),a=BigInt(this._parseBaseWord(i,t));this._magnitude=this._magnitude*n+a,s+=r}this._finishInitialization()}_parseBaseWord(e,t){let i=0;for(let r=0;r<e.length;r++){let n,s=e.codePointAt(r);if(s>=48&&s<=57)n=s-48;else if(s>=65&&s<=90)n=s-65+10;else if(s>=97&&s<=122)n=s-97+10;else throw Error("Invalid character: "+e[r]);if(n>=t)throw Error("Invalid character");i=i*t+n}return i}_initializeState(e,t){this._magnitude=e,this._sign=0n===e?0:t,this._finishInitialization()}_finishInitialization(){if(0n===this._magnitude)this._nominalWordLength=1,this._sign=0;else{let e=this._magnitude.toString(2).length;this._nominalWordLength=Math.max(1,Math.ceil(e/A.wordSize))}}assert(e,t="Assertion failed"){if(!e)throw Error(t)}initNumber(e,t="be"){if(this.assert(BigInt(Math.abs(e))<=A.MAX_NUMBER_CONSTRUCTOR_MAG_BIGINT,"The number is larger than 2 ^ 53 (unsafe)"),this.assert(e%1==0,"Number must be an integer for BigNumber conversion"),this._initializeState(BigInt(Math.abs(e)),+(e<0)),"le"===t){let e=this._sign,t=this.toArray("be");this.initArray(t,"le"),this._sign=e,this.normSign()}return this}initArray(e,t){if(0===e.length)return this._initializeState(0n,0),this;let i=0n;if("be"===t)for(let t of e)i=i<<8n|BigInt(255&t);else for(let t=e.length-1;t>=0;t--)i=i<<8n|BigInt(255&e[t]);return this._initializeState(i,0),this}copy(e){e._magnitude=this._magnitude,e._sign=this._sign,e._nominalWordLength=this._nominalWordLength,e.red=this.red}static move(e,t){e._magnitude=t._magnitude,e._sign=t._sign,e._nominalWordLength=t._nominalWordLength,e.red=t.red}clone(){let e=new A(0n);return this.copy(e),e}expand(e){return this.assert(e>=0,"Expand size must be non-negative"),this._nominalWordLength=Math.max(this._nominalWordLength,e,1),this}strip(){return this._finishInitialization(),this.normSign()}normSign(){return 0n===this._magnitude&&(this._sign=0),this}inspect(){return(null===this.red?"<BN: ":"<BN-R: ")+this.toString(16)+">"}_getMinimalHex(){return 0n===this._magnitude?"0":this._magnitude.toString(16)}toString(e=10,t=1){if(16===e||"hex"===e){let e=this._getMinimalHex();if(t>1)for("0"!==e&&e.length%2!=0&&(e="0"+e);e.length%t!=0;)e="0"+e;return(this.isNeg()?"-":"")+e}if("number"!=typeof e||e<2||e>36||e%1!=0)throw Error("Base should be an integer between 2 and 36");return this.toBaseString(e,t)}toBaseString(e,t){if(0n===this._magnitude){let e="0";if(t>1)for(;e.length<t;)e="0"+e;return e}let i=A.groupSizes[e],r=BigInt(A.groupBases[e]);(0===i||0n===r)&&(0===(i=Math.floor(Math.log(Number.MAX_SAFE_INTEGER)/Math.log(e)))&&(i=1),r=BigInt(e)**BigInt(i));let n="",s=this._magnitude;for(;s>0n;){let t=s%r;s/=r;let a=this._bigIntToStringInBase(t,e);n=(s>0n?this._zeroPaddedChunk(a,i):a)+n}if(t>0)for(;n.length<t;)n="0"+n;return(1===this._sign?"-":"")+n}_zeroPaddedChunk(e,t){let i=t-e.length;return i<=0?e:i<A.zeros.length?A.zeros[i]+e:"0".repeat(i)+e}toNumber(){let e=this._getSignedValue();if(e>A.MAX_SAFE_INTEGER_BIGINT||e<A.MIN_SAFE_INTEGER_BIGINT)throw Error("Number can only safely store up to 53 bits");return Number(e)}toBigInt(){return this._getSignedValue()}toJSON(){let e=this._getMinimalHex();return(this.isNeg()?"-":"")+e}toArrayLikeGeneric(e,t){let i=this._magnitude,r=t?0:e.length-1,n=t?1:-1;for(let t=0;t<e.length;++t){if(0n===i&&r>=0&&r<e.length)e[r]=0;else if(r>=0&&r<e.length)e[r]=Number(255n&i);else break;i>>=8n,r+=n}}toArray(e="be",t){this.strip();let i=this.byteLength(),r=t??Math.max(1,i);this.assert(i<=r,"byte array longer than desired length"),this.assert(r>0,"Requested array length <= 0");let n=Array(r).fill(0);return 0n===this._magnitude&&r>0?n:0n===this._magnitude&&0===r?[]:(this.toArrayLikeGeneric(n,"le"===e),n)}bitLength(){return 0n===this._magnitude?0:this._magnitude.toString(2).length}static toBitArray(e){let t=e.bitLength();if(0===t)return[];let i=Array(t),r=e._magnitude;for(let e=0;e<t;e++)i[e]=+((r>>BigInt(e)&1n)!==0n);return i}toBitArray(){return A.toBitArray(this)}zeroBits(){if(0n===this._magnitude)return 0;let e=0,t=this._magnitude;for(;(1n&t)===0n&&0n!==t;)e++,t>>=1n;return e}byteLength(){return 0n===this._magnitude?0:Math.ceil(this.bitLength()/8)}_getSignedValue(){return 1===this._sign?-this._magnitude:this._magnitude}_setValueFromSigned(e){e<0n?(this._magnitude=-e,this._sign=1):(this._magnitude=e,this._sign=0),this._finishInitialization(),this.normSign()}toTwos(e){this.assert(e>=0);let t=BigInt(e),i=this._getSignedValue();1===this._sign&&0n!==this._magnitude&&(i=(1n<<t)+i),i&=(1n<<t)-1n;let r=new A(0n);return r._initializeState(i,0),r}fromTwos(e){this.assert(e>=0);let t=BigInt(e),i=this._magnitude;if(e>0&&(i>>t-1n&1n)!==0n&&0===this._sign){let e=new A(0n);return e._setValueFromSigned(i-(1n<<t)),e}return this.clone()}isNeg(){return 1===this._sign&&0n!==this._magnitude}neg(){return this.clone().ineg()}ineg(){return 0n!==this._magnitude&&(this._sign=+(1!==this._sign)),this}_iuop(e,t,i=!1){let r=t(this._magnitude,e._magnitude),n=this._nominalWordLength;return i&&(n=Math.max(this.length,e.length)),this._magnitude=r,this._finishInitialization(),i&&(this._nominalWordLength=Math.max(this._nominalWordLength,n)),this.strip()}iuor(e){return this._iuop(e,(e,t)=>e|t)}iuand(e){return this._iuop(e,(e,t)=>e&t)}iuxor(e){return this._iuop(e,(e,t)=>e^t,!0)}_iop(e,t,i=!1){return this.assert(0===this._sign&&0===e._sign),this._iuop(e,t,i)}ior(e){return this._iop(e,(e,t)=>e|t)}iand(e){return this._iop(e,(e,t)=>e&t)}ixor(e){return this._iop(e,(e,t)=>e^t,!0)}_uop_new(e,t){return this.length>=e.length?this.clone()[t](e):e.clone()[t](this)}or(e){return this.assert(0===this._sign&&0===e._sign),this._uop_new(e,"iuor")}uor(e){return this._uop_new(e,"iuor")}and(e){return this.assert(0===this._sign&&0===e._sign),this._uop_new(e,"iuand")}uand(e){return this._uop_new(e,"iuand")}xor(e){return this.assert(0===this._sign&&0===e._sign),this._uop_new(e,"iuxor")}uxor(e){return this._uop_new(e,"iuxor")}inotn(e){this.assert("number"==typeof e&&e>=0);let t=BigInt(e);this._magnitude=~this._magnitude&(1n<<t)-1n;let i=0===e?1:Math.ceil(e/A.wordSize);return this._nominalWordLength=Math.max(1,i),this.strip(),this._nominalWordLength=Math.max(this._nominalWordLength,Math.max(1,i)),this}notn(e){return this.clone().inotn(e)}setn(e,t){this.assert("number"==typeof e&&e>=0);let i=BigInt(e);1===t||!0===t?this._magnitude|=1n<<i:this._magnitude&=~(1n<<i);let r=Math.floor(e/A.wordSize)+1;return this._nominalWordLength=Math.max(this._nominalWordLength,r),this._finishInitialization(),this.strip()}iadd(e){return this._setValueFromSigned(this._getSignedValue()+e._getSignedValue()),this}add(e){let t=new A(0n);return t._setValueFromSigned(this._getSignedValue()+e._getSignedValue()),t}isub(e){return this._setValueFromSigned(this._getSignedValue()-e._getSignedValue()),this}sub(e){let t=new A(0n);return t._setValueFromSigned(this._getSignedValue()-e._getSignedValue()),t}mul(e){let t=new A(0n);return t._magnitude=this._magnitude*e._magnitude,t._sign=0n===t._magnitude?0:this._sign^e._sign,t._nominalWordLength=this.length+e.length,t.red=null,t.normSign()}imul(e){return this._magnitude*=e._magnitude,this._sign=0n===this._magnitude?0:this._sign^e._sign,this._nominalWordLength=this.length+e.length,this.red=null,this.normSign()}imuln(e){return this.assert("number"==typeof e,"Assertion failed"),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"Assertion failed"),this._setValueFromSigned(this._getSignedValue()*BigInt(e)),this}muln(e){return this.clone().imuln(e)}sqr(){let e=new A(0n);return e._magnitude=this._magnitude*this._magnitude,e._sign=0,e._nominalWordLength=2*this.length,e.red=null,e}isqr(){return this._magnitude*=this._magnitude,this._sign=0,this._nominalWordLength=2*this.length,this.red=null,this}pow(e){if(this.assert(0===e._sign,"Exponent for pow must be non-negative"),e.isZero())return new A(1n);let t=new A(1n),i=this.clone(),r=e.clone(),n=i.isNeg(),s=r.isOdd();for(n&&i.ineg();!r.isZero();)r.isOdd()&&t.imul(i),i.isqr(),r.iushrn(1);return n&&s&&t.ineg(),t}static normalizeNonNegativeBigInt(e,t){if("number"==typeof e){if(!Number.isFinite(e)||!Number.isInteger(e)||e<0)throw Error(`${t} must be a non-negative integer`);return BigInt(e)}if(e<0n)throw Error(`${t} must be a non-negative integer`);return e}iushln(e){let t=A.normalizeNonNegativeBigInt(e,"Shift bits");return 0n===t?this:(this._magnitude<<=t,this._finishInitialization(),this.strip())}ishln(e){return this.assert(0===this._sign,"ishln requires positive number"),this.iushln(e)}iushrn(e,t,i){let r=A.normalizeNonNegativeBigInt(e,"Shift bits");if(0n===r)return null!=i&&i._initializeState(0n,0),this;if(null!=i){let e=this._magnitude&(1n<<r)-1n;i._initializeState(e,0)}return this._magnitude>>=r,this._finishInitialization(),this.strip()}ishrn(e,t,i){return this.assert(0===this._sign,"ishrn requires positive number"),this.iushrn(e,t,i)}shln(e){return this.clone().ishln(e)}ushln(e){return this.clone().iushln(e)}shrn(e){return this.clone().ishrn(e)}ushrn(e){return this.clone().iushrn(e)}testn(e){return this.assert("number"==typeof e&&e>=0),(this._magnitude>>BigInt(e)&1n)!==0n}imaskn(e){this.assert("number"==typeof e&&e>=0),this.assert(0===this._sign,"imaskn works only with positive numbers");let t=BigInt(e);this._magnitude&=0n===t?0n:(1n<<t)-1n;let i=0===e?1:Math.max(1,Math.ceil(e/A.wordSize));return this._nominalWordLength=i,this._finishInitialization(),this._nominalWordLength=Math.max(this._nominalWordLength,i),this.strip()}maskn(e){return this.clone().imaskn(e)}iaddn(e){return this.assert("number"==typeof e),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"num is too large"),this._setValueFromSigned(this._getSignedValue()+BigInt(e)),this}_iaddn(e){return this.iaddn(e)}isubn(e){return this.assert("number"==typeof e),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"Assertion failed"),this._setValueFromSigned(this._getSignedValue()-BigInt(e)),this}addn(e){return this.clone().iaddn(e)}subn(e){return this.clone().isubn(e)}iabs(){return this._sign=0,this}abs(){return this.clone().iabs()}divmod(e,t,i){if(this.assert(!e.isZero(),"Division by zero"),this.isZero()){let e=new A(0n);return{div:"mod"===t?null:e,mod:"div"===t?null:e}}let r=this._getSignedValue(),n=e._getSignedValue(),s="mod"!==t?r/n:null,a=this._computeMod(r,n,t,i);return{div:this._bigNumberFromSigned(s),mod:this._bigNumberFromSigned(a)}}_computeMod(e,t,i,r){if("div"===i)return null;let n=e%t;return!0===r&&n<0n&&(n+=t<0n?-t:t),n}_bigNumberFromSigned(e){if(null===e)return null;let t=new A(0n);return t._setValueFromSigned(e),t}div(e){return this.divmod(e,"div",!1).div}mod(e){return this.divmod(e,"mod",!1).mod}umod(e){return this.divmod(e,"mod",!0).mod}divRound(e){this.assert(!e.isZero());let t=this._getSignedValue(),i=e._getSignedValue(),r=t/i,n=t%i;if(0n===n){let e=new A(0n);return e._setValueFromSigned(r),e}2n*(n<0n?-n:n)>=(i<0n?-i:i)&&(t>0n&&i>0n||t<0n&&i<0n?r+=1n:r-=1n);let s=new A(0n);return s._setValueFromSigned(r),s}modrn(e){this.assert(0!==e,"Division by zero in modrn");let t=BigInt(Math.abs(e));if(0n===t)throw Error("Division by zero in modrn");let i=this._magnitude%t;return e<0?Number(-i):Number(i)}idivn(e){return this.assert(0!==e),this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"num is too large"),this._setValueFromSigned(this._getSignedValue()/BigInt(e)),this}divn(e){return this.clone().idivn(e)}egcd(e){this.assert(0===e._sign,"p must not be negative"),this.assert(!e.isZero(),"p must not be zero");let t=this._getSignedValue(),i=e._magnitude,r=1n,n=0n,s=0n,a=1n;for(;0n!==i;){let e=t/i,o=i;i=t%i,t=o,o=n,n=r-e*n,r=o,o=a,a=s-e*a,s=o}let o=new A(0n);o._setValueFromSigned(r);let l=new A(0n);l._setValueFromSigned(s);let c=new A(0n);return c._initializeState(t<0n?-t:t,0),{a:o,b:l,gcd:c}}gcd(e){let t=this._magnitude,i=e._magnitude;if(0n===t){let e=new A(0n);return e._setValueFromSigned(i),e.iabs()}if(0n===i){let e=new A(0n);return e._setValueFromSigned(t),e.iabs()}for(;0n!==i;){let e=t%i;t=i,i=e}let r=new A(0n);return r._initializeState(t,0),r}invm(e){this.assert(!e.isZero()&&0===e._sign,"Modulus for invm must be positive and non-zero");let t=this.egcd(e);if(!t.gcd.eqn(1))throw Error("Inverse does not exist (numbers are not coprime).");return t.a.umod(e)}isEven(){return this._magnitude%2n===0n}isOdd(){return this._magnitude%2n===1n}andln(e){return this.assert(e>=0),Number(this._magnitude&BigInt(e))}bincn(e){this.assert("number"==typeof e&&e>=0);let t=1n<<BigInt(e);return this._setValueFromSigned(this._getSignedValue()+t),this}isZero(){return 0n===this._magnitude}cmpn(e){this.assert(Math.abs(e)<=A.MAX_IMULN_ARG,"Number is too big");let t=this._getSignedValue(),i=BigInt(e);return t<i?-1:+(t>i)}cmp(e){let t=this._getSignedValue(),i=e._getSignedValue();return t<i?-1:+(t>i)}ucmp(e){return this._magnitude<e._magnitude?-1:+(this._magnitude>e._magnitude)}gtn(e){return 1===this.cmpn(e)}gt(e){return 1===this.cmp(e)}gten(e){return this.cmpn(e)>=0}gte(e){return this.cmp(e)>=0}ltn(e){return -1===this.cmpn(e)}lt(e){return -1===this.cmp(e)}lten(e){return 0>=this.cmpn(e)}lte(e){return 0>=this.cmp(e)}eqn(e){return 0===this.cmpn(e)}eq(e){return 0===this.cmp(e)}toRed(e){return this.assert(null==this.red,"Already a number in reduction context"),this.assert(0===this._sign,"toRed works only with positives"),e.convertTo(this).forceRed(e)}fromRed(){return this.assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)}forceRed(e){return this.red=e,this}redAdd(e){return this.assert(this.red,"redAdd works only with red numbers"),this.red.add(this,e)}redIAdd(e){return this.assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)}redSub(e){return this.assert(this.red,"redSub works only with red numbers"),this.red.sub(this,e)}redISub(e){return this.assert(this.red,"redISub works only with red numbers"),this.red.isub(this,e)}redShl(e){return this.assert(this.red,"redShl works only with red numbers"),this.red.shl(this,e)}redMul(e){return this.assert(this.red,"redMul works only with red numbers"),this.red.verify2(this,e),this.red.mul(this,e)}redIMul(e){return this.assert(this.red,"redIMul works only with red numbers"),this.red.verify2(this,e),this.red.imul(this,e)}redSqr(){return this.assert(this.red,"redSqr works only with red numbers"),this.red.verify1(this),this.red.sqr(this)}redISqr(){return this.assert(this.red,"redISqr works only with red numbers"),this.red.verify1(this),this.red.isqr(this)}redSqrt(){return this.assert(this.red,"redSqrt works only with red numbers"),this.red.verify1(this),this.red.sqrt(this)}redInvm(){return this.assert(this.red,"redInvm works only with red numbers"),this.red.verify1(this),this.red.invm(this)}redNeg(){return this.assert(this.red,"redNeg works only with red numbers"),this.red.verify1(this),this.red.neg(this)}redPow(e){return this.assert(null!=this.red&&null==e.red,"redPow(normalNum)"),this.red.verify1(this),this.red.pow(this,e)}static fromHex(e,t){let i="be";return("little"===t||"le"===t)&&(i="le"),new A(e,16,i)}toHex(e=0){if(this.isZero()&&0===e)return"";let t=this._getMinimalHex();"0"!==t&&t.length%2!=0&&(t="0"+t);let i=2*e;for(;t.length<i;)t="0"+t;return(this.isNeg()?"-":"")+t}static fromJSON(e){return new A(e,16)}static fromNumber(e){return new A(e)}static fromString(e,t){return new A(e,t)}static fromSm(e,t="big"){let i;if(0===e.length)return new A(0n);let r=e.slice();"little"===t&&r.reverse();let n=0;if(r.length>0&&(128&r[0])!=0&&(n=1,r[0]&=127),E)i=S.from(r).toString("hex");else for(let e of(i="",r))i+=e<16?"0"+e.toString(16):e.toString(16);let s=0===i.length?0n:BigInt("0x"+i),a=new A(0n);return a._initializeState(s,n),a}toSm(e="big"){let t;if(0n===this._magnitude)return 1===this._sign?[128]:[];let i=this._getMinimalHex();i.length%2!=0&&(i="0"+i);let r=Array(i.length/2);for(let e=0,t=0;e<i.length;e+=2){let n=x[i.codePointAt(e)],s=x[i.codePointAt(e+1)];r[t++]=(15&n)<<4|15&s}return 1===this._sign?(128&r[0])==0?(t=r.slice(),t[0]|=128):t=[128,...r]:t=(128&r[0])==0?r.slice():[0,...r],"little"===e?t.reverse():t}static fromBits(e,t=!1){let i=e>>>24,r=8388607&e,n=(8388608&e)!=0;if(t&&n)throw Error("negative bit set");if(0===i&&0===r){if(n&&t)throw Error("negative bit set for zero value");return new A(0n)}let s=new A(r);return i<=3?s.iushrn((3-i)*8):s.iushln((i-3)*8),n&&s.ineg(),s}toBits(){let e;if(this.strip(),this.isZero()&&!this.isNeg())return 0;let t=this.isNeg(),i=this.abs(),r=i.toArray("be"),n=0;for(;n<r.length-1&&0===r[n];)n++;let s=(r=r.slice(n)).length;if(0!==s||i.isZero()||(r=[0],s=1),i.isZero()&&(s=0,r=[]),0===s)e=0;else if(s<=3){e=0;for(let t=0;t<s;t++)e=e<<8|r[t]}else e=r[0]<<16|r[1]<<8|r[2];(8388608&e)!=0&&s<=255&&(e>>>=8,s++);let a=s<<24|e;return t&&(a|=8388608),a>>>0}static fromScriptNum(e,t=!1,i){if(void 0!==i&&e.length>i)throw Error("script number overflow");if(0===e.length)return new A(0n);if(t&&(127&e.at(-1))==0&&(e.length<=1||(128&e.at(-2))==0))throw Error("non-minimally encoded script number");return A.fromSm(e,"little")}toScriptNum(){return this.toSm("little")}_invmp(e){this.assert(0===e._sign,"p must not be negative for _invmp"),this.assert(!e.isZero(),"p must not be zero for _invmp");let t=this.umod(e),i=e.subn(2);if(null!==t.red)return t.redPow(i);let r=new A(1n),n=t.clone(),s=i.clone();for(;!s.isZero();)s.isOdd()&&(r=r.mul(n).umod(e)),n=n.sqr().umod(e),s.iushrn(1);return r}mulTo(e,t){return t._magnitude=this._magnitude*e._magnitude,t._sign=0n===t._magnitude?0:this._sign^e._sign,t._nominalWordLength=this.length+e.length,t.red=null,t.normSign(),t}}class T{name;p;k;n;tmp;constructor(e,t){this.name=e,this.p=new A(t,16),this.n=this.p.bitLength(),this.k=new A(BigInt(1)).iushln(this.n).isub(this.p),this.tmp=this._tmp()}_tmp(){let e=new A(BigInt(0)),t=Math.ceil(this.n/A.wordSize);return e.expand(Math.max(1,t)),e}ireduce(e){let t;do this.split(e,this.tmp),this.imulK(e),e.iadd(this.tmp),t=e.bitLength();while(t>this.n);let i=t<this.n?-1:e.ucmp(this.p);return 0===i?e.words=[0]:i>0&&e.isub(this.p),e.strip(),e}split(e,t){e.iushrn(this.n,0,t)}imulK(e){return e.imul(this.k)}}class O extends T{constructor(){super("k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}split(e,t){let i=e.words,r=e.length,n=Math.min(r,9),s=Array(n+ +(r>9)).fill(0);for(let e=0;e<n;e++)s[e]=i[e];let a=n;if(r<=9){let i=Array(a);for(let e=0;e<a;++e)i[e]=s[e];t.words=i,e.words=[0];return}let o=i[9];s[a++]=4194303&o;let l=Array(a);for(let e=0;e<a;++e)l[e]=s[e];t.words=l;let c=Array(Math.max(1,r-9)).fill(0),h=0;for(let e=10;e<r;e++){let t=Math.trunc(i[e]);h<c.length&&(c[h++]=(4194303&t)<<4|o>>>22),o=t}o>>>=22,h<c.length?c[h++]=o:0!==o&&c.length;let d=Array(h);for(let e=0;e<h;++e)d[e]=c[e];e.words=d}imulK(e){let t=e.words,i=e.length,r=i+2,n=Array(r).fill(0);for(let e=0;e<i;e++)n[e]=t[e];let s=0;for(let e=0;e<r;e++){let t=Math.trunc(n[e]);s+=977*t,n[e]=0x3ffffff&s,s=64*t+Math.trunc(s/0x4000000)}return e.words=n,e}}class P{prime;m;constructor(e){if("k256"===e){const e=new O;this.m=e.p,this.prime=e}else this.assert(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}assert(e,t="Assertion failed"){if(!e)throw Error(t)}verify1(e){this.assert(0===e.negative,"red works only with positives"),this.assert(e.red,"red works only with red numbers")}verify2(e,t){this.assert((e.negative|t.negative)==0,"red works only with positives"),this.assert(null!=e.red&&e.red===t.red,"red works only with red numbers")}imod(e){return null!=this.prime?this.prime.ireduce(e).forceRed(this):(A.move(e,e.umod(this.m).forceRed(this)),e)}neg(e){return e.isZero()?e.clone():this.m.sub(e).forceRed(this)}add(e,t){this.verify2(e,t);let i=e.clone();return i.iadd(t),i.isub(this.m),i.isNeg()&&i.iadd(this.m),i}iadd(e,t){return this.verify2(e,t),e.iadd(t),e.isub(this.m),e.isNeg()&&e.iadd(this.m),e}sub(e,t){this.verify2(e,t);let i=e.sub(t);return 0>i.cmpn(0)&&i.iadd(this.m),i.forceRed(this)}isub(e,t){this.verify2(e,t);let i=e.isub(t);return 0>i.cmpn(0)&&i.iadd(this.m),i}shl(e,t){return this.verify1(e),this.imod(e.ushln(t))}imul(e,t){return this.verify2(e,t),this.imod(e.imul(t))}mul(e,t){return this.verify2(e,t),this.imod(e.mul(t))}isqr(e){return this.imul(e,e.clone())}sqr(e){return this.mul(e,e)}sqrt(e){if(e.isZero())return e.clone();let t=this.m.andln(3);if(this.assert(t%2==1),3===t){let t=this.m.add(new A(1)).iushrn(2);return this.pow(e,t)}let i=this.m.subn(1),r=0;for(;!i.isZero()&&0===i.andln(1);)r++,i.iushrn(1);this.assert(!i.isZero());let n=new A(1).toRed(this),s=n.redNeg(),a=this.m.subn(1).iushrn(1),o=this.m.bitLength(),l=new A(2*o*o).toRed(this);for(;0!==this.pow(l,a).cmp(s);)l.redIAdd(s);let c=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),u=r;for(;0!==d.cmp(n);){let e=d,t=0;for(;0!==e.cmp(n);t++)e=e.redSqr();this.assert(t<u);let i=this.pow(c,new A(1).iushln(u-t-1));h=h.redMul(i),c=i.redSqr(),d=d.redMul(c),u=t}return h}invm(e){let t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)}pow(e,t){if(this.verify1(e),t.isZero())return new A(1).toRed(this);let i=new A(1).toRed(this),r=e.clone(),n=t.bitLength();for(let e=n-1;e>=0;e--)i=this.sqr(i),t.testn(e)&&(i=this.mul(i,r));return i}convertTo(e){let t=e.umod(this.m);return t===e?t.clone():t}convertFrom(e){let t=e.clone();return t.red=null,t}}class N extends P{shift;r;r2;rinv;minv;constructor(e){super(e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new A(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)}convertTo(e){return this.imod(e.ushln(this.shift))}convertFrom(e){let t=this.imod(e.mul(this.rinv));return t.red=null,t}imul(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;let i=e.imul(t),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s.forceRed(this)}mul(e,t){if(e.isZero()||t.isZero())return new A(0).forceRed(this);let i=e.mul(t),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s.forceRed(this)}invm(e){return this.imod(e._invmp(this.m).mul(this.r2)).forceRed(this)}}class _{curve;type;precomputed;constructor(e){this.curve=new t1,this.type=e,this.precomputed=null}}class R extends _{x;y;z;zOne;constructor(e,t,i){super("jacobian"),null===e&&null===t&&null===i?(this.x=this.curve.one,this.y=this.curve.one,this.z=new A(0)):(A.isBN(e)||(e=new A(e,16)),this.x=e,A.isBN(t)||(t=new A(t,16)),this.y=t,A.isBN(i)||(i=new A(i,16)),this.z=i),null==this.x.red&&(this.x=this.x.toRed(this.curve.red)),null==this.y.red&&(this.y=this.y.toRed(this.curve.red)),null==this.z.red&&(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.isInfinity()&&(this.x=this.curve.one,this.y=this.curve.one,this.z=new A(0).toRed(this.curve.red),this.zOne=!1)}toP(){if(this.isInfinity())return new t0(null,null);let e=this.z.redInvm(),t=e.redSqr();return new t0(this.x.redMul(t),this.y.redMul(t).redMul(e))}neg(){return new R(this.x,this.y.redNeg(),this.z)}add(e){if(this.isInfinity())return e;if(e.isInfinity())return this;let t=e.z.redSqr(),i=this.z.redSqr(),r=this.x.redMul(t),n=e.x.redMul(i),s=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),o=r.redSub(n),l=s.redSub(a);if(0===o.cmpn(0))if(0===l.cmpn(0))return this.dbl();else return new R(null,null,null);let c=o.redSqr(),h=c.redMul(o),d=r.redMul(c),u=l.redSqr().redIAdd(h).redISub(d).redISub(d),f=l.redMul(d.redISub(u)).redISub(s.redMul(h));return new R(u,f,this.z.redMul(e.z).redMul(o))}mixedAdd(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;if(null===e.x||null===e.y)throw Error("Point coordinates cannot be null");let t=this.z.redSqr(),i=this.x,r=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),a=i.redSub(r),o=n.redSub(s);if(0===a.cmpn(0))if(0===o.cmpn(0))return this.dbl();else return new R(null,null,null);let l=a.redSqr(),c=l.redMul(a),h=i.redMul(l),d=o.redSqr().redIAdd(c).redISub(h).redISub(h),u=o.redMul(h.redISub(d)).redISub(n.redMul(c));return new R(d,u,this.z.redMul(a))}dblp(e){if(0===e||this.isInfinity())return this;if(void 0===e)return this.dbl();let t=this;for(let i=0;i<e;i++)t=t.dbl();return t}dbl(){let e,t,i;if(this.isInfinity())return this;if(this.zOne){let r=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(r).redISub(s);a=a.redIAdd(a);let o=r.redAdd(r).redIAdd(r),l=o.redSqr().redISub(a).redISub(a),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l,t=o.redMul(a.redISub(l)).redISub(c),i=this.y.redAdd(this.y)}else{let r=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),a=this.x.redAdd(n).redSqr().redISub(r).redISub(s);a=a.redIAdd(a);let o=r.redAdd(r).redIAdd(r),l=o.redSqr(),c=s.redIAdd(s);c=(c=c.redIAdd(c)).redIAdd(c),e=l.redISub(a).redISub(a),t=o.redMul(a.redISub(e)).redISub(c),i=(i=this.y.redMul(this.z)).redIAdd(i)}return new R(e,t,i)}eq(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e||this.isInfinity()&&e.isInfinity())return!0;if(this.isInfinity()!==e.isInfinity())return!1;let t=this.z.redSqr(),i=e.z.redSqr();if(0!==this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0))return!1;let r=t.redMul(this.z),n=i.redMul(e.z);return 0===this.y.redMul(n).redISub(e.y.redMul(r)).cmpn(0)}eqXToP(e){let t=this.z.redSqr(),i=e.toRed(this.curve?.red).redMul(t);if(0===this.x.cmp(i))return!0;let r=e.clone();if(this.curve?.redN==null)throw Error("Curve or redN is not initialized.");let n=this.curve.redN.redMul(t);for(;0>r.cmp(this.curve.p)&&(r.iadd(this.curve.n),!(r.cmp(this.curve.p)>=0));)if(i.redIAdd(n),0===this.x.cmp(i))return!0;return!1}inspect(){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)+">"}isInfinity(){return 0===this.z.cmpn(0)}}let C=/^[0-9a-fA-F]*$/;function B(e){if("string"!=typeof e)throw TypeError("Invalid hex string");if(0!==e.length&&!C.test(e))throw Error("Invalid hex string")}let U=(e,t="Hash assertion failed")=>{if(!e)throw Error(t)};class F{pending;pendingTotal;blockSize;outSize;endian;_delta8;_delta32;padLength;hmacStrength;constructor(e,t,i,r){this.pending=null,this.pendingTotal=0,this.blockSize=e,this.outSize=t,this.hmacStrength=i,this.padLength=r/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}_update(e,t){throw Error("Not implemented")}_digest(){throw Error("Not implemented")}_digestHex(){throw Error("Not implemented")}update(e,t){if(e=D(e,t),null==this.pending?this.pending=e:this.pending=this.pending.concat(e),this.pendingTotal+=e.length,this.pending.length>=this._delta8){let t=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-t,e.length),0===this.pending.length&&(this.pending=null),e=function(e,t,i){let r=t-0;U(r%4==0);let n=Array(r/4);for(let t=0,r=0;t<n.length;t++,r+=4){let s;s="big"===i?e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]:e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r],n[t]=s>>>0}return n}(e,e.length-t,this.endian);for(let t=0;t<e.length;t+=this._delta32)this._update(e,t)}return this}digest(){return this.update(this._pad()),U(null===this.pending),this._digest()}digestHex(){return this.update(this._pad()),U(null===this.pending),this._digestHex()}_pad(){let e,t=this.pendingTotal;if(!Number.isSafeInteger(t)||t<0)throw Error("Message too long for this hash function");let i=this._delta8,r=i-(t+this.padLength)%i,n=Array(r+this.padLength);for(n[0]=128,e=1;e<r;e++)n[e]=0;let s=this.padLength,a=1n<<BigInt(8*s),o=8n*BigInt(t);if(o>=a)throw Error("Message too long for this hash function");if("big"===this.endian){let t=Array(s);for(let e=s-1;e>=0;e--)t[e]=Number(255n&o),o>>=8n;for(let i=0;i<s;i++)n[e++]=t[i]}else for(let t=0;t<s;t++)n[e++]=Number(255n&o),o>>=8n;return n}}function D(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];if("string"==typeof e)return"hex"===t?function(e){B(e);let t=function(e){if(B(e),0===e.length)return"";let t=e.toLowerCase();return t.length%2!=0&&(t="0"+t),t}(e),i=[];for(let e=0;e<t.length;e+=2)i.push(Number.parseInt(t[e]+t[e+1],16));return i}(e):function(e){let t=[],i=0;for(;i<e.length;)i=function(e,t,i){let r=e.charCodeAt(t);return r<128?(i.push(r),t):r<2048?(i.push(r>>6|192,63&r|128),t):(64512&e.charCodeAt(t))!=55296||t<0||t+1>=e.length||(64512&e.charCodeAt(t+1))!=56320?(i.push(r>>12|224,r>>6&63|128,63&r|128),t):(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(t+1)),i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128),t+1)}(e,i,t)+1;return t}(e);let i=[];for(let t=0;t<e.length;t++)i[t]=Math.trunc(e[t]);return i}function L(e){return ts(e)}function V(e,t){let i="";for(let r of e)"little"===t&&(r=ts(r)),i+=function(e){if(7===e.length)return"0"+e;if(6===e.length)return"00"+e;if(5===e.length)return"000"+e;if(4===e.length)return"0000"+e;if(3===e.length)return"00000"+e;else if(2===e.length)return"000000"+e;else if(1===e.length)return"0000000"+e;else return e}(r.toString(16));return i}let H="u"<typeof globalThis?void 0:globalThis.Buffer,M=null!=H&&"function"==typeof H.from,K="0123456789abcdef",q=Array(256);for(let e=0;e<q.length;e++)q[e]=K[e>>4&15]+K[15&e];let $=(()=>{let e="u"<typeof globalThis?void 0:globalThis.process,t=e?.getBuiltinModule;if("function"==typeof t)try{let i=t.call(e,"node:crypto");if(null!=i)return i}catch{}try{if("function"==typeof require)return require("node:crypto")}catch{}})();function z(e,t){return e instanceof Uint8Array?e:Array.isArray(e)?new Uint8Array(e):Uint8Array.from(D(e,t))}function W(e){return"string"==typeof e?z(e,"hex"):z(e)}function j(e,t,i){null!=e?e.update(i):null!=t&&t.update(i)}function G(e,t){return null!=e?Array.from(e.digest()):null!=t?Array.from(t.digest()):[]}function X(e,t){if(null!=e)return e.digest("hex");if(null!=t){var i=t.digest();if(M)return H.from(i).toString("hex");let e=Array(i.length);for(let t=0;t<i.length;t++)e[t]=q[i[t]];return e.join("")}return""}function Y(e){let t=$?.createHash;if("function"==typeof t)try{return t(e)}catch{return}}function J(e,t){let i=$?.createHmac;if("function"==typeof i)try{return i(e,t)}catch{return}}function Z(e,t,i){let r=Y(e);if(null!=r)return r.update(z(t,i)),r.digest()}function Q(e,t,i,r){let n=J(e,W(t));if(null!=n)return n.update(z(i,r)),n.digest()}function ee(e,t){let i=Array(4*e.length);for(let r=0,n=0;r<e.length;r++,n+=4){let s=e[r];"big"===t?(i[n]=s>>>24,i[n+1]=s>>>16&255,i[n+2]=s>>>8&255,i[n+3]=255&s):(i[n+3]=s>>>24,i[n+2]=s>>>16&255,i[n+1]=s>>>8&255,i[n]=255&s)}return i}function et(e,t){return e>>>t|e<<32-t}function ei(e,t){return e<<t|e>>>32-t}function er(e,t){return e+t>>>0}let en=[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],es=[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],ea=[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],eo=[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];function el(e,t,i,r){return e<=15?t^i^r:e<=31?t&i|~t&r:e<=47?(t|~i)^r:e<=63?t&r|i&~r:t^(i|~r)}class ec extends F{h;constructor(){super(512,160,192,64),this.endian="little",this.h=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],this.endian="little"}_update(e,t){var i,r,n,s,a,o;let l,c=this.h[0],h=this.h[1],d=this.h[2],u=this.h[3],f=this.h[4],p=c,g=h,y=d,m=u,b=f;for(let w=0;w<80;w++){l=er(ei((i=c,r=el(w,h,d,u),i+r+e[en[w]+t]+((a=w)<=15?0:a<=31?0x5a827999:a<=47?0x6ed9eba1:a<=63?0x8f1bbcdc:0xa953fd4e)>>>0),ea[w]),f),c=f,f=u,u=ei(d,10),d=h,h=l,l=er(ei((n=p,s=el(79-w,g,y,m),n+s+e[es[w]+t]+((o=w)<=15?0x50a28be6:o<=31?0x5c4dd124:o<=47?0x6d703ef3:0x7a6d76e9*!!(o<=63))>>>0),eo[w]),b),p=b,b=m,m=ei(y,10),y=g,g=l}l=this.h[1]+d+m>>>0,this.h[1]=this.h[2]+u+b>>>0,this.h[2]=this.h[3]+f+p>>>0,this.h[3]=this.h[4]+c+g>>>0,this.h[4]=this.h[0]+h+y>>>0,this.h[0]=l}_digest(){return ee(this.h,"little")}_digestHex(){return V(this.h,"little")}}class eh{h;native;constructor(){this.native=Y("sha256"),null==this.native&&(this.h=new e2)}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}class ed extends F{h;W;k;constructor(){super(512,160,80,64),this.k=[0x5a827999,0x6ed9eba1,0x8f1bbcdc,0xca62c1d6],this.h=[0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],this.W=Array(80)}_update(e,t){let i,r=this.W;for(void 0===t&&(t=0),i=0;i<16;i++)r[i]=e[t+i];for(;i<r.length;i++)r[i]=ei(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);let n=this.h[0],s=this.h[1],a=this.h[2],o=this.h[3],l=this.h[4];for(i=0;i<r.length;i++){var c,h,d,u,f,p,g,y,m;let e=Math.trunc(i/20),t=(u=ei(n,5),c=s,h=a,d=o,f=0===e?(p=c)&h^~p&d:1===e||3===e?c^h^d:2===e?(g=c)&(y=h)^g&(m=d)^y&m:0,u+f+l+r[i]+this.k[e]>>>0);l=o,o=a,a=ei(s,30),s=n,n=t}this.h[0]=er(this.h[0],n),this.h[1]=er(this.h[1],s),this.h[2]=er(this.h[2],a),this.h[3]=er(this.h[3],o),this.h[4]=er(this.h[4],l)}_digest(){return ee(this.h,"big")}_digestHex(){return V(this.h,"big")}}class eu{h;native;constructor(){this.native=Y("sha512"),null==this.native&&(this.h=new te)}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}class ef{h;native;blockSize=64;outSize=32;constructor(e){const t=W(e);this.native=J("sha256",t),null==this.native&&(this.h=new ti(e8,t))}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}class ep{inner;outer;blockSize=64;constructor(e){let t;for((e=D(e,"hex")).length>this.blockSize&&(e=new ed().update(e).digest()),t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new ed().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new ed().update(e)}update(e,t){return this.inner.update(e,t),this}digest(){return this.outer.update(this.inner.digest()),this.outer.digest()}digestHex(){return this.outer.update(this.inner.digest()),this.outer.digestHex()}}class eg{h;native;blockSize=128;outSize=32;constructor(e){const t=W(e);this.native=J("sha512",t),null==this.native&&(this.h=new ti(tt,t))}update(e,t){return j(this.native,this.h,z(e,t)),this}digest(){return G(this.native,this.h)}digestHex(){return X(this.native,this.h)}}function ey(e,t){let i=Z("sha256",e,t);return null!=i?i:new e2().update(z(e,t)).digest()}function em(e,t){return Z("ripemd160",e,t)}let eb=(e,t)=>{let i=em(e,t);return null!=i?Array.from(i):new ec().update(e,t).digest()},ew=(e,t)=>new ed().update(e,t).digest(),ev=(e,t)=>Array.from(ey(e,t)),eI=(e,t)=>{let i;return Array.from(null!=(i=Z("sha512",e,t))?i:new te().update(z(e,t)).digest())},ek=(e,t)=>Array.from(ey(ey(e,t))),eS=(e,t)=>{let i=ey(e,t),r=em(i);return null!=r?Array.from(r):new ec().update(i).digest()},eE=(e,t,i)=>{let r=Q("sha256",e,t,i);return null!=r?Array.from(r):new ef(e).update(t,i).digest()},ex=(e,t,i)=>{let r=Q("sha512",e,t,i);return null!=r?Array.from(r):new eg(e).update(t,i).digest()};function eA(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got ${e}`)}function eT(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length)){let i=t.join(",");throw Error(`Uint8Array expected of length ${i}, got length=${e.length}`)}}function eO(e){if("function"!=typeof e||"function"!=typeof e.create)throw TypeError("Hash should be wrapped by utils.createHasher");eA(e.outputLen),eA(e.blockLen)}function eP(e,t=!0){if(!0===e.destroyed)throw Error("Hash instance has been destroyed");if(t&&!0===e.finished)throw Error("Hash#digest() has already been called")}function eN(...e){for(let t of e)t.fill(0)}function e_(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function eR(e){return"string"==typeof e&&(e=eC(e)),eT(e),e}function eC(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function eB(e){return"string"==typeof e&&(e=eC(e)),eT(e),e}class eU{}function eF(e){let t=t=>e().update(eR(t)).digest(),i=e();return t.outputLen=i.outputLen,t.blockLen=i.blockLen,t.create=()=>e(),t}let eD=BigInt(0x100000000-1),eL=BigInt(32),eV=(e,t,i)=>e>>>i,eH=(e,t,i)=>e<<32-i|t>>>i,eM=(e,t,i)=>e>>>i|t<<32-i,eK=(e,t,i)=>e<<32-i|t>>>i,eq=(e,t,i)=>e<<64-i|t>>>i-32,e$=(e,t,i)=>e>>>i-32|t<<64-i;function ez(e,t,i,r){let n=(t>>>0)+(r>>>0);return{h:e+i+(n/0x100000000|0)|0,l:0|n}}let eW=(e,t,i)=>(e>>>0)+(t>>>0)+(i>>>0),ej=(e,t,i,r)=>t+i+r+(e/0x100000000|0)|0,eG=(e,t,i,r)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),eX=(e,t,i,r,n)=>t+i+r+n+(e/0x100000000|0)|0,eY=(e,t,i,r,n)=>(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0)+(n>>>0),eJ=(e,t,i,r,n,s)=>t+i+r+n+s+(e/0x100000000|0)|0;class eZ extends eU{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,i,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(e),this.view=e_(this.buffer)}update(e){eP(this),eT(e=eR(e));let{view:t,buffer:i,blockLen:r}=this,n=e.length;for(let s=0;s<n;){let a=Math.min(r-this.pos,n-s);if(a===r){let t=e_(e);for(;r<=n-s;s+=r)this.process(t,s);continue}i.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){eP(this);eT(e);let t=this.outputLen;if(e.length<t)throw Error(`digestInto() expects output buffer of length at least ${t}`);this.finished=!0;let{buffer:i,view:r,blockLen:n,isLE:s}=this,{pos:a}=this;i[a++]=128,eN(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)i[e]=0;(function(e,t,i,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,i,r);let n=BigInt(32),s=BigInt(0xffffffff),a=Number(i>>n&s),o=Number(i&s),l=4*!!r,c=4*!r;e.setUint32(t+l,a,r),e.setUint32(t+c,o,r)})(r,n-8,BigInt(8*this.length),s),this.process(r,0);let o=e_(e),l=this.outputLen;if(l%4!=0)throw Error("_sha2: outputLen should be aligned to 32bit");let c=l/4,h=this.get();if(c>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,h[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){(e||=new this.constructor).set(...this.get());let{blockLen:t,buffer:i,length:r,finished:n,destroyed:s,pos:a}=this;return e.destroyed=s,e.finished=n,e.length=r,e.pos=a,r%t!=0&&e.buffer.set(i),e}clone(){return this._cloneInto()}}let eQ=Uint32Array.from([0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19]),e0=Uint32Array.from([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),e1=new Uint32Array(64);class e2 extends eZ{A=0|eQ[0];B=0|eQ[1];C=0|eQ[2];D=0|eQ[3];E=0|eQ[4];F=0|eQ[5];G=0|eQ[6];H=0|eQ[7];constructor(e=32){super(64,e,8,!1)}get(){let{A:e,B:t,C:i,D:r,E:n,F:s,G:a,H:o}=this;return[e,t,i,r,n,s,a,o]}set(e,t,i,r,n,s,a,o){this.A=0|e,this.B=0|t,this.C=0|i,this.D=0|r,this.E=0|n,this.F=0|s,this.G=0|a,this.H=0|o}process(e,t){var i,r,n,s,a,o,l,c,h;for(let i=0;i<16;i++,t+=4)e1[i]=e.getUint32(t);for(let e=16;e<64;e++){let t=e1[e-15],i=e1[e-2],r=et(t,7)^et(t,18)^t>>>3,n=et(i,17)^et(i,19)^i>>>10;e1[e]=er(er(r,e1[e-7]),er(n,e1[e-16]))}let{A:d,B:u,C:f,D:p,E:g,F:y,G:m,H:b}=this;for(let e=0;e<64;e++){let t=(n=b,s=et(i=g,6)^et(i,11)^et(i,25),a=(r=g)&y^~r&m,n+s+a+e0[e]+e1[e]>>>0),w=er(et(o=d,2)^et(o,13)^et(o,22),(l=d)&(c=u)^l&(h=f)^c&h);b=m,m=y,y=g,g=er(p,t),p=f,f=u,u=d,d=er(t,w)}this.A=er(this.A,d),this.B=er(this.B,u),this.C=er(this.C,f),this.D=er(this.D,p),this.E=er(this.E,g),this.F=er(this.F,y),this.G=er(this.G,m),this.H=er(this.H,b)}roundClean(){eN(e1)}destroy(){eN(this.buffer),this.set(0,0,0,0,0,0,0,0)}}let e8=eF(()=>new e2),e3=Uint32Array.from([0x6a09e667,0xf3bcc908,0xbb67ae85,0x84caa73b,0x3c6ef372,0xfe94f82b,0xa54ff53a,0x5f1d36f1,0x510e527f,0xade682d1,0x9b05688c,0x2b3e6c1f,0x1f83d9ab,0xfb41bd6b,0x5be0cd19,0x137e2179]),e5=function(e,t=!1){let i=e.length,r=new Uint32Array(i),n=new Uint32Array(i);for(let s=0;s<i;s++){let{h:i,l:a}=function(e,t=!1){return t?{h:Number(e&eD),l:Number(e>>eL&eD)}:{h:0|Number(e>>eL&eD),l:0|Number(e&eD)}}(e[s],t);r[s]=i,n[s]=a}return[r,n]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(BigInt)),e6=e5[0],e4=e5[1],e9=new Uint32Array(80),e7=new Uint32Array(80);class te extends eZ{Ah=0|e3[0];Al=0|e3[1];Bh=0|e3[2];Bl=0|e3[3];Ch=0|e3[4];Cl=0|e3[5];Dh=0|e3[6];Dl=0|e3[7];Eh=0|e3[8];El=0|e3[9];Fh=0|e3[10];Fl=0|e3[11];Gh=0|e3[12];Gl=0|e3[13];Hh=0|e3[14];Hl=0|e3[15];constructor(e=64){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:i,Bl:r,Ch:n,Cl:s,Dh:a,Dl:o,Eh:l,El:c,Fh:h,Fl:d,Gh:u,Gl:f,Hh:p,Hl:g}=this;return[e,t,i,r,n,s,a,o,l,c,h,d,u,f,p,g]}set(e,t,i,r,n,s,a,o,l,c,h,d,u,f,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|i,this.Bl=0|r,this.Ch=0|n,this.Cl=0|s,this.Dh=0|a,this.Dl=0|o,this.Eh=0|l,this.El=0|c,this.Fh=0|h,this.Fl=0|d,this.Gh=0|u,this.Gl=0|f,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let i=0;i<16;i++,t+=8)e9[i]=e.getUint32(t),e7[i]=e.getUint32(t+4);for(let e=16;e<80;e++){let t=0|e9[e-15],i=0|e7[e-15],r=eM(t,i,1)^eM(t,i,8)^eV(t,i,7),n=eK(t,i,1)^eK(t,i,8)^eH(t,i,7),s=0|e9[e-2],a=0|e7[e-2],o=eM(s,a,19)^eq(s,a,61)^eV(s,a,6),l=eG(n,eK(s,a,19)^e$(s,a,61)^eH(s,a,6),e7[e-7],e7[e-16]),c=eX(l,r,o,e9[e-7],e9[e-16]);e9[e]=0|c,e7[e]=0|l}let{Ah:i,Al:r,Bh:n,Bl:s,Ch:a,Cl:o,Dh:l,Dl:c,Eh:h,El:d,Fh:u,Fl:f,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let e=0;e<80;e++){let t=eM(h,d,14)^eM(h,d,18)^eq(h,d,41),b=eK(h,d,14)^eK(h,d,18)^e$(h,d,41),w=h&u^~h&p,v=eY(m,b,d&f^~d&g,e4[e],e7[e]),I=eJ(v,y,t,w,e6[e],e9[e]),k=0|v,S=eM(i,r,28)^eq(i,r,34)^eq(i,r,39),E=eK(i,r,28)^e$(i,r,34)^e$(i,r,39),x=i&n^i&a^n&a,A=r&s^r&o^s&o;y=0|p,m=0|g,p=0|u,g=0|f,u=0|h,f=0|d,({h:h,l:d}=ez(0|l,0|c,0|I,0|k)),l=0|a,c=0|o,a=0|n,o=0|s,n=0|i,s=0|r;let T=eW(E,A,k);i=ej(T,S,x,I),r=0|T}({h:i,l:r}=ez(i,r,this.Ah,this.Al)),({h:n,l:s}=ez(n,s,this.Bh,this.Bl)),({h:a,l:o}=ez(a,o,this.Ch,this.Cl)),({h:l,l:c}=ez(l,c,this.Dh,this.Dl)),({h:h,l:d}=ez(h,d,this.Eh,this.El)),({h:u,l:f}=ez(u,f,this.Fh,this.Fl)),({h:p,l:g}=ez(p,g,this.Gh,this.Gl)),({h:y,l:m}=ez(y,m,this.Hh,this.Hl)),this.set(i,r,n,s,a,o,l,c,h,d,u,f,p,g,y,m)}roundClean(){eN(e9,e7)}destroy(){eN(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let tt=eF(()=>new te);class ti extends eU{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){super(),eO(e);const i=eR(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,n=new Uint8Array(r);n.set(i.length>r?e.create().update(i).digest():i);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),eN(n)}update(e){return eP(this),this.iHash.update(e),this}digestInto(e){eP(this),eT(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:i,finished:r,destroyed:n,blockLen:s,outputLen:a}=this;return e.finished=r,e.destroyed=n,e.blockLen=s,e.outputLen=a,e.oHash=t._cloneInto(e.oHash??void 0),e.iHash=i._cloneInto(e.iHash??void 0),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let tr=(e,t,i)=>new ti(e,t).update(i).digest();function tn(e,t,i,r,n="sha512"){if("sha512"!==n)throw Error("Only sha512 is supported in this PBKDF2 implementation");let s=$?.pbkdf2Sync;return"function"==typeof s?Array.from(s(z(e),z(t),i,r,n)):Array.from(function(e,t,i,r){let n;eO(e);let{c:s,dkLen:a}=Object.assign({dkLen:32},r);if(eA(s),eA(a),s<1)throw Error("iterations (c) should be >= 1");let o=eB(t),l=eB(i),c=new Uint8Array(a),h=tr.create(e,o),d=h._cloneInto().update(l),u=new Uint8Array(4),f=e_(u),p=new Uint8Array(h.outputLen);for(let e=1,t=0;t<a;e++,t+=h.outputLen){let i=c.subarray(t,t+h.outputLen);f.setInt32(0,e,!1),(n=d._cloneInto(n)).update(u).digestInto(p),i.set(p.subarray(0,i.length));for(let e=1;e<s;e++){h._cloneInto(n).update(p).digestInto(p);for(let e=0;e<i.length;e++)i[e]^=p[e]}}return h.destroy(),d.destroy(),null!=n&&n.destroy(),eN(p),c}(tt,Uint8Array.from(e),Uint8Array.from(t),{c:i,dkLen:r}))}function ts(e){return(e>>>24|e>>>8&65280|e<<8&0xff0000|(255&e)<<24)>>>0}tr.create=(e,t)=>new ti(e,t);let ta=(i=new Uint32Array(t=new ArrayBuffer(4)),r=new Uint8Array(t),i[0]=0x1020304,4===r[0]);function to(e){return ta?ts(e):e>>>0}class tl{buffer;pos;capacity;constructor(e,t=256){if(null!=e&&e.length>0&&(t=Math.max(t,e.reduce((e,t)=>e+t.length,0))),this.buffer=new Uint8Array(t),this.pos=0,this.capacity=t,null!=e)for(const t of e)this.write(t)}getLength(){return this.pos}toUint8Array(){return this.buffer.slice(0,this.pos)}toArray(){return Array.from(this.toUint8Array())}toUint8ArrayZeroCopy(){return this.buffer.subarray(0,this.pos)}ensureCapacity(e){if(this.pos+e>this.capacity){let t=2*this.capacity;for(;this.pos+e>t;)t*=2;let i=new Uint8Array(t);i.set(this.buffer),this.buffer=i,this.capacity=t}}write(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);return this.ensureCapacity(t.length),this.buffer.set(t,this.pos),this.pos+=t.length,this}writeReverse(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);this.ensureCapacity(t.length);for(let e=t.length-1;e>=0;e--)this.buffer[this.pos]=t[e],this.pos+=1;return this}writeUInt8(e){return this.ensureCapacity(1),this.buffer[this.pos]=255&e,this.pos+=1,this}writeInt8(e){return this.writeUInt8(e),this}writeUInt16LE(e){return this.ensureCapacity(2),this.buffer[this.pos]=255&e,this.buffer[this.pos+1]=e>>8&255,this.pos+=2,this}writeUInt16BE(e){return this.ensureCapacity(2),this.buffer[this.pos]=e>>8&255,this.buffer[this.pos+1]=255&e,this.pos+=2,this}writeInt16LE(e){return this.writeUInt16LE(65535&e),this}writeInt16BE(e){return this.writeUInt16BE(65535&e),this}writeUInt32LE(e){return this.ensureCapacity(4),this.buffer[this.pos]=255&e,this.buffer[this.pos+1]=e>>8&255,this.buffer[this.pos+2]=e>>16&255,this.buffer[this.pos+3]=e>>24&255,this.pos+=4,this}writeUInt32BE(e){return this.ensureCapacity(4),this.buffer[this.pos]=e>>24&255,this.buffer[this.pos+1]=e>>16&255,this.buffer[this.pos+2]=e>>8&255,this.buffer[this.pos+3]=255&e,this.pos+=4,this}writeInt32LE(e){return this.writeUInt32LE(e>>>0),this}writeInt32BE(e){return this.writeUInt32BE(e>>>0),this}writeUInt64BEBn(e){let t=e.toArray("be",8);return this.write(t),this}writeUInt64LEBn(e){let t=e.toArray("be",8);return this.writeReverse(t),this}writeUInt64LE(e){let t=new A(e).toArray("be",8);return this.writeReverse(t),this}writeVarIntNum(e){let t=tP.varIntNum(e);return this.write(t),this}writeVarIntBn(e){let t=tP.varIntBn(e);return this.write(t),this}reset(){this.pos=0}}class tc{bin;pos;length;static makeReader(e,t=0){if(e instanceof Uint8Array)return new tc(e,t);if(Array.isArray(e))return new tN(e,t);throw Error("ReaderUint8Array.makeReader: bin must be Uint8Array or number[]")}constructor(e=new Uint8Array(0),t=0){if(e instanceof Uint8Array)this.bin=e;else if(Array.isArray(e))this.bin=new Uint8Array(e);else throw TypeError("ReaderUint8Array constructor: bin must be Uint8Array or number[]");this.pos=t,this.length=this.bin.length}eof(){return this.pos>=this.length}read(e=this.length){let t=this.pos,i=this.pos+e;return this.pos=i,this.bin.slice(t,i)}readReverse(e=this.length){let t=new Uint8Array(e);for(let i=0;i<e;i++)t[i]=this.bin[this.pos+e-1-i];return this.pos+=e,t}readUInt8(){let e=this.bin[this.pos];return this.pos+=1,e}readInt8(){let e=this.bin[this.pos];return this.pos+=1,(128&e)==0?e:e-256}readUInt16BE(){let e=this.bin[this.pos]<<8|this.bin[this.pos+1];return this.pos+=2,e}readInt16BE(){let e=this.readUInt16BE();return(32768&e)==0?e:e-65536}readUInt16LE(){let e=this.bin[this.pos]|this.bin[this.pos+1]<<8;return this.pos+=2,e}readInt16LE(){let e=this.readUInt16LE();return(32768&e)==0?e:e-65536}readUInt32BE(){let e=0x1000000*this.bin[this.pos]+(this.bin[this.pos+1]<<16|this.bin[this.pos+2]<<8|this.bin[this.pos+3]);return this.pos+=4,e}readInt32BE(){let e=this.readUInt32BE();return(0x80000000&e)==0?e:e-0x100000000}readUInt32LE(){let e=(this.bin[this.pos]|this.bin[this.pos+1]<<8|this.bin[this.pos+2]<<16|this.bin[this.pos+3]<<24)>>>0;return this.pos+=4,e}readInt32LE(){let e=this.readUInt32LE();return(0x80000000&e)==0?e:e-0x100000000}readUInt64BEBn(){let e=new A(Array.from(this.bin.slice(this.pos,this.pos+8)));return this.pos=this.pos+8,e}readUInt64LEBn(){return new A(Array.from(this.readReverse(8)))}readInt64LEBn(){let e=new A(2).pow(new A(63)),t=new A(2).pow(new A(64)),i=new A(Array.from(this.readReverse(8)));return i.gte(e)&&(i=i.sub(t)),i}readVarIntNum(e=!0){let t,i=this.readUInt8();switch(i){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:if((t=e?this.readInt64LEBn():this.readUInt64LEBn()).lte(new A(2).pow(new A(53))))return t.toNumber();throw Error("number too large to retain precision - use readVarIntBn");default:return i}}readVarInt(){switch(this.bin[this.pos]){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}}readVarIntBn(){let e=this.readUInt8();switch(e){case 253:return new A(this.readUInt16LE());case 254:return new A(this.readUInt32LE());case 255:return this.readUInt64LEBn();default:return new A(e)}}}let th="u"<typeof globalThis?void 0:globalThis.Buffer,td=null!=th&&"function"==typeof th.from,tu=e=>e.length%2==1?"0"+e:e,tf="0123456789abcdef",tp=Array(256);for(let e=0;e<256;e++)tp[e]=tf[e>>4&15]+tf[15&e];let tg=e=>{if(td)return th.from(e).toString("hex");if(0===e.length)return"";let t=Array(e.length);for(let i=0;i<e.length;i++)t[i]=tp[255&e[i]];return t.join("")},ty=(e,t)=>e instanceof Uint8Array?e:new Uint8Array(tm(e,t)),tm=(e,t)=>{if(Array.isArray(e))return e.slice();if(void 0===e)return[];if("string"!=typeof e)return Array.from(e,e=>Math.trunc(e));switch(t){case"hex":return tw(e);case"base64":return tv(e);default:var i;return i=e,Array.from(new TextEncoder().encode(i))}},tb=new Int8Array(256).fill(-1);for(let e=0;e<10;e++)tb[48+e]=e;for(let e=0;e<6;e++)tb[65+e]=10+e,tb[97+e]=10+e;let tw=e=>{B(e);let t=e.length%2==0?e:"0"+e;if(td)return Array.from(th.from(t,"hex"));let i=Array(t.length/2),r=0;for(let e=0;e<t.length;e+=2){let n=tb[t.codePointAt(e)],s=tb[t.codePointAt(e+1)];i[r++]=n<<4|s}return i};function tv(e){if("string"!=typeof e)throw TypeError("msg must be a string");let t=e.trim().replaceAll(/[\r\n\t\f\v ]+/g,""),i=(t=t.replaceAll("-","+").replaceAll("_","/")).indexOf("=");if(-1!==i){let e=t.slice(i);if(!/^={1,2}$/.test(e)||t.slice(0,i).includes("="))throw Error("Invalid base64 padding");t=t.slice(0,i)}let r=[],n=0,s=0;for(let e=0;e<t.length;e++){let i=t.codePointAt(e),a=-1;if(i>=65&&i<=90)a=i-65;else if(i>=97&&i<=122)a=i-97+26;else if(i>=48&&i<=57)a=i-48+52;else if(43===i)a=62;else if(47===i)a=63;else throw Error(`Invalid base64 character at index ${e}`);for(n=n<<6|a,s+=6;s>=8;)s-=8,r.push(n>>s&255),n&=(1<<s)-1}return r}let tI=e=>new TextDecoder().decode(new Uint8Array(e)),tk=(e,t)=>{switch(t){case"hex":return tg(e);case"utf8":return tI(e);default:return e}};function tS(e){let t,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="";for(t=0;t<e.length;t+=3){let n=e[t],s=t+1<e.length?e[t+1]:0,a=t+2<e.length?e[t+2]:0,o=n>>2,l=(3&n)<<4|s>>4,c=(15&s)<<2|a>>6,h=63&a;r+=i.charAt(o)+i.charAt(l),r+=t+1<e.length?i.charAt(c):"=",r+=t+2<e.length?i.charAt(h):"="}return r}let tE="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",tx=e=>{let t;if(""===e||"string"!=typeof e)throw Error(`Expected base58 string but got “${e}”`);let i=e.match(/[IOl0]/gmu);if(null!==i)throw Error(`Invalid base58 character “${i.join("")}”`);let r=e.match(/^1+/gmu),n=null===r?0:r[0].length,s=(e.length-n)*(Math.log(58)/Math.log(256))+1>>>0;return[...new Uint8Array([...new Uint8Array(n),...(e.match(/./gmu)??[]).map(e=>tE.indexOf(e)).reduce((e,t)=>e=e.map(e=>{let i=58*e+t;return t=i>>8,i}),new Uint8Array(s)).reverse().filter((t=!1,e=>t=t||e))])]},tA=e=>{let t=Array(256).fill(-1);for(let e=0;e<tE.length;++e)t[tE.codePointAt(e)]=e;let i=[];for(let r of e){let e=r;for(let r=0;r<i.length;++r){let n=(t[i[r]]<<8)+e;i[r]=tE.codePointAt(n%58),e=Math.trunc(n/58)}for(;0!==e;)i.push(tE.codePointAt(e%58)),e=Math.trunc(e/58)}for(let t of e)if(0===t)i.push(49);else break;return i.reverse(),String.fromCodePoint(...i)},tT=(e,t=[0])=>{let i=ek([...t,...e]);return tA(i=[...t,...e,...i.slice(0,4)])},tO=(e,t,i=1)=>{let r=tx(e),n=r.slice(0,i),s=r.slice(i,-4),a=[...n,...s];return a=ek(a),r.slice(-4).forEach((e,t)=>{if(e!==a[t])throw Error("Invalid checksum")}),"hex"===t&&(n=tg(n),s=tg(s)),{prefix:n,data:s}};class tP{bufs;length;constructor(e){for(const t of(this.bufs=e??[],this.length=0,this.bufs))this.length+=t.length}getLength(){return this.length}toUint8Array(){let e=new Uint8Array(this.length),t=0;for(let i of this.bufs)e.set(i,t),t+=i.length;return e}toArray(){let e=Array(this.length),t=0;for(let i of this.bufs)if(i instanceof Uint8Array)for(let r of i)e[t++]=r;else for(let r of i)e[t++]=r;return e}toHex(){return this.toArray().map(e=>e.toString(16).padStart(2,"0")).join("")}write(e){return this.bufs.push(e),this.length+=e.length,this}writeReverse(e){let t=Array(e.length);for(let i=0;i<t.length;i++)t[i]=e[e.length-1-i];return this.write(t)}writeUInt8(e){let t=[,];return t[0]=255&e,this.write(t),this}writeInt8(e){return this.writeUInt8(e)}writeUInt16BE(e){return this.write([e>>8&255,255&e])}writeInt16BE(e){return this.writeUInt16BE(65535&e)}writeUInt16LE(e){return this.write([255&e,e>>8&255])}writeInt16LE(e){return this.writeUInt16LE(65535&e)}writeUInt32BE(e){return this.write([e>>24&255,e>>16&255,e>>8&255,255&e])}writeInt32BE(e){return this.writeUInt32BE(e>>>0)}writeUInt32LE(e){return this.write([255&e,e>>8&255,e>>16&255,e>>24&255])}writeInt32LE(e){return this.writeUInt32LE(e>>>0)}writeUInt64BEBn(e){let t=e.toArray("be",8);return this.write(t),this}writeUInt64LEBn(e){let t=e.toArray("be",8);return this.writeReverse(t),this}writeUInt64LE(e){if(-1===e)this.write(Array(8).fill(255));else{let t=new A(e).toArray("be",8);this.writeReverse(t)}return this}writeVarIntNum(e){let t=tP.varIntNum(e);return this.write(t),this}writeVarIntBn(e){let t=tP.varIntBn(e);return this.write(t),this}static varIntNum(e){let t;if(e<0)return this.varIntBn(new A(e));if(e<253)t=[e];else if(e<65536)t=[253,255&e,e>>8&255];else if(e<0x100000000)t=[254,255&e,e>>8&255,e>>16&255,e>>24&255];else{let i=0|e,r=0|Math.floor(e/0x100000000);t=[255,255&i,i>>8&255,i>>16&255,i>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]}return t}static varIntBn(e){let t;if(e.isNeg()&&(e=e.add(tC)),e.ltn(253))t=[e.toNumber()];else if(e.ltn(65536)){let i=e.toNumber();t=[253,255&i,i>>8&255]}else if(e.lt(new A(0x100000000))){let i=e.toNumber();t=[254,255&i,i>>8&255,i>>16&255,i>>24&255]}else{let i=new tP;i.writeUInt8(255),i.writeUInt64LEBn(e),t=i.toArray()}return t}}class tN{bin;pos;length;constructor(e=[],t=0){this.bin=e,this.pos=t,this.length=e.length}eof(){return this.pos>=this.length}read(e=this.length){let t=this.pos,i=this.pos+e;return this.pos=i,this.bin.slice(t,i)}readReverse(e=this.length){let t=Array(e);for(let i=0;i<e;i++)t[i]=this.bin[this.pos+e-1-i];return this.pos+=e,t}readUInt8(){let e=this.bin[this.pos];return this.pos+=1,e}readInt8(){let e=this.bin[this.pos];return this.pos+=1,(128&e)==0?e:e-256}readUInt16BE(){let e=this.bin[this.pos]<<8|this.bin[this.pos+1];return this.pos+=2,e}readInt16BE(){let e=this.readUInt16BE();return(32768&e)==0?e:e-65536}readUInt16LE(){let e=this.bin[this.pos]|this.bin[this.pos+1]<<8;return this.pos+=2,e}readInt16LE(){let e=this.readUInt16LE();return(32768&e)==0?e:e-65536}readUInt32BE(){let e=0x1000000*this.bin[this.pos]+(this.bin[this.pos+1]<<16|this.bin[this.pos+2]<<8|this.bin[this.pos+3]);return this.pos+=4,e}readInt32BE(){let e=this.readUInt32BE();return(0x80000000&e)==0?e:e-0x100000000}readUInt32LE(){let e=(this.bin[this.pos]|this.bin[this.pos+1]<<8|this.bin[this.pos+2]<<16|this.bin[this.pos+3]<<24)>>>0;return this.pos+=4,e}readInt32LE(){let e=this.readUInt32LE();return(0x80000000&e)==0?e:e-0x100000000}readUInt64BEBn(){let e=new A(this.bin.slice(this.pos,this.pos+8));return this.pos=this.pos+8,e}readUInt64LEBn(){return new A(this.readReverse(8))}readInt64LEBn(){let e=new A(this.readReverse(8));return e.gte(tR)&&(e=e.sub(tC)),e}readVarIntNum(e=!0){let t,i=this.readUInt8();switch(i){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:if((t=e?this.readInt64LEBn():this.readUInt64LEBn()).lte(new A(2).pow(new A(53))))return t.toNumber();throw Error("number too large to retain precision - use readVarIntBn");default:return i}}readVarInt(){switch(this.bin[this.pos]){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}}readVarIntBn(){let e=this.readUInt8();switch(e){case 253:return new A(this.readUInt16LE());case 254:return new A(this.readUInt32LE());case 255:return this.readUInt64LEBn();default:return new A(e)}}}let t_=e=>{if(0===e.length)return e;let t=e.at(-1);if((127&t)!=0)return e;if(1===e.length)return[];if((128&e.at(-2))!=0)return e;for(let i=e.length-1;i>0;i--)if(0!==e[i-1])if((128&e[i-1])==0)return e[i-1]|=t,e.slice(0,i);else return e[i]=t,e.slice(0,i+1);return[]},tR=new A(2).pow(new A(63)),tC=new A(2).pow(new A(64));function tB(e,t="Expected a valid value, but got undefined or null."){if(null==e)throw Error(t);return e}function tU(e,t){if(e.length!==t.length)return!1;let i=0;for(let r=0;r<e.length;r++)i|=e[r]^t[r];return 0===i}function tF(e,t,i){let r=-e,n=(t.X^i.X)&r,s=(t.Y^i.Y)&r,a=(t.Z^i.Z)&r;t.X^=n,i.X^=n,t.Y^=s,i.Y^=s,t.Z^=a,i.Z^=a}let tD=(1n<<256n)-1n;function tL(e){let t=e>>256n;return t=(e=(e&tD)+(t<<32n)+977n*t)>>256n,(e=(e&tD)+(t<<32n)+977n*t)>=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn&&(e-=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn),e}let tV=e=>tL((e%0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn+0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn)%0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn),tH=(e,t)=>e>=t?e-t:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn-(t-e),tM=(e,t)=>tL(e*t),tK=e=>{let t=1n,i=0n,r=tV(e),n=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn;for(;r>1n;){let e=n/r;[t,i]=[i-t*e,t],[r,n]=[n-r*e,r]}return tV(t)},tq=0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn+1n>>2n,t$=BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),tz=BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),tW=new Map,tj=e=>{let{X:t,Y:i,Z:r}=e;if(0n===i)return{X:0n,Y:1n,Z:0n};let n=tM(i,i),s=tM(4n,tM(t,n)),a=tM(3n,tM(t,t)),o=tH(tM(a,a),tM(2n,s)),l=tH(tM(a,tH(s,o)),tM(8n,tM(n,n)));return{X:o,Y:l,Z:tM(2n,tM(i,r))}},tG=(e,t)=>{if(0n===e.Z)return t;if(0n===t.Z)return e;let i=tM(e.Z,e.Z),r=tM(t.Z,t.Z),n=tM(e.X,r),s=tM(t.X,i),a=tM(e.Y,tM(r,t.Z)),o=tM(t.Y,tM(i,e.Z)),l=tH(s,n),c=tH(o,a);if(0n===l)return 0n===c?tj(e):{X:0n,Y:1n,Z:0n};let h=tM(l,l),d=tM(l,h),u=tM(n,h),f=tH(tH(tM(c,c),d),tM(2n,u)),p=tH(tM(c,tH(u,f)),tM(a,d));return{X:f,Y:p,Z:tM(l,tM(e.Z,t.Z))}},tX=e=>0n===e.Z?e:{X:e.X,Y:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn-e.Y,Z:e.Z},tY=(e,t,i=5)=>{let r=`${i}:${t.x.toString(16)}:${t.y.toString(16)}`,n=tW.get(r);if(void 0===n){let e=1<<i-1;n=Array(e);let s={X:t.x,Y:t.y,Z:1n};n[0]=s;let a=tj(s);for(let t=1;t<e;t++)n[t]=tG(n[t-1],a);tW.set(r,n)}let s=[],a=1n<<BigInt(i),o=a>>1n,l=e;for(;l>0n;)if((1n&l)===0n)s.push(0),l>>=1n;else{let e=l&a-1n;e>o&&(e-=a),s.push(Number(e)),l-=e,l>>=1n}let c={X:0n,Y:1n,Z:0n};for(let e=s.length-1;e>=0;e--){c=tj(c);let t=s[e];if(0!==t){let e=Math.abs(t)>>1;c=tG(c,t>0?n[e]:tX(n[e]))}}return c},tJ=e=>{let t=e%0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;return t<0n&&(t+=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n),t},tZ=(e,t)=>tJ(e*t),tQ=e=>{let t=1n,i=0n,r=tJ(e),n=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;for(;r>1n;){let e=n/r;[t,i]=[i-t*e,t],[r,n]=[n-r*e,r]}return tJ(t)};class t0 extends _{x;y;inf;static _assertOnCurve(e){if(!e.validate())throw Error("Invalid point");return e}static fromDER(e){if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==64){if(6===e[0]){if(e.at(-1)%2!=0)throw Error("Point string value is wrong length")}else if(7===e[0]&&e.at(-1)%2!=1)throw Error("Point string value is wrong length");let t=new t0(e.slice(1,33),e.slice(33,65));return t0._assertOnCurve(t)}if((2===e[0]||3===e[0])&&e.length-1==32)return t0._assertOnCurve(t0.fromX(e.slice(1,33),3===e[0]));throw Error("Unknown point format")}static fromString(e){let t=tm(e,"hex");return t0._assertOnCurve(t0.fromDER(t))}static fromX(e,t){var i;let r,n,s=A.isBN(e)?BigInt("0x"+e.toString(16)):"string"==typeof e?BigInt("0x"+e):Array.isArray(e)?BigInt("0x"+tg(e)):BigInt(e),a=(n=((e,t)=>{let i=1n;for(e=tV(e);t>0n;)(1n&t)!==0n&&(i=tM(i,e)),e=tM(e,e),t>>=1n;return i})(i=tL(tM(tM(r=s=tV(s),r),s)+7n),tq),tM(n,n)!==tV(i)?null:n);if(null===a)throw Error("Invalid point");let o=a;(1n&o)!==(t?1n:0n)&&(o=tH(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,o));let l=new A(s.toString(16),16),c=new A(o.toString(16),16);return t0._assertOnCurve(new t0(l,c))}static fromJSON(e,t){"string"==typeof e&&(e=JSON.parse(e));let i=new t0(e[0],e[1],t);if(i=t0._assertOnCurve(i),"object"!=typeof e[2]||null===e[2])return i;let r=e[2],n=e=>{let i=new t0(e[0],e[1],t);return t0._assertOnCurve(i)};return i.precomputed={beta:null,doubles:"object"==typeof r.doubles&&null!==r.doubles?{step:r.doubles.step,points:[i].concat(r.doubles.points.map(n))}:void 0,naf:"object"==typeof r.naf&&null!==r.naf?{wnd:r.naf.wnd,points:[i].concat(r.naf.points.map(n))}:void 0},i}constructor(e,t,i=!0){super("affine"),this.precomputed=null,null===e&&null===t?(this.x=null,this.y=null,this.inf=!0):(A.isBN(e)||(e=new A(e,16)),this.x=e,A.isBN(t)||(t=new A(t,16)),this.y=t,i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),null===this.x.red&&(this.x=this.x.toRed(this.curve.red)),null===this.y.red&&(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}validate(){if(this.inf||null==this.x||null==this.y)return!1;try{let e,t=BigInt("0x"+this.x.fromRed().toString(16)),i=BigInt("0x"+this.y.fromRed().toString(16)),r=tM(i,i),n=(e=tM(tM(t,t),t),tL(e+7n));return r===n}catch{return!1}}encode(e=!0,t){let i;if(this.inf)return"hex"===t?"00":[0];let r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return(i=e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r)),"hex"===t)?tg(i):i}toString(){return this.encode(!0,"hex")}toJSON(){return null==this.precomputed?[this.x,this.y]:[this.x,this.y,"object"==typeof this.precomputed&&null!==this.precomputed?{doubles:null==this.precomputed.doubles?void 0:{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:null==this.precomputed.naf?void 0:{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}:void 0]}inspect(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+(this.x?.fromRed()?.toString(16,2)??"undefined")+" y: "+(this.y?.fromRed()?.toString(16,2)??"undefined")+">"}isInfinity(){return this.inf}add(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||this.x?.cmp(e.x??new A(0))===0)return new t0(null,null);let t=tG({X:BigInt("0x"+this.x.fromRed().toString(16)),Y:BigInt("0x"+this.y.fromRed().toString(16)),Z:1n},{X:BigInt("0x"+e.x.fromRed().toString(16)),Y:BigInt("0x"+e.y.fromRed().toString(16)),Z:1n});if(0n===t.Z)return new t0(null,null);let i=tK(t.Z),r=tM(i,i),n=tM(t.X,r),s=tM(t.Y,tM(r,i));return new t0(n.toString(16),s.toString(16))}dbl(){if(this.inf)return this;if(null===this.x||null===this.y)throw Error("Point coordinates cannot be null");let e=BigInt("0x"+this.x.fromRed().toString(16)),t=BigInt("0x"+this.y.fromRed().toString(16));if(0n===t)return new t0(null,null);let i=tj({X:e,Y:t,Z:1n}),r=tK(i.Z),n=tM(r,r),s=tM(i.X,n),a=tM(i.Y,tM(n,r));return new t0(s.toString(16),a.toString(16))}getX(){return(this.x??new A(0)).fromRed()}getY(){return(this.y??new A(0)).fromRed()}mul(e){let t,i;if(A.isBN(e)||(e=new A(e,16)),this.inf)return this;let r=e.isNeg(),n=BigInt("0x"+(r?e.neg():e).toString(16));if(0n===(n=tV(n))||0n===n)return new t0(null,null);if(null===this.x||null===this.y)throw Error("Point coordinates cannot be null");this===this.curve.g?(t=t$,i=tz):(t=BigInt("0x"+this.x.fromRed().toString(16)),i=BigInt("0x"+this.y.fromRed().toString(16)));let s=tY(n,{x:t,y:i});if(0n===s.Z)return new t0(null,null);let a=tK(s.Z),o=tM(a,a),l=tM(s.X,o),c=tM(s.Y,tM(o,a)),h=new t0(new A(l.toString(16),16),new A(c.toString(16),16));return r?h.neg():h}mulCT(e){if(A.isBN(e)||(e=new A(e,16)),this.inf)return new t0(null,null);let t=e.isNeg(),i=BigInt("0x"+(t?e.neg():e).toString(16));if(0n===(i=tV(i)))return new t0(null,null);let r=this===this.curve.g?t$:BigInt("0x"+this.getX().toString(16)),n=this===this.curve.g?tz:BigInt("0x"+this.getY().toString(16)),s={X:0n,Y:1n,Z:0n},a={X:r,Y:n,Z:1n};for(let e of i.toString(2)){let t="1"===e?1n:0n;tF(t,s,a),a=tG(s,a),tF(t,s=tj(s),a)}if(0n===s.Z)return new t0(null,null);let o=tK(s.Z),l=tM(o,o),c=tM(s.X,l),h=tM(s.Y,tM(l,o)),d=new t0(c.toString(16),h.toString(16));return t?d.neg():d}mulAdd(e,t,i){return this._endoWnafMulAdd([this,t],[e,i])}jmulAdd(e,t,i){return this._endoWnafMulAdd([this,t],[e,i],!0)}eq(e){return this===e||this.inf===e.inf&&(this.inf||0===(this.x??new A(0)).cmp(e.x??new A(0))&&0===(this.y??new A(0)).cmp(e.y??new A(0)))}neg(e){if(this.inf)return this;let t=new t0(this.x,(this.y??new A(0)).redNeg());if(!0===e&&null!=this.precomputed){let e=this.precomputed;t.precomputed={naf:null==e.naf?void 0:{wnd:e.naf.wnd,points:e.naf.points.map(e=>e.neg())},doubles:null==e.doubles?void 0:{step:e.doubles.step,points:e.doubles.points.map(e=>e.neg())},beta:void 0}}return t}dblp(e){let t=this;for(let i=0;i<e;i++)t=t.dbl();return t}toJ(){return this.inf?new R(null,null,null):new R(this.x,this.y,this.curve.one)}_getBeta(){if("object"!=typeof this.curve.endo)return;let e=this.precomputed;if("object"==typeof e&&null!==e&&"object"==typeof e.beta&&null!==e.beta)return e.beta;let t=new t0((this.x??new A(0)).redMul(this.curve.endo.beta),this.y);if(null!=e){let i=this.curve,r=e=>{if(null===e.x)throw Error("p.x is null");if(void 0===i.endo||null===i.endo)throw Error("curve.endo is undefined");return new t0(e.x.redMul(i.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:null==e.naf?void 0:{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:null==e.doubles?void 0:{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}_fixedNafMul(e){if("object"!=typeof this.precomputed||null===this.precomputed)throw Error("_fixedNafMul requires precomputed values for the point");let t=this._getDoubles(),i=this.curve.getNAF(e,1,this.curve._bitLength),r=(1<<t.step+1)-(t.step%2==0?2:1);r/=3;let n=[];for(let e=0;e<i.length;e+=t.step){let r=0;for(let n=e+t.step-1;n>=e;n--)r=(r<<1)+i[n];n.push(r)}let s=new R(null,null,null),a=new R(null,null,null);for(let e=r;e>0;e--){for(let i=0;i<n.length;i++){let r=n[i];r===e?a=a.mixedAdd(t.points[i]):r===-e&&(a=a.mixedAdd(t.points[i].neg()))}s=s.add(a)}return s.toP()}_wnafMulAdd(e,t,i,r,n){let s=this.curve._wnafT1.map(e=>e.toNumber()),a=this.curve._wnafT2.map(()=>[]),o=this.curve._wnafT3.map(()=>[]),l=0;for(let i=0;i<r;i++){let r=t[i]._getNAFPoints(e);s[i]=r.wnd,a[i]=r.points}for(let e=r-1;e>=1;e-=2){let r=e-1,n=e;if(1!==s[r]||1!==s[n]){o[r]=this.curve.getNAF(i[r],s[r],this.curve._bitLength),o[n]=this.curve.getNAF(i[n],s[n],this.curve._bitLength),l=Math.max(o[r].length,l),l=Math.max(o[n].length,l);continue}let c=[t[r],null,null,t[n]];0===(t[r].y??new A(0)).cmp(t[n].y??new A(0))?(c[1]=t[r].add(t[n]),c[2]=t[r].toJ().mixedAdd(t[n].neg())):0===(t[r].y??new A(0)).cmp((t[n].y??new A(0)).redNeg())?(c[1]=t[r].toJ().mixedAdd(t[n]),c[2]=t[r].add(t[n].neg())):(c[1]=t[r].toJ().mixedAdd(t[n]),c[2]=t[r].toJ().mixedAdd(t[n].neg()));let h=[-3,-1,-5,-7,0,7,5,1,3],d=this.curve.getJSF(i[r],i[n]);l=Math.max(d[0].length,l),o[r]=Array(l),o[n]=Array(l);for(let e=0;e<l;e++){let t=Math.trunc(d[0][e]),i=Math.trunc(d[1][e]);o[r][e]=h[(t+1)*3+(i+1)],o[n][e]=0,a[r]=c}}let c=new R(null,null,null),h=this.curve._wnafT4;for(let e=l;e>=0;e--){let t=0;for(;e>=0;){let i=!0;for(let t=0;t<r;t++)h[t]=new A("number"==typeof o[t][e]?o[t][e]:0),h[t].isZero()||(i=!1);if(!i)break;t++,e--}if(e>=0&&t++,c=c.dblp(t),e<0)break;let i=new A(1),n=new A(2);for(let e=0;e<r;e++){let t,r=h[e];0!==r.cmpn(0)&&(c="affine"===(t=r.isNeg()?a[e][r.neg().sub(i).div(n).toNumber()].neg():a[e][r.sub(i).div(n).toNumber()]).type?c.mixedAdd(t):c.add(t))}}for(let e=0;e<r;e++)a[e]=[];return!0===n?c:c.toP()}_endoWnafMulAdd(e,t,i){let r,n=Array(2*e.length),s=Array(2*e.length);for(r=0;r<e.length;r++){let i=this.curve._endoSplit(t[r]),a=e[r],o=a._getBeta()??new t0(null,null);0!==i.k1.negative&&(i.k1.ineg(),a=a.neg(!0)),0!==i.k2.negative&&(i.k2.ineg(),o=o.neg(!0)),n[2*r]=a,n[2*r+1]=o,s[2*r]=i.k1,s[2*r+1]=i.k2}let a=this._wnafMulAdd(1,n,s,2*r,i);for(let e=0;e<2*r;e++)n[e]=null,s[e]=null;return a}_hasDoubles(e){if(null==this.precomputed)return!1;let t=this.precomputed.doubles;return"object"==typeof t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)}_getDoubles(e,t){if("object"==typeof this.precomputed&&null!==this.precomputed&&"object"==typeof this.precomputed.doubles&&null!==this.precomputed.doubles)return this.precomputed.doubles;let i=[this],r=this;for(let n=0;n<(t??0);n+=e??1){for(let t=0;t<(e??1);t++)r=r.dbl();i.push(r)}return{step:e??1,points:i}}_getNAFPoints(e){if("object"==typeof this.precomputed&&null!==this.precomputed&&"object"==typeof this.precomputed.naf&&null!==this.precomputed.naf)return this.precomputed.naf;let t=[this],i=(1<<e)-1,r=1===i?null:this.dbl();for(let e=1;e<i;e++)null!==r&&(t[e]=t[e-1].add(r));return{wnd:e,points:t}}}class t1{p;red;redN;zero;one;two;g;n;a;b;tinv;zeroA;threeA;endo;_endoWnafT1;_endoWnafT2;_wnafT1;_wnafT2;_wnafT3;_wnafT4;_bitLength;static assert(e,t="Elliptic curve assertion failed"){if(!e)throw Error(t)}getNAF(e,t,i){let r=Array(Math.max(e.bitLength(),i)+1);r.fill(0);let n=1<<t+1,s=e.clone();for(let e=0;e<r.length;e++){let t,i=s.andln(n-1);s.isOdd()?(t=i>(n>>1)-1?(n>>1)-i:i,s.isubn(t)):t=0,r[e]=t,s.iushrn(1)}return r}getJSF(e,t){let i=[[],[]];e=e.clone(),t=t.clone();let r=0,n=0;for(;e.cmpn(-r)>0||t.cmpn(-n)>0;){let s,a,o=e.andln(3)+r&3,l=t.andln(3)+n&3;if(3===o&&(o=-1),3===l&&(l=-1),(1&o)==0)s=0;else{let t=e.andln(7)+r&7;s=(3===t||5===t)&&2===l?-o:o}if(i[0].push(s),(1&l)==0)a=0;else{let e=t.andln(7)+n&7;a=(3===e||5===e)&&2===o?-l:l}i[1].push(a),2*r===s+1&&(r=1-r),2*n===a+1&&(n=1-n),e.iushrn(1),t.iushrn(1)}return i}static cachedProperty(e,t,i){let r="_"+t;e.prototype[t]=function(){return void 0===this[r]&&(this[r]=i.call(this)),this[r]}}static parseBytes(e){return"string"==typeof e?tm(e,"hex"):e}static intFromLE(e){return new A(e,"hex","le")}constructor(){if(void 0!==e)return e;e=this;const t={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",beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",{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"]]}}]};this.p=new A(t.p,16),this.red=new P(t.prime),this.zero=new A(0).toRed(this.red),this.one=new A(1).toRed(this.red),this.two=new A(2).toRed(this.red),this.n=new A(t.n,16),this.g=t0.fromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n.bitLength(),this.redN=this.n.toRed(this.red),this.a=new A(t.a,16).toRed(this.red),this.b=new A(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}_getEndomorphism(e){let t,i,r;if(this.zeroA&&1===this.p.modrn(3)){if(void 0===e.beta){let e=this._getEndoRoots(this.p);if(null===e)throw Error("Failed to get endomorphism roots for beta.");t=(t=0>e[0].cmp(e[1])?e[0]:e[1]).toRed(this.red)}else t=new A(e.beta,16).toRed(this.red);if(void 0===e.lambda){let e=this._getEndoRoots(this.n);if(null===e)throw Error("Failed to get endomorphism roots for lambda.");if(null==this.g)throw Error("Curve generator point (g) is not defined.");let r=this.g.mul(e[0])?.x,n=null==this.g.x?void 0:this.g.x.redMul(t);if(null!=r&&null!=n&&0===r.cmp(n))i=e[0];else{if(i=e[1],null==this.g)throw Error("Curve generator point (g) is not defined.");let r=this.g.mul(i)?.x,n=null==this.g.x?void 0:this.g.x.redMul(t);if(null==r||null==n)throw Error("Lambda computation failed: g.mul(lambda).x or g.x.redMul(beta) is undefined.");t1.assert(0===r.cmp(n),"Lambda selection does not match computed beta.")}}else i=new A(e.lambda,16);return r="object"==typeof e.basis&&null!==e.basis?e.basis.map(function(e){return{a:new A(e.a,16),b:new A(e.b,16)}}):this._getEndoBasis(i),{beta:t,lambda:i,basis:r}}}_getEndoRoots(e){let t=e===this.p?this.red:new N(e),i=new A(2).toRed(t).redInvm(),r=i.redNeg(),n=new A(3).toRed(t).redNeg().redSqrt().redMul(i);return[r.redAdd(n).fromRed(),r.redSub(n).fromRed()]}_getEndoBasis(e){let t,i,r,n,s,a,o=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=e,c=this.n.clone(),h=new A(1),d=new A(0),u=new A(0),f=new A(1),p=new A(0),g=0,y=new A(0),m=new A(0);for(;0!==l.cmpn(0);){let e=c.div(l);y=c.sub(e.mul(l)),m=u.sub(e.mul(h));let s=f.sub(e.mul(d));if(void 0===r&&0>y.cmp(o))t=p.neg(),i=h,r=y.neg(),n=m;else if(void 0!==r&&2==++g)break;p=y,c=l,l=y,u=h,h=m,f=d,d=s}if(void 0===t||void 0===i||void 0===r||void 0===n)throw Error("Failed to compute Endo Basis values");s=y.neg(),a=m;let b=r.sqr().add(n.sqr());return s.sqr().add(a.sqr()).cmp(b)>=0&&(s=t,a=i),0!==r.negative&&(r=r.neg(),n=n.neg()),0!==s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:n},{a:s,b:a}]}_endoSplit(e){if(null==this.endo)throw Error("Endomorphism is not defined.");let t=this.endo.basis,i=t[0],r=t[1],n=r.b.mul(e).divRound(this.n),s=i.b.neg().mul(e).divRound(this.n),a=n.mul(i.a),o=s.mul(r.a),l=n.mul(i.b),c=s.mul(r.b);return{k1:e.sub(a).sub(o),k2:l.add(c).neg()}}validate(e){if(e.inf)return!0;let t=e.x,i=e.y;if(null===t||null===i)throw Error("Point coordinates cannot be null");let r=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===i.redSqr().redISub(n).cmpn(0)}}class t2{r;s;static fromDER(e,t){let i=(e,t)=>{let i=e[t.place++];if((128&i)==0)return i;throw Error("Invalid DER entity length")};e=tm(e,t);let r=new class{place;constructor(){this.place=0}};if(48!==e[r.place++])throw Error("Signature DER must start with 0x30");if(i(e,r)+r.place!==e.length||2!==e[r.place++])throw Error("Signature DER invalid");let n=i(e,r),s=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])throw Error("Signature DER invalid");let a=i(e,r);if(e.length!==a+r.place)throw Error("Invalid R-length in signature DER");let o=e.slice(r.place,a+r.place);if(0===s[0])if((128&s[1])==0)throw Error("Invalid R-value in signature DER");else s=s.slice(1);if(0===o[0])if((128&o[1])==0)throw Error("Invalid S-value in signature DER");else o=o.slice(1);return new t2(new A(s),new A(o))}static fromCompact(e,t){if(65!==(e=tm(e,t)).length)throw Error("Invalid Compact Signature");let i=e[0];if(i<27||i>=35)throw Error("Invalid Compact Byte");return new t2(new A(e.slice(1,33)),new A(e.slice(33,65)))}constructor(e,t){this.r=e,this.s=t}verify(e,t,i){return it(new A(ev(e,i),16),this,t)}toString(e){return this.toDER(e)}toDER(e){let t=(e,t)=>{if(t<128)e.push(t);else throw Error("len must be < 0x80")},i=e=>{let t=0,i=e.length-1;for(;0===e[t]&&(128&e[t+1])==0&&t<i;)t++;return 0===t?e:e.slice(t)},r=this.r.toArray(),n=this.s.toArray();for((128&r[0])!=0&&(r=[0].concat(r)),(128&n[0])!=0&&(n=[0].concat(n)),r=i(r),n=i(n);0===n[0]&&(128&n[1])==0;)n=n.slice(1);let s=[2];t(s,r.length),(s=s.concat(r)).push(2),t(s,n.length);let a=s.concat(n),o=[48];return(t(o,a.length),o=o.concat(a),"hex"===e)?tg(o):"base64"===e?tS(o):o}toCompact(e,t,i){if(e<0||e>3)throw Error("Invalid recovery param");if("boolean"!=typeof t)throw TypeError("Invalid compressed param");let r=27+e;t&&(r+=4);let n=[r];return(n=(n=n.concat(this.r.toArray("be",32))).concat(this.s.toArray("be",32)),"hex"===i)?tg(n):"base64"===i?tS(n):n}RecoverPublicKey(e,t){let i=this.r,r=this.s,n=new t1,s=n.n,a=n.g,o=0==e>>1?i:i.add(s),l=t0.fromX(o,(1&e)!=0);if(!l.mul(s).isInfinity())throw Error("nR is not at infinity");let c=t.neg().umod(s),h=i.invm(s),d=h.mul(r).umod(s),u=h.mul(c).umod(s),f=new ii(a.mul(u).add(l.mul(d)));return f.validate(),f}CalculateRecoveryFactor(e,t){for(let i=0;i<4;i++){let r;try{r=this.RecoverPublicKey(i,t)}catch{continue}if(e.eq(r))return i}throw Error("Unable to find valid recovery factor")}}class t8{K;V;constructor(e,t){const i=tm(e,"hex"),r=tm(t,"hex");if(32!==i.length)throw Error("Entropy must be exactly 32 bytes (256 bits)");if(32!==r.length)throw Error("Nonce must be exactly 32 bytes (256 bits)");const n=i.concat(r);this.K=Array(32),this.V=Array(32);for(let e=0;e<32;e++)this.K[e]=0,this.V[e]=1;this.update(n)}hmac(){return new ef(this.K)}update(e){let t=this.hmac().update(this.V).update([0]);void 0!==e&&(t=t.update(e)),this.K=t.digest(),this.V=this.hmac().update(this.V).digest(),void 0!==e&&(this.K=this.hmac().update(this.V).update([1]).update(e).digest(),this.V=this.hmac().update(this.V).digest())}generate(e){let t=[];for(;t.length<e;)this.V=this.hmac().update(this.V).digest(),t=t.concat(this.V);let i=t.slice(0,e);return this.update(),tg(i)}}function t3(e,t,i=new t1){let r=8*e.byteLength()-i.n.bitLength();return(r>0&&e.iushrn(r),!0!==t&&e.cmp(i.n)>=0)?e.sub(i.n):e}function t5(e){let t=e.toArray("be"),i=0n;for(let e of t)i=i<<8n|BigInt(e);return i}let t6=new t1,t4=t6.n.byteLength(),t9=t6.n.subn(1),t7=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n>>1n,ie=(e,t,i=!1,r)=>{let n=t6.n.bitLength();if(e.bitLength()>n)throw Error(`ECDSA message is too large: expected <= ${n} bits. Callers must hash messages before signing.`);let s=t5(e=t3(e)),a=t5(t),o=new t8(t.toArray("be",t4),e.toArray("be",t4));for(let e=0;;e++){let t;if(null==(t="function"==typeof r?r(e):A.isBN(r)?r:new A(o.generate(t4),16)))throw Error("k is undefined");if(0>(t=t3(t,!0)).cmpn(1)||t.cmp(t9)>0){if(A.isBN(r))throw Error("Invalid fixed custom K value (must be >1 and <N-1)");continue}let n=t6.g.mulCT(t);if(n.isInfinity()){if(A.isBN(r))throw Error("Invalid fixed custom K value (k\xb7G at infinity)");continue}let l=tJ(BigInt("0x"+n.getX().toString(16)));if(0n===l){if(A.isBN(r))throw Error("Invalid fixed custom K value (r == 0)");continue}let c=tQ(BigInt("0x"+t.toString(16))),h=tJ(s+tZ(l,a)),d=tZ(c,h);if(0n===d){if(A.isBN(r))throw Error("Invalid fixed custom K value (s == 0)");continue}return i&&d>t7&&(d=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n-d),new t2(new A(l.toString(16),16),new A(d.toString(16),16))}},it=(e,t,i)=>{let r=t6.n.bitLength();if(e.bitLength()>r)return!1;let n=t5(e);if(null==i.x||null==i.y)throw Error("Invalid public key: missing coordinates.");let s={x:t5(i.x),y:t5(i.y)},{r:a,s:o}={r:t5(t.r),s:t5(t.s)};if(a<=0n||a>=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n||o<=0n||o>=0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n)return!1;let l=tQ(o);if(0n===l)return!1;let c=tZ(n,l),h=tZ(a,l),d=tG(tY(c,{x:t$,y:tz}),tY(h,s));if(0n===d.Z)return!1;let u=tK(d.Z),f=tM(u,u);return tJ(tM(d.X,f))===a};class ii extends t0{static fromPrivateKey(e){let t=new t1().g.mul(e);return new ii(t.x,t.y)}static fromString(e){let t=t0.fromString(e);return new ii(t.x,t.y)}static fromDER(e){let t=t0.fromDER(e);return new ii(t.x,t.y)}constructor(e,t=null,i=!0){if(e instanceof t0)super(e.getX(),e.getY());else{if(null===t&&i&&"string"==typeof e&&(66===e.length||130===e.length))throw Error('You are using the "new PublicKey()" constructor with a DER hex string. You need to use "PublicKey.fromString()" instead.');super(e,t,i)}}deriveSharedSecret(e){if(!this.validate())throw Error("Public key not valid for ECDH secret derivation");return this.mulCT(e)}verify(e,t,i){return it(new A(ev(e,i),16),t,this)}toDER(e){return"hex"===e?this.encode(!0,e):this.encode(!0)}toHash(e){let t=eS(this.encode(!0));return"hex"===e?tg(t):t}toAddress(e=[0]){if("string"==typeof e)if("testnet"===e||"test"===e)e=[111];else if("mainnet"===e||"main"===e)e=[0];else throw Error(`Invalid prefix ${e}`);return tT(this.toHash(),e)}deriveChild(e,t,i,r){let n;if("function"==typeof r){let t=r(e,this);void 0===t?(n=this.deriveSharedSecret(e),"function"==typeof i&&i(e,this,n)):n=t}else n=this.deriveSharedSecret(e);let s=tm(t,"utf8"),a=eE(n.encode(!0),s),o=new t1().g.mul(new A(a)),l=this.add(o);return new ii(l.x,l.y)}static fromMsgHashAndCompactSignature(e,t,i){let r=tm(t,i);if(65!==r.length)throw Error("Invalid Compact Signature");let n=r[0];if(n<27||n>=35)throw Error("Invalid Compact Byte");let s=r[0]-27;return s>3&&(s-=4),new t2(new A(r.slice(1,33)),new A(r.slice(33,65))).RecoverPublicKey(s,e)}}class ir{_rand;getRandomValues(e,t){let i=new Uint8Array(t);return e.crypto.getRandomValues(i),Array.from(i)}constructor(){const e=()=>{throw Error("No secure random number generator is available in this environment.")};if(this._rand=e,"u">typeof globalThis&&"function"==typeof globalThis.crypto?.getRandomValues){this._rand=e=>this.getRandomValues(globalThis,e);return}if("u">typeof process&&process.release?.name==="node")try{const e=require("node:crypto");if("function"==typeof e.randomBytes){this._rand=t=>Array.from(e.randomBytes(t));return}}catch(e){}if(void 0!==globalThis.self&&"function"==typeof globalThis.self.crypto?.getRandomValues){this._rand=e=>this.getRandomValues(globalThis.self,e);return}if(void 0!==globalThis.window&&"function"==typeof globalThis.window.crypto?.getRandomValues){this._rand=e=>this.getRandomValues(globalThis.window,e);return}this._rand=e}generate(e){return this._rand(e)}}let is=null,ia=e=>(is??=new ir).generate(e);class io{x;y;constructor(e,t){const i=new t1().p;this.x=e.umod(i),this.y=t.umod(i)}toString(){return tA(this.x.toArray())+"."+tA(this.y.toArray())}static fromString(e){let[t,i]=e.split(".");return new io(new A(tx(t)),new A(tx(i)))}}class il{points;threshold;constructor(e,t){this.points=e,this.threshold=t??e.length}static fromPrivateKey(e,t){let i=new t1().p,r=[new io(new A(0),new A(e.toArray()))];for(let e=1;e<t;e++){let e=new A(ia(32)).umod(i),t=new A(ia(32)).umod(i);r.push(new io(e,t))}return new il(r)}valueAt(e){let t=new t1().p,i=new A(0);for(let r=0;r<this.threshold;r++){let n=this.points[r].y;for(let i=0;i<this.threshold;i++)if(r!==i){let s=this.points[i].x,a=this.points[r].x,o=e.sub(s).umod(t),l=a.sub(s).umod(t).invm(t),c=o.mul(l).umod(t);n=n.mul(c).umod(t)}i=i.add(n).umod(t)}return i}}class ic{points;threshold;integrity;constructor(e,t,i){this.points=e,this.threshold=t,this.integrity=i}static fromBackupFormat(e){let t=0,i="";return new ic(e.map((e,r)=>{let n=e.split(".");if(4!==n.length)throw Error("Invalid share format in share "+r.toString()+'. Expected format: "x.y.t.i" - received '+e);let[s,a,o,l]=n;if(void 0===o)throw Error("Threshold not found in share "+r.toString());if(void 0===l)throw Error("Integrity not found in share "+r.toString());let c=Number.parseInt(o,10);if(0!==r&&t!==c)throw Error("Threshold mismatch in share "+r.toString());if(0!==r&&i!==l)throw Error("Integrity mismatch in share "+r.toString());return t=c,i=l,io.fromString([s,a].join("."))}),t,i)}toBackupFormat(){return this.points.map(e=>e.toString()+"."+this.threshold.toString()+"."+this.integrity)}}class ih extends A{static fromRandom(){return new ih(ia(32))}static fromString(e,t="hex"){return new ih(super.fromString(e,t).toArray())}static fromHex(e){return new ih(super.fromHex(e,"big"))}static fromWif(e,t=1){let i=tO(e,void 0,t);if(33!==i.data.length)throw Error("Invalid WIF length");if(1!==i.data[32])throw Error("Invalid WIF padding");return new ih(i.data.slice(0,32))}constructor(e=0,t=10,i="be",r="apply"){if(e instanceof A?(super(),e.copy(this)):super(e,t,i),"nocheck"!==r){const e=this.checkInField();if(!e.inField){if("error"===r)throw Error("Input is out of field");A.move(this,e.modN)}}}checkInField(){let e=new t1,t=this.mod(e.n);return{inField:0===this.cmp(t),modN:t}}isValid(){return this.checkInField().inField}sign(e,t,i=!0,r){return ie(new A(ev(e,t),16),this,i,r)}verify(e,t,i){return it(new A(ev(e,i),16),t,this.toPublicKey())}toPublicKey(){let e=new t1().g.mulCT(this);return new ii(e.x,e.y)}toWif(e=[128]){if(!this.isValid())throw Error("Value is out of field");return tT([...this.toArray("be",32),1],e)}toAddress(e=[0]){return this.toPublicKey().toAddress(e)}toHex(){return super.toHex(32)}toString(e="hex",t=64){return super.toString(e,t)}deriveSharedSecret(e){if(!e.validate())throw Error("Public key not valid for ECDH secret derivation");return e.mulCT(this)}deriveChild(e,t,i,r){let n;if("function"==typeof r){let t=r(this,e);void 0===t?(n=this.deriveSharedSecret(e),"function"==typeof i&&i(this,e,n)):n=t}else n=this.deriveSharedSecret(e);let s=tm(t,"utf8"),a=eE(n.encode(!0),s),o=new t1;return new ih(this.add(new A(a)).mod(o.n).toArray())}toKeyShares(e,t){if("number"!=typeof e||"number"!=typeof t)throw TypeError("threshold and totalShares must be numbers");if(e<2)throw Error("threshold must be at least 2");if(t<2)throw Error("totalShares must be at least 2");if(e>t)throw Error("threshold should be less than or equal to totalShares");let i=il.fromPrivateKey(this,e),r=[],n=new Set,s=new t1,a=ia(64);for(let e=0;e<t;e++){let t,o=0;do if(t=new A(ex(a,[e,o,...ia(32)])).umod(s.p),++o>5)throw Error("Failed to generate unique x coordinate after 5 attempts");while(t.isZero()||n.has(t.toString()));n.add(t.toString());let l=i.valueAt(t);r.push(new io(t,l))}return new ic(r,e,this.toPublicKey().toHash("hex").slice(0,8))}toBackupShares(e,t){return this.toKeyShares(e,t).toBackupFormat()}static fromBackupShares(e){return ih.fromKeyShares(ic.fromBackupFormat(e))}static fromKeyShares(e){let{points:t,threshold:i,integrity:r}=e;if(i<2)throw Error("threshold must be at least 2");if(t.length<i)throw Error(`At least ${i} shares are required to reconstruct the private key`);for(let e=0;e<i;e++)for(let r=e+1;r<i;r++)if(t[e].x.eq(t[r].x))throw Error("Duplicate share detected, each must be unique.");let n=new ih(new il(t,i).valueAt(new A(0)).toArray());if(n.toPublicKey().toHash("hex").slice(0,8)!==r)throw Error("Integrity hash mismatch");return n}}let id=new Uint8Array([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]),iu=[[0,0,0,0],[1,0,0,0],[2,0,0,0],[4,0,0,0],[8,0,0,0],[16,0,0,0],[32,0,0,0],[64,0,0,0],[128,0,0,0],[27,0,0,0],[54,0,0,0]].map(e=>new Uint8Array(e)),ip=new Uint8Array(256),ig=new Uint8Array(256);for(let e=0;e<256;e++){let t=(e<<1^27*((128&e)!=0))&255;ip[e]=t,ig[e]=t^e}function iy(e,t,i){for(let r=0;r<4;r++){let n=t[i+r];for(let t=0;t<4;t++)e[t][r]^=n[t]}}function im(e){for(let t=0;t<4;t++)e[t]=id[e[t]]}function ib(e,t){let i,r,n,s,a=[[],[],[],[]],o=[],l=Array.from(t);if(16===l.length)s=11;else if(24===l.length)s=13;else if(32===l.length)s=15;else throw Error("Illegal key length: "+String(l.length));let c=function(e,t){let i=t.length/4,r=[];for(let e=0;e<t.length;e++)e%4==0&&r.push([]),r[e>>2].push(t[e]);for(let t=i;t<4*e;t++){r[t]=[];let e=r[t-1].slice();if(t%i==0){!function(e){let t=e[0];e[0]=e[1],e[1]=e[2],e[2]=e[3],e[3]=t}(e),im(e);let r=iu[t/i];for(let t=0;t<4;t++)e[t]^=r[t]}else i>6&&t%i==4&&im(e);for(let n=0;n<4;n++)r[t][n]=r[t-i][n]^e[n]}return r}(s,l);for(let t=0;t<4;t++)a[0][t]=e[4*t],a[1][t]=e[4*t+1],a[2][t]=e[4*t+2],a[3][t]=e[4*t+3];for(iy(a,c,0),n=1;n<s;n++){for(let e=0;e<4;e++)for(let t=0;t<4;t++)a[e][t]=id[a[e][t]];!function(e){let t=e[1][0];e[1][0]=e[1][1],e[1][1]=e[1][2],e[1][2]=e[1][3],e[1][3]=t,t=e[2][0];let i=e[2][1];e[2][0]=e[2][2],e[2][1]=e[2][3],e[2][2]=t,e[2][3]=i,t=e[3][3],e[3][3]=e[3][2],e[3][2]=e[3][1],e[3][1]=e[3][0],e[3][0]=t}(a),n+1<s&&function(e){for(let t=0;t<4;t++){let i=e[0][t],r=e[1][t],n=e[2][t],s=e[3][t];e[0][t]=ip[i]^ig[r]^n^s,e[1][t]=i^ip[r]^ig[n]^s,e[2][t]=i^r^ip[n]^ig[s],e[3][t]=ig[i]^r^n^ip[s]}}(a),iy(a,c,4*n)}for(i=0;i<4;i++)for(r=0;r<4;r++)o.push(a[r][i]);return o}let iw=function(e){if(e<0||e>Number.MAX_SAFE_INTEGER)throw Error("getBytes64: value out of range");let t=Math.floor(e/0x100000000),i=e>>>0;return[t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i]},iv=function(e){return new Uint8Array(e)},iI=((n=new Uint8Array(16))[0]=225,n),ik=(...e)=>{let t=0;for(let i of e)t+=i.length;let i=new Uint8Array(t),r=0;for(let t of e)i.set(t,r),r+=t.length;return i},iS=function(e){let t=0,i=0;for(let r=0;r<e.length;r++)i=t,t=1&e[r],e[r]=e[r]>>1,0!==i&&(e[r]=128|e[r]);return e},iE=function(e,t){let i=t.slice(),r=iv(16);for(let t=0;t<16;t++){let n=e[t];for(let e=7;e>=0;e--){let t=255&-(n>>e&1);for(let e=0;e<16;e++)r[e]^=i[e]&t;let s=255&-(1&i[15]);iS(i);for(let e=0;e<16;e++)i[e]^=iI[e]&s}}return r},ix=function(e){let t=e.slice();for(let e=15;e>11&&(t[e]=t[e]+1&255,0===t[e]);e--);return t};function iA(e,t){let i=iv(16),r=new Uint8Array(16);for(let n=0;n<e.length;n+=16){r.set(i);for(let t=0;t<16;t++)r[t]^=e[n+t]??0;i=iE(r,t)}return i}function iT(e,t,i){if(0===e.length)return new Uint8Array(0);let r=new Uint8Array(e.length),n=t.slice(),s=0,a=Math.ceil(e.length/16);for(let t=0;t<a;t++){let o=ib(n,i),l=Math.min(16,e.length-s);for(let t=0;t<l;t++)r[s]=e[s]^o[t],s++;t+1<a&&(n=ix(n))}return r}function iO(e){let t,i,r=8*e.length;t=0===e.length?16:e.length%16==0?0:16-e.length%16;let n=new Uint8Array(16+e.length+t+16);i=16,n.set(e,i),i+=e.length,i+=t;let s=iw(0);n.set(s,i),i+=8;let a=iw(r);return n.set(a,i),n}let iP=(()=>{let e="u"<typeof globalThis?void 0:globalThis.process,t=e?.getBuiltinModule;if("function"==typeof t)try{let i=t.call(e,"node:crypto");if(null!=i)return i}catch{}try{if("function"==typeof require)return require("node:crypto")}catch{}})(),iN=null!=iP&&"function"==typeof iP.createCipheriv&&"function"==typeof iP.createDecipheriv;class i_ extends A{static fromRandom(){return new i_(ia(32))}encrypt(e,t){let i=new Uint8Array(ia(32)),r=new Uint8Array(tm(e,t)),n=new Uint8Array(this.toArray("be",32));if(iN){let e=function(e,t,i){try{let r=iP.createCipheriv("aes-256-gcm",Buffer.from(i.buffer,i.byteOffset,i.byteLength),Buffer.from(t.buffer,t.byteOffset,t.byteLength)),n=Buffer.concat([r.update(Buffer.from(e.buffer,e.byteOffset,e.byteLength)),r.final()]),s=r.getAuthTag(),a=new Uint8Array(t.length+n.length+s.length),o=0;return a.set(t,o),o+=t.length,a.set(n,o),o+=n.length,a.set(s,o),a}catch{return null}}(r,i,n);if(null!==e)return tk(Array.from(e),t)}let{result:s,authenticationTag:a}=function(e,t,i){let r;if(0===t.length)throw Error("Initialization vector must not be empty");if(0===i.length)throw Error("Key must not be empty");let n=new Uint8Array(ib(iv(16),i));if(12===t.length)r=ik(t,iv(3),new Uint8Array([1]));else{let e=t;e.length%16!=0&&(e=ik(e,iv(16-e.length%16)));let i=iw(8*t.length);r=iA(ik(e,iv(8),new Uint8Array(i)),n)}let s=iT(e,ix(r),i),a=iT(iA(iO(s),n),r,i);return{result:s,authenticationTag:a}}(r,i,n),o=new Uint8Array(i.length+s.length+a.length),l=0;return o.set(i,l),l+=i.length,o.set(s,l),l+=s.length,o.set(a,l),tk(Array.from(o),t)}decrypt(e,t){let i=new Uint8Array(tm(e,t));if(i.length<48)throw Error("Ciphertext too short");let r=new Uint8Array(this.toArray("be",32));if(iN){let e=function(e,t){try{let i=e.slice(0,32),r=e.length-16,n=e.slice(32,r),s=e.slice(r),a=iP.createDecipheriv("aes-256-gcm",Buffer.from(t.buffer,t.byteOffset,t.byteLength),Buffer.from(i.buffer,i.byteOffset,i.byteLength));a.setAuthTag(Buffer.from(s.buffer,s.byteOffset,s.byteLength));let o=Buffer.concat([a.update(Buffer.from(n.buffer,n.byteOffset,n.byteLength)),a.final()]);return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}catch{return null}}(i,r);if(void 0!==e){if(null===e)throw Error("Decryption failed!");return tk(Array.from(e),t)}}let n=i.slice(0,32),s=i.length-16,a=function(e,t,i,r){let n;if(0===e.length)throw Error("Cipher text must not be empty");if(0===t.length)throw Error("Initialization vector must not be empty");if(0===r.length)throw Error("Key must not be empty");let s=new Uint8Array(ib(iv(16),r));if(12===t.length)n=ik(t,iv(3),new Uint8Array([1]));else{let e=t;e.length%16!=0&&(e=ik(e,iv(16-e.length%16)));let i=iw(8*t.length);n=iA(ik(e,iv(8),new Uint8Array(i)),s)}let a=iT(e,ix(n),r),o=iT(iA(iO(e),s),n,r);if(o.length!==i.length)return null;let l=0;for(let e=0;e<o.length;e++)l|=o[e]^i[e];return 0!==l?null:a}(i.slice(32,s),n,i.slice(s),r);if(null===a)throw Error("Decryption failed!");return tk(Array.from(a),t)}}let iR={OP_0:0,OP_FALSE:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_1:81,OP_TRUE:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP2:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP3:178,OP_SUBSTR:179,OP_NOP4:179,OP_LEFT:180,OP_NOP5:180,OP_RIGHT:181,OP_NOP6:181,OP_LSHIFTNUM:182,OP_NOP7:182,OP_RSHIFTNUM:183,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_NOP11:186,OP_NOP12:187,OP_NOP13:188,OP_NOP14:189,OP_NOP15:190,OP_NOP16:191,OP_NOP17:192,OP_NOP18:193,OP_NOP19:194,OP_NOP20:195,OP_NOP21:196,OP_NOP22:197,OP_NOP23:198,OP_NOP24:199,OP_NOP25:200,OP_NOP26:201,OP_NOP27:202,OP_NOP28:203,OP_NOP29:204,OP_NOP30:205,OP_NOP31:206,OP_NOP32:207,OP_NOP33:208,OP_NOP34:209,OP_NOP35:210,OP_NOP36:211,OP_NOP37:212,OP_NOP38:213,OP_NOP39:214,OP_NOP40:215,OP_NOP41:216,OP_NOP42:217,OP_NOP43:218,OP_NOP44:219,OP_NOP45:220,OP_NOP46:221,OP_NOP47:222,OP_NOP48:223,OP_NOP49:224,OP_NOP50:225,OP_NOP51:226,OP_NOP52:227,OP_NOP53:228,OP_NOP54:229,OP_NOP55:230,OP_NOP56:231,OP_NOP57:232,OP_NOP58:233,OP_NOP59:234,OP_NOP60:235,OP_NOP61:236,OP_NOP62:237,OP_NOP63:238,OP_NOP64:239,OP_NOP65:240,OP_NOP66:241,OP_NOP67:242,OP_NOP68:243,OP_NOP69:244,OP_NOP70:245,OP_NOP71:246,OP_NOP72:247,OP_NOP73:248,OP_NOP77:252,OP_SMALLDATA:249,OP_SMALLINTEGER:250,OP_PUBKEYS:251,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};for(let e in iR)void 0===iR[iR[e]]&&(iR[iR[e]]=e);let iC=iR,iB="u"<typeof globalThis?void 0:globalThis.Buffer;class iU{_chunks;parsed;rawBytesCache;hexCache;static fromASM(e){let t=[],i=e.split(" "),r=0;for(;r<i.length;){let{chunk:e,advance:n}=iU.parseASMToken(i,r);t.push(e),r+=n}return new iU(t)}static pushdataOpCodeNum(e){return e>=0&&e<iC.OP_PUSHDATA1?e:e<256?iC.OP_PUSHDATA1:e<65536?iC.OP_PUSHDATA2:iC.OP_PUSHDATA4}static parseASMToken(e,t){let i=e[t];if("0"===i)return{chunk:{op:0},advance:1};if("-1"===i)return{chunk:{op:iC.OP_1NEGATE},advance:1};let r=i.startsWith("OP_")&&void 0!==iC[i],n=r?iC[i]:0;if(n===iC.OP_PUSHDATA1||n===iC.OP_PUSHDATA2||n===iC.OP_PUSHDATA4)return{chunk:{data:tm(e[t+2],"hex"),op:n},advance:3};if(!r){let e=i;e.length%2!=0&&(e="0"+e);let t=tm(e,"hex");if(tk(t,"hex")!==e)throw Error("invalid hex string in script");return{chunk:{data:t,op:iU.pushdataOpCodeNum(t.length)},advance:1}}return{chunk:{op:n},advance:1}}static fromHex(e){if(0===e.length)return iU.fromBinary([]);if(e.length%2!=0)throw Error("There is an uneven number of characters in the string which suggests it is not hex encoded.");if(!/^[0-9a-fA-F]+$/.test(e))throw Error("Some elements in this string are not hex encoded.");let t=tm(e,"hex");return new iU([],Uint8Array.from(t),e.toLowerCase(),!1)}static fromBinary(e){return new iU([],Uint8Array.from(e),void 0,!1)}constructor(e=[],t,i,r=!0){this._chunks=e,this.parsed=r,this.rawBytesCache=t,this.hexCache=i}get chunks(){return this.ensureParsed(),this._chunks}set chunks(e){this._chunks=e,this.parsed=!0,this.invalidateSerializationCaches()}ensureParsed(){this.parsed||(null!=this.rawBytesCache?this._chunks=iU.parseChunks(this.rawBytesCache):this._chunks=[],this.parsed=!0)}toASM(){let e="";for(let t of this.chunks)e+=this._chunkToString(t);return e.slice(1)}toHex(){if(null!=this.hexCache)return this.hexCache;this.rawBytesCache??=this.serializeChunksToBytes();let e=null==iB?tk(Array.from(this.rawBytesCache),"hex"):iB.from(this.rawBytesCache).toString("hex");return this.hexCache=e,e}toBinary(){return Array.from(this.toUint8Array())}toUint8Array(){return this.rawBytesCache??=this.serializeChunksToBytes(),this.rawBytesCache}writeScript(e){return this.invalidateSerializationCaches(),this.chunks=this.chunks.concat(e.chunks),this}writeOpCode(e){return this.invalidateSerializationCaches(),this.chunks.push({op:e}),this}setChunkOpCode(e,t){return this.invalidateSerializationCaches(),this.chunks[e]={op:t},this}writeBn(e){if(this.invalidateSerializationCaches(),e.cmpn(0)===iC.OP_0)this.chunks.push({op:iC.OP_0});else if(0===e.cmpn(-1))this.chunks.push({op:iC.OP_1NEGATE});else if(e.cmpn(1)>=0&&0>=e.cmpn(16))this.chunks.push({op:e.toNumber()+iC.OP_1-1});else{let t=e.toSm("little");this.writeBin(t)}return this}writeBin(e){let t;this.invalidateSerializationCaches();let i=e.length>0?e:void 0;if(e.length>0&&e.length<iC.OP_PUSHDATA1)t=e.length;else if(0===e.length)t=iC.OP_0;else if(e.length<256)t=iC.OP_PUSHDATA1;else if(e.length<65536)t=iC.OP_PUSHDATA2;else if(e.length<0x100000000)t=iC.OP_PUSHDATA4;else throw Error("You can't push that much data");return this.chunks.push({data:i,op:t}),this}writeNumber(e){return this.invalidateSerializationCaches(),this.writeBn(new A(e)),this}removeCodeseparators(){let e=this.toUint8Array();return this.rawBytesCache=Uint8Array.from(iU.removeOpcodeBytes(e,iC.OP_CODESEPARATOR)),this.hexCache=void 0,this._chunks=[],this.parsed=!1,this}findAndDelete(e){this.invalidateSerializationCaches();let t=e.toUint8Array(),i=t.length;if(0===i)return this;let r=t[0]??0,n=e=>{if(e.op!==r)return!1;let n=e.data??[],s=n.length;if(0===s)return 1===i;if(e.op===iC.OP_RETURN||e.op<iC.OP_PUSHDATA1){if(i!==1+s)return!1;for(let e=0;e<s;e++)if(t[1+e]!==n[e])return!1;return!0}if(e.op===iC.OP_PUSHDATA1){if(i!==2+s||t[1]!==(255&s))return!1;for(let e=0;e<s;e++)if(t[2+e]!==n[e])return!1;return!0}if(e.op===iC.OP_PUSHDATA2){if(i!==3+s||t[1]!==(255&s)||t[2]!==(s>>8&255))return!1;for(let e=0;e<s;e++)if(t[3+e]!==n[e])return!1;return!0}if(e.op===iC.OP_PUSHDATA4){if(i!==5+s)return!1;let e=s>>>0;if(t[1]!==(255&e)||t[2]!==(e>>8&255)||t[3]!==(e>>16&255)||t[4]!==(e>>24&255))return!1;for(let e=0;e<s;e++)if(t[5+e]!==n[e])return!1;return!0}return!1};for(let e=0;e<this.chunks.length;)n(this.chunks[e])?this.chunks.splice(e,1):e++;return this}isPushOnly(){for(let e of this.chunks)if(e.op>iC.OP_16)return!1;return!0}isLockingScript(){throw Error("Not implemented")}isUnlockingScript(){throw Error("Not implemented")}static computeSerializedLength(e){let t=0;for(let i of e){if(t+=1,null==i.data)continue;let e=i.data.length;if(i.op===iC.OP_RETURN){t+=e;break}i.op<iC.OP_PUSHDATA1?t+=e:i.op===iC.OP_PUSHDATA1?t+=1+e:i.op===iC.OP_PUSHDATA2?t+=2+e:i.op===iC.OP_PUSHDATA4&&(t+=4+e)}return t}serializeChunksToBytes(){let e=this.chunks,t=new Uint8Array(iU.computeSerializedLength(e)),i=0;for(let r of e)if(t[i++]=r.op,null!=r.data){if(r.op===iC.OP_RETURN){t.set(r.data,i);break}i=iU.writeChunkData(t,i,r.op,r.data)}return t}invalidateSerializationCaches(){this.rawBytesCache=void 0,this.hexCache=void 0}static writeChunkData(e,t,i,r){let n=r.length;if(i<iC.OP_PUSHDATA1)return e.set(r,t),t+n;if(i===iC.OP_PUSHDATA1)return e[t++]=255&n,e.set(r,t),t+n;if(i===iC.OP_PUSHDATA2)return e[t++]=255&n,e[t++]=n>>8&255,e.set(r,t),t+n;if(i===iC.OP_PUSHDATA4){let i=n>>>0;return e[t++]=255&i,e[t++]=i>>8&255,e[t++]=i>>16&255,e[t++]=i>>24&255,e.set(r,t),t+n}return t}static readPushdataLength(e,t,i,r){if(e>0&&e<iC.OP_PUSHDATA1)return{len:e,newPos:i,hasLength:!0};if(e===iC.OP_PUSHDATA1){let e=i<r;return{len:e?t[i++]??0:0,newPos:i,hasLength:e}}if(e===iC.OP_PUSHDATA2){let e=i+1<r;return{len:(t[i]??0)|(t[i+1]??0)<<8,newPos:Math.min(i+2,r),hasLength:e}}let n=i+3<r;return{len:((t[i]??0)|(t[i+1]??0)<<8|(t[i+2]??0)<<16|(t[i+3]??0)<<24)>>>0,newPos:Math.min(i+4,r),hasLength:n}}static parseChunks(e){let t=[],i=e.length,r=0,n=0;for(;r<i;){let s=e[r++]??0;if(s===iC.OP_RETURN&&0===n){t.push({op:s,data:iU.copyRange(e,r,i)});break}if(s===iC.OP_IF||s===iC.OP_NOTIF||s===iC.OP_VERIF||s===iC.OP_VERNOTIF?n++:s===iC.OP_ENDIF&&n--,s>0&&s<=iC.OP_PUSHDATA4){let{len:n,newPos:a,hasLength:o}=iU.readPushdataLength(s,e,r,i),l=Math.min((r=a)+n,i),c=!o||l-r!==n;t.push({data:iU.copyRange(e,r,l),op:s,invalidLength:c}),r=l}else t.push({op:s})}return t}static removeOpcodeBytes(e,t){let i=[],r=e.length,n=0;for(;n<r;){let s=n,a=e[n++]??0;if(a>0&&a<=iC.OP_PUSHDATA4){let{len:o,newPos:l}=iU.readPushdataLength(a,e,n,r),c=Math.min((n=l)+o,r);if(a!==t)for(let t=s;t<c;t++)i.push(e[t]??0);n=c}else a!==t&&i.push(a)}return i}static copyRange(e,t,i){let r=Math.max(i-t,0),n=Array(r);for(let i=0;i<r;i++)n[i]=e[t+i]??0;return n}_chunkToString(e){let t=e.op,i="";if(void 0===e.data){let e=iC[t];i=`${i} ${e}`}else i=`${i} ${tg(e.data)}`;return i}}let iF=new Uint8Array(0);class iD extends t2{static SIGHASH_ALL=1;static SIGHASH_NONE=2;static SIGHASH_SINGLE=3;static SIGHASH_CHRONICLE=32;static SIGHASH_FORKID=64;static SIGHASH_ANYONECANPAY=128;scope;static formatOTDA(e){let t=(e.scope&iD.SIGHASH_ANYONECANPAY)===iD.SIGHASH_ANYONECANPAY,i=(31&e.scope)===iD.SIGHASH_SINGLE,r=(31&e.scope)===iD.SIGHASH_NONE,n=(31&e.scope)===iD.SIGHASH_ALL||!i&&!r,s=iU.fromBinary(e.subscript.toBinary());s.removeCodeseparators();let a={sourceTXID:e.sourceTXID,sourceOutputIndex:e.sourceOutputIndex,sequence:e.inputSequence,script:s.toBinary()},o=new tP;function l(e){for(let t of(o.writeVarIntNum(e.length),e))o.writeReverse(tm(t.sourceTXID,"hex")),o.writeUInt32LE(t.sourceOutputIndex),o.writeVarIntNum(t.script.length),o.write(t.script),o.writeUInt32LE(t.sequence)}function c(e){for(let t of(o.writeVarIntNum(e.length),e))o.writeUInt64LE(t.satoshis),o.writeVarIntNum(t.script.length),o.write(t.script)}o.writeInt32LE(e.transactionVersion);let h=new iU().toBinary();if(t)t&&l([a]);else{let t=e.otherInputs.map(e=>({sourceTXID:e.sourceTXID??e.sourceTransaction?.id("hex")??"",sourceOutputIndex:e.sourceOutputIndex,sequence:i||r?0:e.sequence??0xffffffff,script:h}));t.splice(e.inputIndex,0,a),l(t)}if(n)c(e.outputs.map(e=>({satoshis:e.satoshis??0,script:e.lockingScript.toBinary()})));else if(i){let t=[];for(let i=0;i<e.inputIndex;i++)t.push({satoshis:-1,script:h});let i=e.outputs[e.inputIndex];void 0!==i&&t.push({satoshis:i.satoshis??0,script:i.lockingScript.toBinary()}),c(t)}else r&&c([]);return o.writeUInt32LE(e.lockTime),o.writeUInt32LE(e.scope>>>0),o.toUint8Array()}static formatBip143(e){let t=e.cache,i={sourceTXID:e.sourceTXID,sourceOutputIndex:e.sourceOutputIndex,sequence:e.inputSequence},r=[...e.otherInputs];function n(t){let i=new tP;if(void 0===t)for(let t of e.outputs){let e=t.satoshis??0;i.writeUInt64LE(e);let r=t.lockingScript?.toUint8Array()??iF;i.writeVarIntNum(r.length),i.write(r)}else{let r=e.outputs[t];if(void 0===r)throw Error(`Output at index ${t} does not exist`);let n=r.satoshis??0;i.writeUInt64LE(n);let s=r.lockingScript?.toUint8Array()??iF;i.writeVarIntNum(s.length),i.write(s)}return ek(i.toUint8Array())}r.splice(e.inputIndex,0,i);let s=Array(32).fill(0),a=Array(32).fill(0),o=Array(32).fill(0);if((e.scope&iD.SIGHASH_ANYONECANPAY)==0&&(t?.hashPrevouts==null?(s=(()=>{let e=new tP;for(let t of r){if(void 0===t.sourceTXID){if(null==t.sourceTransaction)throw Error("Missing sourceTransaction for input");e.write(t.sourceTransaction.hash())}else e.writeReverse(tm(t.sourceTXID,"hex"));e.writeUInt32LE(t.sourceOutputIndex)}return ek(e.toUint8Array())})(),null!=t&&(t.hashPrevouts=s)):s=t.hashPrevouts),(e.scope&iD.SIGHASH_ANYONECANPAY)==0&&(31&e.scope)!==iD.SIGHASH_SINGLE&&(31&e.scope)!==iD.SIGHASH_NONE&&(t?.hashSequence==null?(a=(()=>{let e=new tP;for(let t of r){let i=t.sequence??0xffffffff;e.writeUInt32LE(i)}return ek(e.toUint8Array())})(),null!=t&&(t.hashSequence=a)):a=t.hashSequence),(31&e.scope)!==iD.SIGHASH_SINGLE&&(31&e.scope)!==iD.SIGHASH_NONE)t?.hashOutputsAll==null?(o=n(),null!=t&&(t.hashOutputsAll=o)):o=t.hashOutputsAll;else if((31&e.scope)===iD.SIGHASH_SINGLE&&e.inputIndex<e.outputs.length){let i=e.inputIndex,r=t?.hashOutputsSingle?.get(i);null==r?(o=n(i),null!=t&&(t.hashOutputsSingle??=new Map,t.hashOutputsSingle.set(i,o))):o=r}let l=new tP;l.writeInt32LE(e.transactionVersion),l.write(s),l.write(a),l.writeReverse(tm(e.sourceTXID,"hex")),l.writeUInt32LE(e.sourceOutputIndex);let c=e.subscript.toUint8Array();l.writeVarIntNum(c.length),l.write(c),l.writeUInt64LE(e.sourceSatoshis);let h=i.sequence;return l.writeUInt32LE(h),l.write(o),l.writeUInt32LE(e.lockTime),l.writeUInt32LE(e.scope>>>0),l.toUint8Array()}static format(e){return Array.from(this.formatBytes(e))}static formatBytes(e){let t=(e.scope&iD.SIGHASH_FORKID)!=0,i=!0!==e.ignoreChronicle&&(e.scope&iD.SIGHASH_CHRONICLE)!=0;return t&&!i?iD.formatBip143(e):!t||t&&i?iD.formatOTDA(e):new Uint8Array(0)}static usesOtdaSingleBug(e){let t=(e.scope&iD.SIGHASH_FORKID)!=0,i=!0!==e.ignoreChronicle&&(e.scope&iD.SIGHASH_CHRONICLE)!=0;return(!t||t&&i)&&(31&e.scope)===iD.SIGHASH_SINGLE&&e.inputIndex>=e.outputs.length}static fromChecksigFormat(e){if(0===e.length)return new iD(new A(1),new A(1),1);let t=e.at(-1),i=e.slice(0,e.length-1),r=t2.fromDER(i);return new iD(r.r,r.s,t)}constructor(e,t,i){super(e,t),this.scope=i}hasLowS(){return!(this.s.ltn(1)||this.s.gt(new A("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))}toChecksigFormat(){return[...this.toDER(),this.scope]}}class iL{curve;constructor(){this.curve=new t1}generateProof(e,t,i,r){let n=ih.fromRandom(),s=n.toPublicKey(),a=i.mul(n),o=this.computeChallenge(t,i,r,a,s);return{R:s,SPrime:a,z:n.add(o.mul(e)).umod(this.curve.n)}}verifyProof(e,t,i,r){let{R:n,SPrime:s,z:a}=r,o=this.computeChallenge(e,t,i,s,n),l=this.curve.g.mul(a),c=n.add(e.mul(o));if(!l.eq(c))return!1;let h=t.mul(a),d=s.add(i.mul(o));return!!h.eq(d)}computeChallenge(e,t,i,r,n){return new A(ev([...e.encode(!0),...t.encode(!0),...i.encode(!0),...r.encode(!0),...n.encode(!0)])).umod(this.curve.n)}}let iV=/^[0-9a-fA-F]+$/,iH=BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),iM=BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),iK=iH-3n,iq=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),i$={x:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),y:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},iz=iM>>1n;class iW{p=iH;n=iM;a=iK;b=iq;g=i$;mod(e,t=this.p){let i=e%t;return i>=0n?i:i+t}modInv(e,t){if(0n===e||t<=0n)throw Error("Invalid mod inverse input");let[i,r]=[this.mod(e,t),t],[n,s]=[1n,0n];for(;0n!==r;){let e=i/r;[i,r]=[r,i-e*r],[n,s]=[s,n-e*s]}if(1n!==i)throw Error("Inverse does not exist");return this.mod(n,t)}modPow(e,t,i){if(1n===i)return 0n;let r=1n,n=this.mod(e,i),s=t;for(;s>0n;)(1n&s)===1n&&(r=this.mod(r*n,i)),s>>=1n,n=this.mod(n*n,i);return r}isInfinity(e){return null===e}assertOnCurve(e){if(this.isInfinity(e))return;let{x:t,y:i}=e;if(this.mod(i*i)!==this.mod(this.mod(t*t*t+this.a*t)+this.b))throw Error("Point is not on secp256r1")}pointFromAffine(e,t){let i={x:this.mod(e),y:this.mod(t)};return this.assertOnCurve(i),i}pointFromHex(e){if(e.startsWith("04")){let t=BigInt("0x"+e.slice(2,66)),i=BigInt("0x"+e.slice(66));return this.pointFromAffine(t,i)}if(e.startsWith("02")||e.startsWith("03")){let t=BigInt("0x"+e.slice(2)),i=this.mod(this.mod(t*t*t+this.a*t)+this.b),r=this.modPow(i,this.p+1n>>2n,this.p),n=(1n&r)===1n===e.startsWith("03")?r:this.p-r;return this.pointFromAffine(t,n)}throw Error("Invalid point encoding")}pointToHex(e,t=!1){if(this.isInfinity(e))return"00";let i=this.to32BytesHex(e.x),r=this.to32BytesHex(e.y);return t?((1n&e.y)===0n?"02":"03")+i:"04"+i+r}addPoints(e,t){if(this.isInfinity(e))return t;if(this.isInfinity(t))return e;let{x:i,y:r}=e,{x:n,y:s}=t;if(i===n)return r===s?this.doublePoint(e):null;let a=this.mod((s-r)*this.modInv(n-i,this.p)),o=this.mod(a*a-i-n),l=this.mod(a*(i-o)-r);return{x:o,y:l}}doublePoint(e){if(this.isInfinity(e))return e;if(0n===e.y)return null;let t=this.mod((3n*e.x*e.x+this.a)*this.modInv(2n*e.y,this.p)),i=this.mod(t*t-2n*e.x),r=this.mod(t*(e.x-i)-e.y);return{x:i,y:r}}add(e,t){return this.addPoints(e,t)}multiply(e,t){if(0n===t||this.isInfinity(e))return null;let i=this.mod(t,this.n),r=null,n=e;for(;i>0n;)(1n&i)===1n&&(r=this.addPoints(r,n)),n=this.doublePoint(n),i>>=1n;return r}multiplyBase(e){return this.multiply(this.g,e)}isOnCurve(e){try{return this.assertOnCurve(e),!0}catch(e){return!1}}generatePrivateKeyHex(){return this.to32BytesHex(this.randomScalar())}randomScalar(){for(;;){let e=BigInt("0x"+tg(ia(32)));if(e>0n&&e<this.n)return e}}normalizePrivateKey(e){let t=this.mod(e,this.n);if(0n===t)throw Error("Invalid private key");return t}toScalar(e){if("bigint"==typeof e)return this.normalizePrivateKey(e);let t=e.startsWith("0x")?e.slice(2):e;if(!iV.test(t)||0===t.length||t.length>64)throw Error("Private key must be a hex string <= 32 bytes");let i=BigInt("0x"+t.padStart(64,"0"));return this.normalizePrivateKey(i)}publicKeyFromPrivate(e){let t=this.toScalar(e);return this.multiplyBase(t)}sign(e,t,i={}){let{prehashed:r=!1,nonce:n}=i,s=this.toScalar(t),a=this.normalizeMessage(e,r),o=this.bytesToScalar(a),l=n??this.deterministicNonce(s,a);for(;;){let e=this.multiplyBase(l);if(this.isInfinity(e)){l=n??this.deterministicNonce(s,a);continue}let t=this.mod(e.x,this.n);if(0n===t){l=n??this.deterministicNonce(s,a);continue}let i=this.modInv(l,this.n),r=this.mod(i*(o+t*s),this.n);if(0n===r){l=n??this.deterministicNonce(s,a);continue}return r>iz&&(r=this.n-r),{r:this.to32BytesHex(t),s:this.to32BytesHex(r)}}}verify(e,t,i,r={}){let n,{prehashed:s=!1}=r;try{n="string"==typeof i?this.pointFromHex(i):i}catch{return!1}if(null==n||!this.isOnCurve(n))return!1;let a="bigint"==typeof t.r?t.r:BigInt("0x"+t.r),o="bigint"==typeof t.s?t.s:BigInt("0x"+t.s);if(a<=0n||a>=this.n||o<=0n||o>=this.n)return!1;let l=this.bytesToScalar(this.normalizeMessage(e,s)),c=this.modInv(o,this.n),h=this.mod(l*c,this.n),d=this.mod(a*c,this.n),u=this.addPoints(this.multiplyBase(h),this.multiply(n,d));return!this.isInfinity(u)&&this.mod(u.x,this.n)===a}normalizeMessage(e,t){let i=this.toBytes(e);return t?i:new Uint8Array(ev(i))}bytesToScalar(e){return BigInt("0x"+tg(Array.from(e)))%this.n}deterministicNonce(e,t){let i=tm(this.to32BytesHex(e),"hex"),r=0;for(;r<1024;){let e=BigInt("0x"+tg(eE(i,0===r?Array.from(t):Array.from(t).concat([255&r]))))%this.n;if(e>0n)return e;r++}throw Error("Failed to derive deterministic nonce")}toBytes(e){if("string"==typeof e){let t=iV.test(e)&&e.length%2==0;return Uint8Array.from(tm(e,t?"hex":"utf8"))}if(e instanceof Uint8Array)return e;if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unsupported message format")}to32BytesHex(e){return e.toString(16).padStart(64,"0")}}class ij extends iU{isLockingScript(){return!0}isUnlockingScript(){return!1}}class iG extends iU{isLockingScript(){return!1}isUnlockingScript(){return!0}}class iX extends Error{txid;outputIndex;context;programCounter;stackState;altStackState;ifStackState;stackMem;altStackMem;constructor(e){const t=e.stackState.map(e=>null!=e&&void 0!==e.length?tg(e):null==e?"null/undef":"INVALID_STACK_ITEM").join(", "),i=e.altStackState.map(e=>null!=e&&void 0!==e.length?tg(e):null==e?"null/undef":"INVALID_STACK_ITEM").join(", "),r=`Context: ${e.context}, PC: ${e.programCounter}`,n=`Stack: [${t}] (len: ${e.stackState.length}, mem: ${e.stackMem})`,s=`AltStack: [${i}] (len: ${e.altStackState.length}, mem: ${e.altStackMem})`,a=`IfStack: [${e.ifStackState.join(", ")}]`;super(`Script evaluation error: ${e.message}
2
2
  TXID: ${e.txid}, OutputIdx: ${e.outputIndex}
3
3
  ${r}
4
4
  ${n}