@btc-vision/transaction 1.0.4 → 1.0.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 (52) hide show
  1. package/browser/_version.d.ts +1 -1
  2. package/browser/index.js +1 -1
  3. package/browser/index.js.LICENSE.txt +0 -7
  4. package/build/_version.d.ts +1 -1
  5. package/build/_version.js +1 -1
  6. package/build/bytecode/Compressor.js +4 -5
  7. package/docs/classes/AddressGenerator.html +2 -2
  8. package/docs/classes/BitcoinUtils.html +3 -3
  9. package/docs/classes/CalldataGenerator.html +10 -10
  10. package/docs/classes/Compressor.html +4 -4
  11. package/docs/classes/ContractBaseMetadata.html +4 -4
  12. package/docs/classes/DeploymentGenerator.html +9 -9
  13. package/docs/classes/EcKeyPair.html +16 -16
  14. package/docs/classes/FundingTransaction.html +47 -47
  15. package/docs/classes/Generator.html +9 -9
  16. package/docs/classes/InteractionTransaction.html +68 -68
  17. package/docs/classes/TapscriptVerificator.html +2 -2
  18. package/docs/classes/TransactionBuilder.html +50 -50
  19. package/docs/classes/TransactionFactory.html +2 -2
  20. package/docs/classes/TweakedSigner.html +2 -2
  21. package/docs/classes/UTXOManager.html +3 -3
  22. package/docs/classes/Wallet.html +10 -10
  23. package/docs/classes/wBTC.html +7 -7
  24. package/docs/enums/TransactionType.html +2 -2
  25. package/docs/interfaces/ContractAddressVerificationParams.html +2 -2
  26. package/docs/interfaces/FetchUTXOParams.html +2 -2
  27. package/docs/interfaces/IFundingTransactionParameters.html +2 -2
  28. package/docs/interfaces/IInteractionParameters.html +2 -2
  29. package/docs/interfaces/ITransactionDataContractDeployment.html +2 -2
  30. package/docs/interfaces/ITransactionDataContractInteractionWrap.html +2 -2
  31. package/docs/interfaces/ITransactionParameters.html +2 -2
  32. package/docs/interfaces/IWallet.html +4 -4
  33. package/docs/interfaces/NetworkInformation.html +2 -2
  34. package/docs/interfaces/PsbtInputExtended.html +1 -1
  35. package/docs/interfaces/PsbtOutputExtendedAddress.html +2 -2
  36. package/docs/interfaces/PsbtOutputExtendedScript.html +2 -2
  37. package/docs/interfaces/RawUTXOResponse.html +2 -2
  38. package/docs/interfaces/TapLeafScript.html +2 -2
  39. package/docs/interfaces/TweakSettings.html +3 -3
  40. package/docs/interfaces/UTXO.html +2 -2
  41. package/docs/interfaces/UpdateInput.html +2 -2
  42. package/docs/types/PsbtOutputExtended.html +1 -1
  43. package/docs/variables/version.html +1 -1
  44. package/package.json +4 -4
  45. package/src/_version.ts +1 -1
  46. package/src/bytecode/Compressor.ts +5 -6
  47. package/tsconfig.webpack.json +1 -7
  48. package/webpack.config.js +0 -1
  49. package/browser/metadata/ContractMetadataManager.d.ts +0 -1
  50. package/browser/scripts/Regtest.d.ts +0 -2
  51. package/browser/scripts/test.d.ts +0 -1
  52. package/browser/transaction/TransactionBuilder.d.ts +0 -1
package/browser/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- var e,t,r,n,i={7557:(e,t)=>{function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function o(e,...t){if(!i(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function u(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=t.isBytes=void 0,t.number=r,t.bool=n,t.isBytes=i,t.bytes=o,t.hash=a,t.exists=s,t.output=u;const f={number:r,bool:n,bytes:o,hash:a,exists:s,output:u};t.default=f},7202:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HashMD=t.Maj=t.Chi=void 0;const n=r(7557),i=r(9175);t.Chi=(e,t,r)=>e&t^~e&r,t.Maj=(e,t,r)=>e&t^e&r^t&r;class o extends i.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:r,blockLen:o}=this,a=(e=(0,i.toBytes)(e)).length;for(let n=0;n<a;){const s=Math.min(o-this.pos,a-n);if(s!==o)r.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===o&&(this.process(t,0),this.pos=0);else{const t=(0,i.createView)(e);for(;o<=a-n;n+=o)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.exists)(this),(0,n.output)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:a}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let e=s;e<o;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,f=n?0:4;e.setUint32(t+u,a,n),e.setUint32(t+f,s,n)}(r,o-8,BigInt(8*this.length),a),this.process(r,0);const u=(0,i.createView)(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=f/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)u.setUint32(4*e,l[e],a)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}t.HashMD=o},2318:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.add5L=t.add5H=t.add4H=t.add4L=t.add3H=t.add3L=t.add=t.rotlBL=t.rotlBH=t.rotlSL=t.rotlSH=t.rotr32L=t.rotr32H=t.rotrBL=t.rotrBH=t.rotrSL=t.rotrSH=t.shrSL=t.shrSH=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),n=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:a,l:s}=i(e[o],t);[r[o],n[o]]=[a,s]}return[r,n]}t.fromBig=i,t.split=o;const a=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=a;const s=(e,t,r)=>e>>>r;t.shrSH=s;const u=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=u;const f=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=f;const c=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=c;const l=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=l;const h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;const d=(e,t)=>t;t.rotr32H=d;const p=(e,t)=>e;t.rotr32L=p;const y=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=y;const g=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=g;const b=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=b;const m=(e,t,r)=>e<<r-32|t>>>64-r;function v(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}t.rotlBL=m,t.add=v;const w=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=w;const _=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=_;const E=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=E;const S=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;t.add4H=S;const k=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);t.add5L=k;const A=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;t.add5H=A;const T={fromBig:i,split:o,toBig:a,shrSH:s,shrSL:u,rotrSH:f,rotrSL:c,rotrBH:l,rotrBL:h,rotr32H:d,rotr32L:p,rotlSH:y,rotlSL:g,rotlBH:b,rotlBL:m,add:v,add3L:w,add3H:_,add4L:E,add4H:S,add5H:A,add5L:k};t.default=T},5145:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},9615:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const n=r(7557),i=r(9175);class o extends i.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,n.hash)(e);const r=(0,i.toBytes)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,a=new Uint8Array(o);a.set(r.length>o?e.create().update(r).digest():r);for(let e=0;e<a.length;e++)a[e]^=54;this.iHash.update(a),this.oHash=e.create();for(let e=0;e<a.length;e++)a[e]^=106;this.oHash.update(a),a.fill(0)}update(e){return(0,n.exists)(this),this.iHash.update(e),this}digestInto(e){(0,n.exists)(this),(0,n.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=o,t.hmac=(e,t,r)=>new o(e,t).update(r).digest(),t.hmac.create=(e,t)=>new o(e,t)},3238:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0;const n=r(7202),i=r(9175),o=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),a=new Uint8Array(new Array(16).fill(0).map(((e,t)=>t)));let s=[a],u=[a.map((e=>(9*e+5)%16))];for(let e=0;e<4;e++)for(let t of[s,u])t.push(t[e].map((e=>o[e])));const f=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),c=s.map(((e,t)=>e.map((e=>f[t][e])))),l=u.map(((e,t)=>e.map((e=>f[t][e])))),h=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),d=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function p(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const y=new Uint32Array(16);class g extends n.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:i}=this;return[e,t,r,n,i]}set(e,t,r,n,i){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(e,t){for(let r=0;r<16;r++,t+=4)y[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,a=o,f=0|this.h2,g=f,b=0|this.h3,m=b,v=0|this.h4,w=v;for(let e=0;e<5;e++){const t=4-e,_=h[e],E=d[e],S=s[e],k=u[e],A=c[e],T=l[e];for(let t=0;t<16;t++){const n=(0,i.rotl)(r+p(e,o,f,b)+y[S[t]]+_,A[t])+v|0;r=v,v=b,b=0|(0,i.rotl)(f,10),f=o,o=n}for(let e=0;e<16;e++){const r=(0,i.rotl)(n+p(t,a,g,m)+y[k[e]]+E,T[e])+w|0;n=w,w=m,m=0|(0,i.rotl)(g,10),g=a,a=r}}this.set(this.h1+f+m|0,this.h2+b+w|0,this.h3+v+n|0,this.h4+r+a|0,this.h0+o+g|0)}roundClean(){y.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}t.RIPEMD160=g,t.ripemd160=(0,i.wrapConstructor)((()=>new g))},1549:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha1=void 0;const n=r(7202),i=r(9175),o=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),a=new Uint32Array(80);class s extends n.HashMD{constructor(){super(64,20,8,!1),this.A=0|o[0],this.B=0|o[1],this.C=0|o[2],this.D=0|o[3],this.E=0|o[4]}get(){const{A:e,B:t,C:r,D:n,E:i}=this;return[e,t,r,n,i]}set(e,t,r,n,i){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!1);for(let e=16;e<80;e++)a[e]=(0,i.rotl)(a[e-3]^a[e-8]^a[e-14]^a[e-16],1);let{A:r,B:o,C:s,D:u,E:f}=this;for(let e=0;e<80;e++){let t,c;e<20?(t=(0,n.Chi)(o,s,u),c=1518500249):e<40?(t=o^s^u,c=1859775393):e<60?(t=(0,n.Maj)(o,s,u),c=2400959708):(t=o^s^u,c=3395469782);const l=(0,i.rotl)(r,5)+t+f+c+a[e]|0;f=u,u=s,s=(0,i.rotl)(o,30),o=r,r=l}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,u=u+this.D|0,f=f+this.E|0,this.set(r,o,s,u,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}t.sha1=(0,i.wrapConstructor)((()=>new s))},2623:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r(7202),i=r(9175),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);class u extends n.HashMD{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)s[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=s[e-15],r=s[e-2],n=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;s[e]=o+s[e-7]+n+s[e-16]|0}let{A:r,B:a,C:u,D:f,E:c,F:l,G:h,H:d}=this;for(let e=0;e<64;e++){const t=d+((0,i.rotr)(c,6)^(0,i.rotr)(c,11)^(0,i.rotr)(c,25))+(0,n.Chi)(c,l,h)+o[e]+s[e]|0,p=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+(0,n.Maj)(r,a,u)|0;d=h,h=l,l=c,c=f+t|0,f=u,u=a,a=r,r=t+p|0}r=r+this.A|0,a=a+this.B|0,u=u+this.C|0,f=f+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(r,a,u,f,c,l,h,d)}roundClean(){s.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class f extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,i.wrapConstructor)((()=>new u)),t.sha224=(0,i.wrapConstructor)((()=>new f))},102:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha384=t.sha512_256=t.sha512_224=t.sha512=t.SHA512=void 0;const n=r(7202),i=r(2318),o=r(9175),[a,s]=(()=>i.default.split(["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((e=>BigInt(e)))))(),u=new Uint32Array(80),f=new Uint32Array(80);class c extends n.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:f,Fh:c,Fl:l,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y]}set(e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|f,this.Fh=0|c,this.Fl=0|l,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t),f[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|u[e-15],r=0|f[e-15],n=i.default.rotrSH(t,r,1)^i.default.rotrSH(t,r,8)^i.default.shrSH(t,r,7),o=i.default.rotrSL(t,r,1)^i.default.rotrSL(t,r,8)^i.default.shrSL(t,r,7),a=0|u[e-2],s=0|f[e-2],c=i.default.rotrSH(a,s,19)^i.default.rotrBH(a,s,61)^i.default.shrSH(a,s,6),l=i.default.rotrSL(a,s,19)^i.default.rotrBL(a,s,61)^i.default.shrSL(a,s,6),h=i.default.add4L(o,l,f[e-7],f[e-16]),d=i.default.add4H(h,n,c,u[e-7],u[e-16]);u[e]=0|d,f[e]=0|h}let{Ah:r,Al:n,Bh:o,Bl:c,Ch:l,Cl:h,Dh:d,Dl:p,Eh:y,El:g,Fh:b,Fl:m,Gh:v,Gl:w,Hh:_,Hl:E}=this;for(let e=0;e<80;e++){const t=i.default.rotrSH(y,g,14)^i.default.rotrSH(y,g,18)^i.default.rotrBH(y,g,41),S=i.default.rotrSL(y,g,14)^i.default.rotrSL(y,g,18)^i.default.rotrBL(y,g,41),k=y&b^~y&v,A=g&m^~g&w,T=i.default.add5L(E,S,A,s[e],f[e]),P=i.default.add5H(T,_,t,k,a[e],u[e]),O=0|T,I=i.default.rotrSH(r,n,28)^i.default.rotrBH(r,n,34)^i.default.rotrBH(r,n,39),x=i.default.rotrSL(r,n,28)^i.default.rotrBL(r,n,34)^i.default.rotrBL(r,n,39),N=r&o^r&l^o&l,M=n&c^n&h^c&h;_=0|v,E=0|w,v=0|b,w=0|m,b=0|y,m=0|g,({h:y,l:g}=i.default.add(0|d,0|p,0|P,0|O)),d=0|l,p=0|h,l=0|o,h=0|c,o=0|r,c=0|n;const R=i.default.add3L(O,x,M);r=i.default.add3H(R,P,I,N),n=0|R}({h:r,l:n}=i.default.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:c}=i.default.add(0|this.Bh,0|this.Bl,0|o,0|c)),({h:l,l:h}=i.default.add(0|this.Ch,0|this.Cl,0|l,0|h)),({h:d,l:p}=i.default.add(0|this.Dh,0|this.Dl,0|d,0|p)),({h:y,l:g}=i.default.add(0|this.Eh,0|this.El,0|y,0|g)),({h:b,l:m}=i.default.add(0|this.Fh,0|this.Fl,0|b,0|m)),({h:v,l:w}=i.default.add(0|this.Gh,0|this.Gl,0|v,0|w)),({h:_,l:E}=i.default.add(0|this.Hh,0|this.Hl,0|_,0|E)),this.set(r,n,o,c,l,h,d,p,y,g,b,m,v,w,_,E)}roundClean(){u.fill(0),f.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=c;class l extends c{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class h extends c{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class d extends c{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}t.sha512=(0,o.wrapConstructor)((()=>new c)),t.sha512_224=(0,o.wrapConstructor)((()=>new l)),t.sha512_256=(0,o.wrapConstructor)((()=>new h)),t.sha384=(0,o.wrapConstructor)((()=>new d))},9175:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.byteSwap32=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=t.isBytes=void 0;const n=r(5145),i=r(7557);t.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.rotl=(e,t)=>e<<t|e>>>32-t>>>0,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,t.byteSwapIfBE=t.isLE?e=>e:e=>(0,t.byteSwap)(e),t.byteSwap32=function(e){for(let r=0;r<e.length;r++)e[r]=(0,t.byteSwap)(e[r])};const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){(0,i.bytes)(e);let t="";for(let r=0;r<e.length;r++)t+=o[e[r]];return t};const a=48,s=57,u=65,f=70,c=97,l=102;function h(e){return e>=a&&e<=s?e-a:e>=u&&e<=f?e-(u-10):e>=c&&e<=l?e-(c-10):void 0}function d(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function p(e){return"string"==typeof e&&(e=d(e)),(0,i.bytes)(e),e}t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=h(e.charCodeAt(i)),o=h(e.charCodeAt(i+1));if(void 0===r||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+o}return n},t.nextTick=async()=>{},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-i;e>=0&&e<r||(await(0,t.nextTick)(),i+=e)}},t.utf8ToBytes=d,t.toBytes=p,t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];(0,i.bytes)(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r},t.Hash=class{clone(){return this._cloneInto()}};const y={}.toString;t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==y.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(p(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(p(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(p(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},3203:(e,t)=>{function r(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function n(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function i(...e){const t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map((e=>e.encode)).reduceRight(r,t),decode:e.map((e=>e.decode)).reduce(r,t)}}function o(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(r(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function a(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function s(e,t="="){if(r(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function u(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function f(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let i=0;const o=[],a=Array.from(e);for(a.forEach((e=>{if(r(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,r=!0;for(let o=i;o<a.length;o++){const s=a[o],u=t*e+s;if(!Number.isSafeInteger(u)||t*e/t!==e||u-s!=t*e)throw new Error("convertRadix: carry overflow");e=u%n;const f=Math.floor(u/n);if(a[o]=f,!Number.isSafeInteger(f)||f*n+e!==u)throw new Error("convertRadix: carry overflow");r&&(f?r=!1:i=o)}if(o.push(e),r)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}Object.defineProperty(t,"__esModule",{value:!0}),t.bytes=t.stringToBytes=t.str=t.bytesToString=t.hex=t.utf8=t.bech32m=t.bech32=t.base58check=t.createBase58check=t.base58xmr=t.base58xrp=t.base58flickr=t.base58=t.base64urlnopad=t.base64url=t.base64nopad=t.base64=t.base32crockford=t.base32hex=t.base32=t.base16=t.utils=t.assertNumber=void 0,t.assertNumber=r;const c=(e,t)=>t?c(t,e%t):e,l=(e,t)=>e+(t-c(e,t));function h(e,t,n,i){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(l(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${l(t,n)}`);let o=0,a=0;const s=2**n-1,u=[];for(const i of e){if(r(i),i>=2**t)throw new Error(`convertRadix2: invalid data word=${i} from=${t}`);if(o=o<<t|i,a+t>32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=n;a-=n)u.push((o>>a-n&s)>>>0);o&=2**a-1}if(o=o<<n-a&s,!i&&a>=t)throw new Error("Excess padding");if(!i&&o)throw new Error(`Non-zero padding: ${o}`);return i&&a>0&&u.push(o>>>0),u}function d(e){return r(e),{encode:t=>{if(!n(t))throw new Error("radix.encode input should be Uint8Array");return f(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(f(t,e,256))}}}function p(e,t=!1){if(r(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(l(8,e)>32||l(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!n(r))throw new Error("radix2.encode input should be Uint8Array");return h(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(h(r,e,8,t))}}}function y(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function g(e,t){if(r(e),"function"!=typeof t)throw new Error("checksum fn should be function");return{encode(r){if(!n(r))throw new Error("checksum.encode: input should be Uint8Array");const i=t(r).slice(0,e),o=new Uint8Array(r.length+e);return o.set(r),o.set(i,r.length),o},decode(r){if(!n(r))throw new Error("checksum.decode: input should be Uint8Array");const i=r.slice(0,-e),o=t(i).slice(0,e),a=r.slice(-e);for(let t=0;t<e;t++)if(o[t]!==a[t])throw new Error("Invalid checksum");return i}}}t.utils={alphabet:o,chain:i,checksum:g,convertRadix:f,convertRadix2:h,radix:d,radix2:p,join:a,padding:s},t.base16=i(p(4),o("0123456789ABCDEF"),a("")),t.base32=i(p(5),o("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),s(5),a("")),t.base32hex=i(p(5),o("0123456789ABCDEFGHIJKLMNOPQRSTUV"),s(5),a("")),t.base32crockford=i(p(5),o("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),a(""),u((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),t.base64=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s(6),a("")),t.base64nopad=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),a("")),t.base64url=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(6),a("")),t.base64urlnopad=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),a(""));const b=e=>i(d(58),o(e),a(""));t.base58=b("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),t.base58flickr=b("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),t.base58xrp=b("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const m=[0,2,3,5,6,7,9,10,11];t.base58xmr={encode(e){let r="";for(let n=0;n<e.length;n+=8){const i=e.subarray(n,n+8);r+=t.base58.encode(i).padStart(m[i.length],"1")}return r},decode(e){let r=[];for(let n=0;n<e.length;n+=11){const i=e.slice(n,n+11),o=m.indexOf(i.length),a=t.base58.decode(i);for(let e=0;e<a.length-o;e++)if(0!==a[e])throw new Error("base58xmr: wrong padding");r=r.concat(Array.from(a.slice(a.length-o)))}return Uint8Array.from(r)}},t.createBase58check=e=>i(g(4,(t=>e(e(t)))),t.base58),t.base58check=t.createBase58check;const v=i(o("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),a("")),w=[996825010,642813549,513874426,1027748829,705979059];function _(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e<w.length;e++)1==(t>>e&1)&&(r^=w[e]);return r}function E(e,t,r=1){const n=e.length;let i=1;for(let t=0;t<n;t++){const r=e.charCodeAt(t);if(r<33||r>126)throw new Error(`Invalid prefix (${e})`);i=_(i)^r>>5}i=_(i);for(let t=0;t<n;t++)i=_(i)^31&e.charCodeAt(t);for(let e of t)i=_(i)^e;for(let e=0;e<6;e++)i=_(i);return i^=r,v.encode(h([i%2**30],30,5,!1))}function S(e){const t="bech32"===e?1:734539939,r=p(5),n=r.decode,i=r.encode,o=y(n);function a(e,r=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==r&&e.length>r)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=n.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=n.slice(0,i),a=n.slice(i+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=v.decode(a).slice(0,-6),u=E(o,s,t);if(!a.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected "${u}"`);return{prefix:o,words:s}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);if(0===e.length)throw new TypeError(`Invalid prefix length ${e.length}`);const i=e.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=e.toLowerCase(),a=E(o,r,t);return`${o}1${v.encode(r)}${a}`},decode:a,decodeToBytes:function(e){const{prefix:t,words:r}=a(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:y(a),fromWords:n,fromWordsUnsafe:o,toWords:i}}t.bech32=S("bech32"),t.bech32m=S("bech32m"),t.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},t.hex=i(p(4),o("0123456789abcdef"),a(""),u((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const k={utf8:t.utf8,hex:t.hex,base16:t.base16,base32:t.base32,base64:t.base64,base64url:t.base64url,base58:t.base58,base58xmr:t.base58xmr},A="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";t.bytesToString=(e,t)=>{if("string"!=typeof e||!k.hasOwnProperty(e))throw new TypeError(A);if(!n(t))throw new TypeError("bytesToString() expects Uint8Array");return k[e].encode(t)},t.str=t.bytesToString,t.stringToBytes=(e,t)=>{if(!k.hasOwnProperty(e))throw new TypeError(A);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return k[e].decode(t)},t.bytes=t.stringToBytes},4148:(e,t,r)=>{var n=r(3184);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key),"symbol"===i(o)?o:String(o)),n)}var o}function a(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}var s,u,f=r(9597).codes,c=f.ERR_AMBIGUOUS_ARGUMENT,l=f.ERR_INVALID_ARG_TYPE,h=f.ERR_INVALID_ARG_VALUE,d=f.ERR_INVALID_RETURN_VALUE,p=f.ERR_MISSING_ARGS,y=r(3918),g=r(537).inspect,b=r(537).types,m=b.isPromise,v=b.isRegExp,w=r(1514)(),_=r(9394)(),E=r(8075)("RegExp.prototype.test");function S(){var e=r(2299);s=e.isDeepEqual,u=e.isDeepStrictEqual}new Map;var k=!1,A=e.exports=I,T={};function P(e){if(e.message instanceof Error)throw e.message;throw new y(e)}function O(e,t,r,n){if(!r){var i=!1;if(0===t)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new y({actual:r,expected:!0,message:n,operator:"==",stackStartFn:e});throw o.generatedMessage=i,o}}function I(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];O.apply(void 0,[I,t.length].concat(t))}A.fail=function e(t,r,i,o,a){var s,u=arguments.length;if(0===u?s="Failed":1===u?(i=t,t=void 0):(!1===k&&(k=!0,(n.emitWarning?n.emitWarning:console.warn.bind(console))("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")),2===u&&(o="!=")),i instanceof Error)throw i;var f={actual:t,expected:r,operator:void 0===o?"fail":o,stackStartFn:a||e};void 0!==i&&(f.message=i);var c=new y(f);throw s&&(c.message=s,c.generatedMessage=!0),c},A.AssertionError=y,A.ok=I,A.equal=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");t!=r&&P({actual:t,expected:r,message:n,operator:"==",stackStartFn:e})},A.notEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");t==r&&P({actual:t,expected:r,message:n,operator:"!=",stackStartFn:e})},A.deepEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===s&&S(),s(t,r)||P({actual:t,expected:r,message:n,operator:"deepEqual",stackStartFn:e})},A.notDeepEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===s&&S(),s(t,r)&&P({actual:t,expected:r,message:n,operator:"notDeepEqual",stackStartFn:e})},A.deepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===s&&S(),u(t,r)||P({actual:t,expected:r,message:n,operator:"deepStrictEqual",stackStartFn:e})},A.notDeepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");void 0===s&&S(),u(t,r)&&P({actual:t,expected:r,message:n,operator:"notDeepStrictEqual",stackStartFn:e})},A.strictEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");_(t,r)||P({actual:t,expected:r,message:n,operator:"strictEqual",stackStartFn:e})},A.notStrictEqual=function e(t,r,n){if(arguments.length<2)throw new p("actual","expected");_(t,r)&&P({actual:t,expected:r,message:n,operator:"notStrictEqual",stackStartFn:e})};var x=a((function e(t,r,n){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r.forEach((function(e){e in t&&(void 0!==n&&"string"==typeof n[e]&&v(t[e])&&E(t[e],n[e])?i[e]=n[e]:i[e]=t[e])}))}));function N(e,t,r,n){if("function"!=typeof t){if(v(t))return E(t,e);if(2===arguments.length)throw new l("expected",["Function","RegExp"],t);if("object"!==i(e)||null===e){var o=new y({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:n});throw o.operator=n.name,o}var a=Object.keys(t);if(t instanceof Error)a.push("name","message");else if(0===a.length)throw new h("error",t,"may not be an empty object");return void 0===s&&S(),a.forEach((function(i){"string"==typeof e[i]&&v(t[i])&&E(t[i],e[i])||function(e,t,r,n,i,o){if(!(r in e)||!u(e[r],t[r])){if(!n){var a=new x(e,i),s=new x(t,i,e),f=new y({actual:a,expected:s,operator:"deepStrictEqual",stackStartFn:o});throw f.actual=e,f.expected=t,f.operator=o.name,f}P({actual:e,expected:t,message:n,operator:o.name,stackStartFn:o})}}(e,t,i,r,a,n)})),!0}return void 0!==t.prototype&&e instanceof t||!Error.isPrototypeOf(t)&&!0===t.call({},e)}function M(e){if("function"!=typeof e)throw new l("fn","Function",e);try{e()}catch(e){return e}return T}function R(e){return m(e)||null!==e&&"object"===i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function B(e){return Promise.resolve().then((function(){var t;if("function"==typeof e){if(!R(t=e()))throw new d("instance of Promise","promiseFn",t)}else{if(!R(e))throw new l("promiseFn",["Function","Promise"],e);t=e}return Promise.resolve().then((function(){return t})).then((function(){return T})).catch((function(e){return e}))}))}function L(e,t,r,n){if("string"==typeof r){if(4===arguments.length)throw new l("error",["Object","Error","Function","RegExp"],r);if("object"===i(t)&&null!==t){if(t.message===r)throw new c("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new c("error/message",'The error "'.concat(t,'" is identical to the message.'));n=r,r=void 0}else if(null!=r&&"object"!==i(r)&&"function"!=typeof r)throw new l("error",["Object","Error","Function","RegExp"],r);if(t===T){var o="";r&&r.name&&(o+=" (".concat(r.name,")")),o+=n?": ".concat(n):".";var a="rejects"===e.name?"rejection":"exception";P({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(a).concat(o),stackStartFn:e})}if(r&&!N(t,r,n,e))throw t}function C(e,t,r,n){if(t!==T){if("string"==typeof r&&(n=r,r=void 0),!r||N(t,r)){var i=n?": ".concat(n):".",o="doesNotReject"===e.name?"rejection":"exception";P({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(o).concat(i,"\n")+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}function U(e,t,r,n,o){if(!v(t))throw new l("regexp","RegExp",t);var a="match"===o;if("string"!=typeof e||E(t,e)!==a){if(r instanceof Error)throw r;var s=!r;r=r||("string"!=typeof e?'The "string" argument must be of type string. Received type '+"".concat(i(e)," (").concat(g(e),")"):(a?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(g(t),". Input:\n\n").concat(g(e),"\n"));var u=new y({actual:e,expected:t,message:r,operator:o,stackStartFn:n});throw u.generatedMessage=s,u}}function j(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];O.apply(void 0,[j,t.length].concat(t))}A.throws=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];L.apply(void 0,[e,M(t)].concat(n))},A.rejects=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return B(t).then((function(t){return L.apply(void 0,[e,t].concat(n))}))},A.doesNotThrow=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];C.apply(void 0,[e,M(t)].concat(n))},A.doesNotReject=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return B(t).then((function(t){return C.apply(void 0,[e,t].concat(n))}))},A.ifError=function e(t){if(null!=t){var r="ifError got unwanted exception: ";"object"===i(t)&&"string"==typeof t.message?0===t.message.length&&t.constructor?r+=t.constructor.name:r+=t.message:r+=g(t);var n=new y({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),o=t.stack;if("string"==typeof o){var a=o.split("\n");a.shift();for(var s=n.stack.split("\n"),u=0;u<a.length;u++){var f=s.indexOf(a[u]);if(-1!==f){s=s.slice(0,f);break}}n.stack="".concat(s.join("\n"),"\n").concat(a.join("\n"))}throw n}},A.match=function e(t,r,n){U(t,r,n,e,"match")},A.doesNotMatch=function e(t,r,n){U(t,r,n,e,"doesNotMatch")},A.strict=w(j,A,{equal:A.strictEqual,deepEqual:A.deepStrictEqual,notEqual:A.notStrictEqual,notDeepEqual:A.notDeepStrictEqual}),A.strict.strict=A.strict},3918:(e,t,r)=>{var n=r(3184);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){var n,i,o;n=e,i=t,o=r[t],(i=s(i))in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!==y(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===y(t)?t:String(t)}function u(e,t){if(t&&("object"===y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return l(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)},c(e)}function l(e,t,r){return l=h()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&d(i,r.prototype),i},l.apply(null,arguments)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}var g=r(537).inspect,b=r(9597).codes.ERR_INVALID_ARG_TYPE;function m(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}var v="",w="",_="",E="",S={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function k(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){r[t]=e[t]})),Object.defineProperty(r,"message",{value:e.message}),r}function A(e){return g(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var T=function(e,t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(T,e);var r,i,s,c,l=(r=T,i=h(),function(){var e,t=p(r);if(i){var n=p(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return u(this,e)});function T(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,T),"object"!==y(e)||null===e)throw new b("options","Object",e);var r=e.message,i=e.operator,o=e.stackStartFn,a=e.actual,s=e.expected,c=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=r)t=l.call(this,String(r));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(v="",w="",E="",_=""):(v="",w="",E="",_="")),"object"===y(a)&&null!==a&&"object"===y(s)&&null!==s&&"stack"in a&&a instanceof Error&&"stack"in s&&s instanceof Error&&(a=k(a),s=k(s)),"deepStrictEqual"===i||"strictEqual"===i)t=l.call(this,function(e,t,r){var i="",o="",a=0,s="",u=!1,f=A(e),c=f.split("\n"),l=A(t).split("\n"),h=0,d="";if("strictEqual"===r&&"object"===y(e)&&"object"===y(t)&&null!==e&&null!==t&&(r="strictEqualObject"),1===c.length&&1===l.length&&c[0]!==l[0]){var p=c[0].length+l[0].length;if(p<=10){if(!("object"===y(e)&&null!==e||"object"===y(t)&&null!==t||0===e&&0===t))return"".concat(S[r],"\n\n")+"".concat(c[0]," !== ").concat(l[0],"\n")}else if("strictEqualObject"!==r&&p<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;c[0][h]===l[0][h];)h++;h>2&&(d="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,r-e.length)}(" ",h),"^"),h=0)}}for(var g=c[c.length-1],b=l[l.length-1];g===b&&(h++<2?s="\n ".concat(g).concat(s):i=g,c.pop(),l.pop(),0!==c.length&&0!==l.length);)g=c[c.length-1],b=l[l.length-1];var k=Math.max(c.length,l.length);if(0===k){var T=f.split("\n");if(T.length>30)for(T[26]="".concat(v,"...").concat(E);T.length>27;)T.pop();return"".concat(S.notIdentical,"\n\n").concat(T.join("\n"),"\n")}h>3&&(s="\n".concat(v,"...").concat(E).concat(s),u=!0),""!==i&&(s="\n ".concat(i).concat(s),i="");var P=0,O=S[r]+"\n".concat(w,"+ actual").concat(E," ").concat(_,"- expected").concat(E),I=" ".concat(v,"...").concat(E," Lines skipped");for(h=0;h<k;h++){var x=h-a;if(c.length<h+1)x>1&&h>2&&(x>4?(o+="\n".concat(v,"...").concat(E),u=!0):x>3&&(o+="\n ".concat(l[h-2]),P++),o+="\n ".concat(l[h-1]),P++),a=h,i+="\n".concat(_,"-").concat(E," ").concat(l[h]),P++;else if(l.length<h+1)x>1&&h>2&&(x>4?(o+="\n".concat(v,"...").concat(E),u=!0):x>3&&(o+="\n ".concat(c[h-2]),P++),o+="\n ".concat(c[h-1]),P++),a=h,o+="\n".concat(w,"+").concat(E," ").concat(c[h]),P++;else{var N=l[h],M=c[h],R=M!==N&&(!m(M,",")||M.slice(0,-1)!==N);R&&m(N,",")&&N.slice(0,-1)===M&&(R=!1,M+=","),R?(x>1&&h>2&&(x>4?(o+="\n".concat(v,"...").concat(E),u=!0):x>3&&(o+="\n ".concat(c[h-2]),P++),o+="\n ".concat(c[h-1]),P++),a=h,o+="\n".concat(w,"+").concat(E," ").concat(M),i+="\n".concat(_,"-").concat(E," ").concat(N),P+=2):(o+=i,i="",1!==x&&0!==h||(o+="\n ".concat(M),P++))}if(P>20&&h<k-2)return"".concat(O).concat(I,"\n").concat(o,"\n").concat(v,"...").concat(E).concat(i,"\n")+"".concat(v,"...").concat(E)}return"".concat(O).concat(u?I:"","\n").concat(o).concat(i).concat(s).concat(d)}(a,s,i));else if("notDeepStrictEqual"===i||"notStrictEqual"===i){var h=S[i],d=A(a).split("\n");if("notStrictEqual"===i&&"object"===y(a)&&null!==a&&(h=S.notStrictEqualObject),d.length>30)for(d[26]="".concat(v,"...").concat(E);d.length>27;)d.pop();t=1===d.length?l.call(this,"".concat(h," ").concat(d[0])):l.call(this,"".concat(h,"\n\n").concat(d.join("\n"),"\n"))}else{var p=A(a),g="",P=S[i];"notDeepEqual"===i||"notEqual"===i?(p="".concat(S[i],"\n\n").concat(p)).length>1024&&(p="".concat(p.slice(0,1021),"...")):(g="".concat(A(s)),p.length>512&&(p="".concat(p.slice(0,509),"...")),g.length>512&&(g="".concat(g.slice(0,509),"...")),"deepEqual"===i||"equal"===i?p="".concat(P,"\n\n").concat(p,"\n\nshould equal\n\n"):g=" ".concat(i," ").concat(g)),t=l.call(this,"".concat(p).concat(g))}return Error.stackTraceLimit=c,t.generatedMessage=!r,Object.defineProperty(f(t),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),t.code="ERR_ASSERTION",t.actual=a,t.expected=s,t.operator=i,Error.captureStackTrace&&Error.captureStackTrace(f(t),o),t.stack,t.name="AssertionError",u(t)}return s=T,(c=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(e,t){return g(this,o(o({},t),{},{customInspect:!1,depth:0}))}}])&&a(s.prototype,c),Object.defineProperty(s,"prototype",{writable:!1}),T}(c(Error),g.custom);e.exports=T},9597:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var a,s,u={};function f(e,t,r){r||(r=Error);var a=function(r){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}(c,r);var a,s,u,f=(s=c,u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=o(s);if(u){var r=o(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function c(r,n,i){var o;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,c),o=f.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i)),o.code=e,o}return a=c,Object.defineProperty(a,"prototype",{writable:!1}),a}(r);u[e]=a}function c(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}f("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),f("ERR_INVALID_ARG_TYPE",(function(e,t,i){var o,s,u,f,l;if(void 0===a&&(a=r(4148)),a("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(s="not ",t.substr(0,4)===s)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))u="The ".concat(e," ").concat(o," ").concat(c(t,"type"));else{var h=("number"!=typeof l&&(l=0),l+1>(f=e).length||-1===f.indexOf(".",l)?"argument":"property");u='The "'.concat(e,'" ').concat(h," ").concat(o," ").concat(c(t,"type"))}return u+". Received type ".concat(n(i))}),TypeError),f("ERR_INVALID_ARG_VALUE",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===s&&(s=r(537));var i=s.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),f("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")}),TypeError),f("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];void 0===a&&(a=r(4148)),a(t.length>0,"At least one arg needs to be specified");var i="The ",o=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),o){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,o-1).join(", "),i+=", and ".concat(t[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),e.exports.codes=u},2299:(e,t,r)=>{function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,f=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){f=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(f)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}var a=void 0!==/a/g.flags,s=function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t},u=function(e){var t=[];return e.forEach((function(e,r){return t.push([r,e])})),t},f=Object.is?Object.is:r(7653),c=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},l=Number.isNaN?Number.isNaN:r(4133);function h(e){return e.call.bind(e)}var d=h(Object.prototype.hasOwnProperty),p=h(Object.prototype.propertyIsEnumerable),y=h(Object.prototype.toString),g=r(537).types,b=g.isAnyArrayBuffer,m=g.isArrayBufferView,v=g.isDate,w=g.isMap,_=g.isRegExp,E=g.isSet,S=g.isNativeError,k=g.isBoxedPrimitive,A=g.isNumberObject,T=g.isStringObject,P=g.isBooleanObject,O=g.isBigIntObject,I=g.isSymbolObject,x=g.isFloat32Array,N=g.isFloat64Array;function M(e){if(0===e.length||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function R(e){return Object.keys(e).filter(M).concat(c(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function B(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}var L=0,C=1,U=2,j=3;function D(e,t,r,n){if(e===t)return 0!==e||!r||f(e,t);if(r){if("object"!==o(e))return"number"==typeof e&&l(e)&&l(t);if("object"!==o(t)||null===e||null===t)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(null===e||"object"!==o(e))return(null===t||"object"!==o(t))&&e==t;if(null===t||"object"!==o(t))return!1}var i,s,u,c,h=y(e);if(h!==y(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var d=R(e),p=R(t);return d.length===p.length&&H(e,t,r,n,C,d)}if("[object Object]"===h&&(!w(e)&&w(t)||!E(e)&&E(t)))return!1;if(v(e)){if(!v(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(_(e)){if(!_(t)||(u=e,c=t,!(a?u.source===c.source&&u.flags===c.flags:RegExp.prototype.toString.call(u)===RegExp.prototype.toString.call(c))))return!1}else if(S(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else{if(m(e)){if(r||!x(e)&&!N(e)){if(!function(e,t){return e.byteLength===t.byteLength&&0===B(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}(e,t))return!1}else if(!function(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(e,t))return!1;var g=R(e),M=R(t);return g.length===M.length&&H(e,t,r,n,L,g)}if(E(e))return!(!E(t)||e.size!==t.size)&&H(e,t,r,n,U);if(w(e))return!(!w(t)||e.size!==t.size)&&H(e,t,r,n,j);if(b(e)){if(s=t,(i=e).byteLength!==s.byteLength||0!==B(new Uint8Array(i),new Uint8Array(s)))return!1}else if(k(e)&&!function(e,t){return A(e)?A(t)&&f(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):T(e)?T(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):P(e)?P(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):O(e)?O(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):I(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}(e,t))return!1}return H(e,t,r,n,L)}function F(e,t){return t.filter((function(t){return p(e,t)}))}function H(e,t,r,i,a,f){if(5===arguments.length){f=Object.keys(e);var l=Object.keys(t);if(f.length!==l.length)return!1}for(var h=0;h<f.length;h++)if(!d(t,f[h]))return!1;if(r&&5===arguments.length){var y=c(e);if(0!==y.length){var g=0;for(h=0;h<y.length;h++){var b=y[h];if(p(e,b)){if(!p(t,b))return!1;f.push(b),g++}else if(p(t,b))return!1}var m=c(t);if(y.length!==m.length&&F(t,m).length!==g)return!1}else{var v=c(t);if(0!==v.length&&0!==F(t,v).length)return!1}}if(0===f.length&&(a===L||a===C&&0===e.length||0===e.size))return!0;if(void 0===i)i={val1:new Map,val2:new Map,position:0};else{var w=i.val1.get(e);if(void 0!==w){var _=i.val2.get(t);if(void 0!==_)return w===_}i.position++}i.val1.set(e,i.position),i.val2.set(t,i.position);var E=function(e,t,r,i,a,f){var c=0;if(f===U){if(!function(e,t,r,n){for(var i=null,a=s(e),u=0;u<a.length;u++){var f=a[u];if("object"===o(f)&&null!==f)null===i&&(i=new Set),i.add(f);else if(!t.has(f)){if(r)return!1;if(!W(e,t,f))return!1;null===i&&(i=new Set),i.add(f)}}if(null!==i){for(var c=s(t),l=0;l<c.length;l++){var h=c[l];if("object"===o(h)&&null!==h){if(!K(i,h,r,n))return!1}else if(!r&&!e.has(h)&&!K(i,h,r,n))return!1}return 0===i.size}return!0}(e,t,r,a))return!1}else if(f===j){if(!function(e,t,r,i){for(var a=null,s=u(e),f=0;f<s.length;f++){var c=n(s[f],2),l=c[0],h=c[1];if("object"===o(l)&&null!==l)null===a&&(a=new Set),a.add(l);else{var d=t.get(l);if(void 0===d&&!t.has(l)||!D(h,d,r,i)){if(r)return!1;if(!V(e,t,l,h,i))return!1;null===a&&(a=new Set),a.add(l)}}}if(null!==a){for(var p=u(t),y=0;y<p.length;y++){var g=n(p[y],2),b=g[0],m=g[1];if("object"===o(b)&&null!==b){if(!z(a,e,b,m,r,i))return!1}else if(!(r||e.has(b)&&D(e.get(b),m,!1,i)||z(a,e,b,m,!1,i)))return!1}return 0===a.size}return!0}(e,t,r,a))return!1}else if(f===C)for(;c<e.length;c++){if(!d(e,c)){if(d(t,c))return!1;for(var l=Object.keys(e);c<l.length;c++){var h=l[c];if(!d(t,h)||!D(e[h],t[h],r,a))return!1}return l.length===Object.keys(t).length}if(!d(t,c)||!D(e[c],t[c],r,a))return!1}for(c=0;c<i.length;c++){var p=i[c];if(!D(e[p],t[p],r,a))return!1}return!0}(e,t,r,f,i,a);return i.val1.delete(e),i.val2.delete(t),E}function K(e,t,r,n){for(var i=s(e),o=0;o<i.length;o++){var a=i[o];if(D(t,a,r,n))return e.delete(a),!0}return!1}function G(e){switch(o(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(l(e))return!1}return!0}function W(e,t,r){var n=G(r);return null!=n?n:t.has(n)&&!e.has(n)}function V(e,t,r,n,i){var o=G(r);if(null!=o)return o;var a=t.get(o);return!(void 0===a&&!t.has(o)||!D(n,a,!1,i))&&!e.has(o)&&D(n,a,!1,i)}function z(e,t,r,n,i,o){for(var a=s(e),u=0;u<a.length;u++){var f=a[u];if(D(r,f,i,o)&&D(n,t.get(f),i,o))return e.delete(f),!0}return!1}e.exports={isDeepEqual:function(e,t){return D(e,t,!1)},isDeepStrictEqual:function(e,t){return D(e,t,!0)}}},4822:(e,t,r)=>{r.d(t,{r:()=>n});var n="1.0.4"},5104:(e,t,r)=>{r.d(t,{w:()=>l});var n=r(8559),i=r.n(n);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var u,f,c,l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,r=[{key:"compress",value:function(t){return i().gzipSync(t,e.zlibOptions)}},{key:"decompress",value:function(t){return i().gunzipSync(t,e.zlibOptions)}}],null&&a(t.prototype,null),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();u=l,f="zlibOptions",c={level:i().constants.Z_MAX_LEVEL,maxOutputLength:16777216},(f=s(f))in u?Object.defineProperty(u,f,{value:c,enumerable:!0,configurable:!0,writable:!0}):u[f]=c},3539:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{i:()=>f});var i=r(9004),o=r(2343),a=r(1757),s=r(6647),u=e([s]);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=p(e,"string");return"symbol"==c(t)?t:t+""}function p(e,t){if("object"!=c(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}s=(u.then?(await u)():u)[0],(0,a.f0)(s);var f=function(){return e=function e(){l(this,e)},t=[{key:"generatePKSH",value:function(e,t){if(32!==e.length)throw new Error("Invalid hash length");var r=this.ripemd160(e);return this.toSegwitAddress(r,t)}},{key:"ripemd160",value:function(e){return(0,i.n1)("ripemd160").update(e).digest()}},{key:"toSegwitAddress",value:function(e,t){var r=o.bech32.toWords(e);return r.unshift(0),o.bech32.encode(t.bech32,r)}}],null&&h(e.prototype,null),t&&h(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(y){n(y)}}))},5901:(e,t,r)=>{r.d(t,{W:()=>f});var n=r(1757),i=r(8287).Buffer;function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function s(e,t,r){return(t=u(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var f=function(){function e(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"senderPubKey",void 0),s(this,"contractSaltPubKey",void 0),s(this,"network",n.o8.bitcoin),this.senderPubKey=t,this.contractSaltPubKey=r,this.network=i}return t=e,r=[{key:"splitBufferIntoChunks",value:function(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DATA_CHUNK_SIZE,n=[],o=0;o<t.length;o+=r){for(var a=Math.min(r,t.length-o),s=i.alloc(a),u=0;u<a;u++)s.writeUInt8(t[o+u],u);n.push([s])}return n}}],r&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();s(f,"DATA_CHUNK_SIZE",512),s(f,"MAGIC",i.from("bsi","utf-8"))},9068:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{G:()=>c});var i=r(1757),o=r(5104),a=r(5901),s=r(154),u=r(8287).Buffer,f=e([s]);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function h(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function d(e){return b(e)||g(e)||y(e)||p()}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function g(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e){if(Array.isArray(e))return m(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_(n.key),n)}}function _(e){var t=E(e,"string");return"symbol"==l(t)?t:t+""}function E(e,t){if("object"!=l(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function S(e,t){if(t&&("object"==l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(A=function(){return!!e})()}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function P(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}s=(f.then?(await f)():f)[0];var c=function(e){function t(e,r){var n,o,a,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.o8.bitcoin;return v(this,t),n=this,a=[e,r,s],o=T(o=t),S(n,A()?Reflect.construct(o,a||[],T(n).constructor):o.apply(n,a))}return P(t,e),r=t,n=[{key:"compile",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=this.splitBufferIntoChunks(e);if(!s.length)throw new Error("No data chunks found");var f=[this.senderPubKey,i.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,i.Ez.OP_CHECKSIGVERIFY,i.Ez.OP_HASH160,i.Et.hash160(this.senderPubKey),i.Ez.OP_EQUALVERIFY,i.Ez.OP_HASH160,i.Et.hash160(t),i.Ez.OP_EQUALVERIFY,i.Ez.OP_DEPTH,i.Ez.OP_1,i.Ez.OP_NUMEQUAL,i.Ez.OP_IF,a.W.MAGIC];if(n.length>0){var c,l,h=this.getPubKeyAsBuffer(n),p=this.splitBufferIntoChunks(h);if(f=(c=f).concat.apply(c,[i.Ez.OP_0].concat(d(p))),!o)throw new Error("Minimum signatures must be provided");if(o>255)throw new Error("Minimum signatures cannot exceed 255");var y=u.alloc(2);y.writeUint16LE(o,0),f=(l=f).concat.apply(l,[i.Ez.OP_1,y])}var g=(f=(r=f).concat.apply(r,[i.Ez.OP_1NEGATE].concat(d(s),[i.Ez.OP_ELSE,i.Ez.OP_1,i.Ez.OP_ENDIF]))).flat(),b=i.K$.compile(g);if(!i.K$.decompile(b))throw new Error("Failed to decompile script??");return b}},{key:"getPubKeyAsBuffer",value:function(e){var t,r=u.alloc(0),n=h(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(!s.k.fromPublicKey(i,this.network).compressed)throw new Error("Public key must be compressed");if(33!==i.byteLength)throw new Error("Public key must be 33 bytes, got ".concat(i.byteLength," bytes."));r=u.concat([r,i])}}catch(e){n.e(e)}finally{n.f()}var a=o.w.compress(r);return a.byteLength>=r.byteLength?r:a}}],n&&w(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(a.W);n()}catch(I){n(I)}}))},7061:(e,t,r)=>{r.d(t,{z:()=>d});var n=r(1757),i=r(5901);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function u(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}function f(e,t,r){return t=l(t),function(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(c=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}var d=function(e){function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),f(this,t,[e,r,i])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),r=t,(o=[{key:"compile",value:function(e,t){var r=this.getAsm(e,t),i=n.K$.compile(r);if(!n.K$.decompile(i))throw new Error("Failed to decompile script??");return i}},{key:"getAsm",value:function(e,t){var r=this.splitBufferIntoChunks(e);return[this.senderPubKey,n.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,n.Ez.OP_CHECKSIGVERIFY,n.Ez.OP_HASH160,n.Et.hash160(this.senderPubKey),n.Ez.OP_EQUALVERIFY,n.Ez.OP_HASH256,n.Et.hash256(t),n.Ez.OP_EQUALVERIFY,n.Ez.OP_DEPTH,n.Ez.OP_1,n.Ez.OP_NUMEQUAL,n.Ez.OP_IF,i.W.MAGIC,n.Ez.OP_1NEGATE].concat(function(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r),[n.Ez.OP_ELSE,n.Ez.OP_1,n.Ez.OP_ENDIF]).flat()}}])&&s(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o}(i.W)},4317:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{$7:()=>i,Bc:()=>i.InteractionTransaction,D_:()=>i.TransactionType,G7:()=>i.BitcoinUtils,GF:()=>i.CalldataGenerator,P8:()=>i.ContractBaseMetadata,Qc:()=>i.TransactionBuilder,Wj:()=>i.Generator,aS:()=>i.TweakedSigner,cC:()=>i.FundingTransaction,dF:()=>i.TransactionFactory,iy:()=>i.AddressGenerator,kd:()=>i.EcKeyPair,rE:()=>i.version,rR:()=>i.wBTC,tm:()=>i.TapscriptVerificator,uW:()=>i.Wallet,wf:()=>i.Compressor,y4:()=>i.UTXOManager,z4:()=>i.DeploymentGenerator});var i=r(3827),o=e([i]);i=(o.then?(await o)():o)[0],n()}catch(e){n(e)}}))},154:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{k:()=>l});var i=r(852),o=r(1757),a=r(8700),s=r(6647),u=r(8287).Buffer,f=e([s]);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function y(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=b(e,"string");return"symbol"==h(t)?t:t+""}function b(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}s=(f.then?(await f)():f)[0],(0,o.f0)(s);var c="function"==typeof i.Ay?i.Ay:i.Ay.BIP32Factory,l=function(){function e(){d(this,e)}return t=e,r=[{key:"fromWIF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.ECPair.fromWIF(e,t)}},{key:"fromPrivateKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.ECPair.fromPrivateKey(e,{network:t})}},{key:"fromPublicKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.ECPair.fromPublicKey(e,{network:t})}},{key:"generateMultiSigAddress",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.o8.bitcoin,n=this.verifyPubKeys(e,r),i=o.KT.p2wsh({redeem:o.KT.p2ms({m:t,pubkeys:n,network:r}),network:r}).address;if(!i)throw new Error("Failed to generate address");return i}},{key:"verifyPubKeys",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return t.map((function(t){var n=e.fromPublicKey(t,r);if(!n)throw new Error("Failed to regenerate key");return n.publicKey}))}},{key:"getP2WPKHAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=o.KT.p2wpkh({pubkey:e.publicKey,network:t});if(!r.address)throw new Error("Failed to generate wallet");return r.address}},{key:"generateWallet",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.o8.bitcoin,t=this.ECPair.makeRandom({network:e}),r=this.getP2WPKHAddress(t,e);if(!r)throw new Error("Failed to generate wallet");return{address:r,privateKey:t.toWIF(),publicKey:t.publicKey.toString("hex")}}},{key:"verifyContractAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return!!o.hl.toOutputScript(e,t)}},{key:"getLegacyAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=o.KT.p2pkh({pubkey:e.publicKey,network:t});if(!r.address)throw new Error("Failed to generate wallet");return r.address}},{key:"generateRandomKeyPair",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.o8.bitcoin;return this.ECPair.makeRandom({network:e})}},{key:"fromSeed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.BIP32.fromSeed(e,t)}},{key:"getTaprootAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=e.publicKey.slice(1,33),n=u.concat([u.from([81,32]),r]);return o.hl.fromOutputScript(n,t)}},{key:"getTaprootAddressFromAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=o.KT.p2tr({address:e,network:t}).address;if(!r)throw new Error("Failed to generate sender address for transaction");return r}},{key:"fromSeedKeyPair",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=this.BIP32.fromSeed(e,t).privateKey;if(!r)throw new Error("Failed to generate key pair");return this.ECPair.fromPrivateKey(r,{network:t})}}],null&&p(t.prototype,null),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();y(l,"BIP32",c(s)),y(l,"ECPair",(0,a.dg)(s)),n()}catch(m){n(m)}}))},8652:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{u:()=>u});var i=r(154),o=r(1757),a=r(477),s=e([i]);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function h(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){var t=p(e,"string");return"symbol"==f(t)?t:t+""}function p(e,t){if("object"!=f(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}i=(s.then?(await s)():s)[0];var u=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;c(this,e),h(this,"network",void 0),h(this,"_keypair",void 0),h(this,"_p2wpkh",void 0),h(this,"_p2tr",void 0),this.network=r,this._keypair=i.k.fromWIF(t.privateKey,this.network),this._p2wpkh=i.k.getP2WPKHAddress(this._keypair,this.network),this._p2tr=i.k.getTaprootAddress(this._keypair,this.network)},(t=[{key:"keypair",get:function(){if(!this._keypair)throw new Error("Keypair not set");return this._keypair}},{key:"p2wpkh",get:function(){return this._p2wpkh}},{key:"p2tr",get:function(){return this._p2tr}},{key:"publicKey",get:function(){if(!this.keypair)throw new Error("Keypair not set");return this.keypair.publicKey}},{key:"xOnly",get:function(){if(!this.keypair)throw new Error("Keypair not set");return(0,a.toXOnly)(this.keypair.publicKey)}}])&&l(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(y){n(y)}}))},525:(e,t,r)=>{r.d(t,{P:()=>s});var n=r(1757);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var s=function(){return e=function e(){var t,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,i=void 0,(r=a(r="network"))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.network=o},r=[{key:"getAddress",value:function(){throw arguments.length>0&&void 0!==arguments[0]||n.o8.bitcoin,new Error("Method not implemented.")}}],(t=[{key:"getAddress",value:function(){return this.address}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}()},1419:(e,t,r)=>{r.d(t,{r:()=>h});var n=r(1757);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}function a(e,t,r){return t=u(t),function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,r||[],u(e).constructor):t.apply(e,r))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function c(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var h=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(e=a(this,t,[r]),"network",void 0),c(e,"tokenName","Wrapped Bitcoin"),c(e,"tokenSymbol","wBTC"),c(e,"decimals",8),c(e,"address",void 0),e.network=r,e.address=t.getAddress(r),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),r=t,i=[{key:"getAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.o8.bitcoin;switch(e){case n.o8.bitcoin:case n.o8.regtest:return"bcrt1pcw0828yjrtlrc6mkp3lkq30j7wc7slsh7k7dyh53mrs4f8d74l6qumhqp4";case n.o8.testnet:return"tb1pq64lx73fwyrdp4asvl7xt5r5qvxvt9wy82x75taqtzvd64f58nasansurj";default:throw new Error("Invalid network: ".concat(e))}}}],null&&o(r.prototype,null),i&&o(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(r(525).P)},3827:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.r(t),r.d(t,{AddressGenerator:()=>f.i,BitcoinUtils:()=>_.G,CalldataGenerator:()=>s.G,Compressor:()=>o.w,ContractBaseMetadata:()=>p.P,DeploymentGenerator:()=>u.z,EcKeyPair:()=>l.k,FundingTransaction:()=>v.c,Generator:()=>a.W,InteractionTransaction:()=>m.B,TapscriptVerificator:()=>c.t,TransactionBuilder:()=>w.Q,TransactionFactory:()=>g.d,TransactionType:()=>b.D,TweakedSigner:()=>y.a,UTXOManager:()=>E.y,Wallet:()=>h.u,version:()=>i.r,wBTC:()=>d.r});var i=r(4822),o=r(5104),a=r(5901),s=r(9068),u=r(7061),f=r(3539),c=r(2569),l=r(154),h=r(8652),d=r(1419),p=r(525),y=r(4519),g=r(8582),b=r(3959),m=r(855),v=r(3608),w=r(2296),_=r(8284),E=r(9565),S=e([s,f,c,l,h,y,g,m,v,w]);[s,f,c,l,h,y,g,m,v,w]=S.then?(await S)():S,n()}catch(e){n(e)}}))},4519:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{a:()=>l});var i=r(1757),o=r(2218),a=r(477),s=r(6647),u=r(154),f=r(8287).Buffer,c=e([s,u]);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function y(e){var t=g(e,"string");return"symbol"==h(t)?t:t+""}function g(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[s,u]=c.then?(await c)():c,(0,i.f0)(s);var l=function(){return e=function e(){d(this,e)},t=[{key:"tweakSigner",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.privateKey;if(!r)throw new Error("Private key is required for tweaking signer!");3===e.publicKey[0]&&(r=s.privateNegate(r));var n=s.privateAdd(r,(0,o.tapTweakHash)((0,a.toXOnly)(e.publicKey),t.tweakHash));if(!n)throw new Error("Invalid tweaked private key!");return u.k.fromPrivateKey(f.from(n),t.network)}}],null&&p(e.prototype,null),t&&p(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(b){n(b)}}))},8582:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{d:()=>s});var i=r(3608),o=r(855),a=e([i,o]);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=y(e,"string");return"symbol"==u(t)?t:t+""}function y(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[i,o]=a.then?(await a)():a;var s=function(){return e=function e(){h(this,e)},(t=[{key:"signInteraction",value:function(e){var t=new o.B(e);t.signTransaction();var r=t.getFundingTransactionParameters(),n=new i.c(r).signTransaction();if(!n)throw new Error("Could not sign funding transaction.");var a=n.outs[0],s={transactionId:n.getId(),outputIndex:0,scriptPubKey:{hex:a.script.toString("hex"),address:t.getScriptAddress()},value:BigInt(a.value)},u=c(c({},e),{},{utxos:[s],randomBytes:t.getRndBytes()}),f=new o.B(u).signTransaction();return[n.toHex(),f.toHex()]}}])&&d(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(g){n(g)}}))},3608:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{c:()=>s});var i=r(3959),o=r(2296),a=e([o]);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,m(n.key),n)}}function l(e,t){if(t&&("object"==u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(d=function(){return!!e})()}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function b(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t=v(e,"string");return"symbol"==u(t)?t:t+""}function v(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var s=function(e){function t(e){var r,n,o,a;return f(this,t),n=this,a=[e],o=p(o=t),b(r=l(n,d()?Reflect.construct(o,a||[],p(n).constructor):o.apply(n,a)),"type",i.D.FUNDING),b(r,"childTransactionRequiredFees",void 0),r.childTransactionRequiredFees=e.childTransactionRequiredFees,r.internalInit(),r}return y(t,e),r=t,(n=[{key:"buildTransaction",value:function(){this.addInputsFromUTXO();var e=this.getTransactionOPNetFee()+this.childTransactionRequiredFees;this.addOutput({value:Number(e),address:this.to}),this.addRefundOutput(e)}},{key:"getSignerKey",value:function(){return this.signer}}])&&c(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}((o=(a.then?(await a)():a)[0]).Q);n()}catch(w){n(w)}}))},855:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{B:()=>p});var i=r(1757),o=r(2296),a=r(3959),s=r(9068),u=r(5104),f=r(154),c=r(8284),l=r(477),h=r(4519),d=e([o,s,f,h]);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function b(e,t){if(e){if("string"==typeof e)return m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,x(n.key),n)}}function _(e,t){if(t&&("object"==y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return E(e)}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(S=function(){return!!e})()}function k(){return k="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=A(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},k.apply(null,arguments)}function A(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=T(e)););return e}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function P(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function I(e,t,r){return(t=x(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(e){var t=N(e,"string");return"symbol"==y(t)?t:t+""}function N(e,t){if("object"!=y(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[o,s,f,h]=d.then?(await d)():d;var p=function(e){function t(e){var r,n,i,o;if(v(this,t),n=this,o=[e],i=T(i=t),I(r=_(n,S()?Reflect.construct(i,o||[],T(n).constructor):i.apply(n,o)),"type",a.D.INTERACTION),I(r,"randomBytes",void 0),I(r,"targetScriptRedeem",null),I(r,"leftOverFundsScriptRedeem",null),I(r,"compiledTargetScript",void 0),I(r,"scriptTree",void 0),I(r,"tapLeafScript",null),I(r,"calldataGenerator",void 0),I(r,"calldata",void 0),I(r,"contractSecret",r.generateSecret()),I(r,"tweakedSigner",void 0),I(r,"scriptSigner",void 0),I(r,"interactionPubKeys",void 0),I(r,"minimumSignatures",void 0),I(r,"customFinalizer",(function(e,t){if(!r.tapLeafScript)throw new Error("Tap leaf script is required");if(!t.tapScriptSig)throw new Error("Tap script signature is required");if(!r.contractSecret)throw new Error("Contract secret is required");var n=r.getScriptSolution(t).concat(r.tapLeafScript.script).concat(r.tapLeafScript.controlBlock);return{finalScriptWitness:r.witnessStackToScriptWitness(n)}})),!e.calldata)throw new Error("Calldata is required");return r.calldata=u.w.compress(e.calldata),r.interactionPubKeys=e.pubKeys||[],r.minimumSignatures=e.minimumSignatures||0,r.randomBytes=e.randomBytes||c.G.rndBytes(),r.scriptSigner=r.generateKeyPairFromSeed(),r.calldataGenerator=new s.G(r.internalPubKeyToXOnly(),r.scriptSignerXOnlyPubKey(),r.network),r.compiledTargetScript=r.calldataGenerator.compile(r.calldata,r.contractSecret,r.interactionPubKeys,r.minimumSignatures),r.scriptTree=r.getScriptTree(),r.internalInit(),r}return P(t,e),r=t,n=[{key:"getContractSecret",value:function(){return this.contractSecret}},{key:"getRndBytes",value:function(){return this.randomBytes}},{key:"generateSecret",value:function(){return i.hl.fromBech32(this.to).data}},{key:"tweakSigner",value:function(){this.tweakedSigner=this.getTweakedSigner()}},{key:"scriptSignerXOnlyPubKey",value:function(){return(0,l.toXOnly)(this.scriptSigner.publicKey)}},{key:"generateKeyPairFromSeed",value:function(){return f.k.fromSeedKeyPair(this.randomBytes,this.network)}},{key:"addInputsFromUTXO",value:function(){if(!this.tapLeafScript)throw new Error("Tap leaf script is required");var e,t=g(this.utxos);try{for(t.s();!(e=t.n()).done;){var r=e.value,n={hash:r.transactionId,index:r.outputIndex,witnessUtxo:{value:Number(r.value),script:this.getTapOutput()},tapLeafScript:[this.tapLeafScript],sequence:4294967293};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"buildTransaction",value:function(){var e=this.scriptSigner?this.targetScriptRedeem:this.leftOverFundsScriptRedeem;if(!e)throw new Error("Left over funds script redeem is required");if(!e.redeemVersion)throw new Error("Left over funds script redeem version is required");if(!e.output)throw new Error("Left over funds script redeem output is required");this.tapLeafScript={leafVersion:e.redeemVersion,script:e.output,controlBlock:this.getWitness()},this.addInputsFromUTXO();var t=this.getTransactionOPNetFee();this.addOutput({value:Number(t),address:this.to}),this.addRefundOutput(t)}},{key:"signInputs",value:function(e){this.scriptSigner?(e.signInput(0,this.scriptSigner),e.signInput(0,this.getSignerKey()),e.finalizeInput(0,this.customFinalizer)):k(T(t.prototype),"signInputs",this).call(this,e)}},{key:"getSignerKey",value:function(){return this.tweakedSigner?this.tweakedSigner:this.signer}},{key:"generateScriptAddress",value:function(){return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network,scriptTree:this.scriptTree}}},{key:"generateTapData",value:function(){var e=this.scriptSigner?this.targetScriptRedeem:this.leftOverFundsScriptRedeem;if(!e)throw new Error("Left over funds script redeem is required");if(!this.scriptTree)throw new Error("Script tree is required");return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network,scriptTree:this.scriptTree,redeem:e}}},{key:"getScriptSolution",value:function(e){if(!e.tapScriptSig)throw new Error("Tap script signature is required");return[this.contractSecret,this.internalPubKeyToXOnly(),e.tapScriptSig[0].signature,e.tapScriptSig[1].signature]}},{key:"getPubKeys",value:function(){var e=[this.signer.publicKey];return this.scriptSigner&&e.push(this.scriptSigner.publicKey),e}},{key:"getTweakerHash",value:function(){var e;return null===(e=this.tapData)||void 0===e?void 0:e.hash}},{key:"getTweakedSigner",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={network:this.network};return e&&(t.tweakHash=this.getTweakerHash()),h.a.tweakSigner(this.signer,t)}},{key:"generateRedeemScripts",value:function(){this.targetScriptRedeem={pubkeys:this.getPubKeys(),output:this.compiledTargetScript,redeemVersion:192},this.leftOverFundsScriptRedeem={pubkeys:this.getPubKeys(),output:this.getLeafScript(),redeemVersion:192}}},{key:"getLeafScript",value:function(){return t.LOCK_LEAF_SCRIPT}},{key:"getScriptTree",value:function(){if(!this.calldata)throw new Error("Calldata is required");return this.generateRedeemScripts(),[{output:this.compiledTargetScript,version:192},{output:this.getLeafScript(),version:192}]}}],n&&w(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(o.Q);n()}catch(M){n(M)}}))},2296:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{Q:()=>h});var i=r(1757),o=r(606),a=r(477),s=r(6647),u=r(154),f=r(8772),c=r(8287).Buffer,l=e([s,u]);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function g(e){if(Array.isArray(e))return v(e)}function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=m(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function m(e,t){if(e){if("string"==typeof e)return v(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,I(n.key),n)}}function E(e,t){if(t&&("object"==d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return S(e)}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(k=function(){return!!e})()}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}function T(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function O(e,t,r){return(t=I(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I(e){var t=x(e,"string");return"symbol"==d(t)?t:t+""}function x(e,t){if("object"!=d(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[s,u]=l.then?(await l)():l;var h=function(e){function t(e){var r,n,o,a;if(w(this,t),n=this,o=A(o=t),O(r=E(n,k()?Reflect.construct(o,[],A(n).constructor):o.apply(n,a)),"logColor","#785def"),O(r,"transactionFee",0n),O(r,"transaction",void 0),O(r,"inputs",[]),O(r,"updateInputs",[]),O(r,"outputs",[]),O(r,"feeOutput",null),O(r,"signed",!1),O(r,"tapData",null),O(r,"scriptData",null),O(r,"totalInputAmount",void 0),O(r,"signer",void 0),O(r,"network",void 0),O(r,"feeRate",void 0),O(r,"priorityFee",void 0),O(r,"utxos",void 0),O(r,"to",void 0),O(r,"from",void 0),O(r,"_maximumFeeRate",1e8),r.signer=e.signer,r.network=e.network,r.feeRate=e.feeRate,r.priorityFee=e.priorityFee,r.utxos=e.utxos,r.to=e.to,r.from=e.from||u.k.getTaprootAddress(r.signer,r.network),r.totalInputAmount=r.calculateTotalUTXOAmount(),r.calculateTotalVOutAmount()<r.totalInputAmount)throw new Error("Vout value is less than the value to send");if(r.totalInputAmount<t.MINIMUM_DUST)throw new Error("Value is less than the minimum dust");return r.transaction=new i.iL({network:r.network}),r}return T(t,e),r=t,n=[{key:"getFundingTransactionParameters",value:function(){return{utxos:this.utxos,to:this.getScriptAddress(),signer:this.signer,network:this.network,feeRate:this.feeRate,priorityFee:this.priorityFee,from:this.from,childTransactionRequiredFees:this.transactionFee}}},{key:"setDestinationAddress",value:function(e){this.to=e}},{key:"setMaximumFeeRate",value:function(e){this._maximumFeeRate=e}},{key:"signTransaction",value:function(){if(!this.to)throw new Error("Transaction must have a recipient");if(!u.k.verifyContractAddress(this.to,this.network))throw new Error("Invalid contract address. The contract address must be a taproot address.");if(this.signed)throw new Error("Transaction is already signed");if(this.signed=!0,this.buildTransaction(),this.internalBuildTransaction(this.transaction))return this.transaction.extractTransaction(!1);throw new Error("Could not sign transaction")}},{key:"getTransaction",value:function(){return this.transaction.extractTransaction(!1)}},{key:"getScriptAddress",value:function(){if(!this.scriptData||!this.scriptData.address)throw new Error("Tap data is required");return this.scriptData.address}},{key:"disableRBF",value:function(){if(this.signed)throw new Error("Transaction is already signed");var e,t=b(this.inputs);try{for(t.s();!(e=t.n()).done;)e.value.sequence=4294967295}catch(e){t.e(e)}finally{t.f()}}},{key:"getTapAddress",value:function(){if(!this.tapData||!this.tapData.address)throw new Error("Tap data is required");return this.tapData.address}},{key:"addInput",value:function(e){this.inputs.push(e)}},{key:"addOutput",value:function(e){if(e.value<t.MINIMUM_DUST)throw new Error("Output value is less than the minimum dust ".concat(e.value," < ").concat(t.MINIMUM_DUST));this.outputs.push(e)}},{key:"addRefundOutput",value:function(e){var r=this.totalInputAmount-e;r>=t.MINIMUM_DUST?this.setFeeOutput({value:Number(r),address:this.from}):this.warn("Amount to send back is less than the minimum dust, will be consumed in fees instead.")}},{key:"getTransactionOPNetFee",value:function(){return this.priorityFee>t.MINIMUM_DUST?this.priorityFee:t.MINIMUM_DUST}},{key:"calculateTotalUTXOAmount",value:function(){var e,t=0n,r=b(this.utxos);try{for(r.s();!(e=r.n()).done;)t+=e.value.value}catch(e){r.e(e)}finally{r.f()}return t}},{key:"calculateTotalVOutAmount",value:function(){var e,t=0n,r=b(this.utxos);try{for(r.s();!(e=r.n()).done;)t+=e.value.value}catch(e){r.e(e)}finally{r.f()}return t}},{key:"addInputsFromUTXO",value:function(){var e,t=b(this.utxos);try{for(t.s();!(e=t.n()).done;){var r=e.value,n={hash:r.transactionId,index:r.outputIndex,witnessUtxo:{value:Number(r.value),script:c.from(r.scriptPubKey.hex,"hex")},sequence:4294967293};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"witnessStackToScriptWitness",value:function(e){var t,r=c.allocUnsafe(0);function n(e){var t=r.length,n=o.varuint.encodingLength(e);r=c.concat([r,c.allocUnsafe(n)]),o.varuint.encode(e,r,t)}return n((t=e).length),t.forEach((function(e){n(e.length),function(e){r=c.concat([r,c.from(e)])}(e)})),r}},{key:"internalInit",value:function(){this.verifyUTXOValidity(),this.scriptData=i.KT.p2tr(this.generateScriptAddress()),this.tapData=i.KT.p2tr(this.generateTapData())}},{key:"generateScriptAddress",value:function(){return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network}}},{key:"generateTapData",value:function(){return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network}}},{key:"updateInput",value:function(e){this.updateInputs.push(e)}},{key:"getWitness",value:function(){if(!this.tapData||!this.tapData.witness)throw new Error("Witness is required");if(0===this.tapData.witness.length)throw new Error("Witness is empty");return this.tapData.witness[this.tapData.witness.length-1]}},{key:"getTapOutput",value:function(){if(!this.tapData||!this.tapData.output)throw new Error("Tap data is required");return this.tapData.output}},{key:"getInputs",value:function(){return this.inputs}},{key:"getOutputs",value:function(){var e,t=g(e=this.outputs)||y(e)||m(e)||p();return this.feeOutput&&t.push(this.feeOutput),t}},{key:"verifyUTXOValidity",value:function(){var e,t=b(this.utxos);try{for(t.s();!(e=t.n()).done;)if(!e.value.scriptPubKey)throw new Error("Address is required")}catch(e){t.e(e)}finally{t.f()}}},{key:"setFeeOutput",value:function(e){var r=e.value;this.feeOutput=e;var n=this.estimateTransactionFees();if(n>BigInt(r))throw new Error("Insufficient funds");this.feeOutput.value=r-Number(n),this.feeOutput.value<t.MINIMUM_DUST&&(this.feeOutput=null)}},{key:"internalPubKeyToXOnly",value:function(){return(0,a.toXOnly)(this.signer.publicKey)}},{key:"signInputs",value:function(e){e.signAllInputs(this.getSignerKey()),e.finalizeAllInputs()}},{key:"internalBuildTransaction",value:function(e){var t=this.getInputs(),r=this.getOutputs();e.setMaximumFeeRate(this._maximumFeeRate),e.addInputs(t);for(var n=0;n<this.updateInputs.length;n++)e.updateInput(n,this.updateInputs[n]);e.addOutputs(r);try{return this.signInputs(e),this.transactionFee=BigInt(e.getFee()),!0}catch(e){var i=e;this.error("[internalBuildTransaction] Something went wrong while getting building the transaction: ".concat(i.stack))}return!1}},{key:"estimateTransactionFees",value:function(){var e=new i.iL({network:this.network});if(this.internalBuildTransaction(e)){var t=e.extractTransaction(!1).virtualSize(),r=this.feeRate*t+1;return BigInt(Math.ceil(r))}throw new Error("Could not build transaction to estimate fee. Something went wrong while building the transaction.")}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(f.Vy);O(h,"LOCK_LEAF_SCRIPT",i.K$.compile([i.Ez.OP_0])),O(h,"MINIMUM_DUST",330n),(0,i.f0)(s),n()}catch(N){n(N)}}))},3959:(e,t,r)=>{var n;r.d(t,{D:()=>n}),function(e){e[e.GENERIC=0]="GENERIC",e[e.FUNDING=1]="FUNDING",e[e.DEPLOYMENT=2]="DEPLOYMENT",e[e.INTERACTION=3]="INTERACTION",e[e.WBTC_WRAP=4]="WBTC_WRAP"}(n||(n={}))},8284:(e,t,r)=>{r.d(t,{G:()=>s});var n=r(8287).Buffer;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"btcToSatoshi",value:function(e){return BigInt(1e8*e)}},{key:"rndBytes",value:function(){var e=crypto.getRandomValues(new Uint8Array(64));return n.from(e)}}],null&&o(e.prototype,null),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},9565:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(){i=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",f=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new M(n||[]);return a(o,"_invoke",{value:O(e,r,s)}),o}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",y="suspendedYield",g="executing",b="completed",m={};function v(){}function w(){}function _(){}var E={};l(E,u,(function(){return this}));var S=Object.getPrototypeOf,k=S&&S(S(R([])));k&&k!==r&&o.call(k,u)&&(E=k);var A=_.prototype=v.prototype=Object.create(E);function T(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(i,a,s,u){var f=d(e[i],e,a);if("throw"!==f.type){var c=f.arg,l=c.value;return l&&"object"==n(l)&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(l).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,u)}))}u(f.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var i=p;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===b){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=I(s,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var f=d(t,r,n);if("normal"===f.type){if(i=n.done?b:y,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(i=b,n.method="throw",n.arg=f.arg)}}}function I(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,I(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=d(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function N(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function R(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=_,a(A,"constructor",{value:_,configurable:!0}),a(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,l(e,c,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},T(P.prototype),l(P.prototype,f,(function(){return this})),t.AsyncIterator=P,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new P(h(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},T(A),l(A,c,"Generator"),l(A,u,(function(){return this})),l(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=R,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(N),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),N(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;N(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:R(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function f(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{y:()=>l});var l=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"opnetAPIUrl",void 0),f(this,"utxoPath","address/utxos"),this.opnetAPIUrl=t},t=[{key:"fetchUTXO",value:(r=i().mark((function e(t){var r,n,a,s,u,f,c,l,h,d,p,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={method:"GET",headers:{"Content-Type":"application/json"}},n="".concat(this.opnetAPIUrl,"/api/v1/").concat(this.utxoPath,"?address=").concat(t.address),e.next=4,fetch(n,r);case 4:if((a=e.sent).ok){e.next=7;break}throw new Error("Failed to fetch UTXO data: ".concat(a.statusText));case 7:return e.next=9,a.json();case 9:if(0!==(s=e.sent).length){e.next=12;break}throw new Error("No UTXO found");case 12:if(u=s.filter((function(e){return BigInt(e.value)>=t.minAmount})),0!==u.length){e.next=15;break}throw new Error("No UTXO found (minAmount)");case 15:f=[],c=0n,l=t.requestedAmount,h=o(u),e.prev=19,h.s();case 21:if((d=h.n()).done){e.next=30;break}if(p=d.value,y=BigInt(p.value),c+=y,f.push({transactionId:p.transactionId,outputIndex:p.outputIndex,value:y,scriptPubKey:p.scriptPubKey}),!(c+y>l)){e.next=28;break}return e.abrupt("break",30);case 28:e.next=21;break;case 30:e.next=35;break;case 32:e.prev=32,e.t0=e.catch(19),h.e(e.t0);case 35:return e.prev=35,h.f(),e.finish(35);case 38:return e.abrupt("return",f);case 39:case"end":return e.stop()}}),e,this,[[19,32,35,38]])})),n=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function a(e){s(o,n,i,a,u,"next",e)}function u(e){s(o,n,i,a,u,"throw",e)}a(void 0)}))},function(e){return n.apply(this,arguments)})}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n}()},2569:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{t:()=>l});var i=r(1757),o=r(477),a=r(7061),s=r(2296),u=r(3539),f=r(8287).Buffer,c=e([s,u]);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function y(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=b(e,"string");return"symbol"==h(t)?t:t+""}function b(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[s,u]=c.then?(await c)():c;var l=function(){function e(){d(this,e)}return t=e,r=[{key:"getContractAddress",value:function(t){var r=t.network||i.o8.bitcoin,n=[{output:new a.z(t.deployerPubKeyXOnly,(0,o.toXOnly)(t.contractSaltPubKey),r).compile(t.bytecode,t.originalSalt),version:e.TAP_SCRIPT_VERSION},{output:s.Q.LOCK_LEAF_SCRIPT,version:e.TAP_SCRIPT_VERSION}];return e.generateAddressFromScript(t,n)}},{key:"getContractSeed",value:function(e,t,r){var n=i.default.crypto.hash256(t),o=f.concat([e,r,n]);return i.default.crypto.hash256(o)}},{key:"generateContractVirtualAddress",value:function(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i.o8.bitcoin,a=e.getContractSeed(t,r,n);return u.i.generatePKSH(a,o)}},{key:"generateAddressFromScript",value:function(e,t){var r=e.network||i.o8.bitcoin,n={internalPubkey:e.deployerPubKeyXOnly,network:r,scriptTree:t};return i.KT.p2tr(n).address}}],null&&p(t.prototype,null),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();y(l,"TAP_SCRIPT_VERSION",192),n()}catch(m){n(m)}}))},5364:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=n}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function c(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,i=0;e[r]===s;)n++,r++;for(var o=(e.length-r)*u+1>>>0,f=new Uint8Array(o);e[r];){var c=t[e.charCodeAt(r)];if(255===c)return;for(var l=0,h=o-1;(0!==c||l<i)&&-1!==h;h--,l++)c+=a*f[h]>>>0,f[h]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=l,r++}for(var d=o-i;d!==o&&0===f[d];)d++;for(var p=new Uint8Array(n+(o-d)),y=n;d!==o;)p[y++]=f[d++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var u=(o-i)*f+1>>>0,c=new Uint8Array(u);i!==o;){for(var l=t[i],h=0,d=u-1;(0!==l||h<n)&&-1!==d;d--,h++)l+=256*c[d]>>>0,c[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");n=h,i++}for(var p=u-n;p!==u&&0===c[p];)p++;for(var y=s.repeat(r);p<u;++p)y+=e.charAt(c[p]);return y},decodeUnsafe:c,decode:function(e){var t=c(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},7526:(e,t)=>{t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=s(e),a=o[0],u=o[1],f=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),c=0,l=u>0?a-4:a;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],f[c++]=t>>16&255,f[c++]=t>>8&255,f[c++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[c++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[c++]=t>>8&255,f[c++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=16383,s=0,f=n-i;s<f;s+=a)o.push(u(e,s,s+a>f?f:s+a));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,a=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let e=0;e<32;e++){const t=r.charAt(e);n[t]=e}function i(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){let t=1;for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=i(t)^n>>5}t=i(t);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t=i(t)^31&n}return t}function a(e,t,r,n){let i=0,o=0;const a=(1<<r)-1,s=[];for(let n=0;n<e.length;++n)for(i=i<<t|e[n],o+=t;o>=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<<r-o&a);else{if(o>=t)return"Excess padding";if(i<<r-o&a)return"Non-zero padding"}return s}function s(e){return a(e,8,5,!0)}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function f(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function c(e){let t;function a(e,r){if(r=r||90,e.length<8)return e+" too short";if(e.length>r)return"Exceeds length limit";const a=e.toLowerCase(),s=e.toUpperCase();if(e!==a&&e!==s)return"Mixed-case string "+e;const u=(e=a).lastIndexOf("1");if(-1===u)return"No separator character for "+e;if(0===u)return"Missing prefix for "+e;const f=e.slice(0,u),c=e.slice(u+1);if(c.length<6)return"Data too short";let l=o(f);if("string"==typeof l)return l;const h=[];for(let e=0;e<c.length;++e){const t=c.charAt(e),r=n[t];if(void 0===r)return"Unknown character "+t;l=i(l)^r,e+6>=c.length||h.push(r)}return l!==t?"Invalid checksum for "+e:{prefix:f,words:h}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=a(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=a(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,a){if(a=a||90,e.length+7+n.length>a)throw new TypeError("Exceeds length limit");let s=o(e=e.toLowerCase());if("string"==typeof s)throw new Error(s);let u=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5)throw new Error("Non 5-bit word");s=i(s)^t,u+=r.charAt(t)}for(let e=0;e<6;++e)s=i(s);s^=t;for(let e=0;e<6;++e)u+=r.charAt(s>>5*(5-e)&31);return u},toWords:s,fromWordsUnsafe:u,fromWords:f}}t.bech32=c("bech32"),t.bech32m=c("bech32m")},4863:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(1457);function i(e,t,r){return n=>{if(e.has(n))return;const i=r.filter((e=>e.key.toString("hex")===n))[0];t.push(i),e.add(n)}}function o(e){return e.globalMap.unsignedTx}function a(e){const t=new Set;return e.forEach((e=>{const r=e.key.toString("hex");if(t.has(r))throw new Error("Combine: KeyValue Map keys should be unique");t.add(r)})),t}t.combine=function(e){const t=e[0],r=n.psbtToKeyVals(t),s=e.slice(1);if(0===s.length)throw new Error("Combine: Nothing to combine");const u=o(t);if(void 0===u)throw new Error("Combine: Self missing transaction");const f=a(r.globalKeyVals),c=r.inputKeyVals.map(a),l=r.outputKeyVals.map(a);for(const e of s){const t=o(e);if(void 0===t||!t.toBuffer().equals(u.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const s=n.psbtToKeyVals(e);a(s.globalKeyVals).forEach(i(f,r.globalKeyVals,s.globalKeyVals)),s.inputKeyVals.map(a).forEach(((e,t)=>e.forEach(i(c[t],r.inputKeyVals[t],s.inputKeyVals[t])))),s.outputKeyVals.map(a).forEach(((e,t)=>e.forEach(i(l[t],r.outputKeyVals[t],s.outputKeyVals[t]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},4834:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),r={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(n=e.value.length/4-1,[...Array(n).keys()])){const n=e.value.readUInt32LE(4*t+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}var n;return r},t.encode=function(e){const t=n.from([i.GlobalTypes.GLOBAL_XPUB]),r=n.concat([t,e.extendedPubkey]),o=e.path.split("/"),a=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(a,0);let s=4;return o.slice(1).forEach((e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),a.writeUInt32LE(r,s),s+=4})),{key:r,value:a}},t.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",t.check=function(e){const t=e.extendedPubkey,r=e.masterFingerprint,i=e.path;return n.isBuffer(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&n.isBuffer(r)&&4===r.length&&"string"==typeof i&&!!i.match(/^m(\/\d+'?)*$/)},t.canAddToArray=function(e,t,r){const n=t.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)}},4213:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.encode=function(e){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}}},2706:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(9080),i=r(4834),o=r(4213),a=r(6605),s=r(1795),u=r(4431),f=r(6907),c=r(5949),l=r(9344),h=r(2760),d=r(1695),p=r(8454),y=r(9034),g=r(2926),b=r(7851),m=r(7545),v=r(2412),w=r(4307),_=r(7636),E=r(2223),S=r(5578),k={unsignedTx:o,globalXpub:i,checkPubkey:v.makeChecker([])};t.globals=k;const A={nonWitnessUtxo:u,partialSig:f,sighashType:l,finalScriptSig:a,finalScriptWitness:s,porCommitment:c,witnessUtxo:g,bip32Derivation:m.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:w.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:S.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:v.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION]),tapKeySig:h,tapScriptSig:y,tapLeafScript:d,tapBip32Derivation:_.makeConverter(n.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:E.makeConverter(n.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:p};t.inputs=A;const T={bip32Derivation:m.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:w.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:S.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:v.makeChecker([n.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:_.makeConverter(n.OutputTypes.TAP_BIP32_DERIVATION),tapTree:b,tapInternalKey:E.makeConverter(n.OutputTypes.TAP_INTERNAL_KEY)};t.outputs=T},6605:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.FINAL_SCRIPTSIG]),value:e}},t.expected="Buffer",t.check=function(e){return n.isBuffer(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig}},1795:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},t.expected="Buffer",t.check=function(e){return n.isBuffer(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness}},4431:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.NON_WITNESS_UTXO]),value:e}},t.expected="Buffer",t.check=function(e){return n.isBuffer(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo}},6907:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},t.encode=function(e){const t=n.from([i.InputTypes.PARTIAL_SIG]);return{key:n.concat([t,e.pubkey]),value:e.signature}},t.expected="{ pubkey: Buffer; signature: Buffer; }",t.check=function(e){return n.isBuffer(e.pubkey)&&n.isBuffer(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!n.isBuffer(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const r=e[3+t+2];return!(r>33||r<1)&&e.length===3+t+2+r+2}(e.signature)},t.canAddToArray=function(e,t,r){const n=t.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}},5949:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},t.encode=function(e){return{key:n.from([i.InputTypes.POR_COMMITMENT]),value:n.from(e,"utf8")}},t.expected="string",t.check=function(e){return"string"==typeof e},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment}},9344:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},t.encode=function(e){const t=n.from([i.InputTypes.SIGHASH_TYPE]),r=n.allocUnsafe(4);return r.writeUInt32LE(e,0),{key:t,value:r}},t.expected="number",t.check=function(e){return"number"==typeof e},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType}},2760:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);function o(e){return n.isBuffer(e)&&(64===e.length||65===e.length)}t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!o(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.TAP_KEY_SIG]),value:e}},t.expected="Buffer",t.check=o,t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig}},1695:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));const t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));const r=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:r,leafVersion:t}},t.encode=function(e){const t=n.from([i.InputTypes.TAP_LEAF_SCRIPT]),r=n.from([e.leafVersion]);return{key:n.concat([t,e.controlBlock]),value:n.concat([e.script,r])}},t.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",t.check=function(e){return n.isBuffer(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&n.isBuffer(e.script)},t.canAddToArray=function(e,t,r){const n=t.controlBlock.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.controlBlock.equals(t.controlBlock))).length)}},8454:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);function o(e){return n.isBuffer(e)&&32===e.length}t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!o(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.TAP_MERKLE_ROOT]),value:e}},t.expected="Buffer",t.check=o,t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot}},9034:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},t.encode=function(e){const t=n.from([i.InputTypes.TAP_SCRIPT_SIG]);return{key:n.concat([t,e.pubkey,e.leafHash]),value:e.signature}},t.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",t.check=function(e){return n.isBuffer(e.pubkey)&&n.isBuffer(e.leafHash)&&n.isBuffer(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},t.canAddToArray=function(e,t,r){const n=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash))).length)}},2926:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080),o=r(8133),a=r(394);t.decode=function(e){if(e.key[0]!==i.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=o.readUInt64LE(e.value,0);let r=8;const n=a.decode(e.value,r);r+=a.encodingLength(n);const s=e.value.slice(r);if(s.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:s,value:t}},t.encode=function(e){const{script:t,value:r}=e,s=a.encodingLength(t.length),u=n.allocUnsafe(8+s+t.length);return o.writeUInt64LE(u,r,0),a.encode(t.length,u,8),t.copy(u,8+s),{key:n.from([i.InputTypes.WITNESS_UTXO]),value:u}},t.expected="{ script: Buffer; value: number; }",t.check=function(e){return n.isBuffer(e.script)&&"number"==typeof e.value},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo}},7851:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080),o=r(394);t.decode=function(e){if(e.key[0]!==i.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0;const r=[];for(;t<e.value.length;){const n=e.value[t++],i=e.value[t++],a=o.decode(e.value,t);t+=o.encodingLength(a),r.push({depth:n,leafVersion:i,script:e.value.slice(t,t+a)}),t+=a}return{leaves:r}},t.encode=function(e){const t=n.from([i.OutputTypes.TAP_TREE]),r=[].concat(...e.leaves.map((e=>[n.of(e.depth,e.leafVersion),o.encode(e.script.length),e.script])));return{key:t,value:n.concat(r)}},t.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",t.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((e=>e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&n.isBuffer(e.script)))},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree}},7545:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];t.makeConverter=function(e,t=i){return{decode:function(r){if(r.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+r.key.toString("hex"));const n=r.key.slice(1);if(!t(n))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+r.key.toString("hex"));if(r.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:r.value.slice(0,4),pubkey:n,path:"m"};for(const e of(o=r.value.length/4-1,[...Array(o).keys()])){const t=r.value.readUInt32LE(4*e+4),n=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(n?"'":"")}var o;return i},encode:function(t){const r=n.from([e]),i=n.concat([r,t.pubkey]),o=t.path.split("/"),a=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(a,0);let s=4;return o.slice(1).forEach((e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),a.writeUInt32LE(r,s),s+=4})),{key:i,value:a}},check:function(e){return n.isBuffer(e.pubkey)&&n.isBuffer(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,r){const n=t.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}}},2412:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeChecker=function(e){return function(t){let r;if(e.includes(t.key[0])&&(r=t.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return r}}},4307:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:n.from([e]),value:t}},check:function(e){return n.isBuffer(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}}},7636:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(394),o=r(7545),a=e=>32===e.length;t.makeConverter=function(e){const t=o.makeConverter(e,a);return{decode:function(e){const r=i.decode(e.value),n=i.encodingLength(r),o=t.decode({key:e.key,value:e.value.slice(n+32*r)}),a=new Array(r);for(let t=0,i=n;t<r;t++,i+=32)a[t]=e.value.slice(i,i+32);return Object.assign({},o,{leafHashes:a})},encode:function(e){const r=t.encode(e),o=i.encodingLength(e.leafHashes.length),a=n.allocUnsafe(o);i.encode(e.leafHashes.length,a);const s=n.concat([a,...e.leafHashes,r.value]);return Object.assign({},r,{value:s})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((e=>n.isBuffer(e)&&32===e.length))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}}},2223:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:n.from([e]),value:t}},check:function(e){return n.isBuffer(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}}},5578:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:n.from([e]),value:t}},check:function(e){return n.isBuffer(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}}},8133:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(394);function o(e){const t=e.key.length,r=e.value.length,o=i.encodingLength(t),a=i.encodingLength(r),s=n.allocUnsafe(o+t+a+r);return i.encode(t,s,0),e.key.copy(s,o),i.encode(r,s,o+t),e.value.copy(s,o+t+a),s}function a(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}t.range=e=>[...Array(e).keys()],t.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e},t.keyValsToBuffer=function(e){const t=e.map(o);return t.push(n.from([0])),n.concat(t)},t.keyValToBuffer=o,t.readUInt64LE=function(e,t){const r=e.readUInt32LE(t);let n=e.readUInt32LE(t+4);return n*=4294967296,a(n+r,9007199254740991),n+r},t.writeUInt64LE=function(e,t,r){return a(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}},394:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function a(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}t.encode=function e(t,r,i){if(o(t),r||(r=n.allocUnsafe(a(t))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),t<253?(r.writeUInt8(t,i),Object.assign(e,{bytes:1})):t<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(t,i+1),Object.assign(e,{bytes:3})):t<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(t,i+1),Object.assign(e,{bytes:5})):(r.writeUInt8(255,i),r.writeUInt32LE(t>>>0,i+1),r.writeUInt32LE(t/4294967296|0,i+5),Object.assign(e,{bytes:9})),r},t.decode=function e(t,r){if(!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);const i=t.readUInt8(r);if(i<253)return Object.assign(e,{bytes:1}),i;if(253===i)return Object.assign(e,{bytes:3}),t.readUInt16LE(r+1);if(254===i)return Object.assign(e,{bytes:5}),t.readUInt32LE(r+1);{Object.assign(e,{bytes:9});const n=t.readUInt32LE(r+1),i=4294967296*t.readUInt32LE(r+5)+n;return o(i),i}},t.encodingLength=a},6263:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(2706),o=r(8133),a=r(394),s=r(9080);function u(e,t,r){if(!t.equals(n.from([r])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function f(e,{globalMapKeyVals:t,inputKeyVals:r,outputKeyVals:n}){const a={unsignedTx:e};let f=0;for(const e of t)switch(e.key[0]){case s.GlobalTypes.UNSIGNED_TX:if(u("global",e.key,s.GlobalTypes.UNSIGNED_TX),f>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");f++;break;case s.GlobalTypes.GLOBAL_XPUB:void 0===a.globalXpub&&(a.globalXpub=[]),a.globalXpub.push(i.globals.globalXpub.decode(e));break;default:a.unknownKeyVals||(a.unknownKeyVals=[]),a.unknownKeyVals.push(e)}const c=r.length,l=n.length,h=[],d=[];for(const e of o.range(c)){const t={};for(const n of r[e])switch(i.inputs.checkPubkey(n),n.key[0]){case s.InputTypes.NON_WITNESS_UTXO:if(u("input",n.key,s.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=i.inputs.nonWitnessUtxo.decode(n);break;case s.InputTypes.WITNESS_UTXO:if(u("input",n.key,s.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=i.inputs.witnessUtxo.decode(n);break;case s.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(i.inputs.partialSig.decode(n));break;case s.InputTypes.SIGHASH_TYPE:if(u("input",n.key,s.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=i.inputs.sighashType.decode(n);break;case s.InputTypes.REDEEM_SCRIPT:if(u("input",n.key,s.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=i.inputs.redeemScript.decode(n);break;case s.InputTypes.WITNESS_SCRIPT:if(u("input",n.key,s.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=i.inputs.witnessScript.decode(n);break;case s.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(i.inputs.bip32Derivation.decode(n));break;case s.InputTypes.FINAL_SCRIPTSIG:u("input",n.key,s.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=i.inputs.finalScriptSig.decode(n);break;case s.InputTypes.FINAL_SCRIPTWITNESS:u("input",n.key,s.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=i.inputs.finalScriptWitness.decode(n);break;case s.InputTypes.POR_COMMITMENT:u("input",n.key,s.InputTypes.POR_COMMITMENT),t.porCommitment=i.inputs.porCommitment.decode(n);break;case s.InputTypes.TAP_KEY_SIG:u("input",n.key,s.InputTypes.TAP_KEY_SIG),t.tapKeySig=i.inputs.tapKeySig.decode(n);break;case s.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(i.inputs.tapScriptSig.decode(n));break;case s.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(i.inputs.tapLeafScript.decode(n));break;case s.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(i.inputs.tapBip32Derivation.decode(n));break;case s.InputTypes.TAP_INTERNAL_KEY:u("input",n.key,s.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=i.inputs.tapInternalKey.decode(n);break;case s.InputTypes.TAP_MERKLE_ROOT:u("input",n.key,s.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=i.inputs.tapMerkleRoot.decode(n);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}h.push(t)}for(const e of o.range(l)){const t={};for(const r of n[e])switch(i.outputs.checkPubkey(r),r.key[0]){case s.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,s.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=i.outputs.redeemScript.decode(r);break;case s.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,s.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=i.outputs.witnessScript.decode(r);break;case s.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(i.outputs.bip32Derivation.decode(r));break;case s.OutputTypes.TAP_INTERNAL_KEY:u("output",r.key,s.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=i.outputs.tapInternalKey.decode(r);break;case s.OutputTypes.TAP_TREE:u("output",r.key,s.OutputTypes.TAP_TREE),t.tapTree=i.outputs.tapTree.decode(r);break;case s.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(i.outputs.tapBip32Derivation.decode(r));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(r)}d.push(t)}return{globalMap:a,inputs:h,outputs:d}}t.psbtFromBuffer=function(e,t){let r=0;function n(){const t=a.decode(e,r);r+=a.encodingLength(t);const n=e.slice(r,r+t);return r+=t,n}function i(){return{key:n(),value:n()}}function u(){if(r>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(r);return t&&r++,t}if(1886610036!==function(){const t=e.readUInt32BE(r);return r+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(r);return r+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const c=[],l={};for(;!u();){const e=i(),t=e.key.toString("hex");if(l[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);l[t]=1,c.push(e)}const h=c.filter((e=>e.key[0]===s.GlobalTypes.UNSIGNED_TX));if(1!==h.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const d=t(h[0].value),{inputCount:p,outputCount:y}=d.getInputOutputCounts(),g=[],b=[];for(const e of o.range(p)){const t={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+o);t[o]=1,r.push(n)}g.push(r)}for(const e of o.range(y)){const t={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+o);t[o]=1,r.push(n)}b.push(r)}return f(d,{globalMapKeyVals:c,inputKeyVals:g,outputKeyVals:b})},t.checkKeyBuffer=u,t.psbtFromKeyVals=f},1457:(e,t,r)=>{function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(6263)),n(r(238))},238:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(2706),o=r(8133);t.psbtToBuffer=function({globalMap:e,inputs:t,outputs:r}){const{globalKeyVals:i,inputKeyVals:a,outputKeyVals:s}=u({globalMap:e,inputs:t,outputs:r}),f=o.keyValsToBuffer(i),c=e=>0===e.length?[n.from([0])]:e.map(o.keyValsToBuffer),l=c(a),h=c(s),d=n.allocUnsafe(5);return d.writeUIntBE(482972169471,0,5),n.concat([d,f].concat(l,h))};const a=(e,t)=>e.key.compare(t.key);function s(e,t){const r=new Set,n=Object.entries(e).reduce(((e,[n,i])=>{if("unknownKeyVals"===n)return e;const o=t[n];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(r.has(e))throw new Error("Serialize Error: Duplicate key: "+e);r.add(e)})),e.concat(a)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!r.has(e.key.toString("hex")))):[];return n.concat(i).sort(a)}function u({globalMap:e,inputs:t,outputs:r}){return{globalKeyVals:s(e,i.globals),inputKeyVals:t.map((e=>s(e,i.inputs))),outputKeyVals:r.map((e=>s(e,i.outputs)))}}t.psbtToKeyVals=u},1614:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(4863),o=r(1457),a=r(9080),s=r(5080);t.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const r=n.from(e,"base64");return this.fromBuffer(r,t)}static fromHex(e,t){const r=n.from(e,"hex");return this.fromBuffer(r,t)}static fromBuffer(e,t){const r=o.psbtFromBuffer(e,t),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return o.psbtToBuffer(this)}updateGlobal(e){return s.updateGlobal(e,this.globalMap),this}updateInput(e,t){const r=s.checkForInput(this.inputs,e);return s.updateInput(t,r),this}updateOutput(e,t){const r=s.checkForOutput(this.outputs,e);return s.updateOutput(t,r),this}addUnknownKeyValToGlobal(e){return s.checkHasKey(e,this.globalMap.unknownKeyVals,s.getEnumLength(a.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const r=s.checkForInput(this.inputs,e);return s.checkHasKey(t,r.unknownKeyVals,s.getEnumLength(a.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const r=s.checkForOutput(this.outputs,e);return s.checkHasKey(t,r.unknownKeyVals,s.getEnumLength(a.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(r,e))),s.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToOutput(r,e))),s.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=s.checkForInput(this.inputs,e);s.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=i.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}},9080:(e,t)=>{var r,n,i;Object.defineProperty(t,"__esModule",{value:!0}),(i=t.GlobalTypes||(t.GlobalTypes={}))[i.UNSIGNED_TX=0]="UNSIGNED_TX",i[i.GLOBAL_XPUB=1]="GLOBAL_XPUB",t.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=t.InputTypes||(t.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",t.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=t.OutputTypes||(t.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",t.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]},5080:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(2706);function o(e,t){const r=e[t];if(void 0===r)throw new Error(`No input #${t}`);return r}function a(e,t){const r=e[t];if(void 0===r)throw new Error(`No output #${t}`);return r}function s(e,t,r,n){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${r} and got ${JSON.stringify(n)}`)}function u(e){return(t,r)=>{for(const n of Object.keys(t)){const o=t[n],{canAdd:a,canAddToArray:u,check:f,expected:c}=i[e+"s"][n]||{};if(f)if(u){if(!Array.isArray(o)||r[n]&&!Array.isArray(r[n]))throw new Error(`Key type ${n} must be an array`);o.every(f)||s(e,n,c,o);const t=r[n]||[],i=new Set;if(!o.every((e=>u(t,e,i))))throw new Error("Can not add duplicate data to array");r[n]=t.concat(o)}else{if(f(o)||s(e,n,c,o),!a(r,o))throw new Error(`Can not add duplicate data to ${e}`);r[n]=o}}}}t.checkForInput=o,t.checkForOutput=a,t.checkHasKey=function(e,t,r){if(e.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},t.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},t.inputCheckUncleanFinalized=function(e,t){let r=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,n=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!n||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;r=i&&o&&a}if(!1===r)throw new Error(`Input #${e} has too much or too little data to clean`)},t.updateGlobal=u("global"),t.updateInput=u("input"),t.updateOutput=u("output"),t.addInputAttributes=function(e,r){const n=o(e,e.length-1);t.updateInput(r,n)},t.addOutputAttributes=function(e,r){const n=a(e,e.length-1);t.updateOutput(r,n)},t.defaultVersionSetter=function(e,t){if(!n.isBuffer(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},t.defaultLocktimeSetter=function(e,t){if(!n.isBuffer(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}},4642:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BIP32Factory=void 0;const i=r(9571),o=r(7757),a=r(3203),s=r(2623),u=r(8676),f=r(7513),c=(0,a.base58check)(s.sha256);t.BIP32Factory=function(e){(0,o.testEcc)(e);const t=u.BufferN(32),r=u.compile({wif:u.UInt8,bip32:{public:u.UInt32,private:u.UInt32}}),a={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},s=2147483648,l=Math.pow(2,31)-1;function h(e){return u.String(e)&&null!==e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function d(e){return u.UInt32(e)&&e<=l}class p{constructor(e,t){this.__D=e,this.__Q=t,this.lowR=!1}get publicKey(){return void 0===this.__Q&&(this.__Q=n.from(e.pointFromScalar(this.__D,!0))),this.__Q}get privateKey(){return this.__D}sign(t,r){if(!this.privateKey)throw new Error("Missing private key");if(void 0===r&&(r=this.lowR),!1===r)return n.from(e.sign(t,this.privateKey));{let r=n.from(e.sign(t,this.privateKey));const i=n.alloc(32,0);let o=0;for(;r[0]>127;)o++,i.writeUIntLE(o,0,6),r=n.from(e.sign(t,this.privateKey,i));return r}}signSchnorr(t){if(!this.privateKey)throw new Error("Missing private key");if(!e.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return n.from(e.signSchnorr(t,this.privateKey))}verify(t,r){return e.verify(t,this.publicKey,r)}verifySchnorr(t,r){if(!e.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return e.verifySchnorr(t,this.publicKey.subarray(1,33),r)}}class y extends p{constructor(e,t,n,i,o=0,a=0,s=0){super(e,t),this.chainCode=n,this.network=i,this.__DEPTH=o,this.__INDEX=a,this.__PARENT_FINGERPRINT=s,u(r,i)}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get identifier(){return i.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return m(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const e=this.network,t=this.isNeutered()?e.bip32.public:e.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(t,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),i=r,c.encode(Uint8Array.from(i));var i}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return f.encode(this.network.wif,this.privateKey,!0)}derive(t){u(u.UInt32,t);const r=t>=s,o=n.allocUnsafe(37);if(r){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");o[0]=0,this.privateKey.copy(o,1),o.writeUInt32BE(t,33)}else this.publicKey.copy(o,0),o.writeUInt32BE(t,33);const a=i.hmacSHA512(this.chainCode,o),f=a.slice(0,32),c=a.slice(32);if(!e.isPrivate(f))return this.derive(t+1);let l;if(this.isNeutered()){const r=n.from(e.pointAddScalar(this.publicKey,f,!0));if(null===r)return this.derive(t+1);l=m(r,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{const r=n.from(e.privateAdd(this.privateKey,f));if(null==r)return this.derive(t+1);l=b(r,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return l}deriveHardened(e){return u(d,e),this.derive(e+s)}derivePath(e){u(h,e);let t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");t=t.slice(1)}return t.reduce(((e,t)=>{let r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))}),this)}tweak(e){return this.privateKey?this.tweakFromPrivateKey(e):this.tweakFromPublicKey(e)}tweakFromPublicKey(t){const r=32===(i=this.publicKey).length?i:i.slice(1,33);var i;if(!e.xOnlyPointAddTweak)throw new Error("xOnlyPointAddTweak not supported by ecc library");const o=e.xOnlyPointAddTweak(r,t);if(!o||null===o.xOnlyPubkey)throw new Error("Cannot tweak public key!");const a=n.from([0===o.parity?2:3]),s=n.concat([a,o.xOnlyPubkey]);return new p(void 0,s)}tweakFromPrivateKey(t){const r=3===this.publicKey[0]||4===this.publicKey[0]&&!(1&~this.publicKey[64]),i=(()=>{if(r){if(e.privateNegate)return e.privateNegate(this.privateKey);throw new Error("privateNegate not supported by ecc library")}return this.privateKey})(),o=e.privateAdd(i,t);if(!o)throw new Error("Invalid tweaked private key!");return new p(n.from(o),void 0)}}function g(e,t,r){return b(e,t,r)}function b(r,n,i,o,s,f){if(u({privateKey:t,chainCode:t},{privateKey:r,chainCode:n}),i=i||a,!e.isPrivate(r))throw new TypeError("Private key not in range [1, n)");return new y(r,void 0,n,i,o,s,f)}function m(r,n,i,o,s,f){if(u({publicKey:u.BufferN(33),chainCode:t},{publicKey:r,chainCode:n}),i=i||a,!e.isPoint(r))throw new TypeError("Point is not on the curve");return new y(void 0,r,n,i,o,s,f)}return{fromSeed:function(e,t){if(u(u.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||a;const r=i.hmacSHA512(n.from("Bitcoin seed","utf8"),e);return g(r.slice(0,32),r.slice(32),t)},fromBase58:function(e,t){const r=(i=e,n.from(c.decode(i)));var i;if(78!==r.length)throw new TypeError("Invalid buffer length");t=t||a;const o=r.readUInt32BE(0);if(o!==t.bip32.private&&o!==t.bip32.public)throw new TypeError("Invalid network version");const s=r[4],u=r.readUInt32BE(5);if(0===s&&0!==u)throw new TypeError("Invalid parent fingerprint");const f=r.readUInt32BE(9);if(0===s&&0!==f)throw new TypeError("Invalid index");const l=r.slice(13,45);let h;if(o===t.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");h=b(r.slice(46,78),l,t,s,f,u)}else h=m(r.slice(45,78),l,t,s,f,u);return h},fromPublicKey:function(e,t,r){return m(e,t,r)},fromPrivateKey:g}}},9571:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.hmacSHA512=t.hash160=void 0;const i=r(9615),o=r(3238),a=r(2623),s=r(102);t.hash160=function(e){const t=(0,a.sha256)(Uint8Array.from(e));return n.from((0,o.ripemd160)(t))},t.hmacSHA512=function(e,t){return n.from((0,i.hmac)(s.sha512,e,t))}},852:(e,t,r)=>{t.Ay=void 0;var n=r(4642);Object.defineProperty(t,"Ay",{enumerable:!0,get:function(){return n.BIP32Factory}})},7757:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.testEcc=void 0;const i=e=>n.from(e,"hex");function o(e){if(!e)throw new Error("ecc library invalid")}t.testEcc=function(e){if(o(e.isPoint(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(!e.isPoint(i("030000000000000000000000000000000000000000000000000000000000000005"))),o(e.isPrivate(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(!e.isPrivate(i("0000000000000000000000000000000000000000000000000000000000000000"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),o(n.from(e.pointFromScalar(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),e.xOnlyPointAddTweak){o(null===e.xOnlyPointAddTweak(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")));let t=e.xOnlyPointAddTweak(i("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),i("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));o(n.from(t.xOnlyPubkey).equals(i("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&1===t.parity),t=e.xOnlyPointAddTweak(i("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),i("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47"))}o(n.from(e.pointAddScalar(i("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("0000000000000000000000000000000000000000000000000000000000000003"))).equals(i("02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"))),o(n.from(e.privateAdd(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),i("0000000000000000000000000000000000000000000000000000000000000002"))).equals(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),e.privateNegate&&(o(n.from(e.privateNegate(i("0000000000000000000000000000000000000000000000000000000000000001"))).equals(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(n.from(e.privateNegate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(i("0000000000000000000000000000000000000000000000000000000000000003"))),o(n.from(e.privateNegate(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")))),o(n.from(e.sign(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),o(e.verify(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),e.signSchnorr&&o(n.from(e.signSchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),i("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),e.verifySchnorr&&o(e.verifySchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}},57:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.toOutputScript=t.fromOutputScript=t.toBech32=t.toBase58Check=t.fromBech32=t.fromBase58Check=void 0;const i=r(622),o=r(885),a=r(7038),s=r(8116),u=r(2343),f=r(1889),c="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function l(e){const t=n.from(f.decode(e));if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function h(e){let t,r;try{t=u.bech32.decode(e)}catch(e){}if(t){if(r=t.words[0],0!==r)throw new TypeError(e+" uses wrong encoding")}else if(t=u.bech32m.decode(e),r=t.words[0],0===r)throw new TypeError(e+" uses wrong encoding");const i=u.bech32.fromWords(t.words.slice(1));return{version:r,prefix:t.prefix,data:n.from(i)}}function d(e,t,r){const n=u.bech32.toWords(e);return n.unshift(t),0===t?u.bech32.encode(r,n):u.bech32m.encode(r,n)}t.fromBase58Check=l,t.fromBech32=h,t.toBase58Check=function(e,t){(0,s.typeforce)((0,s.tuple)(s.Hash160bit,s.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(t,0),e.copy(r,1),f.encode(r)},t.toBech32=d,t.fromOutputScript=function(e,t){t=t||i.bitcoin;try{return o.p2pkh({output:e,network:t}).address}catch(e){}try{return o.p2sh({output:e,network:t}).address}catch(e){}try{return o.p2wpkh({output:e,network:t}).address}catch(e){}try{return o.p2wsh({output:e,network:t}).address}catch(e){}try{return o.p2tr({output:e,network:t}).address}catch(e){}try{return function(e,t){const r=e.slice(2);if(r.length<2||r.length>40)throw new TypeError("Invalid program length for segwit address");const n=e[0]-80;if(n<2||n>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==r.length)throw new TypeError("Invalid script for segwit address");return console.warn(c),d(r,n,t.bech32)}(e,t)}catch(e){}throw new Error(a.toASM(e)+" has no matching Address")},t.toOutputScript=function(e,t){let r,n;t=t||i.bitcoin;try{r=l(e)}catch(e){}if(r){if(r.version===t.pubKeyHash)return o.p2pkh({hash:r.hash}).output;if(r.version===t.scriptHash)return o.p2sh({hash:r.hash}).output}else{try{n=h(e)}catch(e){}if(n){if(n.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return o.p2wpkh({hash:n.data}).output;if(32===n.data.length)return o.p2wsh({hash:n.data}).output}else if(1===n.version){if(32===n.data.length)return o.p2tr({pubkey:n.data}).output}else if(n.version>=2&&n.version<=16&&n.data.length>=2&&n.data.length<=40)return console.warn(c),a.compile([n.version+80,n.data])}}throw new Error(e+" has no matching Script")}},3966:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decode=t.check=void 0,t.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const r=e[5+t];return!(0===r||6+t+r!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||r>1&&0===e[t+6]&&!(128&e[t+7]))},t.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");const t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");const r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},t.encode=function(e,t){const r=e.length,i=t.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");const o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+r]=2,o[5+r]=t.length,t.copy(o,6+r),o}},1696:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;const i=r(606),o=r(1944),a=r(1015),s=r(2021),u=r(8116),{typeforce:f}=u,c=new TypeError("Cannot compute merkle root for zero transactions"),l=new TypeError("Cannot compute witness commit for non-segwit block");class h{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new i.BufferReader(e),r=new h;if(r.version=t.readInt32(),r.prevHash=t.readSlice(32),r.merkleRoot=t.readSlice(32),r.timestamp=t.readUInt32(),r.bits=t.readUInt32(),r.nonce=t.readUInt32(),80===e.length)return r;const n=()=>{const e=s.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},o=t.readVarInt();r.transactions=[];for(let e=0;e<o;++e){const e=n();r.transactions.push(e)}const a=r.getWitnessCommit();return a&&(r.witnessCommit=a),r}static fromHex(e){return h.fromBuffer(n.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,r=8388607&e,i=n.alloc(32,0);return i.writeUIntBE(r,29-t,3),i}static calculateMerkleRoot(e,t){if(f([{getHash:u.Function}],e),0===e.length)throw c;if(t&&!d(e))throw l;const r=e.map((e=>e.getHash(t))),i=(0,a.fastMerkleRoot)(r,o.hash256);return t?o.hash256(n.concat([i,e[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!d(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(n.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof n&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof n&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+i.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((e,r)=>e+r.byteLength(t)),0)}getHash(){return o.hash256(this.toBuffer(!0))}getId(){return(0,i.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=n.allocUnsafe(this.byteLength(e)),r=new i.BufferWriter(t);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),e||!this.transactions||(i.varuint.encode(this.transactions.length,t,r.offset),r.offset+=i.varuint.encode.bytes,this.transactions.forEach((e=>{const n=e.byteLength();e.toBuffer(t,r.offset),r.offset+=n}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=(0,i.reverseBuffer)(this.getHash()),t=h.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw c;const e=h.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw c;if(!this.hasWitnessCommit())throw l;const e=h.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function d(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}t.Block=h},606:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BufferReader=t.BufferWriter=t.cloneBuffer=t.reverseBuffer=t.writeUInt64LE=t.readUInt64LE=t.varuint=void 0;const i=r(8116),{typeforce:o}=i,a=r(8469);function s(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function u(e,t){const r=e.readUInt32LE(t);let n=e.readUInt32LE(t+4);return n*=4294967296,s(n+r,9007199254740991),n+r}function f(e,t,r){return s(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}t.varuint=a,t.readUInt64LE=u,t.writeUInt64LE=f,t.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e},t.cloneBuffer=function(e){const t=n.allocUnsafe(e.length);return e.copy(t),t};class c{static withCapacity(e){return new c(n.alloc(e))}constructor(e,t=0){this.buffer=e,this.offset=t,o(i.tuple(i.Buffer,i.UInt32),[e,t])}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=f(this.buffer,e,this.offset)}writeVarInt(e){a.encode(e,this.buffer,this.offset),this.offset+=a.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}t.BufferWriter=c,t.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,o(i.tuple(i.Buffer,i.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=u(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=a.decode(this.buffer,this.offset);return this.offset+=a.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let r=0;r<e;r++)t.push(this.readVarSlice());return t}}},1944:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.taggedHash=t.TAGGED_HASH_PREFIXES=t.TAGS=t.hash256=t.hash160=t.sha256=t.sha1=t.ripemd160=void 0;const i=r(3238),o=r(1549),a=r(2623);function s(e){return n.from((0,a.sha256)(Uint8Array.from(e)))}t.ripemd160=function(e){return n.from((0,i.ripemd160)(Uint8Array.from(e)))},t.sha1=function(e){return n.from((0,o.sha1)(Uint8Array.from(e)))},t.sha256=s,t.hash160=function(e){return n.from((0,i.ripemd160)((0,a.sha256)(Uint8Array.from(e))))},t.hash256=function(e){return n.from((0,a.sha256)((0,a.sha256)(Uint8Array.from(e))))},t.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],t.TAGGED_HASH_PREFIXES={"BIP0340/challenge":n.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":n.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":n.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:n.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:n.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:n.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:n.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":n.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":n.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])},t.taggedHash=function(e,r){return s(n.concat([t.TAGGED_HASH_PREFIXES[e],r]))}},916:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getEccLib=t.initEccLib=void 0;const i={};t.initEccLib=function(e){var t;e?e!==i.eccLib&&(a("function"==typeof(t=e).isXOnlyPoint),a(t.isXOnlyPoint(o("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),a(t.isXOnlyPoint(o("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),a(t.isXOnlyPoint(o("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),a(t.isXOnlyPoint(o("0000000000000000000000000000000000000000000000000000000000000001"))),a(!t.isXOnlyPoint(o("0000000000000000000000000000000000000000000000000000000000000000"))),a(!t.isXOnlyPoint(o("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),a("function"==typeof t.xOnlyPointAddTweak),s.forEach((e=>{const r=t.xOnlyPointAddTweak(o(e.pubkey),o(e.tweak));null===e.result?a(null===r):(a(null!==r),a(r.parity===e.parity),a(n.from(r.xOnlyPubkey).equals(o(e.result))))})),i.eccLib=e):i.eccLib=e},t.getEccLib=function(){if(!i.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return i.eccLib};const o=e=>n.from(e,"hex");function a(e){if(!e)throw new Error("ecc library invalid")}const s=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}]},1757:(e,t,r)=>{t.f0=t.Ez=t.iL=t.K$=t.KT=t.o8=t.Et=t.hl=void 0;const n=r(57);t.hl=n;const i=r(1944);t.Et=i;const o=r(622);t.o8=o;const a=r(885);t.KT=a;const s=r(7038);t.K$=s;r(1696);var u=r(9646);Object.defineProperty(t,"iL",{enumerable:!0,get:function(){return u.Psbt}});var f=r(8417);Object.defineProperty(t,"Ez",{enumerable:!0,get:function(){return f.OPS}});r(2021);var c=r(916);Object.defineProperty(t,"f0",{enumerable:!0,get:function(){return c.initEccLib}})},1015:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fastMerkleRoot=void 0,t.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");let r=e.length;const i=e.concat();for(;r>1;){let e=0;for(let o=0;o<r;o+=2,++e){const a=i[o],s=o+1===r?a:i[o+1],u=n.concat([a,s]);i[e]=t(u)}r=e}return i[0]}},622:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.testnet=t.regtest=t.bitcoin=void 0,t.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},t.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},t.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},8417:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.REVERSE_OPS=t.OPS=void 0;const r={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1: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_SUBSTR:127,OP_LEFT:128,OP_RIGHT: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_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};t.OPS=r;const n={};t.REVERSE_OPS=n;for(const e of Object.keys(r))n[r[e]]=e},2218:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tweakKey=t.tapTweakHash=t.tapleafHash=t.findScriptPath=t.toHashTree=t.rootHashFromPath=t.MAX_TAPTREE_DEPTH=t.LEAF_VERSION_TAPSCRIPT=void 0;const n=r(8287),i=r(916),o=r(1944),a=r(606),s=r(8116);function u(e){const r=e.version||t.LEAF_VERSION_TAPSCRIPT;return o.taggedHash("TapLeaf",n.Buffer.concat([n.Buffer.from([r]),l(e.output)]))}function f(e,t){return o.taggedHash("TapTweak",n.Buffer.concat(t?[e,t]:[e]))}function c(e,t){return o.taggedHash("TapBranch",n.Buffer.concat([e,t]))}function l(e){const t=a.varuint.encodingLength(e.length),r=n.Buffer.allocUnsafe(t);return a.varuint.encode(e.length,r),n.Buffer.concat([r,e])}t.LEAF_VERSION_TAPSCRIPT=192,t.MAX_TAPTREE_DEPTH=128,t.rootHashFromPath=function(e,t){if(e.length<33)throw new TypeError(`The control-block length is too small. Got ${e.length}, expected min 33.`);const r=(e.length-33)/32;let n=t;for(let t=0;t<r;t++){const r=e.slice(33+32*t,65+32*t);n=n.compare(r)<0?c(n,r):c(r,n)}return n},t.toHashTree=function e(t){if((0,s.isTapleaf)(t))return{hash:u(t)};const r=[e(t[0]),e(t[1])];r.sort(((e,t)=>e.hash.compare(t.hash)));const[n,i]=r;return{hash:c(n.hash,i.hash),left:n,right:i}},t.findScriptPath=function e(t,r){if("left"in(n=t)&&"right"in n){const n=e(t.left,r);if(void 0!==n)return[...n,t.right.hash];const i=e(t.right,r);if(void 0!==i)return[...i,t.left.hash]}else if(t.hash.equals(r))return[];var n},t.tapleafHash=u,t.tapTweakHash=f,t.tweakKey=function(e,t){if(!n.Buffer.isBuffer(e))return null;if(32!==e.length)return null;if(t&&32!==t.length)return null;const r=f(e,t),o=(0,i.getEccLib)().xOnlyPointAddTweak(e,r);return o&&null!==o.xOnlyPubkey?{parity:o.parity,x:n.Buffer.from(o.xOnlyPubkey)}:null}},5472:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2data=void 0;const n=r(622),i=r(7038),o=r(8116),a=r(7883),s=i.OPS;t.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),data:o.typeforce.maybe(o.typeforce.arrayOf(o.typeforce.Buffer))},e);const r={name:"embed",network:e.network||n.bitcoin};if(a.prop(r,"output",(()=>{if(e.data)return i.compile([s.OP_RETURN].concat(e.data))})),a.prop(r,"data",(()=>{if(e.output)return i.decompile(e.output).slice(1)})),t.validate&&e.output){const t=i.decompile(e.output);if(t[0]!==s.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(o.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!(0,o.stacksEqual)(e.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,e)}},885:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2tr=t.p2wsh=t.p2wpkh=t.p2sh=t.p2pkh=t.p2pk=t.p2ms=t.embed=void 0;const n=r(5472);Object.defineProperty(t,"embed",{enumerable:!0,get:function(){return n.p2data}});const i=r(1395);Object.defineProperty(t,"p2ms",{enumerable:!0,get:function(){return i.p2ms}});const o=r(4930);Object.defineProperty(t,"p2pk",{enumerable:!0,get:function(){return o.p2pk}});const a=r(3504);Object.defineProperty(t,"p2pkh",{enumerable:!0,get:function(){return a.p2pkh}});const s=r(8368);Object.defineProperty(t,"p2sh",{enumerable:!0,get:function(){return s.p2sh}});const u=r(7027);Object.defineProperty(t,"p2wpkh",{enumerable:!0,get:function(){return u.p2wpkh}});const f=r(9041);Object.defineProperty(t,"p2wsh",{enumerable:!0,get:function(){return f.p2wsh}});const c=r(5501);Object.defineProperty(t,"p2tr",{enumerable:!0,get:function(){return c.p2tr}})},7883:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.value=t.prop=void 0,t.prop=function(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=r.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},t.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)}},1395:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2ms=void 0;const n=r(622),i=r(7038),o=r(8116),a=r(7883),s=i.OPS,u=s.OP_RESERVED;t.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function r(e){return i.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===s.OP_0)}t=Object.assign({validate:!0},t||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),m:o.typeforce.maybe(o.typeforce.Number),n:o.typeforce.maybe(o.typeforce.Number),output:o.typeforce.maybe(o.typeforce.Buffer),pubkeys:o.typeforce.maybe(o.typeforce.arrayOf(o.isPoint)),signatures:o.typeforce.maybe(o.typeforce.arrayOf(r)),input:o.typeforce.maybe(o.typeforce.Buffer)},e);const f={network:e.network||n.bitcoin};let c=[],l=!1;function h(e){l||(l=!0,c=i.decompile(e),f.m=c[0]-u,f.n=c[c.length-2]-u,f.pubkeys=c.slice(1,-2))}if(a.prop(f,"output",(()=>{if(e.m&&f.n&&e.pubkeys)return i.compile([].concat(u+e.m,e.pubkeys,u+f.n,s.OP_CHECKMULTISIG))})),a.prop(f,"m",(()=>{if(f.output)return h(f.output),f.m})),a.prop(f,"n",(()=>{if(f.pubkeys)return f.pubkeys.length})),a.prop(f,"pubkeys",(()=>{if(e.output)return h(e.output),f.pubkeys})),a.prop(f,"signatures",(()=>{if(e.input)return i.decompile(e.input).slice(1)})),a.prop(f,"input",(()=>{if(e.signatures)return i.compile([s.OP_0].concat(e.signatures))})),a.prop(f,"witness",(()=>{if(f.input)return[]})),a.prop(f,"name",(()=>{if(f.m&&f.n)return`p2ms(${f.m} of ${f.n})`})),t.validate){if(e.output){if(h(e.output),!o.typeforce.Number(c[0]))throw new TypeError("Output is invalid");if(!o.typeforce.Number(c[c.length-2]))throw new TypeError("Output is invalid");if(c[c.length-1]!==s.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(f.m<=0||f.n>16||f.m>f.n||f.n!==c.length-3)throw new TypeError("Output is invalid");if(!f.pubkeys.every((e=>(0,o.isPoint)(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==f.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==f.n)throw new TypeError("n mismatch");if(e.pubkeys&&!(0,o.stacksEqual)(e.pubkeys,f.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(f.n=e.pubkeys.length,f.n<f.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<f.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>f.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==s.OP_0)throw new TypeError("Input is invalid");if(0===f.signatures.length||!f.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!(0,o.stacksEqual)(e.signatures,f.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(f,e)}},4930:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2pk=void 0;const n=r(622),i=r(7038),o=r(8116),a=r(7883),s=i.OPS;t.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),pubkey:o.typeforce.maybe(o.isPoint),signature:o.typeforce.maybe(i.isCanonicalScriptSignature),input:o.typeforce.maybe(o.typeforce.Buffer)},e);const r=a.value((()=>i.decompile(e.input))),u={name:"p2pk",network:e.network||n.bitcoin};if(a.prop(u,"output",(()=>{if(e.pubkey)return i.compile([e.pubkey,s.OP_CHECKSIG])})),a.prop(u,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),a.prop(u,"signature",(()=>{if(e.input)return r()[0]})),a.prop(u,"input",(()=>{if(e.signature)return i.compile([e.signature])})),a.prop(u,"witness",(()=>{if(u.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==s.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,o.isPoint)(u.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(u.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(u.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(u.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(u,e)}},3504:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2pkh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(1889),c=a.OPS;t.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),output:s.typeforce.maybe(s.typeforce.BufferN(25)),pubkey:s.typeforce.maybe(s.isPoint),signature:s.typeforce.maybe(a.isCanonicalScriptSignature),input:s.typeforce.maybe(s.typeforce.Buffer)},e);const r=u.value((()=>{const t=n.from(f.decode(e.address));return{version:t.readUInt8(0),hash:t.slice(1)}})),l=u.value((()=>a.decompile(e.input))),h=e.network||o.bitcoin,d={name:"p2pkh",network:h};if(u.prop(d,"address",(()=>{if(!d.hash)return;const e=n.allocUnsafe(21);return e.writeUInt8(h.pubKeyHash,0),d.hash.copy(e,1),f.encode(e)})),u.prop(d,"hash",(()=>e.output?e.output.slice(3,23):e.address?r().hash:e.pubkey||d.pubkey?i.hash160(e.pubkey||d.pubkey):void 0)),u.prop(d,"output",(()=>{if(d.hash)return a.compile([c.OP_DUP,c.OP_HASH160,d.hash,c.OP_EQUALVERIFY,c.OP_CHECKSIG])})),u.prop(d,"pubkey",(()=>{if(e.input)return l()[1]})),u.prop(d,"signature",(()=>{if(e.input)return l()[0]})),u.prop(d,"input",(()=>{if(e.pubkey&&e.signature)return a.compile([e.signature,e.pubkey])})),u.prop(d,"witness",(()=>{if(d.input)return[]})),t.validate){let t=n.from([]);if(e.address){if(r().version!==h.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");t=r().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==c.OP_DUP||e.output[1]!==c.OP_HASH160||20!==e.output[2]||e.output[23]!==c.OP_EQUALVERIFY||e.output[24]!==c.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=e.output.slice(3,23);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.pubkey){const r=i.hash160(e.pubkey);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=l();if(2!==r.length)throw new TypeError("Input is invalid");if(!a.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!(0,s.isPoint)(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=i.hash160(r[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(d,e)}},8368:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2sh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(1889),c=a.OPS;t.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),output:s.typeforce.maybe(s.typeforce.BufferN(23)),redeem:s.typeforce.maybe({network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.Buffer),input:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),input:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},e);let r=e.network;r||(r=e.redeem&&e.redeem.network||o.bitcoin);const l={network:r},h=u.value((()=>{const t=n.from(f.decode(e.address));return{version:t.readUInt8(0),hash:t.slice(1)}})),d=u.value((()=>a.decompile(e.input))),p=u.value((()=>{const t=d(),i=t[t.length-1];return{network:r,output:i===c.OP_FALSE?n.from([]):i,input:a.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(u.prop(l,"address",(()=>{if(!l.hash)return;const e=n.allocUnsafe(21);return e.writeUInt8(l.network.scriptHash,0),l.hash.copy(e,1),f.encode(e)})),u.prop(l,"hash",(()=>e.output?e.output.slice(2,22):e.address?h().hash:l.redeem&&l.redeem.output?i.hash160(l.redeem.output):void 0)),u.prop(l,"output",(()=>{if(l.hash)return a.compile([c.OP_HASH160,l.hash,c.OP_EQUAL])})),u.prop(l,"redeem",(()=>{if(e.input)return p()})),u.prop(l,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return a.compile([].concat(a.decompile(e.redeem.input),e.redeem.output))})),u.prop(l,"witness",(()=>l.redeem&&l.redeem.witness?l.redeem.witness:l.input?[]:void 0)),u.prop(l,"name",(()=>{const e=["p2sh"];return void 0!==l.redeem&&void 0!==l.redeem.name&&e.push(l.redeem.name),e.join("-")})),t.validate){let t=n.from([]);if(e.address){if(h().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==h().hash.length)throw new TypeError("Invalid address");t=h().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==c.OP_HASH160||20!==e.output[1]||e.output[22]!==c.OP_EQUAL)throw new TypeError("Output is invalid");const r=e.output.slice(2,22);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}const o=e=>{if(e.output){const r=a.decompile(e.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");if(e.output.byteLength>520)throw new TypeError("Redeem.output unspendable if larger than 520 bytes");if(a.countNonPushOnlyOPs(r)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const n=i.hash160(e.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const t=e.input.length>0,r=e.witness&&e.witness.length>0;if(!t&&!r)throw new TypeError("Empty input");if(t&&r)throw new TypeError("Input and witness provided");if(t){const t=a.decompile(e.input);if(!a.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=d();if(!e||e.length<1)throw new TypeError("Input too short");if(!n.isBuffer(p().output))throw new TypeError("Input is invalid");o(p())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==r)throw new TypeError("Network mismatch");if(e.input){const t=p();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}o(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!(0,s.stacksEqual)(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(l,e)}},5501:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2tr=void 0;const n=r(8287),i=r(622),o=r(7038),a=r(8116),s=r(916),u=r(2218),f=r(7883),c=r(2343),l=r(57),h=o.OPS;t.p2tr=function(e,t){if(!(e.address||e.output||e.pubkey||e.internalPubkey||e.witness&&e.witness.length>1))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,a.typeforce)({address:a.typeforce.maybe(a.typeforce.String),input:a.typeforce.maybe(a.typeforce.BufferN(0)),network:a.typeforce.maybe(a.typeforce.Object),output:a.typeforce.maybe(a.typeforce.BufferN(34)),internalPubkey:a.typeforce.maybe(a.typeforce.BufferN(32)),hash:a.typeforce.maybe(a.typeforce.BufferN(32)),pubkey:a.typeforce.maybe(a.typeforce.BufferN(32)),signature:a.typeforce.maybe(a.typeforce.anyOf(a.typeforce.BufferN(64),a.typeforce.BufferN(65))),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer)),scriptTree:a.typeforce.maybe(a.isTaptree),redeem:a.typeforce.maybe({output:a.typeforce.maybe(a.typeforce.Buffer),redeemVersion:a.typeforce.maybe(a.typeforce.Number),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))}),redeemVersion:a.typeforce.maybe(a.typeforce.Number)},e);const r=f.value((()=>(0,l.fromBech32)(e.address))),d=f.value((()=>{if(e.witness&&e.witness.length)return e.witness.length>=2&&80===e.witness[e.witness.length-1][0]?e.witness.slice(0,-1):e.witness.slice()})),p=f.value((()=>e.scriptTree?(0,u.toHashTree)(e.scriptTree):e.hash?{hash:e.hash}:void 0)),y=e.network||i.bitcoin,g={name:"p2tr",network:y};if(f.prop(g,"address",(()=>{if(!g.pubkey)return;const e=c.bech32m.toWords(g.pubkey);return e.unshift(1),c.bech32m.encode(y.bech32,e)})),f.prop(g,"hash",(()=>{const e=p();if(e)return e.hash;const t=d();if(t&&t.length>1){const e=t[t.length-1],r=e[0]&a.TAPLEAF_VERSION_MASK,n=t[t.length-2],i=(0,u.tapleafHash)({output:n,version:r});return(0,u.rootHashFromPath)(e,i)}return null})),f.prop(g,"output",(()=>{if(g.pubkey)return o.compile([h.OP_1,g.pubkey])})),f.prop(g,"redeemVersion",(()=>e.redeemVersion?e.redeemVersion:e.redeem&&void 0!==e.redeem.redeemVersion&&null!==e.redeem.redeemVersion?e.redeem.redeemVersion:u.LEAF_VERSION_TAPSCRIPT)),f.prop(g,"redeem",(()=>{const e=d();if(e&&!(e.length<2))return{output:e[e.length-2],witness:e.slice(0,-2),redeemVersion:e[e.length-1][0]&a.TAPLEAF_VERSION_MASK}})),f.prop(g,"pubkey",(()=>{if(e.pubkey)return e.pubkey;if(e.output)return e.output.slice(2);if(e.address)return r().data;if(g.internalPubkey){const e=(0,u.tweakKey)(g.internalPubkey,g.hash);if(e)return e.x}})),f.prop(g,"internalPubkey",(()=>{if(e.internalPubkey)return e.internalPubkey;const t=d();return t&&t.length>1?t[t.length-1].slice(1,33):void 0})),f.prop(g,"signature",(()=>{if(e.signature)return e.signature;const t=d();return t&&1===t.length?t[0]:void 0})),f.prop(g,"witness",(()=>{if(e.witness)return e.witness;const t=p();if(t&&e.redeem&&e.redeem.output&&e.internalPubkey){const r=(0,u.tapleafHash)({output:e.redeem.output,version:g.redeemVersion}),i=(0,u.findScriptPath)(t,r);if(!i)return;const o=(0,u.tweakKey)(e.internalPubkey,t.hash);if(!o)return;const a=n.Buffer.concat([n.Buffer.from([g.redeemVersion|o.parity]),e.internalPubkey].concat(i));return[e.redeem.output,a]}return e.signature?[e.signature]:void 0})),t.validate){let t=n.Buffer.from([]);if(e.address){if(y&&y.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(1!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");t=r().data}if(e.pubkey){if(t.length>0&&!t.equals(e.pubkey))throw new TypeError("Pubkey mismatch");t=e.pubkey}if(e.output){if(34!==e.output.length||e.output[0]!==h.OP_1||32!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Pubkey mismatch");t=e.output.slice(2)}if(e.internalPubkey){const r=(0,u.tweakKey)(e.internalPubkey,g.hash);if(t.length>0&&!t.equals(r.x))throw new TypeError("Pubkey mismatch");t=r.x}if(t&&t.length&&!(0,s.getEccLib)().isXOnlyPoint(t))throw new TypeError("Invalid pubkey for p2tr");const i=p();if(e.hash&&i&&!e.hash.equals(i.hash))throw new TypeError("Hash mismatch");if(e.redeem&&e.redeem.output&&i){const t=(0,u.tapleafHash)({output:e.redeem.output,version:g.redeemVersion});if(!(0,u.findScriptPath)(i,t))throw new TypeError("Redeem script not in tree")}const f=d();if(e.redeem&&g.redeem){if(e.redeem.redeemVersion&&e.redeem.redeemVersion!==g.redeem.redeemVersion)throw new TypeError("Redeem.redeemVersion and witness mismatch");if(e.redeem.output){if(0===o.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");if(g.redeem.output&&!e.redeem.output.equals(g.redeem.output))throw new TypeError("Redeem.output and witness mismatch")}if(e.redeem.witness&&g.redeem.witness&&!(0,a.stacksEqual)(e.redeem.witness,g.redeem.witness))throw new TypeError("Redeem.witness and witness mismatch")}if(f&&f.length)if(1===f.length){if(e.signature&&!e.signature.equals(f[0]))throw new TypeError("Signature mismatch")}else{const r=f[f.length-1];if(r.length<33)throw new TypeError(`The control-block length is too small. Got ${r.length}, expected min 33.`);if((r.length-33)%32!=0)throw new TypeError(`The control-block length of ${r.length} is incorrect!`);const n=(r.length-33)/32;if(n>128)throw new TypeError(`The script path is too long. Got ${n}, expected max 128.`);const i=r.slice(1,33);if(e.internalPubkey&&!e.internalPubkey.equals(i))throw new TypeError("Internal pubkey mismatch");if(!(0,s.getEccLib)().isXOnlyPoint(i))throw new TypeError("Invalid internalPubkey for p2tr witness");const o=r[0]&a.TAPLEAF_VERSION_MASK,c=f[f.length-2],l=(0,u.tapleafHash)({output:c,version:o}),h=(0,u.rootHashFromPath)(r,l),d=(0,u.tweakKey)(i,h);if(!d)throw new TypeError("Invalid outputKey for p2tr witness");if(t.length&&!t.equals(d.x))throw new TypeError("Pubkey mismatch for p2tr witness");if(d.parity!==(1&r[0]))throw new Error("Incorrect parity")}}return Object.assign(g,e)}},7027:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2wpkh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(2343),c=a.OPS,l=n.alloc(0);t.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),input:s.typeforce.maybe(s.typeforce.BufferN(0)),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.BufferN(22)),pubkey:s.typeforce.maybe(s.isPoint),signature:s.typeforce.maybe(a.isCanonicalScriptSignature),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},e);const r=u.value((()=>{const t=f.bech32.decode(e.address),r=t.words.shift(),i=f.bech32.fromWords(t.words);return{version:r,prefix:t.prefix,data:n.from(i)}})),h=e.network||o.bitcoin,d={name:"p2wpkh",network:h};if(u.prop(d,"address",(()=>{if(!d.hash)return;const e=f.bech32.toWords(d.hash);return e.unshift(0),f.bech32.encode(h.bech32,e)})),u.prop(d,"hash",(()=>e.output?e.output.slice(2,22):e.address?r().data:e.pubkey||d.pubkey?i.hash160(e.pubkey||d.pubkey):void 0)),u.prop(d,"output",(()=>{if(d.hash)return a.compile([c.OP_0,d.hash])})),u.prop(d,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),u.prop(d,"signature",(()=>{if(e.witness)return e.witness[0]})),u.prop(d,"input",(()=>{if(d.witness)return l})),u.prop(d,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=n.from([]);if(e.address){if(h&&h.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(20!==r().data.length)throw new TypeError("Invalid address data");t=r().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==c.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const r=i.hash160(e.pubkey);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");if(t=r,!(0,s.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!a.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,s.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const r=i.hash160(e.witness[1]);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(d,e)}},9041:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2wsh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(2343),c=a.OPS,l=n.alloc(0);function h(e){return!(!n.isBuffer(e)||65!==e.length||4!==e[0]||!(0,s.isPoint)(e))}t.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(32)),output:s.typeforce.maybe(s.typeforce.BufferN(34)),redeem:s.typeforce.maybe({input:s.typeforce.maybe(s.typeforce.Buffer),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),input:s.typeforce.maybe(s.typeforce.BufferN(0)),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},e);const r=u.value((()=>{const t=f.bech32.decode(e.address),r=t.words.shift(),i=f.bech32.fromWords(t.words);return{version:r,prefix:t.prefix,data:n.from(i)}})),d=u.value((()=>a.decompile(e.redeem.input)));let p=e.network;p||(p=e.redeem&&e.redeem.network||o.bitcoin);const y={network:p};if(u.prop(y,"address",(()=>{if(!y.hash)return;const e=f.bech32.toWords(y.hash);return e.unshift(0),f.bech32.encode(p.bech32,e)})),u.prop(y,"hash",(()=>e.output?e.output.slice(2):e.address?r().data:y.redeem&&y.redeem.output?i.sha256(y.redeem.output):void 0)),u.prop(y,"output",(()=>{if(y.hash)return a.compile([c.OP_0,y.hash])})),u.prop(y,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:l,witness:e.witness.slice(0,-1)}})),u.prop(y,"input",(()=>{if(y.witness)return l})),u.prop(y,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=a.toStack(d());return y.redeem=Object.assign({witness:t},e.redeem),y.redeem.input=l,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),u.prop(y,"name",(()=>{const e=["p2wsh"];return void 0!==y.redeem&&void 0!==y.redeem.name&&e.push(y.redeem.name),e.join("-")})),t.validate){let t=n.from([]);if(e.address){if(r().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");t=r().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==c.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const r=e.output.slice(2);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem){if(e.redeem.network&&e.redeem.network!==p)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){const r=a.decompile(e.redeem.output);if(!r||r.length<1)throw new TypeError("Redeem.output is invalid");if(e.redeem.output.byteLength>3600)throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");if(a.countNonPushOnlyOPs(r)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const n=i.sha256(e.redeem.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem.input&&!a.isPushOnly(d()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!(0,s.stacksEqual)(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&d().some(h)||e.redeem.output&&(a.decompile(e.redeem.output)||[]).some(h))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(h)||(a.decompile(t)||[]).some(h))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(y,e)}},9646:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Psbt=void 0;const i=r(1614),o=r(394),a=r(5080),s=r(57),u=r(606),f=r(622),c=r(885),l=r(2218),h=r(7038),d=r(2021),p=r(477),y=r(4929),g={network:f.bitcoin,maximumFeeRate:5e3};class b{static fromBase64(e,t={}){const r=n.from(e,"base64");return this.fromBuffer(r,t)}static fromHex(e,t={}){const r=n.from(e,"hex");return this.fromBuffer(r,t)}static fromBuffer(e,t={}){const r=i.Psbt.fromBuffer(e,m),n=new b(t,r);var o,a;return o=n.__CACHE.__TX,a=n.__CACHE,o.ins.forEach((e=>{P(a,e)})),n}constructor(e={},t=new i.Psbt(new v)){this.data=t,this.opts=Object.assign({},g,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(e,t,r,n)=>Object.defineProperty(e,t,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:(0,u.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=(0,s.fromOutputScript)(e.script,this.opts.network)}catch(e){}return{script:(0,u.cloneBuffer)(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=b.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){k(e),this.opts.maximumFeeRate=e}setVersion(e){k(e),A(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){k(e),A(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){k(t),A(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=e)throw new Error("Input index too high");return r.__TX.ins[e].sequence=t,r.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");(0,p.checkTaprootInputFields)(e,e,"addInput"),A(this.data.inputs,"addInput"),e.witnessScript&&Z(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),P(t,t.__TX.ins[t.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&H(this.__CACHE,n,r),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");A(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:r}=this.opts,n=(0,s.toOutputScript)(t,r);e=Object.assign(e,{script:n})}(0,p.checkTaprootOutputFields)(e,e,"addOutput");const r=this.__CACHE;return this.data.addOutput(e),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(E))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,r){const n=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${n} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const r=t.__TX.clone();return K(this.data.inputs,r,t,!0),r}getFeeRate(){return N("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return N("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,a.checkForInput)(this.data.inputs,0),X(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t){const r=(0,a.checkForInput)(this.data.inputs,e);return(0,p.isTaprootInput)(r)?this._finalizeTaprootInput(e,r,void 0,t):this._finalizeInput(e,r,t)}finalizeTaprootInput(e,t,r=p.tapScriptFinalizer){const n=(0,a.checkForInput)(this.data.inputs,e);if((0,p.isTaprootInput)(n))return this._finalizeTaprootInput(e,n,t,r);throw new Error(`Cannot finalize input #${e}. Not Taproot.`)}_finalizeInput(e,t,r=M){const{script:n,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=G(r,t,e),a=n.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||(0,y.isP2WPKH)(i.script))&&(i.isSegwit=!0),i}(e,t,this.__CACHE);if(!n)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:r}=e;t.forEach((e=>{const{hashType:t}=h.signature.decode(e.signature);if(r!==t)throw new Error("Signature sighash does not match input sighash type")}))}(t);const{finalScriptSig:s,finalScriptWitness:u}=r(e,t,n,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),u&&this.data.updateInput(e,{finalScriptWitness:u}),!s&&!u)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}_finalizeTaprootInput(e,t,r,n=p.tapScriptFinalizer){if(!t.witnessUtxo)throw new Error(`Cannot finalize input #${e}. Missing withness utxo.`);if(t.tapKeySig){const r=c.p2tr({output:t.witnessUtxo.script,signature:t.tapKeySig}),n=(0,y.witnessStackToScriptWitness)(r.witness);this.data.updateInput(e,{finalScriptWitness:n})}else{const{finalScriptWitness:i}=n(e,t,r);this.data.updateInput(e,{finalScriptWitness:i})}return this.data.clearFinalizedInput(e),this}getInputType(e){const t=(0,a.checkForInput)(this.data.inputs,e),r=q(W(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=h.decompile(e);if(!t)return;const r=t[t.length-1];var i;if(n.isBuffer(r)&&!z(r)&&(i=r,!h.isCanonicalScriptSignature(i))&&h.decompile(r))return r}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=F(e),r=t[t.length-1];return!z(r)&&h.decompile(r)?r:void 0}(t.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+$(r.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,r,n){const i=W(r,t,n),{meaningfulScript:o}=q(i,r,"input",t.redeemScript,t.witnessScript);return(0,y.pubkeyInScript)(e,o)}(t,(0,a.checkForInput)(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const r=(0,a.checkForInput)(this.data.inputs,e),n=S(t);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(e,t){return function(e,t,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=q(i,r,"output",t.redeemScript,t.witnessScript);return(0,y.pubkeyInScript)(e,o)}(t,(0,a.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const r=(0,a.checkForOutput)(this.data.outputs,e),n=S(t);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(e){return(0,a.checkForInput)(this.data.inputs,0),X(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t,e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t,r){const n=this.data.inputs[e];return(0,p.isTaprootInput)(n)?this.validateSignaturesOfTaprootInput(e,t,r):this._validateSignaturesOfInput(e,t,r)}_validateSignaturesOfInput(e,t,r){const n=this.data.inputs[e],i=(n||{}).partialSig;if(!n||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const o=r?i.filter((e=>e.pubkey.equals(r))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const a=[];let s,u,f;for(const r of o){const i=h.signature.decode(r.signature),{hash:o,script:c}=f!==i.hashType?B(e,Object.assign({},n,{sighashType:i.hashType}),this.__CACHE,!0):{hash:s,script:u};f=i.hashType,s=o,u=c,T(r.pubkey,c,"verify"),a.push(t(r.pubkey,o,i.signature))}return a.every((e=>!0===e))}validateSignaturesOfTaprootInput(e,t,r){const n=this.data.inputs[e],i=(n||{}).tapKeySig,o=(n||{}).tapScriptSig;if(!n&&!i&&(!o||o.length))throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const a=(r=r&&(0,p.toXOnly)(r))?U(e,n,this.data.inputs,r,this.__CACHE):function(e,t,r,n){const i=[];if(t.tapInternalKey){const r=L(e,t,n);r&&i.push(r)}if(t.tapScriptSig){const e=t.tapScriptSig.map((e=>e.pubkey));i.push(...e)}return i.map((i=>U(e,t,r,i,n))).flat()}(e,n,this.data.inputs,this.__CACHE);if(!a.length)throw new Error("No signatures for this pubkey");const s=a.find((e=>!e.leafHash));let u=0;if(i&&s){if(!t(s.pubkey,s.hash,C(i)))return!1;u++}if(o)for(const e of o){const r=a.find((t=>e.pubkey.equals(t.pubkey)));if(r){if(!t(e.pubkey,r.hash,C(e.signature)))return!1;u++}}return u>0}signAllInputsHD(e,t=[d.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of X(this.data.inputs.length))try{this.signInputHD(n,e,t),r.push(!0)}catch(e){r.push(!1)}if(r.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[d.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!e||!e.publicKey||!e.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of X(this.data.inputs.length))o.push(this.signInputHDAsync(r,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(e,t,r=[d.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return D(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,r))),this}signInputHDAsync(e,t,r=[d.Transaction.SIGHASH_ALL]){return new Promise(((n,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=D(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(e,t){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of X(this.data.inputs.length))try{this.signInput(n,e,t),r.push(!0)}catch(e){r.push(!1)}if(r.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t){return new Promise(((r,n)=>{if(!e||!e.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return n(new Error("No inputs were signed"));r()}))}))}signInput(e,t,r){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const n=(0,a.checkForInput)(this.data.inputs,e);return(0,p.isTaprootInput)(n)?this._signTaprootInput(e,n,t,void 0,r):this._signInput(e,t,r)}signTaprootInput(e,t,r,n){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const i=(0,a.checkForInput)(this.data.inputs,e);if((0,p.isTaprootInput)(i))return this._signTaprootInput(e,i,t,r,n);throw new Error(`Input #${e} is not of type Taproot.`)}_signInput(e,t,r=[d.Transaction.SIGHASH_ALL]){const{hash:n,sighashType:i}=R(this.data.inputs,e,t.publicKey,this.__CACHE,r),o=[{pubkey:t.publicKey,signature:h.signature.encode(t.sign(n),i)}];return this.data.updateInput(e,{partialSig:o}),this}_signTaprootInput(e,t,r,n,i=[d.Transaction.SIGHASH_DEFAULT]){const o=this.checkTaprootHashesForSig(e,t,r,n,i),a=o.filter((e=>!e.leafHash)).map((e=>(0,p.serializeTaprootSignature)(r.signSchnorr(e.hash),t.sighashType)))[0],s=o.filter((e=>!!e.leafHash)).map((e=>({pubkey:(0,p.toXOnly)(r.publicKey),signature:(0,p.serializeTaprootSignature)(r.signSchnorr(e.hash),t.sighashType),leafHash:e.leafHash})));return a&&this.data.updateInput(e,{tapKeySig:a}),s.length&&this.data.updateInput(e,{tapScriptSig:s}),this}signInputAsync(e,t,r){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const n=(0,a.checkForInput)(this.data.inputs,e);return(0,p.isTaprootInput)(n)?this._signTaprootInputAsync(e,n,t,void 0,r):this._signInputAsync(e,t,r)}))}signTaprootInputAsync(e,t,r,n){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const i=(0,a.checkForInput)(this.data.inputs,e);if((0,p.isTaprootInput)(i))return this._signTaprootInputAsync(e,i,t,r,n);throw new Error(`Input #${e} is not of type Taproot.`)}))}_signInputAsync(e,t,r=[d.Transaction.SIGHASH_ALL]){const{hash:n,sighashType:i}=R(this.data.inputs,e,t.publicKey,this.__CACHE,r);return Promise.resolve(t.sign(n)).then((r=>{const n=[{pubkey:t.publicKey,signature:h.signature.encode(r,i)}];this.data.updateInput(e,{partialSig:n})}))}async _signTaprootInputAsync(e,t,r,n,i=[d.Transaction.SIGHASH_DEFAULT]){const o=this.checkTaprootHashesForSig(e,t,r,n,i),a=[],s=o.filter((e=>!e.leafHash))[0];if(s){const e=Promise.resolve(r.signSchnorr(s.hash)).then((e=>({tapKeySig:(0,p.serializeTaprootSignature)(e,t.sighashType)})));a.push(e)}const u=o.filter((e=>!!e.leafHash));if(u.length){const e=u.map((e=>Promise.resolve(r.signSchnorr(e.hash)).then((n=>({tapScriptSig:[{pubkey:(0,p.toXOnly)(r.publicKey),signature:(0,p.serializeTaprootSignature)(n,t.sighashType),leafHash:e.leafHash}]})))));a.push(...e)}return Promise.all(a).then((t=>{t.forEach((t=>this.data.updateInput(e,t)))}))}checkTaprootHashesForSig(e,t,r,n,i){if("function"!=typeof r.signSchnorr)throw new Error(`Need Schnorr Signer to sign taproot input #${e}.`);const o=U(e,t,this.data.inputs,r.publicKey,this.__CACHE,n,i);if(!o||!o.length)throw new Error(`Can not sign for input #${e} with the key ${r.publicKey.toString("hex")}`);return o}toBuffer(){return w(this.__CACHE),this.data.toBuffer()}toHex(){return w(this.__CACHE),this.data.toHex()}toBase64(){return w(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&Z(t.witnessScript),(0,p.checkTaprootInputFields)(this.data.inputs[e],t,"updateInput"),this.data.updateInput(e,t),t.nonWitnessUtxo&&H(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){const r=this.data.outputs[e];return(0,p.checkTaprootOutputFields)(r,t,"updateOutput"),this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}t.Psbt=b;const m=e=>new v(e);class v{constructor(e=n.from([2,0,0,0,0,0,0,0,0,0])){this.tx=d.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!n.isBuffer(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?(0,u.reverseBuffer)(n.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!n.isBuffer(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function w(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function _(e,t,r){if(!t)return!1;let n;if(n=r?r.map((e=>{const r=function(e){if(65===e.length){const t=1&e[64],r=e.slice(0,33);return r[0]=2|t,r}return e.slice()}(e);return t.find((e=>e.pubkey.equals(r)))})).filter((e=>!!e)):t,n.length>e)throw new Error("Too many signatures");return n.length===e}function E(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function S(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function k(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function A(e,t){e.forEach((e=>{if((0,p.isTaprootInput)(e)?(0,p.checkTaprootInputForSigs)(e,t):(0,y.checkInputForSig)(e,t))throw new Error("Can not modify transaction, signatures exist.")}))}function T(e,t,r){if(!(0,y.pubkeyInScript)(e,t))throw new Error(`Can not ${r} for this input with the key ${e.toString("hex")}`)}function P(e,t){const r=(0,u.reverseBuffer)(n.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[r]=1}function O(e,t){return(r,n,i,o)=>{const a=e({redeem:{output:i}}).output;if(!n.equals(a))throw new Error(`${t} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const I=O(c.p2sh,"Redeem script"),x=O(c.p2wsh,"Witness script");function N(e,t,r,n){if(!r.every(E))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===e&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),K(r,i,n,o),"__FEE_RATE"===e?n.__FEE_RATE:"__FEE"===e?n.__FEE:void 0}function M(e,t,r,n,i,o){const a=$(r);if(!function(e,t,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return _(1,e.partialSig);case"multisig":const r=c.p2ms({output:t});return _(r.m,e.partialSig,r.pubkeys);default:return!1}}(t,r,a))throw new Error(`Can not finalize input #${e}`);return function(e,t,r,n,i,o){let a,s;const u=function(e,t,r){let n;switch(t){case"multisig":const t=function(e,t){return c.p2ms({output:e}).pubkeys.map((e=>(t.filter((t=>t.pubkey.equals(e)))[0]||{}).signature)).filter((e=>!!e))}(e,r);n=c.p2ms({output:e,signatures:t});break;case"pubkey":n=c.p2pk({output:e,signature:r[0].signature});break;case"pubkeyhash":n=c.p2pkh({output:e,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=c.p2wpkh({output:e,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(e,t,r),f=o?c.p2wsh({redeem:u}):null,l=i?c.p2sh({redeem:f||u}):null;return n?(s=f?(0,y.witnessStackToScriptWitness)(f.witness):(0,y.witnessStackToScriptWitness)(u.witness),l&&(a=l.input)):a=l?l.input:u.input,{finalScriptSig:a,finalScriptWitness:s}}(r,a,t.partialSig,n,i,o)}function R(e,t,r,n,i){const o=(0,a.checkForInput)(e,t),{hash:s,sighashType:u,script:f}=B(t,o,n,!1,i);return T(r,f,"sign"),{hash:s,sighashType:u}}function B(e,t,r,n,i){const o=r.__TX,a=t.sighashType||d.Transaction.SIGHASH_ALL;let s,u;if(j(a,i),t.nonWitnessUtxo){const n=G(r,t,e),i=o.ins[e].hash,a=n.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;u=n.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=t.witnessUtxo}const{meaningfulScript:f,type:l}=q(u.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(l)>=0)s=o.hashForWitnessV0(e,f,u.value,a);else if((0,y.isP2WPKH)(f)){const t=c.p2pkh({hash:f.slice(2)}).output;s=o.hashForWitnessV0(e,t,u.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${f.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecessor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,f,a)}return{script:f,sighashType:a,hash:s}}function L(e,t,r){const{script:n}=V(e,t,r);return(0,y.isP2TR)(n)?n.subarray(2,34):null}function C(e){return 64===e.length?e:e.subarray(0,64)}function U(e,t,r,i,o,a,s){const u=o.__TX,f=t.sighashType||d.Transaction.SIGHASH_DEFAULT;j(f,s);const c=r.map(((e,t)=>V(t,e,o))),h=c.map((e=>e.script)),g=c.map((e=>e.value)),b=[];if(t.tapInternalKey&&!a){const r=L(e,t,o)||n.from([]);if((0,p.toXOnly)(i).equals(r)){const t=u.hashForWitnessV1(e,h,g,f);b.push({pubkey:i,hash:t})}}const m=(t.tapLeafScript||[]).filter((e=>(0,y.pubkeyInScript)(i,e.script))).map((e=>{const t=(0,l.tapleafHash)({output:e.script,version:e.leafVersion});return Object.assign({hash:t},e)})).filter((e=>!a||a.equals(e.hash))).map((t=>{const r=u.hashForWitnessV1(e,h,g,d.Transaction.SIGHASH_DEFAULT,t.hash);return{pubkey:i,hash:r,leafHash:t.hash}}));return b.concat(m)}function j(e,t){if(t&&t.indexOf(e)<0){const t=function(e){let t=e&d.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case d.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case d.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case d.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(e);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${t}`)}}function D(e,t,r){const n=(0,a.checkForInput)(t,e);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((e=>e.masterFingerprint.equals(r.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((e=>{const t=r.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}))}function F(e){let t=0;function r(){const r=o.decode(e,t);return t+=o.decode.bytes,r}return function(){const n=r(),i=[];for(let a=0;a<n;a++)i.push((o=void 0,o=r(),t+=o,e.slice(t-o,t)));var o;return i}()}function H(e,t,r){e.__NON_WITNESS_UTXO_BUF_CACHE[r]=t.nonWitnessUtxo;const n=d.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=e,o=r;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function K(e,t,r,n){let i=0;e.forEach(((e,o)=>{if(n&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),n&&e.finalScriptWitness&&(t.ins[o].witness=F(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const n=G(r,e,o),a=t.ins[o].index,s=n.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();r.__FEE=a,r.__EXTRACTED_TX=t,r.__FEE_RATE=Math.floor(a/s)}function G(e,t,r){const n=e.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||H(e,t,r),n[r]}function W(e,t,r){const{script:n}=V(e,t,r);return n}function V(e,t,r){if(void 0!==t.witnessUtxo)return{script:t.witnessUtxo.script,value:t.witnessUtxo.value};if(void 0!==t.nonWitnessUtxo){const n=G(r,t,e).outs[r.__TX.ins[e].index];return{script:n.script,value:n.value}}throw new Error("Can't find pubkey in input without Utxo data")}function z(e){return 33===e.length&&h.isCanonicalPubKey(e)}function q(e,t,r,n,i){const o=(0,y.isP2SHScript)(e),a=o&&n&&(0,y.isP2WSHScript)(n),s=(0,y.isP2WSHScript)(e);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return a?(u=i,I(t,e,n,r),x(t,n,i,r),Z(u)):s?(u=i,x(t,e,i,r),Z(u)):o?(u=n,I(t,e,n,r)):u=e,{meaningfulScript:u,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function Z(e){if((0,y.isP2WPKH)(e)||(0,y.isP2SHScript)(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function $(e){return(0,y.isP2WPKH)(e)?"witnesspubkeyhash":(0,y.isP2PKH)(e)?"pubkeyhash":(0,y.isP2MS)(e)?"multisig":(0,y.isP2PK)(e)?"pubkey":"nonstandard"}function X(e){return[...Array(e).keys()]}},477:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.checkTaprootInputForSigs=t.tapTreeFromList=t.tapTreeToList=t.tweakInternalPubKey=t.checkTaprootOutputFields=t.checkTaprootInputFields=t.isTaprootOutput=t.isTaprootInput=t.serializeTaprootSignature=t.tapScriptFinalizer=t.toXOnly=void 0;const i=r(8116),o=r(2021),a=r(4929),s=r(2218),u=r(885),f=r(4929);function c(e){return e&&!!(e.tapInternalKey||e.tapMerkleRoot||e.tapLeafScript&&e.tapLeafScript.length||e.tapBip32Derivation&&e.tapBip32Derivation.length||e.witnessUtxo&&(0,a.isP2TR)(e.witnessUtxo.script))}function l(e,t){return e&&!!(e.tapInternalKey||e.tapTree||e.tapBip32Derivation&&e.tapBip32Derivation.length||t&&(0,a.isP2TR)(t))}function h(e=[]){return 1===e.length&&0===e[0].depth?{output:e[0].script,version:e[0].leafVersion}:function(e){let t;for(const r of e)if(t=y(r,t),!t)throw new Error("No room left to insert tapleaf in tree");return t}(e)}function d(e){return{signature:e.slice(0,64),hashType:e.slice(64)[0]||o.Transaction.SIGHASH_DEFAULT}}function p(e,t=[],r=0){if(r>s.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");return e?(0,i.isTapleaf)(e)?(t.push({depth:r,leafVersion:e.version||s.LEAF_VERSION_TAPSCRIPT,script:e.output}),t):(e[0]&&p(e[0],t,r+1),e[1]&&p(e[1],t,r+1),t):[]}function y(e,t,r=0){if(r>s.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");if(e.depth===r)return t?void 0:{output:e.script,version:e.leafVersion};if((0,i.isTapleaf)(t))return;const n=y(e,t&&t[0],r+1);if(n)return[n,t&&t[1]];const o=y(e,t&&t[1],r+1);return o?[t&&t[0],o]:void 0}function g(e,t){if(!t)return!0;const r=(0,s.tapleafHash)({output:e.script,version:e.leafVersion});return(0,s.rootHashFromPath)(e.controlBlock,r).equals(t)}function b(e){return e&&!!(e.redeemScript||e.witnessScript||e.bip32Derivation&&e.bip32Derivation.length)}t.toXOnly=e=>32===e.length?e:e.slice(1,33),t.tapScriptFinalizer=function(e,t,r){const n=function(e,t,r){if(!e.tapScriptSig||!e.tapScriptSig.length)throw new Error(`Can not finalize taproot input #${t}. No tapleaf script signature provided.`);const n=(e.tapLeafScript||[]).sort(((e,t)=>e.controlBlock.length-t.controlBlock.length)).find((t=>function(e,t,r){const n=(0,s.tapleafHash)({output:e.script,version:e.leafVersion});return(!r||r.equals(n))&&void 0!==t.find((e=>e.leafHash.equals(n)))}(t,e.tapScriptSig,r)));if(!n)throw new Error(`Can not finalize taproot input #${t}. Signature for tapleaf script not found.`);return n}(t,e,r);try{const e=function(e,t){const r=(0,s.tapleafHash)({output:t.script,version:t.leafVersion});return(e.tapScriptSig||[]).filter((e=>e.leafHash.equals(r))).map((e=>function(e,t){return Object.assign({positionInScript:(0,a.pubkeyPositionInScript)(t.pubkey,e)},t)}(t.script,e))).sort(((e,t)=>t.positionInScript-e.positionInScript)).map((e=>e.signature))}(t,n),r=e.concat(n.script).concat(n.controlBlock);return{finalScriptWitness:(0,a.witnessStackToScriptWitness)(r)}}catch(t){throw new Error(`Can not finalize taproot input #${e}: ${t}`)}},t.serializeTaprootSignature=function(e,t){const r=t?n.from([t]):n.from([]);return n.concat([e,r])},t.isTaprootInput=c,t.isTaprootOutput=l,t.checkTaprootInputFields=function(e,t,r){!function(e,t,r){const n=c(e)&&b(t),i=b(e)&&c(t),o=e===t&&c(t)&&b(t);if(n||i||o)throw new Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)}(e,t,r),function(e,t,r){if(t.tapMerkleRoot){const n=(t.tapLeafScript||[]).every((e=>g(e,t.tapMerkleRoot))),i=(e.tapLeafScript||[]).every((e=>g(e,t.tapMerkleRoot)));if(!n||!i)throw new Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}else if(e.tapMerkleRoot&&!(t.tapLeafScript||[]).every((t=>g(t,e.tapMerkleRoot))))throw new Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}(e,t,r)},t.checkTaprootOutputFields=function(e,t,r){!function(e,t,r){const n=l(e)&&b(t),i=b(e)&&l(t),o=e===t&&l(t)&&b(t);if(n||i||o)throw new Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)}(e,t,r),function(e,t){if(!t.tapTree&&!t.tapInternalKey)return;const r=t.tapInternalKey||e.tapInternalKey,n=t.tapTree||e.tapTree;if(r){const{script:t}=e,i=function(e,t){const r=t&&h(t.leaves),{output:n}=(0,u.p2tr)({internalPubkey:e,scriptTree:r});return n}(r,n);if(t&&!t.equals(i))throw new Error("Error adding output. Script or address missmatch.")}}(e,t)},t.tweakInternalPubKey=function(e,t){const r=t.tapInternalKey,n=r&&(0,s.tweakKey)(r,t.tapMerkleRoot);if(!n)throw new Error(`Cannot tweak tap internal key for input #${e}. Public key: ${r&&r.toString("hex")}`);return n.x},t.tapTreeToList=function(e){if(!(0,i.isTaptree)(e))throw new Error("Cannot convert taptree to tapleaf list. Expecting a tapree structure.");return p(e)},t.tapTreeFromList=h,t.checkTaprootInputForSigs=function(e,t){return function(e){const t=[];if(e.tapKeySig&&t.push(e.tapKeySig),e.tapScriptSig&&t.push(...e.tapScriptSig.map((e=>e.signature))),!t.length){const r=function(e){if(!e)return;const t=e.slice(2);return 64===t.length||65===t.length?t:void 0}(e.finalScriptWitness);r&&t.push(r)}return t}(e).some((e=>(0,f.signatureBlocksAction)(e,d,t)))}},4929:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.signatureBlocksAction=t.checkInputForSig=t.pubkeyInScript=t.pubkeyPositionInScript=t.witnessStackToScriptWitness=t.isP2TR=t.isP2SHScript=t.isP2WSHScript=t.isP2WPKH=t.isP2PKH=t.isP2PK=t.isP2MS=void 0;const i=r(394),o=r(7038),a=r(2021),s=r(1944),u=r(885);function f(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}function c(e,t){const r=(0,s.hash160)(e),n=e.slice(1,33),i=o.decompile(t);if(null===i)throw new Error("Unknown script error");return i.findIndex((t=>"number"!=typeof t&&(t.equals(e)||t.equals(r)||t.equals(n))))}function l(e,t,r){const{hashType:n}=t(e),i=[];switch(n&a.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&n){case a.Transaction.SIGHASH_ALL:break;case a.Transaction.SIGHASH_SINGLE:case a.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}return-1===i.indexOf(r)}t.isP2MS=f(u.p2ms),t.isP2PK=f(u.p2pk),t.isP2PKH=f(u.p2pkh),t.isP2WPKH=f(u.p2wpkh),t.isP2WSHScript=f(u.p2wsh),t.isP2SHScript=f(u.p2sh),t.isP2TR=f(u.p2tr),t.witnessStackToScriptWitness=function(e){let t=n.allocUnsafe(0);function r(e){const r=t.length,o=i.encodingLength(e);t=n.concat([t,n.allocUnsafe(o)]),i.encode(e,t,r)}var o;return r((o=e).length),o.forEach((function(e){r(e.length),function(e){t=n.concat([t,n.from(e)])}(e)})),t},t.pubkeyPositionInScript=c,t.pubkeyInScript=function(e,t){return-1!==c(e,t)},t.checkInputForSig=function(e,t){return function(e){let t=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return[];t=function(e){const t=e.finalScriptSig&&o.decompile(e.finalScriptSig)||[],r=e.finalScriptWitness&&o.decompile(e.finalScriptWitness)||[];return t.concat(r).filter((e=>n.isBuffer(e)&&o.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else t=e.partialSig;return t.map((e=>e.signature))}(e).some((e=>l(e,o.signature.decode,t)))},t.signatureBlocksAction=l},4344:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodingLength=void 0;const n=r(8417);function i(e){return e<n.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}t.encodingLength=i,t.encode=function(e,t,r){const o=i(t);return 1===o?e.writeUInt8(t,r):2===o?(e.writeUInt8(n.OPS.OP_PUSHDATA1,r),e.writeUInt8(t,r+1)):3===o?(e.writeUInt8(n.OPS.OP_PUSHDATA2,r),e.writeUInt16LE(t,r+1)):(e.writeUInt8(n.OPS.OP_PUSHDATA4,r),e.writeUInt32LE(t,r+1)),o},t.decode=function(e,t){const r=e.readUInt8(t);let i,o;if(r<n.OPS.OP_PUSHDATA1)i=r,o=1;else if(r===n.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;i=e.readUInt8(t+1),o=2}else if(r===n.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;i=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==n.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=e.readUInt32LE(t+1),o=5}return{opcode:r,number:i,size:o}}},7038:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.signature=t.number=t.isCanonicalScriptSignature=t.isDefinedHashType=t.isCanonicalPubKey=t.toStack=t.fromASM=t.toASM=t.decompile=t.compile=t.countNonPushOnlyOPs=t.isPushOnly=t.OPS=void 0;const i=r(3966),o=r(8417);Object.defineProperty(t,"OPS",{enumerable:!0,get:function(){return o.OPS}});const a=r(4344),s=r(9464),u=r(1043),f=r(8116),{typeforce:c}=f,l=o.OPS.OP_RESERVED;function h(e){return f.Buffer(e)||function(e){return f.Number(e)&&(e===o.OPS.OP_0||e>=o.OPS.OP_1&&e<=o.OPS.OP_16||e===o.OPS.OP_1NEGATE)}(e)}function d(e){return f.Array(e)&&e.every(h)}function p(e){return 0===e.length?o.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?o.OPS.OP_1NEGATE:void 0:void 0}function y(e){return n.isBuffer(e)}function g(e){return n.isBuffer(e)}function b(e){if(y(e))return e;c(f.Array,e);const t=e.reduce(((e,t)=>g(t)?1===t.length&&void 0!==p(t)?e+1:e+a.encodingLength(t.length)+t.length:e+1),0),r=n.allocUnsafe(t);let i=0;if(e.forEach((e=>{if(g(e)){const t=p(e);if(void 0!==t)return r.writeUInt8(t,i),void(i+=1);i+=a.encode(r,e.length,i),e.copy(r,i),i+=e.length}else r.writeUInt8(e,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function m(e){if(t=e,f.Array(t))return e;var t;c(f.Buffer,e);const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t>o.OPS.OP_0&&t<=o.OPS.OP_PUSHDATA4){const t=a.decode(e,n);if(null===t)return null;if(n+=t.size,n+t.number>e.length)return null;const i=e.slice(n,n+t.number);n+=t.number;const o=p(i);void 0!==o?r.push(o):r.push(i)}else r.push(t),n+=1}return r}function v(e){const t=-129&e;return t>0&&t<4}t.isPushOnly=d,t.countNonPushOnlyOPs=function(e){return e.length-e.filter(h).length},t.compile=b,t.decompile=m,t.toASM=function(e){return y(e)&&(e=m(e)),e.map((e=>{if(g(e)){const t=p(e);if(void 0===t)return e.toString("hex");e=t}return o.REVERSE_OPS[e]})).join(" ")},t.fromASM=function(e){return c(f.String,e),b(e.split(" ").map((e=>void 0!==o.OPS[e]?o.OPS[e]:(c(f.Hex,e),n.from(e,"hex")))))},t.toStack=function(e){return e=m(e),c(d,e),e.map((e=>g(e)?e:e===o.OPS.OP_0?n.allocUnsafe(0):s.encode(e-l)))},t.isCanonicalPubKey=function(e){return f.isPoint(e)},t.isDefinedHashType=v,t.isCanonicalScriptSignature=function(e){return!!n.isBuffer(e)&&!!v(e[e.length-1])&&i.check(e.slice(0,-1))},t.number=s,t.signature=u},9464:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decode=void 0,t.decode=function(e,t,r){t=t||4,r=void 0===r||r;const n=e.length;if(0===n)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&!(127&e[n-1]||!(n<=1)&&128&e[n-2]))throw new Error("Non-minimally encoded script number");if(5===n){const t=e.readUInt32LE(0),r=e.readUInt8(4);return 128&r?-(4294967296*(-129&r)+t):4294967296*r+t}let i=0;for(let t=0;t<n;++t)i|=e[t]<<8*t;return 128&e[n-1]?-(i&~(128<<8*(n-1))):i},t.encode=function(e){let t=Math.abs(e);const r=(i=t)>2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=n.allocUnsafe(r),a=e<0;for(let e=0;e<r;++e)o.writeUInt8(255&t,e),t>>=8;return 128&o[r-1]?o.writeUInt8(a?128:0,r-1):a&&(o[r-1]|=128),o}},1043:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decode=void 0;const i=r(3966),o=r(7038),a=r(8116),{typeforce:s}=a,u=n.alloc(1,0);function f(e){let t=0;for(;0===e[t];)++t;return t===e.length?u:128&(e=e.slice(t))[0]?n.concat([u,e],1+e.length):e}function c(e){0===e[0]&&(e=e.slice(1));const t=n.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}t.decode=function(e){const t=e.readUInt8(e.length-1);if(!(0,o.isDefinedHashType)(t))throw new Error("Invalid hashType "+t);const r=i.decode(e.slice(0,-1)),a=c(r.r),s=c(r.s);return{signature:n.concat([a,s],64),hashType:t}},t.encode=function(e,t){if(s({signature:a.BufferN(64),hashType:a.UInt8},{signature:e,hashType:t}),!(0,o.isDefinedHashType)(t))throw new Error("Invalid hashType "+t);const r=n.allocUnsafe(1);r.writeUInt8(t,0);const u=f(e.slice(0,32)),c=f(e.slice(32,64));return n.concat([i.encode(u,c),r])}},2021:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Transaction=void 0;const i=r(606),o=r(1944),a=r(7038),s=r(7038),u=r(8116),{typeforce:f}=u;function c(e){const t=e.length;return i.varuint.encodingLength(t)+t}const l=n.allocUnsafe(0),h=[],d=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),p=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),y=n.from("ffffffffffffffff","hex"),g={script:l,valueBuffer:y};class b{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const r=new i.BufferReader(e),n=new b;n.version=r.readInt32();const o=r.readUInt8(),a=r.readUInt8();let s=!1;o===b.ADVANCED_TRANSACTION_MARKER&&a===b.ADVANCED_TRANSACTION_FLAG?s=!0:r.offset-=2;const u=r.readVarInt();for(let e=0;e<u;++e)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:h});const f=r.readVarInt();for(let e=0;e<f;++e)n.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(s){for(let e=0;e<u;++e)n.ins[e].witness=r.readVector();if(!n.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),t)return n;if(r.offset!==e.length)throw new Error("Transaction has unexpected data");return n}static fromHex(e){return b.fromBuffer(n.from(e,"hex"),!1)}static isCoinbaseHash(e){f(u.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&b.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,r,n){return f(u.tuple(u.Hash256bit,u.UInt32,u.maybe(u.UInt32),u.maybe(u.Buffer)),arguments),u.Null(r)&&(r=b.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:n||l,sequence:r,witness:h})-1}addOutput(e,t){return f(u.tuple(u.Buffer,u.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+i.varuint.encodingLength(this.ins.length)+i.varuint.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+c(t.script)),0)+this.outs.reduce(((e,t)=>e+8+c(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return i.varuint.encodingLength(t)+e.reduce(((e,t)=>e+c(t)),0)}(t.witness)),0):0)}clone(){const e=new b;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,r){if(f(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),e>=this.ins.length)return p;const i=a.compile(a.decompile(t).filter((e=>e!==s.OPS.OP_CODESEPARATOR))),c=this.clone();if((31&r)===b.SIGHASH_NONE)c.outs=[],c.ins.forEach(((t,r)=>{r!==e&&(t.sequence=0)}));else if((31&r)===b.SIGHASH_SINGLE){if(e>=this.outs.length)return p;c.outs.length=e+1;for(let t=0;t<e;t++)c.outs[t]=g;c.ins.forEach(((t,r)=>{r!==e&&(t.sequence=0)}))}r&b.SIGHASH_ANYONECANPAY?(c.ins=[c.ins[e]],c.ins[0].script=i):(c.ins.forEach((e=>{e.script=l})),c.ins[e].script=i);const h=n.allocUnsafe(c.byteLength(!1)+4);return h.writeInt32LE(r,h.length-4),c.__toBuffer(h,0,!1),o.hash256(h)}hashForWitnessV1(e,t,r,a,s,h){if(f(u.tuple(u.UInt32,f.arrayOf(u.Buffer),f.arrayOf(u.Satoshi),u.UInt32),arguments),r.length!==this.ins.length||t.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const d=a===b.SIGHASH_DEFAULT?b.SIGHASH_ALL:a&b.SIGHASH_OUTPUT_MASK,p=(a&b.SIGHASH_INPUT_MASK)===b.SIGHASH_ANYONECANPAY,y=d===b.SIGHASH_NONE,g=d===b.SIGHASH_SINGLE;let m=l,v=l,w=l,_=l,E=l;if(!p){let e=i.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)})),m=o.sha256(e.end()),e=i.BufferWriter.withCapacity(8*this.ins.length),r.forEach((t=>e.writeUInt64(t))),v=o.sha256(e.end()),e=i.BufferWriter.withCapacity(t.map(c).reduce(((e,t)=>e+t))),t.forEach((t=>e.writeVarSlice(t))),w=o.sha256(e.end()),e=i.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((t=>e.writeUInt32(t.sequence))),_=o.sha256(e.end())}if(y||g){if(g&&e<this.outs.length){const t=this.outs[e],r=i.BufferWriter.withCapacity(8+c(t.script));r.writeUInt64(t.value),r.writeVarSlice(t.script),E=o.sha256(r.end())}}else{const e=this.outs.map((e=>8+c(e.script))).reduce(((e,t)=>e+t)),t=i.BufferWriter.withCapacity(e);this.outs.forEach((e=>{t.writeUInt64(e.value),t.writeVarSlice(e.script)})),E=o.sha256(t.end())}const S=(s?2:0)+(h?1:0),k=174-(p?49:0)-(y?32:0)+(h?32:0)+(s?37:0),A=i.BufferWriter.withCapacity(k);if(A.writeUInt8(a),A.writeInt32(this.version),A.writeUInt32(this.locktime),A.writeSlice(m),A.writeSlice(v),A.writeSlice(w),A.writeSlice(_),y||g||A.writeSlice(E),A.writeUInt8(S),p){const n=this.ins[e];A.writeSlice(n.hash),A.writeUInt32(n.index),A.writeUInt64(r[e]),A.writeVarSlice(t[e]),A.writeUInt32(n.sequence)}else A.writeUInt32(e);if(h){const e=i.BufferWriter.withCapacity(c(h));e.writeVarSlice(h),A.writeSlice(o.sha256(e.end()))}return g&&A.writeSlice(E),s&&(A.writeSlice(s),A.writeUInt8(0),A.writeUInt32(4294967295)),o.taggedHash("TapSighash",n.concat([n.from([0]),A.end()]))}hashForWitnessV0(e,t,r,a){f(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let s,l=n.from([]),h=d,p=d,y=d;if(a&b.SIGHASH_ANYONECANPAY||(l=n.allocUnsafe(36*this.ins.length),s=new i.BufferWriter(l,0),this.ins.forEach((e=>{s.writeSlice(e.hash),s.writeUInt32(e.index)})),p=o.hash256(l)),a&b.SIGHASH_ANYONECANPAY||(31&a)===b.SIGHASH_SINGLE||(31&a)===b.SIGHASH_NONE||(l=n.allocUnsafe(4*this.ins.length),s=new i.BufferWriter(l,0),this.ins.forEach((e=>{s.writeUInt32(e.sequence)})),y=o.hash256(l)),(31&a)!==b.SIGHASH_SINGLE&&(31&a)!==b.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+c(t.script)),0);l=n.allocUnsafe(e),s=new i.BufferWriter(l,0),this.outs.forEach((e=>{s.writeUInt64(e.value),s.writeVarSlice(e.script)})),h=o.hash256(l)}else if((31&a)===b.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];l=n.allocUnsafe(8+c(t.script)),s=new i.BufferWriter(l,0),s.writeUInt64(t.value),s.writeVarSlice(t.script),h=o.hash256(l)}l=n.allocUnsafe(156+c(t)),s=new i.BufferWriter(l,0);const g=this.ins[e];return s.writeInt32(this.version),s.writeSlice(p),s.writeSlice(y),s.writeSlice(g.hash),s.writeUInt32(g.index),s.writeVarSlice(t),s.writeUInt64(r),s.writeUInt32(g.sequence),s.writeSlice(h),s.writeUInt32(this.locktime),s.writeUInt32(a),o.hash256(l)}getHash(e){return e&&this.isCoinbase()?n.alloc(32,0):o.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return(0,i.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){f(u.tuple(u.Number,u.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){f(u.tuple(u.Number,[u.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,r=!1){e||(e=n.allocUnsafe(this.byteLength(r)));const o=new i.BufferWriter(e,t||0);o.writeInt32(this.version);const a=r&&this.hasWitnesses();return a&&(o.writeUInt8(b.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(b.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach((e=>{o.writeSlice(e.hash),o.writeUInt32(e.index),o.writeVarSlice(e.script),o.writeUInt32(e.sequence)})),o.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?o.writeUInt64(e.value):o.writeSlice(e.valueBuffer),o.writeVarSlice(e.script)})),a&&this.ins.forEach((e=>{o.writeVector(e.witness)})),o.writeUInt32(this.locktime),void 0!==t?e.slice(t,o.offset):e}}t.Transaction=b,b.DEFAULT_SEQUENCE=4294967295,b.SIGHASH_DEFAULT=0,b.SIGHASH_ALL=1,b.SIGHASH_NONE=2,b.SIGHASH_SINGLE=3,b.SIGHASH_ANYONECANPAY=128,b.SIGHASH_OUTPUT_MASK=3,b.SIGHASH_INPUT_MASK=128,b.ADVANCED_TRANSACTION_MARKER=0,b.ADVANCED_TRANSACTION_FLAG=1},8116:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.oneOf=t.Null=t.BufferN=t.Function=t.UInt32=t.UInt8=t.tuple=t.maybe=t.Hex=t.Buffer=t.String=t.Boolean=t.Array=t.Number=t.Hash256bit=t.Hash160bit=t.Buffer256bit=t.isTaptree=t.isTapleaf=t.TAPLEAF_VERSION_MASK=t.Satoshi=t.isPoint=t.stacksEqual=t.typeforce=void 0;const n=r(8287);t.typeforce=r(8676);const i=n.Buffer.alloc(32,0),o=n.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");function a(e){return!(!e||!("output"in e)||!n.Buffer.isBuffer(e.output)||void 0!==e.version&&(e.version&t.TAPLEAF_VERSION_MASK)!==e.version)}t.stacksEqual=function(e,t){return e.length===t.length&&e.every(((e,r)=>e.equals(t[r])))},t.isPoint=function(e){if(!n.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;const t=e[0],r=e.slice(1,33);if(0===r.compare(i))return!1;if(r.compare(o)>=0)return!1;if((2===t||3===t)&&33===e.length)return!0;const a=e.slice(33);return 0!==a.compare(i)&&!(a.compare(o)>=0)&&4===t&&65===e.length},t.Satoshi=function(e){return t.typeforce.UInt53(e)&&e<=21e14},t.TAPLEAF_VERSION_MASK=254,t.isTapleaf=a,t.isTaptree=function e(r){return(0,t.Array)(r)?2===r.length&&r.every((t=>e(t))):a(r)},t.Buffer256bit=t.typeforce.BufferN(32),t.Hash160bit=t.typeforce.BufferN(20),t.Hash256bit=t.typeforce.BufferN(32),t.Number=t.typeforce.Number,t.Array=t.typeforce.Array,t.Boolean=t.typeforce.Boolean,t.String=t.typeforce.String,t.Buffer=t.typeforce.Buffer,t.Hex=t.typeforce.Hex,t.maybe=t.typeforce.maybe,t.tuple=t.typeforce.tuple,t.UInt8=t.typeforce.UInt8,t.UInt32=t.typeforce.UInt32,t.Function=t.typeforce.Function,t.BufferN=t.typeforce.BufferN,t.Null=t.typeforce.Null,t.oneOf=t.typeforce.oneOf},5974:(e,t,r)=>{var n=r(8287).Buffer,i=r(3184),o=r(4148),a=r(4442),s=r(8411),u=r(1447),f=r(9681);for(var c in f)t[c]=f[c];function l(e){if("number"!=typeof e||e<t.DEFLATE||e>t.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=e,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}t.NONE=0,t.DEFLATE=1,t.INFLATE=2,t.GZIP=3,t.GUNZIP=4,t.DEFLATERAW=5,t.INFLATERAW=6,t.UNZIP=7,l.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,o(this.init_done,"close before init"),o(this.mode<=t.UNZIP),this.mode===t.DEFLATE||this.mode===t.GZIP||this.mode===t.DEFLATERAW?s.deflateEnd(this.strm):this.mode!==t.INFLATE&&this.mode!==t.GUNZIP&&this.mode!==t.INFLATERAW&&this.mode!==t.UNZIP||u.inflateEnd(this.strm),this.mode=t.NONE,this.dictionary=null)},l.prototype.write=function(e,t,r,n,i,o,a){return this._write(!0,e,t,r,n,i,o,a)},l.prototype.writeSync=function(e,t,r,n,i,o,a){return this._write(!1,e,t,r,n,i,o,a)},l.prototype._write=function(e,r,a,s,u,f,c,l){if(o.equal(arguments.length,8),o(this.init_done,"write before init"),o(this.mode!==t.NONE,"already finalized"),o.equal(!1,this.write_in_progress,"write already in progress"),o.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,o.equal(!1,void 0===r,"must provide flush value"),this.write_in_progress=!0,r!==t.Z_NO_FLUSH&&r!==t.Z_PARTIAL_FLUSH&&r!==t.Z_SYNC_FLUSH&&r!==t.Z_FULL_FLUSH&&r!==t.Z_FINISH&&r!==t.Z_BLOCK)throw new Error("Invalid flush value");if(null==a&&(a=n.alloc(0),u=0,s=0),this.strm.avail_in=u,this.strm.input=a,this.strm.next_in=s,this.strm.avail_out=l,this.strm.output=f,this.strm.next_out=c,this.flush=r,!e)return this._process(),this._checkError()?this._afterSync():void 0;var h=this;return i.nextTick((function(){h._process(),h._after()})),this},l.prototype._afterSync=function(){var e=this.strm.avail_out,t=this.strm.avail_in;return this.write_in_progress=!1,[t,e]},l.prototype._process=function(){var e=null;switch(this.mode){case t.DEFLATE:case t.GZIP:case t.DEFLATERAW:this.err=s.deflate(this.strm,this.flush);break;case t.UNZIP:switch(this.strm.avail_in>0&&(e=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===e)break;if(31!==this.strm.input[e]){this.mode=t.INFLATE;break}if(this.gzip_id_bytes_read=1,e++,1===this.strm.avail_in)break;case 1:if(null===e)break;139===this.strm.input[e]?(this.gzip_id_bytes_read=2,this.mode=t.GUNZIP):this.mode=t.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case t.INFLATE:case t.GUNZIP:case t.INFLATERAW:for(this.err=u.inflate(this.strm,this.flush),this.err===t.Z_NEED_DICT&&this.dictionary&&(this.err=u.inflateSetDictionary(this.strm,this.dictionary),this.err===t.Z_OK?this.err=u.inflate(this.strm,this.flush):this.err===t.Z_DATA_ERROR&&(this.err=t.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===t.GUNZIP&&this.err===t.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=u.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},l.prototype._checkError=function(){switch(this.err){case t.Z_OK:case t.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===t.Z_FINISH)return this._error("unexpected end of file"),!1;break;case t.Z_STREAM_END:break;case t.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},l.prototype._after=function(){if(this._checkError()){var e=this.strm.avail_out,t=this.strm.avail_in;this.write_in_progress=!1,this.callback(t,e),this.pending_close&&this.close()}},l.prototype._error=function(e){this.strm.msg&&(e=this.strm.msg),this.onerror(e,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},l.prototype.init=function(e,r,n,i,a){o(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),o(e>=8&&e<=15,"invalid windowBits"),o(r>=-1&&r<=9,"invalid compression level"),o(n>=1&&n<=9,"invalid memlevel"),o(i===t.Z_FILTERED||i===t.Z_HUFFMAN_ONLY||i===t.Z_RLE||i===t.Z_FIXED||i===t.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(r,e,n,i,a),this._setDictionary()},l.prototype.params=function(){throw new Error("deflateParams Not supported")},l.prototype.reset=function(){this._reset(),this._setDictionary()},l.prototype._init=function(e,r,n,i,o){switch(this.level=e,this.windowBits=r,this.memLevel=n,this.strategy=i,this.flush=t.Z_NO_FLUSH,this.err=t.Z_OK,this.mode!==t.GZIP&&this.mode!==t.GUNZIP||(this.windowBits+=16),this.mode===t.UNZIP&&(this.windowBits+=32),this.mode!==t.DEFLATERAW&&this.mode!==t.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case t.DEFLATE:case t.GZIP:case t.DEFLATERAW:this.err=s.deflateInit2(this.strm,this.level,t.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case t.INFLATE:case t.GUNZIP:case t.INFLATERAW:case t.UNZIP:this.err=u.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==t.Z_OK&&this._error("Init error"),this.dictionary=o,this.write_in_progress=!1,this.init_done=!0},l.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=t.Z_OK,this.mode){case t.DEFLATE:case t.DEFLATERAW:this.err=s.deflateSetDictionary(this.strm,this.dictionary)}this.err!==t.Z_OK&&this._error("Failed to set dictionary")}},l.prototype._reset=function(){switch(this.err=t.Z_OK,this.mode){case t.DEFLATE:case t.DEFLATERAW:case t.GZIP:this.err=s.deflateReset(this.strm);break;case t.INFLATE:case t.INFLATERAW:case t.GUNZIP:this.err=u.inflateReset(this.strm)}this.err!==t.Z_OK&&this._error("Failed to reset stream")},t.Zlib=l},8559:(e,t,r)=>{var n=r(3184),i=r(8287).Buffer,o=r(8310).Transform,a=r(5974),s=r(537),u=r(4148).ok,f=r(8287).kMaxLength,c="Cannot create final Buffer. It would be larger than 0x"+f.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var l=Object.keys(a),h=0;h<l.length;h++){var d=l[h];d.match(/^Z/)&&Object.defineProperty(t,d,{enumerable:!0,value:a[d],writable:!1})}for(var p={Z_OK:a.Z_OK,Z_STREAM_END:a.Z_STREAM_END,Z_NEED_DICT:a.Z_NEED_DICT,Z_ERRNO:a.Z_ERRNO,Z_STREAM_ERROR:a.Z_STREAM_ERROR,Z_DATA_ERROR:a.Z_DATA_ERROR,Z_MEM_ERROR:a.Z_MEM_ERROR,Z_BUF_ERROR:a.Z_BUF_ERROR,Z_VERSION_ERROR:a.Z_VERSION_ERROR},y=Object.keys(p),g=0;g<y.length;g++){var b=y[g];p[p[b]]=b}function m(e,t,r){var n=[],o=0;function a(){for(var t;null!==(t=e.read());)n.push(t),o+=t.length;e.once("readable",a)}function s(){var t,a=null;o>=f?a=new RangeError(c):t=i.concat(n,o),n=[],e.close(),r(a,t)}e.on("error",(function(t){e.removeListener("end",s),e.removeListener("readable",a),r(t)})),e.on("end",s),e.end(t),a()}function v(e,t){if("string"==typeof t&&(t=i.from(t)),!i.isBuffer(t))throw new TypeError("Not a string or buffer");var r=e._finishFlushFlag;return e._processChunk(t,r)}function w(e){if(!(this instanceof w))return new w(e);O.call(this,e,a.DEFLATE)}function _(e){if(!(this instanceof _))return new _(e);O.call(this,e,a.INFLATE)}function E(e){if(!(this instanceof E))return new E(e);O.call(this,e,a.GZIP)}function S(e){if(!(this instanceof S))return new S(e);O.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);O.call(this,e,a.DEFLATERAW)}function A(e){if(!(this instanceof A))return new A(e);O.call(this,e,a.INFLATERAW)}function T(e){if(!(this instanceof T))return new T(e);O.call(this,e,a.UNZIP)}function P(e){return e===a.Z_NO_FLUSH||e===a.Z_PARTIAL_FLUSH||e===a.Z_SYNC_FLUSH||e===a.Z_FULL_FLUSH||e===a.Z_FINISH||e===a.Z_BLOCK}function O(e,r){var n=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||t.Z_DEFAULT_CHUNK,o.call(this,e),e.flush&&!P(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!P(e.finishFlush))throw new Error("Invalid flush flag: "+e.finishFlush);if(this._flushFlag=e.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==e.finishFlush?e.finishFlush:a.Z_FINISH,e.chunkSize&&(e.chunkSize<t.Z_MIN_CHUNK||e.chunkSize>t.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBits<t.Z_MIN_WINDOWBITS||e.windowBits>t.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.level<t.Z_MIN_LEVEL||e.level>t.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevel<t.Z_MIN_MEMLEVEL||e.memLevel>t.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=t.Z_FILTERED&&e.strategy!=t.Z_HUFFMAN_ONLY&&e.strategy!=t.Z_RLE&&e.strategy!=t.Z_FIXED&&e.strategy!=t.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!i.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(r);var s=this;this._hadError=!1,this._handle.onerror=function(e,r){I(s),s._hadError=!0;var n=new Error(e);n.errno=r,n.code=t.codes[r],s.emit("error",n)};var u=t.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(u=e.level);var f=t.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(f=e.strategy),this._handle.init(e.windowBits||t.Z_DEFAULT_WINDOWBITS,u,e.memLevel||t.Z_DEFAULT_MEMLEVEL,f,e.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=u,this._strategy=f,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!n._handle},configurable:!0,enumerable:!0})}function I(e,t){t&&n.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}function x(e){e.emit("close")}Object.defineProperty(t,"codes",{enumerable:!0,value:Object.freeze(p),writable:!1}),t.Deflate=w,t.Inflate=_,t.Gzip=E,t.Gunzip=S,t.DeflateRaw=k,t.InflateRaw=A,t.Unzip=T,t.createDeflate=function(e){return new w(e)},t.createInflate=function(e){return new _(e)},t.createDeflateRaw=function(e){return new k(e)},t.createInflateRaw=function(e){return new A(e)},t.createGzip=function(e){return new E(e)},t.createGunzip=function(e){return new S(e)},t.createUnzip=function(e){return new T(e)},t.deflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new w(t),e,r)},t.deflateSync=function(e,t){return v(new w(t),e)},t.gzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new E(t),e,r)},t.gzipSync=function(e,t){return v(new E(t),e)},t.deflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new k(t),e,r)},t.deflateRawSync=function(e,t){return v(new k(t),e)},t.unzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new T(t),e,r)},t.unzipSync=function(e,t){return v(new T(t),e)},t.inflate=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new _(t),e,r)},t.inflateSync=function(e,t){return v(new _(t),e)},t.gunzip=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new S(t),e,r)},t.gunzipSync=function(e,t){return v(new S(t),e)},t.inflateRaw=function(e,t,r){return"function"==typeof t&&(r=t,t={}),m(new A(t),e,r)},t.inflateRawSync=function(e,t){return v(new A(t),e)},s.inherits(O,o),O.prototype.params=function(e,r,i){if(e<t.Z_MIN_LEVEL||e>t.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(r!=t.Z_FILTERED&&r!=t.Z_HUFFMAN_ONLY&&r!=t.Z_RLE&&r!=t.Z_FIXED&&r!=t.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+r);if(this._level!==e||this._strategy!==r){var o=this;this.flush(a.Z_SYNC_FLUSH,(function(){u(o._handle,"zlib binding closed"),o._handle.params(e,r),o._hadError||(o._level=e,o._strategy=r,i&&i())}))}else n.nextTick(i)},O.prototype.reset=function(){return u(this._handle,"zlib binding closed"),this._handle.reset()},O.prototype._flush=function(e){this._transform(i.alloc(0),"",e)},O.prototype.flush=function(e,t){var r=this,o=this._writableState;("function"==typeof e||void 0===e&&!t)&&(t=e,e=a.Z_FULL_FLUSH),o.ended?t&&n.nextTick(t):o.ending?t&&this.once("end",t):o.needDrain?t&&this.once("drain",(function(){return r.flush(e,t)})):(this._flushFlag=e,this.write(i.alloc(0),"",t))},O.prototype.close=function(e){I(this,e),n.nextTick(x,this)},O.prototype._transform=function(e,t,r){var n,o=this._writableState,s=(o.ending||o.ended)&&(!e||o.length===e.length);return null===e||i.isBuffer(e)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(e,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},O.prototype._processChunk=function(e,t,r){var n=e&&e.length,o=this._chunkSize-this._offset,a=0,s=this,l="function"==typeof r;if(!l){var h,d=[],p=0;this.on("error",(function(e){h=e})),u(this._handle,"zlib binding closed");do{var y=this._handle.writeSync(t,e,a,n,this._buffer,this._offset,o)}while(!this._hadError&&m(y[0],y[1]));if(this._hadError)throw h;if(p>=f)throw I(this),new RangeError(c);var g=i.concat(d,p);return I(this),g}u(this._handle,"zlib binding closed");var b=this._handle.write(t,e,a,n,this._buffer,this._offset,o);function m(f,c){if(this&&(this.buffer=null,this.callback=null),!s._hadError){var h=o-c;if(u(h>=0,"have should not go down"),h>0){var y=s._buffer.slice(s._offset,s._offset+h);s._offset+=h,l?s.push(y):(d.push(y),p+=y.length)}if((0===c||s._offset>=s._chunkSize)&&(o=s._chunkSize,s._offset=0,s._buffer=i.allocUnsafe(s._chunkSize)),0===c){if(a+=n-f,n=f,!l)return!0;var g=s._handle.write(t,e,a,n,s._buffer,s._offset,s._chunkSize);return g.callback=m,void(g.buffer=e)}if(!l)return!1;r()}}b.buffer=e,b.callback=m},s.inherits(w,O),s.inherits(_,O),s.inherits(E,O),s.inherits(S,O),s.inherits(k,O),s.inherits(A,O),s.inherits(T,O)},6763:(e,t,r)=>{const n=r(5364);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9204:(e,t,r)=>{var n=r(6763);e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),i=e(r),o=r.length+4,a=new Uint8Array(o);return a.set(r,0),a.set(i.subarray(0,4),r.length),n.encode(a,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},1889:(e,t,r)=>{var{sha256:n}=r(2623),i=r(9204);e.exports=i((function(e){return n(n(e))}))},8287:(e,t,r)=>{const n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=s(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const i=function(e){if(u.isBuffer(e)){const t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),s(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;o<s;o++)if(f(e,o)===f(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*a}else-1!==n&&(o-=o-n),n=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(f(e,o+n)!==f(t,n)){r=!1;break}if(r)return o}return-1}function w(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let a;for(n>o/2&&(n=o/2),a=0;a<n;++a){const n=parseInt(t.substr(2*a,2),16);if(X(n))return a;e[r+a]=n}return a}function _(e,t,r,n){return Z(z(t,e.length-r),e,r,n)}function E(e,t,r,n){return Z(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return Z(q(t),e,r,n)}function k(e,t,r,n){return Z(function(e,t){let r,n,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=a,u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return f(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return l(e)},u.allocUnsafeSlow=function(e){return l(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if($(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=u.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if($(t,Uint8Array))i+t.length>n.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)b(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if($(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(o,a),f=this.slice(n,i),c=e.slice(t,r);for(let e=0;e<s;++e)if(f[e]!==c[e]){o=f[e],a=c[e];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function O(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function x(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Y[e[n]];return i}function N(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function M(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){K(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function L(e,t,r,n,i){K(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function C(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,o){return t=+t,r>>>=0,o||C(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return t=+t,r>>>=0,o||C(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||W(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=u.isBuffer(e)?e:u.from(e,n),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%a]}return this};const D={};function F(e,t,r){D[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function H(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function K(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new D.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||W(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new D.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new D.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new D.ERR_BUFFER_OUT_OF_BOUNDS;throw new D.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Z(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function J(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},8075:(e,t,r)=>{var n=r(453),i=r(487),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&o(e,".prototype.")>-1?i(r):r}},487:(e,t,r)=>{var n=r(6743),i=r(453),o=r(6897),a=r(9675),s=i("%Function.prototype.apply%"),u=i("%Function.prototype.call%"),f=i("%Reflect.apply%",!0)||n.call(u,s),c=r(655),l=i("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new a("a function is required");var t=f(n,u,arguments);return o(t,1+l(0,e.length-(arguments.length-1)),!0)};var h=function(){return f(n,s,arguments)};c?c(e.exports,"apply",{value:h}):e.exports.apply=h},6168:(e,t,r)=>{var n=r(2861).Buffer,i=r(8310).Transform,o=r(3141).I;function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(6698)(a,i),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=n.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},e.exports=a},7108:(e,t,r)=>{var n=r(6698),i=r(320),o=r(6011),a=r(2802),s=r(6168);function u(e){s.call(this,"digest"),this._hash=e}n(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new i:"rmd160"===e||"ripemd160"===e?new o:new u(a(e))}},320:(e,t,r)=>{var n=r(320);e.exports=function(e){return(new n).update(e).digest()}},41:(e,t,r)=>{var n=r(655),i=r(8068),o=r(9675),a=r(5795);e.exports=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new o("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new o("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new o("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new o("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new o("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new o("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,c=arguments.length>6&&arguments[6],l=!!a&&a(e,t);if(n)n(e,t,{configurable:null===f&&l?l.configurable:!f,enumerable:null===s&&l?l.enumerable:!s,value:r,writable:null===u&&l?l.writable:!u});else{if(!c&&(s||u||f))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},8452:(e,t,r)=>{var n=r(1189),i="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),o=Object.prototype.toString,a=Array.prototype.concat,s=r(41),u=r(592)(),f=function(e,t,r,n){if(t in e)if(!0===n){if(e[t]===r)return}else if("function"!=typeof(i=n)||"[object Function]"!==o.call(i)||!n())return;var i;u?s(e,t,r,!0):s(e,t,r)},c=function(e,t){var r=arguments.length>2?arguments[2]:{},o=n(t);i&&(o=a.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)f(e,o[s],t[o[s]],r[o[s]])};c.supportsDescriptors=!!u,e.exports=c},5170:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ECPairFactory=t.networks=void 0;const i=r(5249);t.networks=i;const o=r(953),a=r(3209),s=r(7513),u=r(709),f=o.typeforce.maybe(o.typeforce.compile({compressed:o.maybe(o.Boolean),network:o.maybe(o.Network)}));t.ECPairFactory=function(e){function t(t,r){if(o.typeforce(o.Buffer256bit,t),!e.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return o.typeforce(f,r),new c(t,void 0,r)}function r(t,r){return o.typeforce(e.isPoint,t),o.typeforce(f,r),new c(void 0,t,r)}(0,u.testEcc)(e);class c{__D;__Q;compressed;network;lowR;constructor(t,r,o){this.__D=t,this.__Q=r,this.lowR=!1,void 0===o&&(o={}),this.compressed=void 0===o.compressed||o.compressed,this.network=o.network||i.bitcoin,void 0!==r&&(this.__Q=n.from(e.pointCompress(r,this.compressed)))}get privateKey(){return this.__D}get publicKey(){if(!this.__Q){const t=e.pointFromScalar(this.__D,this.compressed);this.__Q=n.from(t)}return this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return s.encode(this.network.wif,this.__D,this.compressed)}tweak(e){return this.privateKey?this.tweakFromPrivateKey(e):this.tweakFromPublicKey(e)}sign(t,r){if(!this.__D)throw new Error("Missing private key");if(void 0===r&&(r=this.lowR),!1===r)return n.from(e.sign(t,this.__D));{let r=e.sign(t,this.__D);const i=n.alloc(32,0);let o=0;for(;r[0]>127;)o++,i.writeUIntLE(o,0,6),r=e.sign(t,this.__D,i);return n.from(r)}}signSchnorr(t){if(!this.privateKey)throw new Error("Missing private key");if(!e.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return n.from(e.signSchnorr(t,this.privateKey))}verify(t,r){return e.verify(t,this.publicKey,r)}verifySchnorr(t,r){if(!e.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return e.verifySchnorr(t,this.publicKey.subarray(1,33),r)}tweakFromPublicKey(t){const i=32===(o=this.publicKey).length?o:o.slice(1,33);var o;const a=e.xOnlyPointAddTweak(i,t);if(!a||null===a.xOnlyPubkey)throw new Error("Cannot tweak public key!");const s=n.from([0===a.parity?2:3]);return r(n.concat([s,a.xOnlyPubkey]),{network:this.network,compressed:this.compressed})}tweakFromPrivateKey(r){const i=3!==this.publicKey[0]&&(4!==this.publicKey[0]||1&~this.publicKey[64])?this.privateKey:e.privateNegate(this.privateKey),o=e.privateAdd(i,r);if(!o)throw new Error("Invalid tweaked private key!");return t(n.from(o),{network:this.network,compressed:this.compressed})}}return{isPoint:function(t){return e.isPoint(t)},fromPrivateKey:t,fromPublicKey:r,fromWIF:function(e,r){const n=s.decode(e),a=n.version;if(o.Array(r)){if(!(r=r.filter((e=>a===e.wif)).pop()))throw new Error("Unknown network version")}else if(r=r||i.bitcoin,a!==r.wif)throw new Error("Invalid network version");return t(n.privateKey,{compressed:n.compressed,network:r})},makeRandom:function(r){o.typeforce(f,r),void 0===r&&(r={});const n=r.rng||a;let i;do{i=n(32),o.typeforce(o.Buffer256bit,i)}while(!e.isPrivate(i));return t(i,r)}}}},8700:(e,t,r)=>{t.dg=void 0;var n=r(5170);Object.defineProperty(t,"dg",{enumerable:!0,get:function(){return n.ECPairFactory}})},5249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.testnet=t.bitcoin=void 0,t.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},t.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},709:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.testEcc=void 0;const i=e=>n.from(e,"hex");function o(e){if(!e)throw new Error("ecc library invalid")}t.testEcc=function(e){o(e.isPoint(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(!e.isPoint(i("030000000000000000000000000000000000000000000000000000000000000005"))),o(e.isPrivate(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(!e.isPrivate(i("0000000000000000000000000000000000000000000000000000000000000000"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),o(n.from(e.privateAdd(i("0000000000000000000000000000000000000000000000000000000000000001"),i("0000000000000000000000000000000000000000000000000000000000000000"))).equals(i("0000000000000000000000000000000000000000000000000000000000000001"))),o(null===e.privateAdd(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),i("0000000000000000000000000000000000000000000000000000000000000003"))),o(n.from(e.privateAdd(i("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),i("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"))).equals(i("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24"))),o(n.from(e.privateNegate(i("0000000000000000000000000000000000000000000000000000000000000001"))).equals(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(n.from(e.privateNegate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(i("0000000000000000000000000000000000000000000000000000000000000003"))),o(n.from(e.privateNegate(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792"))),o(n.from(e.pointCompress(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!0)).equals(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(n.from(e.pointCompress(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!1)).equals(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),o(n.from(e.pointCompress(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!0)).equals(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(n.from(e.pointCompress(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!1)).equals(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),o(n.from(e.pointFromScalar(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),o(null===e.xOnlyPointAddTweak(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")));let t=e.xOnlyPointAddTweak(i("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),i("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));o(n.from(t.xOnlyPubkey).equals(i("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&1===t.parity),t=e.xOnlyPointAddTweak(i("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),i("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")),o(n.from(t.xOnlyPubkey).equals(i("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"))&&0===t.parity),o(n.from(e.sign(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),o(e.verify(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),e.signSchnorr&&o(n.from(e.signSchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),i("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),e.verifySchnorr&&o(e.verifySchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}},953:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.maybe=t.Boolean=t.Array=t.Buffer256bit=t.Network=t.typeforce=void 0,t.typeforce=r(8676),t.Network=t.typeforce.compile({messagePrefix:t.typeforce.oneOf(t.typeforce.Buffer,t.typeforce.String),bip32:{public:t.typeforce.UInt32,private:t.typeforce.UInt32},pubKeyHash:t.typeforce.UInt8,scriptHash:t.typeforce.UInt8,wif:t.typeforce.UInt8}),t.Buffer256bit=t.typeforce.BufferN(32),t.Array=t.typeforce.Array,t.Boolean=t.typeforce.Boolean,t.maybe=t.typeforce.maybe},655:(e,t,r)=>{var n=r(453)("%Object.defineProperty%",!0)||!1;if(n)try{n({},"a",{value:1})}catch(e){n=!1}e.exports=n},1237:e=>{e.exports=EvalError},9383:e=>{e.exports=Error},9290:e=>{e.exports=RangeError},9538:e=>{e.exports=ReferenceError},8068:e=>{e.exports=SyntaxError},9675:e=>{e.exports=TypeError},5345:e=>{e.exports=URIError},7007:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,o,a,f;if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=u(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,f=c,console&&console.warn&&console.warn(f)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var f=u.length,c=p(u,f);for(r=0;r<f;++r)n(c[r],this,t)}return!0},o.prototype.addListener=function(e,t){return f(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return f(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,l(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,l(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},2682:(e,t,r)=>{var n=r(9600),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty;e.exports=function(e,t,r){if(!n(t))throw new TypeError("iterator must be a function");var a;arguments.length>=3&&(a=r),"[object Array]"===i.call(e)?function(e,t,r){for(var n=0,i=e.length;n<i;n++)o.call(e,n)&&(null==r?t(e[n],n,e):t.call(r,e[n],n,e))}(e,t,a):"string"==typeof e?function(e,t,r){for(var n=0,i=e.length;n<i;n++)null==r?t(e.charAt(n),n,e):t.call(r,e.charAt(n),n,e)}(e,t,a):function(e,t,r){for(var n in e)o.call(e,n)&&(null==r?t(e[n],n,e):t.call(r,e[n],n,e))}(e,t,a)}},9353:e=>{var t=Object.prototype.toString,r=Math.max,n=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r};e.exports=function(e){var i=this;if("function"!=typeof i||"[object Function]"!==t.apply(i))throw new TypeError("Function.prototype.bind called on incompatible "+i);for(var o,a=function(e,t){for(var r=[],n=1,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r}(arguments),s=r(0,i.length-a.length),u=[],f=0;f<s;f++)u[f]="$"+f;if(o=Function("binder","return function ("+function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=",");return r}(u)+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof o){var t=i.apply(this,n(a,arguments));return Object(t)===t?t:this}return i.apply(e,n(a,arguments))})),i.prototype){var c=function(){};c.prototype=i.prototype,o.prototype=new c,c.prototype=null}return o}},6743:(e,t,r)=>{var n=r(9353);e.exports=Function.prototype.bind||n},453:(e,t,r)=>{var n,i=r(9383),o=r(1237),a=r(9290),s=r(9538),u=r(8068),f=r(9675),c=r(5345),l=Function,h=function(e){try{return l('"use strict"; return ('+e+").constructor;")()}catch(e){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(e){d=null}var p=function(){throw new f},y=d?function(){try{return p}catch(e){try{return d(arguments,"callee").get}catch(e){return p}}}():p,g=r(4039)(),b=r(24)(),m=Object.getPrototypeOf||(b?function(e){return e.__proto__}:null),v={},w="undefined"!=typeof Uint8Array&&m?m(Uint8Array):n,_={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":g&&m?m([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":o,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":v,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&m?m(m([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&g&&m?m((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":a,"%ReferenceError%":s,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&g&&m?m((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&m?m(""[Symbol.iterator]()):n,"%Symbol%":g?Symbol:n,"%SyntaxError%":u,"%ThrowTypeError%":y,"%TypedArray%":w,"%TypeError%":f,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":c,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};if(m)try{null.error}catch(e){var E=m(m(e));_["%Error.prototype%"]=E}var S=function e(t){var r;if("%AsyncFunction%"===t)r=h("async function () {}");else if("%GeneratorFunction%"===t)r=h("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=h("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&m&&(r=m(i.prototype))}return _[t]=r,r},k={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},A=r(6743),T=r(9957),P=A.call(Function.call,Array.prototype.concat),O=A.call(Function.apply,Array.prototype.splice),I=A.call(Function.call,String.prototype.replace),x=A.call(Function.call,String.prototype.slice),N=A.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,R=/\\(\\)?/g,B=function(e,t){var r,n=e;if(T(k,n)&&(n="%"+(r=k[n])[0]+"%"),T(_,n)){var i=_[n];if(i===v&&(i=S(n)),void 0===i&&!t)throw new f("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new u("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new f("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new f('"allowMissing" argument must be a boolean');if(null===N(/^%?[^%]*%?$/,e))throw new u("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=x(e,0,1),r=x(e,-1);if("%"===t&&"%"!==r)throw new u("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new u("invalid intrinsic syntax, expected opening `%`");var n=[];return I(e,M,(function(e,t,r,i){n[n.length]=r?I(i,R,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",i=B("%"+n+"%",t),o=i.name,a=i.value,s=!1,c=i.alias;c&&(n=c[0],O(r,P([0,1],c)));for(var l=1,h=!0;l<r.length;l+=1){var p=r[l],y=x(p,0,1),g=x(p,-1);if(('"'===y||"'"===y||"`"===y||'"'===g||"'"===g||"`"===g)&&y!==g)throw new u("property names with quotes must have matching quotes");if("constructor"!==p&&h||(s=!0),T(_,o="%"+(n+="."+p)+"%"))a=_[o];else if(null!=a){if(!(p in a)){if(!t)throw new f("base intrinsic for "+e+" exists, but the property is not available.");return}if(d&&l+1>=r.length){var b=d(a,p);a=(h=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:a[p]}else h=T(a,p),a=a[p];h&&!s&&(_[o]=a)}}return a}},5795:(e,t,r)=>{var n=r(453)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},592:(e,t,r)=>{var n=r(655),i=function(){return!!n};i.hasArrayLengthDefineBug=function(){if(!n)return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},24:e=>{var t={__proto__:null,foo:{}},r=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof r)}},4039:(e,t,r)=>{var n="undefined"!=typeof Symbol&&Symbol,i=r(1333);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&i()}},1333:e=>{e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},9092:(e,t,r)=>{var n=r(1333);e.exports=function(){return n()&&!!Symbol.toStringTag}},4729:(e,t,r)=>{var n=r(2861).Buffer,i=r(1603).Transform;function o(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(6698)(o,i),o.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");n.isBuffer(e)||(e=n.from(e,t));for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var a=0,s=8*e.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},2260:e=>{var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,a,s,u;if("string"==typeof t&&(o="not ",t.substr(0,4)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var f=("number"!=typeof u&&(u=0),u+1>(s=e).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(n(t,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},2818:(e,t,r)=>{var n=r(3184),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(6736),a=r(2192);r(6698)(c,o);for(var s=i(a.prototype),u=0;u<s.length;u++){var f=s[u];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||n.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},5860:(e,t,r)=>{e.exports=i;var n=r(3054);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(6698)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},6736:(e,t,r)=>{var n,i=r(3184);e.exports=A,A.ReadableState=k,r(7007).EventEmitter;var o,a=function(e,t){return e.listeners(t).length},s=r(1181),u=r(8287).Buffer,f=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},c=r(2382);o=c&&c.debuglog?c.debuglog("stream"):function(){};var l,h,d,p=r(2389),y=r(1468),g=r(8775).getHighWaterMark,b=r(2260).F,m=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(A,s);var E=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(e,t,i){n=n||r(2818),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(3141).I),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function A(e){if(n=n||r(2818),!(this instanceof A))return new A(e);var t=this instanceof n;this._readableState=new k(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function T(e,t,r,n,i){o("readableAddChunk",t);var a,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,N(e)))}}(e,s);else if(i||(a=function(e,t){var r,n;return n=t,u.isBuffer(n)||n instanceof f||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(s,t)),a)E(e,a);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),n)s.endEmitted?E(e,new _):P(e,s,t,!0);else if(s.ended)E(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?P(e,s,t,!1):M(e,s)):P(e,s,t,!1)}else n||(s.reading=!1,M(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function P(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),M(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=y.destroy,A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=u.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},A.prototype.unshift=function(e){return T(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){l||(l=r(3141).I);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var O=1073741824;function I(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=O?e=O:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(N,e))}function N(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function B(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){o("readable nexttick read 0"),e.read(0)}function C(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function D(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(F,t,e))}function F(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function H(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}A.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):x(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&D(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(n=e>0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){E(this,new w("_read()"))},A.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===i.stdout||e===i.stderr?y:u;function u(){o("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",(function t(i,a){o("onunpipe"),i===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",f),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",l),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}));var f=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,U(e))}}(r);e.on("drain",f);var c=!1;function l(t){o("ondata");var i=e.write(t);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==H(n.pipes,e))&&!c&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){o("onerror",t),y(),e.removeListener("error",h),0===a(e,"error")&&E(e,t)}function d(){e.removeListener("finish",p),y()}function p(){o("onfinish"),e.removeListener("close",d),y()}function y(){o("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=H(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},A.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(L,this))),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),r},A.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(C,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(4743)),h(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=j,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===d&&(d=r(5049)),d(A,e,t)})},3054:(e,t,r)=>{e.exports=c;var n=r(2260).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(2818);function f(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);u.call(this,e),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(6698)(c,u),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},2192:(e,t,r)=>{var n,i=r(3184);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=A,A.WritableState=k;var a,s={deprecate:r(4643)},u=r(1181),f=r(8287).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(1468),h=r(8775).getHighWaterMark,d=r(2260).F,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function S(){}function k(e,t,a){n=n||r(2818),e=e||{},"boolean"!=typeof a&&(a=t instanceof n),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(N,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),N(e,t))}(e,r,n,t,o);else{var a=I(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||O(e,r),n?i.nextTick(P,e,r,a,o):P(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function A(e){var t=this instanceof(n=n||r(2818));if(!t&&!a.call(A,this))return new A(e);this._writableState=new k(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function T(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function P(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),N(e,t)}function O(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,T(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback;if(T(e,t,!1,t.objectMode?1:f.length,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),N(e,t)}))}function N(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(x,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(6698)(A,u),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===A&&e&&e._writableState instanceof k}})):a=function(e){return e instanceof this},A.prototype.pipe=function(){E(this,new b)},A.prototype.write=function(e,t,r){var n,o=this._writableState,a=!1,s=!o.objectMode&&(n=e,f.isBuffer(n)||n instanceof c);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(e,t){var r=new w;E(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var o;return null===r?o=new v:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(E(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,s,n,i,o);return u}(this,o,s,e,t,r)),a},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||O(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,N(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=l.destroy,A.prototype._undestroy=l.undestroy,A.prototype._destroy=function(e,t){t(e)}},4743:(e,t,r)=>{var n,i=r(3184);function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(5826),s=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function y(e){var t=e[s];if(null!==t){var r=e[d].read();null!==r&&(e[l]=null,e[s]=null,e[u]=null,t(p(r,!1)))}}function g(e){i.nextTick(y,e)}var b=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[f];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[f]?r(e[f]):t(p(void 0,!0))}))}));var r,n=this[l];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(p(void 0,!0)):t[h](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[h])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),b);e.exports=function(e){var t,r=Object.create(m,(o(t={},d,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,f,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,h,{value:function(e,t){var n=r[d].read();n?(r[l]=null,r[s]=null,r[u]=null,e(p(n,!1))):(r[s]=e,r[u]=t)},writable:!0}),t));return r[l]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[u];return null!==t&&(r[l]=null,r[s]=null,r[u]=null,t(e)),void(r[f]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[u]=null,n(p(void 0,!0))),r[c]=!0})),e.on("readable",g.bind(null,r)),r}},2389:(e,t,r)=>{function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var u=r(8287).Buffer,f=r(8460).inspect,c=f&&f.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return u.alloc(0);for(var t,r,n,i=u.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,u.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=u.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return f(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},1468:(e,t,r)=>{var n=r(3184);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},5826:(e,t,r)=>{var n=r(2260).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||c()},f=t._writableState&&t._writableState.finished,c=function(){s=!1,f=!0,a||o.call(t)},l=t._readableState&&t._readableState.endEmitted,h=function(){a=!1,l=!0,s||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return a&&!l?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):s&&!f?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},y=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",p),t.req?y():t.on("request",y)):s&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",h),t.on("finish",c),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",c),t.removeListener("abort",p),t.removeListener("request",y),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",p)}}},5049:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},9434:(e,t,r)=>{var n,i=r(2260).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e){e()}function f(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var c,l=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var h=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(5826)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}(e,o,i>0,(function(e){c||(c=e),e&&h.forEach(u),o||(h.forEach(u),l(c))}))}));return t.reduce(f)}},8775:(e,t,r)=>{var n=r(2260).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},1181:(e,t,r)=>{e.exports=r(7007).EventEmitter},1603:(e,t,r)=>{(t=e.exports=r(6736)).Stream=t,t.Readable=t,t.Writable=r(2192),t.Duplex=r(2818),t.Transform=r(3054),t.PassThrough=r(5860),t.finished=r(5826),t.pipeline=r(9434)},9957:(e,t,r)=>{var n=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=r(6743);e.exports=o.call(n,i)},251:(e,t)=>{t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,c=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,f=8*o-i-1,c=(1<<f)-1,l=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;e[r+d]=255&a,d+=p,a/=256,f-=8);e[r+d-p]|=128*y}},6698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},7244:(e,t,r)=>{var n=r(9092)(),i=r(8075)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},a=function(e){return!!o(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},s=function(){return o(arguments)}();o.isLegacyArguments=a,e.exports=s?o:a},9600:e=>{var t,r,n=Function.prototype.toString,i="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof i&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},i((function(){throw 42}),null,t)}catch(e){e!==r&&(i=null)}else i=null;var o=/^\s*class\b/,a=function(e){try{var t=n.call(e);return o.test(t)}catch(e){return!1}},s=function(e){try{return!a(e)&&(n.call(e),!0)}catch(e){return!1}},u=Object.prototype.toString,f="function"==typeof Symbol&&!!Symbol.toStringTag,c=!(0 in[,]),l=function(){return!1};if("object"==typeof document){var h=document.all;u.call(h)===u.call(document.all)&&(l=function(e){if((c||!e)&&(void 0===e||"object"==typeof e))try{var t=u.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=i?function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{i(e,null,t)}catch(e){if(e!==r)return!1}return!a(e)&&s(e)}:function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(f)return s(e);if(a(e))return!1;var t=u.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&s(e)}},8184:(e,t,r)=>{var n,i=Object.prototype.toString,o=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(9092)(),u=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(a.test(o.call(e)))return!0;if(!s)return"[object GeneratorFunction]"===i.call(e);if(!u)return!1;if(void 0===n){var t=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&u(t)}return u(e)===n}},3003:e=>{e.exports=function(e){return e!=e}},4133:(e,t,r)=>{var n=r(487),i=r(8452),o=r(3003),a=r(6642),s=r(2464),u=n(a(),Number);i(u,{getPolyfill:a,implementation:o,shim:s}),e.exports=u},6642:(e,t,r)=>{var n=r(3003);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},2464:(e,t,r)=>{var n=r(8452),i=r(6642);e.exports=function(){var e=i();return n(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},5680:(e,t,r)=>{var n=r(5767);e.exports=function(e){return!!n(e)}},9211:e=>{var t=function(e){return e!=e};e.exports=function(e,r){return 0===e&&0===r?1/e==1/r:e===r||!(!t(e)||!t(r))}},7653:(e,t,r)=>{var n=r(8452),i=r(487),o=r(9211),a=r(9394),s=r(6576),u=i(a(),Object);n(u,{getPolyfill:a,implementation:o,shim:s}),e.exports=u},9394:(e,t,r)=>{var n=r(9211);e.exports=function(){return"function"==typeof Object.is?Object.is:n}},6576:(e,t,r)=>{var n=r(9394),i=r(8452);e.exports=function(){var e=n();return i(Object,{is:e},{is:function(){return Object.is!==e}}),e}},8875:(e,t,r)=>{var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,a=r(1093),s=Object.prototype.propertyIsEnumerable,u=!s.call({toString:null},"toString"),f=s.call((function(){}),"prototype"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},d=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{l(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();n=function(e){var t=null!==e&&"object"==typeof e,r="[object Function]"===o.call(e),n=a(e),s=t&&"[object String]"===o.call(e),h=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var p=f&&r;if(s&&e.length>0&&!i.call(e,0))for(var y=0;y<e.length;++y)h.push(String(y));if(n&&e.length>0)for(var g=0;g<e.length;++g)h.push(String(g));else for(var b in e)p&&"prototype"===b||!i.call(e,b)||h.push(String(b));if(u)for(var m=function(e){if("undefined"==typeof window||!d)return l(e);try{return l(e)}catch(e){return!1}}(e),v=0;v<c.length;++v)m&&"constructor"===c[v]||!i.call(e,c[v])||h.push(c[v]);return h}}e.exports=n},1189:(e,t,r)=>{var n=Array.prototype.slice,i=r(1093),o=Object.keys,a=o?function(e){return o(e)}:r(8875),s=Object.keys;a.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return i(e)?s(n.call(e)):s(e)})}else Object.keys=a;return Object.keys||a},e.exports=a},1093:e=>{var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},8403:(e,t,r)=>{var n=r(1189),i=r(1333)(),o=r(8075),a=Object,s=o("Array.prototype.push"),u=o("Object.prototype.propertyIsEnumerable"),f=i?Object.getOwnPropertySymbols:null;e.exports=function(e,t){if(null==e)throw new TypeError("target must be an object");var r=a(e);if(1===arguments.length)return r;for(var o=1;o<arguments.length;++o){var c=a(arguments[o]),l=n(c),h=i&&(Object.getOwnPropertySymbols||f);if(h)for(var d=h(c),p=0;p<d.length;++p){var y=d[p];u(c,y)&&s(l,y)}for(var g=0;g<l.length;++g){var b=l[g];if(u(c,b)){var m=c[b];r[b]=m}}}return r}},1514:(e,t,r)=>{var n=r(8403);e.exports=function(){return Object.assign?function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},n=0;n<t.length;++n)r[t[n]]=t[n];var i=Object.assign({},r),o="";for(var a in i)o+=a;return e!==o}()||function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch(t){return"y"===e[1]}return!1}()?n:Object.assign:n}},9805:(e,t)=>{var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},o={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};t.setTyped=function(e){e?(t.Buf8=Uint8Array,t.Buf16=Uint16Array,t.Buf32=Int32Array,t.assign(t,i)):(t.Buf8=Array,t.Buf16=Array,t.Buf32=Array,t.assign(t,o))},t.setTyped(r)},3269:e=>{e.exports=function(e,t,r,n){for(var i=65535&e,o=e>>>16&65535,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16}},9681:e=>{e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},4823:e=>{var t=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();e.exports=function(e,r,n,i){var o=t,a=i+n;e^=-1;for(var s=i;s<a;s++)e=e>>>8^o[255&(e^r[s])];return~e}},8411:(e,t,r)=>{var n,i=r(9805),o=r(3665),a=r(3269),s=r(4823),u=r(4674),f=0,c=0,l=-2,h=2,d=8,p=286,y=30,g=19,b=2*p+1,m=15,v=3,w=258,_=w+v+1,E=42,S=103,k=113,A=666;function T(e,t){return e.msg=u[t],t}function P(e){return(e<<1)-(e>4?9:0)}function O(e){for(var t=e.length;--t>=0;)e[t]=0}function I(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function x(e,t){o._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,I(e.strm)}function N(e,t){e.pending_buf[e.pending++]=t}function M(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function R(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-_?e.strstart-(e.w_size-_):0,f=e.window,c=e.w_mask,l=e.prev,h=e.strstart+w,d=f[o+a-1],p=f[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(f[(r=t)+a]===p&&f[r+a-1]===d&&f[r]===f[o]&&f[++r]===f[o+1]){o+=2,r++;do{}while(f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&o<h);if(n=w-(h-o),o=h-w,n>a){if(e.match_start=t,a=n,n>=s)break;d=f[o+a-1],p=f[o+a]}}}while((t=l[t&c])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead}function B(e){var t,r,n,o,u,f,c,l,h,d,p=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=p+(p-_)){i.arraySet(e.window,e.window,p,p,0),e.match_start-=p,e.strstart-=p,e.block_start-=p,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=p?n-p:0}while(--r);t=r=p;do{n=e.prev[--t],e.prev[t]=n>=p?n-p:0}while(--r);o+=p}if(0===e.strm.avail_in)break;if(f=e.strm,c=e.window,l=e.strstart+e.lookahead,h=o,d=void 0,(d=f.avail_in)>h&&(d=h),r=0===d?0:(f.avail_in-=d,i.arraySet(c,f.input,f.next_in,d,l),1===f.state.wrap?f.adler=a(f.adler,c,d,l):2===f.state.wrap&&(f.adler=s(f.adler,c,d,l)),f.next_in+=d,f.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=v)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+v-1])&e.hash_mask,e.prev[u&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=u,u++,e.insert--,!(e.lookahead+e.insert<v)););}while(e.lookahead<_&&0!==e.strm.avail_in)}function L(e,t){for(var r,n;;){if(e.lookahead<_){if(B(e),e.lookahead<_&&t===f)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=v&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+v-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-_&&(e.match_length=R(e,r)),e.match_length>=v)if(n=o._tr_tally(e,e.strstart-e.match_start,e.match_length-v),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=v){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+v-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<v-1?e.strstart:v-1,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(x(e,!1),0===e.strm.avail_out)?1:2}function C(e,t){for(var r,n,i;;){if(e.lookahead<_){if(B(e),e.lookahead<_&&t===f)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=v&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+v-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=v-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-_&&(e.match_length=R(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===v&&e.strstart-e.match_start>4096)&&(e.match_length=v-1)),e.prev_length>=v&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-v,n=o._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-v),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+v-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=v-1,e.strstart++,n&&(x(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=o._tr_tally(e,0,e.window[e.strstart-1]))&&x(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=o._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<v-1?e.strstart:v-1,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(x(e,!1),0===e.strm.avail_out)?1:2}function U(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function j(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=d,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*b),this.dyn_dtree=new i.Buf16(2*(2*y+1)),this.bl_tree=new i.Buf16(2*(2*g+1)),O(this.dyn_ltree),O(this.dyn_dtree),O(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(m+1),this.heap=new i.Buf16(2*p+1),O(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*p+1),O(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function D(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=h,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?E:k,e.adler=2===t.wrap?0:1,t.last_flush=f,o._tr_init(t),c):T(e,l)}function F(e){var t,r=D(e);return r===c&&((t=e.state).window_size=2*t.w_size,O(t.head),t.max_lazy_match=n[t.level].max_lazy,t.good_match=n[t.level].good_length,t.nice_match=n[t.level].nice_length,t.max_chain_length=n[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=v-1,t.match_available=0,t.ins_h=0),r}function H(e,t,r,n,o,a){if(!e)return l;var s=1;if(-1===t&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),o<1||o>9||r!==d||n<8||n>15||t<0||t>9||a<0||a>4)return T(e,l);8===n&&(n=9);var u=new j;return e.state=u,u.strm=e,u.wrap=s,u.gzhead=null,u.w_bits=n,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+v-1)/v),u.window=new i.Buf8(2*u.w_size),u.head=new i.Buf16(u.hash_size),u.prev=new i.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new i.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=a,u.method=r,F(e)}n=[new U(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(B(e),0===e.lookahead&&t===f)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,x(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-_&&(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(x(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(x(e,!1),e.strm.avail_out),1)})),new U(4,4,8,4,L),new U(4,5,16,8,L),new U(4,6,32,32,L),new U(4,4,16,16,C),new U(8,16,32,32,C),new U(8,16,128,128,C),new U(8,32,128,256,C),new U(32,128,258,1024,C),new U(32,258,258,4096,C)],t.deflateInit=function(e,t){return H(e,t,d,15,8,0)},t.deflateInit2=H,t.deflateReset=F,t.deflateResetKeep=D,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?l:(e.state.gzhead=t,c):l},t.deflate=function(e,t){var r,i,a,u;if(!e||!e.state||t>5||t<0)return e?T(e,l):l;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||i.status===A&&4!==t)return T(e,0===e.avail_out?-5:l);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===E)if(2===i.wrap)e.adler=0,N(i,31),N(i,139),N(i,8),i.gzhead?(N(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),N(i,255&i.gzhead.time),N(i,i.gzhead.time>>8&255),N(i,i.gzhead.time>>16&255),N(i,i.gzhead.time>>24&255),N(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),N(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(N(i,255&i.gzhead.extra.length),N(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(N(i,0),N(i,0),N(i,0),N(i,0),N(i,0),N(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),N(i,3),i.status=k);else{var h=d+(i.w_bits-8<<4)<<8;h|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=k,M(i,h),0!==i.strstart&&(M(i,e.adler>>>16),M(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),I(e),a=i.pending,i.pending!==i.pending_buf_size));)N(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),I(e),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,N(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),I(e),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,N(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(e.adler=s(e.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.status=S)}else i.status=S;if(i.status===S&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&I(e),i.pending+2<=i.pending_buf_size&&(N(i,255&e.adler),N(i,e.adler>>8&255),e.adler=0,i.status=k)):i.status=k),0!==i.pending){if(I(e),0===e.avail_out)return i.last_flush=-1,c}else if(0===e.avail_in&&P(t)<=P(r)&&4!==t)return T(e,-5);if(i.status===A&&0!==e.avail_in)return T(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==f&&i.status!==A){var p=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(B(e),0===e.lookahead)){if(t===f)return 1;break}if(e.match_length=0,r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(x(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,n,i,a,s=e.window;;){if(e.lookahead<=w){if(B(e),e.lookahead<=w&&t===f)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=v&&e.strstart>0&&(n=s[i=e.strstart-1])===s[++i]&&n===s[++i]&&n===s[++i]){a=e.strstart+w;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<a);e.match_length=w-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=v?(r=o._tr_tally(e,1,e.match_length-v),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=o._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(x(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(x(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(x(e,!1),0===e.strm.avail_out)?1:2}(i,t):n[i.level].func(i,t);if(3!==p&&4!==p||(i.status=A),1===p||3===p)return 0===e.avail_out&&(i.last_flush=-1),c;if(2===p&&(1===t?o._tr_align(i):5!==t&&(o._tr_stored_block(i,0,0,!1),3===t&&(O(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),I(e),0===e.avail_out))return i.last_flush=-1,c}return 4!==t?c:i.wrap<=0?1:(2===i.wrap?(N(i,255&e.adler),N(i,e.adler>>8&255),N(i,e.adler>>16&255),N(i,e.adler>>24&255),N(i,255&e.total_in),N(i,e.total_in>>8&255),N(i,e.total_in>>16&255),N(i,e.total_in>>24&255)):(M(i,e.adler>>>16),M(i,65535&e.adler)),I(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?c:1)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==E&&69!==t&&73!==t&&91!==t&&t!==S&&t!==k&&t!==A?T(e,l):(e.state=null,t===k?T(e,-3):c):l},t.deflateSetDictionary=function(e,t){var r,n,o,s,u,f,h,d,p=t.length;if(!e||!e.state)return l;if(2===(s=(r=e.state).wrap)||1===s&&r.status!==E||r.lookahead)return l;for(1===s&&(e.adler=a(e.adler,t,p,0)),r.wrap=0,p>=r.w_size&&(0===s&&(O(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new i.Buf8(r.w_size),i.arraySet(d,t,p-r.w_size,r.w_size,0),t=d,p=r.w_size),u=e.avail_in,f=e.next_in,h=e.input,e.avail_in=p,e.next_in=0,e.input=t,B(r);r.lookahead>=v;){n=r.strstart,o=r.lookahead-(v-1);do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+v-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--o);r.strstart=n,r.lookahead=v-1,B(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=v-1,r.match_available=0,e.next_in=f,e.input=h,e.avail_in=u,r.wrap=s,c},t.deflateInfo="pako deflate (from Nodeca project)"},7293:e=>{e.exports=function(e,t){var r,n,i,o,a,s,u,f,c,l,h,d,p,y,g,b,m,v,w,_,E,S,k,A,T;r=e.state,n=e.next_in,A=e.input,i=n+(e.avail_in-5),o=e.next_out,T=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),u=r.dmax,f=r.wsize,c=r.whave,l=r.wnext,h=r.window,d=r.hold,p=r.bits,y=r.lencode,g=r.distcode,b=(1<<r.lenbits)-1,m=(1<<r.distbits)-1;e:do{p<15&&(d+=A[n++]<<p,p+=8,d+=A[n++]<<p,p+=8),v=y[d&b];t:for(;;){if(d>>>=w=v>>>24,p-=w,0==(w=v>>>16&255))T[o++]=65535&v;else{if(!(16&w)){if(64&w){if(32&w){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}v=y[(65535&v)+(d&(1<<w)-1)];continue t}for(_=65535&v,(w&=15)&&(p<w&&(d+=A[n++]<<p,p+=8),_+=d&(1<<w)-1,d>>>=w,p-=w),p<15&&(d+=A[n++]<<p,p+=8,d+=A[n++]<<p,p+=8),v=g[d&m];;){if(d>>>=w=v>>>24,p-=w,16&(w=v>>>16&255)){if(E=65535&v,p<(w&=15)&&(d+=A[n++]<<p,(p+=8)<w&&(d+=A[n++]<<p,p+=8)),(E+=d&(1<<w)-1)>u){e.msg="invalid distance too far back",r.mode=30;break e}if(d>>>=w,p-=w,E>(w=o-a)){if((w=E-w)>c&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=0,k=h,0===l){if(S+=f-w,w<_){_-=w;do{T[o++]=h[S++]}while(--w);S=o-E,k=T}}else if(l<w){if(S+=f+l-w,(w-=l)<_){_-=w;do{T[o++]=h[S++]}while(--w);if(S=0,l<_){_-=w=l;do{T[o++]=h[S++]}while(--w);S=o-E,k=T}}}else if(S+=l-w,w<_){_-=w;do{T[o++]=h[S++]}while(--w);S=o-E,k=T}for(;_>2;)T[o++]=k[S++],T[o++]=k[S++],T[o++]=k[S++],_-=3;_&&(T[o++]=k[S++],_>1&&(T[o++]=k[S++]))}else{S=o-E;do{T[o++]=T[S++],T[o++]=T[S++],T[o++]=T[S++],_-=3}while(_>2);_&&(T[o++]=T[S++],_>1&&(T[o++]=T[S++]))}break}if(64&w){e.msg="invalid distance code",r.mode=30;break e}v=g[(65535&v)+(d&(1<<w)-1)]}}break}}while(n<i&&o<s);n-=_=p>>3,d&=(1<<(p-=_<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=d,r.bits=p}},1447:(e,t,r)=>{var n=r(9805),i=r(3269),o=r(4823),a=r(7293),s=r(1998),u=0,f=-2,c=1,l=12,h=30,d=852,p=592;function y(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=c,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new n.Buf32(d),t.distcode=t.distdyn=new n.Buf32(p),t.sane=1,t.back=-1,u):f}function m(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,b(e)):f}function v(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?f:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,m(e))):f}function w(e,t){var r,n;return e?(n=new g,e.state=n,n.window=null,(r=v(e,t))!==u&&(e.state=null),r):f}var _,E,S=!0;function k(e){if(S){var t;for(_=new n.Buf32(512),E=new n.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(s(1,e.lens,0,288,_,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;s(2,e.lens,0,32,E,0,e.work,{bits:5}),S=!1}e.lencode=_,e.lenbits=9,e.distcode=E,e.distbits=5}function A(e,t,r,i){var o,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new n.Buf8(a.wsize)),i>=a.wsize?(n.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),n.arraySet(a.window,t,r-i,o,a.wnext),(i-=o)?(n.arraySet(a.window,t,r-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}t.inflateReset=m,t.inflateReset2=v,t.inflateResetKeep=b,t.inflateInit=function(e){return w(e,15)},t.inflateInit2=w,t.inflate=function(e,t){var r,d,p,g,b,m,v,w,_,E,S,T,P,O,I,x,N,M,R,B,L,C,U,j,D=0,F=new n.Buf8(4),H=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return f;(r=e.state).mode===l&&(r.mode=13),b=e.next_out,p=e.output,v=e.avail_out,g=e.next_in,d=e.input,m=e.avail_in,w=r.hold,_=r.bits,E=m,S=v,C=u;e:for(;;)switch(r.mode){case c:if(0===r.wrap){r.mode=13;break}for(;_<16;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(2&r.wrap&&35615===w){r.check=0,F[0]=255&w,F[1]=w>>>8&255,r.check=o(r.check,F,2,0),w=0,_=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&w)<<8)+(w>>8))%31){e.msg="incorrect header check",r.mode=h;break}if(8!=(15&w)){e.msg="unknown compression method",r.mode=h;break}if(_-=4,L=8+(15&(w>>>=4)),0===r.wbits)r.wbits=L;else if(L>r.wbits){e.msg="invalid window size",r.mode=h;break}r.dmax=1<<L,e.adler=r.check=1,r.mode=512&w?10:l,w=0,_=0;break;case 2:for(;_<16;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(r.flags=w,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=h;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=h;break}r.head&&(r.head.text=w>>8&1),512&r.flags&&(F[0]=255&w,F[1]=w>>>8&255,r.check=o(r.check,F,2,0)),w=0,_=0,r.mode=3;case 3:for(;_<32;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}r.head&&(r.head.time=w),512&r.flags&&(F[0]=255&w,F[1]=w>>>8&255,F[2]=w>>>16&255,F[3]=w>>>24&255,r.check=o(r.check,F,4,0)),w=0,_=0,r.mode=4;case 4:for(;_<16;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}r.head&&(r.head.xflags=255&w,r.head.os=w>>8),512&r.flags&&(F[0]=255&w,F[1]=w>>>8&255,r.check=o(r.check,F,2,0)),w=0,_=0,r.mode=5;case 5:if(1024&r.flags){for(;_<16;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}r.length=w,r.head&&(r.head.extra_len=w),512&r.flags&&(F[0]=255&w,F[1]=w>>>8&255,r.check=o(r.check,F,2,0)),w=0,_=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((T=r.length)>m&&(T=m),T&&(r.head&&(L=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),n.arraySet(r.head.extra,d,g,T,L)),512&r.flags&&(r.check=o(r.check,d,T,g)),m-=T,g+=T,r.length-=T),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===m)break e;T=0;do{L=d[g+T++],r.head&&L&&r.length<65536&&(r.head.name+=String.fromCharCode(L))}while(L&&T<m);if(512&r.flags&&(r.check=o(r.check,d,T,g)),m-=T,g+=T,L)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===m)break e;T=0;do{L=d[g+T++],r.head&&L&&r.length<65536&&(r.head.comment+=String.fromCharCode(L))}while(L&&T<m);if(512&r.flags&&(r.check=o(r.check,d,T,g)),m-=T,g+=T,L)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;_<16;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(w!==(65535&r.check)){e.msg="header crc mismatch",r.mode=h;break}w=0,_=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=l;break;case 10:for(;_<32;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}e.adler=r.check=y(w),w=0,_=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=b,e.avail_out=v,e.next_in=g,e.avail_in=m,r.hold=w,r.bits=_,2;e.adler=r.check=1,r.mode=l;case l:if(5===t||6===t)break e;case 13:if(r.last){w>>>=7&_,_-=7&_,r.mode=27;break}for(;_<3;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}switch(r.last=1&w,_-=1,3&(w>>>=1)){case 0:r.mode=14;break;case 1:if(k(r),r.mode=20,6===t){w>>>=2,_-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=h}w>>>=2,_-=2;break;case 14:for(w>>>=7&_,_-=7&_;_<32;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if((65535&w)!=(w>>>16^65535)){e.msg="invalid stored block lengths",r.mode=h;break}if(r.length=65535&w,w=0,_=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(T=r.length){if(T>m&&(T=m),T>v&&(T=v),0===T)break e;n.arraySet(p,d,g,T,b),m-=T,g+=T,v-=T,b+=T,r.length-=T;break}r.mode=l;break;case 17:for(;_<14;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(r.nlen=257+(31&w),w>>>=5,_-=5,r.ndist=1+(31&w),w>>>=5,_-=5,r.ncode=4+(15&w),w>>>=4,_-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=h;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;_<3;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}r.lens[H[r.have++]]=7&w,w>>>=3,_-=3}for(;r.have<19;)r.lens[H[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,U={bits:r.lenbits},C=s(0,r.lens,0,19,r.lencode,0,r.work,U),r.lenbits=U.bits,C){e.msg="invalid code lengths set",r.mode=h;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;x=(D=r.lencode[w&(1<<r.lenbits)-1])>>>16&255,N=65535&D,!((I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(N<16)w>>>=I,_-=I,r.lens[r.have++]=N;else{if(16===N){for(j=I+2;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(w>>>=I,_-=I,0===r.have){e.msg="invalid bit length repeat",r.mode=h;break}L=r.lens[r.have-1],T=3+(3&w),w>>>=2,_-=2}else if(17===N){for(j=I+3;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}_-=I,L=0,T=3+(7&(w>>>=I)),w>>>=3,_-=3}else{for(j=I+7;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}_-=I,L=0,T=11+(127&(w>>>=I)),w>>>=7,_-=7}if(r.have+T>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=h;break}for(;T--;)r.lens[r.have++]=L}}if(r.mode===h)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=h;break}if(r.lenbits=9,U={bits:r.lenbits},C=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,U),r.lenbits=U.bits,C){e.msg="invalid literal/lengths set",r.mode=h;break}if(r.distbits=6,r.distcode=r.distdyn,U={bits:r.distbits},C=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,U),r.distbits=U.bits,C){e.msg="invalid distances set",r.mode=h;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(m>=6&&v>=258){e.next_out=b,e.avail_out=v,e.next_in=g,e.avail_in=m,r.hold=w,r.bits=_,a(e,S),b=e.next_out,p=e.output,v=e.avail_out,g=e.next_in,d=e.input,m=e.avail_in,w=r.hold,_=r.bits,r.mode===l&&(r.back=-1);break}for(r.back=0;x=(D=r.lencode[w&(1<<r.lenbits)-1])>>>16&255,N=65535&D,!((I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(x&&!(240&x)){for(M=I,R=x,B=N;x=(D=r.lencode[B+((w&(1<<M+R)-1)>>M)])>>>16&255,N=65535&D,!(M+(I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}w>>>=M,_-=M,r.back+=M}if(w>>>=I,_-=I,r.back+=I,r.length=N,0===x){r.mode=26;break}if(32&x){r.back=-1,r.mode=l;break}if(64&x){e.msg="invalid literal/length code",r.mode=h;break}r.extra=15&x,r.mode=22;case 22:if(r.extra){for(j=r.extra;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}r.length+=w&(1<<r.extra)-1,w>>>=r.extra,_-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;x=(D=r.distcode[w&(1<<r.distbits)-1])>>>16&255,N=65535&D,!((I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(!(240&x)){for(M=I,R=x,B=N;x=(D=r.distcode[B+((w&(1<<M+R)-1)>>M)])>>>16&255,N=65535&D,!(M+(I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}w>>>=M,_-=M,r.back+=M}if(w>>>=I,_-=I,r.back+=I,64&x){e.msg="invalid distance code",r.mode=h;break}r.offset=N,r.extra=15&x,r.mode=24;case 24:if(r.extra){for(j=r.extra;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}r.offset+=w&(1<<r.extra)-1,w>>>=r.extra,_-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=h;break}r.mode=25;case 25:if(0===v)break e;if(T=S-v,r.offset>T){if((T=r.offset-T)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=h;break}T>r.wnext?(T-=r.wnext,P=r.wsize-T):P=r.wnext-T,T>r.length&&(T=r.length),O=r.window}else O=p,P=b-r.offset,T=r.length;T>v&&(T=v),v-=T,r.length-=T;do{p[b++]=O[P++]}while(--T);0===r.length&&(r.mode=21);break;case 26:if(0===v)break e;p[b++]=r.length,v--,r.mode=21;break;case 27:if(r.wrap){for(;_<32;){if(0===m)break e;m--,w|=d[g++]<<_,_+=8}if(S-=v,e.total_out+=S,r.total+=S,S&&(e.adler=r.check=r.flags?o(r.check,p,S,b-S):i(r.check,p,S,b-S)),S=v,(r.flags?w:y(w))!==r.check){e.msg="incorrect data check",r.mode=h;break}w=0,_=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;_<32;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(w!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=h;break}w=0,_=0}r.mode=29;case 29:C=1;break e;case h:C=-3;break e;case 31:return-4;default:return f}return e.next_out=b,e.avail_out=v,e.next_in=g,e.avail_in=m,r.hold=w,r.bits=_,(r.wsize||S!==e.avail_out&&r.mode<h&&(r.mode<27||4!==t))&&A(e,e.output,e.next_out,S-e.avail_out)?(r.mode=31,-4):(E-=e.avail_in,S-=e.avail_out,e.total_in+=E,e.total_out+=S,r.total+=S,r.wrap&&S&&(e.adler=r.check=r.flags?o(r.check,p,S,e.next_out-S):i(r.check,p,S,e.next_out-S)),e.data_type=r.bits+(r.last?64:0)+(r.mode===l?128:0)+(20===r.mode||15===r.mode?256:0),(0===E&&0===S||4===t)&&C===u&&(C=-5),C)},t.inflateEnd=function(e){if(!e||!e.state)return f;var t=e.state;return t.window&&(t.window=null),e.state=null,u},t.inflateGetHeader=function(e,t){var r;return e&&e.state&&2&(r=e.state).wrap?(r.head=t,t.done=!1,u):f},t.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?f:11===r.mode&&i(1,t,n,0)!==r.check?-3:A(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,u):f},t.inflateInfo="pako inflate (from Nodeca project)"},1998:(e,t,r)=>{var n=r(9805),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(e,t,r,u,f,c,l,h){var d,p,y,g,b,m,v,w,_,E=h.bits,S=0,k=0,A=0,T=0,P=0,O=0,I=0,x=0,N=0,M=0,R=null,B=0,L=new n.Buf16(16),C=new n.Buf16(16),U=null,j=0;for(S=0;S<=15;S++)L[S]=0;for(k=0;k<u;k++)L[t[r+k]]++;for(P=E,T=15;T>=1&&0===L[T];T--);if(P>T&&(P=T),0===T)return f[c++]=20971520,f[c++]=20971520,h.bits=1,0;for(A=1;A<T&&0===L[A];A++);for(P<A&&(P=A),x=1,S=1;S<=15;S++)if(x<<=1,(x-=L[S])<0)return-1;if(x>0&&(0===e||1!==T))return-1;for(C[1]=0,S=1;S<15;S++)C[S+1]=C[S]+L[S];for(k=0;k<u;k++)0!==t[r+k]&&(l[C[t[r+k]]++]=k);if(0===e?(R=U=l,m=19):1===e?(R=i,B-=257,U=o,j-=257,m=256):(R=a,U=s,m=-1),M=0,k=0,S=A,b=c,O=P,I=0,y=-1,g=(N=1<<P)-1,1===e&&N>852||2===e&&N>592)return 1;for(;;){v=S-I,l[k]<m?(w=0,_=l[k]):l[k]>m?(w=U[j+l[k]],_=R[B+l[k]]):(w=96,_=0),d=1<<S-I,A=p=1<<O;do{f[b+(M>>I)+(p-=d)]=v<<24|w<<16|_}while(0!==p);for(d=1<<S-1;M&d;)d>>=1;if(0!==d?(M&=d-1,M+=d):M=0,k++,0==--L[S]){if(S===T)break;S=t[r+l[k]]}if(S>P&&(M&g)!==y){for(0===I&&(I=P),b+=A,x=1<<(O=S-I);O+I<T&&!((x-=L[O+I])<=0);)O++,x<<=1;if(N+=1<<O,1===e&&N>852||2===e&&N>592)return 1;f[y=M&g]=P<<24|O<<16|b-c}}return 0!==M&&(f[b+M]=S-I<<24|64<<16),h.bits=P,0}},4674:e=>{e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},3665:(e,t,r)=>{var n=r(9805);function i(e){for(var t=e.length;--t>=0;)e[t]=0}var o=256,a=286,s=30,u=15,f=16,c=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],l=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],d=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],p=new Array(576);i(p);var y=new Array(60);i(y);var g=new Array(512);i(g);var b=new Array(256);i(b);var m=new Array(29);i(m);var v,w,_,E=new Array(s);function S(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function k(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function A(e){return e<256?g[e]:g[256+(e>>>7)]}function T(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>f-r?(e.bi_buf|=t<<e.bi_valid&65535,T(e,e.bi_buf),e.bi_buf=t>>f-e.bi_valid,e.bi_valid+=r-f):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function O(e,t,r){P(e,r[2*t],r[2*t+1])}function I(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function x(e,t,r){var n,i,o=new Array(u+1),a=0;for(n=1;n<=u;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=I(o[s]++,s))}}function N(e){var t;for(t=0;t<a;t++)e.dyn_ltree[2*t]=0;for(t=0;t<s;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function M(e){e.bi_valid>8?T(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function R(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function B(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&R(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!R(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function L(e,t,r){var n,i,a,s,u=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],i=e.pending_buf[e.l_buf+u],u++,0===n?O(e,i,t):(O(e,(a=b[i])+o+1,t),0!==(s=c[a])&&P(e,i-=m[a],s),O(e,a=A(--n),r),0!==(s=l[a])&&P(e,n-=E[a],s))}while(u<e.last_lit);O(e,256,t)}function C(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,f=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<f;r++)0!==o[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)B(e,o,r);i=f;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],B(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,B(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,f=t.dyn_tree,c=t.max_code,l=t.stat_desc.static_tree,h=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,y=t.stat_desc.max_length,g=0;for(o=0;o<=u;o++)e.bl_count[o]=0;for(f[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=f[2*f[2*(n=e.heap[r])+1]+1]+1)>y&&(o=y,g++),f[2*n+1]=o,n>c||(e.bl_count[o]++,a=0,n>=p&&(a=d[n-p]),s=f[2*n],e.opt_len+=s*(o+a),h&&(e.static_len+=s*(l[2*n+1]+a)));if(0!==g){do{for(o=y-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[y]--,g-=2}while(g>0);for(o=y;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>c||(f[2*i+1]!==o&&(e.opt_len+=(o-f[2*i+1])*f[2*i],f[2*i+1]=o),n--)}}(e,t),x(o,c,e.bl_count)}function U(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,f=4;for(0===a&&(u=138,f=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<f?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(u=138,f=3):i===a?(u=6,f=3):(u=7,f=4))}function j(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,f=4;for(0===a&&(u=138,f=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<f)do{O(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(O(e,i,e.bl_tree),s--),O(e,16,e.bl_tree),P(e,s-3,2)):s<=10?(O(e,17,e.bl_tree),P(e,s-3,3)):(O(e,18,e.bl_tree),P(e,s-11,7));s=0,o=i,0===a?(u=138,f=3):i===a?(u=6,f=3):(u=7,f=4)}}i(E);var D=!1;function F(e,t,r,i){P(e,0+(i?1:0),3),function(e,t,r,i){M(e),T(e,r),T(e,~r),n.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r)}t._tr_init=function(e){D||(function(){var e,t,r,n,i,o=new Array(u+1);for(r=0,n=0;n<28;n++)for(m[n]=r,e=0;e<1<<c[n];e++)b[r++]=n;for(b[r-1]=n,i=0,n=0;n<16;n++)for(E[n]=i,e=0;e<1<<l[n];e++)g[i++]=n;for(i>>=7;n<s;n++)for(E[n]=i<<7,e=0;e<1<<l[n]-7;e++)g[256+i++]=n;for(t=0;t<=u;t++)o[t]=0;for(e=0;e<=143;)p[2*e+1]=8,e++,o[8]++;for(;e<=255;)p[2*e+1]=9,e++,o[9]++;for(;e<=279;)p[2*e+1]=7,e++,o[7]++;for(;e<=287;)p[2*e+1]=8,e++,o[8]++;for(x(p,287,o),e=0;e<s;e++)y[2*e+1]=5,y[2*e]=I(e,5);v=new S(p,c,257,a,u),w=new S(y,l,0,s,u),_=new S(new Array(0),h,0,19,7)}(),D=!0),e.l_desc=new k(e.dyn_ltree,v),e.d_desc=new k(e.dyn_dtree,w),e.bl_desc=new k(e.bl_tree,_),e.bi_buf=0,e.bi_valid=0,N(e)},t._tr_stored_block=F,t._tr_flush_block=function(e,t,r,n){var i,a,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<o;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),C(e,e.l_desc),C(e,e.d_desc),s=function(e){var t;for(U(e,e.dyn_ltree,e.l_desc.max_code),U(e,e.dyn_dtree,e.d_desc.max_code),C(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*d[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=i&&(i=a)):i=a=r+5,r+4<=i&&-1!==t?F(e,t,r,n):4===e.strategy||a===i?(P(e,2+(n?1:0),3),L(e,p,y)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i<n;i++)P(e,e.bl_tree[2*d[i]+1],3);j(e,e.dyn_ltree,t-1),j(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),L(e,e.dyn_ltree,e.dyn_dtree)),N(e),n&&M(e)},t._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(b[r]+o+1)]++,e.dyn_dtree[2*A(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){P(e,2,3),O(e,256,p),function(e){16===e.bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},4442:e=>{e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},6578:e=>{e.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]},3209:(e,t,r)=>{var n=r(3184),i=65536,o=r(2861).Buffer,a=r.g.crypto||r.g.msCrypto;a&&a.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s<e;s+=i)a.getRandomValues(r.slice(s,s+i));else a.getRandomValues(r);return"function"==typeof t?n.nextTick((function(){t(null,r)})):r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},6011:(e,t,r)=>{var n=r(8287).Buffer,i=r(6698),o=r(4729),a=new Array(16),s=[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],u=[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],f=[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],c=[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],l=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<<t|e>>>32-t}function y(e,t,r,n,i,o,a,s){return p(e+(t^r^n)+o+a|0,s)+i|0}function g(e,t,r,n,i,o,a,s){return p(e+(t&r|~t&n)+o+a|0,s)+i|0}function b(e,t,r,n,i,o,a,s){return p(e+((t|~r)^n)+o+a|0,s)+i|0}function m(e,t,r,n,i,o,a,s){return p(e+(t&n|r&~n)+o+a|0,s)+i|0}function v(e,t,r,n,i,o,a,s){return p(e+(t^(r|~n))+o+a|0,s)+i|0}i(d,o),d.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,E=0|this._c,S=0|this._d,k=0|this._e,A=0;A<80;A+=1){var T,P;A<16?(T=y(r,n,i,o,d,e[s[A]],l[0],f[A]),P=v(w,_,E,S,k,e[u[A]],h[0],c[A])):A<32?(T=g(r,n,i,o,d,e[s[A]],l[1],f[A]),P=m(w,_,E,S,k,e[u[A]],h[1],c[A])):A<48?(T=b(r,n,i,o,d,e[s[A]],l[2],f[A]),P=b(w,_,E,S,k,e[u[A]],h[2],c[A])):A<64?(T=m(r,n,i,o,d,e[s[A]],l[3],f[A]),P=g(w,_,E,S,k,e[u[A]],h[3],c[A])):(T=v(r,n,i,o,d,e[s[A]],l[4],f[A]),P=y(w,_,E,S,k,e[u[A]],h[4],c[A])),r=d,d=o,o=p(i,10),i=n,n=T,w=k,k=S,S=p(E,10),E=_,_=P}var O=this._b+i+S|0;this._b=this._c+o+k|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+E|0,this._a=O},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=d},2861:(e,t,r)=>{var n=r(8287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},6897:(e,t,r)=>{var n=r(453),i=r(41),o=r(592)(),a=r(5795),s=r(9675),u=n("%Math.floor%");e.exports=function(e,t){if("function"!=typeof e)throw new s("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||u(t)!==t)throw new s("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,f=!0;if("length"in e&&a){var c=a(e,"length");c&&!c.configurable&&(n=!1),c&&!c.writable&&(f=!1)}return(n||f||!r)&&(o?i(e,"length",t,!0,!0):i(e,"length",t)),e}},392:(e,t,r)=>{var n=r(2861).Buffer;function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,i=this._blockSize,o=e.length,a=this._len,s=0;s<o;){for(var u=a%i,f=Math.min(o-s,i-u),c=0;c<f;c++)r[u+c]=e[s+c];s+=f,(a+=f)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},2802:(e,t,r)=>{var n=e.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};n.sha=r(7816),n.sha1=r(3737),n.sha224=r(6710),n.sha256=r(4107),n.sha384=r(2827),n.sha512=r(2890)},7816:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e){return e<<30|e>>>2}function c(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var h=0;h<80;++h){var d=~~(h/20),p=0|((t=n)<<5|t>>>27)+c(d,i,o,s)+u+r[h]+a[d];u=s,s=o,o=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},3737:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function l(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=(t=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|t>>>31;for(var d=0;d<80;++d){var p=~~(d/20),y=f(n)+l(p,i,o,s)+u+r[d]+a[p]|0;u=s,s=o,o=c(i),i=n,n=y}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},6710:(e,t,r)=>{var n=r(6698),i=r(4107),o=r(392),a=r(2861).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},4107:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e,t,r){return r^e&(t^r)}function c(e,t,r){return e&t|r&(e|t)}function l(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function h(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,y=0|this._g,g=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+d(r[b-15])+r[b-16];for(var m=0;m<64;++m){var v=g+h(u)+f(u,p,y)+a[m]+r[m]|0,w=l(n)+c(n,i,o)|0;g=y,y=p,p=u,u=s+v|0,s=o,o=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},2827:(e,t,r)=>{var n=r(6698),i=r(2890),o=r(392),a=r(2861).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},2890:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function f(e,t,r){return r^e&(t^r)}function c(e,t,r){return e&t|r&(e|t)}function l(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function h(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0<t>>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,m=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,E=0|this._cl,S=0|this._dl,k=0|this._el,A=0|this._fl,T=0|this._gl,P=0|this._hl,O=0;O<32;O+=2)t[O]=e.readInt32BE(4*O),t[O+1]=e.readInt32BE(4*O+4);for(;O<160;O+=2){var I=t[O-30],x=t[O-30+1],N=d(I,x),M=p(x,I),R=y(I=t[O-4],x=t[O-4+1]),B=g(x,I),L=t[O-14],C=t[O-14+1],U=t[O-32],j=t[O-32+1],D=M+C|0,F=N+L+b(D,M)|0;F=(F=F+R+b(D=D+B|0,B)|0)+U+b(D=D+j|0,j)|0,t[O]=F,t[O+1]=D}for(var H=0;H<160;H+=2){F=t[H],D=t[H+1];var K=c(r,n,i),G=c(w,_,E),W=l(r,w),V=l(w,r),z=h(s,k),q=h(k,s),Z=a[H],$=a[H+1],X=f(s,u,m),Y=f(k,A,T),J=P+q|0,Q=v+z+b(J,P)|0;Q=(Q=(Q=Q+X+b(J=J+Y|0,Y)|0)+Z+b(J=J+$|0,$)|0)+F+b(J=J+D|0,D)|0;var ee=V+G|0,te=W+K+b(ee,V)|0;v=m,P=T,m=u,T=A,u=s,A=k,s=o+Q+b(k=S+J|0,S)|0,o=i,S=E,i=n,E=_,n=r,_=w,r=Q+te+b(w=J+ee|0,J)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+k|0,this._fl=this._fl+A|0,this._gl=this._gl+T|0,this._hl=this._hl+P|0,this._ah=this._ah+r+b(this._al,w)|0,this._bh=this._bh+n+b(this._bl,_)|0,this._ch=this._ch+i+b(this._cl,E)|0,this._dh=this._dh+o+b(this._dl,S)|0,this._eh=this._eh+s+b(this._el,k)|0,this._fh=this._fh+u+b(this._fl,A)|0,this._gh=this._gh+m+b(this._gl,T)|0,this._hh=this._hh+v+b(this._hl,P)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},8310:(e,t,r)=>{e.exports=i;var n=r(7007).EventEmitter;function i(){n.call(this)}r(6698)(i,n),i.Readable=r(6891),i.Writable=r(1999),i.Duplex=r(8101),i.Transform=r(9083),i.PassThrough=r(3681),i.finished=r(4257),i.pipeline=r(5267),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function f(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",f),e.removeListener("error",f),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",f),e.on("error",f),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},2463:e=>{var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,a,s,u;if("string"==typeof t&&(o="not ",t.substr(0,4)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var f=("number"!=typeof u&&(u=0),u+1>(s=e).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(n(t,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},8101:(e,t,r)=>{var n=r(3184),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(6891),a=r(1999);r(6698)(c,o);for(var s=i(a.prototype),u=0;u<s.length;u++){var f=s[u];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||n.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},3681:(e,t,r)=>{e.exports=i;var n=r(9083);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(6698)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},6891:(e,t,r)=>{var n,i=r(3184);e.exports=A,A.ReadableState=k,r(7007).EventEmitter;var o,a=function(e,t){return e.listeners(t).length},s=r(1396),u=r(8287).Buffer,f=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},c=r(7199);o=c&&c.debuglog?c.debuglog("stream"):function(){};var l,h,d,p=r(1766),y=r(4347),g=r(6644).getHighWaterMark,b=r(2463).F,m=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(A,s);var E=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(e,t,i){n=n||r(8101),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(3141).I),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function A(e){if(n=n||r(8101),!(this instanceof A))return new A(e);var t=this instanceof n;this._readableState=new k(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function T(e,t,r,n,i){o("readableAddChunk",t);var a,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,N(e)))}}(e,s);else if(i||(a=function(e,t){var r,n;return n=t,u.isBuffer(n)||n instanceof f||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(s,t)),a)E(e,a);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),n)s.endEmitted?E(e,new _):P(e,s,t,!0);else if(s.ended)E(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?P(e,s,t,!1):M(e,s)):P(e,s,t,!1)}else n||(s.reading=!1,M(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function P(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),M(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=y.destroy,A.prototype._undestroy=y.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=u.from(e,t),t=""),r=!0),T(this,e,t,!1,r)},A.prototype.unshift=function(e){return T(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){l||(l=r(3141).I);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var O=1073741824;function I(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=O?e=O:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(N,e))}function N(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function M(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function B(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){o("readable nexttick read 0"),e.read(0)}function C(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function j(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function D(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(F,t,e))}function F(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function H(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}A.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):x(this),null;if(0===(e=I(e,t))&&t.ended)return 0===t.length&&D(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=I(r,t))),null===(n=e>0?j(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&D(this)),null!==n&&this.emit("data",n),n},A.prototype._read=function(e){E(this,new w("_read()"))},A.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===i.stdout||e===i.stderr?y:u;function u(){o("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",(function t(i,a){o("onunpipe"),i===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",f),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",l),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}));var f=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,U(e))}}(r);e.on("drain",f);var c=!1;function l(t){o("ondata");var i=e.write(t);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==H(n.pipes,e))&&!c&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){o("onerror",t),y(),e.removeListener("error",h),0===a(e,"error")&&E(e,t)}function d(){e.removeListener("finish",p),y()}function p(){o("onfinish"),e.removeListener("close",d),y()}function y(){o("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=H(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},A.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(L,this))),r},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),r},A.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(C,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(5034)),h(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=j,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===d&&(d=r(968)),d(A,e,t)})},9083:(e,t,r)=>{e.exports=c;var n=r(2463).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(8101);function f(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);u.call(this,e),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(6698)(c,u),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},1999:(e,t,r)=>{var n,i=r(3184);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=A,A.WritableState=k;var a,s={deprecate:r(4643)},u=r(1396),f=r(8287).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(4347),h=r(6644).getHighWaterMark,d=r(2463).F,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function S(){}function k(e,t,a){n=n||r(8101),e=e||{},"boolean"!=typeof a&&(a=t instanceof n),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(N,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),N(e,t))}(e,r,n,t,o);else{var a=I(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||O(e,r),n?i.nextTick(P,e,r,a,o):P(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function A(e){var t=this instanceof(n=n||r(8101));if(!t&&!a.call(A,this))return new A(e);this._writableState=new k(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function T(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function P(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),N(e,t)}function O(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,T(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback;if(T(e,t,!1,t.objectMode?1:f.length,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),N(e,t)}))}function N(e,t){var r=I(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(x,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(6698)(A,u),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===A&&e&&e._writableState instanceof k}})):a=function(e){return e instanceof this},A.prototype.pipe=function(){E(this,new b)},A.prototype.write=function(e,t,r){var n,o=this._writableState,a=!1,s=!o.objectMode&&(n=e,f.isBuffer(n)||n instanceof c);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(e,t){var r=new w;E(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var o;return null===r?o=new v:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(E(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else T(e,t,!1,s,n,i,o);return u}(this,o,s,e,t,r)),a},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||O(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,N(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=l.destroy,A.prototype._undestroy=l.undestroy,A.prototype._destroy=function(e,t){t(e)}},5034:(e,t,r)=>{var n,i=r(3184);function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(4257),s=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function y(e){var t=e[s];if(null!==t){var r=e[d].read();null!==r&&(e[l]=null,e[s]=null,e[u]=null,t(p(r,!1)))}}function g(e){i.nextTick(y,e)}var b=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[f];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[f]?r(e[f]):t(p(void 0,!0))}))}));var r,n=this[l];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(p(void 0,!0)):t[h](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[h])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),b);e.exports=function(e){var t,r=Object.create(m,(o(t={},d,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,f,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,h,{value:function(e,t){var n=r[d].read();n?(r[l]=null,r[s]=null,r[u]=null,e(p(n,!1))):(r[s]=e,r[u]=t)},writable:!0}),t));return r[l]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[u];return null!==t&&(r[l]=null,r[s]=null,r[u]=null,t(e)),void(r[f]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[u]=null,n(p(void 0,!0))),r[c]=!0})),e.on("readable",g.bind(null,r)),r}},1766:(e,t,r)=>{function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var u=r(8287).Buffer,f=r(3779).inspect,c=f&&f.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return u.alloc(0);for(var t,r,n,i=u.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,u.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=u.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return f(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},4347:(e,t,r)=>{var n=r(3184);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},4257:(e,t,r)=>{var n=r(2463).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||c()},f=t._writableState&&t._writableState.finished,c=function(){s=!1,f=!0,a||o.call(t)},l=t._readableState&&t._readableState.endEmitted,h=function(){a=!1,l=!0,s||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return a&&!l?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):s&&!f?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},y=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",p),t.req?y():t.on("request",y)):s&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",h),t.on("finish",c),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",c),t.removeListener("abort",p),t.removeListener("request",y),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",p)}}},968:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},5267:(e,t,r)=>{var n,i=r(2463).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e){e()}function f(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var c,l=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var h=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(4257)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}(e,o,i>0,(function(e){c||(c=e),e&&h.forEach(u),o||(h.forEach(u),l(c))}))}));return t.reduce(f)}},6644:(e,t,r)=>{var n=r(2463).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},1396:(e,t,r)=>{e.exports=r(7007).EventEmitter},3141:(e,t,r)=>{var n=r(5003).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=l,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.I=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=a(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},5003:(e,t,r)=>{var n=r(8287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},1061:(e,t,r)=>{var n=r(2113);function i(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function o(e){return n.Nil(e)?"":i(e.constructor)}function a(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function s(e){return n.Function(e)?e.toJSON?e.toJSON():i(e):n.Array(e)?"Array":e&&n.Object(e)?"Object":void 0!==e?e:""}function u(e,t,r){var i=function(e){return n.Function(e)?"":n.String(e)?JSON.stringify(e):e&&n.Object(e)?"":e}(t);return"Expected "+s(e)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(e,t,r){r=r||o(t),this.message=u(e,t,r),a(this,f),this.__type=e,this.__value=t,this.__valueTypeName=r}function c(e,t,r,n,i){e?(i=i||o(n),this.message=function(e,t,r,n,i){var o='" of type ';return"key"===t&&(o='" with key type '),u('property "'+s(r)+o+s(e),n,i)}(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',a(this,f),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,c.prototype=Object.create(Error.prototype),c.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:c,tfCustomError:function(e,t){return new f(e,{},t)},tfSubError:function(e,t,r){return e instanceof c?(t=t+"."+e.__property,e=new c(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof f&&(e=new c(e.__type,t,r,e.__value,e.__valueTypeName)),a(e),e},tfJSON:s,getValueTypeName:o}},9542:(e,t,r)=>{var n=r(8287).Buffer,i=r(2113),o=r(1061);function a(e){return n.isBuffer(e)}function s(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function u(e,t){var r=e.toJSON();function n(n){if(!e(n))return!1;if(n.length===t)return!0;throw o.tfCustomError(r+"(Length: "+t+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var f=u.bind(null,i.Array),c=u.bind(null,a),l=u.bind(null,s),h=u.bind(null,i.String),d=Math.pow(2,53)-1,p={ArrayN:f,Buffer:a,BufferN:c,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:s,HexN:l,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-d&&e<=d&&Math.floor(e)===e},Range:function(e,t,r){function n(n,i){return r(n,i)&&n>e&&n<t}return r=r||i.Number,n.toJSON=function(){return`${r.toJSON()} between [${e}, ${t}]`},n},StringN:h,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=d&&Math.floor(e)===e}};for(var y in p)p[y].toJSON=function(e){return e}.bind(null,y);e.exports=p},8676:(e,t,r)=>{var n=r(1061),i=r(2113),o=n.tfJSON,a=n.TfTypeError,s=n.TfPropertyTypeError,u=n.tfSubError,f=n.getValueTypeName,c={arrayOf:function(e,t){function r(r,n){return!!i.Array(r)&&!i.Nil(r)&&!(void 0!==t.minLength&&r.length<t.minLength)&&!(void 0!==t.maxLength&&r.length>t.maxLength)&&(void 0===t.length||r.length===t.length)&&r.every((function(t,r){try{return h(e,t,n)}catch(e){throw u(e,r)}}))}return e=l(e),t=t||{},r.toJSON=function(){var r="["+o(e)+"]";return void 0!==t.length?r+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(r+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),r},r},maybe:function e(t){function r(r,n){return i.Nil(r)||t(r,n,e)}return t=l(t),r.toJSON=function(){return"?"+o(t)},r},map:function(e,t){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{t&&h(t,o,n)}catch(e){throw u(e,o,"key")}try{var a=r[o];h(e,a,n)}catch(e){throw u(e,o)}}return!0}return e=l(e),t&&(t=l(t)),r.toJSON=t?function(){return"{"+o(t)+": "+o(e)+"}"}:function(){return"{"+o(e)+"}"},r},object:function(e){var t={};for(var r in e)t[r]=l(e[r]);function n(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var n;try{for(n in t)h(t[n],e[n],r)}catch(e){throw u(e,n)}if(r)for(n in e)if(!t[n])throw new s(void 0,n);return!0}return n.toJSON=function(){return o(t)},n},anyOf:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return e.some((function(e){try{return h(e,t,r)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(o).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return e.every((function(e){try{return h(e,t,r)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(o).join(" & ")},t},quacksLike:function(e){function t(t){return e===f(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return!i.Nil(t)&&!i.Nil(t.length)&&(!r||t.length===e.length)&&e.every((function(e,n){try{return h(e,t[n],r)}catch(e){throw u(e,n)}}))}return t.toJSON=function(){return"("+e.map(o).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function l(e){if(i.String(e))return"?"===e[0]?c.maybe(e.slice(1)):i[e]||c.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(e[0])}return c.object(e)}return i.Function(e)?e:c.value(e)}function h(e,t,r,n){if(i.Function(e)){if(e(t,r))return!0;throw new a(n||e,t)}return h(l(e),t,r)}for(var d in c.oneOf=c.anyOf,i)h[d]=i[d];for(d in c)h[d]=c[d];var p=r(9542);for(d in p)h[d]=p[d];h.compile=l,h.TfTypeError=a,h.TfPropertyTypeError=s,e.exports=h},2113:e=>{var t={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var r in t.Null=t.Nil,t)t[r].toJSON=function(e){return e}.bind(null,r);e.exports=t},4643:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},1135:e=>{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},9032:(e,t,r)=>{var n=r(7244),i=r(8184),o=r(5767),a=r(5680);function s(e){return e.call.bind(e)}var u="undefined"!=typeof BigInt,f="undefined"!=typeof Symbol,c=s(Object.prototype.toString),l=s(Number.prototype.valueOf),h=s(String.prototype.valueOf),d=s(Boolean.prototype.valueOf);if(u)var p=s(BigInt.prototype.valueOf);if(f)var y=s(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function b(e){return"[object Map]"===c(e)}function m(e){return"[object Set]"===c(e)}function v(e){return"[object WeakMap]"===c(e)}function w(e){return"[object WeakSet]"===c(e)}function _(e){return"[object ArrayBuffer]"===c(e)}function E(e){return"undefined"!=typeof ArrayBuffer&&(_.working?_(e):e instanceof ArrayBuffer)}function S(e){return"[object DataView]"===c(e)}function k(e){return"undefined"!=typeof DataView&&(S.working?S(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=a,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):a(e)||k(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},b.working="undefined"!=typeof Map&&b(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(b.working?b(e):e instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(m.working?m(e):e instanceof Set)},v.working="undefined"!=typeof WeakMap&&v(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(v.working?v(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},_.working="undefined"!=typeof ArrayBuffer&&_(new ArrayBuffer),t.isArrayBuffer=E,S.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&S(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=k;var A="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function T(e){return"[object SharedArrayBuffer]"===c(e)}function P(e){return void 0!==A&&(void 0===T.working&&(T.working=T(new A)),T.working?T(e):e instanceof A)}function O(e){return g(e,l)}function I(e){return g(e,h)}function x(e){return g(e,d)}function N(e){return u&&g(e,p)}function M(e){return f&&g(e,y)}t.isSharedArrayBuffer=P,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===c(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===c(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===c(e)},t.isGeneratorObject=function(e){return"[object Generator]"===c(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===c(e)},t.isNumberObject=O,t.isStringObject=I,t.isBooleanObject=x,t.isBigIntObject=N,t.isSymbolObject=M,t.isBoxedPrimitive=function(e){return O(e)||I(e)||x(e)||N(e)||M(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(E(e)||P(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},537:(e,t,r)=>{var n=r(3184),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},o=/%[sdj%]/g;t.format=function(e){if(!v(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(f(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,a=String(e).replace(o,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r<i;s=n[++r])b(s)||!E(s)?a+=" "+s:a+=" "+f(s);return a},t.deprecate=function(e,r){if(void 0!==n&&!0===n.noDeprecation)return e;if(void 0===n)return function(){return t.deprecate(e,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),i=!0}return e.apply(this,arguments)}};var a={},s=/^$/;if(n.env.NODE_DEBUG){var u=n.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+u+"$","i")}function f(e,r){var n={seen:[],stylize:l};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=c),h(n,e,n.depth)}function c(e,t){var r=f.styles[t];return r?"["+f.colors[r][0]+"m"+e+"["+f.colors[r][1]+"m":e}function l(e,t){return e}function h(e,r,n){if(e.customInspect&&r&&A(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return v(i)||(i=h(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(v(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):b(t)?e.stylize("null","null"):void 0}(e,r);if(o)return o;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),k(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return d(r);if(0===a.length){if(A(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(_(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return e.stylize(Date.prototype.toString.call(r),"date");if(k(r))return d(r)}var f,c="",l=!1,E=["{","}"];return y(r)&&(l=!0,E=["[","]"]),A(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),_(r)&&(c=" "+RegExp.prototype.toString.call(r)),S(r)&&(c=" "+Date.prototype.toUTCString.call(r)),k(r)&&(c=" "+d(r)),0!==a.length||l&&0!=r.length?n<0?_(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),f=l?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a<s;++a)I(t,String(a))?o.push(p(e,t,r,n,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))})),o}(e,r,n,s,a):a.map((function(t){return p(e,r,n,s,t,l)})),e.seen.pop(),function(e,t,r){return e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(f,c,E)):E[0]+c+E[1]}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),I(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=b(r)?h(e,u.value,null):h(e,u.value,r-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function y(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function b(e){return null===e}function m(e){return"number"==typeof e}function v(e){return"string"==typeof e}function w(e){return void 0===e}function _(e){return E(e)&&"[object RegExp]"===T(e)}function E(e){return"object"==typeof e&&null!==e}function S(e){return E(e)&&"[object Date]"===T(e)}function k(e){return E(e)&&("[object Error]"===T(e)||e instanceof Error)}function A(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function P(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(s.test(e)){var r=n.pid;a[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else a[e]=function(){};return a[e]},t.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(9032),t.isArray=y,t.isBoolean=g,t.isNull=b,t.isNullOrUndefined=function(e){return null==e},t.isNumber=m,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=_,t.types.isRegExp=_,t.isObject=E,t.isDate=S,t.types.isDate=S,t.isError=k,t.types.isNativeError=k,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(1135);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(r=[P((e=new Date).getHours()),P(e.getMinutes()),P(e.getSeconds())].join(":"),[e.getDate(),O[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(6698),t._extend=function(e,t){if(!t||!E(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function N(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(e){r(e)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),x&&Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=x,t.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var i=t.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,t).then((function(e){n.nextTick(a.bind(null,null,e))}),(function(e){n.nextTick(N.bind(null,e,a))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,i(e)),t}},8469:(e,t,r)=>{var n=r(2861).Buffer,i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function a(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:function e(t,r,i){if(o(t),r||(r=n.allocUnsafe(a(t))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),t<253?(r.writeUInt8(t,i),e.bytes=1):t<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(t,i+1),e.bytes=3):t<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(t,i+1),e.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(t>>>0,i+1),r.writeUInt32LE(t/4294967296|0,i+5),e.bytes=9),r},decode:function e(t,r){if(!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=t.readUInt8(r);if(i<253)return e.bytes=1,i;if(253===i)return e.bytes=3,t.readUInt16LE(r+1);if(254===i)return e.bytes=5,t.readUInt32LE(r+1);e.bytes=9;var a=t.readUInt32LE(r+1),s=4294967296*t.readUInt32LE(r+5)+a;return o(s),s},encodingLength:a}},5767:(e,t,r)=>{var n=r(2682),i=r(9209),o=r(487),a=r(8075),s=r(5795),u=a("Object.prototype.toString"),f=r(9092)(),c="undefined"==typeof globalThis?r.g:globalThis,l=i(),h=a("String.prototype.slice"),d=Object.getPrototypeOf,p=a("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},y={__proto__:null};n(l,f&&s&&d?function(e){var t=new c[e];if(Symbol.toStringTag in t){var r=d(t),n=s(r,Symbol.toStringTag);if(!n){var i=d(r);n=s(i,Symbol.toStringTag)}y["$"+e]=o(n.get)}}:function(e){var t=new c[e],r=t.slice||t.set;r&&(y["$"+e]=o(r))}),e.exports=function(e){if(!e||"object"!=typeof e)return!1;if(!f){var t=h(u(e),8,-1);return p(l,t)>-1?t:"Object"===t&&function(e){var t=!1;return n(y,(function(r,n){if(!t)try{r(e),t=h(n,1)}catch(e){}})),t}(e)}return s?function(e){var t=!1;return n(y,(function(r,n){if(!t)try{"$"+r(e)===n&&(t=h(n,1))}catch(e){}})),t}(e):null}},7513:(e,t,r)=>{var n=r(8287).Buffer,i=r(7701);function o(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function a(e,t,r){var i=new n(r?34:33);return i.writeUInt8(e,0),t.copy(i,1),r&&(i[33]=1),i}e.exports={decode:function(e,t){return o(i.decode(e),t)},decodeRaw:o,encode:function(e,t,r){return"number"==typeof e?i.encode(a(e,t,r)):i.encode(a(e.version,e.privateKey,e.compressed))},encodeRaw:a}},1448:(e,t,r)=>{var n=r(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(255!==t[a])throw new TypeError(o+" is ambiguous");t[a]=i}var s=e.length,u=e.charAt(0),f=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.alloc(0);for(var r=0,i=0,o=0;e[r]===u;)i++,r++;for(var a=(e.length-r)*f+1>>>0,c=new Uint8Array(a);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var h=0,d=a-1;(0!==l||h<o)&&-1!==d;d--,h++)l+=s*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,r++}for(var p=a-o;p!==a&&0===c[p];)p++;var y=n.allocUnsafe(i+(a-p));y.fill(0,0,i);for(var g=i;p!==a;)y[g++]=c[p++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var f=(a-o)*c+1>>>0,l=new Uint8Array(f);o!==a;){for(var h=t[o],d=0,p=f-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*l[p]>>>0,l[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===l[y];)y++;for(var g=u.repeat(r);y<f;++y)g+=e.charAt(l[y]);return g},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},3119:(e,t,r)=>{var n=r(1448);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8016:(e,t,r)=>{var n=r(3119),i=r(2861).Buffer;e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=e(t);return n.encode(i.concat([t,r],t.length+4))},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},7701:(e,t,r)=>{var n=r(7108),i=r(8016);e.exports=i((function(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()}))},1324:(e,t,r)=>{e.exports=function e(t,n,i){function o(s,u){if(!n[s]){if(!t[s]){var f=void 0;if(!u&&f)return undefined(s,!0);if(a)return a(s,!0);throw(f=new Error("Cannot find module '"+s+"'")).code="MODULE_NOT_FOUND",r(718)}f=n[s]={exports:{}},t[s][0].call(f.exports,(function(e){return o(t[s][1][e]||e)}),f,f.exports,e,t,n,i)}return n[s].exports}for(var a=void 0,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.version="4.0.49"},{}],2:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./utils/properties");function i(){n.setType(this,"Signer")}i.isSigner=function(e){return n.isType(e,"Signer")},e=i,r.Signer=e},{"./utils/properties":74}],3:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./utils/bignumber");r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ",e=n.bigNumberify(-1),r.NegativeOne=e,e=n.bigNumberify(0),r.Zero=e,e=n.bigNumberify(1),r.One=e,e=n.bigNumberify(2),r.Two=e,e=n.bigNumberify("1000000000000000000"),r.WeiPerEther=e,n=n.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MaxUint256=n},{"./utils/bignumber":63}],4:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./constants"),u=o(e("./errors")),f=e("./utils/abi-coder"),c=e("./utils/address"),l=e("./utils/bignumber"),h=e("./utils/bytes"),d=e("./utils/interface"),p=e("./utils/properties"),y=e("./providers/abstract-provider"),g=e("./abstract-signer"),b=(i(m,a=g.Signer),m.prototype.getAddress=function(){return Promise.resolve(this.address)},m.prototype._fail=function(e,t){return Promise.resolve().then((function(){u.throwError(e,u.UNSUPPORTED_OPERATION,{operation:t})}))},m.prototype.signMessage=function(e){return this._fail("VoidSigner cannot sign messages","signMessage")},m.prototype.sendTransaction=function(e){return this._fail("VoidSigner cannot sign transactions","sendTransaction")},m.prototype.connect=function(e){return new m(this.address,e)},m);function m(e,t){var r=a.call(this)||this;return p.defineReadOnly(r,"address",e),p.defineReadOnly(r,"provider",t),r}r.VoidSigner=b;var v={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function w(e,t,r){var n=e.interface.functions[t];return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var o={},a=null;if(t.length===n.inputs.length+1&&"object"==typeof t[t.length-1])for(var c in null!=(o=p.shallowCopy(t.pop())).blockTag&&(a=o.blockTag),delete o.blockTag,o)if(!v[c])throw new Error("unknown transaction override "+c);if(t.length!=n.inputs.length)throw new Error("incorrect number of arguments");return["data","to"].forEach((function(e){null!=o[e]&&u.throwError("cannot override "+e,u.UNSUPPORTED_OPERATION,{operation:e})})),o.to=e._deployed(a).then((function(){return e.addressPromise})),function e(t,r,n){if(Array.isArray(n)){var i=[];return n.forEach((function(n,o){var a;a=Array.isArray(r)?r[o]:r[n.name],i.push(e(t,a,n))})),Promise.all(i)}if("address"===n.type)return t.resolveName(r);if("tuple"===n.type)return e(t,r,n.components);var o=n.type.match(/(.*)(\[[0-9]*\]$)/);if(o){if(!Array.isArray(r))throw new Error("invalid value for array");var a=[],s={components:n.components,type:o[1]};return r.forEach((function(r){a.push(e(t,r,s))})),Promise.all(a)}return Promise.resolve(r)}(e.provider,t,n.inputs).then((function(t){if(o.data=n.encode(t),"call"===n.type)return r?Promise.resolve(s.Zero):(e.provider||u.throwError("call (constant functions) require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"call"}),["gasLimit","gasPrice","value"].forEach((function(e){if(null!=o[e])throw new Error("call cannot override "+e)})),null==o.from&&e.signer&&(o.from=e.signer.getAddress()),e.provider.call(o,a).then((function(r){var i;h.hexDataLength(r)%32==4&&"0x08c379a0"===h.hexDataSlice(r,0,4)&&(i=f.defaultAbiCoder.decode(["string"],h.hexDataSlice(r,4)),u.throwError("call revert exception",u.CALL_EXCEPTION,{address:e.address,args:t,method:n.signature,errorSignature:"Error(string)",errorArgs:[i],reason:i,transaction:o}));try{var a=n.decode(r);return 1===n.outputs.length?a[0]:a}catch(i){throw"0x"===r&&0<n.outputs.length&&u.throwError("call exception",u.CALL_EXCEPTION,{address:e.address,method:n.signature,args:t}),i}})));if("transaction"===n.type)return r?(e.provider||u.throwError("estimate gas require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"estimateGas"}),null==o.from&&e.signer&&(o.from=e.signer.getAddress()),e.provider.estimateGas(o)):(null==o.gasLimit&&null!=n.gas&&(o.gasLimit=l.bigNumberify(n.gas).add(21e3)),e.signer||u.throwError("sending a transaction requires a signer",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=o.from&&u.throwError("cannot override from in a transaction",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),e.signer.sendTransaction(o).then((function(t){var r=t.wait.bind(t);return t.wait=function(t){return r(t).then((function(t){return t.events=t.logs.map((function(r){var n=p.deepCopy(r);return(r=e.interface.parseLog(r))&&(n.args=r.values,n.decode=r.decode,n.event=r.name,n.eventSignature=r.signature),n.removeListener=function(){return e.provider},n.getBlock=function(){return e.provider.getBlock(t.blockHash)},n.getTransaction=function(){return e.provider.getTransaction(t.transactionHash)},n.getTransactionReceipt=function(){return Promise.resolve(t)},n})),t}))},t})));throw new Error("invalid type - "+n.type)}))}}function _(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.join(":"):""):"*"}var E=(S.prototype.deployed=function(){return this._deployed()},S.prototype._deployed=function(e){var t=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return t})):this._deployedPromise=this.provider.getCode(this.address,e).then((function(e){return"0x"===e&&u.throwError("contract not deployed",u.UNSUPPORTED_OPERATION,{contractAddress:t.address,operation:"getDeployed"}),t}))),this._deployedPromise},S.prototype.fallback=function(e){var t=this;this.signer||u.throwError("sending a transaction requires a signer",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=p.shallowCopy(e||{});return["from","to"].forEach((function(e){null!=r[e]&&u.throwError("cannot override "+e,u.UNSUPPORTED_OPERATION,{operation:e})})),r.to=this.addressPromise,this.deployed().then((function(){return t.signer.sendTransaction(r)}))},S.prototype.connect=function(e){return"string"==typeof e&&(e=new b(e,this.provider)),e=new S(this.address,this.interface,e),this.deployTransaction&&p.defineReadOnly(e,"deployTransaction",this.deployTransaction),e},S.prototype.attach=function(e){return new S(e,this.interface,this.signer||this.provider)},S.isIndexed=function(e){return d.Interface.isIndexed(e)},S.prototype._getEventFilter=function(e){var t=this;if("string"==typeof e){if("*"===e)return{prepareEvent:function(e){var r=t.interface.parseLog(e);return r&&(e.args=r.values,e.decode=r.decode,e.event=r.name,e.eventSignature=r.signature),[e]},eventTag:"*",filter:{address:this.address}};-1!==e.indexOf("(")&&(e=f.formatSignature(f.parseSignature("event "+e)));var r=this.interface.events[e];r||u.throwError("unknown event - "+e,u.INVALID_ARGUMENT,{argumnet:"eventName",value:e});var n={address:this.address,topics:[r.topic]};return{prepareEvent:function(e){var t=r.decode(e.data,e.topics);return e.args=t,(t=Array.prototype.slice.call(t)).push(e),t},event:r,eventTag:_(n),filter:n}}n={address:this.address};var i=null;if(e.topics&&e.topics[0])for(var o in n.topics=e.topics,this.interface.events)if(-1!==o.indexOf("(")&&(o=this.interface.events[o]).topic===e.topics[0].toLowerCase()){i=o;break}return{prepareEvent:function(e){if(!i)return[e];var t=i.decode(e.data,e.topics);return e.args=t,(t=Array.prototype.slice.call(t)).push(e),t},event:i,eventTag:_(n),filter:n}},S.prototype._addEventListener=function(e,t,r){var n=this;function i(r){var i=p.deepCopy(r),o=e.prepareEvent(i);e.event&&(i.decode=e.event.decode,i.event=e.event.name,i.eventSignature=e.event.signature),i.removeListener=function(){n.removeListener(e.filter,t)},i.getBlock=function(){return n.provider.getBlock(r.blockHash)},i.getTransaction=function(){return n.provider.getTransaction(r.transactionHash)},i.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(r.transactionHash)},n.emit.apply(n,[e.filter].concat(o))}this.provider||u.throwError("events require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"once"}),this.provider.on(e.filter,i),this._events.push({eventFilter:e,listener:t,wrappedListener:i,once:r})},S.prototype.on=function(e,t){return this._addEventListener(this._getEventFilter(e),t,!1),this},S.prototype.once=function(e,t){return this._addEventListener(this._getEventFilter(e),t,!0),this},S.prototype.addListener=function(e,t){return this.on(e,t)},S.prototype.emit=function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this.provider)return!1;var i=!1,o=this._getEventFilter(e);return this._events=this._events.filter((function(e){return e.eventFilter.eventTag!==o.eventTag||(setTimeout((function(){e.listener.apply(t,r)}),0),i=!0,!e.once)})),i},S.prototype.listenerCount=function(e){if(!this.provider)return 0;var t=this._getEventFilter(e);return this._events.filter((function(e){return e.eventFilter.eventTag===t.eventTag})).length},S.prototype.listeners=function(e){if(!this.provider)return[];var t=this._getEventFilter(e);return this._events.filter((function(e){return e.eventFilter.eventTag===t.eventTag})).map((function(e){return e.listener}))},S.prototype.removeAllListeners=function(e){var t=this;if(!this.provider)return this;var r=this._getEventFilter(e);return this._events=this._events.filter((function(e){return e.eventFilter.eventTag!==r.eventTag||(t.provider.removeListener(e.eventFilter.filter,e.wrappedListener),!1)})),this},S.prototype.removeListener=function(e,t){var r=this;if(!this.provider)return this;var n=!1,i=this._getEventFilter(e);return this._events=this._events.filter((function(e){return e.eventFilter.eventTag!==i.eventTag||e.listener!==t||(r.provider.removeListener(e.eventFilter.filter,e.wrappedListener),!!n||!(n=!0))})),this},S);function S(e,t,r){var n=this;if(u.checkNew(this,S),d.Interface.isInterface(t)?p.defineReadOnly(this,"interface",t):p.defineReadOnly(this,"interface",new d.Interface(t)),g.Signer.isSigner(r)?(p.defineReadOnly(this,"provider",r.provider),p.defineReadOnly(this,"signer",r)):y.Provider.isProvider(r)?(p.defineReadOnly(this,"provider",r),p.defineReadOnly(this,"signer",null)):u.throwError("invalid signer or provider",u.INVALID_ARGUMENT,{arg:"signerOrProvider",value:r}),p.defineReadOnly(this,"estimate",{}),p.defineReadOnly(this,"functions",{}),p.defineReadOnly(this,"filters",{}),Object.keys(this.interface.events).forEach((function(e){var t=n.interface.events[e];p.defineReadOnly(n.filters,e,(function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return{address:n.address,topics:t.encodeTopics(e)}}))})),this._events=[],p.defineReadOnly(this,"address",e),this.provider)p.defineReadOnly(this,"addressPromise",this.provider.resolveName(e).then((function(e){if(null==e)throw new Error("name not found");return e})).catch((function(e){throw e})));else try{p.defineReadOnly(this,"addressPromise",Promise.resolve(c.getAddress(e)))}catch(t){u.throwError("provider is required to use non-address contract address",u.INVALID_ARGUMENT,{argument:"addressOrName",value:e})}Object.keys(this.interface.functions).forEach((function(e){var t=w(n,e,!1);null==n[e]?p.defineReadOnly(n,e,t):u.warn("WARNING: Multiple definitions for "+e),null==n.functions[e]&&(p.defineReadOnly(n.functions,e,t),p.defineReadOnly(n.estimate,e,w(n,e,!0)))}))}function k(e,t,r){var n=null;"string"==typeof t?n=t:h.isArrayish(t)?n=h.hexlify(t):"string"==typeof t.object?n=t.object:u.throwError("bytecode must be a valid hex string",u.INVALID_ARGUMENT,{arg:"bytecode",value:t}),"0x"!==n.substring(0,2)&&(n="0x"+n),h.isHexString(n)||u.throwError("bytecode must be a valid hex string",u.INVALID_ARGUMENT,{arg:"bytecode",value:t}),n.length%2!=0&&u.throwError("bytecode must be valid data (even length)",u.INVALID_ARGUMENT,{arg:"bytecode",value:t}),p.defineReadOnly(this,"bytecode",n),d.Interface.isInterface(e)?p.defineReadOnly(this,"interface",e):p.defineReadOnly(this,"interface",new d.Interface(e)),r&&!g.Signer.isSigner(r)&&u.throwError("invalid signer",u.INVALID_ARGUMENT,{arg:"signer",value:null}),p.defineReadOnly(this,"signer",r||null)}r.Contract=E,k.prototype.getDeployTransaction=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={};if(e.length===this.interface.deployFunction.inputs.length+1)for(var n in r=p.shallowCopy(e.pop()))if(!v[n])throw new Error("unknown transaction override "+n);return["data","from","to"].forEach((function(e){null!=r[e]&&u.throwError("cannot override "+e,u.UNSUPPORTED_OPERATION,{operation:e})})),u.checkArgumentCount(e.length,this.interface.deployFunction.inputs.length," in Contract constructor"),r.data=this.interface.deployFunction.encode(this.bytecode,e),r},k.prototype.deploy=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.getDeployTransaction.apply(this,t);return this.signer.sendTransaction(n).then((function(t){var r=new E(c.getContractAddress(t),e.interface,e.signer);return p.defineReadOnly(r,"deployTransaction",t),r}))},k.prototype.attach=function(e){return new E(e,this.interface,this.signer)},k.prototype.connect=function(e){return new k(this.interface,this.bytecode,e)},k.fromSolidity=function(e,t){null==e&&u.throwError("missing compiler output",u.MISSING_ARGUMENT,{argument:"compilerOutput"});var r=(e="string"==typeof e?JSON.parse(e):e).abi,n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new k(r,n,t)},i=k,r.ContractFactory=i},{"./abstract-signer":2,"./constants":3,"./errors":5,"./providers/abstract-provider":50,"./utils/abi-coder":59,"./utils/address":60,"./utils/bignumber":63,"./utils/bytes":64,"./utils/interface":69,"./utils/properties":74}],5:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./_version");r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.MISSING_NEW="MISSING_NEW",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.NUMERIC_FAULT="NUMERIC_FAULT",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED";var i=!(r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION"),o=!1;function a(e,t,i){if(o)throw new Error("unknown error");t=t||r.UNKNOWN_ERROR,i=i||{};var a=[];Object.keys(i).forEach((function(e){try{a.push(e+"="+JSON.stringify(i[e]))}catch(t){a.push(e+"="+JSON.stringify(i[e].toString()))}})),a.push("version="+n.version);var s=e;a.length&&(e+=" ("+a.join(", ")+")");var u=new Error(e);throw u.reason=s,u.code=t,Object.keys(i).forEach((function(e){u[e]=i[e]})),u}r.throwError=a,r.checkNew=function(e,t){e instanceof t||a("missing new",r.MISSING_NEW,{name:t.name})},r.checkArgumentCount=function(e,t,n){n=n||"",e<t&&a("missing argument"+n,r.MISSING_ARGUMENT,{count:e,expectedCount:t}),t<e&&a("too many arguments"+n,r.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})},r.setCensorship=function(e,t){i&&a("error censorship permanent",r.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o=!!e,i=!!t},r.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(e){try{"test".normalize(e)}catch(t){throw new Error("missing "+e)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){a("platform missing String.prototype.normalize",r.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:e.message})}};var s={debug:1,default:2,info:2,warn:3,error:4,off:5},u=s.default;function f(e,t){u>s[e]||console.log.apply(console,t)}function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];f("warn",e)}r.setLogLevel=function(e){var t=s[e];null!=t?u=t:c("invliad log level - "+e)},r.warn=c,r.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];f("info",e)}},{"./_version":1}],6:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./contract");r.Contract=i.Contract,r.ContractFactory=i.ContractFactory,r.VoidSigner=i.VoidSigner,i=e("./abstract-signer"),r.Signer=i.Signer,i=e("./wallet"),r.Wallet=i.Wallet,i=n(e("./constants")),r.constants=i;var o=n(e("./errors"));r.errors=o;var a=n(e("./providers"));r.providers=a;var s=n(e("./utils"));r.utils=s,n=n(e("./wordlists")),r.wordlists=n,n=e("./utils/shims"),r.platform=n.platform,e=e("./_version"),r.version=e.version,r.getDefaultProvider=function(e){var t=s.getNetwork(e=null==e?"homestead":e);return t&&t._defaultProvider||o.throwError("unsupported getDefaultProvider network",o.UNSUPPORTED_OPERATION,{operation:"getDefaultProvider",network:e}),t._defaultProvider(a)}},{"./_version":1,"./abstract-signer":2,"./constants":3,"./contract":4,"./errors":5,"./providers":54,"./utils":68,"./utils/shims":80,"./wallet":88,"./wordlists":89}],7:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0}),n=n(e("./ethers")),r.ethers=n,function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./ethers"))},{"./ethers":6}],8:[function(e,t,r){!function(e){function n(e){return parseInt(e)===e}function i(e){if(n(e.length)){for(var t=0;t<e.length;t++)if(!n(e[t])||e[t]<0||255<e[t])return;return 1}}function o(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t?e.slice?e.slice():Array.prototype.slice.call(e):e;if(Array.isArray(e)){if(!i(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(n(e.length)&&i(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function a(e){return new Uint8Array(e)}function s(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var u,f={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return o(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):191<n&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},c=(u="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(u[(240&n)>>4]+u[15&n])}return t.join("")}}),l={16:10,24:12,32:14},h=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[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],p=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],y=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],g=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],b=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],m=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],v=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],w=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],E=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],S=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],k=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],T=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function P(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var O=function(e){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};O.prototype._prepare=function(){var e=l[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(e+1),i=this.key.length/4,o=P(this.key);for(t=0;t<i;t++)this._Ke[r=t>>2][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,s=0,u=i;u<n;){if(a=o[i-1],o[0]^=d[a>>16&255]<<24^d[a>>8&255]<<16^d[255&a]<<8^d[a>>24&255]^h[s]<<24,s+=1,8!=i)for(t=1;t<i;t++)o[t]^=o[t-1];else{for(t=1;t<i/2;t++)o[t]^=o[t-1];for(a=o[i/2-1],o[i/2]^=d[255&a]^d[a>>8&255]<<8^d[a>>16&255]<<16^d[a>>24&255]<<24,t=i/2+1;t<i;t++)o[t]^=o[t-1]}for(t=0;t<i&&u<n;)this._Ke[f=u>>2][c=u%4]=o[t],this._Kd[e-f][c]=o[t++],u++}for(var f=1;f<e;f++)for(var c=0;c<4;c++)a=this._Kd[f][c],this._Kd[f][c]=S[a>>24&255]^k[a>>16&255]^A[a>>8&255]^T[255&a]},O.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=P(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o<t;o++){for(i=0;i<4;i++)r[i]=y[n[i]>>24&255]^g[n[(i+1)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^m[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Ke[t][i],u[4*i]=255&(d[n[i]>>24&255]^s>>24),u[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return u},O.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=P(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o<t;o++){for(i=0;i<4;i++)r[i]=v[n[i]>>24&255]^w[n[(i+3)%4]>>16&255]^_[n[(i+2)%4]>>8&255]^E[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Kd[t][i],u[4*i]=255&(p[n[i]>>24&255]^s>>24),u[4*i+1]=255&(p[n[(i+3)%4]>>16&255]^s>>16),u[4*i+2]=255&(p[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(p[255&n[(i+1)%4]]^s);return u};var I=function(e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new O(e)};I.prototype.encrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.encrypt(r),t,n);return t},I.prototype.decrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.decrypt(r),t,n);return t};var x=function(e,t){if(!(this instanceof x))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=a(16);this._lastCipherblock=o(t,!0),this._aes=new O(e)};x.prototype.encrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16){s(e,r,0,n,n+16);for(var i=0;i<16;i++)r[i]^=this._lastCipherblock[i];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,t,n)}return t},x.prototype.decrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16){s(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var i=0;i<16;i++)t[n+i]=r[i]^this._lastCipherblock[i];s(e,this._lastCipherblock,0,n,n+16)}return t};var N=function(e,t,r){if(!(this instanceof N))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=a(16);this.segmentSize=r=r||1,this._shiftRegister=o(t,!0),this._aes=new O(e)};N.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t=o(e,!0),r=0;r<t.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)t[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(t,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return t},N.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t=o(e,!0),r=0;r<t.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)t[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return t};var M=function(e,t){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=a(16);this._lastPrecipher=o(t,!0),this._lastPrecipherIndex=16,this._aes=new O(e)};M.prototype.encrypt=function(e){for(var t=o(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},M.prototype.decrypt=M.prototype.encrypt;var R=function(e){if(!(this instanceof R))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0===e||e?e:1)?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");for(var t=15;0<=t;--t)this._counter[t]=e%256,e>>=8},R.prototype.setBytes=function(e){if(16!=(e=o(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},R.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var B=function(e,t){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof R||(t=new R(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new O(e)};B.prototype.encrypt=function(e){for(var t=o(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},B.prototype.decrypt=B.prototype.encrypt,f={AES:O,Counter:R,ModeOfOperation:{ecb:I,cbc:x,cfb:N,ofb:M,ctr:B},utils:{hex:c,utf8:f},padding:{pkcs7:{pad:function(e){var t=16-(e=o(e,!0)).length%16,r=a(e.length+t);s(e,r);for(var n=e.length;n<r.length;n++)r[n]=t;return r},strip:function(e){if((e=o(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(16<t)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n<t;n++)if(e[r+n]!==t)throw new Error("PKCS#7 invalid padding byte");var i=a(r);return s(e,i,0,0,r),i}}},_arrayTest:{coerceArray:o,createArray:a,copyArray:s}},void 0!==r?t.exports=f:(e.aesjs&&(f._aesjs=e.aesjs),e.aesjs=f)}(this)},{}],9:[function(e,t,r){!function(t,r){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){function r(){}e.super_=t,r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,(this.red=null)!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof t?t.exports=o:r.BN=o,(o.BN=o).wordSize=26;try{a=("undefined"!=typeof window&&void 0!==window.Buffer?window:e("buffer")).Buffer}catch(t){}function s(e,t){return 65<=(t=e.charCodeAt(t))&&t<=70?t-55:97<=t&&t<=102?t-87:t-48&15}function u(e,t,r){var n=s(e,r);return t<=r-1&&(n|=s(e,r-1)<<4),n}function f(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=n,i+=49<=s?s-49+10:17<=s?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return 0<e.cmp(t)?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);n((t="hex"===t?16:t)===(0|t)&&2<=t&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i,o,a=0;a<this.length;a++)this.words[a]=0;var s=0;if("be"===r)for(a=e.length-1,i=0;0<=a;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=a=0;a<e.length;a+=3)o=e[a]|e[a+1]<<8|e[a+2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=e.length-1;t<=n;n-=2)i=u(e,t,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=u(e,t,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;i=i/t|0;for(var o=e.length-r,a=o%--n,s=Math.min(o,o-a)+r,u=0,c=r;c<s;c+=n)u=f(e,c,c+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!=a){var l=1;for(u=f(e,c,e.length,t),c=0;c<a;c++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0,i=(n=(r.length=n)-1|0,(a=(0|e.words[0])*(0|t.words[0]))/67108864|0);r.words[0]=67108863&a;for(var o=1;o<n;o++){for(var a,s=i>>>26,u=67108863&i,f=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=f;c++)s+=(a=(0|e.words[o-c|0])*(0|t.words[c])+u)/67108864|0,u=67108863&a;r.words[o]=0|u,i=0|s}return 0!==i?r.words[o]=0|i:r.length--,r.strip()}o.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){u="";for(var r=0,i=0,o=0;o<this.length;o++){var a=this.words[o],s=(16777215&(a<<r|i)).toString(16),u=0!=(i=a>>>24-r&16777215)||o!==this.length-1?c[6-s.length]+s+u:s+u;26<=(r+=2)&&(r-=26,o--)}for(0!==i&&(u=i.toString(16)+u);u.length%t!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}if(e===(0|e)&&2<=e&&e<=36){var f=l[e],d=h[e];for(u="",(p=this.clone()).negative=0;!p.isZero();){var p,y=p.modn(d).toString(e);u=(p=p.idivn(d)).isZero()?y+u:c[f-y.length]+y+u}for(this.isZero()&&(u="0"+u);u.length%t!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(0<o,"Requested array length <= 0"),this.strip(),t="le"===t;var a,s,u=new e(o),f=this.clone();if(t){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e;return e=0,4096<=t&&(e+=13,t>>>=13),64<=t&&(e+=7,t>>>=7),8<=t&&(e+=4,t>>>=4),2<=t&&(e+=2,t>>>=2),e+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e;return e=0,!(8191&t)&&(e+=13,t>>>=13),!(127&t)&&(e+=7,t>>>=7),!(15&t)&&(e+=4,t>>>=4),!(3&t)&&(e+=2,t>>>=2),!(1&t)&&e++,e},o.prototype.bitLength=function(){var e=this.words[this.length-1];return e=this._countBits(e),26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return n(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return n(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){for(var t,r=this.length>e.length?(t=this,e):(t=e,this),n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return n(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26);e%=26,this._expand(t),0<e&&t--;for(var r=0;r<t;r++)this.words[r]=67108863&~this.words[r];return 0<e&&(this.words[r]=~this.words[r]&67108863>>26-e),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&0<=e);var r=e/26|0;return e%=26,this._expand(1+r),this.words[r]=t?this.words[r]|1<<e:this.words[r]&~(1<<e),this.strip()},o.prototype.iadd=function(e){var t,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();for(var n=this.length>e.length?(r=this,e):(r=e,this),i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;for(var i=0<n?(r=this,e):(r=e,this),o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var n,i,o,a=e.words,s=t.words,u=r.words,f=8191&(n=0|a[0]),c=n>>>13,l=8191&(V=0|a[1]),h=V>>>13,d=8191&(z=0|a[2]),p=z>>>13,y=8191&(i=0|a[3]),g=i>>>13,b=8191&(q=0|a[4]),m=q>>>13,v=8191&(Z=0|a[5]),w=Z>>>13,_=8191&(o=0|a[6]),E=o>>>13,S=8191&($=0|a[7]),k=$>>>13,A=8191&(X=0|a[8]),T=X>>>13,P=8191&(Y=0|a[9]),O=Y>>>13,I=8191&(J=0|s[0]),x=J>>>13,N=0|s[1],M=8191&N,R=N>>>13,B=0|s[2],L=8191&B,C=B>>>13,U=8191&(Q=0|s[3]),j=Q>>>13,D=0|s[4],F=8191&D,H=D>>>13,K=0|s[5],G=8191&K,W=K>>>13,V=8191&(n=0|s[6]),z=n>>>13,q=8191&(i=0|s[7]),Z=i>>>13,$=8191&(o=0|s[8]),X=o>>>13,Y=8191&(a=0|s[9]),J=a>>>13;r.negative=e.negative^t.negative,r.length=19;var Q=(0+Math.imul(f,I)|0)+((8191&(B=(B=Math.imul(f,x))+Math.imul(c,I)|0))<<13)|0,ee=((D=Math.imul(c,x))+(B>>>13)|0)+(Q>>>26)|0;return Q&=67108863,N=Math.imul(l,I),B=(B=Math.imul(l,x))+Math.imul(h,I)|0,D=Math.imul(h,x),K=(ee+(N+Math.imul(f,M)|0)|0)+((8191&(B=(B=B+Math.imul(f,R)|0)+Math.imul(c,M)|0))<<13)|0,ee=((D=D+Math.imul(c,R)|0)+(B>>>13)|0)+(K>>>26)|0,K&=67108863,N=Math.imul(d,I),B=(B=Math.imul(d,x))+Math.imul(p,I)|0,D=Math.imul(p,x),N=N+Math.imul(l,M)|0,B=(B=B+Math.imul(l,R)|0)+Math.imul(h,M)|0,D=D+Math.imul(h,R)|0,n=(ee+(N+Math.imul(f,L)|0)|0)+((8191&(B=(B=B+Math.imul(f,C)|0)+Math.imul(c,L)|0))<<13)|0,ee=((D=D+Math.imul(c,C)|0)+(B>>>13)|0)+(n>>>26)|0,n&=67108863,N=Math.imul(y,I),B=(B=Math.imul(y,x))+Math.imul(g,I)|0,D=Math.imul(g,x),N=N+Math.imul(d,M)|0,B=(B=B+Math.imul(d,R)|0)+Math.imul(p,M)|0,D=D+Math.imul(p,R)|0,N=N+Math.imul(l,L)|0,B=(B=B+Math.imul(l,C)|0)+Math.imul(h,L)|0,D=D+Math.imul(h,C)|0,i=(ee+(N+Math.imul(f,U)|0)|0)+((8191&(B=(B=B+Math.imul(f,j)|0)+Math.imul(c,U)|0))<<13)|0,ee=((D=D+Math.imul(c,j)|0)+(B>>>13)|0)+(i>>>26)|0,i&=67108863,N=Math.imul(b,I),B=(B=Math.imul(b,x))+Math.imul(m,I)|0,D=Math.imul(m,x),N=N+Math.imul(y,M)|0,B=(B=B+Math.imul(y,R)|0)+Math.imul(g,M)|0,D=D+Math.imul(g,R)|0,N=N+Math.imul(d,L)|0,B=(B=B+Math.imul(d,C)|0)+Math.imul(p,L)|0,D=D+Math.imul(p,C)|0,N=N+Math.imul(l,U)|0,B=(B=B+Math.imul(l,j)|0)+Math.imul(h,U)|0,D=D+Math.imul(h,j)|0,o=(ee+(N+Math.imul(f,F)|0)|0)+((8191&(B=(B=B+Math.imul(f,H)|0)+Math.imul(c,F)|0))<<13)|0,ee=((D=D+Math.imul(c,H)|0)+(B>>>13)|0)+(o>>>26)|0,o&=67108863,N=Math.imul(v,I),B=(B=Math.imul(v,x))+Math.imul(w,I)|0,D=Math.imul(w,x),N=N+Math.imul(b,M)|0,B=(B=B+Math.imul(b,R)|0)+Math.imul(m,M)|0,D=D+Math.imul(m,R)|0,N=N+Math.imul(y,L)|0,B=(B=B+Math.imul(y,C)|0)+Math.imul(g,L)|0,D=D+Math.imul(g,C)|0,N=N+Math.imul(d,U)|0,B=(B=B+Math.imul(d,j)|0)+Math.imul(p,U)|0,D=D+Math.imul(p,j)|0,N=N+Math.imul(l,F)|0,B=(B=B+Math.imul(l,H)|0)+Math.imul(h,F)|0,D=D+Math.imul(h,H)|0,s=(ee+(N+Math.imul(f,G)|0)|0)+((8191&(B=(B=B+Math.imul(f,W)|0)+Math.imul(c,G)|0))<<13)|0,ee=((D=D+Math.imul(c,W)|0)+(B>>>13)|0)+(s>>>26)|0,s&=67108863,N=Math.imul(_,I),B=(B=Math.imul(_,x))+Math.imul(E,I)|0,D=Math.imul(E,x),N=N+Math.imul(v,M)|0,B=(B=B+Math.imul(v,R)|0)+Math.imul(w,M)|0,D=D+Math.imul(w,R)|0,N=N+Math.imul(b,L)|0,B=(B=B+Math.imul(b,C)|0)+Math.imul(m,L)|0,D=D+Math.imul(m,C)|0,N=N+Math.imul(y,U)|0,B=(B=B+Math.imul(y,j)|0)+Math.imul(g,U)|0,D=D+Math.imul(g,j)|0,N=N+Math.imul(d,F)|0,B=(B=B+Math.imul(d,H)|0)+Math.imul(p,F)|0,D=D+Math.imul(p,H)|0,N=N+Math.imul(l,G)|0,B=(B=B+Math.imul(l,W)|0)+Math.imul(h,G)|0,D=D+Math.imul(h,W)|0,a=(ee+(N+Math.imul(f,V)|0)|0)+((8191&(B=(B=B+Math.imul(f,z)|0)+Math.imul(c,V)|0))<<13)|0,ee=((D=D+Math.imul(c,z)|0)+(B>>>13)|0)+(a>>>26)|0,a&=67108863,N=Math.imul(S,I),B=(B=Math.imul(S,x))+Math.imul(k,I)|0,D=Math.imul(k,x),N=N+Math.imul(_,M)|0,B=(B=B+Math.imul(_,R)|0)+Math.imul(E,M)|0,D=D+Math.imul(E,R)|0,N=N+Math.imul(v,L)|0,B=(B=B+Math.imul(v,C)|0)+Math.imul(w,L)|0,D=D+Math.imul(w,C)|0,N=N+Math.imul(b,U)|0,B=(B=B+Math.imul(b,j)|0)+Math.imul(m,U)|0,D=D+Math.imul(m,j)|0,N=N+Math.imul(y,F)|0,B=(B=B+Math.imul(y,H)|0)+Math.imul(g,F)|0,D=D+Math.imul(g,H)|0,N=N+Math.imul(d,G)|0,B=(B=B+Math.imul(d,W)|0)+Math.imul(p,G)|0,D=D+Math.imul(p,W)|0,N=N+Math.imul(l,V)|0,B=(B=B+Math.imul(l,z)|0)+Math.imul(h,V)|0,D=D+Math.imul(h,z)|0,e=(ee+(N+Math.imul(f,q)|0)|0)+((8191&(B=(B=B+Math.imul(f,Z)|0)+Math.imul(c,q)|0))<<13)|0,ee=((D=D+Math.imul(c,Z)|0)+(B>>>13)|0)+(e>>>26)|0,e&=67108863,N=Math.imul(A,I),B=(B=Math.imul(A,x))+Math.imul(T,I)|0,D=Math.imul(T,x),N=N+Math.imul(S,M)|0,B=(B=B+Math.imul(S,R)|0)+Math.imul(k,M)|0,D=D+Math.imul(k,R)|0,N=N+Math.imul(_,L)|0,B=(B=B+Math.imul(_,C)|0)+Math.imul(E,L)|0,D=D+Math.imul(E,C)|0,N=N+Math.imul(v,U)|0,B=(B=B+Math.imul(v,j)|0)+Math.imul(w,U)|0,D=D+Math.imul(w,j)|0,N=N+Math.imul(b,F)|0,B=(B=B+Math.imul(b,H)|0)+Math.imul(m,F)|0,D=D+Math.imul(m,H)|0,N=N+Math.imul(y,G)|0,B=(B=B+Math.imul(y,W)|0)+Math.imul(g,G)|0,D=D+Math.imul(g,W)|0,N=N+Math.imul(d,V)|0,B=(B=B+Math.imul(d,z)|0)+Math.imul(p,V)|0,D=D+Math.imul(p,z)|0,N=N+Math.imul(l,q)|0,B=(B=B+Math.imul(l,Z)|0)+Math.imul(h,q)|0,D=D+Math.imul(h,Z)|0,t=(ee+(N+Math.imul(f,$)|0)|0)+((8191&(B=(B=B+Math.imul(f,X)|0)+Math.imul(c,$)|0))<<13)|0,ee=((D=D+Math.imul(c,X)|0)+(B>>>13)|0)+(t>>>26)|0,t&=67108863,N=Math.imul(P,I),B=(B=Math.imul(P,x))+Math.imul(O,I)|0,D=Math.imul(O,x),N=N+Math.imul(A,M)|0,B=(B=B+Math.imul(A,R)|0)+Math.imul(T,M)|0,D=D+Math.imul(T,R)|0,N=N+Math.imul(S,L)|0,B=(B=B+Math.imul(S,C)|0)+Math.imul(k,L)|0,D=D+Math.imul(k,C)|0,N=N+Math.imul(_,U)|0,B=(B=B+Math.imul(_,j)|0)+Math.imul(E,U)|0,D=D+Math.imul(E,j)|0,N=N+Math.imul(v,F)|0,B=(B=B+Math.imul(v,H)|0)+Math.imul(w,F)|0,D=D+Math.imul(w,H)|0,N=N+Math.imul(b,G)|0,B=(B=B+Math.imul(b,W)|0)+Math.imul(m,G)|0,D=D+Math.imul(m,W)|0,N=N+Math.imul(y,V)|0,B=(B=B+Math.imul(y,z)|0)+Math.imul(g,V)|0,D=D+Math.imul(g,z)|0,N=N+Math.imul(d,q)|0,B=(B=B+Math.imul(d,Z)|0)+Math.imul(p,q)|0,D=D+Math.imul(p,Z)|0,N=N+Math.imul(l,$)|0,B=(B=B+Math.imul(l,X)|0)+Math.imul(h,$)|0,D=D+Math.imul(h,X)|0,f=(ee+(N+Math.imul(f,Y)|0)|0)+((8191&(B=(B=B+Math.imul(f,J)|0)+Math.imul(c,Y)|0))<<13)|0,ee=((D=D+Math.imul(c,J)|0)+(B>>>13)|0)+(f>>>26)|0,f&=67108863,N=Math.imul(P,M),B=(B=Math.imul(P,R))+Math.imul(O,M)|0,D=Math.imul(O,R),N=N+Math.imul(A,L)|0,B=(B=B+Math.imul(A,C)|0)+Math.imul(T,L)|0,D=D+Math.imul(T,C)|0,N=N+Math.imul(S,U)|0,B=(B=B+Math.imul(S,j)|0)+Math.imul(k,U)|0,D=D+Math.imul(k,j)|0,N=N+Math.imul(_,F)|0,B=(B=B+Math.imul(_,H)|0)+Math.imul(E,F)|0,D=D+Math.imul(E,H)|0,N=N+Math.imul(v,G)|0,B=(B=B+Math.imul(v,W)|0)+Math.imul(w,G)|0,D=D+Math.imul(w,W)|0,N=N+Math.imul(b,V)|0,B=(B=B+Math.imul(b,z)|0)+Math.imul(m,V)|0,D=D+Math.imul(m,z)|0,N=N+Math.imul(y,q)|0,B=(B=B+Math.imul(y,Z)|0)+Math.imul(g,q)|0,D=D+Math.imul(g,Z)|0,N=N+Math.imul(d,$)|0,B=(B=B+Math.imul(d,X)|0)+Math.imul(p,$)|0,D=D+Math.imul(p,X)|0,l=(ee+(N+Math.imul(l,Y)|0)|0)+((8191&(B=(B=B+Math.imul(l,J)|0)+Math.imul(h,Y)|0))<<13)|0,ee=((D=D+Math.imul(h,J)|0)+(B>>>13)|0)+(l>>>26)|0,l&=67108863,N=Math.imul(P,L),B=(B=Math.imul(P,C))+Math.imul(O,L)|0,D=Math.imul(O,C),N=N+Math.imul(A,U)|0,B=(B=B+Math.imul(A,j)|0)+Math.imul(T,U)|0,D=D+Math.imul(T,j)|0,N=N+Math.imul(S,F)|0,B=(B=B+Math.imul(S,H)|0)+Math.imul(k,F)|0,D=D+Math.imul(k,H)|0,N=N+Math.imul(_,G)|0,B=(B=B+Math.imul(_,W)|0)+Math.imul(E,G)|0,D=D+Math.imul(E,W)|0,N=N+Math.imul(v,V)|0,B=(B=B+Math.imul(v,z)|0)+Math.imul(w,V)|0,D=D+Math.imul(w,z)|0,N=N+Math.imul(b,q)|0,B=(B=B+Math.imul(b,Z)|0)+Math.imul(m,q)|0,D=D+Math.imul(m,Z)|0,N=N+Math.imul(y,$)|0,B=(B=B+Math.imul(y,X)|0)+Math.imul(g,$)|0,D=D+Math.imul(g,X)|0,d=(ee+(N+Math.imul(d,Y)|0)|0)+((8191&(B=(B=B+Math.imul(d,J)|0)+Math.imul(p,Y)|0))<<13)|0,ee=((D=D+Math.imul(p,J)|0)+(B>>>13)|0)+(d>>>26)|0,d&=67108863,N=Math.imul(P,U),B=(B=Math.imul(P,j))+Math.imul(O,U)|0,D=Math.imul(O,j),N=N+Math.imul(A,F)|0,B=(B=B+Math.imul(A,H)|0)+Math.imul(T,F)|0,D=D+Math.imul(T,H)|0,N=N+Math.imul(S,G)|0,B=(B=B+Math.imul(S,W)|0)+Math.imul(k,G)|0,D=D+Math.imul(k,W)|0,N=N+Math.imul(_,V)|0,B=(B=B+Math.imul(_,z)|0)+Math.imul(E,V)|0,D=D+Math.imul(E,z)|0,N=N+Math.imul(v,q)|0,B=(B=B+Math.imul(v,Z)|0)+Math.imul(w,q)|0,D=D+Math.imul(w,Z)|0,N=N+Math.imul(b,$)|0,B=(B=B+Math.imul(b,X)|0)+Math.imul(m,$)|0,D=D+Math.imul(m,X)|0,y=(ee+(N+Math.imul(y,Y)|0)|0)+((8191&(B=(B=B+Math.imul(y,J)|0)+Math.imul(g,Y)|0))<<13)|0,ee=((D=D+Math.imul(g,J)|0)+(B>>>13)|0)+(y>>>26)|0,y&=67108863,N=Math.imul(P,F),B=(B=Math.imul(P,H))+Math.imul(O,F)|0,D=Math.imul(O,H),N=N+Math.imul(A,G)|0,B=(B=B+Math.imul(A,W)|0)+Math.imul(T,G)|0,D=D+Math.imul(T,W)|0,N=N+Math.imul(S,V)|0,B=(B=B+Math.imul(S,z)|0)+Math.imul(k,V)|0,D=D+Math.imul(k,z)|0,N=N+Math.imul(_,q)|0,B=(B=B+Math.imul(_,Z)|0)+Math.imul(E,q)|0,D=D+Math.imul(E,Z)|0,N=N+Math.imul(v,$)|0,B=(B=B+Math.imul(v,X)|0)+Math.imul(w,$)|0,D=D+Math.imul(w,X)|0,b=(ee+(N+Math.imul(b,Y)|0)|0)+((8191&(B=(B=B+Math.imul(b,J)|0)+Math.imul(m,Y)|0))<<13)|0,ee=((D=D+Math.imul(m,J)|0)+(B>>>13)|0)+(b>>>26)|0,b&=67108863,N=Math.imul(P,G),B=(B=Math.imul(P,W))+Math.imul(O,G)|0,D=Math.imul(O,W),N=N+Math.imul(A,V)|0,B=(B=B+Math.imul(A,z)|0)+Math.imul(T,V)|0,D=D+Math.imul(T,z)|0,N=N+Math.imul(S,q)|0,B=(B=B+Math.imul(S,Z)|0)+Math.imul(k,q)|0,D=D+Math.imul(k,Z)|0,N=N+Math.imul(_,$)|0,B=(B=B+Math.imul(_,X)|0)+Math.imul(E,$)|0,D=D+Math.imul(E,X)|0,v=(ee+(N+Math.imul(v,Y)|0)|0)+((8191&(B=(B=B+Math.imul(v,J)|0)+Math.imul(w,Y)|0))<<13)|0,ee=((D=D+Math.imul(w,J)|0)+(B>>>13)|0)+(v>>>26)|0,v&=67108863,N=Math.imul(P,V),B=(B=Math.imul(P,z))+Math.imul(O,V)|0,D=Math.imul(O,z),N=N+Math.imul(A,q)|0,B=(B=B+Math.imul(A,Z)|0)+Math.imul(T,q)|0,D=D+Math.imul(T,Z)|0,N=N+Math.imul(S,$)|0,B=(B=B+Math.imul(S,X)|0)+Math.imul(k,$)|0,D=D+Math.imul(k,X)|0,_=(ee+(N+Math.imul(_,Y)|0)|0)+((8191&(B=(B=B+Math.imul(_,J)|0)+Math.imul(E,Y)|0))<<13)|0,ee=((D=D+Math.imul(E,J)|0)+(B>>>13)|0)+(_>>>26)|0,_&=67108863,N=Math.imul(P,q),B=(B=Math.imul(P,Z))+Math.imul(O,q)|0,D=Math.imul(O,Z),N=N+Math.imul(A,$)|0,B=(B=B+Math.imul(A,X)|0)+Math.imul(T,$)|0,D=D+Math.imul(T,X)|0,S=(ee+(N+Math.imul(S,Y)|0)|0)+((8191&(B=(B=B+Math.imul(S,J)|0)+Math.imul(k,Y)|0))<<13)|0,ee=((D=D+Math.imul(k,J)|0)+(B>>>13)|0)+(S>>>26)|0,S&=67108863,N=Math.imul(P,$),B=(B=Math.imul(P,X))+Math.imul(O,$)|0,D=Math.imul(O,X),A=(ee+(N+Math.imul(A,Y)|0)|0)+((8191&(B=(B=B+Math.imul(A,J)|0)+Math.imul(T,Y)|0))<<13)|0,ee=((D=D+Math.imul(T,J)|0)+(B>>>13)|0)+(A>>>26)|0,A&=67108863,Y=(ee+Math.imul(P,Y)|0)+((8191&(B=(B=Math.imul(P,J))+Math.imul(O,Y)|0))<<13)|0,ee=((D=Math.imul(O,J))+(B>>>13)|0)+(Y>>>26)|0,Y&=67108863,u[0]=Q,u[1]=K,u[2]=n,u[3]=i,u[4]=o,u[5]=s,u[6]=a,u[7]=e,u[8]=t,u[9]=f,u[10]=l,u[11]=d,u[12]=y,u[13]=b,u[14]=v,u[15]=_,u[16]=S,u[17]=A,u[18]=Y,0!=ee&&(u[19]=ee,r.length++),r};function y(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=d),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return t=(10===this.length&&10===e.length?p:r<63?d:r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){for(var a=i,s=(i=0,67108863&n),u=Math.min(o,t.length-1),f=Math.max(0,o-e.length+1);f<=u;f++){var c,l=(0|e.words[o-f])*(0|t.words[f]);s=67108863&(c=(c=67108863&l)+s|0),i+=(a=(a=a+(l/67108864|0)|0)+(c>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}:y)(this,e,t),t},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},g.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a<o;a++)n[a]=t[e[a]],i[a]=r[e[a]]},g.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),f=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var l=u,h=f,d=0;d<a;d++){var p=r[c+d],y=n[c+d],g=r[c+d+a],b=l*g-h*(m=n[c+d+a]),m=l*m+h*g;r[c+d]=p+(g=b),n[c+d]=y+m,r[c+d+a]=p-g,n[c+d+a]=y-m,d!==s&&(b=u*l-f*h,h=u*h+f*l,l=b)}},g.prototype.guessLen13b=function(e,t){e=1&(n=1|Math.max(t,e));for(var r=0,n=n/2|0;n;n>>>=1)r++;return 1<<r+1+e},g.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},g.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},g.prototype.convert13b=function(e,t,r,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,r[2*a+1]=8191&(o>>>=13),o>>>=13;for(a=2*t;a<i;++a)r[a]=0;n(0===o),n(!(-8192&o))},g.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},g.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),f=new Array(n),c=new Array(n),l=new Array(n),h=r.words;h.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,f,n),this.transform(a,o,s,u,n,i),this.transform(f,o,c,l,n,i);for(var d=0;d<n;d++){var p=s[d]*c[d]-u[d]*l[d];u[d]=s[d]*l[d]+u[d]*c[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,h,o,n,i),this.conjugate(h,o,n),this.normalize13b(h,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),y(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r%26;t[r]=(e.words[r/26|0]&1<<n)>>>n}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){n("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t;if(0!=t){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,u=(0|this.words[a])-s<<t;this.words[a]=u|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(0!=r){for(a=this.length-1;0<=a;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},o.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){n("number"==typeof e&&0<=e);var i=t?(t-t%26)/26:0,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var f=0;f<a;f++)u.words[f]=this.words[f];u.length=a}if(0!==a)if(this.length>a)for(this.length-=a,f=0;f<this.length;f++)this.words[f]=this.words[f+a];else this.words[0]=0,this.length=1;var c=0;for(f=this.length-1;0<=f&&(0!==c||i<=f);f--){var l=0|this.words[f];this.words[f]=c<<26-o|l>>>o,c=l&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&0<=e);var t=e%26;return e=(e-t)/26,!(this.length<=e||!(this.words[e]&1<<t))},o.prototype.imaskn=function(e){n("number"==typeof e&&0<=e);var t=e%26;return e=(e-t)/26,n(0===this.negative,"imaskn works only with positive numbers"),this.length<=e?this:(0!=t&&e++,this.length=Math.min(e,this.length),0!=t&&(this.words[this.length-1]&=67108863^67108863>>>t<<t),this.strip())},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?(1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(e),this.negative=1),this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r;this._expand(i);for(var o=0,a=0;a<e.length;a++){var s=(0|this.words[a+r])+o,u=(0|e.words[a])*t;o=((s-=67108863&u)>>26)-(u/67108864|0),this.words[a+r]=67108863&s}for(;a<this.length-r;a++)o=(s=(0|this.words[a+r])+o)>>26,this.words[a+r]=67108863&s;if(0===o)return this.strip();for(n(-1===o),a=o=0;a<this.length;a++)o=(s=-(0|this.words[a])+o)>>26,this.words[a]=67108863&s;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==t){(s=new o(null)).length=1+u,s.words=new Array(s.length);for(var f=0;f<s.length;f++)s.words[f]=0}0===(e=n.clone()._ishlnsubmul(i,1,u)).negative&&(n=e,s&&(s.words[u]=1));for(var c=u-1;0<=c;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),n.strip(),"div"!==t&&0!=r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),{div:i="mod"!==t?s.div.neg():i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1);return e=e.andln(1),(n=r.cmp(n))<0||1===e&&0===n?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;0<=i;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());for(var t=this,r=e.clone(),i=(t=0!==t.negative?t.umod(e):t.clone(),new o(1)),a=new o(0),s=new o(0),u=new o(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),l=t.clone();!t.isZero();){for(var h=0,d=1;!(t.words[0]&d)&&h<26;++h,d<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(l)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(0<p)for(r.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(l)),s.iushrn(1),u.iushrn(1);0<=t.cmp(r)?(t.isub(r),i.isub(s),a.isub(u)):(r.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());for(var t,r=this,i=e.clone(),a=(r=0!==r.negative?r.umod(e):r.clone(),new o(1)),s=new o(0),u=i.clone();0<r.cmpn(1)&&0<i.cmpn(1);){for(var f=0,c=1;!(r.words[0]&c)&&f<26;++f,c<<=1);if(0<f)for(r.iushrn(f);0<f--;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var l=0,h=1;!(i.words[0]&h)&&l<26;++l,h<<=1);if(0<l)for(i.iushrn(l);0<l--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=r.cmp(i)?(r.isub(i),a.isub(s)):(i.isub(r),s.isub(a))}return(t=0===r.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0;for(var n=r.negative=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e),e=(e-(t=e%26))/26;var t=1<<t;if(this.length<=e)return this._expand(1+e),this.words[e]|=t,this;for(var r=t,i=e;0!==r&&i<this.length;i++){var o=0|this.words[i];r=(o+=r)>>>26,o&=67108863,this.words[i]=o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t=e<0;return 0===this.negative||t?0===this.negative&&t?1:(this.strip(),e=1<this.length?1:(n((e=t?-e:e)<=67108863,"Number is too big"),(t=0|this.words[0])===e?0:t<e?-1:1),0!==this.negative?0|-e:e):-1},o.prototype.cmp=function(e){return 0!==this.negative&&0===e.negative?-1:0===this.negative&&0!==e.negative?1:(e=this.ucmp(e),0!==this.negative?0|-e:e)},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;0<=r;r--){var n=0|this.words[r],i=0|e.words[r];if(n!=i){n<i?t=-1:i<n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return 0<=this.cmpn(e)},o.prototype.gte=function(e){return 0<=this.cmp(e)},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){var t;"string"==typeof e?(t=o._prime(e),this.m=t.p,this.prime=t):(n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null)}function k(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}m.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){for(var t,r=e;this.split(r,this.tmp),(t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength())>this.n;);return 0===(e=t<this.n?-1:r.ucmp(this.p))?(r.words[0]=0,r.length=1):0<e?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(v,m),v.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n<r;n++)t.words[n]=e.words[n];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(4194303&o)<<4|i>>>22,i=o}0==(e.words[n-10]=i>>>=22)&&10<e.length?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(w,m),i(_,m),i(E,m),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return b[e]=t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(!(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return(this.prime?this.prime.ireduce(e):e.umod(this.m))._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){return this._verify2(e,t),0<=(t=e.add(t)).cmp(this.m)&&t.isub(this.m),t._forceRed(this)},S.prototype.iadd=function(e,t){return this._verify2(e,t),0<=(t=e.iadd(t)).cmp(this.m)&&t.isub(this.m),t},S.prototype.sub=function(e,t){return this._verify2(e,t),(t=e.sub(t)).cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},S.prototype.isub=function(e,t){return this._verify2(e,t),(t=e.isub(t)).cmpn(0)<0&&t.iadd(this.m),t},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t)return t=this.m.add(new o(1)).iushrn(2),this.pow(e,t);for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);n(!r.isZero());for(var a=new o(1).toRed(this),s=a.redNeg(),u=this.m.subn(1).iushrn(1),f=new o(2*(f=this.m.bitLength())*f).toRed(this);0!==this.pow(f,u).cmp(s);)f.redIAdd(s);for(var c=this.pow(f,r),l=this.pow(e,r.addn(1).iushrn(1)),h=this.pow(e,r),d=i;0!==h.cmp(a);){for(var p=h,y=0;0!==p.cmp(a);y++)p=p.redSqr();n(y<d);var g=this.pow(c,new o(1).iushln(d-y-1));l=l.redMul(g),c=g.redSqr(),h=h.redMul(c),d=y}return l},S.prototype.invm=function(e){return 0!==(e=e._invmp(this.m)).negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;0<=n;n--){for(var f=t.words[n],c=u-1;0<=c;c--){var l=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!=l||0!==a?(a<<=1,a|=l,(4==++s||0===n&&0===c)&&(i=this.mul(i,r[a]),a=s=0)):s=0}u=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){return(e=e.clone()).red=null,e},o.mont=function(e){return new k(e)},i(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){return(e=this.imod(e.mul(this.rinv))).red=null,e},k.prototype.imul=function(e,t){return e.isZero()||t.isZero()?(e.words[0]=0,e.length=1,e):(t=(e=e.imul(t)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),t=e=e.isub(t).iushrn(this.shift),0<=e.cmp(this.m)?t=e.isub(this.m):e.cmpn(0)<0&&(t=e.iadd(this.m)),t._forceRed(this))},k.prototype.mul=function(e,t){return e.isZero()||t.isZero()?new o(0)._forceRed(this):(t=(e=e.mul(t)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),t=e=e.isub(t).iushrn(this.shift),0<=e.cmp(this.m)?t=e.isub(this.m):e.cmpn(0)<0&&(t=e.iadd(this.m)),t._forceRed(this))},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:11}],10:[function(e,t,n){(function(e){(function(){t.exports=function(t){return t=new Uint8Array(t),(e.crypto||e.msCrypto).getRandomValues(t),t}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,r){},{}],12:[function(e,t,r){r.version=e("../package.json").version,r.utils=e("./elliptic/utils"),r.rand=e("brorand"),r.curve=e("./elliptic/curve"),r.curves=e("./elliptic/curves"),r.ec=e("./elliptic/ec"),r.eddsa=e("./elliptic/eddsa")},{"../package.json":25,"./elliptic/curve":15,"./elliptic/curves":18,"./elliptic/ec":19,"./elliptic/eddsa":22,"./elliptic/utils":24,brorand:10}],13:[function(e,t,r){var n=e("bn.js"),i=e("../utils"),o=i.getNAF,a=i.getJSF,s=i.assert;function u(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0,!(t=this.n&&this.p.div(this.n))||0<t.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}(t.exports=u).prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength);t=(1<<r.step+1)-(r.step%2==0?2:1),t/=3;for(var i=[],a=0;a<n.length;a+=r.step){for(var u=0,f=a+r.step-1;a<=f;f--)u=(u<<1)+n[f];i.push(u)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=t;0<h;h--){for(a=0;a<i.length;a++)(u=i[a])===h?l=l.mixedAdd(r.points[a]):u===-h&&(l=l.mixedAdd(r.points[a].neg()));c=c.add(l)}return c.toP()},u.prototype._wnafMul=function(e,t){for(var r=e._getNAFPoints(4),n=r.wnd,i=r.points,a=o(t,n,this._bitLength),u=this.jpoint(null,null,null),f=a.length-1;0<=f;f--){for(var c=0;0<=f&&0===a[f];f--)c++;if(0<=f&&c++,u=u.dblp(c),f<0)break;var l=a[f];s(0!==l),u="affine"===e.type?0<l?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):0<l?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n,i){for(var s=this._wnafT1,u=this._wnafT2,f=this._wnafT3,c=0,l=0;l<n;l++){var h,d=(h=t[l])._getNAFPoints(e);s[l]=d.wnd,u[l]=d.points}for(l=n-1;1<=l;l-=2){var p=l-1,y=l;if(1===s[p]&&1===s[y]){var g=[t[p],null,null,t[y]];0===t[p].y.cmp(t[y].y)?(g[1]=t[p].add(t[y]),g[2]=t[p].toJ().mixedAdd(t[y].neg())):0===t[p].y.cmp(t[y].y.redNeg())?(g[1]=t[p].toJ().mixedAdd(t[y]),g[2]=t[p].add(t[y].neg())):(g[1]=t[p].toJ().mixedAdd(t[y]),g[2]=t[p].toJ().mixedAdd(t[y].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],m=a(r[p],r[y]);for(c=Math.max(m[0].length,c),f[p]=new Array(c),f[y]=new Array(c),A=0;A<c;A++){var v=0|m[0][A],w=0|m[1][A];f[p][A]=b[3*(1+v)+(1+w)],f[y][A]=0,u[p]=g}}else f[p]=o(r[p],s[p],this._bitLength),f[y]=o(r[y],s[y],this._bitLength),c=Math.max(f[p].length,c),c=Math.max(f[y].length,c)}var _=this.jpoint(null,null,null),E=this._wnafT4;for(l=c;0<=l;l--){for(var S=0;0<=l;){for(var k=!0,A=0;A<n;A++)E[A]=0|f[A][l],0!==E[A]&&(k=!1);if(!k)break;S++,l--}if(0<=l&&S++,_=_.dblp(S),l<0)break;for(A=0;A<n;A++){var T=E[A];0!==T&&(0<T?h=u[A][T-1>>1]:T<0&&(h=u[A][-T-1>>1].neg()),_="affine"===h.type?_.mixedAdd(h):_.add(h))}}for(l=0;l<n;l++)u[l]=null;return i?_:_.toP()},(u.BasePoint=f).prototype.eq=function(){throw new Error("Not implemented")},f.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){if(e=i.toArray(e,t),t=this.p.byteLength(),(4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*t)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+t),e.slice(1+t,1+2*t));if((2===e[0]||3===e[0])&&e.length-1===t)return this.pointFromX(e.slice(1,1+t),3===e[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function(e){return this.encode(e,!0)},f.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},f.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},f.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},f.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},f.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},f.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1==r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},f.prototype._getBeta=function(){return null},f.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},{"../utils":24,"bn.js":9}],14:[function(e,t,r){t.exports={}},{}],15:[function(e,t,r){r.base=e("./base"),r.short=e("./short"),r.mont=e("./mont"),r.edwards=e("./edwards")},{"./base":13,"./edwards":14,"./mont":16,"./short":17}],16:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],17:[function(e,t,r){var n=e("../utils"),i=e("bn.js"),o=e("inherits"),a=e("./base"),s=n.assert;function u(e){a.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.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(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(e){var t,r,n;if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3))return r=(e.beta?new i(e.beta,16):r=(n=this._getEndoRoots(this.p))[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red),e.lambda?t=new i(e.lambda,16):(n=this._getEndoRoots(this.n),0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(r))?t=n[0]:(t=n[1],s(0===this.g.mul(t).x.cmp(this.g.x.redMul(r))))),{beta:r,lambda:t,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(t)}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=(e=(r=new i(2).toRed(t).redInvm()).redNeg(),new i(3).toRed(t).redNeg().redSqrt().redMul(r));return[e.redAdd(r).fromRed(),e.redSub(r).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,o,a,s=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=e,f=this.n.clone(),c=new i(1),l=new i(0),h=new i(0),d=new i(1),p=0;0!==u.cmpn(0);){var y=f.div(u),g=f.sub(y.mul(u)),b=h.sub(y.mul(c));if(y=d.sub(y.mul(l)),!n&&g.cmp(s)<0)t=a.neg(),r=c,n=g.neg(),o=b;else if(n&&2==++p)break;f=u,u=a=g,h=c,c=b,d=l,l=y}var m=g.neg(),v=b;return e=n.sqr().add(o.sqr()),0<=m.sqr().add(v.sqr()).cmp(e)&&(m=t,v=r),n.negative&&(n=n.neg(),o=o.neg()),m.negative&&(m=m.neg(),v=v.neg()),[{a:n,b:o},{a:m,b:v}]},u.prototype._endoSplit=function(e){var t=(o=this.endo.basis)[0],r=(a=o[1]).b.mul(e).divRound(this.n),n=t.b.neg().mul(e).divRound(this.n),i=r.mul(t.a),o=n.mul(a.a),a=(t=r.mul(t.b),n.mul(a.b));return{k1:e.sub(i).sub(o),k2:t.add(a).neg()}},u.prototype.pointFromX=function(e,t){var r=(e=(e=new i(e,16)).red?e:e.toRed(this.red)).redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");return r=n.fromRed().isOdd(),(t&&!r||!t&&r)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y;return e=this.a.redMul(t),e=t.redSqr().redMul(t).redIAdd(e).redIAdd(this.b),0===r.redSqr().redISub(e).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}r=this._wnafMulAdd(1,n,i,2*o,r);for(var f=0;f<2*o;f++)n[f]=null,i[f]=null;return r},o(f,a.BasePoint),u.prototype.point=function(e,t,r){return new f(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return f.fromJSON(this,e,t)},f.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t,r,n=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);return e&&(t=this.curve,r=function(e){return t.point(e.x.redMul(t.endo.beta),e.y)},(e.beta=n).precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}),n}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}return t=t[2],n.precomputed={beta:null,doubles:t.doubles&&{step:t.doubles.step,points:[n].concat(t.doubles.points.map(i))},naf:t.naf&&{wnd:t.naf.wnd,points:[n].concat(t.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);e=(t=0!==(t=this.y.redSub(e.y)).cmpn(0)?t.redMul(this.x.redSub(e.x).redInvm()):t).redSqr().redISub(this.x).redISub(e.x);var t=t.redMul(this.x.redSub(e)).redISub(this.y);return this.curve.point(e,t)},f.prototype.dbl=function(){if(this.inf)return this;if(0===(r=this.y.redAdd(this.y)).cmpn(0))return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),r=r.redInvm();return r=(e=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(r)).redSqr().redISub(this.x.redAdd(this.x)),e=e.redMul(this.x.redSub(r)).redISub(this.y),this.curve.point(r,e)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return t=[this,t],r=[e,r],this.curve.endo?this.curve._endoWnafMulAdd(t,r):this.curve._wnafMulAdd(1,t,r,2)},f.prototype.jmulAdd=function(e,t,r){return t=[this,t],r=[e,r],this.curve.endo?this.curve._endoWnafMulAdd(t,r,!0):this.curve._wnafMulAdd(1,t,r,2,!0)},f.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},f.prototype.neg=function(e){if(this.inf)return this;var t,r=this.curve.point(this.x,this.y.redNeg());return e&&this.precomputed&&(t=this.precomputed,e=function(e){return e.neg()},r.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(e)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(e)}}),r},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=(r=this.z.redInvm()).redSqr(),t=this.x.redMul(e),r=this.y.redMul(e).redMul(r);return this.curve.point(t,r)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z));return t=n.redSub(i),r=o.redSub(a),0===t.cmpn(0)?0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(a=(i=t.redSqr()).redMul(t),n=n.redMul(i),i=r.redSqr().redIAdd(a).redISub(n).redISub(n),a=r.redMul(n.redISub(i)).redISub(o.redMul(a)),t=this.z.redMul(e.z).redMul(t),this.curve.jpoint(i,a,t))},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z);return e=r.redSub(n),t=i.redSub(o),0===e.cmpn(0)?0!==t.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(o=(n=e.redSqr()).redMul(e),r=r.redMul(n),n=t.redSqr().redIAdd(o).redISub(r).redISub(r),o=t.redMul(r.redISub(n)).redISub(i.redMul(o)),e=this.z.redMul(e),this.curve.jpoint(n,o,e))},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),f=a.redAdd(a);for(r=0;r<e;r++){var c=o.redSqr(),l=(d=f.redSqr()).redSqr(),h=c.redAdd(c).redIAdd(c).redIAdd(n.redMul(u)),d=(c=o.redMul(d),h.redSqr().redISub(c.redAdd(c)));c=c.redISub(d),h=(h=h.redMul(c)).redIAdd(h).redISub(l),c=f.redMul(s),r+1<e&&(u=u.redMul(l)),o=d,s=c,f=h}return this.curve.jpoint(o,f.redMul(i),s)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},c.prototype._zeroDbl=function(){var e,t,r,n,i,o=this.zOne?(r=this.x.redSqr(),e=(n=this.y.redSqr()).redSqr(),i=(i=this.x.redAdd(n).redSqr().redISub(r).redISub(e)).redIAdd(i),n=(t=r.redAdd(r).redIAdd(r)).redSqr().redISub(i).redISub(i),r=(r=(r=e.redIAdd(e)).redIAdd(r)).redIAdd(r),t=t.redMul(i.redISub(e=n)).redISub(r),this.y.redAdd(this.y)):(i=this.x.redSqr(),o=(n=this.y.redSqr()).redSqr(),r=(r=this.x.redAdd(n).redSqr().redISub(i).redISub(o)).redIAdd(r),i=(n=i.redAdd(i).redIAdd(i)).redSqr(),o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o),e=i.redISub(r).redISub(r),t=n.redMul(r.redISub(e)).redISub(o),(o=this.y.redMul(this.z)).redIAdd(o));return this.curve.jpoint(e,t,o)},c.prototype._threeDbl=function(){var e,t,r,n,i,o,a,s;return this.zOne?(a=this.x.redSqr(),r=(e=this.y.redSqr()).redSqr(),o=(o=this.x.redAdd(e).redSqr().redISub(a).redISub(r)).redIAdd(o),t=n=(s=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a)).redSqr().redISub(o).redISub(o),i=(i=(i=r.redIAdd(r)).redIAdd(i)).redIAdd(i),e=s.redMul(o.redISub(n)).redISub(i),a=this.y.redAdd(this.y)):(r=this.z.redSqr(),s=this.y.redSqr(),o=this.x.redMul(s),n=(n=this.x.redSub(r).redMul(this.x.redAdd(r))).redAdd(n).redIAdd(n),o=(i=(i=o.redIAdd(o)).redIAdd(i)).redAdd(i),t=n.redSqr().redISub(o),a=this.y.redAdd(this.z).redSqr().redISub(s).redISub(r),s=(s=(s=(s=s.redSqr()).redIAdd(s)).redIAdd(s)).redIAdd(s),e=n.redMul(i.redISub(t)).redISub(s)),this.curve.jpoint(t,e,a)},c.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),a=r.redSqr();return e=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),t=(i=(i=t.redAdd(t)).redIAdd(i)).redMul(a),i=e.redSqr().redISub(t.redAdd(t)),t=t.redISub(i),a=(a=(a=(a=a.redSqr()).redIAdd(a)).redIAdd(a)).redIAdd(a),a=e.redMul(t).redISub(a),n=r.redAdd(r).redMul(n),this.curve.jpoint(i,a,n)},c.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n);return e=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),n=(n=(n=(n=n.redIAdd(n)).redIAdd(n)).redIAdd(n)).redIAdd(n),o=i.redIAdd(a).redSqr().redISub(o).redISub(e).redISub(n),t=(t=(t=t.redMul(o)).redIAdd(t)).redIAdd(t),t=(t=(t=this.x.redMul(e).redISub(t)).redIAdd(t)).redIAdd(t),o=(o=(o=(o=this.y.redMul(o.redMul(n.redISub(o)).redISub(a.redMul(e)))).redIAdd(o)).redIAdd(o)).redIAdd(o),e=this.z.redAdd(a).redSqr().redISub(r).redISub(e),this.curve.jpoint(t,o,e)},c.prototype.mul=function(e,t){return e=new i(e,t),this.curve._wnafMul(this,e)},c.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();return 0===this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0)&&(t=t.redMul(this.z),r=r.redMul(e.z),0===this.y.redMul(r).redISub(e.y.redMul(t)).cmpn(0))},c.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},c.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":24,"./base":13,"bn.js":9,inherits:39}],18:[function(e,t,r){var n,i=r,o=(r=e("hash.js"),e("./curve")),a=e("./utils").assert;function s(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":15,"./precomputed/secp256k1":23,"./utils":24,"hash.js":26}],19:[function(e,t,r){var n=e("bn.js"),i=e("hmac-drbg"),o=e("../utils"),a=e("../curves"),s=e("brorand"),u=o.assert,f=e("./key"),c=e("./signature");function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=l).prototype.keyPair=function(e){return new f(this,e)},l.prototype.keyFromPrivate=function(e,t){return f.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return f.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){for(var t=new i({hash:this.hash,pers:(e=e||{}).pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(t.generate(r));if(!(0<a.cmp(o)))return a.iaddn(1),this.keyFromPrivate(a)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return 0<r&&(e=e.ushrn(r)),!t&&0<=e.cmp(this.n)?e.sub(this.n):e},l.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o=o||{},t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var a=this.n.byteLength(),s=(r=t.getPrivate().toArray("be",a),a=e.toArray("be",a),new i({hash:this.hash,entropy:r,nonce:a,pers:o.pers,persEnc:o.persEnc||"utf8"})),u=this.n.sub(new n(1)),f=0;;f++){var l=o.k?o.k(f):new n(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||0<=l.cmp(u))){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)&&0!==(l=(l=l.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e))).umod(this.n)).cmpn(0))return d=(h.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0),o.canonical&&0<l.cmp(this.nh)&&(l=this.n.sub(l),d^=1),new c({r:p,s:l,recoveryParam:d})}}}},l.prototype.verify=function(e,t,r,i){return e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i),i=(t=new c(t,"hex")).r,t=t.s,!(i.cmpn(1)<0||0<=i.cmp(this.n))&&!(t.cmpn(1)<0||0<=t.cmp(this.n))&&(e=(t=t.invm(this.n)).mul(e).umod(this.n),t=t.mul(i).umod(this.n),this.curve._maxwellTrick?!(o=this.g.jmulAdd(e,r.getPublic(),t)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(e,r.getPublic(),t)).isInfinity()&&0===o.getX().umod(this.n).cmp(i));var o},l.prototype.recoverPubKey=function(e,t,r,i){u((3&r)===r,"The recovery param is more than two bits"),t=new c(t,i);var o=this.n,a=new n(e),s=t.r;if(i=t.s,e=1&r,r>>=1,0<=s.cmp(this.curve.p.umod(this.curve.n))&&r)throw new Error("Unable to find sencond key candinate");return s=r?this.curve.pointFromX(s.add(this.curve.n),e):this.curve.pointFromX(s,e),t=t.r.invm(o),a=o.sub(a).mul(t).umod(o),o=i.mul(t).umod(o),this.g.mulAdd(a,s,o)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new c(t,n)).recoveryParam)return t.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(e,t,o)}catch(e){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../curves":18,"../utils":24,"./key":20,"./signature":21,"bn.js":9,brorand:10,"hmac-drbg":38}],20:[function(e,t,r){var n=e("bn.js"),i=e("../utils").assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":24,"bn.js":9}],21:[function(e,t,r){var n=e("bn.js"),i=e("../utils"),o=i.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0==n||4<n)return!1;for(var i=0,o=0,a=t.place;o<n;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function f(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function c(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=a).prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;if(!1===(t=u(e,r)))return!1;if(o=e.slice(r.place,t+r.place),r.place+=t,2!==e[r.place++])return!1;if(!1===(t=u(e,r)))return!1;if(e.length!==t+r.place)return!1;if(r=e.slice(r.place,t+r.place),0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===r[0]){if(!(128&r[1]))return!1;r=r.slice(1)}return this.r=new n(o),this.s=new n(r),!(this.recoveryParam=null)},a.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=f(t),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];return c(n,t.length),(n=n.concat(t)).push(2),c(n,r.length),t=n.concat(r),c(n=[48],t.length),n=n.concat(t),i.encode(n,e)}},{"../utils":24,"bn.js":9}],22:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],23:[function(e,t,r){t.exports=void 0},{}],24:[function(e,t,r){var n=r,i=e("bn.js");r=e("minimalistic-assert"),e=e("minimalistic-crypto-utils"),n.assert=r,n.toArray=e.toArray,n.zero2=e.zero2,n.toHex=e.toHex,n.encode=e.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<n.length;a++){var s,u=o.andln(i-1);o.isOdd()?o.isubn(s=(i>>1)-1<u?(i>>1)-u:u):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;0<e.cmpn(-i)||0<t.cmpn(-o);){var a,s=e.andln(3)+i&3,u=t.andln(3)+o&3;3===u&&(u=-1),a=1&(s=3===s?-1:s)?3!=(n=e.andln(7)+i&7)&&5!==n||2!==u?s:-s:0,r[0].push(a),u=1&u?3!=(n=t.andln(7)+o&7)&&5!==n||2!==s?u:-u:0,r[1].push(u),2*i===a+1&&(i=1-i),2*o===u+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":9,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],25:[function(e,t,r){t.exports={version:"6.5.4"}},{}],26:[function(e,t,r){r.utils=e("./hash/utils"),r.common=e("./hash/common"),r.sha=e("./hash/sha"),r.ripemd=e("./hash/ripemd"),r.hmac=e("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(e,t,r){var n=e("./utils"),i=e("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}(r.BlockHash=o).prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){t=(e=this.pending).length%this._delta8,this.pending=e.slice(e.length-t,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-t,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},{"./utils":37,"minimalistic-assert":41}],28:[function(e,t,r){var n=e("./utils"),i=e("minimalistic-assert");function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}(t.exports=o).prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},{"./utils":37,"minimalistic-assert":41}],29:[function(e,t,r){var n=e("./utils"),i=(e=e("./common"),n.rotl32),o=n.sum32,a=n.sum32_3,s=n.sum32_4,u=e.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}n.inherits(f,u),(r.ripemd160=f).blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r,n=v=this.h[0],u=S=this.h[1],f=E=this.h[2],y=_=this.h[3],g=w=this.h[4],b=0;b<80;b++){var m=o(i(s(v,c(b,S,E,_),e[l[b]+t],(r=b)<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838),d[b]),w),v=w,w=_,_=i(E,10),E=S,S=m;m=o(i(s(n,c(79-b,u,f,y),e[h[b]+t],(r=b)<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0),p[b]),g),n=g,g=y,y=i(f,10),f=u,u=m}m=a(this.h[1],E,y),this.h[1]=a(this.h[2],_,g),this.h[2]=a(this.h[3],w,n),this.h[3]=a(this.h[4],v,u),this.h[4]=a(this.h[0],S,f),this.h[0]=m},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var l=[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],h=[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],d=[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],p=[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]},{"./common":27,"./utils":37}],30:[function(e,t,r){r.sha1=e("./sha/1"),r.sha224=e("./sha/224"),r.sha256=e("./sha/256"),r.sha384=e("./sha/384"),r.sha512=e("./sha/512")},{"./sha/1":31,"./sha/224":32,"./sha/256":33,"./sha/384":34,"./sha/512":35}],31:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],32:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],33:[function(e,t,r){var n=e("../utils"),i=e("../common"),o=e("./common"),a=e("minimalistic-assert"),s=n.sum32,u=n.sum32_4,f=n.sum32_5,c=o.ch32,l=o.maj32,h=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,g=i.BlockHash,b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}n.inherits(m,g),(t.exports=m).blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=u(y(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],g=this.h[2],b=this.h[3],m=this.h[4],v=this.h[5],w=this.h[6],_=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var E=f(_,d(m),c(m,v,w),this.k[n],r[n]),S=s(h(i),l(i,o,g));_=w,w=v,v=m,m=s(b,E),b=g,g=o,o=i,i=s(E,S)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],b),this.h[4]=s(this.h[4],m),this.h[5]=s(this.h[5],v),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],_)},m.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"./common":36,"minimalistic-assert":41}],34:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],35:[function(e,t,r){var n=e("../utils"),i=e("../common"),o=e("minimalistic-assert"),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,f=n.shr64_lo,c=n.sum64,l=n.sum64_hi,h=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,g=n.sum64_5_lo,b=i.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;b.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}n.inherits(v,b),(t.exports=v).blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=function(e,t){return(t=a(e,t,19)^a(t,e,29)^(t=u(e,t,6)))<0&&(t+=4294967296),t}(r[n-4],r[n-3]),o=function(e,t){return(t=s(e,t,19)^s(t,e,29)^(t=f(e,t,6)))<0&&(t+=4294967296),t}(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],h=function(e,t){return(t=a(e,t,1)^a(e,t,8)^(t=u(e,t,7)))<0&&(t+=4294967296),t}(r[n-30],r[n-29]),y=function(e,t){return(t=s(e,t,1)^s(e,t,8)^(t=f(e,t,7)))<0&&(t+=4294967296),t}(r[n-30],r[n-29]),g=r[n-32],b=r[n-31];r[n]=d(i,o,c,l,h,y,g,b),r[n+1]=p(i,o,c,l,h,y,g,b)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],u=this.h[2],f=this.h[3],d=this.h[4],p=this.h[5],b=this.h[6],m=this.h[7],v=this.h[8],w=this.h[9],_=this.h[10],E=this.h[11],S=this.h[12],k=this.h[13],A=this.h[14],T=this.h[15];o(this.k.length===r.length);for(var P=0;P<r.length;P+=2){var O=A,I=T,x=function(e,t){return(e=a(e,t,14)^a(e,t,18)^(e=a(t,e,9)))<0&&(e+=4294967296),e}(v,w),N=function(e,t){return(e=s(e,t,14)^s(e,t,18)^(e=s(t,e,9)))<0&&(e+=4294967296),e}(v,w),M=function(e,t,r){return(r=e&t^~e&r)<0&&(r+=4294967296),r}(v,_,S),R=function(e,t,r){return(r=e&t^~e&r)<0&&(r+=4294967296),r}(w,E,k),B=this.k[P],L=this.k[P+1],C=r[P],U=r[P+1],j=y(O,I,x,N,M,R,B,L,C,U);C=g(O,I,x,N,M,R,B,L,C,U),O=function(e,t){return(e=a(e,t,28)^a(t,e,2)^(e=a(t,e,7)))<0&&(e+=4294967296),e}(n,i),I=function(e,t){return(e=s(e,t,28)^s(t,e,2)^(e=s(t,e,7)))<0&&(e+=4294967296),e}(n,i),x=function(e,t,r){return(r=e&t^e&r^t&r)<0&&(r+=4294967296),r}(n,u,d),N=function(e,t,r){return(r=e&t^e&r^t&r)<0&&(r+=4294967296),r}(i,f,p),U=l(O,I,x,N),N=h(O,I,x,N),A=S,T=k,S=_,k=E,_=v,E=w,v=l(b,m,j,C),w=h(m,m,j,C),b=d,m=p,d=u,p=f,u=n,f=i,n=l(j,C,U,N),i=h(j,C,U,N)}c(this.h,0,n,i),c(this.h,2,u,f),c(this.h,4,d,p),c(this.h,6,b,m),c(this.h,8,v,w),c(this.h,10,_,E),c(this.h,12,S,k),c(this.h,14,A,T)},v.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"minimalistic-assert":41}],36:[function(e,t,r){var n=e("../utils").rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}r.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?t^r^n:2===e?o(t,r,n):void 0},r.ch32=i,r.maj32=o,r.p32=function(e,t,r){return e^t^r},r.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},r.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},r.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":37}],37:[function(e,t,r){var n=e("minimalistic-assert");function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}e=e("inherits"),r.inherits=e,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var i=(o=e.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},r.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=o(e[r].toString(16));return t},r.htonl=i,r.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e[n];r+=a((o="little"===t?i(o):o).toString(16))}return r},r.zero2=o,r.zero8=a,r.join32=function(e,t,r,i){n((r-=t)%4==0);for(var o=new Array(r/4),a=0,s=t;a<o.length;a++,s+=4){var u="big"===i?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s];o[a]=u>>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<<t|e>>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0;e[t]=(o<n?1:0)+r+i>>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,f=t;return u+=(f=t+n>>>0)<t?1:0,u+=(f=f+o>>>0)<o?1:0,e+r+i+a+(u+=(f=f+s>>>0)<s?1:0)>>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,f){var c=0,l=t;return c+=(l=t+n>>>0)<t?1:0,c+=(l=l+o>>>0)<o?1:0,c+=(l=l+s>>>0)<s?1:0,e+r+i+a+u+(c+=(l=l+f>>>0)<f?1:0)>>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,f){return t+n+o+s+f>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:39,"minimalistic-assert":41}],38:[function(e,t,r){var n=e("hash.js"),i=e("minimalistic-crypto-utils"),o=e("minimalistic-assert");function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex");e=i.toArray(e.pers,e.persEnc||"hex"),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,e)}(t.exports=a).prototype._init=function(e,t,r){r=e.concat(t).concat(r),this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=i.toArray(e,t),r=i.toArray(r,n),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);return n=o.slice(0,e),this._update(r),this._reseed++,i.encode(n,t)}},{"hash.js":26,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],39:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){var r;t&&(e.super_=t,(r=function(){}).prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e)}},{}],40:[function(e,t,n){(function(e,r){(function(){!function(){for(var n="object"==typeof window?window:{},i=!(n=!n.JS_SHA3_NO_NODE_JS&&"object"==typeof e&&e.versions&&e.versions.node?r:n).JS_SHA3_NO_COMMON_JS&&"object"==typeof t&&t.exports,o="0123456789abcdef".split(""),a=[0,8,16,24],s=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],u=[224,256,384,512],f=["hex","buffer","arrayBuffer","array"],c=function(e,t,r){return function(n){return new _(e,t,e).update(n)[r]()}},l=function(e,t,r){return function(n,i){return new _(e,t,i).update(n)[r]()}},h=function(e,t){var r=c(e,t,"hex");r.create=function(){return new _(e,t,e)},r.update=function(e){return r.create().update(e)};for(var n=0;n<f.length;++n){var i=f[n];r[i]=c(e,t,i)}return r},d=[{name:"keccak",padding:[1,256,65536,16777216],bits:u,createMethod:h},{name:"sha3",padding:[6,1536,393216,100663296],bits:u,createMethod:h},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(e,t){var r=l(e,t,"hex");r.create=function(r){return new _(e,t,r)},r.update=function(e,t){return r.create(t).update(e)};for(var n=0;n<f.length;++n){var i=f[n];r[i]=l(e,t,i)}return r}}],p={},y=[],g=0;g<d.length;++g)for(var b=d[g],m=b.bits,v=0;v<m.length;++v){var w=b.name+"_"+m[v];y.push(w),p[w]=b.createMethod(m[v],b.padding)}function _(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}_.prototype.update=function(e){for(var t,r,n="string"!=typeof e,i=(e=n&&e.constructor===ArrayBuffer?new Uint8Array(e):e).length,o=this.blocks,s=this.byteCount,u=this.blockCount,f=0,c=this.s;f<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,t=1;t<u+1;++t)o[t]=0;if(n)for(t=this.start;f<i&&t<s;++f)o[t>>2]|=e[f]<<a[3&t++];else for(t=this.start;f<i&&t<s;++f)(r=e.charCodeAt(f))<128?o[t>>2]|=r<<a[3&t++]:(r<2048?o[t>>2]|=(192|r>>6)<<a[3&t++]:(r<55296||57344<=r?o[t>>2]|=(224|r>>12)<<a[3&t++]:(r=65536+((1023&r)<<10|1023&e.charCodeAt(++f)),o[t>>2]|=(240|r>>18)<<a[3&t++],o[t>>2]|=(128|r>>12&63)<<a[3&t++]),o[t>>2]|=(128|r>>6&63)<<a[3&t++]),o[t>>2]|=(128|63&r)<<a[3&t++]);if(s<=(this.lastByteIndex=t)){for(this.start=t-s,this.block=o[u],t=0;t<u;++t)c[t]^=o[t];E(c),this.reset=!0}else this.start=t}return this},_.prototype.finalize=function(){var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];E(n)},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,u="";s<n;){for(a=0;a<t&&s<n;++a,++s)e=r[a],u+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];s%t==0&&(E(r),a=0)}return i&&(e=r[a],0<i&&(u+=o[e>>4&15]+o[15&e]),1<i&&(u+=o[e>>12&15]+o[e>>8&15]),2<i&&(u+=o[e>>20&15]+o[e>>16&15])),u},_.prototype.arrayBuffer=function(){this.finalize();for(var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,a=this.outputBits>>3,s=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(a),u=new Uint32Array(s);o<r;){for(i=0;i<e&&o<r;++i,++o)u[o]=t[i];o%e==0&&E(t)}return n&&(u[i]=t[i],s=s.slice(0,a)),s},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)t=n[a],u[e=s<<2]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&E(n)}return o&&(e=s<<2,t=n[a],0<o&&(u[e]=255&t),1<o&&(u[e+1]=t>>8&255),2<o&&(u[e+2]=t>>16&255)),u};var E=function(e){for(var t,r,n,i,o,a,u,f,c,l,h,d,p,y,g,b,m,v,w,_,E,S,k,A,T,P,O,I,x,N,M,R,B,L,C,U,j,D,F,H,K,G,W,V,z,q,Z,$,X,Y,J=0;J<48;J+=2)O=e[0]^e[10]^e[20]^e[30]^e[40],I=e[1]^e[11]^e[21]^e[31]^e[41],H=e[2]^e[12]^e[22]^e[32]^e[42],F=e[3]^e[13]^e[23]^e[33]^e[43],R=e[4]^e[14]^e[24]^e[34]^e[44],M=e[5]^e[15]^e[25]^e[35]^e[45],q=e[6]^e[16]^e[26]^e[36]^e[46],z=e[7]^e[17]^e[27]^e[37]^e[47],p=e[8]^e[18]^e[28]^e[38]^e[48],l=(y=e[9]^e[19]^e[29]^e[39]^e[49])^(F<<1|H>>>31),e[0]^=c=p^(H<<1|F>>>31),e[1]^=l,e[10]^=c,e[11]^=l,e[20]^=c,e[21]^=l,e[30]^=c,e[31]^=l,e[40]^=c,e[41]^=l,l=I^(M<<1|R>>>31),e[2]^=c=O^(R<<1|M>>>31),e[3]^=l,e[12]^=c,e[13]^=l,e[22]^=c,e[23]^=l,e[32]^=c,e[33]^=l,e[42]^=c,e[43]^=l,l=F^(z<<1|q>>>31),e[4]^=c=H^(q<<1|z>>>31),e[5]^=l,e[14]^=c,e[15]^=l,e[24]^=c,e[25]^=l,e[34]^=c,e[35]^=l,e[44]^=c,e[45]^=l,l=M^(y<<1|p>>>31),e[6]^=c=R^(p<<1|y>>>31),e[7]^=l,e[16]^=c,e[17]^=l,e[26]^=c,e[27]^=l,e[36]^=c,e[37]^=l,e[46]^=c,e[47]^=l,l=z^(I<<1|O>>>31),e[8]^=c=q^(O<<1|I>>>31),e[9]^=l,e[18]^=c,e[19]^=l,e[28]^=c,e[29]^=l,e[38]^=c,e[39]^=l,e[48]^=c,e[49]^=l,t=e[0],r=e[1],B=e[11]<<4|e[10]>>>28,L=e[10]<<4|e[11]>>>28,g=e[20]<<3|e[21]>>>29,b=e[21]<<3|e[20]>>>29,Z=e[31]<<9|e[30]>>>23,$=e[30]<<9|e[31]>>>23,x=e[40]<<18|e[41]>>>14,N=e[41]<<18|e[40]>>>14,E=e[2]<<1|e[3]>>>31,S=e[3]<<1|e[2]>>>31,n=e[13]<<12|e[12]>>>20,i=e[12]<<12|e[13]>>>20,C=e[22]<<10|e[23]>>>22,U=e[23]<<10|e[22]>>>22,m=e[33]<<13|e[32]>>>19,v=e[32]<<13|e[33]>>>19,X=e[42]<<2|e[43]>>>30,Y=e[43]<<2|e[42]>>>30,K=e[5]<<30|e[4]>>>2,G=e[4]<<30|e[5]>>>2,k=e[14]<<6|e[15]>>>26,A=e[15]<<6|e[14]>>>26,o=e[25]<<11|e[24]>>>21,a=e[24]<<11|e[25]>>>21,j=e[34]<<15|e[35]>>>17,D=e[35]<<15|e[34]>>>17,w=e[45]<<29|e[44]>>>3,_=e[44]<<29|e[45]>>>3,h=e[6]<<28|e[7]>>>4,d=e[7]<<28|e[6]>>>4,W=e[17]<<23|e[16]>>>9,V=e[16]<<23|e[17]>>>9,T=e[26]<<25|e[27]>>>7,P=e[27]<<25|e[26]>>>7,u=e[36]<<21|e[37]>>>11,f=e[37]<<21|e[36]>>>11,F=e[47]<<24|e[46]>>>8,H=e[46]<<24|e[47]>>>8,M=e[8]<<27|e[9]>>>5,R=e[9]<<27|e[8]>>>5,p=e[18]<<20|e[19]>>>12,y=e[19]<<20|e[18]>>>12,z=e[29]<<7|e[28]>>>25,q=e[28]<<7|e[29]>>>25,O=e[38]<<8|e[39]>>>24,I=e[39]<<8|e[38]>>>24,c=e[48]<<14|e[49]>>>18,l=e[49]<<14|e[48]>>>18,e[0]=t^~n&o,e[1]=r^~i&a,e[10]=h^~p&g,e[11]=d^~y&b,e[20]=E^~k&T,e[21]=S^~A&P,e[30]=M^~B&C,e[31]=R^~L&U,e[40]=K^~W&z,e[41]=G^~V&q,e[2]=n^~o&u,e[3]=i^~a&f,e[12]=p^~g&m,e[13]=y^~b&v,e[22]=k^~T&O,e[23]=A^~P&I,e[32]=B^~C&j,e[33]=L^~U&D,e[42]=W^~z&Z,e[43]=V^~q&$,e[4]=o^~u&c,e[5]=a^~f&l,e[14]=g^~m&w,e[15]=b^~v&_,e[24]=T^~O&x,e[25]=P^~I&N,e[34]=C^~j&F,e[35]=U^~D&H,e[44]=z^~Z&X,e[45]=q^~$&Y,e[6]=u^~c&t,e[7]=f^~l&r,e[16]=m^~w&h,e[17]=v^~_&d,e[26]=O^~x&E,e[27]=I^~N&S,e[36]=j^~F&M,e[37]=D^~H&R,e[46]=Z^~X&K,e[47]=$^~Y&G,e[8]=c^~t&n,e[9]=l^~r&i,e[18]=w^~h&p,e[19]=_^~d&y,e[28]=x^~E&k,e[29]=N^~S&A,e[38]=F^~M&B,e[39]=H^~R&L,e[48]=X^~K&W,e[49]=Y^~G&V,e[0]^=s[J],e[1]^=s[J+1]};if(i)t.exports=p;else for(g=0;g<y.length;++g)n[y[g]]=p[y[g]]}()}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:43}],41:[function(e,t,r){(t.exports=function(e,t){if(!e)throw new Error(t||"Assertion failed")}).equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},{}],42:[function(e,t,r){function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16));else for(n=0;n<e.length;n++){var i=(o=e.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},{}],43:[function(e,t,r){t.exports={browser:!0}},{}],44:[function(e,t,r){(function(e){(function(){function n(e){var t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,i=1013904242,o=2773480762,a=1359893119,s=2600822924,u=528734635,f=1541459225,c=new Array(64);function l(e){for(var l=0,h=e.length;64<=h;){for(var d,p,y,g,b=r,m=n,v=i,w=o,_=a,E=s,S=u,k=f,A=0;A<16;A++)c[A]=(255&e[p=l+4*A])<<24|(255&e[p+1])<<16|(255&e[p+2])<<8|255&e[p+3];for(A=16;A<64;A++)y=((d=c[A-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=c[A-15],c[A]=(y+c[A-7]|0)+((g=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3)+c[A-16]|0)|0;for(A=0;A<64;A++)y=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&E^~_&S)|0)+(k+(t[A]+c[A]|0)|0)|0,g=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&m^b&v^m&v)|0,k=S,S=E,E=_,_=w+y|0,w=v,v=m,m=b,b=y+g|0;r=r+b|0,n=n+m|0,i=i+v|0,o=o+w|0,a=a+_|0,s=s+E|0,u=u+S|0,f=f+k|0,l+=64,h-=64}}l(e);var h,d=e.length%64,p=e.length/536870912|0,y=e.length<<3,g=d<56?56:120,b=e.slice(e.length-d,e.length);for(b.push(128),h=1+d;h<g;h++)b.push(0);return b.push(p>>>24&255),b.push(p>>>16&255),b.push(p>>>8&255),b.push(p>>>0&255),b.push(y>>>24&255),b.push(y>>>16&255),b.push(y>>>8&255),b.push(y>>>0&255),l(b),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,f>>>24&255,f>>>16&255,f>>>8&255,f>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);for(var i=64+t.length+4,o=new Array(i),a=new Array(64),s=[],u=0;u<64;u++)o[u]=54;for(u=0;u<e.length;u++)o[u]^=e[u];for(u=0;u<t.length;u++)o[64+u]=t[u];for(u=i-4;u<i;u++)o[u]=0;for(u=0;u<64;u++)a[u]=92;for(u=0;u<e.length;u++)a[u]^=e[u];function f(){for(var e=i-1;i-4<=e;e--){if(o[e]++,o[e]<=255)return;o[e]=0}}for(;32<=r;)f(),s=s.concat(n(a.concat(n(o)))),r-=32;return 0<r&&(f(),s=s.concat(n(a.concat(n(o))).slice(0,r))),s}function o(e,t,r,n,i){var o;for(u(e,16*(2*r-1),i,0,16),o=0;o<2*r;o++)s(e,16*o,i,16),function(e,t){u(e,0,t,0,16);for(var r=8;0<r;r-=2)t[4]^=a(t[0]+t[12],7),t[8]^=a(t[4]+t[0],9),t[12]^=a(t[8]+t[4],13),t[0]^=a(t[12]+t[8],18),t[9]^=a(t[5]+t[1],7),t[13]^=a(t[9]+t[5],9),t[1]^=a(t[13]+t[9],13),t[5]^=a(t[1]+t[13],18),t[14]^=a(t[10]+t[6],7),t[2]^=a(t[14]+t[10],9),t[6]^=a(t[2]+t[14],13),t[10]^=a(t[6]+t[2],18),t[3]^=a(t[15]+t[11],7),t[7]^=a(t[3]+t[15],9),t[11]^=a(t[7]+t[3],13),t[15]^=a(t[11]+t[7],18),t[1]^=a(t[0]+t[3],7),t[2]^=a(t[1]+t[0],9),t[3]^=a(t[2]+t[1],13),t[0]^=a(t[3]+t[2],18),t[6]^=a(t[5]+t[4],7),t[7]^=a(t[6]+t[5],9),t[4]^=a(t[7]+t[6],13),t[5]^=a(t[4]+t[7],18),t[11]^=a(t[10]+t[9],7),t[8]^=a(t[11]+t[10],9),t[9]^=a(t[8]+t[11],13),t[10]^=a(t[9]+t[8],18),t[12]^=a(t[15]+t[14],7),t[13]^=a(t[12]+t[15],9),t[14]^=a(t[13]+t[12],13),t[15]^=a(t[14]+t[13],18);for(r=0;r<16;++r)e[r]+=t[r]}(i,n),u(i,0,e,t+16*o,16);for(o=0;o<r;o++)u(e,t+2*o*16,e,16*o,16);for(o=0;o<r;o++)u(e,t+16*(2*o+1),e,16*(o+r),16)}function a(e,t){return e<<t|e>>>32-t}function s(e,t,r,n){for(var i=0;i<n;i++)r[i]^=e[t+i]}function u(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}function f(e){if(e&&"number"==typeof e.length){for(var t=0;t<e.length;t++){if("number"!=typeof e[t])return;var r=parseInt(e[t]);if(r!=e[t]||r<0||256<=r)return}return 1}}function c(e,t){var r=parseInt(e);if(e!=r)throw new Error("invalid "+t);return r}function l(t,r,n,a,l,h,p){if(!p)throw new Error("missing callback");if(n=c(n,"N"),a=c(a,"r"),l=c(l,"p"),h=c(h,"dkLen"),0===n||n&n-1)throw new Error("N must be power of 2");if(d/128/a<n)throw new Error("N too large");if(d/128/l<a)throw new Error("r too large");if(!f(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!f(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);for(var y=i(t,r,128*l*a),g=new Uint32Array(32*l*a),b=0;b<g.length;b++){var m=4*b;g[b]=(255&y[3+m])<<24|(255&y[2+m])<<16|(255&y[1+m])<<8|255&y[0+m]}var v,w,_=new Uint32Array(64*a),E=new Uint32Array(32*a*n),S=32*a,k=new Uint32Array(16),A=new Uint32Array(16),T=l*n*2,P=0,O=null,I=!1,x=0,N=0,M=parseInt(1e3/a),R=void 0!==e?e:setTimeout,B=function(){if(I)return p(new Error("cancelled"),P/T);switch(x){case 0:u(g,w=32*N*a,_,0,S),x=1,v=0;case 1:M<(r=n-v)&&(r=M);for(var e=0;e<r;e++)u(_,0,E,(v+e)*S,S),o(_,S,a,k,A);if(v+=r,P+=r,(c=parseInt(1e3*P/T))!==O){if(I=p(null,P/T))break;O=c}if(v<n)break;v=0,x=2;case 2:var r;for(M<(r=n-v)&&(r=M),e=0;e<r;e++){var f=_[16*(2*a-1)]&n-1;s(E,f*S,_,S),o(_,S,a,k,A)}if(v+=r,P+=r,(c=parseInt(1e3*P/T))!==O){if(I=p(null,P/T))break;O=c}if(v<n)break;if(u(_,0,g,w,S),++N<l){x=0;break}for(y=[],e=0;e<g.length;e++)y.push(255&g[e]),y.push(g[e]>>8&255),y.push(g[e]>>16&255),y.push(g[e]>>24&255);var c=i(t,y,h);return p(null,1,c)}R(B)};B()}var h,d;h=this,d=2147483647,void 0!==r?t.exports=l:h&&(h.scrypt&&(h._scrypt=h.scrypt),h.scrypt=l)}).call(this)}).call(this,e("timers").setImmediate)},{timers:46}],45:[function(e,t,n){(function(e,t,r){(function(){!function(t,r){var n,i,o,a,s,u,f,c;function l(e){return i[n]=h.apply(r,e),n++}function h(e){var t=[].slice.call(arguments,1);return function(){"function"==typeof e?e.apply(r,t):new Function(""+e)()}}function d(e){if(o)setTimeout(h(d,e),0);else{var t=i[e];if(t){o=!0;try{t()}finally{p(e),o=!1}}}}function p(e){delete i[e]}t.setImmediate||(n=1,o=!(i={}),a=t.document,c=(c=Object.getPrototypeOf&&Object.getPrototypeOf(t))&&c.setTimeout?c:t,"[object process]"==={}.toString.call(t.process)?s=function(){var t=l(arguments);return e.nextTick(h(d,t)),t}:function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?function(){function e(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(r)&&d(+e.data.slice(r.length))}var r="setImmediate$"+Math.random()+"$";t.addEventListener?t.addEventListener("message",e,!1):t.attachEvent("onmessage",e),s=function(){var e=l(arguments);return t.postMessage(r+e,"*"),e}}():s=t.MessageChannel?((f=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(){var e=l(arguments);return f.port2.postMessage(e),e}):a&&"onreadystatechange"in a.createElement("script")?(u=a.documentElement,function(){var e=l(arguments),t=a.createElement("script");return t.onreadystatechange=function(){d(e),t.onreadystatechange=null,u.removeChild(t),t=null},u.appendChild(t),e}):function(){var e=l(arguments);return setTimeout(h(d,e),0),e},c.setImmediate=s,c.clearImmediate=p)}("undefined"==typeof self?void 0===t?this:t:self)}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").clearImmediate)},{_process:43,timers:46}],46:[function(e,t,n){(function(e){(function(){t.exports={setImmediate:e.setImmediate}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(e,t,n){(function(e){(function(){var r,n,i;e.crypto&&crypto.getRandomValues&&(r=new Uint8Array(16),n=function(){return crypto.getRandomValues(r),r}),n||(i=new Array(16),n=function(){for(var e,t=0;t<16;t++)!(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}),t.exports=n}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(e,t,r){for(var n=e("./rng"),i=[],o={},a=0;a<256;a++)i[a]=(a+256).toString(16).substr(1),o[i[a]]=a;function s(e,t){return t=t||0,i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]}var u=[1|(e=n())[0],e[1],e[2],e[3],e[4],e[5]],f=16383&(e[6]<<8|e[7]),c=0,l=0;function h(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;a++)t[i+a]=o[a];return t||s(o)}(e=h).v1=function(e,t,r){var n=t&&r||0,i=t||[],o=void 0!==(e=e||{}).clockseq?e.clockseq:f,a=void 0!==e.msecs?e.msecs:(new Date).getTime(),h=void 0!==e.nsecs?e.nsecs:l+1;if((r=a-c+(h-l)/1e4)<0&&void 0===e.clockseq&&(o=o+1&16383),1e4<=(h=(r<0||c<a)&&void 0===e.nsecs?0:h))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=a,f=o,h=(1e4*(268435455&(a+=122192928e5))+(l=h))%4294967296,i[n++]=h>>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=255&h,a=a/4294967296*1e4&268435455,i[n++]=a>>>8&255,i[n++]=255&a,i[n++]=a>>>24&15|16,i[n++]=a>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var d=e.node||u,p=0;p<6;p++)i[n+p]=d[p];return t||s(i)},e.v4=h,e.parse=function(e,t,r){var n=t&&r||0,i=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,(function(e){i<16&&(t[n+i++]=o[e])}));i<16;)t[n+i++]=0;return t},e.unparse=s,t.exports=e},{"./rng":47}],49:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});try{t.exports.XMLHttpRequest=XMLHttpRequest}catch(e){console.log("Warning: XMLHttpRequest is not defined"),t.exports.XMLHttpRequest=null}},{}],50:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../utils/properties");function i(){n.setType(this,"Provider")}i.isProvider=function(e){return n.isType(e,"Provider")},e=i,r.Provider=e},{"../utils/properties":74}],51:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("../utils/address"),s=e("../utils/bignumber"),u=e("../utils/bytes"),f=e("../constants"),c=e("../utils/hash"),l=e("../utils/networks"),h=e("../utils/properties"),d=e("../utils/rlp"),p=e("../utils/transaction"),y=e("../utils/utf8"),g=e("../utils/web"),b=o(e("../errors")),m=e("./abstract-provider");function v(e,t){var r,n={};for(r in e)try{var i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}function w(e,t){return function(r){return null==r?t:e(r)}}function _(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");var r=[];return t.forEach((function(t){r.push(e(t))})),r}}function E(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),32===u.hexDataLength(e))?e.toLowerCase():(b.throwError("invalid hash",b.INVALID_ARGUMENT,{arg:"hash",value:e}),null)}function S(e){return s.bigNumberify(e).toNumber()}function k(e){if(!u.isHexString(e))throw new Error("invalid uint256");for(;e.length<66;)e="0x0"+e.substring(2);return e}function A(e){if(null==e)return"latest";if("earliest"===e)return"0x0";if("latest"===e||"pending"===e)return e;if("number"==typeof e)return u.hexStripZeros(u.hexlify(e));if(u.isHexString(e))return u.hexStripZeros(e);throw new Error("invalid blockTag")}var T={hash:E,blockHash:w(E,null),blockNumber:w(S,null),transactionIndex:w(S,null),confirmations:w(S,null),from:a.getAddress,gasPrice:s.bigNumberify,gasLimit:s.bigNumberify,to:w(a.getAddress,null),value:s.bigNumberify,nonce:S,data:u.hexlify,r:w(k),s:w(k),v:w(S),creates:w(a.getAddress,null),raw:w(u.hexlify)};function P(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&s.bigNumberify(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=a.getContractAddress(e)),e.raw||e.v&&e.r&&e.s&&(r=[u.stripZeros(u.hexlify(e.nonce)),u.stripZeros(u.hexlify(e.gasPrice)),u.stripZeros(u.hexlify(e.gasLimit)),e.to||"0x",u.stripZeros(u.hexlify(e.value||"0x")),u.hexlify(e.data||"0x"),u.stripZeros(u.hexlify(e.v||"0x")),u.stripZeros(u.hexlify(e.r)),u.stripZeros(u.hexlify(e.s))],e.raw=d.encode(r));var t=v(T,e),r=e.networkId;return null!=e.chainId&&null==r&&null==t.v&&(r=e.chainId),"number"!=typeof(r=u.isHexString(r)?s.bigNumberify(r).toNumber():r)&&null!=t.v&&((r=(t.v-35)/2)<0&&(r=0),r=parseInt(r)),t.networkId=r="number"!=typeof r?0:r,null==t.chainId&&null!=r&&(t.chainId=r),t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}var O={hash:E,parentHash:E,number:S,timestamp:S,nonce:w(u.hexlify),difficulty:function(e){e=s.bigNumberify(e);try{return e.toNumber()}catch(e){}return null},gasLimit:s.bigNumberify,gasUsed:s.bigNumberify,miner:a.getAddress,extraData:u.hexlify,transactions:w(_(E))},I=h.shallowCopy(O);function x(e,t){return null!=e.author&&null==e.miner&&(e.miner=e.author),v(t?I:O,e)}I.transactions=w(_(P));var N={from:w(a.getAddress),nonce:w(S),gasLimit:w(s.bigNumberify),gasPrice:w(s.bigNumberify),to:w(a.getAddress),value:w(s.bigNumberify),data:w(u.hexlify)};function M(e){return v(N,e)}var R={transactionLogIndex:w(S),transactionIndex:S,blockNumber:S,transactionHash:E,address:a.getAddress,topics:_(E),data:u.hexlify,logIndex:S,blockHash:E},B={to:w(a.getAddress,null),from:w(a.getAddress,null),contractAddress:w(a.getAddress,null),transactionIndex:S,root:w(E),gasUsed:s.bigNumberify,logsBloom:w(u.hexlify),blockHash:E,transactionHash:E,logs:_((function(e){return v(R,e)})),blockNumber:S,confirmations:w(S,null),cumulativeGasUsed:s.bigNumberify,status:w(S)};function L(e){return Array.isArray(e)?e.forEach((function(e){L(e)})):null!=e&&E(e),e}var C,U,j={fromBlock:w(A,void 0),toBlock:w(A,void 0),address:w(a.getAddress,void 0),topics:w(L,void 0)},D={blockHash:w(E,void 0),address:w(a.getAddress,void 0),topics:w(L,void 0)},F={blockNumber:w(S),blockHash:w(E),transactionIndex:S,removed:w((function(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===e)return!0;if("false"===e)return!1}throw new Error("invaid boolean - "+e)})),address:a.getAddress,data:(C=u.hexlify,"0x",function(e){return e?C(e):"0x"}),topics:_(E),transactionHash:E,logIndex:S};function H(e){return v(F,e)}function K(e){return e.map((function(e){return"string"==typeof e?e:Array.isArray(e)?(e.forEach((function(e){null!==e&&32!==u.hexDataLength(e)&&b.throwError("invalid topic",b.INVALID_ARGUMENT,{argument:"topic",value:e})})),e.join(",")):null===e?"":b.throwError("invalid topic value",b.INVALID_ARGUMENT,{argument:"topic",value:e})})).join("&")}function G(e){if("string"==typeof e){if(20===u.hexDataLength(e))return"address:"+a.getAddress(e);if(e=e.toLowerCase(),32===u.hexDataLength(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter::"+K(e);if(e&&"object"==typeof e)return"filter:"+(e.address||"")+":"+K(e.topics||[])}throw new Error("invalid event - "+e)}function W(){return(new Date).getTime()}function V(e){var t,r=U.call(this)||this;return b.checkNew(r,m.Provider),e instanceof Promise?(h.defineReadOnly(r,"ready",e.then((function(e){return h.defineReadOnly(r,"_network",e),e}))),r.ready.catch((function(e){}))):(t=l.getNetwork(null==e?"homestead":e))?(h.defineReadOnly(r,"_network",t),h.defineReadOnly(r,"ready",Promise.resolve(r._network))):b.throwError("invalid network",b.INVALID_ARGUMENT,{arg:"network",value:e}),r._lastBlockNumber=-2,r._balances={},r._events=[],r._pollingInterval=4e3,r._emitted={block:-2},r._fastQueryDate=0,r}i(V,U=m.Provider),V.prototype._doPoll=function(){var e=this;this.getBlockNumber().then((function(t){if(e.polling&&(e._setFastBlockNumber(t),t!==e._lastBlockNumber)){-2===e._emitted.block&&(e._emitted.block=t-1);for(var r=e._emitted.block+1;r<=t;r++)e.emit("block",r);e._emitted.block!==t&&(e._emitted.block=t,Object.keys(e._emitted).forEach((function(r){var n;"block"===r||"pending"!==(n=e._emitted[r])&&12<t-n&&delete e._emitted[r]}))),-2===e._lastBlockNumber&&(e._lastBlockNumber=t-1);var n={},i={};return e._events.forEach((function(e){i[e.tag]=!0})),Object.keys(i).forEach((function(r){var i=r.split(":");switch(i[0]){case"tx":var o=i[1];e.getTransactionReceipt(o).then((function(t){return t&&null!=t.blockNumber&&(e._emitted["t:"+o]=t.blockNumber,e.emit(o,t)),null})).catch((function(t){e.emit("error",t)}));break;case"address":var a=i[1];e._balances[a]&&(n[a]=e._balances[a]),e.getBalance(a,"latest").then((function(t){var r=e._balances[a];if(!r||!t.eq(r))return e._balances[a]=t,e.emit(a,t),null})).catch((function(t){e.emit("error",t)}));break;case"filter":var s=i[2].split(/&/g).map((function(e){var t=e.split(",");return 1===t.length?""===t[0]?null:e:t.map((function(e){return""===e?null:e}))})),u={address:i[1],fromBlock:e._lastBlockNumber+1,toBlock:t,topics:s};u.address||delete u.address,e.getLogs(u).then((function(t){if(0!==t.length)return t.forEach((function(t){e._emitted["b:"+t.blockHash]=t.blockNumber,e._emitted["t:"+t.transactionHash]=t.blockNumber,e.emit(u,t)})),null})).catch((function(t){e.emit("error",t)}))}})),e._lastBlockNumber=t,e._balances=n,null}})).catch((function(e){})),this.doPoll()},V.prototype.resetEventsBlock=function(e){this._lastBlockNumber=e-1,this.polling&&this._doPoll()},Object.defineProperty(V.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),V.prototype.getNetwork=function(){return this.ready},Object.defineProperty(V.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(V.prototype,"polling",{get:function(){return null!=this._poller},set:function(e){var t=this;setTimeout((function(){e&&!t._poller?(t._poller=setInterval(t._doPoll.bind(t),t.pollingInterval),t._doPoll()):!e&&t._poller&&(clearInterval(t._poller),t._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(V.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),V.prototype._getFastBlockNumber=function(){var e=this,t=W();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise},V.prototype._setFastBlockNumber=function(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=W(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))},V.prototype.waitForTransaction=function(e,t){var r=this;return null==t&&(t=1),this.getTransactionReceipt(e).then((function(n){return 0===t||n&&n.confirmations>=t?n:new Promise((function(n){var i=function(o){o.confirmations<t||(r.removeListener(e,i),n(o))};r.on(e,i)}))}))},V.prototype.getBlockNumber=function(){var e=this;return this.ready.then((function(){return e.perform("getBlockNumber",{}).then((function(t){var r=parseInt(t);if(r!=t)throw new Error("invalid response - getBlockNumber");return e._setFastBlockNumber(r),r}))}))},V.prototype.getGasPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getGasPrice",{}).then((function(e){return s.bigNumberify(e)}))}))},V.prototype.getBalance=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,n=e.blockTag;return r._getAddress(t).then((function(e){return e={address:e,blockTag:A(n)},r.perform("getBalance",e).then((function(e){return s.bigNumberify(e)}))}))}))}))},V.prototype.getTransactionCount=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,n=e.blockTag;return r._getAddress(t).then((function(e){return e={address:e,blockTag:A(n)},r.perform("getTransactionCount",e).then((function(e){return s.bigNumberify(e).toNumber()}))}))}))}))},V.prototype.getCode=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,n=e.blockTag;return r._getAddress(t).then((function(e){return e={address:e,blockTag:A(n)},r.perform("getCode",e).then((function(e){return u.hexlify(e)}))}))}))}))},V.prototype.getStorageAt=function(e,t,r){var n=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,position:t,blockTag:r}).then((function(e){var t=e.addressOrName,r=e.position,i=e.blockTag;return n._getAddress(t).then((function(e){return e={address:e,blockTag:A(i),position:u.hexStripZeros(u.hexlify(r))},n.perform("getStorageAt",e).then((function(e){return u.hexlify(e)}))}))}))}))},V.prototype.sendTransaction=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties({signedTransaction:e}).then((function(e){var r=e.signedTransaction;return e={signedTransaction:u.hexlify(r)},t.perform("sendTransaction",e).then((function(e){return t._wrapTransaction(p.parse(r),e)}),(function(e){throw e.transaction=p.parse(r),e.transaction.hash&&(e.transactionHash=e.transaction.hash),e}))}))}))},V.prototype._wrapTransaction=function(e,t){var r=this;if(null!=t&&32!==u.hexDataLength(t))throw new Error("invalid response - sendTransaction");var n=e;return null!=t&&e.hash!==t&&b.throwError("Transaction hash mismatch from Provider.sendTransaction.",b.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=function(t){return 0!==t&&(r._emitted["t:"+e.hash]="pending"),r.waitForTransaction(e.hash,t).then((function(n){return null==n&&0===t?null:(r._emitted["t:"+e.hash]=n.blockNumber,0===n.status&&b.throwError("transaction failed",b.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e}),n)}))},n},V.prototype.call=function(e,t){var r=this,n=h.shallowCopy(e);return this.ready.then((function(){return h.resolveProperties({blockTag:t,tx:n}).then((function(e){var t=e.blockTag;return e=e.tx,r._resolveNames(e,["to","from"]).then((function(e){return e={blockTag:A(t),transaction:M(e)},r.perform("call",e).then((function(e){return u.hexlify(e)}))}))}))}))},V.prototype.estimateGas=function(e){var t=this,r={to:e.to,from:e.from,data:e.data,gasPrice:e.gasPrice,value:e.value};return this.ready.then((function(){return h.resolveProperties(r).then((function(e){return t._resolveNames(e,["to","from"]).then((function(e){return e={transaction:M(e)},t.perform("estimateGas",e).then((function(e){return s.bigNumberify(e)}))}))}))}))},V.prototype.getBlock=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({blockHashOrBlockTag:e}).then((function(e){e=e.blockHashOrBlockTag;try{var n=u.hexlify(e);if(32===u.hexDataLength(n))return g.poll((function(){return r.perform("getBlock",{blockHash:n,includeTransactions:!!t}).then((function(e){return null==e?null==r._emitted["b:"+n]?null:void 0:x(e,t)}))}),{onceBlock:r})}catch(e){}try{var i=-128,o=A(e);return u.isHexString(o)&&(i=parseInt(o.substring(2),16)),g.poll((function(){return r.perform("getBlock",{blockTag:o,includeTransactions:!!t}).then((function(e){return null==e?i<=r._emitted.block?void 0:null:x(e,t)}))}),{onceBlock:r})}catch(e){}throw new Error("invalid block hash or block tag")}))}))},V.prototype.getTransaction=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties({transactionHash:e}).then((function(e){var r=e.transactionHash,n={transactionHash:E(r,!0)};return g.poll((function(){return t.perform("getTransaction",n).then((function(e){if(null==e)return null==t._emitted["t:"+r]?null:void 0;var n=V.checkTransactionResponse(e);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations)return t._getFastBlockNumber().then((function(e){return e=e-n.blockNumber+1,n.confirmations=e=e<=0?1:e,t._wrapTransaction(n)}));return t._wrapTransaction(n)}))}),{onceBlock:t})}))}))},V.prototype.getTransactionReceipt=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties({transactionHash:e}).then((function(e){var r=e.transactionHash,n={transactionHash:E(r,!0)};return g.poll((function(){return t.perform("getTransactionReceipt",n).then((function(e){if(null==e)return null==t._emitted["t:"+r]?null:void 0;if(null!=e.blockHash){var n,i=((e=v(B,n=e)).logs.forEach((function(e,t){null==e.transactionLogIndex&&(e.transactionLogIndex=t)})),null!=n.status&&(e.byzantium=!0),e);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations)return t._getFastBlockNumber().then((function(e){return e=e-i.blockNumber+1,i.confirmations=e=e<=0?1:e,i}));return i}}))}),{onceBlock:t})}))}))},V.prototype.getLogs=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties(e).then((function(e){return t._resolveNames(e,["address"]).then((function(e){return e={filter:e&&e.blockHash?v(D,e):v(j,e)},t.perform("getLogs",e).then((function(e){return _(H)(e)}))}))}))}))},V.prototype.getEtherPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getEtherPrice",{}).then((function(e){return e}))}))},V.prototype._getAddress=function(e){return this.resolveName(e).then((function(t){return null==t&&b.throwError("ENS name not configured",b.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(e)+")"}),t}))},V.prototype._resolveNames=function(e,t){var r=[],n=h.shallowCopy(e);return t.forEach((function(e){null!=n[e]&&r.push(this._getAddress(n[e]).then((function(t){n[e]=t})))}),this),Promise.all(r).then((function(){return n}))},V.prototype._getResolver=function(e){var t=this;return this.getNetwork().then((function(r){r.ensAddress||b.throwError("network does not support ENS",b.UNSUPPORTED_OPERATION,{operation:"ENS",network:r.name});var n="0x0178b8bf"+c.namehash(e).substring(2);return n={to:r.ensAddress,data:n},t.call(n).then((function(e){return 32!==u.hexDataLength(e)||(e=a.getAddress(u.hexDataSlice(e,12)))===f.AddressZero?null:e}))}))},V.prototype.resolveName=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.resolveName(e)}));try{return Promise.resolve(a.getAddress(e))}catch(t){if(u.isHexString(e))throw t}var r=this,n=c.namehash(e);return this._getResolver(e).then((function(e){if(null==e)return null;var t="0x3b3b57de"+n.substring(2);return r.call({to:e,data:t})})).then((function(e){return 32!==u.hexDataLength(e)||(e=a.getAddress(u.hexDataSlice(e,12)))===f.AddressZero?null:e}))},V.prototype.lookupAddress=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.lookupAddress(e)}));var r=(e=a.getAddress(e)).substring(2)+".addr.reverse",n=c.namehash(r),i=this;return this._getResolver(r).then((function(e){if(!e)return null;var t="0x691f3431"+n.substring(2);return i.call({to:e,data:t})})).then((function(t){if(null==t)return null;if((t=t.substring(2)).length<64)return null;if((t=t.substring(64)).length<64)return null;var r=s.bigNumberify("0x"+t.substring(0,64)).toNumber();if(2*r>(t=t.substring(64)).length)return null;var n=y.toUtf8String("0x"+t.substring(0,2*r));return i.resolveName(n).then((function(t){return t!=e?null:n}))}))},V.checkTransactionResponse=P,V.prototype.doPoll=function(){},V.prototype.perform=function(e,t){return b.throwError(e+" not implemented",b.NOT_IMPLEMENTED,{operation:e}),null},V.prototype._startPending=function(){b.warn("WARNING: this provider does not support pending events")},V.prototype._stopPending=function(){},V.prototype._addEventListener=function(e,t,r){this._events.push({tag:G(e),listener:t,once:r}),"pending"===e&&this._startPending(),this.polling=!0},V.prototype.on=function(e,t){return this._addEventListener(e,t,!1),this},V.prototype.once=function(e,t){return this._addEventListener(e,t,!0),this},V.prototype.addEventListener=function(e,t){return this.on(e,t)},V.prototype.emit=function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=!1,o=G(e);return this._events=this._events.filter((function(e){return e.tag!==o||(setTimeout((function(){e.listener.apply(t,r)}),0),i=!0,!e.once)})),0===this.listenerCount()&&(this.polling=!1),i},V.prototype.listenerCount=function(e){if(!e)return this._events.length;var t=G(e);return this._events.filter((function(e){return e.tag===t})).length},V.prototype.listeners=function(e){var t=G(e);return this._events.filter((function(e){return e.tag===t})).map((function(e){return e.listener}))},V.prototype.removeAllListeners=function(e){var t;return null==e?(this._events=[],this._stopPending()):(t=G(e),this._events=this._events.filter((function(e){return e.tag!==t})),"pending"===e&&this._stopPending()),0===this._events.length&&(this.polling=!1),this},V.prototype.removeListener=function(e,t){var r=!1,n=G(e);return this._events=this._events.filter((function(e){return e.tag!==n||e.listener!=t||!!r||!(r=!0)})),"pending"===e&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},i=V,r.BaseProvider=i,h.defineReadOnly(m.Provider,"inherits",h.inheritable(m.Provider))},{"../constants":3,"../errors":5,"../utils/address":60,"../utils/bignumber":63,"../utils/bytes":64,"../utils/hash":65,"../utils/networks":72,"../utils/properties":74,"../utils/rlp":76,"../utils/transaction":83,"../utils/utf8":85,"../utils/web":86,"./abstract-provider":50}],52:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./base-provider"),s=e("../utils/bytes"),u=e("../utils/properties"),f=e("../utils/web"),c=o(e("../errors"));function l(e){var t,r,n=[];for(t in e)null!=e[t]&&(r=s.hexlify(e[t]),{gasLimit:!0,gasPrice:!0,nonce:!0,value:!0}[t]&&(r=s.hexStripZeros(r)),n.push(t+"="+r));return n.join("&")}function h(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1==e.status&&"OK"==e.message)return e.result;var t=new Error("invalid response");throw t.result=JSON.stringify(e),t}function d(e){if("2.0"!=e.jsonrpc)throw(t=new Error("invalid response")).result=JSON.stringify(e),t;if(e.error){var t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function p(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}var y;function g(e,t){var r=y.call(this,e)||this;c.checkNew(r,g),e="invalid";var n=null;switch(e=r.network?r.network.name:e){case"homestead":n="https://api.etherscan.io";break;case"ropsten":n="https://api-ropsten.etherscan.io";break;case"rinkeby":n="https://api-rinkeby.etherscan.io";break;case"kovan":n="https://api-kovan.etherscan.io";break;case"goerli":n="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}return u.defineReadOnly(r,"baseUrl",n),u.defineReadOnly(r,"apiKey",t||"8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR"),r}i(g,y=a.BaseProvider),g.prototype.perform=function(e,t){var r,n=this,i=this.baseUrl,o="";function a(e,t){return f.fetchJson(e,null,t||d).then((function(t){return n.emit("debug",{action:"perform",request:e,response:t,provider:n}),t}))}switch(this.apiKey&&(o+="&apikey="+this.apiKey),e){case"getBlockNumber":return a(i+="/api?module=proxy&action=eth_blockNumber"+o);case"getGasPrice":return a(i+="/api?module=proxy&action=eth_gasPrice"+o);case"getBalance":return i+="/api?module=account&action=balance&address="+t.address,a(i+="&tag="+t.blockTag+o,h);case"getTransactionCount":return i+="/api?module=proxy&action=eth_getTransactionCount&address="+t.address,a(i+="&tag="+t.blockTag+o);case"getCode":return i+="/api?module=proxy&action=eth_getCode&address="+t.address,a(i+="&tag="+t.blockTag+o,d);case"getStorageAt":return i+="/api?module=proxy&action=eth_getStorageAt&address="+t.address,i+="&position="+t.position,a(i+="&tag="+t.blockTag+o,d);case"sendTransaction":return i+="/api?module=proxy&action=eth_sendRawTransaction&hex="+t.signedTransaction,a(i+=o).catch((function(e){throw e.responseText&&(0<=e.responseText.toLowerCase().indexOf("insufficient funds")&&c.throwError("insufficient funds",c.INSUFFICIENT_FUNDS,{}),0<=e.responseText.indexOf("same hash was already imported")&&c.throwError("nonce has already been used",c.NONCE_EXPIRED,{}),0<=e.responseText.indexOf("another transaction with same nonce")&&c.throwError("replacement fee too low",c.REPLACEMENT_UNDERPRICED,{})),e}));case"getBlock":return t.blockTag?(i+="/api?module=proxy&action=eth_getBlockByNumber&tag="+t.blockTag,t.includeTransactions?i+="&boolean=true":i+="&boolean=false",a(i+=o)):Promise.reject(new Error("getBlock by blockHash not implemeneted"));case"getTransaction":return i+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+t.transactionHash,a(i+=o);case"getTransactionReceipt":return i+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+t.transactionHash,a(i+=o);case"call":return i+="/api?module=proxy&action=eth_call"+(r=(r=l(t.transaction))&&"&"+r),"latest"!==t.blockTag?Promise.reject(new Error("EtherscanProvider does not support blockTag for call")):a(i+=o);case"estimateGas":return i+="/api?module=proxy&action=eth_estimateGas&"+(r=(r=l(t.transaction))&&"&"+r),a(i+=o);case"getLogs":i+="/api?module=logs&action=getLogs";try{if(t.filter.fromBlock&&(i+="&fromBlock="+p(t.filter.fromBlock)),t.filter.toBlock&&(i+="&toBlock="+p(t.filter.toBlock)),t.filter.blockHash)try{c.throwError("Etherscan does not support blockHash filters",c.UNSUPPORTED_OPERATION,{operation:"getLogs(blockHash)"})}catch(e){return Promise.reject(e)}if(t.filter.address&&(i+="&address="+t.filter.address),t.filter.topics&&0<t.filter.topics.length){if(1<t.filter.topics.length)throw new Error("unsupported topic format");var s=t.filter.topics[0];if("string"!=typeof s||66!==s.length)throw new Error("unsupported topic0 format");i+="&topic0="+s}}catch(e){return Promise.reject(e)}var u=this;return a(i+=o,h).then((function(e){var t={},r=Promise.resolve();return e.forEach((function(e){r=r.then((function(){return null!=e.blockHash?null:(e.blockHash=t[e.transactionHash],null==e.blockHash?u.getTransaction(e.transactionHash).then((function(r){return t[e.transactionHash]=r.blockHash,e.blockHash=r.blockHash,null})):null)}))})),r.then((function(){return e}))}));case"getEtherPrice":return"homestead"!==this.network.name?Promise.resolve(0):(i+="/api?module=stats&action=ethprice",a(i+=o,h).then((function(e){return parseFloat(e.ethusd)})))}return y.prototype.perform.call(this,e,t)},g.prototype.getHistory=function(e,t,r){var n=this,i=this.baseUrl,o="";return this.apiKey&&(o+="&apikey="+this.apiKey),null==t&&(t=0),null==r&&(r=99999999),this.resolveName(e).then((function(e){return i+="/api?module=account&action=txlist&address="+e,i+="&startblock="+t,i+="&endblock="+r,i+="&sort=asc"+o,f.fetchJson(i,null,h).then((function(e){n.emit("debug",{action:"getHistory",request:i,response:e,provider:n});var t=[];return e.forEach((function(e){["contractAddress","to"].forEach((function(t){""==e[t]&&delete e[t]})),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);var r=a.BaseProvider.checkTransactionResponse(e);e.timeStamp&&(r.timestamp=parseInt(e.timeStamp)),t.push(r)})),t}))}))},i=g,r.EtherscanProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/properties":74,"../utils/web":86,"./base-provider":51}],53:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./base-provider"),u=o(e("../errors"));function f(e){var t=!0,r=null;return e.forEach((function(n){null!=n?null!=r?r.name===n.name&&r.chainId===n.chainId&&(r.ensAddress===n.ensAddress||null==r.ensAddress&&null==n.ensAddress)||u.throwError("provider mismatch",u.INVALID_ARGUMENT,{arg:"networks",value:e}):r=n:t=!1})),t}function c(e){var t,r=this;if(0===e.length)throw new Error("no providers");return r=f(e.map((function(e){return e.network})))?a.call(this,e[0].network)||this:(t=Promise.all(e.map((function(e){return e.getNetwork()}))).then((function(e){return f(e)||u.throwError("getNetwork returned null",u.UNKNOWN_ERROR,{}),e[0]})),a.call(this,t)||this),u.checkNew(r,c),r._providers=e.slice(0),r}i(c,a=s.BaseProvider),Object.defineProperty(c.prototype,"providers",{get:function(){return this._providers.slice(0)},enumerable:!0,configurable:!0}),c.prototype.perform=function(e,t){var r=this.providers;return new Promise((function(n,i){var o=null;!function a(){r.length?r.shift().perform(e,t).then((function(e){return n(e)})).catch((function(e){o=o||e,setTimeout(a,0)})):i(o)}()}))},i=c,r.FallbackProvider=i},{"../errors":5,"./base-provider":51}],54:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./abstract-provider");r.Provider=n.Provider,n=e("./base-provider"),r.BaseProvider=n.BaseProvider,n=e("./etherscan-provider"),r.EtherscanProvider=n.EtherscanProvider,n=e("./fallback-provider"),r.FallbackProvider=n.FallbackProvider,n=e("./ipc-provider"),r.IpcProvider=n.IpcProvider,n=e("./infura-provider"),r.InfuraProvider=n.InfuraProvider,n=e("./json-rpc-provider"),r.JsonRpcProvider=n.JsonRpcProvider,r.JsonRpcSigner=n.JsonRpcSigner,e=e("./web3-provider"),r.Web3Provider=e.Web3Provider},{"./abstract-provider":50,"./base-provider":51,"./etherscan-provider":52,"./fallback-provider":53,"./infura-provider":55,"./ipc-provider":56,"./json-rpc-provider":57,"./web3-provider":58}],55:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./json-rpc-provider"),u=e("../utils/bytes"),f=e("../utils/networks"),c=e("../utils/properties"),l=o(e("../errors"));function h(e,t){var r=this,n=f.getNetwork(null==e?"homestead":e);null==t&&(t="7d0d81d0919f4f05b9ab6634be01ee73");var i=null;switch(n.name){case"homestead":i="mainnet.infura.io";break;case"ropsten":i="ropsten.infura.io";break;case"rinkeby":i="rinkeby.infura.io";break;case"goerli":i="goerli.infura.io";break;case"kovan":i="kovan.infura.io";break;default:l.throwError("unsupported network",l.INVALID_ARGUMENT,{argument:"network",value:e})}return u.isHexString("0x"+t,16)?(r=a.call(this,"https://"+i+"/v3/"+t,n)||this,c.defineReadOnly(r,"apiAccessToken",null),c.defineReadOnly(r,"projectId",t)):(l.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)"),r=a.call(this,"https://"+i+"/"+t,n)||this,c.defineReadOnly(r,"apiAccessToken",t),c.defineReadOnly(r,"projectId",null)),l.checkNew(r,h),r}i(h,a=s.JsonRpcProvider),h.prototype._startPending=function(){l.warn("WARNING: INFURA does not support pending filters")},h.prototype.getSigner=function(e){return l.throwError("INFURA does not support signing",l.UNSUPPORTED_OPERATION,{operation:"getSigner"})},h.prototype.listAccounts=function(){return Promise.resolve([])},i=h,r.InfuraProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"./json-rpc-provider":57}],56:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})},{}],57:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./base-provider"),s=e("../abstract-signer"),u=o(e("../errors")),f=e("../utils/address"),c=e("../utils/bytes"),l=e("../utils/networks"),h=e("../utils/properties"),d=e("../utils/utf8"),p=e("../utils/web");function y(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function g(e){return e&&e.toLowerCase()}var b,m={},v=42,w=(i(_,b=s.Signer),_.prototype.getAddress=function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&u.throwError("unknown account #"+e._index,u.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e._address=f.getAddress(t[e._index]),e._address}))},_.prototype.getBalance=function(e){return this.provider.getBalance(this.getAddress(),e)},_.prototype.getTransactionCount=function(e){return this.provider.getTransactionCount(this.getAddress(),e)},_.prototype.sendUncheckedTransaction=function(e){var t=this;e=h.shallowCopy(e);var r,n=this.getAddress().then((function(e){return e&&e.toLowerCase()}));return null==e.gasLimit&&((r=h.shallowCopy(e)).from=n,e.gasLimit=this.provider.estimateGas(r)),Promise.all([h.resolveProperties(e),n]).then((function(e){var r=e[0],n=k.hexlifyTransaction(r);return n.from=e[1],t.provider.send("eth_sendTransaction",[n]).then((function(e){return e}),(function(e){throw e.responseText&&(0<=e.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{transaction:r}),0<=e.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{transaction:r}),0<=e.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{transaction:r})),e}))}))},_.prototype.sendTransaction=function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return p.poll((function(){return t.provider.getTransaction(e).then((function(r){if(null!==r)return t.provider._wrapTransaction(r,e)}))}),{fastRetry:250,onceBlock:t.provider}).catch((function(t){throw t.transactionHash=e,t}))}))},_.prototype.signMessage=function(e){var t=this,r="string"==typeof e?d.toUtf8Bytes(e):e;return this.getAddress().then((function(e){return t.provider.send("eth_sign",[e.toLowerCase(),c.hexlify(r)])}))},_.prototype.unlock=function(e){var t=this.provider;return this.getAddress().then((function(r){return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))},_);function _(e,t,r){var n=b.call(this)||this;if(u.checkNew(n,_),e!==m)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return h.defineReadOnly(n,"provider",t),r?"string"==typeof r?h.defineReadOnly(n,"_address",f.getAddress(r)):"number"==typeof r?h.defineReadOnly(n,"_index",r):u.throwError("invalid address or index",u.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):h.defineReadOnly(n,"_index",0),n}r.JsonRpcSigner=w;var E,S={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},k=(i(A,E=a.BaseProvider),A.prototype.getSigner=function(e){return new w(m,this,e)},A.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(e){return e.map((function(e){return f.getAddress(e)}))}))},A.prototype.send=function(e,t){var r=this,n={method:e,params:t,id:v++,jsonrpc:"2.0"};return p.fetchJson(this.connection,JSON.stringify(n),y).then((function(e){return r.emit("debug",{action:"send",request:n,response:e,provider:r}),e}))},A.prototype.perform=function(e,t){switch(e){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[g(t.address),t.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[g(t.address),t.blockTag]);case"getCode":return this.send("eth_getCode",[g(t.address),t.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[g(t.address),t.position,t.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[t.signedTransaction]).catch((function(e){throw e.responseText&&(0<e.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{}),0<e.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{}),0<e.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{})),e}));case"getBlock":return t.blockTag?this.send("eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]):t.blockHash?this.send("eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[t.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[t.transactionHash]);case"call":return this.send("eth_call",[A.hexlifyTransaction(t.transaction,{from:!0}),t.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[A.hexlifyTransaction(t.transaction,{from:!0})]);case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=g(t.filter.address)),this.send("eth_getLogs",[t.filter])}return u.throwError(e+" not implemented",u.NOT_IMPLEMENTED,{operation:e}),null},A.prototype._startPending=function(){var e,t;null==this._pendingFilter&&(t=(e=this).send("eth_newPendingTransactionFilter",[]),(this._pendingFilter=t).then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;var n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return 1e3,new Promise((function(e){setTimeout((function(){e()}),1e3)}))}))})).then((function(){return e._pendingFilter==t?(setTimeout((function(){n()}),0),null):void e.send("eth_uninstallFilter",[r])})).catch((function(e){}))}(),r})).catch((function(e){})))},A.prototype._stopPending=function(){this._pendingFilter=null},A.hexlifyTransaction=function(e,t){var r=h.shallowCopy(S);if(t)for(var n in t)t[n]&&(r[n]=!0);h.checkProperties(e,r);var i={};return["gasLimit","gasPrice","nonce","value"].forEach((function(t){var r;null!=e[t]&&(r=c.hexStripZeros(c.hexlify(e[t])),i[t="gasLimit"===t?"gas":t]=r)})),["from","to","data"].forEach((function(t){null!=e[t]&&(i[t]=c.hexlify(e[t]))})),i},A);function A(e,t){var r=this;return"string"==typeof e&&null===t&&l.getNetwork(e)&&(t=e,e=null),t||(t=new Promise((function(e,t){setTimeout((function(){r.send("net_version",[]).then((function(t){return e(l.getNetwork(parseInt(t)))})).catch((function(e){t(e)}))}))}))),r=E.call(this,t)||this,u.checkNew(r,A),r.connection="string"==typeof(e=e||"http://localhost:8545")?{url:e}:e,r}r.JsonRpcProvider=k},{"../abstract-signer":2,"../errors":5,"../utils/address":60,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"../utils/utf8":85,"../utils/web":86,"./base-provider":51}],58:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./json-rpc-provider"),u=e("../utils/properties"),f=o(e("../errors")),c=42;function l(e,t){return t=a.call(this,e.host||e.path||"",t)||this,f.checkNew(t,l),e&&(e.sendAsync?t._sendAsync=e.sendAsync.bind(e):e.send&&(t._sendAsync=e.send.bind(e))),e&&t._sendAsync||f.throwError("invalid web3Provider",f.INVALID_ARGUMENT,{arg:"web3Provider",value:e}),u.defineReadOnly(t,"_web3Provider",e),u.defineReadOnly(t,"provider",e),t}i(l,a=s.JsonRpcProvider),l.prototype.send=function(e,t){var r=this;return"eth_sign"==e&&this._web3Provider.isMetaMask&&(e="personal_sign",t=[t[1],t[0]]),new Promise((function(n,i){var o={method:e,params:t,id:c++,jsonrpc:"2.0"};r._sendAsync(o,(function(e,t){if(e)i(e);else{if(t.error)return(e=new Error(t.error.message)).code=t.error.code,e.data=t.error.data,void i(e);n(t.result)}}))}))},i=l,r.Web3Provider=i},{"../errors":5,"../utils/properties":74,"./json-rpc-provider":57}],59:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("../constants"),s=o(e("../errors")),u=e("./address"),f=e("./bignumber"),c=e("./bytes"),l=e("./utf8"),h=e("./properties"),d=new RegExp(/^bytes([0-9]*)$/),p=new RegExp(/^(u?int)([0-9]*)$/),y=new RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(e,t){return(e=e.match(p))&&parseInt(e[2])<=48?t.toNumber():t};var g=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),b=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function m(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}function v(e,t){var r=e;function n(e){throw new Error('unexpected character "'+r[e]+'" at position '+e+' in "'+r+'"')}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,a=0;a<e.length;a++){var s=e[a];switch(s){case"(":o.state.allowParams||n(a),o.state.allowType=!1,o.type=m(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,t&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=m(o.type);var u=o;(o=o.parent)||n(a),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,t&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=m(o.type),u={type:"",name:"",parent:o.parent,state:{allowType:!0}},o.parent.components.push(u),delete o.parent,o=u;break;case" ":o.state.allowType&&""!==o.type&&(o.type=m(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(t&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(a),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(a),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(a)}}if(o.parent)throw new Error("unexpected eof");return delete i.state,t&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=m(i.type),i}function w(e){return ie(r.defaultCoerceFunc,e).type}function _(e,t,r,n,i){this.coerceFunc=e,this.name=t,this.type=r,this.localName=n,this.dynamic=i}r.parseParamType=function(e){return v(e,!0)},r.formatParamType=w,r.formatSignature=function(e){return e.name+"("+e.inputs.map(w).join(",")+")"},r.parseSignature=function(e){if("string"==typeof e)return"event "===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(e){var t={anonymous:!1,inputs:[],name:"",type:"event"},r=e.match(g);if(!r)throw new Error("invalid event: "+e);if(t.name=r[1].trim(),re(r[2]).forEach((function(e){(e=v(e,!0)).indexed=!!e.indexed,t.inputs.push(e)})),r[3].split(" ").forEach((function(e){switch(e){case"anonymous":t.anonymous=!0;break;case"":break;default:s.info("unknown modifier: "+e)}})),t.name&&!t.name.match(b))throw new Error('invalid identifier: "'+t.name+'"');return t}(e.substring(6).trim()):function(e){var t={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=e.split("@");if(1!==r.length){if(2<r.length)throw new Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw new Error("invalid signature gas");t.gas=f.bigNumberify(r[1]),e=r[0]}if(!(e=(r=e.split(" returns "))[0].match(g)))throw new Error("invalid signature");if(t.name=e[1].trim(),!t.name.match(b))throw new Error('invalid identifier: "'+e[1]+'"');if(re(e[2]).forEach((function(e){t.inputs.push(v(e))})),e[3].split(" ").forEach((function(e){switch(e){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:s.info("unknown modifier: "+e)}})),1<r.length){if(""!=(r=r[1].match(g))[1].trim()||""!=r[3].trim())throw new Error("unexpected tokens");re(r[2]).forEach((function(e){t.outputs.push(v(e))}))}if("constructor"===t.name){if(t.type="constructor",t.outputs.length)throw new Error("constructor may not have outputs");delete t.name,delete t.outputs}return t}((e="function "===e.substring(0,9)?e.substring(9):e).trim());throw new Error("unknown signature")};var E,S=(i(k,E=_),k.prototype.encode=function(e){return this.coder.encode(e)},k.prototype.decode=function(e,t){return this.coder.decode(e,t)},k);function k(e){var t=E.call(this,e.coerceFunc,e.name,e.type,void 0,e.dynamic)||this;return h.defineReadOnly(t,"coder",e),t}var A,T=(i(P,A=_),P.prototype.encode=function(e){return c.arrayify([])},P.prototype.decode=function(e,t){if(t>e.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},P);function P(e,t){return A.call(this,e,"null","",t,!1)||this}var O,I=(i(x,O=_),x.prototype.encode=function(e){try{var t=f.bigNumberify(e);if(this.signed){var r=a.MaxUint256.maskn(8*this.size-1);if(t.gt(r))throw new Error("out-of-bounds");if(r=r.add(a.One).mul(a.NegativeOne),t.lt(r))throw new Error("out-of-bounds")}else if(t.lt(a.Zero)||t.gt(a.MaxUint256.maskn(8*this.size)))throw new Error("out-of-bounds");return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),c.padZeros(c.arrayify(t),32)}catch(t){s.throwError("invalid number value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e})}return null},x.prototype.decode=function(e,t){e.length<t+32&&s.throwError("insufficient data for "+this.name+" type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:c.hexlify(e.slice(t,t+32))});var r=32-this.size;return t=f.bigNumberify(e.slice(t+r,t+32)),t=this.signed?t.fromTwos(8*this.size):t.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,t)}},x);function x(e,t,r,n){var i=this,o=(r?"int":"uint")+8*t;return(i=O.call(this,e,o,o,n,!1)||this).size=t,i.signed=r,i}var N,M=new I((function(e,t){return t}),32,!1,"none"),R=(i(B,N=_),B.prototype.encode=function(e){return M.encode(e?1:0)},B.prototype.decode=function(e,t){try{var r=M.decode(e,t)}catch(e){throw"insufficient data for uint256 type"===e.reason&&s.throwError("insufficient data for boolean type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:e.value}),e}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},B);function B(e,t){return N.call(this,e,"bool","bool",t,!1)||this}var L,C=(i(U,L=_),U.prototype.encode=function(e){var t=new Uint8Array(32);try{var r=c.arrayify(e);if(r.length!==this.length)throw new Error("incorrect data length");t.set(r)}catch(t){s.throwError("invalid "+this.name+" value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t.value||e})}return t},U.prototype.decode=function(e,t){return e.length<t+32&&s.throwError("insufficient data for "+this.name+" type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:c.hexlify(e.slice(t,t+32))}),{consumed:32,value:this.coerceFunc(this.name,c.hexlify(e.slice(t,t+this.length)))}},U);function U(e,t,r){var n=this,i="bytes"+t;return(n=L.call(this,e,i,i,r,!1)||this).length=t,n}var j,D,F,H=(i(K,j=_),K.prototype.encode=function(e){var t=new Uint8Array(32);try{t.set(c.arrayify(u.getAddress(e)),12)}catch(t){s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:e})}return t},K.prototype.decode=function(e,t){return e.length<t+32&&s.throwError("insufficient data for address type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:c.hexlify(e.slice(t,t+32))}),{consumed:32,value:this.coerceFunc("address",u.getAddress(c.hexlify(e.slice(t+12,t+32))))}},K);function K(e,t){return j.call(this,e,"address","address",t,!1)||this}function G(e){var t=32*Math.ceil(e.length/32);return t=new Uint8Array(t-e.length),c.concat([M.encode(e.length),e,t])}function W(e,t,r){e.length<t+32&&s.throwError("insufficient data for dynamicBytes length",s.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:c.hexlify(e.slice(t,t+32))});var n=M.decode(e,t).value;try{n=n.toNumber()}catch(e){s.throwError("dynamic bytes count too large",s.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:n.toString()})}return e.length<t+32+n&&s.throwError("insufficient data for dynamicBytes type",s.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:c.hexlify(e.slice(t,t+32+n))}),{consumed:32+32*Math.ceil(n/32),value:e.slice(t+32,t+32+n)}}function V(e,t){return D.call(this,e,"bytes","bytes",t,!0)||this}function z(e,t){return F.call(this,e,"string","string",t,!0)||this}function q(e){return 32*Math.ceil(e/32)}function Z(e,t){var r;Array.isArray(t)||(t&&"object"==typeof t?(r=[],e.forEach((function(e){r.push(t[e.localName])})),t=r):s.throwError("invalid tuple value",s.INVALID_ARGUMENT,{coderType:"tuple",value:t})),e.length!==t.length&&s.throwError("types/value length mismatch",s.INVALID_ARGUMENT,{coderType:"tuple",value:t});var n=[];e.forEach((function(e,r){n.push({dynamic:e.dynamic,value:e.encode(t[r])})}));var i=0,o=0;n.forEach((function(e){e.dynamic?(i+=32,o+=q(e.value.length)):i+=q(e.value.length)}));var a=0,u=i,f=new Uint8Array(i+o);return n.forEach((function(e){e.dynamic?(f.set(M.encode(u),a),a+=32,f.set(e.value,u),u+=q(e.value.length)):(f.set(e.value,a),a+=q(e.value.length))})),f}function $(e,t,r){var n=r,i=0,o=[];return e.forEach((function(e){var a,s;e.dynamic?(a=M.decode(t,r),(s=e.decode(t,n+a.value.toNumber())).consumed=a.consumed):s=e.decode(t,r),null!=s.value&&o.push(s.value),r+=s.consumed,i+=s.consumed})),e.forEach((function(e,t){(e=e.localName)&&null==o[e="length"===e?"_length":e]&&(o[e]=o[t])})),{value:o,consumed:i}}i(V,D=_),V.prototype.encode=function(e){try{return G(c.arrayify(e))}catch(e){s.throwError("invalid bytes value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:e.value})}return null},V.prototype.decode=function(e,t){return(t=W(e,t,this.localName)).value=this.coerceFunc("bytes",c.hexlify(t.value)),t},o=V,i(z,F=_),z.prototype.encode=function(e){return"string"!=typeof e&&s.throwError("invalid string value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:e}),G(l.toUtf8Bytes(e))},z.prototype.decode=function(e,t){return(t=W(e,t,this.localName)).value=this.coerceFunc("string",l.toUtf8String(t.value)),t},e=z;var X,Y=(i(J,X=_),J.prototype.encode=function(e){Array.isArray(e)||s.throwError("expected array value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:e});var t=this.length,r=new Uint8Array(0);-1===t&&(t=e.length,r=M.encode(t)),s.checkArgumentCount(t,e.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;i<e.length;i++)n.push(this.coder);return c.concat([r,Z(n,e)])},J.prototype.decode=function(e,t){var r=0,n=this.length;if(-1===n){try{var i=M.decode(e,t)}catch(e){s.throwError("insufficient data for dynamic array length",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:e.value})}try{n=i.value.toNumber()}catch(e){s.throwError("array count too large",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:i.value.toString()})}r+=i.consumed,t+=i.consumed}for(var o=[],a=0;a<n;a++)o.push(new S(this.coder));return(t=$(o,e,t)).consumed+=r,t.value=this.coerceFunc(this.type,t.value),t},J);function J(e,t,r,n){var i=this,o=t.type+"["+(0<=r?r:"")+"]",a=-1===r||t.dynamic;return(i=X.call(this,e,"array",o,n,a)||this).coder=t,i.length=r,i}var Q,ee=(i(te,Q=_),te.prototype.encode=function(e){return Z(this.coders,e)},te.prototype.decode=function(e,t){return(t=$(this.coders,e,t)).value=this.coerceFunc(this.type,t.value),t},te);function te(e,t,r){var n=this,i=!1,o=[];t.forEach((function(e){e.dynamic&&(i=!0),o.push(e.type)}));var a="tuple("+o.join(",")+")";return(n=Q.call(this,e,"tuple",a,r,i)||this).coders=t,n}function re(e){e=e.trim();for(var t=[],r="",n=0,i=0;i<e.length;i++){var o=e[i];if(","===o&&0===n)t.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1==--n)throw new Error("unbalanced parenthsis")}return r&&t.push(r),t}var ne={address:H,bool:R,string:e,bytes:o};function ie(e,t){var r,n,i;if(i=ne[t.type])return new i(e,t.name);if(i=t.type.match(p))return(0===(o=parseInt(i[2]||"256"))||256<o||o%8!=0)&&s.throwError("invalid "+i[1]+" bit length",s.INVALID_ARGUMENT,{arg:"param",value:t}),new I(e,o/8,"int"===i[1],t.name);if(i=t.type.match(d))return(0===(o=parseInt(i[1]))||32<o)&&s.throwError("invalid bytes length",s.INVALID_ARGUMENT,{arg:"param",value:t}),new C(e,o,t.name);if(i=t.type.match(y)){var o=parseInt(i[2]||"-1");return(t=h.shallowCopy(t)).type=i[1],t=h.deepCopy(t),new Y(e,ie(e,t),o,t.name)}return"tuple"===t.type.substring(0,5)?(r=e,i=t.components,o=t.name,n=[],(i=i||[]).forEach((function(e){n.push(ie(r,e))})),new ee(r,n,o)):""===t.type?new T(e,t.name):(s.throwError("invalid type",s.INVALID_ARGUMENT,{arg:"type",value:t.type}),null)}function oe(e){s.checkNew(this,oe),e=e||r.defaultCoerceFunc,h.defineReadOnly(this,"coerceFunc",e)}oe.prototype.encode=function(e,t){e.length!==t.length&&s.throwError("types/values length mismatch",s.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var r=[];return e.forEach((function(e){var t;t="string"==typeof e?v(e):e,r.push(ie(this.coerceFunc,t))}),this),c.hexlify(new ee(this.coerceFunc,r,"_").encode(t))},oe.prototype.decode=function(e,t){var r=[];return e.forEach((function(e){var t;t="string"==typeof e?v(e):h.deepCopy(e),r.push(ie(this.coerceFunc,t))}),this),new ee(this.coerceFunc,r,"_").decode(c.arrayify(t),0).value},o=oe,r.AbiCoder=o,r.defaultAbiCoder=new o},{"../constants":3,"../errors":5,"./address":60,"./bignumber":63,"./bytes":64,"./properties":74,"./utf8":85}],60:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("bn.js")),o=e("./bytes"),a=e("./keccak256"),s=e("./rlp"),u=e("../errors");function f(e){"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e});for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=t[n].charCodeAt(0);r=o.arrayify(a.keccak256(r));for(var i=0;i<40;i+=2)8<=r[i>>1]>>4&&(t[i]=t[i].toUpperCase()),8<=(15&r[i>>1])&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}for(var c={},l=0;l<10;l++)c[String(l)]=String(l);for(l=0;l<26;l++)c[String.fromCharCode(65+l)]=String(10+l);var h,d=Math.floor((h=9007199254740991,Math.log10?Math.log10(h):Math.log(h)/Math.LN10));function p(e){e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00";var t="";for(e.split("").forEach((function(e){t+=c[e]}));t.length>=d;){var r=t.substring(0,d);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function y(e){var t=null;if("string"!=typeof e&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))t=f(e="0x"!==e.substring(0,2)?"0x"+e:e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==p(e)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:e}),t=new i.default.BN(e.substring(4),36).toString(16);t.length<40;)t="0"+t;t=f("0x"+t)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e});return t}r.getAddress=y,r.getIcapAddress=function(e){for(var t=new i.default.BN(y(e).substring(2),16).toString(36).toUpperCase();t.length<30;)t="0"+t;return"XE"+p("XE00"+t)+t},r.getContractAddress=function(e){if(!e.from)throw new Error("missing from address");var t=e.nonce;return y("0x"+a.keccak256(s.encode([y(e.from),o.stripZeros(o.hexlify(t))])).substring(26))},r.getCreate2Address=function(e){var t=e.initCodeHash;e.initCode&&(t?a.keccak256(e.initCode)!==t&&u.throwError("initCode/initCodeHash mismatch",u.INVALID_ARGUMENT,{arg:"options",value:e}):t=a.keccak256(e.initCode)),t||u.throwError("missing initCode or initCodeHash",u.INVALID_ARGUMENT,{arg:"options",value:e});var r=y(e.from),n=o.arrayify(e.salt);return 32!==n.length&&u.throwError("invalid salt",u.INVALID_ARGUMENT,{arg:"options",value:e}),y("0x"+a.keccak256(o.concat(["0xff",r,n,t])).substring(26))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./rlp":76,"bn.js":9}],61:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../utils/bytes");t.exports={decode:function(e){e=atob(e);for(var t=[],r=0;r<e.length;r++)t.push(e.charCodeAt(r));return n.arrayify(t)},encode:function(e){e=n.arrayify(e);for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}}},{"../utils/bytes":64}],62:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bytes"),i=e("./properties"),o=(a.prototype.encode=function(e){var t=n.arrayify(e);if(0===t.length)return"";for(var r=[0],i=0;i<t.length;++i){for(var o=t[i],a=0;a<r.length;++a)o+=r[a]<<8,r[a]=o%this.base,o=o/this.base|0;for(;0<o;)r.push(o%this.base),o=o/this.base|0}for(var s="",u=0;0===t[u]&&u<t.length-1;++u)s+=this._leader;for(var f=r.length-1;0<=f;--f)s+=this.alphabet[r[f]];return s},a.prototype.decode=function(e){if("string"!=typeof e)throw new TypeError("Expected String");var t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(var r=0;r<e.length;r++){var i=this._alphabetMap[e[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");for(var o=i,a=0;a<t.length;++a)o+=t[a]*this.base,t[a]=255&o,o>>=8;for(;0<o;)t.push(255&o),o>>=8}for(var s=0;e[s]===this._leader&&s<e.length-1;++s)t.push(0);return n.arrayify(new Uint8Array(t.reverse()))},a);function a(e){i.defineReadOnly(this,"alphabet",e),i.defineReadOnly(this,"base",e.length),i.defineReadOnly(this,"_alphabetMap",{}),i.defineReadOnly(this,"_leader",e.charAt(0));for(var t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}e=new(r.BaseX=o)("abcdefghijklmnopqrstuvwxyz234567"),r.Base32=e,o=new o("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),r.Base58=o},{"./bytes":64,"./properties":74}],63:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var o=n(e("bn.js")),a=e("./bytes"),s=e("./properties"),u=i(e("../errors")),f=new o.default.BN(-1);function c(e){return"-"===(e=e.toString(16))[0]?e.length%2==0?"-0x0"+e.substring(1):"-0x"+e.substring(1):e.length%2==1?"0x0"+e:"0x"+e}function l(e){return d(g(e))}function h(e){return new p(c(e))}function d(e){return"-"===(e=e._hex)[0]?new o.default.BN(e.substring(3),16).mul(f):new o.default.BN(e.substring(2),16)}var p=(y.prototype.fromTwos=function(e){return h(d(this).fromTwos(e))},y.prototype.toTwos=function(e){return h(d(this).toTwos(e))},y.prototype.abs=function(){return"-"===this._hex[0]?h(d(this).mul(f)):this},y.prototype.add=function(e){return h(d(this).add(l(e)))},y.prototype.sub=function(e){return h(d(this).sub(l(e)))},y.prototype.div=function(e){return g(e).isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),h(d(this).div(l(e)))},y.prototype.mul=function(e){return h(d(this).mul(l(e)))},y.prototype.mod=function(e){return h(d(this).mod(l(e)))},y.prototype.pow=function(e){return h(d(this).pow(l(e)))},y.prototype.maskn=function(e){return h(d(this).maskn(e))},y.prototype.eq=function(e){return d(this).eq(l(e))},y.prototype.lt=function(e){return d(this).lt(l(e))},y.prototype.lte=function(e){return d(this).lte(l(e))},y.prototype.gt=function(e){return d(this).gt(l(e))},y.prototype.gte=function(e){return d(this).gte(l(e))},y.prototype.isZero=function(){return d(this).isZero()},y.prototype.toNumber=function(){try{return d(this).toNumber()}catch(e){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}return null},y.prototype.toString=function(){return d(this).toString(10)},y.prototype.toHexString=function(){return this._hex},y.isBigNumber=function(e){return s.isType(e,"BigNumber")},y);function y(e){if(u.checkNew(this,y),s.setType(this,"BigNumber"),"string"==typeof e)a.isHexString(e)?s.defineReadOnly(this,"_hex",e="0x"==e?"0x0":e):"-"===e[0]&&a.isHexString(e.substring(1))?s.defineReadOnly(this,"_hex",e):e.match(/^-?[0-9]*$/)?s.defineReadOnly(this,"_hex",c(new o.default.BN(e=""==e?"0":e))):u.throwError("invalid BigNumber string value",u.INVALID_ARGUMENT,{arg:"value",value:e});else if("number"==typeof e){parseInt(String(e))!==e&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:e,outputValue:parseInt(String(e))});try{s.defineReadOnly(this,"_hex",c(new o.default.BN(e)))}catch(e){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}}else e instanceof y?s.defineReadOnly(this,"_hex",e._hex):e.toHexString?s.defineReadOnly(this,"_hex",c(l(e.toHexString()))):e._hex&&a.isHexString(e._hex)?s.defineReadOnly(this,"_hex",e._hex):a.isArrayish(e)?s.defineReadOnly(this,"_hex",c(new o.default.BN(a.hexlify(e).substring(2),16))):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:e})}function g(e){return p.isBigNumber(e)?e:new p(e)}r.BigNumber=p,r.bigNumberify=g},{"../errors":5,"./bytes":64,"./properties":74,"bn.js":9}],64:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors"));function o(e){return!!e.toHexString}function a(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function s(e){if(!e||parseInt(String(e.length))!=e.length||"string"==typeof e)return!1;for(var t=0;t<e.length;t++){var r=e[t];if(r<0||256<=r||parseInt(String(r))!=r)return!1}return!0}function u(e){if(null==e&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:e}),"string"!=typeof(e=o(e)?e.toHexString():e))return s(e)?a(new Uint8Array(e)):(i.throwError("invalid arrayify value",null,{arg:"value",value:e,type:typeof e}),null);var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==t[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:e}),(e=e.substring(2)).length%2&&(e="0"+e);for(var r=[],n=0;n<e.length;n+=2)r.push(parseInt(e.substr(n,2),16));return a(new Uint8Array(r))}function f(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=u(e[n]);t.push(i),r+=i.length}var o=new Uint8Array(r),s=0;for(n=0;n<t.length;n++)o.set(t[n],s),s+=t[n].length;return a(o)}function c(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}r.isHexable=o,r.isArrayish=s,r.arrayify=u,r.concat=f,r.stripZeros=function(e){var t=u(e);if(0===t.length)return t;for(var r=0;0===t[r];)r++;return r?t.slice(r):t},r.padZeros=function(e,t){if(t<(e=u(e)).length)throw new Error("cannot pad");var r=new Uint8Array(t);return r.set(e,t-e.length),a(r)},r.isHexString=c;var l="0123456789abcdef";function h(e){if(o(e))return e.toHexString();if("number"==typeof e){e<0&&i.throwError("cannot hexlify negative value",i.INVALID_ARGUMENT,{arg:"value",value:e}),9007199254740991<=e&&i.throwError("out-of-range",i.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var t="";e;)t=l[15&e]+t,e=Math.floor(e/16);return t.length?"0x"+(t=t.length%2?"0"+t:t):"0x00"}if("string"==typeof e){var r=e.match(/^(0x)?[0-9a-fA-F]*$/);return r||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==r[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2?"0x0"+e.substring(2):e}if(s(e)){for(var n=[],a=0;a<e.length;a++){var u=e[a];n.push(l[(240&u)>>4]+l[15&u])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:e}),"never"}function d(e,t){for(c(e)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:e});e.length<2*t+2;)e="0x0"+e.substring(2);return e}function p(e){var t=0,r="0x",n="0x";if((o=e)&&null!=o.r&&null!=o.s){null==e.v&&null==e.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:e}),r=d(e.r,32),n=d(e.s,32),"string"==typeof(t=e.v)&&(t=parseInt(t,16));var o=e.recoveryParam;t=27+(o=null==o&&null!=e.v?1-t%2:o)}else{if(65!==(e=u(e)).length)throw new Error("invalid signature");r=h(e.slice(0,32)),n=h(e.slice(32,64)),27!==(t=e[64])&&28!==t&&(t=27+t%2)}return{r,s:n,recoveryParam:t-27,v:t}}r.hexlify=h,r.hexDataLength=function(e){return c(e)&&e.length%2==0?(e.length-2)/2:null},r.hexDataSlice=function(e,t,r){return c(e)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:e}),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)},r.hexStripZeros=function(e){for(c(e)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:e});3<e.length&&"0x0"===e.substring(0,3);)e="0x"+e.substring(3);return e},r.hexZeroPad=d,r.splitSignature=p,r.joinSignature=function(e){return h(f([(e=p(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},{"../errors":5}],65:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors")),o=e("./bytes"),a=e("./utf8"),s=e("./keccak256"),u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),f=new RegExp("^((.*)\\.)?([^.]+)$"),c=new RegExp("^[a-z0-9.-]*$");r.namehash=function(e){"string"!=typeof e&&i.throwError("invalid address - "+String(e),i.INVALID_ARGUMENT,{argument:"name",value:e}),(e=e.toLowerCase()).match(c)||i.throwError("contains invalid UseSTD3ASCIIRules characters",i.INVALID_ARGUMENT,{argument:"name",value:e});for(var t=u;e.length;){var r=e.match(f),n=a.toUtf8Bytes(r[3]);t=s.keccak256(o.concat([t,s.keccak256(n)])),e=r[2]||""}return o.hexlify(t)},r.id=function(e){return s.keccak256(a.toUtf8Bytes(e))},r.hashMessage=function(e){return s.keccak256(o.concat([a.toUtf8Bytes("Ethereum Signed Message:\n"),a.toUtf8Bytes(String(e.length)),"string"==typeof e?a.toUtf8Bytes(e):e]))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./utf8":85}],66:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors")),o=e("../wordlists/lang-en"),a=e("./basex"),s=e("./bytes"),u=e("./bignumber"),f=e("./utf8"),c=e("./pbkdf2"),l=e("./hmac"),h=e("./properties"),d=e("./secp256k1"),p=e("./sha2"),y=u.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),g=f.toUtf8Bytes("Bitcoin seed"),b=2147483648;function m(e){return(1<<e)-1<<8-e}function v(e){return s.hexZeroPad(s.hexlify(e),32)}function w(e){var t=s.hexDataSlice(p.sha256(p.sha256(e)),0,4);return a.Base58.encode(s.concat([e,t]))}var _={};r.defaultPath="m/44'/60'/0'/0/0";var E=(Object.defineProperty(S.prototype,"extendedKey",{get:function(){if(256<=this.depth)throw new Error("Depth too large!");return w(s.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",s.hexlify(this.depth),this.parentFingerprint,s.hexZeroPad(s.hexlify(this.index),4),this.chainCode,null!=this.privateKey?s.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),S.prototype.neuter=function(){return new S(_,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},S.prototype._derive=function(e){if(4294967295<e)throw new Error("invalid index - "+String(e));var t=this.path;t&&(t+="/"+(e&~b));var r=new Uint8Array(37);if(e&b){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(s.arrayify(this.privateKey),1),t&&(t+="'")}else r.set(s.arrayify(this.publicKey));for(var n=24;0<=n;n-=8)r[33+(n>>3)]=e>>24-n&255;var i=(f=l.computeHmac(l.SupportedAlgorithms.sha512,this.chainCode,r)).slice(0,32),o=f.slice(32),a=null,f=null;return this.privateKey?a=v(u.bigNumberify(i).add(this.privateKey).mod(y)):f=new d.KeyPair(s.hexlify(i))._addPoint(this.publicKey),new S(_,a,f,this.fingerprint,v(o),e,this.depth+1,this.mnemonic,t)},S.prototype.derivePath=function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var r=this,n=0;n<t.length;n++){var i=t[n];if(i.match(/^[0-9]+'$/)){var o=parseInt(i.substring(0,i.length-1));if(b<=o)throw new Error("invalid path index - "+i);r=r._derive(b+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);if(o=parseInt(i),b<=o)throw new Error("invalid path index - "+i);r=r._derive(o)}}return r},S.isHDNode=function(e){return h.isType(e,"HDNode")},S);function S(e,t,r,n,o,a,u,f,c){if(i.checkNew(this,S),e!==_)throw new Error("HDNode constructor cannot be called directly");t?(t=new d.KeyPair(t),h.defineReadOnly(this,"privateKey",t.privateKey),h.defineReadOnly(this,"publicKey",t.compressedPublicKey)):(h.defineReadOnly(this,"privateKey",null),h.defineReadOnly(this,"publicKey",s.hexlify(r))),h.defineReadOnly(this,"parentFingerprint",n),h.defineReadOnly(this,"fingerprint",s.hexDataSlice(p.ripemd160(p.sha256(this.publicKey)),0,4)),h.defineReadOnly(this,"address",d.computeAddress(this.publicKey)),h.defineReadOnly(this,"chainCode",o),h.defineReadOnly(this,"index",a),h.defineReadOnly(this,"depth",u),h.defineReadOnly(this,"mnemonic",f),h.defineReadOnly(this,"path",c),h.setType(this,"HDNode")}function k(e,t){if((e=s.arrayify(e)).length<16||64<e.length)throw new Error("invalid seed");return e=s.arrayify(l.computeHmac(l.SupportedAlgorithms.sha512,g,e)),new E(_,v(e.slice(0,32)),null,"0x00000000",v(e.slice(32)),0,0,t,"m")}function A(e,t){return t=f.toUtf8Bytes("mnemonic"+(t=t||""),f.UnicodeNormalizationForm.NFKD),s.hexlify(c.pbkdf2(f.toUtf8Bytes(e,f.UnicodeNormalizationForm.NFKD),t,2048,64,"sha512"))}function T(e,t){t=t||o.langEn,i.checkNormalize();var r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");for(var n=s.arrayify(new Uint8Array(Math.ceil(11*r.length/8))),a=0,u=0;u<r.length;u++){var f=t.getWordIndex(r[u].normalize("NFKD"));if(-1===f)throw new Error("invalid mnemonic");for(var c=0;c<11;c++)f&1<<10-c&&(n[a>>3]|=1<<7-a%8),a++}var l=32*r.length/3,h=m(r.length/3);if(e=s.arrayify(p.sha256(n.slice(0,l/8)))[0],(e&=h)!=(n[n.length-1]&h))throw new Error("invalid checksum");return s.hexlify(n.slice(0,l/8))}function P(e,t){if((e=s.arrayify(e)).length%4!=0||e.length<16||32<e.length)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i<e.length;i++)8<n?(r[r.length-1]<<=8,r[r.length-1]|=e[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[i]>>8-n,r.push(e[i]&(1<<8-n)-1),n+=3);var a=s.arrayify(p.sha256(e))[0],u=e.length/4;return a&=m(u),r[r.length-1]<<=u,r[r.length-1]|=a>>8-u,(t=t||o.langEn).join(r.map((function(e){return t.getWord(e)})))}r.HDNode=E,r.fromExtendedKey=function(e){var t=a.Base58.decode(e);82===t.length&&w(t.slice(0,78))===e||i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var r=t[4],n=s.hexlify(t.slice(5,9)),o=parseInt(s.hexlify(t.slice(9,13)).substring(2),16),u=s.hexlify(t.slice(13,45)),f=t.slice(45,78);switch(s.hexlify(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new E(_,null,s.hexlify(f),n,u,o,r,null,null);case"0x0488ade4":case"0x04358394":if(0!==f[0])break;return new E(_,s.hexlify(f.slice(1)),null,n,u,o,r,null,null)}return i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},r.fromMnemonic=function(e,t,r){return k(A(e=P(T(e,t),t),r),e)},r.fromSeed=function(e){return k(e,null)},r.mnemonicToSeed=A,r.mnemonicToEntropy=T,r.entropyToMnemonic=P,r.isValidMnemonic=function(e,t){try{return T(e,t),!0}catch(e){}return!1}},{"../errors":5,"../wordlists/lang-en":90,"./basex":62,"./bignumber":63,"./bytes":64,"./hmac":67,"./pbkdf2":73,"./properties":74,"./secp256k1":77,"./sha2":79,"./utf8":85}],67:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i,o=n(e("hash.js")),a=e("../utils/bytes"),s=n(e("../errors"));(e=i=r.SupportedAlgorithms||(r.SupportedAlgorithms={})).sha256="sha256",e.sha512="sha512",r.computeHmac=function(e,t,r){return i[e]||s.throwError("unsupported algorithm "+e,s.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),a.arrayify(o.hmac(o[e],a.arrayify(t)).update(a.arrayify(r)).digest())}},{"../errors":5,"../utils/bytes":64,"hash.js":26}],68:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./abi-coder");r.AbiCoder=i.AbiCoder,r.defaultAbiCoder=i.defaultAbiCoder,r.formatSignature=i.formatSignature,r.formatParamType=i.formatParamType,r.parseSignature=i.parseSignature,r.parseParamType=i.parseParamType,i=e("./address"),r.getAddress=i.getAddress,r.getContractAddress=i.getContractAddress,r.getCreate2Address=i.getCreate2Address,r.getIcapAddress=i.getIcapAddress,i=n(e("./base64")),r.base64=i,i=e("./bignumber"),r.BigNumber=i.BigNumber,r.bigNumberify=i.bigNumberify,i=e("./bytes"),r.arrayify=i.arrayify,r.concat=i.concat,r.hexDataSlice=i.hexDataSlice,r.hexDataLength=i.hexDataLength,r.hexlify=i.hexlify,r.hexStripZeros=i.hexStripZeros,r.hexZeroPad=i.hexZeroPad,r.isHexString=i.isHexString,r.joinSignature=i.joinSignature,r.padZeros=i.padZeros,r.splitSignature=i.splitSignature,r.stripZeros=i.stripZeros,i=e("./hash"),r.hashMessage=i.hashMessage,r.id=i.id,r.namehash=i.namehash,i=n(e("./hdnode")),r.HDNode=i,i=e("./interface"),r.Interface=i.Interface,i=e("./json-wallet"),r.getJsonWalletAddress=i.getJsonWalletAddress,i=e("./keccak256"),r.keccak256=i.keccak256,i=e("./sha2"),r.sha256=i.sha256,i=e("./solidity"),r.solidityKeccak256=i.keccak256,r.solidityPack=i.pack,r.soliditySha256=i.sha256,i=e("./random-bytes"),r.randomBytes=i.randomBytes,i=e("./networks"),r.getNetwork=i.getNetwork,i=e("./properties"),r.checkProperties=i.checkProperties,r.deepCopy=i.deepCopy,r.defineReadOnly=i.defineReadOnly,r.resolveProperties=i.resolveProperties,r.shallowCopy=i.shallowCopy,n=n(e("./rlp")),r.RLP=n,n=e("./secp256k1"),r.computeAddress=n.computeAddress,r.computePublicKey=n.computePublicKey,r.recoverAddress=n.recoverAddress,r.recoverPublicKey=n.recoverPublicKey,r.verifyMessage=n.verifyMessage,n=e("./signing-key"),r.SigningKey=n.SigningKey,n=e("./transaction"),r.populateTransaction=n.populateTransaction,n=e("./transaction"),r.parseTransaction=n.parse,r.serializeTransaction=n.serialize,n=e("./utf8"),r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String,r.toUtf8Bytes=n.toUtf8Bytes,r.toUtf8String=n.toUtf8String,n=e("./units"),r.commify=n.commify,r.formatEther=n.formatEther,r.parseEther=n.parseEther,r.formatUnits=n.formatUnits,r.parseUnits=n.parseUnits,n=e("./web"),r.fetchJson=n.fetchJson,r.poll=n.poll,n=e("./hmac"),r.SupportedAlgorithms=n.SupportedAlgorithms,n=e("./utf8"),r.UnicodeNormalizationForm=n.UnicodeNormalizationForm,e=e("./wordlist"),r.Wordlist=e.Wordlist},{"./abi-coder":59,"./address":60,"./base64":61,"./bignumber":63,"./bytes":64,"./hash":65,"./hdnode":66,"./hmac":67,"./interface":69,"./json-wallet":70,"./keccak256":71,"./networks":72,"./properties":74,"./random-bytes":75,"./rlp":76,"./secp256k1":77,"./sha2":79,"./signing-key":81,"./solidity":82,"./transaction":83,"./units":84,"./utf8":85,"./web":86,"./wordlist":87}],69:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./address"),u=e("./abi-coder"),f=e("./bignumber"),c=e("./bytes"),l=e("./hash"),h=e("./keccak256"),d=e("./properties"),p=o(e("../errors")),y=function(e){d.setType(this,"Indexed"),d.defineReadOnly(this,"hash",e)},g=(e=function(e){for(var t in d.setType(this,"Description"),e)d.defineReadOnly(this,t,d.deepCopy(e[t],!0));Object.freeze(this)},i(b,a=e),b.prototype.encode=function(e,t){c.isHexString(e)||p.throwError("invalid contract bytecode",p.INVALID_ARGUMENT,{arg:"bytecode",value:e}),p.checkArgumentCount(t.length,this.inputs.length," in Interface constructor");try{return e+u.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(e){p.throwError("invalid constructor argument",p.INVALID_ARGUMENT,{arg:e.arg,reason:e.reason,value:e.value})}return null},b);function b(){return null!==a&&a.apply(this,arguments)||this}var m,v=(i(w,m=e),w.prototype.encode=function(e){p.checkArgumentCount(e.length,this.inputs.length," in interface function "+this.name);try{return this.sighash+u.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(e){p.throwError("invalid input argument",p.INVALID_ARGUMENT,{arg:e.arg,reason:e.reason,value:e.value})}return null},w.prototype.decode=function(e){try{return u.defaultAbiCoder.decode(this.outputs,c.arrayify(e))}catch(t){p.throwError("invalid data for function output",p.INVALID_ARGUMENT,{arg:"data",errorArg:t.arg,errorValue:t.value,value:e,reason:t.reason})}},w);function w(){return null!==m&&m.apply(this,arguments)||this}var _,E=(i(S,_=e),S);function S(){return null!==_&&_.apply(this,arguments)||this}var k,A=(i(T,k=e),T.prototype.encodeTopics=function(e){var t=this;e.length>this.inputs.length&&p.throwError("too many arguments for "+this.name,p.UNEXPECTED_ARGUMENT,{maxCount:e.length,expectedCount:this.inputs.length});var r=[];for(this.anonymous||r.push(this.topic),e.forEach((function(e,n){var i=t.inputs[n];i.indexed?null==e?r.push(null):"string"===i.type?r.push(l.id(e)):"bytes"===i.type?r.push(h.keccak256(e)):-1!==i.type.indexOf("[")||"tuple"===i.type.substring(0,5)?p.throwError("filtering with tuples or arrays not implemented yet; bug us on GitHub",p.NOT_IMPLEMENTED,{operation:"filter(array|tuple)"}):("address"===i.type&&s.getAddress(e),r.push(c.hexZeroPad(c.hexlify(e),32).toLowerCase())):null!=e&&p.throwError("cannot filter non-indexed parameters; must be null",p.INVALID_ARGUMENT,{argument:i.name||n,value:e})}));r.length&&null===r[r.length-1];)r.pop();return r},T.prototype.decode=function(e,t){null==t||this.anonymous||(t=t.slice(1));var r,n=[],i=[],o=[];this.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||0<=e.type.indexOf("[")||"tuple"===e.type.substring(0,5)?(n.push({type:"bytes32",name:e.name||""}),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))})),null!=t&&(r=u.defaultAbiCoder.decode(n,c.concat(t)));var a=u.defaultAbiCoder.decode(i,c.arrayify(e)),s={},f=0,l=0;return this.inputs.forEach((function(e,n){e.indexed?null==t?s[n]=new y(null):o[n]?s[n]=new y(r[l++]):s[n]=r[l++]:s[n]=a[f++],e.name&&(s[e.name]=s[n])})),s.length=this.inputs.length,new E(s)},T);function T(){return null!==k&&k.apply(this,arguments)||this}var P,O=(i(I,P=e),I);function I(){return null!==P&&P.apply(this,arguments)||this}var x,N=(i(M,x=e),M);function M(){return null!==x&&x.apply(this,arguments)||this}function R(e){switch(e.type){case"constructor":var t=new g({inputs:e.inputs,payable:null==e.payable||!!e.payable});this.deployFunction||(this.deployFunction=t);break;case"function":var r=u.formatSignature(e).replace(/tuple/g,""),n=l.id(r).substring(0,10),i=!1;null!=e.constant?i=e.constant:null!=e.stateMutability&&(i="view"==e.stateMutability||"pure"==e.stateMutability),t=new v({inputs:e.inputs,outputs:e.outputs,gas:e.gas,payable:null==e.payable||!!e.payable,type:i?"call":"transaction",name:e.name,signature:r,sighash:n}),e.name&&(null==this.functions[e.name]?d.defineReadOnly(this.functions,e.name,t):p.warn("WARNING: Multiple definitions for "+e.name)),null==this.functions[t.signature]&&d.defineReadOnly(this.functions,t.signature,t);break;case"event":r=u.formatSignature(e).replace(/tuple/g,""),t=new A({name:e.name,signature:r,inputs:e.inputs,topic:l.id(r),anonymous:!!e.anonymous}),e.name&&null==this.events[e.name]&&d.defineReadOnly(this.events,e.name,t),null==this.events[t.signature]&&d.defineReadOnly(this.events,t.signature,t);break;case"receive":case"fallback":break;default:p.warn("WARNING: unsupported ABI type - "+e.type)}}function B(e){if(p.checkNew(this,B),"string"==typeof e){try{e=JSON.parse(e)}catch(t){p.throwError("could not parse ABI JSON",p.INVALID_ARGUMENT,{arg:"abi",errorMessage:t.message,value:e})}if(!Array.isArray(e))return p.throwError("invalid abi",p.INVALID_ARGUMENT,{arg:"abi",value:e}),null}d.defineReadOnly(this,"functions",{}),d.defineReadOnly(this,"events",{});var t=[];e.forEach((function(e){"string"==typeof e&&(e=u.parseSignature(e)),t.push(e)})),d.defineReadOnly(this,"abi",d.deepCopy(t,!0)),t.forEach(R,this),this.deployFunction||R.call(this,{type:"constructor",inputs:[]}),d.setType(this,"Interface")}B.prototype.parseTransaction=function(e){var t,r=e.data.substring(0,10).toLowerCase();for(t in this.functions)if(-1!==t.indexOf("(")){var n=this.functions[t];if(n.sighash===r){var i=u.defaultAbiCoder.decode(n.inputs,"0x"+e.data.substring(10));return new O({args:i,decode:n.decode,name:n.name,signature:n.signature,sighash:n.sighash,value:f.bigNumberify(e.value||"0")})}}return null},B.prototype.parseLog=function(e){for(var t in this.events)if(-1!==t.indexOf("(")&&!(t=this.events[t]).anonymous&&t.topic===e.topics[0])return new N({decode:t.decode,name:t.name,signature:t.signature,topic:t.topic,values:t.decode(e.data,e.topics)});return null},B.isInterface=function(e){return d.isType(e,"Interface")},B.isIndexed=function(e){return d.isType(e,"Indexed")},e=B,r.Interface=e},{"../errors":5,"./abi-coder":59,"./address":60,"./bignumber":63,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74}],70:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./address");function i(e){try{var t=JSON.parse(e)}catch(e){return!1}return t.encseed&&t.ethaddr}function o(e){try{var t=JSON.parse(e)}catch(e){return!1}return!(!t.version||parseInt(t.version)!==t.version||3!==parseInt(t.version))}r.isCrowdsaleWallet=i,r.isSecretStorageWallet=o,r.getJsonWalletAddress=function(e){if(i(e))try{return n.getAddress(JSON.parse(e).ethaddr)}catch(e){return null}if(o(e))try{return n.getAddress(JSON.parse(e).address)}catch(e){return null}return null}},{"./address":60}],71:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("js-sha3"),i=e("./bytes");r.keccak256=function(e){return"0x"+n.keccak_256(i.arrayify(e))}},{"./bytes":64,"js-sha3":40}],72:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors"));function o(e){return function(t){var r=[];return t.InfuraProvider&&r.push(new t.InfuraProvider(e)),t.EtherscanProvider&&r.push(new t.EtherscanProvider(e)),0===r.length?null:t.FallbackProvider?new t.FallbackProvider(r):r[0]}}function a(e,t){return function(r){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null}}var s={unspecified:{chainId:0,name:"unspecified"},homestead:n={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},mainnet:n,morden:{chainId:2,name:"morden"},ropsten:e={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},testnet:e,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:a("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:a("https://web3.gastracker.io/morden","classicTestnet")}};r.getNetwork=function(e){if(null==e)return null;if("number"==typeof e){for(var t in s)if((t=s[t]).chainId===e)return{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress||null,_defaultProvider:t._defaultProvider||null};return{chainId:e,name:"unknown"}}if("string"!=typeof e)return(r=s[e.name])?(0!==e.chainId&&e.chainId!==r.chainId&&i.throwError("network chainId mismatch",i.INVALID_ARGUMENT,{arg:"network",value:e}),{name:e.name,chainId:r.chainId,ensAddress:e.ensAddress||r.ensAddress||null,_defaultProvider:e._defaultProvider||r._defaultProvider||null}):("number"!=typeof e.chainId&&i.throwError("invalid network chainId",i.INVALID_ARGUMENT,{arg:"network",value:e}),e);var r=s[e];return null==r?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}},{"../errors":5}],73:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../utils/bytes"),i=e("./hmac");r.pbkdf2=function(e,t,r,o,a){var s;e=n.arrayify(e),t=n.arrayify(t);var u,f,c=1,l=new Uint8Array(o),h=new Uint8Array(t.length+4);h.set(t);for(var d=1;d<=c;d++){h[t.length]=d>>24&255,h[t.length+1]=d>>16&255,h[t.length+2]=d>>8&255,h[t.length+3]=255&d;var p=i.computeHmac(a,e,h);s||(s=p.length,f=new Uint8Array(s),u=o-((c=Math.ceil(o/s))-1)*s),f.set(p);for(var y=1;y<r;y++){p=i.computeHmac(a,e,p);for(var g=0;g<s;g++)f[g]^=p[g]}var b=(d-1)*s,m=d===c?u:s;l.set(n.arrayify(f).slice(0,m),b)}return n.arrayify(l)}},{"../utils/bytes":64,"./hmac":67}],74:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors"));function o(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function a(e,t){return e&&e._ethersType===t}r.defineReadOnly=o,r.setType=function(e,t){Object.defineProperty(e,"_ethersType",{configurable:!1,value:t,writable:!1})},r.isType=a,r.resolveProperties=function(e){var t={},r=[];return Object.keys(e).forEach((function(n){var i=e[n];i instanceof Promise?r.push(i.then((function(e){return t[n]=e,null}))):t[n]=i})),Promise.all(r).then((function(){return t}))},r.checkProperties=function(e,t){e&&"object"==typeof e||i.throwError("invalid object",i.INVALID_ARGUMENT,{argument:"object",value:e}),Object.keys(e).forEach((function(r){t[r]||i.throwError("invalid object key - "+r,i.INVALID_ARGUMENT,{argument:"transaction",value:e,key:r})}))},r.shallowCopy=function(e){var t,r={};for(t in e)r[t]=e[t];return r};var s={boolean:!0,number:!0,string:!0};r.deepCopy=function e(t,r){if(null==t||s[typeof t])return t;if(Array.isArray(t)){var n=t.map((function(t){return e(t,r)}));return r&&Object.freeze(n),n}if("object"==typeof t){if(a(t,"BigNumber"))return t;if(a(t,"Description"))return t;if(a(t,"Indexed"))return t;var i;for(i in n={},t){var u=t[i];void 0!==u&&o(n,i,e(u,r))}return r&&Object.freeze(n),n}if("function"==typeof t)return t;throw new Error("Cannot deepCopy "+typeof t)},r.inheritable=function e(t){return function(r){var n,i;i=t,(n=r).super_=i,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(r,"inherits",e(r))}}},{"../errors":5}],75:[function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0});var r=e("../utils/bytes"),i=e("../utils/properties"),o=t.crypto||t.msCrypto;function a(e){if(e<=0||1024<e||parseInt(String(e))!=e)throw new Error("invalid length");return e=new Uint8Array(e),o.getRandomValues(e),r.arrayify(e)}o&&o.getRandomValues||(console.log("WARNING: Missing strong random number source; using weak randomBytes"),o={getRandomValues:function(e){for(var t=0;t<20;t++)for(var r=0;r<e.length;r++)t?e[r]^=Math.trunc(256*Math.random()):e[r]=Math.trunc(256*Math.random());return e},_weakCrypto:!0}),n.randomBytes=a,!0===o._weakCrypto&&i.defineReadOnly(a,"_weakCrypto",!0)}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/bytes":64,"../utils/properties":74}],76:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bytes");function i(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function o(e,t,r){for(var n=0,i=0;i<r;i++)n=256*n+e[t+i];return n}function a(e,t,r,n){for(var i=[];r<t+1+n;){var o=s(e,r);if(i.push(o.result),t+1+n<(r+=o.consumed))throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function s(e,t){if(0===e.length)throw new Error("invalid rlp data");if(248<=e[t]){if(t+1+(r=e[t]-247)>e.length)throw new Error("too short");if(t+1+r+(i=o(e,t+1,r))>e.length)throw new Error("to short");return a(e,t,t+1+r,r+i)}if(192<=e[t]){if(t+1+(i=e[t]-192)>e.length)throw new Error("invalid rlp data");return a(e,t,t+1,i)}if(184<=e[t]){var r;if(t+1+(r=e[t]-183)>e.length)throw new Error("invalid rlp data");if(t+1+r+(i=o(e,t+1,r))>e.length)throw new Error("invalid rlp data");return{consumed:1+r+i,result:n.hexlify(e.slice(t+1+r,t+1+r+i))}}if(128<=e[t]){var i;if(t+1+(i=e[t]-128)>e.length)throw new Error("invalid rlp data");return{consumed:1+i,result:n.hexlify(e.slice(t+1,t+1+i))}}return{consumed:1,result:n.hexlify(e[t])}}r.encode=function(e){return n.hexlify(function e(t){if(Array.isArray(t)){var r=[];return t.forEach((function(t){r=r.concat(e(t))})),r.length<=55?(r.unshift(192+r.length),r):((o=i(r.length)).unshift(247+o.length),o.concat(r))}var o;return 1===(t=Array.prototype.slice.call(n.arrayify(t))).length&&t[0]<=127?t:t.length<=55?(t.unshift(128+t.length),t):((o=i(t.length)).unshift(183+o.length),o.concat(t))}(e))},r.decode=function(e){var t=n.arrayify(e);if((e=s(t,0)).consumed!==t.length)throw new Error("invalid rlp data");return e.result}},{"./bytes":64}],77:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("elliptic"),o=e("./address"),a=e("./bytes"),s=e("./hash"),u=e("./keccak256"),f=e("./properties"),c=n(e("../errors")),l=null;function h(){return l=l||new i.ec("secp256k1")}var d=(p.prototype.sign=function(e){return{recoveryParam:(e=h().keyFromPrivate(a.arrayify(this.privateKey)).sign(a.arrayify(e),{canonical:!0})).recoveryParam,r:a.hexZeroPad("0x"+e.r.toString(16),32),s:a.hexZeroPad("0x"+e.s.toString(16),32),v:27+e.recoveryParam}},p.prototype.computeSharedSecret=function(e){var t=h().keyFromPrivate(a.arrayify(this.privateKey));return e=h().keyFromPublic(a.arrayify(y(e))),a.hexZeroPad("0x"+t.derive(e.getPublic()).toString(16),32)},p.prototype._addPoint=function(e){var t=h().keyFromPublic(a.arrayify(this.publicKey));return e=h().keyFromPublic(a.arrayify(e)),"0x"+t.pub.add(e.pub).encodeCompressed("hex")},p);function p(e){e=h().keyFromPrivate(a.arrayify(e)),f.defineReadOnly(this,"privateKey",a.hexlify(e.priv.toArray("be",32))),f.defineReadOnly(this,"publicKey","0x"+e.getPublic(!1,"hex")),f.defineReadOnly(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),f.defineReadOnly(this,"publicKeyBytes",e.getPublic().encode(null,!0))}function y(e,t){return 32!==(e=a.arrayify(e)).length?33===e.length?t?a.hexlify(e):"0x"+h().keyFromPublic(e).getPublic(!1,"hex"):65===e.length?t?"0x"+h().keyFromPublic(e).getPublic(!0,"hex"):a.hexlify(e):(c.throwError("invalid public or private key",c.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null):(e=new d(e),t?e.compressedPublicKey:e.publicKey)}function g(e){return e="0x"+y(e).slice(4),o.getAddress("0x"+u.keccak256(e).substring(26))}function b(e,t){var r=a.splitSignature(t);return t={r:a.arrayify(r.r),s:a.arrayify(r.s)},"0x"+h().recoverPubKey(a.arrayify(e),t,r.recoveryParam).encode("hex",!1)}function m(e,t){return g(b(a.arrayify(e),t))}r.KeyPair=d,r.computePublicKey=y,r.computeAddress=g,r.recoverPublicKey=b,r.recoverAddress=m,r.verifyMessage=function(e,t){return m(s.hashMessage(e),t)}},{"../errors":5,"./address":60,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74,elliptic:12}],78:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var o=n(e("aes-js")),a=n(e("scrypt-js")),s=n(e("uuid")),u=e("./signing-key"),f=i(e("./hdnode")),c=e("./address"),l=e("./bytes"),h=e("./pbkdf2"),d=e("./keccak256"),p=e("./utf8"),y=e("./random-bytes");function g(e){return"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),l.arrayify(e)}function b(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function m(e){return"string"==typeof e?p.toUtf8Bytes(e,p.UnicodeNormalizationForm.NFKC):l.arrayify(e)}function v(e,t){for(var r=e,n=t.toLowerCase().split("/"),i=0;i<n.length;i++){var o,a=null;for(o in r)if(o.toLowerCase()===n[i]){a=r[o];break}if(null===a)return null;r=a}return r}r.decryptCrowdsale=function(e,t){var r=JSON.parse(e);t=m(t);var n=c.getAddress(v(r,"ethaddr"));if(!(e=g(v(r,"encseed")))||e.length%16!=0)throw new Error("invalid encseed");r=h.pbkdf2(t,t,2e3,32,"sha256").slice(0,16),t=e.slice(0,16),e=e.slice(16),t=new o.default.ModeOfOperation.cbc(r,t);for(var i=l.arrayify(t.decrypt(e)),a=(i=o.default.padding.pkcs7.strip(i),""),s=0;s<i.length;s++)a+=String.fromCharCode(i[s]);if(e=p.toUtf8Bytes(a),(e=new u.SigningKey(d.keccak256(e))).address!==n)throw new Error("corrupt crowdsale wallet");return e},r.decrypt=function(e,t,r){function n(e,t){var r=g(v(i,"crypto/ciphertext"));if(l.hexlify((s=e.slice(16,32),d.keccak256(l.concat([s,r])))).substring(2)!==v(i,"crypto/mac").toLowerCase())return t(new Error("invalid password")),null;var n=function(e,t){if("aes-128-ctr"!==v(i,"crypto/cipher"))return null;var r=g(v(i,"crypto/cipherparams/iv"));return r=new o.default.Counter(r),r=new o.default.ModeOfOperation.ctr(e,r),l.arrayify(r.decrypt(t))}(e.slice(0,16),r),a=e.slice(32,64);if(!n)return t(new Error("unsupported cipher")),null;var s=new u.SigningKey(n);if(i.address&&s.address!==c.getAddress(i.address))return t(new Error("address mismatch")),null;if(r=v(i,"x-ethers/locale"),"0.1"===v(i,"x-ethers/version")&&(null==r||"en"===r)){if(e=g(v(i,"x-ethers/mnemonicCiphertext")),r=g(v(i,"x-ethers/mnemonicCounter")),r=new o.default.Counter(r),a=new o.default.ModeOfOperation.ctr(a,r),r=v(i,"x-ethers/path")||f.defaultPath,e=l.arrayify(a.decrypt(e)),e=f.entropyToMnemonic(e),(r=f.fromMnemonic(e).derivePath(r)).privateKey!=l.hexlify(n))return t(new Error("mnemonic mismatch")),null;s=new u.SigningKey(r)}return s}var i=JSON.parse(e),s=m(t);return new Promise((function(e,t){if((p=v(i,"crypto/kdf"))&&"string"==typeof p)if("scrypt"===p.toLowerCase()){var o=g(v(i,"crypto/kdfparams/salt")),u=parseInt(v(i,"crypto/kdfparams/n")),f=parseInt(v(i,"crypto/kdfparams/r")),c=parseInt(v(i,"crypto/kdfparams/p"));u&&f&&c?u&u-1?t(new Error("unsupported key-derivation function parameter value for N")):32===(d=parseInt(v(i,"crypto/kdfparams/dklen")))?(r&&r(0),a.default(s,o,u,f,c,64,(function(i,o,a){if(i)i.progress=o,t(i);else if(a)(a=n(a=l.arrayify(a),t))&&(r&&r(1),e(a));else if(r)return r(o)}))):t(new Error("unsupported key-derivation derived-key length")):t(new Error("unsupported key-derivation function parameters"))}else if("pbkdf2"===p.toLowerCase()){if(o=g(v(i,"crypto/kdfparams/salt")),c=null,"hmac-sha256"===(p=v(i,"crypto/kdfparams/prf")))c="sha256";else{if("hmac-sha512"!==p)return void t(new Error("unsupported prf"));c="sha512"}var d,p=parseInt(v(i,"crypto/kdfparams/c"));32===(d=parseInt(v(i,"crypto/kdfparams/dklen")))?(c=n(c=h.pbkdf2(s,o,p,d,c),t))&&e(c):t(new Error("unsupported key-derivation derived-key length"))}else t(new Error("unsupported key-derivation function"));else t(new Error("unsupported key-derivation function"))}))},r.encrypt=function(e,t,r,n){"function"!=typeof r||n||(n=r,r={}),r=r||{};var i;if(32!==(i=u.SigningKey.isSigningKey(e)?l.arrayify(e.privateKey):l.arrayify(e)).length)throw new Error("invalid private key");var c=m(t),h=null;if(r.entropy&&(h=l.arrayify(r.entropy)),r.mnemonic)if(h){if(f.entropyToMnemonic(h)!==r.mnemonic)throw new Error("entropy and mnemonic mismatch")}else h=l.arrayify(f.mnemonicToEntropy(r.mnemonic,r.wordlist));var p=r.path;h&&!p&&(p=f.defaultPath);var g,v=(v=r.client)||"ethers.js",w=(g=r.salt?l.arrayify(r.salt):y.randomBytes(32),null);if(r.iv){if(16!==(w=l.arrayify(r.iv)).length)throw new Error("invalid iv")}else w=y.randomBytes(16);var _=null;if(r.uuid){if(16!==(_=l.arrayify(r.uuid)).length)throw new Error("invalid uuid")}else _=y.randomBytes(16);var E=1<<17,S=8,k=1;return r.scrypt&&(r.scrypt.N&&(E=r.scrypt.N),r.scrypt.r&&(S=r.scrypt.r),r.scrypt.p&&(k=r.scrypt.p)),new Promise((function(e,t){n&&n(0),a.default(c,g,E,S,k,64,(function(a,f,c){if(a)a.progress=f,t(a);else if(c){var m=(c=l.arrayify(c)).slice(0,16),A=c.slice(16,32),T=c.slice(32,64);a=new u.SigningKey(i).address,c=new o.default.Counter(w),c=new o.default.ModeOfOperation.ctr(m,c),c=l.arrayify(c.encrypt(i)),A=d.keccak256(l.concat([A,c])),a={address:a.substring(2).toLowerCase(),id:s.default.v4({random:_}),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:l.hexlify(w).substring(2)},ciphertext:l.hexlify(c).substring(2),kdf:"scrypt",kdfparams:{salt:l.hexlify(g).substring(2),n:E,dklen:32,p:k,r:S},mac:A.substring(2)}},h&&(c=y.randomBytes(16),A=new o.default.Counter(c),T=new o.default.ModeOfOperation.ctr(T,A),A=l.arrayify(T.encrypt(h)),T=(T=new Date).getUTCFullYear()+"-"+b(T.getUTCMonth()+1,2)+"-"+b(T.getUTCDate(),2)+"T"+b(T.getUTCHours(),2)+"-"+b(T.getUTCMinutes(),2)+"-"+b(T.getUTCSeconds(),2)+".0Z",a["x-ethers"]={client:v,gethFilename:"UTC--"+T+"--"+a.address,mnemonicCounter:l.hexlify(c).substring(2),mnemonicCiphertext:l.hexlify(A).substring(2),path:p,version:"0.1"},r.wordlist&&"string"==typeof r.wordlist.locale&&(a["x-ethers"].locale=r.wordlist.locale)),n&&n(1),e(JSON.stringify(a))}else if(n)return n(f)}))}))}},{"./address":60,"./bytes":64,"./hdnode":66,"./keccak256":71,"./pbkdf2":73,"./random-bytes":75,"./signing-key":81,"./utf8":85,"aes-js":8,"scrypt-js":44,uuid:48}],79:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("hash.js")),o=e("./bytes");r.ripemd160=function(e){return"0x"+i.default.ripemd160().update(o.arrayify(e)).digest("hex")},r.sha256=function(e){return"0x"+i.default.sha256().update(o.arrayify(e)).digest("hex")},r.sha512=function(e){return"0x"+i.default.sha512().update(o.arrayify(e)).digest("hex")}},{"./bytes":64,"hash.js":26}],80:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),e("setimmediate"),r.platform="browser"},{setimmediate:45}],81:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./hdnode"),o=e("./bytes"),a=e("./properties"),s=e("./secp256k1"),u=n(e("../errors"));function f(e){u.checkNew(this,f);var t;t=i.HDNode.isHDNode(e)?(a.defineReadOnly(this,"mnemonic",e.mnemonic),a.defineReadOnly(this,"path",e.path),o.arrayify(e.privateKey)):("string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e),o.arrayify(e));try{32!==t.length&&u.throwError("exactly 32 bytes required",u.INVALID_ARGUMENT,{arg:"privateKey",value:"[REDACTED]"})}catch(t){e={arg:"privateKey",reason:t.reason,value:"[REDACTED]"},t.value&&("number"==typeof t.value.length&&(e.length=t.value.length),e.type=typeof t.value),u.throwError("invalid private key",t.code,e)}a.defineReadOnly(this,"privateKey",o.hexlify(t)),a.defineReadOnly(this,"keyPair",new s.KeyPair(t)),a.defineReadOnly(this,"publicKey",this.keyPair.publicKey),a.defineReadOnly(this,"address",s.computeAddress(this.keyPair.publicKey)),a.setType(this,"SigningKey")}f.prototype.signDigest=function(e){return this.keyPair.sign(e)},f.prototype.computeSharedSecret=function(e){return this.keyPair.computeSharedSecret(o.arrayify(e))},f.isSigningKey=function(e){return a.isType(e,"SigningKey")},e=f,r.SigningKey=e},{"../errors":5,"./bytes":64,"./hdnode":66,"./properties":74,"./secp256k1":77}],82:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bignumber"),i=e("./bytes"),o=e("./utf8"),a=e("./keccak256"),s=e("./sha2"),u=new RegExp("^bytes([0-9]+)$"),f=new RegExp("^(u?int)([0-9]*)$"),c=new RegExp("^(.*)\\[([0-9]*)\\]$");function l(e,t){if(e.length!=t.length)throw new Error("type/value count mismatch");var r=[];return e.forEach((function(e,a){r.push(function e(t,r,a){switch(t){case"address":return a?i.padZeros(r,32):i.arrayify(r);case"string":return o.toUtf8Bytes(r);case"bytes":return i.arrayify(r);case"bool":return r=r?"0x01":"0x00",a?i.padZeros(r,32):i.arrayify(r)}var s=t.match(f);if(s){if((l=parseInt(s[2]||"256"))%8!=0||0===l||256<l)throw new Error("invalid number type - "+t);return a&&(l=256),r=n.bigNumberify(r).toTwos(l),i.padZeros(r,l/8)}if(s=t.match(u)){var l=parseInt(s[1]);if(String(l)!=s[1]||0===l||32<l)throw new Error("invalid number type - "+t);if(i.arrayify(r).byteLength!==l)throw new Error("invalid value for "+t);return a?i.arrayify((r+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):r}if((s=t.match(c))&&Array.isArray(r)){var h=s[1];if(parseInt(s[2]||String(r.length))!=r.length)throw new Error("invalid value for "+t);var d=[];return r.forEach((function(t){d.push(e(h,t,!0))})),i.concat(d)}throw new Error("unknown type - "+t)}(e,t[a]))})),i.hexlify(i.concat(r))}r.pack=l,r.keccak256=function(e,t){return a.keccak256(l(e,t))},r.sha256=function(e,t){return s.sha256(l(e,t))}},{"./bignumber":63,"./bytes":64,"./keccak256":71,"./sha2":79,"./utf8":85}],83:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("../constants"),o=n(e("../errors")),a=e("./secp256k1"),s=e("./address"),u=e("./bignumber"),f=e("./bytes"),c=e("./keccak256"),l=e("./properties"),h=n(e("./rlp")),d=e("../providers/abstract-provider");function p(e){return"0x"===e?i.Zero:u.bigNumberify(e)}var y=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],g={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};r.serialize=function(e,t){l.checkProperties(e,g);var r=[];y.forEach((function(t){var n=e[t.name]||[];n=f.arrayify(f.hexlify(n)),t.length&&n.length!==t.length&&0<n.length&&o.throwError("invalid length for "+t.name,o.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:n}),t.maxLength&&(n=f.stripZeros(n)).length>t.maxLength&&o.throwError("invalid length for "+t.name,o.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:n}),r.push(f.hexlify(n))})),null!=e.chainId&&0!==e.chainId&&(r.push(f.hexlify(e.chainId)),r.push("0x"),r.push("0x"));var n=h.encode(r);return t?(t=27+(n=f.splitSignature(t)).recoveryParam,9===r.length&&(r.pop(),r.pop(),r.pop(),t+=2*e.chainId+8),r.push(f.hexlify(t)),r.push(f.stripZeros(f.arrayify(n.r))),r.push(f.stripZeros(f.arrayify(n.s))),h.encode(r)):n},r.parse=function(e){9!==(n=h.decode(e)).length&&6!==n.length&&o.throwError("invalid raw transaction",o.INVALID_ARGUMENT,{arg:"rawTransactin",value:e});var t={nonce:p(n[0]).toNumber(),gasPrice:p(n[1]),gasLimit:p(n[2]),to:"0x"===(r=n[3])?null:s.getAddress(r),value:p(n[4]),data:n[5],chainId:0};if(6===n.length)return t;try{t.v=u.bigNumberify(n[6]).toNumber()}catch(e){return o.info(e),t}if(t.r=f.hexZeroPad(n[7],32),t.s=f.hexZeroPad(n[8],32),u.bigNumberify(t.r).isZero()&&u.bigNumberify(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);var r=t.v-27,n=n.slice(0,6);0!==t.chainId&&(n.push(f.hexlify(t.chainId)),n.push("0x"),n.push("0x"),r-=2*t.chainId+8),n=c.keccak256(h.encode(n));try{t.from=a.recoverAddress(n,{r:f.hexlify(t.r),s:f.hexlify(t.s),recoveryParam:r})}catch(e){o.info(e)}t.hash=c.keccak256(e)}return t},r.populateTransaction=function(e,t,r){d.Provider.isProvider(t)||o.throwError("missing provider",o.INVALID_ARGUMENT,{argument:"provider",value:t}),l.checkProperties(e,g);var n=l.shallowCopy(e);return null!=n.to&&(n.to=t.resolveName(n.to)),null==n.gasPrice&&(n.gasPrice=t.getGasPrice()),null==n.nonce&&(n.nonce=t.getTransactionCount(r)),null==n.gasLimit&&((e=l.shallowCopy(n)).from=r,n.gasLimit=t.estimateGas(e)),null==n.chainId&&(n.chainId=t.getNetwork().then((function(e){return e.chainId}))),l.resolveProperties(n)}},{"../constants":3,"../errors":5,"../providers/abstract-provider":50,"./address":60,"./bignumber":63,"./bytes":64,"./keccak256":71,"./properties":74,"./rlp":76,"./secp256k1":77}],84:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i,o=e("../constants"),a=n(e("../errors")),s=e("./bignumber"),u={};function f(e){return{decimals:e.length-1,tenPower:s.bigNumberify(e)}}function c(e){var t=u[String(e).toLowerCase()];if(!t&&"number"==typeof e&&parseInt(String(e))==e&&0<=e&&e<=256){for(var r="1",n=0;n<e;n++)r+="0";t=f(r)}return t||a.throwError("invalid unitType",a.INVALID_ARGUMENT,{argument:"name",value:e}),t}function l(e,t){for(var r=c(t),n=(t=(e=s.bigNumberify(e)).lt(o.Zero),(e=t?e.mul(o.NegativeOne):e).mod(r.tenPower).toString());n.length<r.decimals;)n="0"+n;return n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1],e=e.div(r.tenPower).toString()+"."+n,t?"-"+e:e}function h(e,t){var r=c(t=null==t?18:t);if("string"==typeof e&&e.match(/^-?[0-9.,]+$/)||a.throwError("invalid decimal value",a.INVALID_ARGUMENT,{arg:"value",value:e}),0===r.decimals)return s.bigNumberify(e);var n="-"===e.substring(0,1);"."===(e=n?e.substring(1):e)&&a.throwError("missing value",a.INVALID_ARGUMENT,{arg:"value",value:e}),2<(t=e.split(".")).length&&a.throwError("too many decimal points",a.INVALID_ARGUMENT,{arg:"value",value:e}),e=t[0];var i=t[1];for(e=e||"0",(i=i||"0").length>r.decimals&&a.throwError("underflow occurred",a.NUMERIC_FAULT,{operation:"division",fault:"underflow"});i.length<r.decimals;)i+="0";return t=s.bigNumberify(e),e=s.bigNumberify(i),e=t.mul(r.tenPower).add(e),n?e.mul(o.NegativeOne):e}i="1",["wei","kwei","Mwei","Gwei","szabo","finney","ether"].forEach((function(e){var t=f(i);u[e.toLowerCase()]=t,u[String(t.decimals)]=t,i+="000"})),r.commify=function(e){var t=String(e).split(".");(2<t.length||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&a.throwError("invalid value",a.INVALID_ARGUMENT,{argument:"value",value:e});var r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0"),e="",2===t.length&&(e="."+(t[1]||"0"));for(var i=[];r.length;){if(r.length<=3){i.unshift(r);break}var o=r.length-3;i.unshift(r.substring(o)),r=r.substring(0,o)}return n+i.join(",")+e},r.formatUnits=l,r.parseUnits=h,r.formatEther=function(e){return l(e,18)},r.parseEther=function(e){return h(e,18)}},{"../constants":3,"../errors":5,"./bignumber":63}],85:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../constants"),o=e("../errors"),a=e("./bytes");function s(e,t){(t=void 0===t?n.current:t)!=n.current&&(o.checkNormalize(),e=e.normalize(t));for(var r=[],i=0;i<e.length;i++){var s=e.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(63&s|128);else if(55296==(64512&s)){i++;var u=e.charCodeAt(i);if(i>=e.length||56320!=(64512&u))throw new Error("invalid utf-8 string");r.push((s=65536+((1023&s)<<10)+(1023&u))>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(63&s|128)}return a.arrayify(r)}function u(e,t){e=a.arrayify(e);for(var r="",n=0;n<e.length;){var i=e[n++];if(i>>7){var o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){if(t)continue;if(128==(192&i))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}o=3,s=65535}if(n+o>e.length){if(!t)throw new Error("invalid utf8 byte sequence; too short");for(;n<e.length&&e[n]>>6==2;n++);}else{for(var u=i&(1<<8-o-1)-1,f=0;f<o;f++){var c=e[n];if(128!=(192&c)){u=null;break}u=u<<6|63&c,n++}if(null!==u)if(u<=s){if(!t)throw new Error("invalid utf8 byte sequence; overlong")}else if(1114111<u){if(!t)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(55296<=u&&u<=57343){if(!t)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else u<=65535?r+=String.fromCharCode(u):(u-=65536,r+=String.fromCharCode(55296+(u>>10&1023),56320+(1023&u)));else if(!t)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}(e=n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})).current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD",r.toUtf8Bytes=s,r.toUtf8String=u,r.formatBytes32String=function(e){if(31<(e=s(e)).length)throw new Error("bytes32 string must be less than 32 bytes");return a.hexlify(a.concat([e,i.HashZero]).slice(0,32))},r.parseBytes32String=function(e){var t=a.arrayify(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===t[r-1];)r--;return u(t.slice(0,r))}},{"../constants":3,"../errors":5,"./bytes":64}],86:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("xmlhttprequest"),o=e("./base64"),a=e("./properties"),s=e("./utf8"),u=n(e("../errors"));r.fetchJson=function(e,t,r){var n,a={},f=null,c=12e4;if("string"==typeof e)f=e;else if("object"==typeof e){if(null==e.url&&u.throwError("missing URL",u.MISSING_ARGUMENT,{arg:"url"}),f=e.url,"number"==typeof e.timeout&&0<e.timeout&&(c=e.timeout),e.headers)for(var l in e.headers)a[l.toLowerCase()]={key:l,value:String(e.headers[l])};null!=e.user&&null!=e.password&&("https:"!==f.substring(0,6)&&!0!==e.allowInsecure&&u.throwError("basic authentication requires a secure https url",u.INVALID_ARGUMENT,{arg:"url",url:f,user:e.user,password:"[REDACTED]"}),n=e.user+":"+e.password,a.authorization={key:"Authorization",value:"Basic "+o.encode(s.toUtf8Bytes(n))})}return new Promise((function(e,n){function o(){null!=u&&(clearTimeout(u),u=null)}var s=new i.XMLHttpRequest,u=null;u=setTimeout((function(){null!=u&&(u=null,n(new Error("timeout")),setTimeout((function(){s.abort()}),0))}),c),t?(s.open("POST",f,!0),a["content-type"]={key:"Content-Type",value:"application/json"}):s.open("GET",f,!0),Object.keys(a).forEach((function(e){e=a[e],s.setRequestHeader(e.key,e.value)})),s.onreadystatechange=function(){if(4===s.readyState){if(200!=s.status){o();var i=new Error("invalid response - "+s.status);return i.statusCode=s.status,s.responseText&&(i.responseText=s.responseText),void n(i)}var a=null;try{a=JSON.parse(s.responseText)}catch(i){o();var u=new Error("invalid json response");return u.orginialError=i,u.responseText=s.responseText,null!=t&&(u.requestBody=t),u.url=f,void n(u)}if(r)try{a=r(a)}catch(i){return o(),i.url=f,i.body=t,i.responseText=s.responseText,void n(i)}o(),e(a)}},s.onerror=function(e){o(),n(e)};try{null!=t?s.send(t):s.send()}catch(u){o();var l=new Error("connection error");l.error=u,n(l)}}))},r.poll=function(e,t){return t=t||{},null==(t=a.shallowCopy(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){var i=null,o=!1,a=function(){return!o&&(o=!0,i&&clearTimeout(i),!0)};t.timeout&&(i=setTimeout((function(){a()&&n(new Error("timeout"))}),t.timeout));var s=t.fastRetry||null,u=0;!function i(){return e().then((function(e){return void 0!==e?a()&&r(e):t.onceBlock?t.onceBlock.once("block",i):o||(u++,(e=(e=t.interval*parseInt(String(Math.random()*Math.pow(2,u))))<t.floor?t.floor:e)>t.ceiling&&(e=t.ceiling),s&&(u--,e=s,s=null),setTimeout(i,e)),null}),(function(e){a()&&n(e)}))}()}))}},{"../errors":5,"./base64":61,"./properties":74,"./utf8":85,xmlhttprequest:49}],87:[function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0});var t=e("../utils/hash"),r=e("../utils/properties");n.check=function(e){for(var r=[],n=0;n<2048;n++){var i=e.getWord(n);if(n!==e.getWordIndex(i))return"0x";r.push(i)}return t.id(r.join("\n")+"\n")};var i=(o.prototype.split=function(e){return e.toLowerCase().split(/ +/g)},o.prototype.join=function(e){return e.join(" ")},o);function o(e){r.defineReadOnly(this,"locale",e)}n.Wordlist=i,n.register=function(e,t){t=t||e.locale}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/hash":65,"../utils/properties":74}],88:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./utils/bytes"),u=e("./utils/hash"),f=e("./utils/hdnode"),c=e("./utils/json-wallet"),l=e("./utils/keccak256"),h=e("./utils/properties"),d=e("./utils/random-bytes"),p=o(e("./utils/secret-storage")),y=e("./utils/signing-key"),g=e("./utils/transaction"),b=e("./abstract-signer"),m=e("./providers/abstract-provider"),v=o(e("./errors"));function w(e,t){var r=a.call(this)||this;return v.checkNew(r,w),y.SigningKey.isSigningKey(e)?h.defineReadOnly(r,"signingKey",e):h.defineReadOnly(r,"signingKey",new y.SigningKey(e)),h.defineReadOnly(r,"provider",t),r}i(w,a=b.Signer),Object.defineProperty(w.prototype,"address",{get:function(){return this.signingKey.address},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"mnemonic",{get:function(){return this.signingKey.mnemonic},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"path",{get:function(){return this.signingKey.path},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"privateKey",{get:function(){return this.signingKey.privateKey},enumerable:!0,configurable:!0}),w.prototype.connect=function(e){return m.Provider.isProvider(e)||v.throwError("invalid provider",v.INVALID_ARGUMENT,{argument:"provider",value:e}),new w(this.signingKey,e)},w.prototype.getAddress=function(){return Promise.resolve(this.address)},w.prototype.sign=function(e){var t=this;return h.resolveProperties(e).then((function(e){var r=g.serialize(e);return r=t.signingKey.signDigest(l.keccak256(r)),g.serialize(e,r)}))},w.prototype.signMessage=function(e){return Promise.resolve(s.joinSignature(this.signingKey.signDigest(u.hashMessage(e))))},w.prototype.getBalance=function(e){if(!this.provider)throw new Error("missing provider");return this.provider.getBalance(this.address,e)},w.prototype.getTransactionCount=function(e){if(!this.provider)throw new Error("missing provider");return this.provider.getTransactionCount(this.address,e)},w.prototype.sendTransaction=function(e){var t=this;if(!this.provider)throw new Error("missing provider");return null==e.nonce&&((e=h.shallowCopy(e)).nonce=this.getTransactionCount("pending")),g.populateTransaction(e,this.provider,this.address).then((function(e){return t.sign(e).then((function(e){return t.provider.sendTransaction(e)}))}))},w.prototype.encrypt=function(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t=t||{},this.mnemonic&&((t=h.shallowCopy(t)).mnemonic=this.mnemonic,t.path=this.path),p.encrypt(this.privateKey,e,t,r)},w.createRandom=function(e){var t=d.randomBytes(16);return(e=e||{}).extraEntropy&&(t=s.arrayify(l.keccak256(s.concat([t,e.extraEntropy])).substring(0,34))),t=f.entropyToMnemonic(t,e.locale),w.fromMnemonic(t,e.path,e.locale)},w.fromEncryptedJson=function(e,t,r){if(c.isCrowdsaleWallet(e))try{r&&r(0);var n=p.decryptCrowdsale(e,t);return r&&r(1),Promise.resolve(new w(n))}catch(e){return Promise.reject(e)}else if(c.isSecretStorageWallet(e))return p.decrypt(e,t,r).then((function(e){return new w(e)}));return Promise.reject("invalid wallet JSON")},w.fromMnemonic=function(e,t,r){return t=t||f.defaultPath,new w(f.fromMnemonic(e,r).derivePath(t))},i=w,r.Wallet=i},{"./abstract-signer":2,"./errors":5,"./providers/abstract-provider":50,"./utils/bytes":64,"./utils/hash":65,"./utils/hdnode":66,"./utils/json-wallet":70,"./utils/keccak256":71,"./utils/properties":74,"./utils/random-bytes":75,"./utils/secret-storage":78,"./utils/signing-key":81,"./utils/transaction":83}],89:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),e=e("../wordlists/lang-en").langEn,r.en=e},{"../wordlists/lang-en":90}],90:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o,a=e("../utils/wordlist"),s=null;function u(e){if(null==s&&(s="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==a.check(e)))throw s=null,new Error("BIP39 Wordlist for en (English) FAILED")}function f(){return o.call(this,"en")||this}i=new(i(f,o=a.Wordlist),f.prototype.getWord=function(e){return u(this),s[e]},f.prototype.getWordIndex=function(e){return u(this),s.indexOf(e)},f),r.langEn=i,a.register(i)},{"../utils/wordlist":87}]},{},[7])(7)},718:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=718,e.exports=t},3184:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,u=[],f=!1,c=-1;function l(){f&&s&&(f=!1,s.length?u=s.concat(u):c=-1,u.length&&h())}function h(){if(!f){var e=a(l);f=!0;for(var t=u.length;t;){for(s=u,u=[];++c<t;)s&&s[c].run();c=-1,t=u.length}s=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new d(e,t)),1!==u.length||f||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},8460:()=>{},2382:()=>{},3779:()=>{},7199:()=>{},9209:(e,t,r)=>{var n=r(6578),i="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t<n.length;t++)"function"==typeof i[n[t]]&&(e[e.length]=n[t]);return e}},8772:(e,t,r)=>{r.d(t,{Vy:()=>fe});var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},i={};n.d(i,{q$:()=>se,Vy:()=>ue,$7:()=>o,rE:()=>a});var o={};n.r(o),n.d(o,{DebugLevel:()=>se,Logger:()=>ue,version:()=>a});var a="1.0.1";function s(e,t){e=e.replace("#","");var r=parseInt(e,16),n=Math.round(2.55*t),i=(r>>16)+n,o=(r>>8&255)+n,a=(255&r)+n;return(16777216+65536*(i<255?i<1?0:i:255)+256*(o<255?o<1?0:o:255)+(a<255?a<1?0:a:255)).toString(16).slice(1)}const u=(e=0)=>t=>`[${t+e}m`,f=(e=0)=>t=>`[${38+e};5;${t}m`,c=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(l.modifier),Object.keys(l.color),Object.keys(l.bgColor);const h=function(){const e=new Map;for(const[t,r]of Object.entries(l)){for(const[t,n]of Object.entries(r))l[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=l[t],e.set(n[0],n[1]);Object.defineProperty(l,t,{value:r,enumerable:!1})}return Object.defineProperty(l,"codes",{value:e,enumerable:!1}),l.color.close="",l.bgColor.close="",l.color.ansi=u(),l.color.ansi256=f(),l.color.ansi16m=c(),l.bgColor.ansi=u(10),l.bgColor.ansi256=f(10),l.bgColor.ansi16m=c(10),Object.defineProperties(l,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map((e=>e+e)).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>l.rgbToAnsi256(...l.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const i=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(i/6)/5,n=i%6/5}const i=2*Math.max(t,r,n);if(0===i)return 30;let o=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===i&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>l.ansi256ToAnsi(l.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>l.ansi256ToAnsi(l.hexToAnsi256(e)),enumerable:!1}}),l}(),d=(()=>{if(navigator.userAgentData){const e=navigator.userAgentData.brands.find((({brand:e})=>"Chromium"===e));if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(navigator.userAgent)?1:0})(),p=0!==d&&{level:d,hasBasic:!0,has256:d>=2,has16m:d>=3},y={stdout:p,stderr:p};function g(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const i=t.length;let o=0,a="";do{a+=e.slice(o,n)+t+r,o=n+i,n=e.indexOf(t,o)}while(-1!==n);return a+=e.slice(o),a}const{stdout:b,stderr:m}=y,v=Symbol("GENERATOR"),w=Symbol("STYLER"),_=Symbol("IS_EMPTY"),E=["ansi","ansi","ansi256","ansi16m"],S=Object.create(null);class k{constructor(e){return A(e)}}const A=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=b?b.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,T.prototype),t};function T(e){return A(e)}Object.setPrototypeOf(T.prototype,Function.prototype);for(const[e,t]of Object.entries(h))S[e]={get(){const r=N(this,x(t.open,t.close,this[w]),this[_]);return Object.defineProperty(this,e,{value:r}),r}};S.visible={get(){const e=N(this,this[w],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const P=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?h[r].ansi16m(...n):"ansi256"===t?h[r].ansi256(h.rgbToAnsi256(...n)):h[r].ansi(h.rgbToAnsi(...n)):"hex"===e?P("rgb",t,r,...h.hexToRgb(...n)):h[r][e](...n),O=["rgb","hex","ansi256"];for(const e of O)S[e]={get(){const{level:t}=this;return function(...r){const n=x(P(e,E[t],"color",...r),h.color.close,this[w]);return N(this,n,this[_])}}},S["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=x(P(e,E[t],"bgColor",...r),h.bgColor.close,this[w]);return N(this,n,this[_])}}};const I=Object.defineProperties((()=>{}),{...S,level:{enumerable:!0,get(){return this[v].level},set(e){this[v].level=e}}}),x=(e,t,r)=>{let n,i;return void 0===r?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},N=(e,t,r)=>{const n=(...e)=>M(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,I),n[v]=e,n[w]=t,n[_]=r,n},M=(e,t)=>{if(e.level<=0||!t)return e[_]?"":t;let r=e[w];if(void 0===r)return t;const{openAll:n,closeAll:i}=r;if(t.includes(""))for(;void 0!==r;)t=g(t,r.close,r.open),r=r.parent;const o=t.indexOf("\n");return-1!==o&&(t=function(e,t,r,n){let i=0,o="";do{const a="\r"===e[n-1];o+=e.slice(i,a?n-1:n)+t+(a?"\r\n":"\n")+r,i=n+1,n=e.indexOf("\n",i)}while(-1!==n);return o+=e.slice(i),o}(t,i,n,o)),n+t+i};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function B(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function L(e,t,r){return(t=C(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(e){var t=function(e,t){if("object"!=R(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function U(e,t){return e.get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t))}Object.defineProperties(T.prototype,S),T(),T({level:m?m.level:0});var j=new WeakMap,D=new WeakMap,F=new WeakMap,H=new WeakMap,K=new WeakMap,G=new WeakMap,W=new WeakMap,V=new WeakMap,z=new WeakMap,q=new WeakMap,Z=new WeakMap,$=new WeakMap,X=new WeakMap,Y=new WeakMap,J=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new k;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),L(this,"chalk",void 0),L(this,"moduleName",""),L(this,"logColor","#00bfff"),L(this,"enableLogs",!0),L(this,"hideLogs",!1),B(this,j,"#ff00ff"),B(this,D,s(U(j,this),75)),B(this,F,"#9400d3"),B(this,H,s(U(F,this),15)),B(this,K,s(U(H,this),15)),B(this,G,"#7cfc00"),B(this,W,s(U(G,this),15)),B(this,V,"#ffdead"),B(this,z,s(U(V,this),15)),B(this,q,"#ff8c00"),B(this,Z,s(U(q,this),15)),B(this,$,"#ff4500"),B(this,X,s(U($,this),15)),B(this,Y,"#ffffff"),B(this,J,s(U(Y,this),15)),B(this,Q,"#8b0000"),B(this,ee,s(U(Q,this),15)),L(this,"prefix",""),this.chalk=t,this.moduleName=this.constructor.name},t=[{key:"setLogPrefix",value:function(e){this.prefix=e}},{key:"getStartPrefix",value:function(){return this.prefix}},{key:"disable",value:function(){this.enableLogs=!1}},{key:"enable",value:function(){this.enableLogs=!0}},{key:"fancyLog",value:function(e,t,r,n,i){this.enableLogs&&console.log(this.chalk.hex(U(j,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(U(Y,this))(e)+" "+this.chalk.hex(U(Z,this))(t)+" "+this.chalk.hex(U(Y,this))(r)+" "+this.chalk.hex(U(K,this))(n)+" "+this.chalk.hex(U(Y,this))(i))}},{key:"log",value:function(){if(this.enableLogs&&!this.hideLogs){var e=s(this.logColor,15);console.log(this.chalk.hex(this.logColor)("".concat(this.getStartPrefix(),"[").concat(this.moduleName," LOG]: "))+this.chalk.hex(e).apply(void 0,arguments))}}},{key:"lightOrangeLog",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(Z,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," LOG]: "))+this.chalk.hex(U(Y,this)).apply(void 0,arguments)))}},{key:"error",value:function(){this.enableLogs&&console.log(this.chalk.hex(U($,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," ERROR]: "))+this.chalk.hex(U(X,this)).apply(void 0,arguments))}},{key:"warn",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(q,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," WARN]: "))+this.chalk.hex(U(Z,this)).apply(void 0,arguments))}},{key:"debug",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(V,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(U(z,this)).apply(void 0,arguments)))}},{key:"success",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(G,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," SUCCESS]: "))+this.chalk.hex(U(W,this)).apply(void 0,arguments)))}},{key:"fail",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U($,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," FAIL]: "))+this.chalk.hex(U(X,this)).apply(void 0,arguments)))}},{key:"debugBright",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(F,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(U(H,this)).apply(void 0,arguments)))}},{key:"important",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(j,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," IMPORTANT]: "))+this.chalk.hex(U(D,this)).apply(void 0,arguments))}},{key:"panic",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(Q,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," HELP PANIC]: "))+this.chalk.hex(U(ee,this)).apply(void 0,arguments))}},{key:"info",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(j,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(U(Y,this)).apply(void 0,arguments))}},{key:"securityNotice",value:function(){this.enableLogs&&console.log(this.chalk.hex("#22d8e6")("".concat(this.getStartPrefix(),"[").concat(this.moduleName," SECURITY NOTICE]: "))+this.chalk.hex("#22e3e6").apply(void 0,arguments))}},{key:"traceLog",value:function(){this.enableLogs&&console.log(this.chalk.hex("#ffffff")("".concat(this.getStartPrefix(),"[").concat(this.moduleName," TRACE LOG]: "))+this.chalk.hex(U(J,this)).apply(void 0,arguments))}}],t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,C(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function re(e){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},re(e)}function ne(e,t,r){return t=oe(t),function(e,t){if(t&&("object"===re(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ie()?Reflect.construct(t,r||[],oe(e).constructor):t.apply(e,r))}function ie(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ie=function(){return!!e})()}function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ae(e,t){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ae(e,t)}var se,ue=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ne(this,t)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ae(e,t)}(t,te),r=t,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}();!function(e){e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e[e.TRACE=5]="TRACE",e[e.ALL=6]="ALL"}(se||(se={}));var fe=i.Vy},9004:(e,t,r)=>{function n(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function i(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}r.d(t,{n1:()=>K});const o=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),a=(e,t)=>e<<32-t|e>>>t;function s(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),n(e),e}new Uint8Array(new Uint32Array([287454020]).buffer)[0];class u{clone(){return this._cloneInto()}}function f(e){const t=t=>e().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}const c=(e,t,r)=>e&t^e&r^t&r;class l extends u{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=o(this.buffer)}update(e){i(this);const{view:t,buffer:r,blockLen:n}=this,a=(e=s(e)).length;for(let i=0;i<a;){const s=Math.min(n-this.pos,a-i);if(s!==n)r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=o(e);for(;n<=a-i;i+=n)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){i(this),function(e,t){n(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:a,isLE:s}=this;let{pos:u}=this;t[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>a-u&&(this.process(r,0),u=0);for(let e=u;e<a;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,f=n?0:4;e.setUint32(t+u,a,n),e.setUint32(t+f,s,n)}(r,a-8,BigInt(8*this.length),s),this.process(r,0);const f=o(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)f.setUint32(4*e,h[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const h=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),d=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),p=new Uint32Array(64);class y extends l{constructor(){super(64,32,8,!1),this.A=0|d[0],this.B=0|d[1],this.C=0|d[2],this.D=0|d[3],this.E=0|d[4],this.F=0|d[5],this.G=0|d[6],this.H=0|d[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)p[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=p[e-15],r=p[e-2],n=a(t,7)^a(t,18)^t>>>3,i=a(r,17)^a(r,19)^r>>>10;p[e]=i+p[e-7]+n+p[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:u,G:f,H:l}=this;for(let e=0;e<64;e++){const t=l+(a(s,6)^a(s,11)^a(s,25))+((d=s)&u^~d&f)+h[e]+p[e]|0,y=(a(r,2)^a(r,13)^a(r,22))+c(r,n,i)|0;l=f,f=u,u=s,s=o+t|0,o=i,i=n,n=r,r=t+y|0}var d;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,u=u+this.F|0,f=f+this.G|0,l=l+this.H|0,this.set(r,n,i,o,s,u,f,l)}roundClean(){p.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const g=f((()=>new y)),b=BigInt(2**32-1),m=BigInt(32);function v(e,t=!1){return t?{h:Number(e&b),l:Number(e>>m&b)}:{h:0|Number(e>>m&b),l:0|Number(e&b)}}const w=function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:a}=v(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]},_=(e,t,r)=>e>>>r,E=(e,t,r)=>e<<32-r|t>>>r,S=(e,t,r)=>e>>>r|t<<32-r,k=(e,t,r)=>e<<32-r|t>>>r,A=(e,t,r)=>e<<64-r|t>>>r-32,T=(e,t,r)=>e>>>r-32|t<<64-r,P=function(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},O=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),I=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,x=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),N=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,M=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,R=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),[B,L]=(()=>w(["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((e=>BigInt(e)))))(),C=new Uint32Array(80),U=new Uint32Array(80);class j extends l{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:f,Fh:c,Fl:l,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y]}set(e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|f,this.Fh=0|c,this.Fl=0|l,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)C[r]=e.getUint32(t),U[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|C[e-15],r=0|U[e-15],n=S(t,r,1)^S(t,r,8)^_(t,r,7),i=k(t,r,1)^k(t,r,8)^E(t,r,7),o=0|C[e-2],a=0|U[e-2],s=S(o,a,19)^A(o,a,61)^_(o,a,6),u=k(o,a,19)^T(o,a,61)^E(o,a,6),f=x(i,u,U[e-7],U[e-16]),c=N(f,n,s,C[e-7],C[e-16]);C[e]=0|c,U[e]=0|f}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:a,Cl:s,Dh:u,Dl:f,Eh:c,El:l,Fh:h,Fl:d,Gh:p,Gl:y,Hh:g,Hl:b}=this;for(let e=0;e<80;e++){const t=S(c,l,14)^S(c,l,18)^A(c,l,41),m=k(c,l,14)^k(c,l,18)^T(c,l,41),v=c&h^~c&p,w=R(b,m,l&d^~l&y,L[e],U[e]),_=M(w,g,t,v,B[e],C[e]),E=0|w,x=S(r,n,28)^A(r,n,34)^A(r,n,39),N=k(r,n,28)^T(r,n,34)^T(r,n,39),j=r&i^r&a^i&a,D=n&o^n&s^o&s;g=0|p,b=0|y,p=0|h,y=0|d,h=0|c,d=0|l,({h:c,l}=P(0|u,0|f,0|_,0|E)),u=0|a,f=0|s,a=0|i,s=0|o,i=0|r,o=0|n;const F=O(E,N,D);r=I(F,_,x,j),n=0|F}({h:r,l:n}=P(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=P(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=P(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:f}=P(0|this.Dh,0|this.Dl,0|u,0|f)),({h:c,l}=P(0|this.Eh,0|this.El,0|c,0|l)),({h,l:d}=P(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=P(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=P(0|this.Hh,0|this.Hl,0|g,0|b)),this.set(r,n,i,o,a,s,u,f,c,l,h,d,p,y,g,b)}roundClean(){C.fill(0),U.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const D=f((()=>new j));var F=r(1324),H=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();function K(e){switch(e){case"sha256":return g.create();case"sha512":return D.create()}(0,F.assertArgument)(!1,"invalid hashing algorithm name","algorithm",e)}H.crypto||H.msCrypto},6647:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.r(t),r.d(t,{__initializeContext:()=>I,isPoint:()=>x,isPointCompressed:()=>N,isPrivate:()=>R,isXOnlyPoint:()=>M,pointAdd:()=>B,pointAddScalar:()=>L,pointCompress:()=>C,pointFromScalar:()=>U,pointMultiply:()=>F,privateAdd:()=>H,privateNegate:()=>G,privateSub:()=>K,recover:()=>X,sign:()=>z,signRecoverable:()=>q,signSchnorr:()=>Z,verify:()=>$,verifySchnorr:()=>Y,xOnlyPointAddTweak:()=>W,xOnlyPointAddTweakCheck:()=>V,xOnlyPointFromPoint:()=>D,xOnlyPointFromScalar:()=>j});var i=r(5005),o=r(6597),a=r(3423),s=e([a]);a=(s.then?(await s)():s)[0];const u=new Uint8Array(a.A.memory.buffer),f=a.A.PRIVATE_INPUT.value,c=a.A.PUBLIC_KEY_INPUT.value,l=a.A.PUBLIC_KEY_INPUT2.value,h=a.A.X_ONLY_PUBLIC_KEY_INPUT.value,d=a.A.X_ONLY_PUBLIC_KEY_INPUT2.value,p=a.A.TWEAK_INPUT.value,y=a.A.HASH_INPUT.value,g=a.A.EXTRA_DATA_INPUT.value,b=a.A.SIGNATURE_INPUT.value,m=u.subarray(f,f+o.uS),v=u.subarray(c,c+o.Lv),w=u.subarray(l,l+o.Lv),_=u.subarray(h,h+o.Sl),E=u.subarray(d,d+o.Sl),S=u.subarray(p,p+o.jp),k=u.subarray(y,y+o.Ts),A=u.subarray(g,g+o.C9),T=u.subarray(b,b+o.JZ);function P(e,t){return void 0===e?void 0!==t?t.length:o.Ah:e?o.Ah:o.Lv}function O(e){try{return v.set(e),1===a.A.isPoint(e.length)}finally{v.fill(0)}}function I(){a.A.initializeContext()}function x(e){return o._n(e)&&O(e)}function N(e){return o.uE(e)&&O(e)}function M(e){return o.xm(e)&&O(e)}function R(e){return o.Gw(e)}function B(e,t,r){o.j4(e),o.j4(t);const n=P(r,e);try{return v.set(e),w.set(t),1===a.A.pointAdd(e.length,t.length,n)?v.slice(0,n):null}finally{v.fill(0),w.fill(0)}}function L(e,t,r){o.j4(e),o.ZO(t);const n=P(r,e);try{return v.set(e),S.set(t),1===a.A.pointAddScalar(e.length,n)?v.slice(0,n):null}finally{v.fill(0),S.fill(0)}}function C(e,t){o.j4(e);const r=P(t,e);try{return v.set(e),a.A.pointCompress(e.length,r),v.slice(0,r)}finally{v.fill(0)}}function U(e,t){o.w6(e);const r=P(t);try{return m.set(e),1===a.A.pointFromScalar(r)?v.slice(0,r):null}finally{m.fill(0),v.fill(0)}}function j(e){o.w6(e);try{return m.set(e),a.A.xOnlyPointFromScalar(),_.slice(0,o.Sl)}finally{m.fill(0),_.fill(0)}}function D(e){o.j4(e);try{return v.set(e),a.A.xOnlyPointFromPoint(e.length),_.slice(0,o.Sl)}finally{v.fill(0),_.fill(0)}}function F(e,t,r){o.j4(e),o.ZO(t);const n=P(r,e);try{return v.set(e),S.set(t),1===a.A.pointMultiply(e.length,n)?v.slice(0,n):null}finally{v.fill(0),S.fill(0)}}function H(e,t){o.w6(e),o.ZO(t);try{return m.set(e),S.set(t),1===a.A.privateAdd()?m.slice(0,o.uS):null}finally{m.fill(0),S.fill(0)}}function K(e,t){if(o.w6(e),o.ZO(t),o.be(t))return new Uint8Array(e);try{return m.set(e),S.set(t),1===a.A.privateSub()?m.slice(0,o.uS):null}finally{m.fill(0),S.fill(0)}}function G(e){o.w6(e);try{return m.set(e),a.A.privateNegate(),m.slice(0,o.uS)}finally{m.fill(0)}}function W(e,t){o.L6(e),o.ZO(t);try{_.set(e),S.set(t);const r=a.A.xOnlyPointAddTweak();return-1!==r?{parity:r,xOnlyPubkey:_.slice(0,o.Sl)}:null}finally{_.fill(0),S.fill(0)}}function V(e,t,r,n){o.L6(e),o.L6(r),o.ZO(t);const s=void 0!==n;s&&o.Iq(n);try{if(_.set(e),E.set(r),S.set(t),s)return 1===a.A.xOnlyPointAddTweakCheck(n);{a.A.xOnlyPointAddTweak();const e=_.slice(0,o.Sl);return 0===(0,i.UD)(e,r)}}finally{_.fill(0),E.fill(0),S.fill(0)}}function z(e,t,r){o.Fd(e),o.w6(t),o.F1(r);try{return k.set(e),m.set(t),void 0!==r&&A.set(r),a.A.sign(void 0===r?0:1),T.slice(0,o.JZ)}finally{k.fill(0),m.fill(0),void 0!==r&&A.fill(0),T.fill(0)}}function q(e,t,r){o.Fd(e),o.w6(t),o.F1(r);try{k.set(e),m.set(t),void 0!==r&&A.set(r);const n=a.A.signRecoverable(void 0===r?0:1);return{signature:T.slice(0,o.JZ),recoveryId:n}}finally{k.fill(0),m.fill(0),void 0!==r&&A.fill(0),T.fill(0)}}function Z(e,t,r){o.Fd(e),o.w6(t),o.F1(r);try{return k.set(e),m.set(t),void 0!==r&&A.set(r),a.A.signSchnorr(void 0===r?0:1),T.slice(0,o.JZ)}finally{k.fill(0),m.fill(0),void 0!==r&&A.fill(0),T.fill(0)}}function $(e,t,r,n=!1){o.Fd(e),o.j4(t),o.fK(r);try{return k.set(e),v.set(t),T.set(r),1===a.A.verify(t.length,!0===n?1:0)}finally{k.fill(0),v.fill(0),T.fill(0)}}function X(e,t,r,n=!1){o.Fd(e),o.fK(t),o.tT(t),2&r&&o.ML(t),o.Mf((()=>M(t.subarray(0,32))));const i=P(n);try{return k.set(e),T.set(t),1===a.A.recover(i,r)?v.slice(0,i):null}finally{k.fill(0),T.fill(0),v.fill(0)}}function Y(e,t,r){o.Fd(e),o.L6(t),o.fK(r);try{return k.set(e),_.set(t),T.set(r),1===a.A.verifySchnorr()}finally{k.fill(0),_.fill(0),T.fill(0)}}n()}catch(J){n(J)}}))},4086:(e,t,r)=>{function n(){const e=function(){const e=new Uint8Array(4);if("undefined"==typeof crypto)throw new Error("The crypto object is unavailable. This may occur if your environment does not support the Web Cryptography API.");return crypto.getRandomValues(e),e}();return(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3]}r.d(t,{q:()=>n})},6597:(e,t,r)=>{r.d(t,{Ah:()=>o,C9:()=>c,F1:()=>O,Fd:()=>P,Gw:()=>m,Iq:()=>E,JZ:()=>l,L6:()=>A,Lv:()=>a,ML:()=>M,Mf:()=>x,Sl:()=>s,Ts:()=>f,ZO:()=>T,_n:()=>w,be:()=>b,fK:()=>I,j4:()=>k,jp:()=>u,tT:()=>N,uE:()=>_,uS:()=>i,w6:()=>S,xm:()=>v});var n=r(6924);const i=32,o=33,a=65,s=32,u=32,f=32,c=32,l=64,h=new Uint8Array(32),d=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65]),p=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,69,81,35,25,80,183,95,196,64,45,161,114,47,201,186,238]);function y(e){return e instanceof Uint8Array}function g(e,t){for(let r=0;r<32;++r)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function b(e){return 0===g(e,h)}function m(e){return y(e)&&e.length===i&&g(e,h)>0&&g(e,d)<0}function v(e){return y(e)&&e.length===s}function w(e){return y(e)&&(e.length===o||e.length===a)}function _(e){return y(e)&&e.length===o}function E(e){0!==e&&1!==e&&(0,n.$8)(n.H_)}function S(e){m(e)||(0,n.$8)(n.hK)}function k(e){(function(e){return y(e)&&(e.length===o||e.length===a||e.length===s)})(e)||(0,n.$8)(n.Md)}function A(e){v(e)||(0,n.$8)(n.Md)}function T(e){(function(e){return y(e)&&e.length===u&&g(e,d)<0})(e)||(0,n.$8)(n._1)}function P(e){(function(e){return y(e)&&e.length===f})(e)||(0,n.$8)(n.EW)}function O(e){(function(e){return void 0===e||y(e)&&e.length===c})(e)||(0,n.$8)(n.pA)}function I(e){(function(e){return y(e)&&64===e.length&&g(e.subarray(0,32),d)<0&&g(e.subarray(32,64),d)<0})(e)||(0,n.$8)(n.u4)}function x(e){e()||(0,n.$8)(n.u4)}function N(e){b(e.subarray(0,32))&&(0,n.$8)(n.u4),b(e.subarray(32,64))&&(0,n.$8)(n.u4)}function M(e){(function(e){return y(e)&&64===e.length&&g(e.subarray(0,32),p)<0})(e)||(0,n.$8)(n.bU)}},6924:(e,t,r)=>{r.d(t,{$8:()=>h,EW:()=>a,H_:()=>f,Md:()=>i,_1:()=>o,bU:()=>c,hK:()=>n,pA:()=>u,u4:()=>s});const n=0,i=1,o=2,a=3,s=4,u=5,f=6,c=7,l={[n.toString()]:"Expected Private",[i.toString()]:"Expected Point",[o.toString()]:"Expected Tweak",[a.toString()]:"Expected Hash",[s.toString()]:"Expected Signature",[u.toString()]:"Expected Extra Data (32 bytes)",[f.toString()]:"Expected Parity (1 | 0)",[c.toString()]:"Bad Recovery Id"};function h(e){const t=l[e.toString()]||`Unknow error code: ${e}`;throw new TypeError(t)}},3423:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{A:()=>a});var i=r(5598),o=e([i]);const a=i=(o.then?(await o)():o)[0];n()}catch(e){n(e)}}))},5005:(e,t,r)=>{r.d(t,{UD:()=>i});const n="0123456789abcdefABCDEF";function i(e,t){const r=Math.min(e.length,t.length);for(let n=0;n<r;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return e.length===t.length?0:e.length>t.length?1:-1}n.split("").map((e=>e.codePointAt(0))),Array(256).fill(!0).map(((e,t)=>{const r=String.fromCodePoint(t),i=n.indexOf(r);return i<0?void 0:i<16?i:i-6})),new TextEncoder,new TextDecoder("ascii")},5598:(e,t,r)=>{var n=r(4086),i=r(6924);e.exports=r.v(t,e.id,"873e754d6c7c6e9361f1",{"./rand.js":{generateInt32:n.q},"./validate_error.js":{throwError:i.$8}})}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={id:e,exports:{}};return i[e](r,r.exports,a),r.exports}e="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",t="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",r="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",n=e=>{e&&e.d<1&&(e.d=1,e.forEach((e=>e.r--)),e.forEach((e=>e.r--?e.r++:e())))},a.a=(i,o,a)=>{var s;a&&((s=[]).d=-1);var u,f,c,l=new Set,h=i.exports,d=new Promise(((e,t)=>{c=t,f=e}));d[t]=h,d[e]=e=>(s&&e(s),l.forEach(e),d.catch((e=>{}))),i.exports=d,o((i=>{var o;u=(i=>i.map((i=>{if(null!==i&&"object"==typeof i){if(i[e])return i;if(i.then){var o=[];o.d=0,i.then((e=>{a[t]=e,n(o)}),(e=>{a[r]=e,n(o)}));var a={};return a[e]=e=>e(o),a}}var s={};return s[e]=e=>{},s[t]=i,s})))(i);var a=()=>u.map((e=>{if(e[r])throw e[r];return e[t]})),f=new Promise((t=>{(o=()=>t(a)).r=0;var r=e=>e!==s&&!l.has(e)&&(l.add(e),e&&!e.d&&(o.r++,e.push(o)));u.map((t=>t[e](r)))}));return o.r?f:a()}),(e=>(e?c(d[r]=e):f(h),n(s)))),s&&s.d<0&&(s.d=0)},a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.v=(e,t,r,n)=>{var i=fetch(a.p+""+r+".module.wasm"),o=()=>i.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,n))).then((t=>Object.assign(e,t.instance.exports)));return i.then((t=>"function"==typeof WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,n).then((t=>Object.assign(e,t.instance.exports)),(e=>{if("application/wasm"!==t.headers.get("Content-Type"))return console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e),o();throw e})):o()))},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})();var s=a(4317),u=(s=await s).iy,f=s.G7,c=s.GF,l=s.wf,h=s.P8,d=s.z4,p=s.kd,y=s.cC,g=s.Wj,b=s.Bc,m=s.tm,v=s.Qc,w=s.dF,_=s.D_,E=s.aS,S=s.y4,k=s.uW,A=s.$7,T=s.rE,P=s.rR;export{u as AddressGenerator,f as BitcoinUtils,c as CalldataGenerator,l as Compressor,h as ContractBaseMetadata,d as DeploymentGenerator,p as EcKeyPair,y as FundingTransaction,g as Generator,b as InteractionTransaction,m as TapscriptVerificator,v as TransactionBuilder,w as TransactionFactory,_ as TransactionType,E as TweakedSigner,S as UTXOManager,k as Wallet,A as opnet,T as version,P as wBTC};
2
+ var e,t,r,n,i={7557:(e,t)=>{function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function n(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function i(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function o(e,...t){if(!i(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function u(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=t.isBytes=void 0,t.number=r,t.bool=n,t.isBytes=i,t.bytes=o,t.hash=a,t.exists=s,t.output=u;const f={number:r,bool:n,bytes:o,hash:a,exists:s,output:u};t.default=f},7202:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.HashMD=t.Maj=t.Chi=void 0;const n=r(7557),i=r(9175);t.Chi=(e,t,r)=>e&t^~e&r,t.Maj=(e,t,r)=>e&t^e&r^t&r;class o extends i.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,i.createView)(this.buffer)}update(e){(0,n.exists)(this);const{view:t,buffer:r,blockLen:o}=this,a=(e=(0,i.toBytes)(e)).length;for(let n=0;n<a;){const s=Math.min(o-this.pos,a-n);if(s!==o)r.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===o&&(this.process(t,0),this.pos=0);else{const t=(0,i.createView)(e);for(;o<=a-n;n+=o)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.exists)(this),(0,n.output)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:o,isLE:a}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let e=s;e<o;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,f=n?0:4;e.setUint32(t+u,a,n),e.setUint32(t+f,s,n)}(r,o-8,BigInt(8*this.length),a),this.process(r,0);const u=(0,i.createView)(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=f/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)u.setUint32(4*e,l[e],a)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}t.HashMD=o},2318:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.add5L=t.add5H=t.add4H=t.add4L=t.add3H=t.add3L=t.add=t.rotlBL=t.rotlBH=t.rotlSL=t.rotlSH=t.rotr32L=t.rotr32H=t.rotrBL=t.rotrBH=t.rotrSL=t.rotrSH=t.shrSL=t.shrSH=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),n=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function o(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:a,l:s}=i(e[o],t);[r[o],n[o]]=[a,s]}return[r,n]}t.fromBig=i,t.split=o;const a=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=a;const s=(e,t,r)=>e>>>r;t.shrSH=s;const u=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=u;const f=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=f;const c=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=c;const l=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=l;const h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;const d=(e,t)=>t;t.rotr32H=d;const p=(e,t)=>e;t.rotr32L=p;const y=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=y;const g=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=g;const b=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=b;const m=(e,t,r)=>e<<r-32|t>>>64-r;function v(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}t.rotlBL=m,t.add=v;const w=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=w;const _=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=_;const E=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=E;const S=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;t.add4H=S;const k=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);t.add5L=k;const T=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;t.add5H=T;const A={fromBig:i,split:o,toBig:a,shrSH:s,shrSL:u,rotrSH:f,rotrSL:c,rotrBH:l,rotrBL:h,rotr32H:d,rotr32L:p,rotlSH:y,rotlSL:g,rotlBH:b,rotlBL:m,add:v,add3L:w,add3H:_,add4L:E,add4H:S,add5H:T,add5L:k};t.default=A},5145:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},9615:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hmac=t.HMAC=void 0;const n=r(7557),i=r(9175);class o extends i.Hash{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,n.hash)(e);const r=(0,i.toBytes)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,a=new Uint8Array(o);a.set(r.length>o?e.create().update(r).digest():r);for(let e=0;e<a.length;e++)a[e]^=54;this.iHash.update(a),this.oHash=e.create();for(let e=0;e<a.length;e++)a[e]^=106;this.oHash.update(a),a.fill(0)}update(e){return(0,n.exists)(this),this.iHash.update(e),this}digestInto(e){(0,n.exists)(this),(0,n.bytes)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}t.HMAC=o,t.hmac=(e,t,r)=>new o(e,t).update(r).digest(),t.hmac.create=(e,t)=>new o(e,t)},3238:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ripemd160=t.RIPEMD160=void 0;const n=r(7202),i=r(9175),o=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),a=new Uint8Array(new Array(16).fill(0).map(((e,t)=>t)));let s=[a],u=[a.map((e=>(9*e+5)%16))];for(let e=0;e<4;e++)for(let t of[s,u])t.push(t[e].map((e=>o[e])));const f=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),c=s.map(((e,t)=>e.map((e=>f[t][e])))),l=u.map(((e,t)=>e.map((e=>f[t][e])))),h=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),d=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function p(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const y=new Uint32Array(16);class g extends n.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:i}=this;return[e,t,r,n,i]}set(e,t,r,n,i){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|i}process(e,t){for(let r=0;r<16;r++,t+=4)y[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,a=o,f=0|this.h2,g=f,b=0|this.h3,m=b,v=0|this.h4,w=v;for(let e=0;e<5;e++){const t=4-e,_=h[e],E=d[e],S=s[e],k=u[e],T=c[e],A=l[e];for(let t=0;t<16;t++){const n=(0,i.rotl)(r+p(e,o,f,b)+y[S[t]]+_,T[t])+v|0;r=v,v=b,b=0|(0,i.rotl)(f,10),f=o,o=n}for(let e=0;e<16;e++){const r=(0,i.rotl)(n+p(t,a,g,m)+y[k[e]]+E,A[e])+w|0;n=w,w=m,m=0|(0,i.rotl)(g,10),g=a,a=r}}this.set(this.h1+f+m|0,this.h2+b+w|0,this.h3+v+n|0,this.h4+r+a|0,this.h0+o+g|0)}roundClean(){y.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}t.RIPEMD160=g,t.ripemd160=(0,i.wrapConstructor)((()=>new g))},1549:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha1=void 0;const n=r(7202),i=r(9175),o=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),a=new Uint32Array(80);class s extends n.HashMD{constructor(){super(64,20,8,!1),this.A=0|o[0],this.B=0|o[1],this.C=0|o[2],this.D=0|o[3],this.E=0|o[4]}get(){const{A:e,B:t,C:r,D:n,E:i}=this;return[e,t,r,n,i]}set(e,t,r,n,i){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!1);for(let e=16;e<80;e++)a[e]=(0,i.rotl)(a[e-3]^a[e-8]^a[e-14]^a[e-16],1);let{A:r,B:o,C:s,D:u,E:f}=this;for(let e=0;e<80;e++){let t,c;e<20?(t=(0,n.Chi)(o,s,u),c=1518500249):e<40?(t=o^s^u,c=1859775393):e<60?(t=(0,n.Maj)(o,s,u),c=2400959708):(t=o^s^u,c=3395469782);const l=(0,i.rotl)(r,5)+t+f+c+a[e]|0;f=u,u=s,s=(0,i.rotl)(o,30),o=r,r=l}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,u=u+this.D|0,f=f+this.E|0,this.set(r,o,s,u,f)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}t.sha1=(0,i.wrapConstructor)((()=>new s))},2623:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha224=t.sha256=void 0;const n=r(7202),i=r(9175),o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),s=new Uint32Array(64);class u extends n.HashMD{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)s[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=s[e-15],r=s[e-2],n=(0,i.rotr)(t,7)^(0,i.rotr)(t,18)^t>>>3,o=(0,i.rotr)(r,17)^(0,i.rotr)(r,19)^r>>>10;s[e]=o+s[e-7]+n+s[e-16]|0}let{A:r,B:a,C:u,D:f,E:c,F:l,G:h,H:d}=this;for(let e=0;e<64;e++){const t=d+((0,i.rotr)(c,6)^(0,i.rotr)(c,11)^(0,i.rotr)(c,25))+(0,n.Chi)(c,l,h)+o[e]+s[e]|0,p=((0,i.rotr)(r,2)^(0,i.rotr)(r,13)^(0,i.rotr)(r,22))+(0,n.Maj)(r,a,u)|0;d=h,h=l,l=c,c=f+t|0,f=u,u=a,a=r,r=t+p|0}r=r+this.A|0,a=a+this.B|0,u=u+this.C|0,f=f+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(r,a,u,f,c,l,h,d)}roundClean(){s.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class f extends u{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}t.sha256=(0,i.wrapConstructor)((()=>new u)),t.sha224=(0,i.wrapConstructor)((()=>new f))},102:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.sha384=t.sha512_256=t.sha512_224=t.sha512=t.SHA512=void 0;const n=r(7202),i=r(2318),o=r(9175),[a,s]=(()=>i.default.split(["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((e=>BigInt(e)))))(),u=new Uint32Array(80),f=new Uint32Array(80);class c extends n.HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:f,Fh:c,Fl:l,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y]}set(e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|f,this.Fh=0|c,this.Fl=0|l,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)u[r]=e.getUint32(t),f[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|u[e-15],r=0|f[e-15],n=i.default.rotrSH(t,r,1)^i.default.rotrSH(t,r,8)^i.default.shrSH(t,r,7),o=i.default.rotrSL(t,r,1)^i.default.rotrSL(t,r,8)^i.default.shrSL(t,r,7),a=0|u[e-2],s=0|f[e-2],c=i.default.rotrSH(a,s,19)^i.default.rotrBH(a,s,61)^i.default.shrSH(a,s,6),l=i.default.rotrSL(a,s,19)^i.default.rotrBL(a,s,61)^i.default.shrSL(a,s,6),h=i.default.add4L(o,l,f[e-7],f[e-16]),d=i.default.add4H(h,n,c,u[e-7],u[e-16]);u[e]=0|d,f[e]=0|h}let{Ah:r,Al:n,Bh:o,Bl:c,Ch:l,Cl:h,Dh:d,Dl:p,Eh:y,El:g,Fh:b,Fl:m,Gh:v,Gl:w,Hh:_,Hl:E}=this;for(let e=0;e<80;e++){const t=i.default.rotrSH(y,g,14)^i.default.rotrSH(y,g,18)^i.default.rotrBH(y,g,41),S=i.default.rotrSL(y,g,14)^i.default.rotrSL(y,g,18)^i.default.rotrBL(y,g,41),k=y&b^~y&v,T=g&m^~g&w,A=i.default.add5L(E,S,T,s[e],f[e]),P=i.default.add5H(A,_,t,k,a[e],u[e]),I=0|A,O=i.default.rotrSH(r,n,28)^i.default.rotrBH(r,n,34)^i.default.rotrBH(r,n,39),x=i.default.rotrSL(r,n,28)^i.default.rotrBL(r,n,34)^i.default.rotrBL(r,n,39),M=r&o^r&l^o&l,N=n&c^n&h^c&h;_=0|v,E=0|w,v=0|b,w=0|m,b=0|y,m=0|g,({h:y,l:g}=i.default.add(0|d,0|p,0|P,0|I)),d=0|l,p=0|h,l=0|o,h=0|c,o=0|r,c=0|n;const R=i.default.add3L(I,x,N);r=i.default.add3H(R,P,O,M),n=0|R}({h:r,l:n}=i.default.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:c}=i.default.add(0|this.Bh,0|this.Bl,0|o,0|c)),({h:l,l:h}=i.default.add(0|this.Ch,0|this.Cl,0|l,0|h)),({h:d,l:p}=i.default.add(0|this.Dh,0|this.Dl,0|d,0|p)),({h:y,l:g}=i.default.add(0|this.Eh,0|this.El,0|y,0|g)),({h:b,l:m}=i.default.add(0|this.Fh,0|this.Fl,0|b,0|m)),({h:v,l:w}=i.default.add(0|this.Gh,0|this.Gl,0|v,0|w)),({h:_,l:E}=i.default.add(0|this.Hh,0|this.Hl,0|_,0|E)),this.set(r,n,o,c,l,h,d,p,y,g,b,m,v,w,_,E)}roundClean(){u.fill(0),f.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=c;class l extends c{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class h extends c{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class d extends c{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}t.sha512=(0,o.wrapConstructor)((()=>new c)),t.sha512_224=(0,o.wrapConstructor)((()=>new l)),t.sha512_256=(0,o.wrapConstructor)((()=>new h)),t.sha384=(0,o.wrapConstructor)((()=>new d))},9175:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.byteSwap32=t.byteSwapIfBE=t.byteSwap=t.isLE=t.rotl=t.rotr=t.createView=t.u32=t.u8=t.isBytes=void 0;const n=r(5145),i=r(7557);t.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),t.rotr=(e,t)=>e<<32-t|e>>>t,t.rotl=(e,t)=>e<<t|e>>>32-t>>>0,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,t.byteSwapIfBE=t.isLE?e=>e:e=>(0,t.byteSwap)(e),t.byteSwap32=function(e){for(let r=0;r<e.length;r++)e[r]=(0,t.byteSwap)(e[r])};const o=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){(0,i.bytes)(e);let t="";for(let r=0;r<e.length;r++)t+=o[e[r]];return t};const a=48,s=57,u=65,f=70,c=97,l=102;function h(e){return e>=a&&e<=s?e-a:e>=u&&e<=f?e-(u-10):e>=c&&e<=l?e-(c-10):void 0}function d(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function p(e){return"string"==typeof e&&(e=d(e)),(0,i.bytes)(e),e}t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=h(e.charCodeAt(i)),o=h(e.charCodeAt(i+1));if(void 0===r||void 0===o){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+o}return n},t.nextTick=async()=>{},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let o=0;o<e;o++){n(o);const e=Date.now()-i;e>=0&&e<r||(await(0,t.nextTick)(),i+=e)}},t.utf8ToBytes=d,t.toBytes=p,t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];(0,i.bytes)(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r},t.Hash=class{clone(){return this._cloneInto()}};const y={}.toString;t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==y.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(p(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(p(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(p(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}},3203:(e,t)=>{function r(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function n(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function i(...e){const t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map((e=>e.encode)).reduceRight(r,t),decode:e.map((e=>e.decode)).reduce(r,t)}}function o(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(r(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function a(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function s(e,t="="){if(r(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function u(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function f(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let i=0;const o=[],a=Array.from(e);for(a.forEach((e=>{if(r(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,r=!0;for(let o=i;o<a.length;o++){const s=a[o],u=t*e+s;if(!Number.isSafeInteger(u)||t*e/t!==e||u-s!=t*e)throw new Error("convertRadix: carry overflow");e=u%n;const f=Math.floor(u/n);if(a[o]=f,!Number.isSafeInteger(f)||f*n+e!==u)throw new Error("convertRadix: carry overflow");r&&(f?r=!1:i=o)}if(o.push(e),r)break}for(let t=0;t<e.length-1&&0===e[t];t++)o.push(0);return o.reverse()}Object.defineProperty(t,"__esModule",{value:!0}),t.bytes=t.stringToBytes=t.str=t.bytesToString=t.hex=t.utf8=t.bech32m=t.bech32=t.base58check=t.createBase58check=t.base58xmr=t.base58xrp=t.base58flickr=t.base58=t.base64urlnopad=t.base64url=t.base64nopad=t.base64=t.base32crockford=t.base32hex=t.base32=t.base16=t.utils=t.assertNumber=void 0,t.assertNumber=r;const c=(e,t)=>t?c(t,e%t):e,l=(e,t)=>e+(t-c(e,t));function h(e,t,n,i){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(l(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${l(t,n)}`);let o=0,a=0;const s=2**n-1,u=[];for(const i of e){if(r(i),i>=2**t)throw new Error(`convertRadix2: invalid data word=${i} from=${t}`);if(o=o<<t|i,a+t>32)throw new Error(`convertRadix2: carry overflow pos=${a} from=${t}`);for(a+=t;a>=n;a-=n)u.push((o>>a-n&s)>>>0);o&=2**a-1}if(o=o<<n-a&s,!i&&a>=t)throw new Error("Excess padding");if(!i&&o)throw new Error(`Non-zero padding: ${o}`);return i&&a>0&&u.push(o>>>0),u}function d(e){return r(e),{encode:t=>{if(!n(t))throw new Error("radix.encode input should be Uint8Array");return f(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(f(t,e,256))}}}function p(e,t=!1){if(r(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(l(8,e)>32||l(e,8)>32)throw new Error("radix2: carry overflow");return{encode:r=>{if(!n(r))throw new Error("radix2.encode input should be Uint8Array");return h(Array.from(r),8,e,!t)},decode:r=>{if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(h(r,e,8,t))}}}function y(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function g(e,t){if(r(e),"function"!=typeof t)throw new Error("checksum fn should be function");return{encode(r){if(!n(r))throw new Error("checksum.encode: input should be Uint8Array");const i=t(r).slice(0,e),o=new Uint8Array(r.length+e);return o.set(r),o.set(i,r.length),o},decode(r){if(!n(r))throw new Error("checksum.decode: input should be Uint8Array");const i=r.slice(0,-e),o=t(i).slice(0,e),a=r.slice(-e);for(let t=0;t<e;t++)if(o[t]!==a[t])throw new Error("Invalid checksum");return i}}}t.utils={alphabet:o,chain:i,checksum:g,convertRadix:f,convertRadix2:h,radix:d,radix2:p,join:a,padding:s},t.base16=i(p(4),o("0123456789ABCDEF"),a("")),t.base32=i(p(5),o("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),s(5),a("")),t.base32hex=i(p(5),o("0123456789ABCDEFGHIJKLMNOPQRSTUV"),s(5),a("")),t.base32crockford=i(p(5),o("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),a(""),u((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),t.base64=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s(6),a("")),t.base64nopad=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),a("")),t.base64url=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(6),a("")),t.base64urlnopad=i(p(6),o("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),a(""));const b=e=>i(d(58),o(e),a(""));t.base58=b("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),t.base58flickr=b("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),t.base58xrp=b("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const m=[0,2,3,5,6,7,9,10,11];t.base58xmr={encode(e){let r="";for(let n=0;n<e.length;n+=8){const i=e.subarray(n,n+8);r+=t.base58.encode(i).padStart(m[i.length],"1")}return r},decode(e){let r=[];for(let n=0;n<e.length;n+=11){const i=e.slice(n,n+11),o=m.indexOf(i.length),a=t.base58.decode(i);for(let e=0;e<a.length-o;e++)if(0!==a[e])throw new Error("base58xmr: wrong padding");r=r.concat(Array.from(a.slice(a.length-o)))}return Uint8Array.from(r)}},t.createBase58check=e=>i(g(4,(t=>e(e(t)))),t.base58),t.base58check=t.createBase58check;const v=i(o("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),a("")),w=[996825010,642813549,513874426,1027748829,705979059];function _(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e<w.length;e++)1==(t>>e&1)&&(r^=w[e]);return r}function E(e,t,r=1){const n=e.length;let i=1;for(let t=0;t<n;t++){const r=e.charCodeAt(t);if(r<33||r>126)throw new Error(`Invalid prefix (${e})`);i=_(i)^r>>5}i=_(i);for(let t=0;t<n;t++)i=_(i)^31&e.charCodeAt(t);for(let e of t)i=_(i)^e;for(let e=0;e<6;e++)i=_(i);return i^=r,v.encode(h([i%2**30],30,5,!1))}function S(e){const t="bech32"===e?1:734539939,r=p(5),n=r.decode,i=r.encode,o=y(n);function a(e,r=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==r&&e.length>r)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=n.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=n.slice(0,i),a=n.slice(i+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=v.decode(a).slice(0,-6),u=E(o,s,t);if(!a.endsWith(u))throw new Error(`Invalid checksum in ${e}: expected "${u}"`);return{prefix:o,words:s}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);if(0===e.length)throw new TypeError(`Invalid prefix length ${e.length}`);const i=e.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=e.toLowerCase(),a=E(o,r,t);return`${o}1${v.encode(r)}${a}`},decode:a,decodeToBytes:function(e){const{prefix:t,words:r}=a(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:y(a),fromWords:n,fromWordsUnsafe:o,toWords:i}}t.bech32=S("bech32"),t.bech32m=S("bech32m"),t.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},t.hex=i(p(4),o("0123456789abcdef"),a(""),u((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const k={utf8:t.utf8,hex:t.hex,base16:t.base16,base32:t.base32,base64:t.base64,base64url:t.base64url,base58:t.base58,base58xmr:t.base58xmr},T="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";t.bytesToString=(e,t)=>{if("string"!=typeof e||!k.hasOwnProperty(e))throw new TypeError(T);if(!n(t))throw new TypeError("bytesToString() expects Uint8Array");return k[e].encode(t)},t.str=t.bytesToString,t.stringToBytes=(e,t)=>{if(!k.hasOwnProperty(e))throw new TypeError(T);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return k[e].decode(t)},t.bytes=t.stringToBytes},4822:(e,t,r)=>{r.d(t,{r:()=>n});var n="1.0.5"},374:(e,t,r)=>{function n(e){let t=e.length;for(;--t>=0;)e[t]=0}r.d(t,{w:()=>mr});const i=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),a=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),s=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),u=new Array(576);n(u);const f=new Array(60);n(f);const c=new Array(512);n(c);const l=new Array(256);n(l);const h=new Array(29);n(h);const d=new Array(30);function p(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let y,g,b;function m(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}n(d);const v=e=>e<256?c[e]:c[256+(e>>>7)],w=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},_=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,w(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},E=(e,t,r)=>{_(e,r[2*t],r[2*t+1])},S=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},k=(e,t,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=15;i++)a=a+r[i-1]<<1,n[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=S(n[t]++,t))}},T=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},A=e=>{e.bi_valid>8?w(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},P=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},I=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&P(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!P(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},O=(e,t,r)=>{let n,a,s,u,f=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+f++],n+=(255&e.pending_buf[e.sym_buf+f++])<<8,a=e.pending_buf[e.sym_buf+f++],0===n?E(e,a,t):(s=l[a],E(e,s+256+1,t),u=i[s],0!==u&&(a-=h[s],_(e,a,u)),n--,s=v(n),E(e,s,r),u=o[s],0!==u&&(n-=d[s],_(e,n,u)))}while(f<e.sym_next);E(e,256,t)},x=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,u,f=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=f=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)u=e.heap[++e.heap_len]=f<2?++f:0,r[2*u]=1,e.depth[u]=0,e.opt_len--,i&&(e.static_len-=n[2*u+1]);for(t.max_code=f,a=e.heap_len>>1;a>=1;a--)I(e,r,a);u=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],I(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*u]=r[2*a]+r[2*s],e.depth[u]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=u,e.heap[1]=u++,I(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,u=t.stat_desc.max_length;let f,c,l,h,d,p,y=0;for(h=0;h<=15;h++)e.bl_count[h]=0;for(r[2*e.heap[e.heap_max]+1]=0,f=e.heap_max+1;f<573;f++)c=e.heap[f],h=r[2*r[2*c+1]+1]+1,h>u&&(h=u,y++),r[2*c+1]=h,c>n||(e.bl_count[h]++,d=0,c>=s&&(d=a[c-s]),p=r[2*c],e.opt_len+=p*(h+d),o&&(e.static_len+=p*(i[2*c+1]+d)));if(0!==y){do{for(h=u-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[u]--,y-=2}while(y>0);for(h=u;0!==h;h--)for(c=e.bl_count[h];0!==c;)l=e.heap[--f],l>n||(r[2*l+1]!==h&&(e.opt_len+=(h-r[2*l+1])*r[2*l],r[2*l+1]=h),c--)}})(e,t),k(r,f,e.bl_count)},M=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,u=7,f=4;for(0===a&&(u=138,f=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<f?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(u=138,f=3):i===a?(u=6,f=3):(u=7,f=4))},N=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,u=7,f=4;for(0===a&&(u=138,f=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<f)do{E(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(E(e,i,e.bl_tree),s--),E(e,16,e.bl_tree),_(e,s-3,2)):s<=10?(E(e,17,e.bl_tree),_(e,s-3,3)):(E(e,18,e.bl_tree),_(e,s-11,7));s=0,o=i,0===a?(u=138,f=3):i===a?(u=6,f=3):(u=7,f=4)}};let R=!1;const B=(e,t,r,n)=>{_(e,0+(n?1:0),3),A(e),w(e,r),w(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var C={_tr_init:e=>{R||((()=>{let e,t,r,n,s;const m=new Array(16);for(r=0,n=0;n<28;n++)for(h[n]=r,e=0;e<1<<i[n];e++)l[r++]=n;for(l[r-1]=n,s=0,n=0;n<16;n++)for(d[n]=s,e=0;e<1<<o[n];e++)c[s++]=n;for(s>>=7;n<30;n++)for(d[n]=s<<7,e=0;e<1<<o[n]-7;e++)c[256+s++]=n;for(t=0;t<=15;t++)m[t]=0;for(e=0;e<=143;)u[2*e+1]=8,e++,m[8]++;for(;e<=255;)u[2*e+1]=9,e++,m[9]++;for(;e<=279;)u[2*e+1]=7,e++,m[7]++;for(;e<=287;)u[2*e+1]=8,e++,m[8]++;for(k(u,287,m),e=0;e<30;e++)f[2*e+1]=5,f[2*e]=S(e,5);y=new p(u,i,257,286,15),g=new p(f,o,0,30,15),b=new p(new Array(0),a,0,19,7)})(),R=!0),e.l_desc=new m(e.dyn_ltree,y),e.d_desc=new m(e.dyn_dtree,g),e.bl_desc=new m(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,T(e)},_tr_stored_block:B,_tr_flush_block:(e,t,r,n)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),x(e,e.l_desc),x(e,e.d_desc),a=(e=>{let t;for(M(e,e.dyn_ltree,e.l_desc.max_code),M(e,e.dyn_dtree,e.d_desc.max_code),x(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*s[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?B(e,t,r,n):4===e.strategy||o===i?(_(e,2+(n?1:0),3),O(e,u,f)):(_(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(_(e,t-257,5),_(e,r-1,5),_(e,n-4,4),i=0;i<n;i++)_(e,e.bl_tree[2*s[i]+1],3);N(e,e.dyn_ltree,t-1),N(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),O(e,e.dyn_ltree,e.dyn_dtree)),T(e),n&&A(e)},_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(l[r]+256+1)]++,e.dyn_dtree[2*v(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{_(e,2,3),E(e,256,u),(e=>{16===e.bi_valid?(w(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}},L=(e,t,r,n)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+t[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const U=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var D=(e,t,r,n)=>{const i=U,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return~e},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},H={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:F,_tr_stored_block:K,_tr_flush_block:G,_tr_tally:V,_tr_align:z}=C,{Z_NO_FLUSH:W,Z_PARTIAL_FLUSH:q,Z_FULL_FLUSH:X,Z_FINISH:$,Z_BLOCK:Z,Z_OK:Y,Z_STREAM_END:J,Z_STREAM_ERROR:Q,Z_DATA_ERROR:ee,Z_BUF_ERROR:te,Z_DEFAULT_COMPRESSION:re,Z_FILTERED:ne,Z_HUFFMAN_ONLY:ie,Z_RLE:oe,Z_FIXED:ae,Z_DEFAULT_STRATEGY:se,Z_UNKNOWN:ue,Z_DEFLATED:fe}=H,ce=258,le=262,he=42,de=113,pe=666,ye=(e,t)=>(e.msg=j[t],t),ge=e=>2*e-(e>4?9:0),be=e=>{let t=e.length;for(;--t>=0;)e[t]=0},me=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let ve=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const we=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},_e=(e,t)=>{G(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,we(e.strm)},Ee=(e,t)=>{e.pending_buf[e.pending++]=t},Se=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},ke=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=L(e.adler,t,i,r):2===e.state.wrap&&(e.adler=D(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},Te=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const u=e.strstart>e.w_size-le?e.strstart-(e.w_size-le):0,f=e.window,c=e.w_mask,l=e.prev,h=e.strstart+ce;let d=f[o+a-1],p=f[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,f[r+a]===p&&f[r+a-1]===d&&f[r]===f[o]&&f[++r]===f[o+1]){o+=2,r++;do{}while(f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&f[++o]===f[++r]&&o<h);if(n=ce-(h-o),o=h-ce,n>a){if(e.match_start=t,a=n,n>=s)break;d=f[o+a-1],p=f[o+a]}}}while((t=l[t&c])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead},Ae=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-le)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),me(e),n+=t),0===e.strm.avail_in)break;if(r=ke(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=ve(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=ve(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<le&&0!==e.strm.avail_in)},Pe=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==$||t===W||r!==n+e.strm.avail_in))break;a=t===$&&r===n+e.strm.avail_in?1:0,K(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,we(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(ke(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==W&&t!==$&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(ke(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===$)&&t!==W&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,a=t===$&&0===e.strm.avail_in&&r===n?1:0,K(e,e.block_start,r,a),e.block_start+=r,we(e.strm)),a?3:1)},Ie=(e,t)=>{let r,n;for(;;){if(e.lookahead<le){if(Ae(e),e.lookahead<le&&t===W)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=ve(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-le&&(e.match_length=Te(e,r)),e.match_length>=3)if(n=V(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=ve(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ve(e,e.ins_h,e.window[e.strstart+1]);else n=V(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(_e(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===$?(_e(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(_e(e,!1),0===e.strm.avail_out)?1:2},Oe=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<le){if(Ae(e),e.lookahead<le&&t===W)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=ve(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-le&&(e.match_length=Te(e,r),e.match_length<=5&&(e.strategy===ne||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=V(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=ve(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(_e(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=V(e,0,e.window[e.strstart-1]),n&&_e(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=V(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===$?(_e(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(_e(e,!1),0===e.strm.avail_out)?1:2};function xe(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const Me=[new xe(0,0,0,0,Pe),new xe(4,4,8,4,Ie),new xe(4,5,16,8,Ie),new xe(4,6,32,32,Ie),new xe(4,4,16,16,Oe),new xe(8,16,32,32,Oe),new xe(8,16,128,128,Oe),new xe(8,32,128,256,Oe),new xe(32,128,258,1024,Oe),new xe(32,258,258,4096,Oe)];function Ne(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=fe,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),be(this.dyn_ltree),be(this.dyn_dtree),be(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),be(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),be(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const Re=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==he&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==de&&t.status!==pe?1:0},Be=e=>{if(Re(e))return ye(e,Q);e.total_in=e.total_out=0,e.data_type=ue;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?he:de,e.adler=2===t.wrap?0:1,t.last_flush=-2,F(t),Y},Ce=e=>{const t=Be(e);var r;return t===Y&&((r=e.state).window_size=2*r.w_size,be(r.head),r.max_lazy_match=Me[r.level].max_lazy,r.good_match=Me[r.level].good_length,r.nice_match=Me[r.level].nice_length,r.max_chain_length=Me[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},Le=(e,t,r,n,i,o)=>{if(!e)return Q;let a=1;if(t===re&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==fe||n<8||n>15||t<0||t>9||o<0||o>ae||8===n&&1!==a)return ye(e,Q);8===n&&(n=9);const s=new Ne;return e.state=s,s.strm=e,s.status=he,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,Ce(e)};var Ue={deflateInit:(e,t)=>Le(e,t,fe,15,8,se),deflateInit2:Le,deflateReset:Ce,deflateResetKeep:Be,deflateSetHeader:(e,t)=>Re(e)||2!==e.state.wrap?Q:(e.state.gzhead=t,Y),deflate:(e,t)=>{if(Re(e)||t>Z||t<0)return e?ye(e,Q):Q;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===pe&&t!==$)return ye(e,0===e.avail_out?te:Q);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(we(e),0===e.avail_out)return r.last_flush=-1,Y}else if(0===e.avail_in&&ge(t)<=ge(n)&&t!==$)return ye(e,te);if(r.status===pe&&0!==e.avail_in)return ye(e,te);if(r.status===he&&0===r.wrap&&(r.status=de),r.status===he){let t=fe+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=ie||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,Se(r,t),0!==r.strstart&&(Se(r,e.adler>>>16),Se(r,65535&e.adler)),e.adler=1,r.status=de,we(e),0!==r.pending)return r.last_flush=-1,Y}if(57===r.status)if(e.adler=0,Ee(r,31),Ee(r,139),Ee(r,8),r.gzhead)Ee(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Ee(r,255&r.gzhead.time),Ee(r,r.gzhead.time>>8&255),Ee(r,r.gzhead.time>>16&255),Ee(r,r.gzhead.time>>24&255),Ee(r,9===r.level?2:r.strategy>=ie||r.level<2?4:0),Ee(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Ee(r,255&r.gzhead.extra.length),Ee(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=D(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Ee(r,0),Ee(r,0),Ee(r,0),Ee(r,0),Ee(r,0),Ee(r,9===r.level?2:r.strategy>=ie||r.level<2?4:0),Ee(r,3),r.status=de,we(e),0!==r.pending)return r.last_flush=-1,Y;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=D(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,we(e),0!==r.pending)return r.last_flush=-1,Y;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=D(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=D(e.adler,r.pending_buf,r.pending-n,n)),we(e),0!==r.pending)return r.last_flush=-1,Y;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Ee(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=D(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=D(e.adler,r.pending_buf,r.pending-n,n)),we(e),0!==r.pending)return r.last_flush=-1,Y;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Ee(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=D(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(we(e),0!==r.pending))return r.last_flush=-1,Y;Ee(r,255&e.adler),Ee(r,e.adler>>8&255),e.adler=0}if(r.status=de,we(e),0!==r.pending)return r.last_flush=-1,Y}if(0!==e.avail_in||0!==r.lookahead||t!==W&&r.status!==pe){let n=0===r.level?Pe(r,t):r.strategy===ie?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(Ae(e),0===e.lookahead)){if(t===W)return 1;break}if(e.match_length=0,r=V(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(_e(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===$?(_e(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(_e(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===oe?((e,t)=>{let r,n,i,o;const a=e.window;for(;;){if(e.lookahead<=ce){if(Ae(e),e.lookahead<=ce&&t===W)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+ce;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=ce-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=V(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=V(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(_e(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===$?(_e(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(_e(e,!1),0===e.strm.avail_out)?1:2})(r,t):Me[r.level].func(r,t);if(3!==n&&4!==n||(r.status=pe),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),Y;if(2===n&&(t===q?z(r):t!==Z&&(K(r,0,0,!1),t===X&&(be(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),we(e),0===e.avail_out))return r.last_flush=-1,Y}return t!==$?Y:r.wrap<=0?J:(2===r.wrap?(Ee(r,255&e.adler),Ee(r,e.adler>>8&255),Ee(r,e.adler>>16&255),Ee(r,e.adler>>24&255),Ee(r,255&e.total_in),Ee(r,e.total_in>>8&255),Ee(r,e.total_in>>16&255),Ee(r,e.total_in>>24&255)):(Se(r,e.adler>>>16),Se(r,65535&e.adler)),we(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Y:J)},deflateEnd:e=>{if(Re(e))return Q;const t=e.state.status;return e.state=null,t===de?ye(e,ee):Y},deflateSetDictionary:(e,t)=>{let r=t.length;if(Re(e))return Q;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==he||n.lookahead)return Q;if(1===i&&(e.adler=L(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(be(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,Ae(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=ve(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,Ae(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,n.wrap=i,Y},deflateInfo:"pako deflate (from Nodeca project)"};const De=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var je={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)De(r,t)&&(e[t]=r[t])}}return e},flattenChunks:e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r}};let He=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){He=!1}const Fe=new Uint8Array(256);for(let e=0;e<256;e++)Fe[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;Fe[254]=Fe[254]=1;var Ke={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},buf2string:(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=Fe[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&He)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Fe[e[r]]>t?r:t}},Ge=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Ve=Object.prototype.toString,{Z_NO_FLUSH:ze,Z_SYNC_FLUSH:We,Z_FULL_FLUSH:qe,Z_FINISH:Xe,Z_OK:$e,Z_STREAM_END:Ze,Z_DEFAULT_COMPRESSION:Ye,Z_DEFAULT_STRATEGY:Je,Z_DEFLATED:Qe}=H;function et(e){this.options=je.assign({level:Ye,method:Qe,chunkSize:16384,windowBits:15,memLevel:8,strategy:Je},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ge,this.strm.avail_out=0;let r=Ue.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==$e)throw new Error(j[r]);if(t.header&&Ue.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Ke.string2buf(t.dictionary):"[object ArrayBuffer]"===Ve.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=Ue.deflateSetDictionary(this.strm,e),r!==$e)throw new Error(j[r]);this._dict_set=!0}}function tt(e,t){const r=new et(t);if(r.push(e,!0),r.err)throw r.msg||j[r.err];return r.result}et.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Xe:ze,"string"==typeof e?r.input=Ke.string2buf(e):"[object ArrayBuffer]"===Ve.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===We||o===qe)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=Ue.deflate(r,o),i===Ze)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Ue.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===$e;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},et.prototype.onData=function(e){this.chunks.push(e)},et.prototype.onEnd=function(e){e===$e&&(this.result=je.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var rt={Deflate:et,deflate:tt,deflateRaw:function(e,t){return(t=t||{}).raw=!0,tt(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,tt(e,t)},constants:H};const nt=16209;var it=function(e,t){let r,n,i,o,a,s,u,f,c,l,h,d,p,y,g,b,m,v,w,_,E,S,k,T;const A=e.state;r=e.next_in,k=e.input,n=r+(e.avail_in-5),i=e.next_out,T=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=A.dmax,u=A.wsize,f=A.whave,c=A.wnext,l=A.window,h=A.hold,d=A.bits,p=A.lencode,y=A.distcode,g=(1<<A.lenbits)-1,b=(1<<A.distbits)-1;e:do{d<15&&(h+=k[r++]<<d,d+=8,h+=k[r++]<<d,d+=8),m=p[h&g];t:for(;;){if(v=m>>>24,h>>>=v,d-=v,v=m>>>16&255,0===v)T[i++]=65535&m;else{if(!(16&v)){if(64&v){if(32&v){A.mode=16191;break e}e.msg="invalid literal/length code",A.mode=nt;break e}m=p[(65535&m)+(h&(1<<v)-1)];continue t}for(w=65535&m,v&=15,v&&(d<v&&(h+=k[r++]<<d,d+=8),w+=h&(1<<v)-1,h>>>=v,d-=v),d<15&&(h+=k[r++]<<d,d+=8,h+=k[r++]<<d,d+=8),m=y[h&b];;){if(v=m>>>24,h>>>=v,d-=v,v=m>>>16&255,16&v){if(_=65535&m,v&=15,d<v&&(h+=k[r++]<<d,d+=8,d<v&&(h+=k[r++]<<d,d+=8)),_+=h&(1<<v)-1,_>s){e.msg="invalid distance too far back",A.mode=nt;break e}if(h>>>=v,d-=v,v=i-o,_>v){if(v=_-v,v>f&&A.sane){e.msg="invalid distance too far back",A.mode=nt;break e}if(E=0,S=l,0===c){if(E+=u-v,v<w){w-=v;do{T[i++]=l[E++]}while(--v);E=i-_,S=T}}else if(c<v){if(E+=u+c-v,v-=c,v<w){w-=v;do{T[i++]=l[E++]}while(--v);if(E=0,c<w){v=c,w-=v;do{T[i++]=l[E++]}while(--v);E=i-_,S=T}}}else if(E+=c-v,v<w){w-=v;do{T[i++]=l[E++]}while(--v);E=i-_,S=T}for(;w>2;)T[i++]=S[E++],T[i++]=S[E++],T[i++]=S[E++],w-=3;w&&(T[i++]=S[E++],w>1&&(T[i++]=S[E++]))}else{E=i-_;do{T[i++]=T[E++],T[i++]=T[E++],T[i++]=T[E++],w-=3}while(w>2);w&&(T[i++]=T[E++],w>1&&(T[i++]=T[E++]))}break}if(64&v){e.msg="invalid distance code",A.mode=nt;break e}m=y[(65535&m)+(h&(1<<v)-1)]}}break}}while(r<n&&i<a);w=d>>3,r-=w,d-=w<<3,h&=(1<<d)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<a?a-i+257:257-(i-a),A.hold=h,A.bits=d};const ot=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),at=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),st=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ut=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var ft=(e,t,r,n,i,o,a,s)=>{const u=s.bits;let f,c,l,h,d,p,y=0,g=0,b=0,m=0,v=0,w=0,_=0,E=0,S=0,k=0,T=null;const A=new Uint16Array(16),P=new Uint16Array(16);let I,O,x,M=null;for(y=0;y<=15;y++)A[y]=0;for(g=0;g<n;g++)A[t[r+g]]++;for(v=u,m=15;m>=1&&0===A[m];m--);if(v>m&&(v=m),0===m)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(b=1;b<m&&0===A[b];b++);for(v<b&&(v=b),E=1,y=1;y<=15;y++)if(E<<=1,E-=A[y],E<0)return-1;if(E>0&&(0===e||1!==m))return-1;for(P[1]=0,y=1;y<15;y++)P[y+1]=P[y]+A[y];for(g=0;g<n;g++)0!==t[r+g]&&(a[P[t[r+g]]++]=g);if(0===e?(T=M=a,p=20):1===e?(T=ot,M=at,p=257):(T=st,M=ut,p=0),k=0,g=0,y=b,d=o,w=v,_=0,l=-1,S=1<<v,h=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){I=y-_,a[g]+1<p?(O=0,x=a[g]):a[g]>=p?(O=M[a[g]-p],x=T[a[g]-p]):(O=96,x=0),f=1<<y-_,c=1<<w,b=c;do{c-=f,i[d+(k>>_)+c]=I<<24|O<<16|x}while(0!==c);for(f=1<<y-1;k&f;)f>>=1;if(0!==f?(k&=f-1,k+=f):k=0,g++,0==--A[y]){if(y===m)break;y=t[r+a[g]]}if(y>v&&(k&h)!==l){for(0===_&&(_=v),d+=b,w=y-_,E=1<<w;w+_<m&&(E-=A[w+_],!(E<=0));)w++,E<<=1;if(S+=1<<w,1===e&&S>852||2===e&&S>592)return 1;l=k&h,i[l]=v<<24|w<<16|d-o}}return 0!==k&&(i[d+k]=y-_<<24|64<<16),s.bits=v,0};const{Z_FINISH:ct,Z_BLOCK:lt,Z_TREES:ht,Z_OK:dt,Z_STREAM_END:pt,Z_NEED_DICT:yt,Z_STREAM_ERROR:gt,Z_DATA_ERROR:bt,Z_MEM_ERROR:mt,Z_BUF_ERROR:vt,Z_DEFLATED:wt}=H,_t=16180,Et=16190,St=16191,kt=16192,Tt=16194,At=16199,Pt=16200,It=16206,Ot=16209,xt=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function Mt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const Nt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<_t||t.mode>16211?1:0},Rt=e=>{if(Nt(e))return gt;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=_t,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,dt},Bt=e=>{if(Nt(e))return gt;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Rt(e)},Ct=(e,t)=>{let r;if(Nt(e))return gt;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?gt:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Bt(e))},Lt=(e,t)=>{if(!e)return gt;const r=new Mt;e.state=r,r.strm=e,r.window=null,r.mode=_t;const n=Ct(e,t);return n!==dt&&(e.state=null),n};let Ut,Dt,jt=!0;const Ht=e=>{if(jt){Ut=new Int32Array(512),Dt=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ft(1,e.lens,0,288,Ut,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ft(2,e.lens,0,32,Dt,0,e.work,{bits:5}),jt=!1}e.lencode=Ut,e.lenbits=9,e.distcode=Dt,e.distbits=5},Ft=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Kt={inflateReset:Bt,inflateReset2:Ct,inflateResetKeep:Rt,inflateInit:e=>Lt(e,15),inflateInit2:Lt,inflate:(e,t)=>{let r,n,i,o,a,s,u,f,c,l,h,d,p,y,g,b,m,v,w,_,E,S,k=0;const T=new Uint8Array(4);let A,P;const I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Nt(e)||!e.output||!e.input&&0!==e.avail_in)return gt;r=e.state,r.mode===St&&(r.mode=kt),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,f=r.hold,c=r.bits,l=s,h=u,S=dt;e:for(;;)switch(r.mode){case _t:if(0===r.wrap){r.mode=kt;break}for(;c<16;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(2&r.wrap&&35615===f){0===r.wbits&&(r.wbits=15),r.check=0,T[0]=255&f,T[1]=f>>>8&255,r.check=D(r.check,T,2,0),f=0,c=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&f)<<8)+(f>>8))%31){e.msg="incorrect header check",r.mode=Ot;break}if((15&f)!==wt){e.msg="unknown compression method",r.mode=Ot;break}if(f>>>=4,c-=4,E=8+(15&f),0===r.wbits&&(r.wbits=E),E>15||E>r.wbits){e.msg="invalid window size",r.mode=Ot;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&f?16189:St,f=0,c=0;break;case 16181:for(;c<16;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(r.flags=f,(255&r.flags)!==wt){e.msg="unknown compression method",r.mode=Ot;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=Ot;break}r.head&&(r.head.text=f>>8&1),512&r.flags&&4&r.wrap&&(T[0]=255&f,T[1]=f>>>8&255,r.check=D(r.check,T,2,0)),f=0,c=0,r.mode=16182;case 16182:for(;c<32;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}r.head&&(r.head.time=f),512&r.flags&&4&r.wrap&&(T[0]=255&f,T[1]=f>>>8&255,T[2]=f>>>16&255,T[3]=f>>>24&255,r.check=D(r.check,T,4,0)),f=0,c=0,r.mode=16183;case 16183:for(;c<16;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}r.head&&(r.head.xflags=255&f,r.head.os=f>>8),512&r.flags&&4&r.wrap&&(T[0]=255&f,T[1]=f>>>8&255,r.check=D(r.check,T,2,0)),f=0,c=0,r.mode=16184;case 16184:if(1024&r.flags){for(;c<16;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}r.length=f,r.head&&(r.head.extra_len=f),512&r.flags&&4&r.wrap&&(T[0]=255&f,T[1]=f>>>8&255,r.check=D(r.check,T,2,0)),f=0,c=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(d=r.length,d>s&&(d=s),d&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+d),E)),512&r.flags&&4&r.wrap&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,r.length-=d),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&d<s);if(512&r.flags&&4&r.wrap&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;d=0;do{E=n[o+d++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&d<s);if(512&r.flags&&4&r.wrap&&(r.check=D(r.check,n,d,o)),s-=d,o+=d,E)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;c<16;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(4&r.wrap&&f!==(65535&r.check)){e.msg="header crc mismatch",r.mode=Ot;break}f=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=St;break;case 16189:for(;c<32;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}e.adler=r.check=xt(f),f=0,c=0,r.mode=Et;case Et:if(0===r.havedict)return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=f,r.bits=c,yt;e.adler=r.check=1,r.mode=St;case St:if(t===lt||t===ht)break e;case kt:if(r.last){f>>>=7&c,c-=7&c,r.mode=It;break}for(;c<3;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}switch(r.last=1&f,f>>>=1,c-=1,3&f){case 0:r.mode=16193;break;case 1:if(Ht(r),r.mode=At,t===ht){f>>>=2,c-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=Ot}f>>>=2,c-=2;break;case 16193:for(f>>>=7&c,c-=7&c;c<32;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if((65535&f)!=(f>>>16^65535)){e.msg="invalid stored block lengths",r.mode=Ot;break}if(r.length=65535&f,f=0,c=0,r.mode=Tt,t===ht)break e;case Tt:r.mode=16195;case 16195:if(d=r.length,d){if(d>s&&(d=s),d>u&&(d=u),0===d)break e;i.set(n.subarray(o,o+d),a),s-=d,o+=d,u-=d,a+=d,r.length-=d;break}r.mode=St;break;case 16196:for(;c<14;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(r.nlen=257+(31&f),f>>>=5,c-=5,r.ndist=1+(31&f),f>>>=5,c-=5,r.ncode=4+(15&f),f>>>=4,c-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=Ot;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;c<3;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}r.lens[I[r.have++]]=7&f,f>>>=3,c-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},S=ft(0,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,S){e.msg="invalid code lengths set",r.mode=Ot;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;k=r.lencode[f&(1<<r.lenbits)-1],g=k>>>24,b=k>>>16&255,m=65535&k,!(g<=c);){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(m<16)f>>>=g,c-=g,r.lens[r.have++]=m;else{if(16===m){for(P=g+2;c<P;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(f>>>=g,c-=g,0===r.have){e.msg="invalid bit length repeat",r.mode=Ot;break}E=r.lens[r.have-1],d=3+(3&f),f>>>=2,c-=2}else if(17===m){for(P=g+3;c<P;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}f>>>=g,c-=g,E=0,d=3+(7&f),f>>>=3,c-=3}else{for(P=g+7;c<P;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}f>>>=g,c-=g,E=0,d=11+(127&f),f>>>=7,c-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=Ot;break}for(;d--;)r.lens[r.have++]=E}}if(r.mode===Ot)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=Ot;break}if(r.lenbits=9,A={bits:r.lenbits},S=ft(1,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,S){e.msg="invalid literal/lengths set",r.mode=Ot;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},S=ft(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,S){e.msg="invalid distances set",r.mode=Ot;break}if(r.mode=At,t===ht)break e;case At:r.mode=Pt;case Pt:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=f,r.bits=c,it(e,h),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,f=r.hold,c=r.bits,r.mode===St&&(r.back=-1);break}for(r.back=0;k=r.lencode[f&(1<<r.lenbits)-1],g=k>>>24,b=k>>>16&255,m=65535&k,!(g<=c);){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(b&&!(240&b)){for(v=g,w=b,_=m;k=r.lencode[_+((f&(1<<v+w)-1)>>v)],g=k>>>24,b=k>>>16&255,m=65535&k,!(v+g<=c);){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}f>>>=v,c-=v,r.back+=v}if(f>>>=g,c-=g,r.back+=g,r.length=m,0===b){r.mode=16205;break}if(32&b){r.back=-1,r.mode=St;break}if(64&b){e.msg="invalid literal/length code",r.mode=Ot;break}r.extra=15&b,r.mode=16201;case 16201:if(r.extra){for(P=r.extra;c<P;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}r.length+=f&(1<<r.extra)-1,f>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;k=r.distcode[f&(1<<r.distbits)-1],g=k>>>24,b=k>>>16&255,m=65535&k,!(g<=c);){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(!(240&b)){for(v=g,w=b,_=m;k=r.distcode[_+((f&(1<<v+w)-1)>>v)],g=k>>>24,b=k>>>16&255,m=65535&k,!(v+g<=c);){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}f>>>=v,c-=v,r.back+=v}if(f>>>=g,c-=g,r.back+=g,64&b){e.msg="invalid distance code",r.mode=Ot;break}r.offset=m,r.extra=15&b,r.mode=16203;case 16203:if(r.extra){for(P=r.extra;c<P;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}r.offset+=f&(1<<r.extra)-1,f>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=Ot;break}r.mode=16204;case 16204:if(0===u)break e;if(d=h-u,r.offset>d){if(d=r.offset-d,d>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=Ot;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),y=r.window}else y=i,p=a-r.offset,d=r.length;d>u&&(d=u),u-=d,r.length-=d;do{i[a++]=y[p++]}while(--d);0===r.length&&(r.mode=Pt);break;case 16205:if(0===u)break e;i[a++]=r.length,u--,r.mode=Pt;break;case It:if(r.wrap){for(;c<32;){if(0===s)break e;s--,f|=n[o++]<<c,c+=8}if(h-=u,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?D(r.check,i,h,a-h):L(r.check,i,h,a-h)),h=u,4&r.wrap&&(r.flags?f:xt(f))!==r.check){e.msg="incorrect data check",r.mode=Ot;break}f=0,c=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;c<32;){if(0===s)break e;s--,f+=n[o++]<<c,c+=8}if(4&r.wrap&&f!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=Ot;break}f=0,c=0}r.mode=16208;case 16208:S=pt;break e;case Ot:S=bt;break e;case 16210:return mt;default:return gt}return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=f,r.bits=c,(r.wsize||h!==e.avail_out&&r.mode<Ot&&(r.mode<It||t!==ct))&&Ft(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?D(r.check,i,h,e.next_out-h):L(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===St?128:0)+(r.mode===At||r.mode===Tt?256:0),(0===l&&0===h||t===ct)&&S===dt&&(S=vt),S},inflateEnd:e=>{if(Nt(e))return gt;let t=e.state;return t.window&&(t.window=null),e.state=null,dt},inflateGetHeader:(e,t)=>{if(Nt(e))return gt;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,dt):gt},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return Nt(e)?gt:(n=e.state,0!==n.wrap&&n.mode!==Et?gt:n.mode===Et&&(i=1,i=L(i,t,r,0),i!==n.check)?bt:(o=Ft(e,t,r,r),o?(n.mode=16210,mt):(n.havedict=1,dt)))},inflateInfo:"pako inflate (from Nodeca project)"},Gt=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Vt=Object.prototype.toString,{Z_NO_FLUSH:zt,Z_FINISH:Wt,Z_OK:qt,Z_STREAM_END:Xt,Z_NEED_DICT:$t,Z_STREAM_ERROR:Zt,Z_DATA_ERROR:Yt,Z_MEM_ERROR:Jt}=H;function Qt(e){this.options=je.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ge,this.strm.avail_out=0;let r=Kt.inflateInit2(this.strm,t.windowBits);if(r!==qt)throw new Error(j[r]);if(this.header=new Gt,Kt.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Ke.string2buf(t.dictionary):"[object ArrayBuffer]"===Vt.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Kt.inflateSetDictionary(this.strm,t.dictionary),r!==qt)))throw new Error(j[r])}function er(e,t){const r=new Qt(t);if(r.push(e),r.err)throw r.msg||j[r.err];return r.result}Qt.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Wt:zt,"[object ArrayBuffer]"===Vt.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Kt.inflate(r,a),o===$t&&i&&(o=Kt.inflateSetDictionary(r,i),o===qt?o=Kt.inflate(r,a):o===Yt&&(o=$t));r.avail_in>0&&o===Xt&&r.state.wrap>0&&0!==e[r.next_in];)Kt.inflateReset(r),o=Kt.inflate(r,a);switch(o){case Zt:case Yt:case $t:case Jt:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===Xt))if("string"===this.options.to){let e=Ke.utf8border(r.output,r.next_out),t=r.next_out-e,i=Ke.buf2string(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==qt||0!==s){if(o===Xt)return o=Kt.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Qt.prototype.onData=function(e){this.chunks.push(e)},Qt.prototype.onEnd=function(e){e===qt&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=je.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var tr={Inflate:Qt,inflate:er,inflateRaw:function(e,t){return(t=t||{}).raw=!0,er(e,t)},ungzip:er,constants:H};const{Deflate:rr,deflate:nr,deflateRaw:ir,gzip:or}=rt,{Inflate:ar,inflate:sr,inflateRaw:ur,ungzip:fr}=tr;var cr={Deflate:rr,deflate:nr,deflateRaw:ir,gzip:or,Inflate:ar,inflate:sr,inflateRaw:ur,ungzip:fr,constants:H},lr=r(8287).Buffer;function hr(e){return hr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hr(e)}function dr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,pr(n.key),n)}}function pr(e){var t=function(e,t){if("object"!=hr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=hr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==hr(t)?t:t+""}var yr,gr,br,mr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,r=[{key:"compress",value:function(t){return lr.from(cr.gzip(t,e.zlibOptions))}},{key:"decompress",value:function(e){return lr.from(cr.ungzip(e))}}],null&&dr(t.prototype,null),r&&dr(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();yr=mr,br={level:9},(gr=pr(gr="zlibOptions"))in yr?Object.defineProperty(yr,gr,{value:br,enumerable:!0,configurable:!0,writable:!0}):yr[gr]=br},3539:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{i:()=>f});var i=r(9004),o=r(2343),a=r(1757),s=r(6647),u=e([s]);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=p(e,"string");return"symbol"==c(t)?t:t+""}function p(e,t){if("object"!=c(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}s=(u.then?(await u)():u)[0],(0,a.f0)(s);var f=function(){return e=function e(){l(this,e)},t=[{key:"generatePKSH",value:function(e,t){if(32!==e.length)throw new Error("Invalid hash length");var r=this.ripemd160(e);return this.toSegwitAddress(r,t)}},{key:"ripemd160",value:function(e){return(0,i.n1)("ripemd160").update(e).digest()}},{key:"toSegwitAddress",value:function(e,t){var r=o.bech32.toWords(e);return r.unshift(0),o.bech32.encode(t.bech32,r)}}],null&&h(e.prototype,null),t&&h(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(y){n(y)}}))},5901:(e,t,r)=>{r.d(t,{W:()=>f});var n=r(1757),i=r(8287).Buffer;function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function s(e,t,r){return(t=u(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var f=function(){function e(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"senderPubKey",void 0),s(this,"contractSaltPubKey",void 0),s(this,"network",n.o8.bitcoin),this.senderPubKey=t,this.contractSaltPubKey=r,this.network=i}return t=e,r=[{key:"splitBufferIntoChunks",value:function(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DATA_CHUNK_SIZE,n=[],o=0;o<t.length;o+=r){for(var a=Math.min(r,t.length-o),s=i.alloc(a),u=0;u<a;u++)s.writeUInt8(t[o+u],u);n.push([s])}return n}}],r&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();s(f,"DATA_CHUNK_SIZE",512),s(f,"MAGIC",i.from("bsi","utf-8"))},9068:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{G:()=>c});var i=r(1757),o=r(374),a=r(5901),s=r(154),u=r(8287).Buffer,f=e([s]);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function h(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=y(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function d(e){return b(e)||g(e)||y(e)||p()}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e,t){if(e){if("string"==typeof e)return m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function g(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function b(e){if(Array.isArray(e))return m(e)}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_(n.key),n)}}function _(e){var t=E(e,"string");return"symbol"==l(t)?t:t+""}function E(e,t){if("object"!=l(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function S(e,t){if(t&&("object"==l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return k(e)}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(T=function(){return!!e})()}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}function P(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&I(e,t)}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}s=(f.then?(await f)():f)[0];var c=function(e){function t(e,r){var n,o,a,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.o8.bitcoin;return v(this,t),n=this,a=[e,r,s],o=A(o=t),S(n,T()?Reflect.construct(o,a||[],A(n).constructor):o.apply(n,a))}return P(t,e),r=t,n=[{key:"compile",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=this.splitBufferIntoChunks(e);if(!s.length)throw new Error("No data chunks found");var f=[this.senderPubKey,i.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,i.Ez.OP_CHECKSIGVERIFY,i.Ez.OP_HASH160,i.Et.hash160(this.senderPubKey),i.Ez.OP_EQUALVERIFY,i.Ez.OP_HASH160,i.Et.hash160(t),i.Ez.OP_EQUALVERIFY,i.Ez.OP_DEPTH,i.Ez.OP_1,i.Ez.OP_NUMEQUAL,i.Ez.OP_IF,a.W.MAGIC];if(n.length>0){var c,l,h=this.getPubKeyAsBuffer(n),p=this.splitBufferIntoChunks(h);if(f=(c=f).concat.apply(c,[i.Ez.OP_0].concat(d(p))),!o)throw new Error("Minimum signatures must be provided");if(o>255)throw new Error("Minimum signatures cannot exceed 255");var y=u.alloc(2);y.writeUint16LE(o,0),f=(l=f).concat.apply(l,[i.Ez.OP_1,y])}var g=(f=(r=f).concat.apply(r,[i.Ez.OP_1NEGATE].concat(d(s),[i.Ez.OP_ELSE,i.Ez.OP_1,i.Ez.OP_ENDIF]))).flat(),b=i.K$.compile(g);if(!i.K$.decompile(b))throw new Error("Failed to decompile script??");return b}},{key:"getPubKeyAsBuffer",value:function(e){var t,r=u.alloc(0),n=h(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(!s.k.fromPublicKey(i,this.network).compressed)throw new Error("Public key must be compressed");if(33!==i.byteLength)throw new Error("Public key must be 33 bytes, got ".concat(i.byteLength," bytes."));r=u.concat([r,i])}}catch(e){n.e(e)}finally{n.f()}var a=o.w.compress(r);return a.byteLength>=r.byteLength?r:a}}],n&&w(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(a.W);n()}catch(O){n(O)}}))},7061:(e,t,r)=>{r.d(t,{z:()=>d});var n=r(1757),i=r(5901);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,u(n.key),n)}}function u(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}function f(e,t,r){return t=l(t),function(e,t){if(t&&("object"==o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,c()?Reflect.construct(t,r||[],l(e).constructor):t.apply(e,r))}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(c=function(){return!!e})()}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}var d=function(e){function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),f(this,t,[e,r,i])}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(t,e),r=t,(o=[{key:"compile",value:function(e,t){var r=this.getAsm(e,t),i=n.K$.compile(r);if(!n.K$.decompile(i))throw new Error("Failed to decompile script??");return i}},{key:"getAsm",value:function(e,t){var r=this.splitBufferIntoChunks(e);return[this.senderPubKey,n.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,n.Ez.OP_CHECKSIGVERIFY,n.Ez.OP_HASH160,n.Et.hash160(this.senderPubKey),n.Ez.OP_EQUALVERIFY,n.Ez.OP_HASH256,n.Et.hash256(t),n.Ez.OP_EQUALVERIFY,n.Ez.OP_DEPTH,n.Ez.OP_1,n.Ez.OP_NUMEQUAL,n.Ez.OP_IF,i.W.MAGIC,n.Ez.OP_1NEGATE].concat(function(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r),[n.Ez.OP_ELSE,n.Ez.OP_1,n.Ez.OP_ENDIF]).flat()}}])&&s(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o}(i.W)},4317:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{$7:()=>i,Bc:()=>i.InteractionTransaction,D_:()=>i.TransactionType,G7:()=>i.BitcoinUtils,GF:()=>i.CalldataGenerator,P8:()=>i.ContractBaseMetadata,Qc:()=>i.TransactionBuilder,Wj:()=>i.Generator,aS:()=>i.TweakedSigner,cC:()=>i.FundingTransaction,dF:()=>i.TransactionFactory,iy:()=>i.AddressGenerator,kd:()=>i.EcKeyPair,rE:()=>i.version,rR:()=>i.wBTC,tm:()=>i.TapscriptVerificator,uW:()=>i.Wallet,wf:()=>i.Compressor,y4:()=>i.UTXOManager,z4:()=>i.DeploymentGenerator});var i=r(3827),o=e([i]);i=(o.then?(await o)():o)[0],n()}catch(e){n(e)}}))},154:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{k:()=>l});var i=r(852),o=r(1757),a=r(8700),s=r(6647),u=r(8287).Buffer,f=e([s]);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function y(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=b(e,"string");return"symbol"==h(t)?t:t+""}function b(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}s=(f.then?(await f)():f)[0],(0,o.f0)(s);var c="function"==typeof i.Ay?i.Ay:i.Ay.BIP32Factory,l=function(){function e(){d(this,e)}return t=e,r=[{key:"fromWIF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.ECPair.fromWIF(e,t)}},{key:"fromPrivateKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.ECPair.fromPrivateKey(e,{network:t})}},{key:"fromPublicKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.ECPair.fromPublicKey(e,{network:t})}},{key:"generateMultiSigAddress",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.o8.bitcoin,n=this.verifyPubKeys(e,r),i=o.KT.p2wsh({redeem:o.KT.p2ms({m:t,pubkeys:n,network:r}),network:r}).address;if(!i)throw new Error("Failed to generate address");return i}},{key:"verifyPubKeys",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return t.map((function(t){var n=e.fromPublicKey(t,r);if(!n)throw new Error("Failed to regenerate key");return n.publicKey}))}},{key:"getP2WPKHAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=o.KT.p2wpkh({pubkey:e.publicKey,network:t});if(!r.address)throw new Error("Failed to generate wallet");return r.address}},{key:"generateWallet",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.o8.bitcoin,t=this.ECPair.makeRandom({network:e}),r=this.getP2WPKHAddress(t,e);if(!r)throw new Error("Failed to generate wallet");return{address:r,privateKey:t.toWIF(),publicKey:t.publicKey.toString("hex")}}},{key:"verifyContractAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return!!o.hl.toOutputScript(e,t)}},{key:"getLegacyAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=o.KT.p2pkh({pubkey:e.publicKey,network:t});if(!r.address)throw new Error("Failed to generate wallet");return r.address}},{key:"generateRandomKeyPair",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.o8.bitcoin;return this.ECPair.makeRandom({network:e})}},{key:"fromSeed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;return this.BIP32.fromSeed(e,t)}},{key:"getTaprootAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=e.publicKey.slice(1,33),n=u.concat([u.from([81,32]),r]);return o.hl.fromOutputScript(n,t)}},{key:"getTaprootAddressFromAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=o.KT.p2tr({address:e,network:t}).address;if(!r)throw new Error("Failed to generate sender address for transaction");return r}},{key:"fromSeedKeyPair",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin,r=this.BIP32.fromSeed(e,t).privateKey;if(!r)throw new Error("Failed to generate key pair");return this.ECPair.fromPrivateKey(r,{network:t})}}],null&&p(t.prototype,null),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();y(l,"BIP32",c(s)),y(l,"ECPair",(0,a.dg)(s)),n()}catch(m){n(m)}}))},8652:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{u:()=>u});var i=r(154),o=r(1757),a=r(477),s=e([i]);function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function h(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){var t=p(e,"string");return"symbol"==f(t)?t:t+""}function p(e,t){if("object"!=f(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}i=(s.then?(await s)():s)[0];var u=function(){return e=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.o8.bitcoin;c(this,e),h(this,"network",void 0),h(this,"_keypair",void 0),h(this,"_p2wpkh",void 0),h(this,"_p2tr",void 0),this.network=r,this._keypair=i.k.fromWIF(t.privateKey,this.network),this._p2wpkh=i.k.getP2WPKHAddress(this._keypair,this.network),this._p2tr=i.k.getTaprootAddress(this._keypair,this.network)},(t=[{key:"keypair",get:function(){if(!this._keypair)throw new Error("Keypair not set");return this._keypair}},{key:"p2wpkh",get:function(){return this._p2wpkh}},{key:"p2tr",get:function(){return this._p2tr}},{key:"publicKey",get:function(){if(!this.keypair)throw new Error("Keypair not set");return this.keypair.publicKey}},{key:"xOnly",get:function(){if(!this.keypair)throw new Error("Keypair not set");return(0,a.toXOnly)(this.keypair.publicKey)}}])&&l(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(y){n(y)}}))},525:(e,t,r)=>{r.d(t,{P:()=>s});var n=r(1757);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var s=function(){return e=function e(){var t,r,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,i=void 0,(r=a(r="network"))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,this.network=o},r=[{key:"getAddress",value:function(){throw arguments.length>0&&void 0!==arguments[0]||n.o8.bitcoin,new Error("Method not implemented.")}}],(t=[{key:"getAddress",value:function(){return this.address}}])&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}()},1419:(e,t,r)=>{r.d(t,{r:()=>h});var n=r(1757);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,l(n.key),n)}}function a(e,t,r){return t=u(t),function(e,t){if(t&&("object"==i(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,s()?Reflect.construct(t,r||[],u(e).constructor):t.apply(e,r))}function s(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(s=function(){return!!e})()}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function c(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var h=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),c(e=a(this,t,[r]),"network",void 0),c(e,"tokenName","Wrapped Bitcoin"),c(e,"tokenSymbol","wBTC"),c(e,"decimals",8),c(e,"address",void 0),e.network=r,e.address=t.getAddress(r),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(t,e),r=t,i=[{key:"getAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.o8.bitcoin;switch(e){case n.o8.bitcoin:case n.o8.regtest:return"bcrt1pcw0828yjrtlrc6mkp3lkq30j7wc7slsh7k7dyh53mrs4f8d74l6qumhqp4";case n.o8.testnet:return"tb1pq64lx73fwyrdp4asvl7xt5r5qvxvt9wy82x75taqtzvd64f58nasansurj";default:throw new Error("Invalid network: ".concat(e))}}}],null&&o(r.prototype,null),i&&o(r,i),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,i}(r(525).P)},3827:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.r(t),r.d(t,{AddressGenerator:()=>f.i,BitcoinUtils:()=>_.G,CalldataGenerator:()=>s.G,Compressor:()=>o.w,ContractBaseMetadata:()=>p.P,DeploymentGenerator:()=>u.z,EcKeyPair:()=>l.k,FundingTransaction:()=>v.c,Generator:()=>a.W,InteractionTransaction:()=>m.B,TapscriptVerificator:()=>c.t,TransactionBuilder:()=>w.Q,TransactionFactory:()=>g.d,TransactionType:()=>b.D,TweakedSigner:()=>y.a,UTXOManager:()=>E.y,Wallet:()=>h.u,version:()=>i.r,wBTC:()=>d.r});var i=r(4822),o=r(374),a=r(5901),s=r(9068),u=r(7061),f=r(3539),c=r(2569),l=r(154),h=r(8652),d=r(1419),p=r(525),y=r(4519),g=r(8582),b=r(3959),m=r(855),v=r(3608),w=r(2296),_=r(8284),E=r(9565),S=e([s,f,c,l,h,y,g,m,v,w]);[s,f,c,l,h,y,g,m,v,w]=S.then?(await S)():S,n()}catch(e){n(e)}}))},4519:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{a:()=>l});var i=r(1757),o=r(2218),a=r(477),s=r(6647),u=r(154),f=r(8287).Buffer,c=e([s,u]);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function y(e){var t=g(e,"string");return"symbol"==h(t)?t:t+""}function g(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[s,u]=c.then?(await c)():c,(0,i.f0)(s);var l=function(){return e=function e(){d(this,e)},t=[{key:"tweakSigner",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.privateKey;if(!r)throw new Error("Private key is required for tweaking signer!");3===e.publicKey[0]&&(r=s.privateNegate(r));var n=s.privateAdd(r,(0,o.tapTweakHash)((0,a.toXOnly)(e.publicKey),t.tweakHash));if(!n)throw new Error("Invalid tweaked private key!");return u.k.fromPrivateKey(f.from(n),t.network)}}],null&&p(e.prototype,null),t&&p(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(b){n(b)}}))},8582:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{d:()=>s});var i=r(3608),o=r(855),a=e([i,o]);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t,r){return(t=p(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=y(e,"string");return"symbol"==u(t)?t:t+""}function y(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[i,o]=a.then?(await a)():a;var s=function(){return e=function e(){h(this,e)},(t=[{key:"signInteraction",value:function(e){var t=new o.B(e);t.signTransaction();var r=t.getFundingTransactionParameters(),n=new i.c(r).signTransaction();if(!n)throw new Error("Could not sign funding transaction.");var a=n.outs[0],s={transactionId:n.getId(),outputIndex:0,scriptPubKey:{hex:a.script.toString("hex"),address:t.getScriptAddress()},value:BigInt(a.value)},u=c(c({},e),{},{utxos:[s],randomBytes:t.getRndBytes()}),f=new o.B(u).signTransaction();return[n.toHex(),f.toHex()]}}])&&d(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();n()}catch(g){n(g)}}))},3608:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{c:()=>s});var i=r(3959),o=r(2296),a=e([o]);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,m(n.key),n)}}function l(e,t){if(t&&("object"==u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(d=function(){return!!e})()}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&g(e,t)}function g(e,t){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},g(e,t)}function b(e,t,r){return(t=m(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){var t=v(e,"string");return"symbol"==u(t)?t:t+""}function v(e,t){if("object"!=u(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var s=function(e){function t(e){var r,n,o,a;return f(this,t),n=this,a=[e],o=p(o=t),b(r=l(n,d()?Reflect.construct(o,a||[],p(n).constructor):o.apply(n,a)),"type",i.D.FUNDING),b(r,"childTransactionRequiredFees",void 0),r.childTransactionRequiredFees=e.childTransactionRequiredFees,r.internalInit(),r}return y(t,e),r=t,(n=[{key:"buildTransaction",value:function(){this.addInputsFromUTXO();var e=this.getTransactionOPNetFee()+this.childTransactionRequiredFees;this.addOutput({value:Number(e),address:this.to}),this.addRefundOutput(e)}},{key:"getSignerKey",value:function(){return this.signer}}])&&c(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}((o=(a.then?(await a)():a)[0]).Q);n()}catch(w){n(w)}}))},855:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{B:()=>p});var i=r(1757),o=r(2296),a=r(3959),s=r(9068),u=r(374),f=r(154),c=r(8284),l=r(477),h=r(4519),d=e([o,s,f,h]);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function g(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function b(e,t){if(e){if("string"==typeof e)return m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,x(n.key),n)}}function _(e,t){if(t&&("object"==y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return E(e)}function E(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(S=function(){return!!e})()}function k(){return k="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=T(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},k.apply(null,arguments)}function T(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=A(e)););return e}function A(e){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},A(e)}function P(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&I(e,t)}function I(e,t){return I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},I(e,t)}function O(e,t,r){return(t=x(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function x(e){var t=M(e,"string");return"symbol"==y(t)?t:t+""}function M(e,t){if("object"!=y(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[o,s,f,h]=d.then?(await d)():d;var p=function(e){function t(e){var r,n,i,o;if(v(this,t),n=this,o=[e],i=A(i=t),O(r=_(n,S()?Reflect.construct(i,o||[],A(n).constructor):i.apply(n,o)),"type",a.D.INTERACTION),O(r,"randomBytes",void 0),O(r,"targetScriptRedeem",null),O(r,"leftOverFundsScriptRedeem",null),O(r,"compiledTargetScript",void 0),O(r,"scriptTree",void 0),O(r,"tapLeafScript",null),O(r,"calldataGenerator",void 0),O(r,"calldata",void 0),O(r,"contractSecret",r.generateSecret()),O(r,"tweakedSigner",void 0),O(r,"scriptSigner",void 0),O(r,"interactionPubKeys",void 0),O(r,"minimumSignatures",void 0),O(r,"customFinalizer",(function(e,t){if(!r.tapLeafScript)throw new Error("Tap leaf script is required");if(!t.tapScriptSig)throw new Error("Tap script signature is required");if(!r.contractSecret)throw new Error("Contract secret is required");var n=r.getScriptSolution(t).concat(r.tapLeafScript.script).concat(r.tapLeafScript.controlBlock);return{finalScriptWitness:r.witnessStackToScriptWitness(n)}})),!e.calldata)throw new Error("Calldata is required");return r.calldata=u.w.compress(e.calldata),r.interactionPubKeys=e.pubKeys||[],r.minimumSignatures=e.minimumSignatures||0,r.randomBytes=e.randomBytes||c.G.rndBytes(),r.scriptSigner=r.generateKeyPairFromSeed(),r.calldataGenerator=new s.G(r.internalPubKeyToXOnly(),r.scriptSignerXOnlyPubKey(),r.network),r.compiledTargetScript=r.calldataGenerator.compile(r.calldata,r.contractSecret,r.interactionPubKeys,r.minimumSignatures),r.scriptTree=r.getScriptTree(),r.internalInit(),r}return P(t,e),r=t,n=[{key:"getContractSecret",value:function(){return this.contractSecret}},{key:"getRndBytes",value:function(){return this.randomBytes}},{key:"generateSecret",value:function(){return i.hl.fromBech32(this.to).data}},{key:"tweakSigner",value:function(){this.tweakedSigner=this.getTweakedSigner()}},{key:"scriptSignerXOnlyPubKey",value:function(){return(0,l.toXOnly)(this.scriptSigner.publicKey)}},{key:"generateKeyPairFromSeed",value:function(){return f.k.fromSeedKeyPair(this.randomBytes,this.network)}},{key:"addInputsFromUTXO",value:function(){if(!this.tapLeafScript)throw new Error("Tap leaf script is required");var e,t=g(this.utxos);try{for(t.s();!(e=t.n()).done;){var r=e.value,n={hash:r.transactionId,index:r.outputIndex,witnessUtxo:{value:Number(r.value),script:this.getTapOutput()},tapLeafScript:[this.tapLeafScript],sequence:4294967293};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"buildTransaction",value:function(){var e=this.scriptSigner?this.targetScriptRedeem:this.leftOverFundsScriptRedeem;if(!e)throw new Error("Left over funds script redeem is required");if(!e.redeemVersion)throw new Error("Left over funds script redeem version is required");if(!e.output)throw new Error("Left over funds script redeem output is required");this.tapLeafScript={leafVersion:e.redeemVersion,script:e.output,controlBlock:this.getWitness()},this.addInputsFromUTXO();var t=this.getTransactionOPNetFee();this.addOutput({value:Number(t),address:this.to}),this.addRefundOutput(t)}},{key:"signInputs",value:function(e){this.scriptSigner?(e.signInput(0,this.scriptSigner),e.signInput(0,this.getSignerKey()),e.finalizeInput(0,this.customFinalizer)):k(A(t.prototype),"signInputs",this).call(this,e)}},{key:"getSignerKey",value:function(){return this.tweakedSigner?this.tweakedSigner:this.signer}},{key:"generateScriptAddress",value:function(){return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network,scriptTree:this.scriptTree}}},{key:"generateTapData",value:function(){var e=this.scriptSigner?this.targetScriptRedeem:this.leftOverFundsScriptRedeem;if(!e)throw new Error("Left over funds script redeem is required");if(!this.scriptTree)throw new Error("Script tree is required");return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network,scriptTree:this.scriptTree,redeem:e}}},{key:"getScriptSolution",value:function(e){if(!e.tapScriptSig)throw new Error("Tap script signature is required");return[this.contractSecret,this.internalPubKeyToXOnly(),e.tapScriptSig[0].signature,e.tapScriptSig[1].signature]}},{key:"getPubKeys",value:function(){var e=[this.signer.publicKey];return this.scriptSigner&&e.push(this.scriptSigner.publicKey),e}},{key:"getTweakerHash",value:function(){var e;return null===(e=this.tapData)||void 0===e?void 0:e.hash}},{key:"getTweakedSigner",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t={network:this.network};return e&&(t.tweakHash=this.getTweakerHash()),h.a.tweakSigner(this.signer,t)}},{key:"generateRedeemScripts",value:function(){this.targetScriptRedeem={pubkeys:this.getPubKeys(),output:this.compiledTargetScript,redeemVersion:192},this.leftOverFundsScriptRedeem={pubkeys:this.getPubKeys(),output:this.getLeafScript(),redeemVersion:192}}},{key:"getLeafScript",value:function(){return t.LOCK_LEAF_SCRIPT}},{key:"getScriptTree",value:function(){if(!this.calldata)throw new Error("Calldata is required");return this.generateRedeemScripts(),[{output:this.compiledTargetScript,version:192},{output:this.getLeafScript(),version:192}]}}],n&&w(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(o.Q);n()}catch(N){n(N)}}))},2296:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{Q:()=>h});var i=r(1757),o=r(606),a=r(477),s=r(6647),u=r(154),f=r(8772),c=r(8287).Buffer,l=e([s,u]);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function g(e){if(Array.isArray(e))return v(e)}function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=m(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function m(e,t){if(e){if("string"==typeof e)return v(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,O(n.key),n)}}function E(e,t){if(t&&("object"==d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return S(e)}function S(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(k=function(){return!!e})()}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}function A(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function I(e,t,r){return(t=O(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e){var t=x(e,"string");return"symbol"==d(t)?t:t+""}function x(e,t){if("object"!=d(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[s,u]=l.then?(await l)():l;var h=function(e){function t(e){var r,n,o,a;if(w(this,t),n=this,o=T(o=t),I(r=E(n,k()?Reflect.construct(o,[],T(n).constructor):o.apply(n,a)),"logColor","#785def"),I(r,"transactionFee",0n),I(r,"transaction",void 0),I(r,"inputs",[]),I(r,"updateInputs",[]),I(r,"outputs",[]),I(r,"feeOutput",null),I(r,"signed",!1),I(r,"tapData",null),I(r,"scriptData",null),I(r,"totalInputAmount",void 0),I(r,"signer",void 0),I(r,"network",void 0),I(r,"feeRate",void 0),I(r,"priorityFee",void 0),I(r,"utxos",void 0),I(r,"to",void 0),I(r,"from",void 0),I(r,"_maximumFeeRate",1e8),r.signer=e.signer,r.network=e.network,r.feeRate=e.feeRate,r.priorityFee=e.priorityFee,r.utxos=e.utxos,r.to=e.to,r.from=e.from||u.k.getTaprootAddress(r.signer,r.network),r.totalInputAmount=r.calculateTotalUTXOAmount(),r.calculateTotalVOutAmount()<r.totalInputAmount)throw new Error("Vout value is less than the value to send");if(r.totalInputAmount<t.MINIMUM_DUST)throw new Error("Value is less than the minimum dust");return r.transaction=new i.iL({network:r.network}),r}return A(t,e),r=t,n=[{key:"getFundingTransactionParameters",value:function(){return{utxos:this.utxos,to:this.getScriptAddress(),signer:this.signer,network:this.network,feeRate:this.feeRate,priorityFee:this.priorityFee,from:this.from,childTransactionRequiredFees:this.transactionFee}}},{key:"setDestinationAddress",value:function(e){this.to=e}},{key:"setMaximumFeeRate",value:function(e){this._maximumFeeRate=e}},{key:"signTransaction",value:function(){if(!this.to)throw new Error("Transaction must have a recipient");if(!u.k.verifyContractAddress(this.to,this.network))throw new Error("Invalid contract address. The contract address must be a taproot address.");if(this.signed)throw new Error("Transaction is already signed");if(this.signed=!0,this.buildTransaction(),this.internalBuildTransaction(this.transaction))return this.transaction.extractTransaction(!1);throw new Error("Could not sign transaction")}},{key:"getTransaction",value:function(){return this.transaction.extractTransaction(!1)}},{key:"getScriptAddress",value:function(){if(!this.scriptData||!this.scriptData.address)throw new Error("Tap data is required");return this.scriptData.address}},{key:"disableRBF",value:function(){if(this.signed)throw new Error("Transaction is already signed");var e,t=b(this.inputs);try{for(t.s();!(e=t.n()).done;)e.value.sequence=4294967295}catch(e){t.e(e)}finally{t.f()}}},{key:"getTapAddress",value:function(){if(!this.tapData||!this.tapData.address)throw new Error("Tap data is required");return this.tapData.address}},{key:"addInput",value:function(e){this.inputs.push(e)}},{key:"addOutput",value:function(e){if(e.value<t.MINIMUM_DUST)throw new Error("Output value is less than the minimum dust ".concat(e.value," < ").concat(t.MINIMUM_DUST));this.outputs.push(e)}},{key:"addRefundOutput",value:function(e){var r=this.totalInputAmount-e;r>=t.MINIMUM_DUST?this.setFeeOutput({value:Number(r),address:this.from}):this.warn("Amount to send back is less than the minimum dust, will be consumed in fees instead.")}},{key:"getTransactionOPNetFee",value:function(){return this.priorityFee>t.MINIMUM_DUST?this.priorityFee:t.MINIMUM_DUST}},{key:"calculateTotalUTXOAmount",value:function(){var e,t=0n,r=b(this.utxos);try{for(r.s();!(e=r.n()).done;)t+=e.value.value}catch(e){r.e(e)}finally{r.f()}return t}},{key:"calculateTotalVOutAmount",value:function(){var e,t=0n,r=b(this.utxos);try{for(r.s();!(e=r.n()).done;)t+=e.value.value}catch(e){r.e(e)}finally{r.f()}return t}},{key:"addInputsFromUTXO",value:function(){var e,t=b(this.utxos);try{for(t.s();!(e=t.n()).done;){var r=e.value,n={hash:r.transactionId,index:r.outputIndex,witnessUtxo:{value:Number(r.value),script:c.from(r.scriptPubKey.hex,"hex")},sequence:4294967293};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"witnessStackToScriptWitness",value:function(e){var t,r=c.allocUnsafe(0);function n(e){var t=r.length,n=o.varuint.encodingLength(e);r=c.concat([r,c.allocUnsafe(n)]),o.varuint.encode(e,r,t)}return n((t=e).length),t.forEach((function(e){n(e.length),function(e){r=c.concat([r,c.from(e)])}(e)})),r}},{key:"internalInit",value:function(){this.verifyUTXOValidity(),this.scriptData=i.KT.p2tr(this.generateScriptAddress()),this.tapData=i.KT.p2tr(this.generateTapData())}},{key:"generateScriptAddress",value:function(){return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network}}},{key:"generateTapData",value:function(){return{internalPubkey:this.internalPubKeyToXOnly(),network:this.network}}},{key:"updateInput",value:function(e){this.updateInputs.push(e)}},{key:"getWitness",value:function(){if(!this.tapData||!this.tapData.witness)throw new Error("Witness is required");if(0===this.tapData.witness.length)throw new Error("Witness is empty");return this.tapData.witness[this.tapData.witness.length-1]}},{key:"getTapOutput",value:function(){if(!this.tapData||!this.tapData.output)throw new Error("Tap data is required");return this.tapData.output}},{key:"getInputs",value:function(){return this.inputs}},{key:"getOutputs",value:function(){var e,t=g(e=this.outputs)||y(e)||m(e)||p();return this.feeOutput&&t.push(this.feeOutput),t}},{key:"verifyUTXOValidity",value:function(){var e,t=b(this.utxos);try{for(t.s();!(e=t.n()).done;)if(!e.value.scriptPubKey)throw new Error("Address is required")}catch(e){t.e(e)}finally{t.f()}}},{key:"setFeeOutput",value:function(e){var r=e.value;this.feeOutput=e;var n=this.estimateTransactionFees();if(n>BigInt(r))throw new Error("Insufficient funds");this.feeOutput.value=r-Number(n),this.feeOutput.value<t.MINIMUM_DUST&&(this.feeOutput=null)}},{key:"internalPubKeyToXOnly",value:function(){return(0,a.toXOnly)(this.signer.publicKey)}},{key:"signInputs",value:function(e){e.signAllInputs(this.getSignerKey()),e.finalizeAllInputs()}},{key:"internalBuildTransaction",value:function(e){var t=this.getInputs(),r=this.getOutputs();e.setMaximumFeeRate(this._maximumFeeRate),e.addInputs(t);for(var n=0;n<this.updateInputs.length;n++)e.updateInput(n,this.updateInputs[n]);e.addOutputs(r);try{return this.signInputs(e),this.transactionFee=BigInt(e.getFee()),!0}catch(e){var i=e;this.error("[internalBuildTransaction] Something went wrong while getting building the transaction: ".concat(i.stack))}return!1}},{key:"estimateTransactionFees",value:function(){var e=new i.iL({network:this.network});if(this.internalBuildTransaction(e)){var t=e.extractTransaction(!1).virtualSize(),r=this.feeRate*t+1;return BigInt(Math.ceil(r))}throw new Error("Could not build transaction to estimate fee. Something went wrong while building the transaction.")}}],n&&_(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(f.Vy);I(h,"LOCK_LEAF_SCRIPT",i.K$.compile([i.Ez.OP_0])),I(h,"MINIMUM_DUST",330n),(0,i.f0)(s),n()}catch(M){n(M)}}))},3959:(e,t,r)=>{var n;r.d(t,{D:()=>n}),function(e){e[e.GENERIC=0]="GENERIC",e[e.FUNDING=1]="FUNDING",e[e.DEPLOYMENT=2]="DEPLOYMENT",e[e.INTERACTION=3]="INTERACTION",e[e.WBTC_WRAP=4]="WBTC_WRAP"}(n||(n={}))},8284:(e,t,r)=>{r.d(t,{G:()=>s});var n=r(8287).Buffer;function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"btcToSatoshi",value:function(e){return BigInt(1e8*e)}},{key:"rndBytes",value:function(){var e=crypto.getRandomValues(new Uint8Array(64));return n.from(e)}}],null&&o(e.prototype,null),t&&o(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},9565:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(){i=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",f=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function h(e,t,r,n){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),s=new N(n||[]);return a(o,"_invoke",{value:I(e,r,s)}),o}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var p="suspendedStart",y="suspendedYield",g="executing",b="completed",m={};function v(){}function w(){}function _(){}var E={};l(E,u,(function(){return this}));var S=Object.getPrototypeOf,k=S&&S(S(R([])));k&&k!==r&&o.call(k,u)&&(E=k);var T=_.prototype=v.prototype=Object.create(E);function A(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function r(i,a,s,u){var f=d(e[i],e,a);if("throw"!==f.type){var c=f.arg,l=c.value;return l&&"object"==n(l)&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):t.resolve(l).then((function(e){c.value=e,s(c)}),(function(e){return r("throw",e,s,u)}))}u(f.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}})}function I(t,r,n){var i=p;return function(o,a){if(i===g)throw Error("Generator is already running");if(i===b){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=O(s,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=g;var f=d(t,r,n);if("normal"===f.type){if(i=n.done?b:y,f.arg===m)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(i=b,n.method="throw",n.arg=f.arg)}}}function O(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=d(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function N(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function R(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=_,a(T,"constructor",{value:_,configurable:!0}),a(_,"constructor",{value:w,configurable:!0}),w.displayName=l(_,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,l(e,c,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},A(P.prototype),l(P.prototype,f,(function(){return this})),t.AsyncIterator=P,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new P(h(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},A(T),l(T,c,"Generator"),l(T,u,(function(){return this})),l(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=R,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),f=o.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),M(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;M(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:R(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function f(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}r.d(t,{y:()=>l});var l=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"opnetAPIUrl",void 0),f(this,"utxoPath","address/utxos"),this.opnetAPIUrl=t},t=[{key:"fetchUTXO",value:(r=i().mark((function e(t){var r,n,a,s,u,f,c,l,h,d,p,y;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={method:"GET",headers:{"Content-Type":"application/json"}},n="".concat(this.opnetAPIUrl,"/api/v1/").concat(this.utxoPath,"?address=").concat(t.address),e.next=4,fetch(n,r);case 4:if((a=e.sent).ok){e.next=7;break}throw new Error("Failed to fetch UTXO data: ".concat(a.statusText));case 7:return e.next=9,a.json();case 9:if(0!==(s=e.sent).length){e.next=12;break}throw new Error("No UTXO found");case 12:if(u=s.filter((function(e){return BigInt(e.value)>=t.minAmount})),0!==u.length){e.next=15;break}throw new Error("No UTXO found (minAmount)");case 15:f=[],c=0n,l=t.requestedAmount,h=o(u),e.prev=19,h.s();case 21:if((d=h.n()).done){e.next=30;break}if(p=d.value,y=BigInt(p.value),c+=y,f.push({transactionId:p.transactionId,outputIndex:p.outputIndex,value:y,scriptPubKey:p.scriptPubKey}),!(c+y>l)){e.next=28;break}return e.abrupt("break",30);case 28:e.next=21;break;case 30:e.next=35;break;case 32:e.prev=32,e.t0=e.catch(19),h.e(e.t0);case 35:return e.prev=35,h.f(),e.finish(35);case 38:return e.abrupt("return",f);case 39:case"end":return e.stop()}}),e,this,[[19,32,35,38]])})),n=function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function a(e){s(o,n,i,a,u,"next",e)}function u(e){s(o,n,i,a,u,"throw",e)}a(void 0)}))},function(e){return n.apply(this,arguments)})}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n}()},2569:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{t:()=>l});var i=r(1757),o=r(477),a=r(7061),s=r(2296),u=r(3539),f=r(8287).Buffer,c=e([s,u]);function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function y(e,t,r){return(t=g(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(e){var t=b(e,"string");return"symbol"==h(t)?t:t+""}function b(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}[s,u]=c.then?(await c)():c;var l=function(){function e(){d(this,e)}return t=e,r=[{key:"getContractAddress",value:function(t){var r=t.network||i.o8.bitcoin,n=[{output:new a.z(t.deployerPubKeyXOnly,(0,o.toXOnly)(t.contractSaltPubKey),r).compile(t.bytecode,t.originalSalt),version:e.TAP_SCRIPT_VERSION},{output:s.Q.LOCK_LEAF_SCRIPT,version:e.TAP_SCRIPT_VERSION}];return e.generateAddressFromScript(t,n)}},{key:"getContractSeed",value:function(e,t,r){var n=i.default.crypto.hash256(t),o=f.concat([e,r,n]);return i.default.crypto.hash256(o)}},{key:"generateContractVirtualAddress",value:function(t,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i.o8.bitcoin,a=e.getContractSeed(t,r,n);return u.i.generatePKSH(a,o)}},{key:"generateAddressFromScript",value:function(e,t){var r=e.network||i.o8.bitcoin,n={internalPubkey:e.deployerPubKeyXOnly,network:r,scriptTree:t};return i.KT.p2tr(n).address}}],null&&p(t.prototype,null),r&&p(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();y(l,"TAP_SCRIPT_VERSION",192),n()}catch(m){n(m)}}))},5364:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=n}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function c(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var r=0,n=0,i=0;e[r]===s;)n++,r++;for(var o=(e.length-r)*u+1>>>0,f=new Uint8Array(o);e[r];){var c=t[e.charCodeAt(r)];if(255===c)return;for(var l=0,h=o-1;(0!==c||l<i)&&-1!==h;h--,l++)c+=a*f[h]>>>0,f[h]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=l,r++}for(var d=o-i;d!==o&&0===f[d];)d++;for(var p=new Uint8Array(n+(o-d)),y=n;d!==o;)p[y++]=f[d++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var u=(o-i)*f+1>>>0,c=new Uint8Array(u);i!==o;){for(var l=t[i],h=0,d=u-1;(0!==l||h<n)&&-1!==d;d--,h++)l+=256*c[d]>>>0,c[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");n=h,i++}for(var p=u-n;p!==u&&0===c[p];)p++;for(var y=s.repeat(r);p<u;++p)y+=e.charAt(c[p]);return y},decodeUnsafe:c,decode:function(e){var t=c(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}},7526:(e,t)=>{t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=s(e),a=o[0],u=o[1],f=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,u)),c=0,l=u>0?a-4:a;for(r=0;r<l;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],f[c++]=t>>16&255,f[c++]=t>>8&255,f[c++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,f[c++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,f[c++]=t>>8&255,f[c++]=255&t),f},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=16383,s=0,f=n-i;s<f;s+=a)o.push(u(e,s,s+a>f?f:s+a));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],n[o.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,a=[],s=t;s<n;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},2343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bech32m=t.bech32=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let e=0;e<32;e++){const t=r.charAt(e);n[t]=e}function i(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){let t=1;for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=i(t)^n>>5}t=i(t);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t=i(t)^31&n}return t}function a(e,t,r,n){let i=0,o=0;const a=(1<<r)-1,s=[];for(let n=0;n<e.length;++n)for(i=i<<t|e[n],o+=t;o>=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<<r-o&a);else{if(o>=t)return"Excess padding";if(i<<r-o&a)return"Non-zero padding"}return s}function s(e){return a(e,8,5,!0)}function u(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t}function f(e){const t=a(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function c(e){let t;function a(e,r){if(r=r||90,e.length<8)return e+" too short";if(e.length>r)return"Exceeds length limit";const a=e.toLowerCase(),s=e.toUpperCase();if(e!==a&&e!==s)return"Mixed-case string "+e;const u=(e=a).lastIndexOf("1");if(-1===u)return"No separator character for "+e;if(0===u)return"Missing prefix for "+e;const f=e.slice(0,u),c=e.slice(u+1);if(c.length<6)return"Data too short";let l=o(f);if("string"==typeof l)return l;const h=[];for(let e=0;e<c.length;++e){const t=c.charAt(e),r=n[t];if(void 0===r)return"Unknown character "+t;l=i(l)^r,e+6>=c.length||h.push(r)}return l!==t?"Invalid checksum for "+e:{prefix:f,words:h}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=a(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=a(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,a){if(a=a||90,e.length+7+n.length>a)throw new TypeError("Exceeds length limit");let s=o(e=e.toLowerCase());if("string"==typeof s)throw new Error(s);let u=e+"1";for(let e=0;e<n.length;++e){const t=n[e];if(t>>5)throw new Error("Non 5-bit word");s=i(s)^t,u+=r.charAt(t)}for(let e=0;e<6;++e)s=i(s);s^=t;for(let e=0;e<6;++e)u+=r.charAt(s>>5*(5-e)&31);return u},toWords:s,fromWordsUnsafe:u,fromWords:f}}t.bech32=c("bech32"),t.bech32m=c("bech32m")},4863:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(1457);function i(e,t,r){return n=>{if(e.has(n))return;const i=r.filter((e=>e.key.toString("hex")===n))[0];t.push(i),e.add(n)}}function o(e){return e.globalMap.unsignedTx}function a(e){const t=new Set;return e.forEach((e=>{const r=e.key.toString("hex");if(t.has(r))throw new Error("Combine: KeyValue Map keys should be unique");t.add(r)})),t}t.combine=function(e){const t=e[0],r=n.psbtToKeyVals(t),s=e.slice(1);if(0===s.length)throw new Error("Combine: Nothing to combine");const u=o(t);if(void 0===u)throw new Error("Combine: Self missing transaction");const f=a(r.globalKeyVals),c=r.inputKeyVals.map(a),l=r.outputKeyVals.map(a);for(const e of s){const t=o(e);if(void 0===t||!t.toBuffer().equals(u.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");const s=n.psbtToKeyVals(e);a(s.globalKeyVals).forEach(i(f,r.globalKeyVals,s.globalKeyVals)),s.inputKeyVals.map(a).forEach(((e,t)=>e.forEach(i(c[t],r.inputKeyVals[t],s.inputKeyVals[t])))),s.outputKeyVals.map(a).forEach(((e,t)=>e.forEach(i(l[t],r.outputKeyVals[t],s.outputKeyVals[t]))))}return n.psbtFromKeyVals(u,{globalMapKeyVals:r.globalKeyVals,inputKeyVals:r.inputKeyVals,outputKeyVals:r.outputKeyVals})}},4834:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");const t=e.key.slice(1),r={masterFingerprint:e.value.slice(0,4),extendedPubkey:t,path:"m"};for(const t of(n=e.value.length/4-1,[...Array(n).keys()])){const n=e.value.readUInt32LE(4*t+4),i=!!(2147483648&n),o=2147483647&n;r.path+="/"+o.toString(10)+(i?"'":"")}var n;return r},t.encode=function(e){const t=n.from([i.GlobalTypes.GLOBAL_XPUB]),r=n.concat([t,e.extendedPubkey]),o=e.path.split("/"),a=n.allocUnsafe(4*o.length);e.masterFingerprint.copy(a,0);let s=4;return o.slice(1).forEach((e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),a.writeUInt32LE(r,s),s+=4})),{key:r,value:a}},t.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",t.check=function(e){const t=e.extendedPubkey,r=e.masterFingerprint,i=e.path;return n.isBuffer(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&n.isBuffer(r)&&4===r.length&&"string"==typeof i&&!!i.match(/^m(\/\d+'?)*$/)},t.canAddToArray=function(e,t,r){const n=t.extendedPubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.extendedPubkey.equals(t.extendedPubkey))).length)}},4213:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.encode=function(e){return{key:n.from([i.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}}},2706:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(9080),i=r(4834),o=r(4213),a=r(6605),s=r(1795),u=r(4431),f=r(6907),c=r(5949),l=r(9344),h=r(2760),d=r(1695),p=r(8454),y=r(9034),g=r(2926),b=r(7851),m=r(7545),v=r(2412),w=r(4307),_=r(7636),E=r(2223),S=r(5578),k={unsignedTx:o,globalXpub:i,checkPubkey:v.makeChecker([])};t.globals=k;const T={nonWitnessUtxo:u,partialSig:f,sighashType:l,finalScriptSig:a,finalScriptWitness:s,porCommitment:c,witnessUtxo:g,bip32Derivation:m.makeConverter(n.InputTypes.BIP32_DERIVATION),redeemScript:w.makeConverter(n.InputTypes.REDEEM_SCRIPT),witnessScript:S.makeConverter(n.InputTypes.WITNESS_SCRIPT),checkPubkey:v.makeChecker([n.InputTypes.PARTIAL_SIG,n.InputTypes.BIP32_DERIVATION]),tapKeySig:h,tapScriptSig:y,tapLeafScript:d,tapBip32Derivation:_.makeConverter(n.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:E.makeConverter(n.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:p};t.inputs=T;const A={bip32Derivation:m.makeConverter(n.OutputTypes.BIP32_DERIVATION),redeemScript:w.makeConverter(n.OutputTypes.REDEEM_SCRIPT),witnessScript:S.makeConverter(n.OutputTypes.WITNESS_SCRIPT),checkPubkey:v.makeChecker([n.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:_.makeConverter(n.OutputTypes.TAP_BIP32_DERIVATION),tapTree:b,tapInternalKey:E.makeConverter(n.OutputTypes.TAP_INTERNAL_KEY)};t.outputs=A},6605:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.FINAL_SCRIPTSIG]),value:e}},t.expected="Buffer",t.check=function(e){return n.isBuffer(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig}},1795:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},t.expected="Buffer",t.check=function(e){return n.isBuffer(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness}},4431:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.NON_WITNESS_UTXO]),value:e}},t.expected="Buffer",t.check=function(e){return n.isBuffer(e)},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo}},6907:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig with key 0x"+e.key.toString("hex"));if(34!==e.key.length&&66!==e.key.length||![2,3,4].includes(e.key[1]))throw new Error("Decode Error: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},t.encode=function(e){const t=n.from([i.InputTypes.PARTIAL_SIG]);return{key:n.concat([t,e.pubkey]),value:e.signature}},t.expected="{ pubkey: Buffer; signature: Buffer; }",t.check=function(e){return n.isBuffer(e.pubkey)&&n.isBuffer(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!n.isBuffer(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;const t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;const r=e[3+t+2];return!(r>33||r<1)&&e.length===3+t+2+r+2}(e.signature)},t.canAddToArray=function(e,t,r){const n=t.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}},5949:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},t.encode=function(e){return{key:n.from([i.InputTypes.POR_COMMITMENT]),value:n.from(e,"utf8")}},t.expected="string",t.check=function(e){return"string"==typeof e},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment}},9344:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},t.encode=function(e){const t=n.from([i.InputTypes.SIGHASH_TYPE]),r=n.allocUnsafe(4);return r.writeUInt32LE(e,0),{key:t,value:r}},t.expected="number",t.check=function(e){return"number"==typeof e},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType}},2760:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);function o(e){return n.isBuffer(e)&&(64===e.length||65===e.length)}t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!o(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.TAP_KEY_SIG]),value:e}},t.expected="Buffer",t.check=o,t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig}},1695:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));const t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));const r=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:r,leafVersion:t}},t.encode=function(e){const t=n.from([i.InputTypes.TAP_LEAF_SCRIPT]),r=n.from([e.leafVersion]);return{key:n.concat([t,e.controlBlock]),value:n.concat([e.script,r])}},t.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",t.check=function(e){return n.isBuffer(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&n.isBuffer(e.script)},t.canAddToArray=function(e,t,r){const n=t.controlBlock.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.controlBlock.equals(t.controlBlock))).length)}},8454:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);function o(e){return n.isBuffer(e)&&32===e.length}t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!o(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},t.encode=function(e){return{key:n.from([i.InputTypes.TAP_MERKLE_ROOT]),value:e}},t.expected="Buffer",t.check=o,t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot}},9034:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080);t.decode=function(e){if(e.key[0]!==i.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},t.encode=function(e){const t=n.from([i.InputTypes.TAP_SCRIPT_SIG]);return{key:n.concat([t,e.pubkey,e.leafHash]),value:e.signature}},t.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",t.check=function(e){return n.isBuffer(e.pubkey)&&n.isBuffer(e.leafHash)&&n.isBuffer(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},t.canAddToArray=function(e,t,r){const n=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash))).length)}},2926:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080),o=r(8133),a=r(394);t.decode=function(e){if(e.key[0]!==i.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));const t=o.readUInt64LE(e.value,0);let r=8;const n=a.decode(e.value,r);r+=a.encodingLength(n);const s=e.value.slice(r);if(s.length!==n)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:s,value:t}},t.encode=function(e){const{script:t,value:r}=e,s=a.encodingLength(t.length),u=n.allocUnsafe(8+s+t.length);return o.writeUInt64LE(u,r,0),a.encode(t.length,u,8),t.copy(u,8+s),{key:n.from([i.InputTypes.WITNESS_UTXO]),value:u}},t.expected="{ script: Buffer; value: number; }",t.check=function(e){return n.isBuffer(e.script)&&"number"==typeof e.value},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo}},7851:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(9080),o=r(394);t.decode=function(e){if(e.key[0]!==i.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));let t=0;const r=[];for(;t<e.value.length;){const n=e.value[t++],i=e.value[t++],a=o.decode(e.value,t);t+=o.encodingLength(a),r.push({depth:n,leafVersion:i,script:e.value.slice(t,t+a)}),t+=a}return{leaves:r}},t.encode=function(e){const t=n.from([i.OutputTypes.TAP_TREE]),r=[].concat(...e.leaves.map((e=>[n.of(e.depth,e.leafVersion),o.encode(e.script.length),e.script])));return{key:t,value:n.concat(r)}},t.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",t.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((e=>e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&n.isBuffer(e.script)))},t.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree}},7545:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=e=>33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0];t.makeConverter=function(e,t=i){return{decode:function(r){if(r.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+r.key.toString("hex"));const n=r.key.slice(1);if(!t(n))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+r.key.toString("hex"));if(r.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");const i={masterFingerprint:r.value.slice(0,4),pubkey:n,path:"m"};for(const e of(o=r.value.length/4-1,[...Array(o).keys()])){const t=r.value.readUInt32LE(4*e+4),n=!!(2147483648&t),o=2147483647&t;i.path+="/"+o.toString(10)+(n?"'":"")}var o;return i},encode:function(t){const r=n.from([e]),i=n.concat([r,t.pubkey]),o=t.path.split("/"),a=n.allocUnsafe(4*o.length);t.masterFingerprint.copy(a,0);let s=4;return o.slice(1).forEach((e=>{const t="'"===e.slice(-1);let r=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(r+=2147483648),a.writeUInt32LE(r,s),s+=4})),{key:i,value:a}},check:function(e){return n.isBuffer(e.pubkey)&&n.isBuffer(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,r){const n=t.pubkey.toString("hex");return!r.has(n)&&(r.add(n),0===e.filter((e=>e.pubkey.equals(t.pubkey))).length)}}}},2412:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.makeChecker=function(e){return function(t){let r;if(e.includes(t.key[0])&&(r=t.key.slice(1),33!==r.length&&65!==r.length||![2,3,4].includes(r[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return r}}},4307:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:n.from([e]),value:t}},check:function(e){return n.isBuffer(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}}},7636:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(394),o=r(7545),a=e=>32===e.length;t.makeConverter=function(e){const t=o.makeConverter(e,a);return{decode:function(e){const r=i.decode(e.value),n=i.encodingLength(r),o=t.decode({key:e.key,value:e.value.slice(n+32*r)}),a=new Array(r);for(let t=0,i=n;t<r;t++,i+=32)a[t]=e.value.slice(i,i+32);return Object.assign({},o,{leafHashes:a})},encode:function(e){const r=t.encode(e),o=i.encodingLength(e.leafHashes.length),a=n.allocUnsafe(o);i.encode(e.leafHashes.length,a);const s=n.concat([a,...e.leafHashes,r.value]);return Object.assign({},r,{value:s})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((e=>n.isBuffer(e)&&32===e.length))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}}},2223:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:n.from([e]),value:t}},check:function(e){return n.isBuffer(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}}},5578:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:n.from([e]),value:t}},check:function(e){return n.isBuffer(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}}},8133:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(394);function o(e){const t=e.key.length,r=e.value.length,o=i.encodingLength(t),a=i.encodingLength(r),s=n.allocUnsafe(o+t+a+r);return i.encode(t,s,0),e.key.copy(s,o),i.encode(r,s,o+t),e.value.copy(s,o+t+a),s}function a(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}t.range=e=>[...Array(e).keys()],t.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e},t.keyValsToBuffer=function(e){const t=e.map(o);return t.push(n.from([0])),n.concat(t)},t.keyValToBuffer=o,t.readUInt64LE=function(e,t){const r=e.readUInt32LE(t);let n=e.readUInt32LE(t+4);return n*=4294967296,a(n+r,9007199254740991),n+r},t.writeUInt64LE=function(e,t,r){return a(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}},394:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function a(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}t.encode=function e(t,r,i){if(o(t),r||(r=n.allocUnsafe(a(t))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),t<253?(r.writeUInt8(t,i),Object.assign(e,{bytes:1})):t<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(t,i+1),Object.assign(e,{bytes:3})):t<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(t,i+1),Object.assign(e,{bytes:5})):(r.writeUInt8(255,i),r.writeUInt32LE(t>>>0,i+1),r.writeUInt32LE(t/4294967296|0,i+5),Object.assign(e,{bytes:9})),r},t.decode=function e(t,r){if(!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);const i=t.readUInt8(r);if(i<253)return Object.assign(e,{bytes:1}),i;if(253===i)return Object.assign(e,{bytes:3}),t.readUInt16LE(r+1);if(254===i)return Object.assign(e,{bytes:5}),t.readUInt32LE(r+1);{Object.assign(e,{bytes:9});const n=t.readUInt32LE(r+1),i=4294967296*t.readUInt32LE(r+5)+n;return o(i),i}},t.encodingLength=a},6263:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(2706),o=r(8133),a=r(394),s=r(9080);function u(e,t,r){if(!t.equals(n.from([r])))throw new Error(`Format Error: Invalid ${e} key: ${t.toString("hex")}`)}function f(e,{globalMapKeyVals:t,inputKeyVals:r,outputKeyVals:n}){const a={unsignedTx:e};let f=0;for(const e of t)switch(e.key[0]){case s.GlobalTypes.UNSIGNED_TX:if(u("global",e.key,s.GlobalTypes.UNSIGNED_TX),f>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");f++;break;case s.GlobalTypes.GLOBAL_XPUB:void 0===a.globalXpub&&(a.globalXpub=[]),a.globalXpub.push(i.globals.globalXpub.decode(e));break;default:a.unknownKeyVals||(a.unknownKeyVals=[]),a.unknownKeyVals.push(e)}const c=r.length,l=n.length,h=[],d=[];for(const e of o.range(c)){const t={};for(const n of r[e])switch(i.inputs.checkPubkey(n),n.key[0]){case s.InputTypes.NON_WITNESS_UTXO:if(u("input",n.key,s.InputTypes.NON_WITNESS_UTXO),void 0!==t.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");t.nonWitnessUtxo=i.inputs.nonWitnessUtxo.decode(n);break;case s.InputTypes.WITNESS_UTXO:if(u("input",n.key,s.InputTypes.WITNESS_UTXO),void 0!==t.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");t.witnessUtxo=i.inputs.witnessUtxo.decode(n);break;case s.InputTypes.PARTIAL_SIG:void 0===t.partialSig&&(t.partialSig=[]),t.partialSig.push(i.inputs.partialSig.decode(n));break;case s.InputTypes.SIGHASH_TYPE:if(u("input",n.key,s.InputTypes.SIGHASH_TYPE),void 0!==t.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");t.sighashType=i.inputs.sighashType.decode(n);break;case s.InputTypes.REDEEM_SCRIPT:if(u("input",n.key,s.InputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");t.redeemScript=i.inputs.redeemScript.decode(n);break;case s.InputTypes.WITNESS_SCRIPT:if(u("input",n.key,s.InputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");t.witnessScript=i.inputs.witnessScript.decode(n);break;case s.InputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(i.inputs.bip32Derivation.decode(n));break;case s.InputTypes.FINAL_SCRIPTSIG:u("input",n.key,s.InputTypes.FINAL_SCRIPTSIG),t.finalScriptSig=i.inputs.finalScriptSig.decode(n);break;case s.InputTypes.FINAL_SCRIPTWITNESS:u("input",n.key,s.InputTypes.FINAL_SCRIPTWITNESS),t.finalScriptWitness=i.inputs.finalScriptWitness.decode(n);break;case s.InputTypes.POR_COMMITMENT:u("input",n.key,s.InputTypes.POR_COMMITMENT),t.porCommitment=i.inputs.porCommitment.decode(n);break;case s.InputTypes.TAP_KEY_SIG:u("input",n.key,s.InputTypes.TAP_KEY_SIG),t.tapKeySig=i.inputs.tapKeySig.decode(n);break;case s.InputTypes.TAP_SCRIPT_SIG:void 0===t.tapScriptSig&&(t.tapScriptSig=[]),t.tapScriptSig.push(i.inputs.tapScriptSig.decode(n));break;case s.InputTypes.TAP_LEAF_SCRIPT:void 0===t.tapLeafScript&&(t.tapLeafScript=[]),t.tapLeafScript.push(i.inputs.tapLeafScript.decode(n));break;case s.InputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(i.inputs.tapBip32Derivation.decode(n));break;case s.InputTypes.TAP_INTERNAL_KEY:u("input",n.key,s.InputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=i.inputs.tapInternalKey.decode(n);break;case s.InputTypes.TAP_MERKLE_ROOT:u("input",n.key,s.InputTypes.TAP_MERKLE_ROOT),t.tapMerkleRoot=i.inputs.tapMerkleRoot.decode(n);break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(n)}h.push(t)}for(const e of o.range(l)){const t={};for(const r of n[e])switch(i.outputs.checkPubkey(r),r.key[0]){case s.OutputTypes.REDEEM_SCRIPT:if(u("output",r.key,s.OutputTypes.REDEEM_SCRIPT),void 0!==t.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");t.redeemScript=i.outputs.redeemScript.decode(r);break;case s.OutputTypes.WITNESS_SCRIPT:if(u("output",r.key,s.OutputTypes.WITNESS_SCRIPT),void 0!==t.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");t.witnessScript=i.outputs.witnessScript.decode(r);break;case s.OutputTypes.BIP32_DERIVATION:void 0===t.bip32Derivation&&(t.bip32Derivation=[]),t.bip32Derivation.push(i.outputs.bip32Derivation.decode(r));break;case s.OutputTypes.TAP_INTERNAL_KEY:u("output",r.key,s.OutputTypes.TAP_INTERNAL_KEY),t.tapInternalKey=i.outputs.tapInternalKey.decode(r);break;case s.OutputTypes.TAP_TREE:u("output",r.key,s.OutputTypes.TAP_TREE),t.tapTree=i.outputs.tapTree.decode(r);break;case s.OutputTypes.TAP_BIP32_DERIVATION:void 0===t.tapBip32Derivation&&(t.tapBip32Derivation=[]),t.tapBip32Derivation.push(i.outputs.tapBip32Derivation.decode(r));break;default:t.unknownKeyVals||(t.unknownKeyVals=[]),t.unknownKeyVals.push(r)}d.push(t)}return{globalMap:a,inputs:h,outputs:d}}t.psbtFromBuffer=function(e,t){let r=0;function n(){const t=a.decode(e,r);r+=a.encodingLength(t);const n=e.slice(r,r+t);return r+=t,n}function i(){return{key:n(),value:n()}}function u(){if(r>=e.length)throw new Error("Format Error: Unexpected End of PSBT");const t=0===e.readUInt8(r);return t&&r++,t}if(1886610036!==function(){const t=e.readUInt32BE(r);return r+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){const t=e.readUInt8(r);return r+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");const c=[],l={};for(;!u();){const e=i(),t=e.key.toString("hex");if(l[t])throw new Error("Format Error: Keys must be unique for global keymap: key "+t);l[t]=1,c.push(e)}const h=c.filter((e=>e.key[0]===s.GlobalTypes.UNSIGNED_TX));if(1!==h.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");const d=t(h[0].value),{inputCount:p,outputCount:y}=d.getInputOutputCounts(),g=[],b=[];for(const e of o.range(p)){const t={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each input: input index "+e+" key "+o);t[o]=1,r.push(n)}g.push(r)}for(const e of o.range(y)){const t={},r=[];for(;!u();){const n=i(),o=n.key.toString("hex");if(t[o])throw new Error("Format Error: Keys must be unique for each output: output index "+e+" key "+o);t[o]=1,r.push(n)}b.push(r)}return f(d,{globalMapKeyVals:c,inputKeyVals:g,outputKeyVals:b})},t.checkKeyBuffer=u,t.psbtFromKeyVals=f},1457:(e,t,r)=>{function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(6263)),n(r(238))},238:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(2706),o=r(8133);t.psbtToBuffer=function({globalMap:e,inputs:t,outputs:r}){const{globalKeyVals:i,inputKeyVals:a,outputKeyVals:s}=u({globalMap:e,inputs:t,outputs:r}),f=o.keyValsToBuffer(i),c=e=>0===e.length?[n.from([0])]:e.map(o.keyValsToBuffer),l=c(a),h=c(s),d=n.allocUnsafe(5);return d.writeUIntBE(482972169471,0,5),n.concat([d,f].concat(l,h))};const a=(e,t)=>e.key.compare(t.key);function s(e,t){const r=new Set,n=Object.entries(e).reduce(((e,[n,i])=>{if("unknownKeyVals"===n)return e;const o=t[n];if(void 0===o)return e;const a=(Array.isArray(i)?i:[i]).map(o.encode);return a.map((e=>e.key.toString("hex"))).forEach((e=>{if(r.has(e))throw new Error("Serialize Error: Duplicate key: "+e);r.add(e)})),e.concat(a)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((e=>!r.has(e.key.toString("hex")))):[];return n.concat(i).sort(a)}function u({globalMap:e,inputs:t,outputs:r}){return{globalKeyVals:s(e,i.globals),inputKeyVals:t.map((e=>s(e,i.inputs))),outputKeyVals:r.map((e=>s(e,i.outputs)))}}t.psbtToKeyVals=u},1614:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(4863),o=r(1457),a=r(9080),s=r(5080);t.Psbt=class{constructor(e){this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:e}}static fromBase64(e,t){const r=n.from(e,"base64");return this.fromBuffer(r,t)}static fromHex(e,t){const r=n.from(e,"hex");return this.fromBuffer(r,t)}static fromBuffer(e,t){const r=o.psbtFromBuffer(e,t),n=new this(r.globalMap.unsignedTx);return Object.assign(n,r),n}toBase64(){return this.toBuffer().toString("base64")}toHex(){return this.toBuffer().toString("hex")}toBuffer(){return o.psbtToBuffer(this)}updateGlobal(e){return s.updateGlobal(e,this.globalMap),this}updateInput(e,t){const r=s.checkForInput(this.inputs,e);return s.updateInput(t,r),this}updateOutput(e,t){const r=s.checkForOutput(this.outputs,e);return s.updateOutput(t,r),this}addUnknownKeyValToGlobal(e){return s.checkHasKey(e,this.globalMap.unknownKeyVals,s.getEnumLength(a.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}addUnknownKeyValToInput(e,t){const r=s.checkForInput(this.inputs,e);return s.checkHasKey(t,r.unknownKeyVals,s.getEnumLength(a.InputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(t),this}addUnknownKeyValToOutput(e,t){const r=s.checkForOutput(this.outputs,e);return s.checkHasKey(t,r.unknownKeyVals,s.getEnumLength(a.OutputTypes)),r.unknownKeyVals||(r.unknownKeyVals=[]),r.unknownKeyVals.push(t),this}addInput(e){this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToInput(r,e))),s.addInputAttributes(this.inputs,e),this}addOutput(e){this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});const t=e.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(t))throw new Error("unknownKeyVals must be an Array");return t.forEach((e=>this.addUnknownKeyValToOutput(r,e))),s.addOutputAttributes(this.outputs,e),this}clearFinalizedInput(e){const t=s.checkForInput(this.inputs,e);s.inputCheckUncleanFinalized(e,t);for(const e of Object.keys(t))["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(e)||delete t[e];return this}combine(...e){const t=i.combine([this].concat(e));return Object.assign(this,t),this}getTransaction(){return this.globalMap.unsignedTx.toBuffer()}}},9080:(e,t)=>{var r,n,i;Object.defineProperty(t,"__esModule",{value:!0}),(i=t.GlobalTypes||(t.GlobalTypes={}))[i.UNSIGNED_TX=0]="UNSIGNED_TX",i[i.GLOBAL_XPUB=1]="GLOBAL_XPUB",t.GLOBAL_TYPE_NAMES=["unsignedTx","globalXpub"],(n=t.InputTypes||(t.InputTypes={}))[n.NON_WITNESS_UTXO=0]="NON_WITNESS_UTXO",n[n.WITNESS_UTXO=1]="WITNESS_UTXO",n[n.PARTIAL_SIG=2]="PARTIAL_SIG",n[n.SIGHASH_TYPE=3]="SIGHASH_TYPE",n[n.REDEEM_SCRIPT=4]="REDEEM_SCRIPT",n[n.WITNESS_SCRIPT=5]="WITNESS_SCRIPT",n[n.BIP32_DERIVATION=6]="BIP32_DERIVATION",n[n.FINAL_SCRIPTSIG=7]="FINAL_SCRIPTSIG",n[n.FINAL_SCRIPTWITNESS=8]="FINAL_SCRIPTWITNESS",n[n.POR_COMMITMENT=9]="POR_COMMITMENT",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",t.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(r=t.OutputTypes||(t.OutputTypes={}))[r.REDEEM_SCRIPT=0]="REDEEM_SCRIPT",r[r.WITNESS_SCRIPT=1]="WITNESS_SCRIPT",r[r.BIP32_DERIVATION=2]="BIP32_DERIVATION",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",t.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]},5080:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0});const i=r(2706);function o(e,t){const r=e[t];if(void 0===r)throw new Error(`No input #${t}`);return r}function a(e,t){const r=e[t];if(void 0===r)throw new Error(`No output #${t}`);return r}function s(e,t,r,n){throw new Error(`Data for ${e} key ${t} is incorrect: Expected ${r} and got ${JSON.stringify(n)}`)}function u(e){return(t,r)=>{for(const n of Object.keys(t)){const o=t[n],{canAdd:a,canAddToArray:u,check:f,expected:c}=i[e+"s"][n]||{};if(f)if(u){if(!Array.isArray(o)||r[n]&&!Array.isArray(r[n]))throw new Error(`Key type ${n} must be an array`);o.every(f)||s(e,n,c,o);const t=r[n]||[],i=new Set;if(!o.every((e=>u(t,e,i))))throw new Error("Can not add duplicate data to array");r[n]=t.concat(o)}else{if(f(o)||s(e,n,c,o),!a(r,o))throw new Error(`Can not add duplicate data to ${e}`);r[n]=o}}}}t.checkForInput=o,t.checkForOutput=a,t.checkHasKey=function(e,t,r){if(e.key[0]<r)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((t=>t.key.equals(e.key))).length)throw new Error(`Duplicate Key: ${e.key.toString("hex")}`)},t.getEnumLength=function(e){let t=0;return Object.keys(e).forEach((e=>{Number(isNaN(Number(e)))&&t++})),t},t.inputCheckUncleanFinalized=function(e,t){let r=!1;if(t.nonWitnessUtxo||t.witnessUtxo){const e=!!t.redeemScript,n=!!t.witnessScript,i=!e||!!t.finalScriptSig,o=!n||!!t.finalScriptWitness,a=!!t.finalScriptSig||!!t.finalScriptWitness;r=i&&o&&a}if(!1===r)throw new Error(`Input #${e} has too much or too little data to clean`)},t.updateGlobal=u("global"),t.updateInput=u("input"),t.updateOutput=u("output"),t.addInputAttributes=function(e,r){const n=o(e,e.length-1);t.updateInput(r,n)},t.addOutputAttributes=function(e,r){const n=a(e,e.length-1);t.updateOutput(r,n)},t.defaultVersionSetter=function(e,t){if(!n.isBuffer(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},t.defaultLocktimeSetter=function(e,t){if(!n.isBuffer(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}},4642:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BIP32Factory=void 0;const i=r(9571),o=r(7757),a=r(3203),s=r(2623),u=r(8676),f=r(7513),c=(0,a.base58check)(s.sha256);t.BIP32Factory=function(e){(0,o.testEcc)(e);const t=u.BufferN(32),r=u.compile({wif:u.UInt8,bip32:{public:u.UInt32,private:u.UInt32}}),a={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},s=2147483648,l=Math.pow(2,31)-1;function h(e){return u.String(e)&&null!==e.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}function d(e){return u.UInt32(e)&&e<=l}class p{constructor(e,t){this.__D=e,this.__Q=t,this.lowR=!1}get publicKey(){return void 0===this.__Q&&(this.__Q=n.from(e.pointFromScalar(this.__D,!0))),this.__Q}get privateKey(){return this.__D}sign(t,r){if(!this.privateKey)throw new Error("Missing private key");if(void 0===r&&(r=this.lowR),!1===r)return n.from(e.sign(t,this.privateKey));{let r=n.from(e.sign(t,this.privateKey));const i=n.alloc(32,0);let o=0;for(;r[0]>127;)o++,i.writeUIntLE(o,0,6),r=n.from(e.sign(t,this.privateKey,i));return r}}signSchnorr(t){if(!this.privateKey)throw new Error("Missing private key");if(!e.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return n.from(e.signSchnorr(t,this.privateKey))}verify(t,r){return e.verify(t,this.publicKey,r)}verifySchnorr(t,r){if(!e.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return e.verifySchnorr(t,this.publicKey.subarray(1,33),r)}}class y extends p{constructor(e,t,n,i,o=0,a=0,s=0){super(e,t),this.chainCode=n,this.network=i,this.__DEPTH=o,this.__INDEX=a,this.__PARENT_FINGERPRINT=s,u(r,i)}get depth(){return this.__DEPTH}get index(){return this.__INDEX}get parentFingerprint(){return this.__PARENT_FINGERPRINT}get identifier(){return i.hash160(this.publicKey)}get fingerprint(){return this.identifier.slice(0,4)}get compressed(){return!0}isNeutered(){return void 0===this.__D}neutered(){return m(this.publicKey,this.chainCode,this.network,this.depth,this.index,this.parentFingerprint)}toBase58(){const e=this.network,t=this.isNeutered()?e.bip32.public:e.bip32.private,r=n.allocUnsafe(78);return r.writeUInt32BE(t,0),r.writeUInt8(this.depth,4),r.writeUInt32BE(this.parentFingerprint,5),r.writeUInt32BE(this.index,9),this.chainCode.copy(r,13),this.isNeutered()?this.publicKey.copy(r,45):(r.writeUInt8(0,45),this.privateKey.copy(r,46)),i=r,c.encode(Uint8Array.from(i));var i}toWIF(){if(!this.privateKey)throw new TypeError("Missing private key");return f.encode(this.network.wif,this.privateKey,!0)}derive(t){u(u.UInt32,t);const r=t>=s,o=n.allocUnsafe(37);if(r){if(this.isNeutered())throw new TypeError("Missing private key for hardened child key");o[0]=0,this.privateKey.copy(o,1),o.writeUInt32BE(t,33)}else this.publicKey.copy(o,0),o.writeUInt32BE(t,33);const a=i.hmacSHA512(this.chainCode,o),f=a.slice(0,32),c=a.slice(32);if(!e.isPrivate(f))return this.derive(t+1);let l;if(this.isNeutered()){const r=n.from(e.pointAddScalar(this.publicKey,f,!0));if(null===r)return this.derive(t+1);l=m(r,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}else{const r=n.from(e.privateAdd(this.privateKey,f));if(null==r)return this.derive(t+1);l=b(r,c,this.network,this.depth+1,t,this.fingerprint.readUInt32BE(0))}return l}deriveHardened(e){return u(d,e),this.derive(e+s)}derivePath(e){u(h,e);let t=e.split("/");if("m"===t[0]){if(this.parentFingerprint)throw new TypeError("Expected master, got child");t=t.slice(1)}return t.reduce(((e,t)=>{let r;return"'"===t.slice(-1)?(r=parseInt(t.slice(0,-1),10),e.deriveHardened(r)):(r=parseInt(t,10),e.derive(r))}),this)}tweak(e){return this.privateKey?this.tweakFromPrivateKey(e):this.tweakFromPublicKey(e)}tweakFromPublicKey(t){const r=32===(i=this.publicKey).length?i:i.slice(1,33);var i;if(!e.xOnlyPointAddTweak)throw new Error("xOnlyPointAddTweak not supported by ecc library");const o=e.xOnlyPointAddTweak(r,t);if(!o||null===o.xOnlyPubkey)throw new Error("Cannot tweak public key!");const a=n.from([0===o.parity?2:3]),s=n.concat([a,o.xOnlyPubkey]);return new p(void 0,s)}tweakFromPrivateKey(t){const r=3===this.publicKey[0]||4===this.publicKey[0]&&!(1&~this.publicKey[64]),i=(()=>{if(r){if(e.privateNegate)return e.privateNegate(this.privateKey);throw new Error("privateNegate not supported by ecc library")}return this.privateKey})(),o=e.privateAdd(i,t);if(!o)throw new Error("Invalid tweaked private key!");return new p(n.from(o),void 0)}}function g(e,t,r){return b(e,t,r)}function b(r,n,i,o,s,f){if(u({privateKey:t,chainCode:t},{privateKey:r,chainCode:n}),i=i||a,!e.isPrivate(r))throw new TypeError("Private key not in range [1, n)");return new y(r,void 0,n,i,o,s,f)}function m(r,n,i,o,s,f){if(u({publicKey:u.BufferN(33),chainCode:t},{publicKey:r,chainCode:n}),i=i||a,!e.isPoint(r))throw new TypeError("Point is not on the curve");return new y(void 0,r,n,i,o,s,f)}return{fromSeed:function(e,t){if(u(u.Buffer,e),e.length<16)throw new TypeError("Seed should be at least 128 bits");if(e.length>64)throw new TypeError("Seed should be at most 512 bits");t=t||a;const r=i.hmacSHA512(n.from("Bitcoin seed","utf8"),e);return g(r.slice(0,32),r.slice(32),t)},fromBase58:function(e,t){const r=(i=e,n.from(c.decode(i)));var i;if(78!==r.length)throw new TypeError("Invalid buffer length");t=t||a;const o=r.readUInt32BE(0);if(o!==t.bip32.private&&o!==t.bip32.public)throw new TypeError("Invalid network version");const s=r[4],u=r.readUInt32BE(5);if(0===s&&0!==u)throw new TypeError("Invalid parent fingerprint");const f=r.readUInt32BE(9);if(0===s&&0!==f)throw new TypeError("Invalid index");const l=r.slice(13,45);let h;if(o===t.bip32.private){if(0!==r.readUInt8(45))throw new TypeError("Invalid private key");h=b(r.slice(46,78),l,t,s,f,u)}else h=m(r.slice(45,78),l,t,s,f,u);return h},fromPublicKey:function(e,t,r){return m(e,t,r)},fromPrivateKey:g}}},9571:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.hmacSHA512=t.hash160=void 0;const i=r(9615),o=r(3238),a=r(2623),s=r(102);t.hash160=function(e){const t=(0,a.sha256)(Uint8Array.from(e));return n.from((0,o.ripemd160)(t))},t.hmacSHA512=function(e,t){return n.from((0,i.hmac)(s.sha512,e,t))}},852:(e,t,r)=>{t.Ay=void 0;var n=r(4642);Object.defineProperty(t,"Ay",{enumerable:!0,get:function(){return n.BIP32Factory}})},7757:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.testEcc=void 0;const i=e=>n.from(e,"hex");function o(e){if(!e)throw new Error("ecc library invalid")}t.testEcc=function(e){if(o(e.isPoint(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(!e.isPoint(i("030000000000000000000000000000000000000000000000000000000000000005"))),o(e.isPrivate(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(!e.isPrivate(i("0000000000000000000000000000000000000000000000000000000000000000"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),o(n.from(e.pointFromScalar(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),e.xOnlyPointAddTweak){o(null===e.xOnlyPointAddTweak(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")));let t=e.xOnlyPointAddTweak(i("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),i("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));o(n.from(t.xOnlyPubkey).equals(i("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&1===t.parity),t=e.xOnlyPointAddTweak(i("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),i("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47"))}o(n.from(e.pointAddScalar(i("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("0000000000000000000000000000000000000000000000000000000000000003"))).equals(i("02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"))),o(n.from(e.privateAdd(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),i("0000000000000000000000000000000000000000000000000000000000000002"))).equals(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),e.privateNegate&&(o(n.from(e.privateNegate(i("0000000000000000000000000000000000000000000000000000000000000001"))).equals(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(n.from(e.privateNegate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(i("0000000000000000000000000000000000000000000000000000000000000003"))),o(n.from(e.privateNegate(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")))),o(n.from(e.sign(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),o(e.verify(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),e.signSchnorr&&o(n.from(e.signSchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),i("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),e.verifySchnorr&&o(e.verifySchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}},57:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.toOutputScript=t.fromOutputScript=t.toBech32=t.toBase58Check=t.fromBech32=t.fromBase58Check=void 0;const i=r(622),o=r(885),a=r(7038),s=r(8116),u=r(2343),f=r(1889),c="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function l(e){const t=n.from(f.decode(e));if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function h(e){let t,r;try{t=u.bech32.decode(e)}catch(e){}if(t){if(r=t.words[0],0!==r)throw new TypeError(e+" uses wrong encoding")}else if(t=u.bech32m.decode(e),r=t.words[0],0===r)throw new TypeError(e+" uses wrong encoding");const i=u.bech32.fromWords(t.words.slice(1));return{version:r,prefix:t.prefix,data:n.from(i)}}function d(e,t,r){const n=u.bech32.toWords(e);return n.unshift(t),0===t?u.bech32.encode(r,n):u.bech32m.encode(r,n)}t.fromBase58Check=l,t.fromBech32=h,t.toBase58Check=function(e,t){(0,s.typeforce)((0,s.tuple)(s.Hash160bit,s.UInt8),arguments);const r=n.allocUnsafe(21);return r.writeUInt8(t,0),e.copy(r,1),f.encode(r)},t.toBech32=d,t.fromOutputScript=function(e,t){t=t||i.bitcoin;try{return o.p2pkh({output:e,network:t}).address}catch(e){}try{return o.p2sh({output:e,network:t}).address}catch(e){}try{return o.p2wpkh({output:e,network:t}).address}catch(e){}try{return o.p2wsh({output:e,network:t}).address}catch(e){}try{return o.p2tr({output:e,network:t}).address}catch(e){}try{return function(e,t){const r=e.slice(2);if(r.length<2||r.length>40)throw new TypeError("Invalid program length for segwit address");const n=e[0]-80;if(n<2||n>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==r.length)throw new TypeError("Invalid script for segwit address");return console.warn(c),d(r,n,t.bech32)}(e,t)}catch(e){}throw new Error(a.toASM(e)+" has no matching Address")},t.toOutputScript=function(e,t){let r,n;t=t||i.bitcoin;try{r=l(e)}catch(e){}if(r){if(r.version===t.pubKeyHash)return o.p2pkh({hash:r.hash}).output;if(r.version===t.scriptHash)return o.p2sh({hash:r.hash}).output}else{try{n=h(e)}catch(e){}if(n){if(n.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===n.version){if(20===n.data.length)return o.p2wpkh({hash:n.data}).output;if(32===n.data.length)return o.p2wsh({hash:n.data}).output}else if(1===n.version){if(32===n.data.length)return o.p2tr({pubkey:n.data}).output}else if(n.version>=2&&n.version<=16&&n.data.length>=2&&n.data.length<=40)return console.warn(c),a.compile([n.version+80,n.data])}}throw new Error(e+" has no matching Script")}},3966:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decode=t.check=void 0,t.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;const t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;const r=e[5+t];return!(0===r||6+t+r!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||r>1&&0===e[t+6]&&!(128&e[t+7]))},t.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");const t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");const r=e[5+t];if(0===r)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(r>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},t.encode=function(e,t){const r=e.length,i=t.length;if(0===r)throw new Error("R length is zero");if(0===i)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(i>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(r>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(i>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");const o=n.allocUnsafe(6+r+i);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+r]=2,o[5+r]=t.length,t.copy(o,6+r),o}},1696:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Block=void 0;const i=r(606),o=r(1944),a=r(1015),s=r(2021),u=r(8116),{typeforce:f}=u,c=new TypeError("Cannot compute merkle root for zero transactions"),l=new TypeError("Cannot compute witness commit for non-segwit block");class h{constructor(){this.version=1,this.prevHash=void 0,this.merkleRoot=void 0,this.timestamp=0,this.witnessCommit=void 0,this.bits=0,this.nonce=0,this.transactions=void 0}static fromBuffer(e){if(e.length<80)throw new Error("Buffer too small (< 80 bytes)");const t=new i.BufferReader(e),r=new h;if(r.version=t.readInt32(),r.prevHash=t.readSlice(32),r.merkleRoot=t.readSlice(32),r.timestamp=t.readUInt32(),r.bits=t.readUInt32(),r.nonce=t.readUInt32(),80===e.length)return r;const n=()=>{const e=s.Transaction.fromBuffer(t.buffer.slice(t.offset),!0);return t.offset+=e.byteLength(),e},o=t.readVarInt();r.transactions=[];for(let e=0;e<o;++e){const e=n();r.transactions.push(e)}const a=r.getWitnessCommit();return a&&(r.witnessCommit=a),r}static fromHex(e){return h.fromBuffer(n.from(e,"hex"))}static calculateTarget(e){const t=((4278190080&e)>>24)-3,r=8388607&e,i=n.alloc(32,0);return i.writeUIntBE(r,29-t,3),i}static calculateMerkleRoot(e,t){if(f([{getHash:u.Function}],e),0===e.length)throw c;if(t&&!d(e))throw l;const r=e.map((e=>e.getHash(t))),i=(0,a.fastMerkleRoot)(r,o.hash256);return t?o.hash256(n.concat([i,e[0].ins[0].witness[0]])):i}getWitnessCommit(){if(!d(this.transactions))return null;const e=this.transactions[0].outs.filter((e=>e.script.slice(0,6).equals(n.from("6a24aa21a9ed","hex")))).map((e=>e.script.slice(6,38)));if(0===e.length)return null;const t=e[e.length-1];return t instanceof n&&32===t.length?t:null}hasWitnessCommit(){return this.witnessCommit instanceof n&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}hasWitness(){return(e=this.transactions)instanceof Array&&e.some((e=>"object"==typeof e&&e.ins instanceof Array&&e.ins.some((e=>"object"==typeof e&&e.witness instanceof Array&&e.witness.length>0))));var e}weight(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}byteLength(e,t=!0){return e||!this.transactions?80:80+i.varuint.encodingLength(this.transactions.length)+this.transactions.reduce(((e,r)=>e+r.byteLength(t)),0)}getHash(){return o.hash256(this.toBuffer(!0))}getId(){return(0,i.reverseBuffer)(this.getHash()).toString("hex")}getUTCDate(){const e=new Date(0);return e.setUTCSeconds(this.timestamp),e}toBuffer(e){const t=n.allocUnsafe(this.byteLength(e)),r=new i.BufferWriter(t);return r.writeInt32(this.version),r.writeSlice(this.prevHash),r.writeSlice(this.merkleRoot),r.writeUInt32(this.timestamp),r.writeUInt32(this.bits),r.writeUInt32(this.nonce),e||!this.transactions||(i.varuint.encode(this.transactions.length,t,r.offset),r.offset+=i.varuint.encode.bytes,this.transactions.forEach((e=>{const n=e.byteLength();e.toBuffer(t,r.offset),r.offset+=n}))),t}toHex(e){return this.toBuffer(e).toString("hex")}checkTxRoots(){const e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}checkProofOfWork(){const e=(0,i.reverseBuffer)(this.getHash()),t=h.calculateTarget(this.bits);return e.compare(t)<=0}__checkMerkleRoot(){if(!this.transactions)throw c;const e=h.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(e)}__checkWitnessCommit(){if(!this.transactions)throw c;if(!this.hasWitnessCommit())throw l;const e=h.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(e)}}function d(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}t.Block=h},606:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.BufferReader=t.BufferWriter=t.cloneBuffer=t.reverseBuffer=t.writeUInt64LE=t.readUInt64LE=t.varuint=void 0;const i=r(8116),{typeforce:o}=i,a=r(8469);function s(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function u(e,t){const r=e.readUInt32LE(t);let n=e.readUInt32LE(t+4);return n*=4294967296,s(n+r,9007199254740991),n+r}function f(e,t,r){return s(t,9007199254740991),e.writeInt32LE(-1&t,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}t.varuint=a,t.readUInt64LE=u,t.writeUInt64LE=f,t.reverseBuffer=function(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e},t.cloneBuffer=function(e){const t=n.allocUnsafe(e.length);return e.copy(t),t};class c{static withCapacity(e){return new c(n.alloc(e))}constructor(e,t=0){this.buffer=e,this.offset=t,o(i.tuple(i.Buffer,i.UInt32),[e,t])}writeUInt8(e){this.offset=this.buffer.writeUInt8(e,this.offset)}writeInt32(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}writeUInt32(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}writeUInt64(e){this.offset=f(this.buffer,e,this.offset)}writeVarInt(e){a.encode(e,this.buffer,this.offset),this.offset+=a.encode.bytes}writeSlice(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}writeVarSlice(e){this.writeVarInt(e.length),this.writeSlice(e)}writeVector(e){this.writeVarInt(e.length),e.forEach((e=>this.writeVarSlice(e)))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}t.BufferWriter=c,t.BufferReader=class{constructor(e,t=0){this.buffer=e,this.offset=t,o(i.tuple(i.Buffer,i.UInt32),[e,t])}readUInt8(){const e=this.buffer.readUInt8(this.offset);return this.offset++,e}readInt32(){const e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}readUInt32(){const e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}readUInt64(){const e=u(this.buffer,this.offset);return this.offset+=8,e}readVarInt(){const e=a.decode(this.buffer,this.offset);return this.offset+=a.decode.bytes,e}readSlice(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");const t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const e=this.readVarInt(),t=[];for(let r=0;r<e;r++)t.push(this.readVarSlice());return t}}},1944:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.taggedHash=t.TAGGED_HASH_PREFIXES=t.TAGS=t.hash256=t.hash160=t.sha256=t.sha1=t.ripemd160=void 0;const i=r(3238),o=r(1549),a=r(2623);function s(e){return n.from((0,a.sha256)(Uint8Array.from(e)))}t.ripemd160=function(e){return n.from((0,i.ripemd160)(Uint8Array.from(e)))},t.sha1=function(e){return n.from((0,o.sha1)(Uint8Array.from(e)))},t.sha256=s,t.hash160=function(e){return n.from((0,i.ripemd160)((0,a.sha256)(Uint8Array.from(e))))},t.hash256=function(e){return n.from((0,a.sha256)((0,a.sha256)(Uint8Array.from(e))))},t.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],t.TAGGED_HASH_PREFIXES={"BIP0340/challenge":n.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":n.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":n.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:n.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:n.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:n.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:n.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":n.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":n.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])},t.taggedHash=function(e,r){return s(n.concat([t.TAGGED_HASH_PREFIXES[e],r]))}},916:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.getEccLib=t.initEccLib=void 0;const i={};t.initEccLib=function(e){var t;e?e!==i.eccLib&&(a("function"==typeof(t=e).isXOnlyPoint),a(t.isXOnlyPoint(o("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),a(t.isXOnlyPoint(o("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),a(t.isXOnlyPoint(o("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),a(t.isXOnlyPoint(o("0000000000000000000000000000000000000000000000000000000000000001"))),a(!t.isXOnlyPoint(o("0000000000000000000000000000000000000000000000000000000000000000"))),a(!t.isXOnlyPoint(o("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),a("function"==typeof t.xOnlyPointAddTweak),s.forEach((e=>{const r=t.xOnlyPointAddTweak(o(e.pubkey),o(e.tweak));null===e.result?a(null===r):(a(null!==r),a(r.parity===e.parity),a(n.from(r.xOnlyPubkey).equals(o(e.result))))})),i.eccLib=e):i.eccLib=e},t.getEccLib=function(){if(!i.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return i.eccLib};const o=e=>n.from(e,"hex");function a(e){if(!e)throw new Error("ecc library invalid")}const s=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}]},1757:(e,t,r)=>{t.f0=t.Ez=t.iL=t.K$=t.KT=t.o8=t.Et=t.hl=void 0;const n=r(57);t.hl=n;const i=r(1944);t.Et=i;const o=r(622);t.o8=o;const a=r(885);t.KT=a;const s=r(7038);t.K$=s;r(1696);var u=r(9646);Object.defineProperty(t,"iL",{enumerable:!0,get:function(){return u.Psbt}});var f=r(8417);Object.defineProperty(t,"Ez",{enumerable:!0,get:function(){return f.OPS}});r(2021);var c=r(916);Object.defineProperty(t,"f0",{enumerable:!0,get:function(){return c.initEccLib}})},1015:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.fastMerkleRoot=void 0,t.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");let r=e.length;const i=e.concat();for(;r>1;){let e=0;for(let o=0;o<r;o+=2,++e){const a=i[o],s=o+1===r?a:i[o+1],u=n.concat([a,s]);i[e]=t(u)}r=e}return i[0]}},622:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.testnet=t.regtest=t.bitcoin=void 0,t.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},t.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},t.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},8417:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.REVERSE_OPS=t.OPS=void 0;const r={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1: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_SUBSTR:127,OP_LEFT:128,OP_RIGHT: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_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};t.OPS=r;const n={};t.REVERSE_OPS=n;for(const e of Object.keys(r))n[r[e]]=e},2218:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tweakKey=t.tapTweakHash=t.tapleafHash=t.findScriptPath=t.toHashTree=t.rootHashFromPath=t.MAX_TAPTREE_DEPTH=t.LEAF_VERSION_TAPSCRIPT=void 0;const n=r(8287),i=r(916),o=r(1944),a=r(606),s=r(8116);function u(e){const r=e.version||t.LEAF_VERSION_TAPSCRIPT;return o.taggedHash("TapLeaf",n.Buffer.concat([n.Buffer.from([r]),l(e.output)]))}function f(e,t){return o.taggedHash("TapTweak",n.Buffer.concat(t?[e,t]:[e]))}function c(e,t){return o.taggedHash("TapBranch",n.Buffer.concat([e,t]))}function l(e){const t=a.varuint.encodingLength(e.length),r=n.Buffer.allocUnsafe(t);return a.varuint.encode(e.length,r),n.Buffer.concat([r,e])}t.LEAF_VERSION_TAPSCRIPT=192,t.MAX_TAPTREE_DEPTH=128,t.rootHashFromPath=function(e,t){if(e.length<33)throw new TypeError(`The control-block length is too small. Got ${e.length}, expected min 33.`);const r=(e.length-33)/32;let n=t;for(let t=0;t<r;t++){const r=e.slice(33+32*t,65+32*t);n=n.compare(r)<0?c(n,r):c(r,n)}return n},t.toHashTree=function e(t){if((0,s.isTapleaf)(t))return{hash:u(t)};const r=[e(t[0]),e(t[1])];r.sort(((e,t)=>e.hash.compare(t.hash)));const[n,i]=r;return{hash:c(n.hash,i.hash),left:n,right:i}},t.findScriptPath=function e(t,r){if("left"in(n=t)&&"right"in n){const n=e(t.left,r);if(void 0!==n)return[...n,t.right.hash];const i=e(t.right,r);if(void 0!==i)return[...i,t.left.hash]}else if(t.hash.equals(r))return[];var n},t.tapleafHash=u,t.tapTweakHash=f,t.tweakKey=function(e,t){if(!n.Buffer.isBuffer(e))return null;if(32!==e.length)return null;if(t&&32!==t.length)return null;const r=f(e,t),o=(0,i.getEccLib)().xOnlyPointAddTweak(e,r);return o&&null!==o.xOnlyPubkey?{parity:o.parity,x:n.Buffer.from(o.xOnlyPubkey)}:null}},5472:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2data=void 0;const n=r(622),i=r(7038),o=r(8116),a=r(7883),s=i.OPS;t.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),data:o.typeforce.maybe(o.typeforce.arrayOf(o.typeforce.Buffer))},e);const r={name:"embed",network:e.network||n.bitcoin};if(a.prop(r,"output",(()=>{if(e.data)return i.compile([s.OP_RETURN].concat(e.data))})),a.prop(r,"data",(()=>{if(e.output)return i.decompile(e.output).slice(1)})),t.validate&&e.output){const t=i.decompile(e.output);if(t[0]!==s.OP_RETURN)throw new TypeError("Output is invalid");if(!t.slice(1).every(o.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!(0,o.stacksEqual)(e.data,r.data))throw new TypeError("Data mismatch")}return Object.assign(r,e)}},885:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2tr=t.p2wsh=t.p2wpkh=t.p2sh=t.p2pkh=t.p2pk=t.p2ms=t.embed=void 0;const n=r(5472);Object.defineProperty(t,"embed",{enumerable:!0,get:function(){return n.p2data}});const i=r(1395);Object.defineProperty(t,"p2ms",{enumerable:!0,get:function(){return i.p2ms}});const o=r(4930);Object.defineProperty(t,"p2pk",{enumerable:!0,get:function(){return o.p2pk}});const a=r(3504);Object.defineProperty(t,"p2pkh",{enumerable:!0,get:function(){return a.p2pkh}});const s=r(8368);Object.defineProperty(t,"p2sh",{enumerable:!0,get:function(){return s.p2sh}});const u=r(7027);Object.defineProperty(t,"p2wpkh",{enumerable:!0,get:function(){return u.p2wpkh}});const f=r(9041);Object.defineProperty(t,"p2wsh",{enumerable:!0,get:function(){return f.p2wsh}});const c=r(5501);Object.defineProperty(t,"p2tr",{enumerable:!0,get:function(){return c.p2tr}})},7883:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.value=t.prop=void 0,t.prop=function(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const e=r.call(this);return this[t]=e,e},set(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},t.value=function(e){let t;return()=>(void 0!==t||(t=e()),t)}},1395:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2ms=void 0;const n=r(622),i=r(7038),o=r(8116),a=r(7883),s=i.OPS,u=s.OP_RESERVED;t.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function r(e){return i.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===s.OP_0)}t=Object.assign({validate:!0},t||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),m:o.typeforce.maybe(o.typeforce.Number),n:o.typeforce.maybe(o.typeforce.Number),output:o.typeforce.maybe(o.typeforce.Buffer),pubkeys:o.typeforce.maybe(o.typeforce.arrayOf(o.isPoint)),signatures:o.typeforce.maybe(o.typeforce.arrayOf(r)),input:o.typeforce.maybe(o.typeforce.Buffer)},e);const f={network:e.network||n.bitcoin};let c=[],l=!1;function h(e){l||(l=!0,c=i.decompile(e),f.m=c[0]-u,f.n=c[c.length-2]-u,f.pubkeys=c.slice(1,-2))}if(a.prop(f,"output",(()=>{if(e.m&&f.n&&e.pubkeys)return i.compile([].concat(u+e.m,e.pubkeys,u+f.n,s.OP_CHECKMULTISIG))})),a.prop(f,"m",(()=>{if(f.output)return h(f.output),f.m})),a.prop(f,"n",(()=>{if(f.pubkeys)return f.pubkeys.length})),a.prop(f,"pubkeys",(()=>{if(e.output)return h(e.output),f.pubkeys})),a.prop(f,"signatures",(()=>{if(e.input)return i.decompile(e.input).slice(1)})),a.prop(f,"input",(()=>{if(e.signatures)return i.compile([s.OP_0].concat(e.signatures))})),a.prop(f,"witness",(()=>{if(f.input)return[]})),a.prop(f,"name",(()=>{if(f.m&&f.n)return`p2ms(${f.m} of ${f.n})`})),t.validate){if(e.output){if(h(e.output),!o.typeforce.Number(c[0]))throw new TypeError("Output is invalid");if(!o.typeforce.Number(c[c.length-2]))throw new TypeError("Output is invalid");if(c[c.length-1]!==s.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(f.m<=0||f.n>16||f.m>f.n||f.n!==c.length-3)throw new TypeError("Output is invalid");if(!f.pubkeys.every((e=>(0,o.isPoint)(e))))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==f.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==f.n)throw new TypeError("n mismatch");if(e.pubkeys&&!(0,o.stacksEqual)(e.pubkeys,f.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(f.n=e.pubkeys.length,f.n<f.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<f.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>f.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==s.OP_0)throw new TypeError("Input is invalid");if(0===f.signatures.length||!f.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!(0,o.stacksEqual)(e.signatures,f.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(f,e)}},4930:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2pk=void 0;const n=r(622),i=r(7038),o=r(8116),a=r(7883),s=i.OPS;t.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,o.typeforce)({network:o.typeforce.maybe(o.typeforce.Object),output:o.typeforce.maybe(o.typeforce.Buffer),pubkey:o.typeforce.maybe(o.isPoint),signature:o.typeforce.maybe(i.isCanonicalScriptSignature),input:o.typeforce.maybe(o.typeforce.Buffer)},e);const r=a.value((()=>i.decompile(e.input))),u={name:"p2pk",network:e.network||n.bitcoin};if(a.prop(u,"output",(()=>{if(e.pubkey)return i.compile([e.pubkey,s.OP_CHECKSIG])})),a.prop(u,"pubkey",(()=>{if(e.output)return e.output.slice(1,-1)})),a.prop(u,"signature",(()=>{if(e.input)return r()[0]})),a.prop(u,"input",(()=>{if(e.signature)return i.compile([e.signature])})),a.prop(u,"witness",(()=>{if(u.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==s.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,o.isPoint)(u.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(u.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(u.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==r().length)throw new TypeError("Input is invalid");if(!i.isCanonicalScriptSignature(u.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(u,e)}},3504:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2pkh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(1889),c=a.OPS;t.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),output:s.typeforce.maybe(s.typeforce.BufferN(25)),pubkey:s.typeforce.maybe(s.isPoint),signature:s.typeforce.maybe(a.isCanonicalScriptSignature),input:s.typeforce.maybe(s.typeforce.Buffer)},e);const r=u.value((()=>{const t=n.from(f.decode(e.address));return{version:t.readUInt8(0),hash:t.slice(1)}})),l=u.value((()=>a.decompile(e.input))),h=e.network||o.bitcoin,d={name:"p2pkh",network:h};if(u.prop(d,"address",(()=>{if(!d.hash)return;const e=n.allocUnsafe(21);return e.writeUInt8(h.pubKeyHash,0),d.hash.copy(e,1),f.encode(e)})),u.prop(d,"hash",(()=>e.output?e.output.slice(3,23):e.address?r().hash:e.pubkey||d.pubkey?i.hash160(e.pubkey||d.pubkey):void 0)),u.prop(d,"output",(()=>{if(d.hash)return a.compile([c.OP_DUP,c.OP_HASH160,d.hash,c.OP_EQUALVERIFY,c.OP_CHECKSIG])})),u.prop(d,"pubkey",(()=>{if(e.input)return l()[1]})),u.prop(d,"signature",(()=>{if(e.input)return l()[0]})),u.prop(d,"input",(()=>{if(e.pubkey&&e.signature)return a.compile([e.signature,e.pubkey])})),u.prop(d,"witness",(()=>{if(d.input)return[]})),t.validate){let t=n.from([]);if(e.address){if(r().version!==h.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==r().hash.length)throw new TypeError("Invalid address");t=r().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==c.OP_DUP||e.output[1]!==c.OP_HASH160||20!==e.output[2]||e.output[23]!==c.OP_EQUALVERIFY||e.output[24]!==c.OP_CHECKSIG)throw new TypeError("Output is invalid");const r=e.output.slice(3,23);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.pubkey){const r=i.hash160(e.pubkey);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.input){const r=l();if(2!==r.length)throw new TypeError("Input is invalid");if(!a.isCanonicalScriptSignature(r[0]))throw new TypeError("Input has invalid signature");if(!(0,s.isPoint)(r[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(r[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(r[1]))throw new TypeError("Pubkey mismatch");const n=i.hash160(r[1]);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch")}}return Object.assign(d,e)}},8368:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2sh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(1889),c=a.OPS;t.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),output:s.typeforce.maybe(s.typeforce.BufferN(23)),redeem:s.typeforce.maybe({network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.Buffer),input:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),input:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},e);let r=e.network;r||(r=e.redeem&&e.redeem.network||o.bitcoin);const l={network:r},h=u.value((()=>{const t=n.from(f.decode(e.address));return{version:t.readUInt8(0),hash:t.slice(1)}})),d=u.value((()=>a.decompile(e.input))),p=u.value((()=>{const t=d(),i=t[t.length-1];return{network:r,output:i===c.OP_FALSE?n.from([]):i,input:a.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(u.prop(l,"address",(()=>{if(!l.hash)return;const e=n.allocUnsafe(21);return e.writeUInt8(l.network.scriptHash,0),l.hash.copy(e,1),f.encode(e)})),u.prop(l,"hash",(()=>e.output?e.output.slice(2,22):e.address?h().hash:l.redeem&&l.redeem.output?i.hash160(l.redeem.output):void 0)),u.prop(l,"output",(()=>{if(l.hash)return a.compile([c.OP_HASH160,l.hash,c.OP_EQUAL])})),u.prop(l,"redeem",(()=>{if(e.input)return p()})),u.prop(l,"input",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.output)return a.compile([].concat(a.decompile(e.redeem.input),e.redeem.output))})),u.prop(l,"witness",(()=>l.redeem&&l.redeem.witness?l.redeem.witness:l.input?[]:void 0)),u.prop(l,"name",(()=>{const e=["p2sh"];return void 0!==l.redeem&&void 0!==l.redeem.name&&e.push(l.redeem.name),e.join("-")})),t.validate){let t=n.from([]);if(e.address){if(h().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==h().hash.length)throw new TypeError("Invalid address");t=h().hash}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==c.OP_HASH160||20!==e.output[1]||e.output[22]!==c.OP_EQUAL)throw new TypeError("Output is invalid");const r=e.output.slice(2,22);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}const o=e=>{if(e.output){const r=a.decompile(e.output);if(!r||r.length<1)throw new TypeError("Redeem.output too short");if(e.output.byteLength>520)throw new TypeError("Redeem.output unspendable if larger than 520 bytes");if(a.countNonPushOnlyOPs(r)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const n=i.hash160(e.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.input){const t=e.input.length>0,r=e.witness&&e.witness.length>0;if(!t&&!r)throw new TypeError("Empty input");if(t&&r)throw new TypeError("Input and witness provided");if(t){const t=a.decompile(e.input);if(!a.isPushOnly(t))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const e=d();if(!e||e.length<1)throw new TypeError("Input too short");if(!n.isBuffer(p().output))throw new TypeError("Input is invalid");o(p())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==r)throw new TypeError("Network mismatch");if(e.input){const t=p();if(e.redeem.output&&!e.redeem.output.equals(t.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(t.input))throw new TypeError("Redeem.input mismatch")}o(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!(0,s.stacksEqual)(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(l,e)}},5501:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.p2tr=void 0;const n=r(8287),i=r(622),o=r(7038),a=r(8116),s=r(916),u=r(2218),f=r(7883),c=r(2343),l=r(57),h=o.OPS;t.p2tr=function(e,t){if(!(e.address||e.output||e.pubkey||e.internalPubkey||e.witness&&e.witness.length>1))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,a.typeforce)({address:a.typeforce.maybe(a.typeforce.String),input:a.typeforce.maybe(a.typeforce.BufferN(0)),network:a.typeforce.maybe(a.typeforce.Object),output:a.typeforce.maybe(a.typeforce.BufferN(34)),internalPubkey:a.typeforce.maybe(a.typeforce.BufferN(32)),hash:a.typeforce.maybe(a.typeforce.BufferN(32)),pubkey:a.typeforce.maybe(a.typeforce.BufferN(32)),signature:a.typeforce.maybe(a.typeforce.anyOf(a.typeforce.BufferN(64),a.typeforce.BufferN(65))),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer)),scriptTree:a.typeforce.maybe(a.isTaptree),redeem:a.typeforce.maybe({output:a.typeforce.maybe(a.typeforce.Buffer),redeemVersion:a.typeforce.maybe(a.typeforce.Number),witness:a.typeforce.maybe(a.typeforce.arrayOf(a.typeforce.Buffer))}),redeemVersion:a.typeforce.maybe(a.typeforce.Number)},e);const r=f.value((()=>(0,l.fromBech32)(e.address))),d=f.value((()=>{if(e.witness&&e.witness.length)return e.witness.length>=2&&80===e.witness[e.witness.length-1][0]?e.witness.slice(0,-1):e.witness.slice()})),p=f.value((()=>e.scriptTree?(0,u.toHashTree)(e.scriptTree):e.hash?{hash:e.hash}:void 0)),y=e.network||i.bitcoin,g={name:"p2tr",network:y};if(f.prop(g,"address",(()=>{if(!g.pubkey)return;const e=c.bech32m.toWords(g.pubkey);return e.unshift(1),c.bech32m.encode(y.bech32,e)})),f.prop(g,"hash",(()=>{const e=p();if(e)return e.hash;const t=d();if(t&&t.length>1){const e=t[t.length-1],r=e[0]&a.TAPLEAF_VERSION_MASK,n=t[t.length-2],i=(0,u.tapleafHash)({output:n,version:r});return(0,u.rootHashFromPath)(e,i)}return null})),f.prop(g,"output",(()=>{if(g.pubkey)return o.compile([h.OP_1,g.pubkey])})),f.prop(g,"redeemVersion",(()=>e.redeemVersion?e.redeemVersion:e.redeem&&void 0!==e.redeem.redeemVersion&&null!==e.redeem.redeemVersion?e.redeem.redeemVersion:u.LEAF_VERSION_TAPSCRIPT)),f.prop(g,"redeem",(()=>{const e=d();if(e&&!(e.length<2))return{output:e[e.length-2],witness:e.slice(0,-2),redeemVersion:e[e.length-1][0]&a.TAPLEAF_VERSION_MASK}})),f.prop(g,"pubkey",(()=>{if(e.pubkey)return e.pubkey;if(e.output)return e.output.slice(2);if(e.address)return r().data;if(g.internalPubkey){const e=(0,u.tweakKey)(g.internalPubkey,g.hash);if(e)return e.x}})),f.prop(g,"internalPubkey",(()=>{if(e.internalPubkey)return e.internalPubkey;const t=d();return t&&t.length>1?t[t.length-1].slice(1,33):void 0})),f.prop(g,"signature",(()=>{if(e.signature)return e.signature;const t=d();return t&&1===t.length?t[0]:void 0})),f.prop(g,"witness",(()=>{if(e.witness)return e.witness;const t=p();if(t&&e.redeem&&e.redeem.output&&e.internalPubkey){const r=(0,u.tapleafHash)({output:e.redeem.output,version:g.redeemVersion}),i=(0,u.findScriptPath)(t,r);if(!i)return;const o=(0,u.tweakKey)(e.internalPubkey,t.hash);if(!o)return;const a=n.Buffer.concat([n.Buffer.from([g.redeemVersion|o.parity]),e.internalPubkey].concat(i));return[e.redeem.output,a]}return e.signature?[e.signature]:void 0})),t.validate){let t=n.Buffer.from([]);if(e.address){if(y&&y.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(1!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");t=r().data}if(e.pubkey){if(t.length>0&&!t.equals(e.pubkey))throw new TypeError("Pubkey mismatch");t=e.pubkey}if(e.output){if(34!==e.output.length||e.output[0]!==h.OP_1||32!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Pubkey mismatch");t=e.output.slice(2)}if(e.internalPubkey){const r=(0,u.tweakKey)(e.internalPubkey,g.hash);if(t.length>0&&!t.equals(r.x))throw new TypeError("Pubkey mismatch");t=r.x}if(t&&t.length&&!(0,s.getEccLib)().isXOnlyPoint(t))throw new TypeError("Invalid pubkey for p2tr");const i=p();if(e.hash&&i&&!e.hash.equals(i.hash))throw new TypeError("Hash mismatch");if(e.redeem&&e.redeem.output&&i){const t=(0,u.tapleafHash)({output:e.redeem.output,version:g.redeemVersion});if(!(0,u.findScriptPath)(i,t))throw new TypeError("Redeem script not in tree")}const f=d();if(e.redeem&&g.redeem){if(e.redeem.redeemVersion&&e.redeem.redeemVersion!==g.redeem.redeemVersion)throw new TypeError("Redeem.redeemVersion and witness mismatch");if(e.redeem.output){if(0===o.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");if(g.redeem.output&&!e.redeem.output.equals(g.redeem.output))throw new TypeError("Redeem.output and witness mismatch")}if(e.redeem.witness&&g.redeem.witness&&!(0,a.stacksEqual)(e.redeem.witness,g.redeem.witness))throw new TypeError("Redeem.witness and witness mismatch")}if(f&&f.length)if(1===f.length){if(e.signature&&!e.signature.equals(f[0]))throw new TypeError("Signature mismatch")}else{const r=f[f.length-1];if(r.length<33)throw new TypeError(`The control-block length is too small. Got ${r.length}, expected min 33.`);if((r.length-33)%32!=0)throw new TypeError(`The control-block length of ${r.length} is incorrect!`);const n=(r.length-33)/32;if(n>128)throw new TypeError(`The script path is too long. Got ${n}, expected max 128.`);const i=r.slice(1,33);if(e.internalPubkey&&!e.internalPubkey.equals(i))throw new TypeError("Internal pubkey mismatch");if(!(0,s.getEccLib)().isXOnlyPoint(i))throw new TypeError("Invalid internalPubkey for p2tr witness");const o=r[0]&a.TAPLEAF_VERSION_MASK,c=f[f.length-2],l=(0,u.tapleafHash)({output:c,version:o}),h=(0,u.rootHashFromPath)(r,l),d=(0,u.tweakKey)(i,h);if(!d)throw new TypeError("Invalid outputKey for p2tr witness");if(t.length&&!t.equals(d.x))throw new TypeError("Pubkey mismatch for p2tr witness");if(d.parity!==(1&r[0]))throw new Error("Incorrect parity")}}return Object.assign(g,e)}},7027:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2wpkh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(2343),c=a.OPS,l=n.alloc(0);t.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(20)),input:s.typeforce.maybe(s.typeforce.BufferN(0)),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.BufferN(22)),pubkey:s.typeforce.maybe(s.isPoint),signature:s.typeforce.maybe(a.isCanonicalScriptSignature),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},e);const r=u.value((()=>{const t=f.bech32.decode(e.address),r=t.words.shift(),i=f.bech32.fromWords(t.words);return{version:r,prefix:t.prefix,data:n.from(i)}})),h=e.network||o.bitcoin,d={name:"p2wpkh",network:h};if(u.prop(d,"address",(()=>{if(!d.hash)return;const e=f.bech32.toWords(d.hash);return e.unshift(0),f.bech32.encode(h.bech32,e)})),u.prop(d,"hash",(()=>e.output?e.output.slice(2,22):e.address?r().data:e.pubkey||d.pubkey?i.hash160(e.pubkey||d.pubkey):void 0)),u.prop(d,"output",(()=>{if(d.hash)return a.compile([c.OP_0,d.hash])})),u.prop(d,"pubkey",(()=>e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0)),u.prop(d,"signature",(()=>{if(e.witness)return e.witness[0]})),u.prop(d,"input",(()=>{if(d.witness)return l})),u.prop(d,"witness",(()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){let t=n.from([]);if(e.address){if(h&&h.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(20!==r().data.length)throw new TypeError("Invalid address data");t=r().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==c.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(t.length>0&&!t.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");t=e.output.slice(2)}if(e.pubkey){const r=i.hash160(e.pubkey);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");if(t=r,!(0,s.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!a.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,s.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const r=i.hash160(e.witness[1]);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch")}}return Object.assign(d,e)}},9041:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.p2wsh=void 0;const i=r(1944),o=r(622),a=r(7038),s=r(8116),u=r(7883),f=r(2343),c=a.OPS,l=n.alloc(0);function h(e){return!(!n.isBuffer(e)||65!==e.length||4!==e[0]||!(0,s.isPoint)(e))}t.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,s.typeforce)({network:s.typeforce.maybe(s.typeforce.Object),address:s.typeforce.maybe(s.typeforce.String),hash:s.typeforce.maybe(s.typeforce.BufferN(32)),output:s.typeforce.maybe(s.typeforce.BufferN(34)),redeem:s.typeforce.maybe({input:s.typeforce.maybe(s.typeforce.Buffer),network:s.typeforce.maybe(s.typeforce.Object),output:s.typeforce.maybe(s.typeforce.Buffer),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))}),input:s.typeforce.maybe(s.typeforce.BufferN(0)),witness:s.typeforce.maybe(s.typeforce.arrayOf(s.typeforce.Buffer))},e);const r=u.value((()=>{const t=f.bech32.decode(e.address),r=t.words.shift(),i=f.bech32.fromWords(t.words);return{version:r,prefix:t.prefix,data:n.from(i)}})),d=u.value((()=>a.decompile(e.redeem.input)));let p=e.network;p||(p=e.redeem&&e.redeem.network||o.bitcoin);const y={network:p};if(u.prop(y,"address",(()=>{if(!y.hash)return;const e=f.bech32.toWords(y.hash);return e.unshift(0),f.bech32.encode(p.bech32,e)})),u.prop(y,"hash",(()=>e.output?e.output.slice(2):e.address?r().data:y.redeem&&y.redeem.output?i.sha256(y.redeem.output):void 0)),u.prop(y,"output",(()=>{if(y.hash)return a.compile([c.OP_0,y.hash])})),u.prop(y,"redeem",(()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:l,witness:e.witness.slice(0,-1)}})),u.prop(y,"input",(()=>{if(y.witness)return l})),u.prop(y,"witness",(()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const t=a.toStack(d());return y.redeem=Object.assign({witness:t},e.redeem),y.redeem.input=l,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),u.prop(y,"name",(()=>{const e=["p2wsh"];return void 0!==y.redeem&&void 0!==y.redeem.name&&e.push(y.redeem.name),e.join("-")})),t.validate){let t=n.from([]);if(e.address){if(r().prefix!==p.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==r().version)throw new TypeError("Invalid address version");if(32!==r().data.length)throw new TypeError("Invalid address data");t=r().data}if(e.hash){if(t.length>0&&!t.equals(e.hash))throw new TypeError("Hash mismatch");t=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==c.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");const r=e.output.slice(2);if(t.length>0&&!t.equals(r))throw new TypeError("Hash mismatch");t=r}if(e.redeem){if(e.redeem.network&&e.redeem.network!==p)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){const r=a.decompile(e.redeem.output);if(!r||r.length<1)throw new TypeError("Redeem.output is invalid");if(e.redeem.output.byteLength>3600)throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");if(a.countNonPushOnlyOPs(r)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const n=i.sha256(e.redeem.output);if(t.length>0&&!t.equals(n))throw new TypeError("Hash mismatch");t=n}if(e.redeem.input&&!a.isPushOnly(d()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!(0,s.stacksEqual)(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&d().some(h)||e.redeem.output&&(a.decompile(e.redeem.output)||[]).some(h))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const t=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(t))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(h)||(a.decompile(t)||[]).some(h))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(y,e)}},9646:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Psbt=void 0;const i=r(1614),o=r(394),a=r(5080),s=r(57),u=r(606),f=r(622),c=r(885),l=r(2218),h=r(7038),d=r(2021),p=r(477),y=r(4929),g={network:f.bitcoin,maximumFeeRate:5e3};class b{static fromBase64(e,t={}){const r=n.from(e,"base64");return this.fromBuffer(r,t)}static fromHex(e,t={}){const r=n.from(e,"hex");return this.fromBuffer(r,t)}static fromBuffer(e,t={}){const r=i.Psbt.fromBuffer(e,m),n=new b(t,r);var o,a;return o=n.__CACHE.__TX,a=n.__CACHE,o.ins.forEach((e=>{P(a,e)})),n}constructor(e={},t=new i.Psbt(new v)){this.data=t,this.opts=Object.assign({},g,e),this.__CACHE={__NON_WITNESS_UTXO_TX_CACHE:[],__NON_WITNESS_UTXO_BUF_CACHE:[],__TX_IN_CACHE:{},__TX:this.data.globalMap.unsignedTx.tx,__UNSAFE_SIGN_NONSEGWIT:!1},0===this.data.inputs.length&&this.setVersion(2);const r=(e,t,r,n)=>Object.defineProperty(e,t,{enumerable:r,writable:n});r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}get inputCount(){return this.data.inputs.length}get version(){return this.__CACHE.__TX.version}set version(e){this.setVersion(e)}get locktime(){return this.__CACHE.__TX.locktime}set locktime(e){this.setLocktime(e)}get txInputs(){return this.__CACHE.__TX.ins.map((e=>({hash:(0,u.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence})))}get txOutputs(){return this.__CACHE.__TX.outs.map((e=>{let t;try{t=(0,s.fromOutputScript)(e.script,this.opts.network)}catch(e){}return{script:(0,u.cloneBuffer)(e.script),value:e.value,address:t}}))}combine(...e){return this.data.combine(...e.map((e=>e.data))),this}clone(){const e=b.fromBuffer(this.data.toBuffer());return e.opts=JSON.parse(JSON.stringify(this.opts)),e}setMaximumFeeRate(e){k(e),this.opts.maximumFeeRate=e}setVersion(e){k(e),T(this.data.inputs,"setVersion");const t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}setLocktime(e){k(e),T(this.data.inputs,"setLocktime");const t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}setInputSequence(e,t){k(t),T(this.data.inputs,"setInputSequence");const r=this.__CACHE;if(r.__TX.ins.length<=e)throw new Error("Input index too high");return r.__TX.ins[e].sequence=t,r.__EXTRACTED_TX=void 0,this}addInputs(e){return e.forEach((e=>this.addInput(e))),this}addInput(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");(0,p.checkTaprootInputFields)(e,e,"addInput"),T(this.data.inputs,"addInput"),e.witnessScript&&X(e.witnessScript);const t=this.__CACHE;this.data.addInput(e),P(t,t.__TX.ins[t.__TX.ins.length-1]);const r=this.data.inputs.length-1,n=this.data.inputs[r];return n.nonWitnessUtxo&&F(this.__CACHE,n,r),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}addOutputs(e){return e.forEach((e=>this.addOutput(e))),this}addOutput(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");T(this.data.inputs,"addOutput");const{address:t}=e;if("string"==typeof t){const{network:r}=this.opts,n=(0,s.toOutputScript)(t,r);e=Object.assign(e,{script:n})}(0,p.checkTaprootOutputFields)(e,e,"addOutput");const r=this.__CACHE;return this.data.addOutput(e),r.__FEE=void 0,r.__FEE_RATE=void 0,r.__EXTRACTED_TX=void 0,this}extractTransaction(e){if(!this.data.inputs.every(E))throw new Error("Not finalized");const t=this.__CACHE;if(e||function(e,t,r){const n=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=n*i;if(n>=r.maximumFeeRate)throw new Error(`Warning: You are paying around ${(o/1e8).toFixed(8)} in fees, which is ${n} satoshi per byte for a transaction with a VSize of ${i} bytes (segwit counted as 0.25 byte per byte). Use setMaximumFeeRate method to raise your threshold, or pass true to the first arg of extractTransaction.`)}(this,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;const r=t.__TX.clone();return K(this.data.inputs,r,t,!0),r}getFeeRate(){return M("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return M("__FEE","fee",this.data.inputs,this.__CACHE)}finalizeAllInputs(){return(0,a.checkForInput)(this.data.inputs,0),Z(this.data.inputs.length).forEach((e=>this.finalizeInput(e))),this}finalizeInput(e,t){const r=(0,a.checkForInput)(this.data.inputs,e);return(0,p.isTaprootInput)(r)?this._finalizeTaprootInput(e,r,void 0,t):this._finalizeInput(e,r,t)}finalizeTaprootInput(e,t,r=p.tapScriptFinalizer){const n=(0,a.checkForInput)(this.data.inputs,e);if((0,p.isTaprootInput)(n))return this._finalizeTaprootInput(e,n,t,r);throw new Error(`Cannot finalize input #${e}. Not Taproot.`)}_finalizeInput(e,t,r=N){const{script:n,isP2SH:i,isP2WSH:o,isSegwit:a}=function(e,t,r){const n=r.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){const o=G(r,t,e),a=n.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||(0,y.isP2WPKH)(i.script))&&(i.isSegwit=!0),i}(e,t,this.__CACHE);if(!n)throw new Error(`No script found for input #${e}`);!function(e){if(!e.sighashType||!e.partialSig)return;const{partialSig:t,sighashType:r}=e;t.forEach((e=>{const{hashType:t}=h.signature.decode(e.signature);if(r!==t)throw new Error("Signature sighash does not match input sighash type")}))}(t);const{finalScriptSig:s,finalScriptWitness:u}=r(e,t,n,a,i,o);if(s&&this.data.updateInput(e,{finalScriptSig:s}),u&&this.data.updateInput(e,{finalScriptWitness:u}),!s&&!u)throw new Error(`Unknown error finalizing input #${e}`);return this.data.clearFinalizedInput(e),this}_finalizeTaprootInput(e,t,r,n=p.tapScriptFinalizer){if(!t.witnessUtxo)throw new Error(`Cannot finalize input #${e}. Missing withness utxo.`);if(t.tapKeySig){const r=c.p2tr({output:t.witnessUtxo.script,signature:t.tapKeySig}),n=(0,y.witnessStackToScriptWitness)(r.witness);this.data.updateInput(e,{finalScriptWitness:n})}else{const{finalScriptWitness:i}=n(e,t,r);this.data.updateInput(e,{finalScriptWitness:i})}return this.data.clearFinalizedInput(e),this}getInputType(e){const t=(0,a.checkForInput)(this.data.inputs,e),r=q(V(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(!e)return;const t=h.decompile(e);if(!t)return;const r=t[t.length-1];var i;if(n.isBuffer(r)&&!W(r)&&(i=r,!h.isCanonicalScriptSignature(i))&&h.decompile(r))return r}(t.finalScriptSig),t.witnessScript||function(e){if(!e)return;const t=H(e),r=t[t.length-1];return!W(r)&&h.decompile(r)?r:void 0}(t.finalScriptWitness));return("raw"===r.type?"":r.type+"-")+$(r.meaningfulScript)}inputHasPubkey(e,t){return function(e,t,r,n){const i=V(r,t,n),{meaningfulScript:o}=q(i,r,"input",t.redeemScript,t.witnessScript);return(0,y.pubkeyInScript)(e,o)}(t,(0,a.checkForInput)(this.data.inputs,e),e,this.__CACHE)}inputHasHDKey(e,t){const r=(0,a.checkForInput)(this.data.inputs,e),n=S(t);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}outputHasPubkey(e,t){return function(e,t,r,n){const i=n.__TX.outs[r].script,{meaningfulScript:o}=q(i,r,"output",t.redeemScript,t.witnessScript);return(0,y.pubkeyInScript)(e,o)}(t,(0,a.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}outputHasHDKey(e,t){const r=(0,a.checkForOutput)(this.data.outputs,e),n=S(t);return!!r.bip32Derivation&&r.bip32Derivation.some(n)}validateSignaturesOfAllInputs(e){return(0,a.checkForInput)(this.data.inputs,0),Z(this.data.inputs.length).map((t=>this.validateSignaturesOfInput(t,e))).reduce(((e,t)=>!0===t&&e),!0)}validateSignaturesOfInput(e,t,r){const n=this.data.inputs[e];return(0,p.isTaprootInput)(n)?this.validateSignaturesOfTaprootInput(e,t,r):this._validateSignaturesOfInput(e,t,r)}_validateSignaturesOfInput(e,t,r){const n=this.data.inputs[e],i=(n||{}).partialSig;if(!n||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const o=r?i.filter((e=>e.pubkey.equals(r))):i;if(o.length<1)throw new Error("No signatures for this pubkey");const a=[];let s,u,f;for(const r of o){const i=h.signature.decode(r.signature),{hash:o,script:c}=f!==i.hashType?B(e,Object.assign({},n,{sighashType:i.hashType}),this.__CACHE,!0):{hash:s,script:u};f=i.hashType,s=o,u=c,A(r.pubkey,c,"verify"),a.push(t(r.pubkey,o,i.signature))}return a.every((e=>!0===e))}validateSignaturesOfTaprootInput(e,t,r){const n=this.data.inputs[e],i=(n||{}).tapKeySig,o=(n||{}).tapScriptSig;if(!n&&!i&&(!o||o.length))throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");const a=(r=r&&(0,p.toXOnly)(r))?U(e,n,this.data.inputs,r,this.__CACHE):function(e,t,r,n){const i=[];if(t.tapInternalKey){const r=C(e,t,n);r&&i.push(r)}if(t.tapScriptSig){const e=t.tapScriptSig.map((e=>e.pubkey));i.push(...e)}return i.map((i=>U(e,t,r,i,n))).flat()}(e,n,this.data.inputs,this.__CACHE);if(!a.length)throw new Error("No signatures for this pubkey");const s=a.find((e=>!e.leafHash));let u=0;if(i&&s){if(!t(s.pubkey,s.hash,L(i)))return!1;u++}if(o)for(const e of o){const r=a.find((t=>e.pubkey.equals(t.pubkey)));if(r){if(!t(e.pubkey,r.hash,L(e.signature)))return!1;u++}}return u>0}signAllInputsHD(e,t=[d.Transaction.SIGHASH_ALL]){if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");const r=[];for(const n of Z(this.data.inputs.length))try{this.signInputHD(n,e,t),r.push(!0)}catch(e){r.push(!1)}if(r.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsHDAsync(e,t=[d.Transaction.SIGHASH_ALL]){return new Promise(((r,n)=>{if(!e||!e.publicKey||!e.fingerprint)return n(new Error("Need HDSigner to sign input"));const i=[],o=[];for(const r of Z(this.data.inputs.length))o.push(this.signInputHDAsync(r,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return n(new Error("No inputs were signed"));r()}))}))}signInputHD(e,t,r=[d.Transaction.SIGHASH_ALL]){if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return j(e,this.data.inputs,t).forEach((t=>this.signInput(e,t,r))),this}signInputHDAsync(e,t,r=[d.Transaction.SIGHASH_ALL]){return new Promise(((n,i)=>{if(!t||!t.publicKey||!t.fingerprint)return i(new Error("Need HDSigner to sign input"));const o=j(e,this.data.inputs,t).map((t=>this.signInputAsync(e,t,r)));return Promise.all(o).then((()=>{n()})).catch(i)}))}signAllInputs(e,t){if(!e||!e.publicKey)throw new Error("Need Signer to sign input");const r=[];for(const n of Z(this.data.inputs.length))try{this.signInput(n,e,t),r.push(!0)}catch(e){r.push(!1)}if(r.every((e=>!1===e)))throw new Error("No inputs were signed");return this}signAllInputsAsync(e,t){return new Promise(((r,n)=>{if(!e||!e.publicKey)return n(new Error("Need Signer to sign input"));const i=[],o=[];for(const[r]of this.data.inputs.entries())o.push(this.signInputAsync(r,e,t).then((()=>{i.push(!0)}),(()=>{i.push(!1)})));return Promise.all(o).then((()=>{if(i.every((e=>!1===e)))return n(new Error("No inputs were signed"));r()}))}))}signInput(e,t,r){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const n=(0,a.checkForInput)(this.data.inputs,e);return(0,p.isTaprootInput)(n)?this._signTaprootInput(e,n,t,void 0,r):this._signInput(e,t,r)}signTaprootInput(e,t,r,n){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const i=(0,a.checkForInput)(this.data.inputs,e);if((0,p.isTaprootInput)(i))return this._signTaprootInput(e,i,t,r,n);throw new Error(`Input #${e} is not of type Taproot.`)}_signInput(e,t,r=[d.Transaction.SIGHASH_ALL]){const{hash:n,sighashType:i}=R(this.data.inputs,e,t.publicKey,this.__CACHE,r),o=[{pubkey:t.publicKey,signature:h.signature.encode(t.sign(n),i)}];return this.data.updateInput(e,{partialSig:o}),this}_signTaprootInput(e,t,r,n,i=[d.Transaction.SIGHASH_DEFAULT]){const o=this.checkTaprootHashesForSig(e,t,r,n,i),a=o.filter((e=>!e.leafHash)).map((e=>(0,p.serializeTaprootSignature)(r.signSchnorr(e.hash),t.sighashType)))[0],s=o.filter((e=>!!e.leafHash)).map((e=>({pubkey:(0,p.toXOnly)(r.publicKey),signature:(0,p.serializeTaprootSignature)(r.signSchnorr(e.hash),t.sighashType),leafHash:e.leafHash})));return a&&this.data.updateInput(e,{tapKeySig:a}),s.length&&this.data.updateInput(e,{tapScriptSig:s}),this}signInputAsync(e,t,r){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const n=(0,a.checkForInput)(this.data.inputs,e);return(0,p.isTaprootInput)(n)?this._signTaprootInputAsync(e,n,t,void 0,r):this._signInputAsync(e,t,r)}))}signTaprootInputAsync(e,t,r,n){return Promise.resolve().then((()=>{if(!t||!t.publicKey)throw new Error("Need Signer to sign input");const i=(0,a.checkForInput)(this.data.inputs,e);if((0,p.isTaprootInput)(i))return this._signTaprootInputAsync(e,i,t,r,n);throw new Error(`Input #${e} is not of type Taproot.`)}))}_signInputAsync(e,t,r=[d.Transaction.SIGHASH_ALL]){const{hash:n,sighashType:i}=R(this.data.inputs,e,t.publicKey,this.__CACHE,r);return Promise.resolve(t.sign(n)).then((r=>{const n=[{pubkey:t.publicKey,signature:h.signature.encode(r,i)}];this.data.updateInput(e,{partialSig:n})}))}async _signTaprootInputAsync(e,t,r,n,i=[d.Transaction.SIGHASH_DEFAULT]){const o=this.checkTaprootHashesForSig(e,t,r,n,i),a=[],s=o.filter((e=>!e.leafHash))[0];if(s){const e=Promise.resolve(r.signSchnorr(s.hash)).then((e=>({tapKeySig:(0,p.serializeTaprootSignature)(e,t.sighashType)})));a.push(e)}const u=o.filter((e=>!!e.leafHash));if(u.length){const e=u.map((e=>Promise.resolve(r.signSchnorr(e.hash)).then((n=>({tapScriptSig:[{pubkey:(0,p.toXOnly)(r.publicKey),signature:(0,p.serializeTaprootSignature)(n,t.sighashType),leafHash:e.leafHash}]})))));a.push(...e)}return Promise.all(a).then((t=>{t.forEach((t=>this.data.updateInput(e,t)))}))}checkTaprootHashesForSig(e,t,r,n,i){if("function"!=typeof r.signSchnorr)throw new Error(`Need Schnorr Signer to sign taproot input #${e}.`);const o=U(e,t,this.data.inputs,r.publicKey,this.__CACHE,n,i);if(!o||!o.length)throw new Error(`Can not sign for input #${e} with the key ${r.publicKey.toString("hex")}`);return o}toBuffer(){return w(this.__CACHE),this.data.toBuffer()}toHex(){return w(this.__CACHE),this.data.toHex()}toBase64(){return w(this.__CACHE),this.data.toBase64()}updateGlobal(e){return this.data.updateGlobal(e),this}updateInput(e,t){return t.witnessScript&&X(t.witnessScript),(0,p.checkTaprootInputFields)(this.data.inputs[e],t,"updateInput"),this.data.updateInput(e,t),t.nonWitnessUtxo&&F(this.__CACHE,this.data.inputs[e],e),this}updateOutput(e,t){const r=this.data.outputs[e];return(0,p.checkTaprootOutputFields)(r,t,"updateOutput"),this.data.updateOutput(e,t),this}addUnknownKeyValToGlobal(e){return this.data.addUnknownKeyValToGlobal(e),this}addUnknownKeyValToInput(e,t){return this.data.addUnknownKeyValToInput(e,t),this}addUnknownKeyValToOutput(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}clearFinalizedInput(e){return this.data.clearFinalizedInput(e),this}}t.Psbt=b;const m=e=>new v(e);class v{constructor(e=n.from([2,0,0,0,0,0,0,0,0,0])){this.tx=d.Transaction.fromBuffer(e),function(e){if(!e.ins.every((e=>e.script&&0===e.script.length&&e.witness&&0===e.witness.length)))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}getInputOutputCounts(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}addInput(e){if(void 0===e.hash||void 0===e.index||!n.isBuffer(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");const t="string"==typeof e.hash?(0,u.reverseBuffer)(n.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}addOutput(e){if(void 0===e.script||void 0===e.value||!n.isBuffer(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}toBuffer(){return this.tx.toBuffer()}}function w(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function _(e,t,r){if(!t)return!1;let n;if(n=r?r.map((e=>{const r=function(e){if(65===e.length){const t=1&e[64],r=e.slice(0,33);return r[0]=2|t,r}return e.slice()}(e);return t.find((e=>e.pubkey.equals(r)))})).filter((e=>!!e)):t,n.length>e)throw new Error("Too many signatures");return n.length===e}function E(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function S(e){return t=>!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}function k(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function T(e,t){e.forEach((e=>{if((0,p.isTaprootInput)(e)?(0,p.checkTaprootInputForSigs)(e,t):(0,y.checkInputForSig)(e,t))throw new Error("Can not modify transaction, signatures exist.")}))}function A(e,t,r){if(!(0,y.pubkeyInScript)(e,t))throw new Error(`Can not ${r} for this input with the key ${e.toString("hex")}`)}function P(e,t){const r=(0,u.reverseBuffer)(n.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[r])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[r]=1}function I(e,t){return(r,n,i,o)=>{const a=e({redeem:{output:i}}).output;if(!n.equals(a))throw new Error(`${t} for ${o} #${r} doesn't match the scriptPubKey in the prevout`)}}const O=I(c.p2sh,"Redeem script"),x=I(c.p2wsh,"Witness script");function M(e,t,r,n){if(!r.every(E))throw new Error(`PSBT must be finalized to calculate ${t}`);if("__FEE_RATE"===e&&n.__FEE_RATE)return n.__FEE_RATE;if("__FEE"===e&&n.__FEE)return n.__FEE;let i,o=!0;return n.__EXTRACTED_TX?(i=n.__EXTRACTED_TX,o=!1):i=n.__TX.clone(),K(r,i,n,o),"__FEE_RATE"===e?n.__FEE_RATE:"__FEE"===e?n.__FEE:void 0}function N(e,t,r,n,i,o){const a=$(r);if(!function(e,t,r){switch(r){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return _(1,e.partialSig);case"multisig":const r=c.p2ms({output:t});return _(r.m,e.partialSig,r.pubkeys);default:return!1}}(t,r,a))throw new Error(`Can not finalize input #${e}`);return function(e,t,r,n,i,o){let a,s;const u=function(e,t,r){let n;switch(t){case"multisig":const t=function(e,t){return c.p2ms({output:e}).pubkeys.map((e=>(t.filter((t=>t.pubkey.equals(e)))[0]||{}).signature)).filter((e=>!!e))}(e,r);n=c.p2ms({output:e,signatures:t});break;case"pubkey":n=c.p2pk({output:e,signature:r[0].signature});break;case"pubkeyhash":n=c.p2pkh({output:e,pubkey:r[0].pubkey,signature:r[0].signature});break;case"witnesspubkeyhash":n=c.p2wpkh({output:e,pubkey:r[0].pubkey,signature:r[0].signature})}return n}(e,t,r),f=o?c.p2wsh({redeem:u}):null,l=i?c.p2sh({redeem:f||u}):null;return n?(s=f?(0,y.witnessStackToScriptWitness)(f.witness):(0,y.witnessStackToScriptWitness)(u.witness),l&&(a=l.input)):a=l?l.input:u.input,{finalScriptSig:a,finalScriptWitness:s}}(r,a,t.partialSig,n,i,o)}function R(e,t,r,n,i){const o=(0,a.checkForInput)(e,t),{hash:s,sighashType:u,script:f}=B(t,o,n,!1,i);return A(r,f,"sign"),{hash:s,sighashType:u}}function B(e,t,r,n,i){const o=r.__TX,a=t.sighashType||d.Transaction.SIGHASH_ALL;let s,u;if(D(a,i),t.nonWitnessUtxo){const n=G(r,t,e),i=o.ins[e].hash,a=n.getHash();if(!i.equals(a))throw new Error(`Non-witness UTXO hash for input #${e} doesn't match the hash specified in the prevout`);const s=o.ins[e].index;u=n.outs[s]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");u=t.witnessUtxo}const{meaningfulScript:f,type:l}=q(u.script,e,"input",t.redeemScript,t.witnessScript);if(["p2sh-p2wsh","p2wsh"].indexOf(l)>=0)s=o.hashForWitnessV0(e,f,u.value,a);else if((0,y.isP2WPKH)(f)){const t=c.p2pkh({hash:f.slice(2)}).output;s=o.hashForWitnessV0(e,t,u.value,a)}else{if(void 0===t.nonWitnessUtxo&&!1===r.__UNSAFE_SIGN_NONSEGWIT)throw new Error(`Input #${e} has witnessUtxo but non-segwit script: ${f.toString("hex")}`);n||!1===r.__UNSAFE_SIGN_NONSEGWIT||console.warn("Warning: Signing non-segwit inputs without the full parent transaction means there is a chance that a miner could feed you incorrect information to trick you into paying large fees. This behavior is the same as Psbt's predecessor (TransactionBuilder - now removed) when signing non-segwit scripts. You are not able to export this Psbt with toBuffer|toBase64|toHex since it is not BIP174 compliant.\n*********************\nPROCEED WITH CAUTION!\n*********************"),s=o.hashForSignature(e,f,a)}return{script:f,sighashType:a,hash:s}}function C(e,t,r){const{script:n}=z(e,t,r);return(0,y.isP2TR)(n)?n.subarray(2,34):null}function L(e){return 64===e.length?e:e.subarray(0,64)}function U(e,t,r,i,o,a,s){const u=o.__TX,f=t.sighashType||d.Transaction.SIGHASH_DEFAULT;D(f,s);const c=r.map(((e,t)=>z(t,e,o))),h=c.map((e=>e.script)),g=c.map((e=>e.value)),b=[];if(t.tapInternalKey&&!a){const r=C(e,t,o)||n.from([]);if((0,p.toXOnly)(i).equals(r)){const t=u.hashForWitnessV1(e,h,g,f);b.push({pubkey:i,hash:t})}}const m=(t.tapLeafScript||[]).filter((e=>(0,y.pubkeyInScript)(i,e.script))).map((e=>{const t=(0,l.tapleafHash)({output:e.script,version:e.leafVersion});return Object.assign({hash:t},e)})).filter((e=>!a||a.equals(e.hash))).map((t=>{const r=u.hashForWitnessV1(e,h,g,d.Transaction.SIGHASH_DEFAULT,t.hash);return{pubkey:i,hash:r,leafHash:t.hash}}));return b.concat(m)}function D(e,t){if(t&&t.indexOf(e)<0){const t=function(e){let t=e&d.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case d.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case d.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case d.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(e);throw new Error(`Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ${t}`)}}function j(e,t,r){const n=(0,a.checkForInput)(t,e);if(!n.bip32Derivation||0===n.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");const i=n.bip32Derivation.map((e=>e.masterFingerprint.equals(r.fingerprint)?e:void 0)).filter((e=>!!e));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");return i.map((e=>{const t=r.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}))}function H(e){let t=0;function r(){const r=o.decode(e,t);return t+=o.decode.bytes,r}return function(){const n=r(),i=[];for(let a=0;a<n;a++)i.push((o=void 0,o=r(),t+=o,e.slice(t-o,t)));var o;return i}()}function F(e,t,r){e.__NON_WITNESS_UTXO_BUF_CACHE[r]=t.nonWitnessUtxo;const n=d.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[r]=n;const i=e,o=r;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get(){const e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;{const e=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e,e}},set(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function K(e,t,r,n){let i=0;e.forEach(((e,o)=>{if(n&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),n&&e.finalScriptWitness&&(t.ins[o].witness=H(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){const n=G(r,e,o),a=t.ins[o].index,s=n.outs[a];i+=s.value}}));const o=t.outs.reduce(((e,t)=>e+t.value),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");const s=t.virtualSize();r.__FEE=a,r.__EXTRACTED_TX=t,r.__FEE_RATE=Math.floor(a/s)}function G(e,t,r){const n=e.__NON_WITNESS_UTXO_TX_CACHE;return n[r]||F(e,t,r),n[r]}function V(e,t,r){const{script:n}=z(e,t,r);return n}function z(e,t,r){if(void 0!==t.witnessUtxo)return{script:t.witnessUtxo.script,value:t.witnessUtxo.value};if(void 0!==t.nonWitnessUtxo){const n=G(r,t,e).outs[r.__TX.ins[e].index];return{script:n.script,value:n.value}}throw new Error("Can't find pubkey in input without Utxo data")}function W(e){return 33===e.length&&h.isCanonicalPubKey(e)}function q(e,t,r,n,i){const o=(0,y.isP2SHScript)(e),a=o&&n&&(0,y.isP2WSHScript)(n),s=(0,y.isP2WSHScript)(e);if(o&&void 0===n)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((s||a)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");let u;return a?(u=i,O(t,e,n,r),x(t,n,i,r),X(u)):s?(u=i,x(t,e,i,r),X(u)):o?(u=n,O(t,e,n,r)):u=e,{meaningfulScript:u,type:a?"p2sh-p2wsh":o?"p2sh":s?"p2wsh":"raw"}}function X(e){if((0,y.isP2WPKH)(e)||(0,y.isP2SHScript)(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function $(e){return(0,y.isP2WPKH)(e)?"witnesspubkeyhash":(0,y.isP2PKH)(e)?"pubkeyhash":(0,y.isP2MS)(e)?"multisig":(0,y.isP2PK)(e)?"pubkey":"nonstandard"}function Z(e){return[...Array(e).keys()]}},477:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.checkTaprootInputForSigs=t.tapTreeFromList=t.tapTreeToList=t.tweakInternalPubKey=t.checkTaprootOutputFields=t.checkTaprootInputFields=t.isTaprootOutput=t.isTaprootInput=t.serializeTaprootSignature=t.tapScriptFinalizer=t.toXOnly=void 0;const i=r(8116),o=r(2021),a=r(4929),s=r(2218),u=r(885),f=r(4929);function c(e){return e&&!!(e.tapInternalKey||e.tapMerkleRoot||e.tapLeafScript&&e.tapLeafScript.length||e.tapBip32Derivation&&e.tapBip32Derivation.length||e.witnessUtxo&&(0,a.isP2TR)(e.witnessUtxo.script))}function l(e,t){return e&&!!(e.tapInternalKey||e.tapTree||e.tapBip32Derivation&&e.tapBip32Derivation.length||t&&(0,a.isP2TR)(t))}function h(e=[]){return 1===e.length&&0===e[0].depth?{output:e[0].script,version:e[0].leafVersion}:function(e){let t;for(const r of e)if(t=y(r,t),!t)throw new Error("No room left to insert tapleaf in tree");return t}(e)}function d(e){return{signature:e.slice(0,64),hashType:e.slice(64)[0]||o.Transaction.SIGHASH_DEFAULT}}function p(e,t=[],r=0){if(r>s.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");return e?(0,i.isTapleaf)(e)?(t.push({depth:r,leafVersion:e.version||s.LEAF_VERSION_TAPSCRIPT,script:e.output}),t):(e[0]&&p(e[0],t,r+1),e[1]&&p(e[1],t,r+1),t):[]}function y(e,t,r=0){if(r>s.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");if(e.depth===r)return t?void 0:{output:e.script,version:e.leafVersion};if((0,i.isTapleaf)(t))return;const n=y(e,t&&t[0],r+1);if(n)return[n,t&&t[1]];const o=y(e,t&&t[1],r+1);return o?[t&&t[0],o]:void 0}function g(e,t){if(!t)return!0;const r=(0,s.tapleafHash)({output:e.script,version:e.leafVersion});return(0,s.rootHashFromPath)(e.controlBlock,r).equals(t)}function b(e){return e&&!!(e.redeemScript||e.witnessScript||e.bip32Derivation&&e.bip32Derivation.length)}t.toXOnly=e=>32===e.length?e:e.slice(1,33),t.tapScriptFinalizer=function(e,t,r){const n=function(e,t,r){if(!e.tapScriptSig||!e.tapScriptSig.length)throw new Error(`Can not finalize taproot input #${t}. No tapleaf script signature provided.`);const n=(e.tapLeafScript||[]).sort(((e,t)=>e.controlBlock.length-t.controlBlock.length)).find((t=>function(e,t,r){const n=(0,s.tapleafHash)({output:e.script,version:e.leafVersion});return(!r||r.equals(n))&&void 0!==t.find((e=>e.leafHash.equals(n)))}(t,e.tapScriptSig,r)));if(!n)throw new Error(`Can not finalize taproot input #${t}. Signature for tapleaf script not found.`);return n}(t,e,r);try{const e=function(e,t){const r=(0,s.tapleafHash)({output:t.script,version:t.leafVersion});return(e.tapScriptSig||[]).filter((e=>e.leafHash.equals(r))).map((e=>function(e,t){return Object.assign({positionInScript:(0,a.pubkeyPositionInScript)(t.pubkey,e)},t)}(t.script,e))).sort(((e,t)=>t.positionInScript-e.positionInScript)).map((e=>e.signature))}(t,n),r=e.concat(n.script).concat(n.controlBlock);return{finalScriptWitness:(0,a.witnessStackToScriptWitness)(r)}}catch(t){throw new Error(`Can not finalize taproot input #${e}: ${t}`)}},t.serializeTaprootSignature=function(e,t){const r=t?n.from([t]):n.from([]);return n.concat([e,r])},t.isTaprootInput=c,t.isTaprootOutput=l,t.checkTaprootInputFields=function(e,t,r){!function(e,t,r){const n=c(e)&&b(t),i=b(e)&&c(t),o=e===t&&c(t)&&b(t);if(n||i||o)throw new Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)}(e,t,r),function(e,t,r){if(t.tapMerkleRoot){const n=(t.tapLeafScript||[]).every((e=>g(e,t.tapMerkleRoot))),i=(e.tapLeafScript||[]).every((e=>g(e,t.tapMerkleRoot)));if(!n||!i)throw new Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}else if(e.tapMerkleRoot&&!(t.tapLeafScript||[]).every((t=>g(t,e.tapMerkleRoot))))throw new Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}(e,t,r)},t.checkTaprootOutputFields=function(e,t,r){!function(e,t,r){const n=l(e)&&b(t),i=b(e)&&l(t),o=e===t&&l(t)&&b(t);if(n||i||o)throw new Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)}(e,t,r),function(e,t){if(!t.tapTree&&!t.tapInternalKey)return;const r=t.tapInternalKey||e.tapInternalKey,n=t.tapTree||e.tapTree;if(r){const{script:t}=e,i=function(e,t){const r=t&&h(t.leaves),{output:n}=(0,u.p2tr)({internalPubkey:e,scriptTree:r});return n}(r,n);if(t&&!t.equals(i))throw new Error("Error adding output. Script or address missmatch.")}}(e,t)},t.tweakInternalPubKey=function(e,t){const r=t.tapInternalKey,n=r&&(0,s.tweakKey)(r,t.tapMerkleRoot);if(!n)throw new Error(`Cannot tweak tap internal key for input #${e}. Public key: ${r&&r.toString("hex")}`);return n.x},t.tapTreeToList=function(e){if(!(0,i.isTaptree)(e))throw new Error("Cannot convert taptree to tapleaf list. Expecting a tapree structure.");return p(e)},t.tapTreeFromList=h,t.checkTaprootInputForSigs=function(e,t){return function(e){const t=[];if(e.tapKeySig&&t.push(e.tapKeySig),e.tapScriptSig&&t.push(...e.tapScriptSig.map((e=>e.signature))),!t.length){const r=function(e){if(!e)return;const t=e.slice(2);return 64===t.length||65===t.length?t:void 0}(e.finalScriptWitness);r&&t.push(r)}return t}(e).some((e=>(0,f.signatureBlocksAction)(e,d,t)))}},4929:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.signatureBlocksAction=t.checkInputForSig=t.pubkeyInScript=t.pubkeyPositionInScript=t.witnessStackToScriptWitness=t.isP2TR=t.isP2SHScript=t.isP2WSHScript=t.isP2WPKH=t.isP2PKH=t.isP2PK=t.isP2MS=void 0;const i=r(394),o=r(7038),a=r(2021),s=r(1944),u=r(885);function f(e){return t=>{try{return e({output:t}),!0}catch(e){return!1}}}function c(e,t){const r=(0,s.hash160)(e),n=e.slice(1,33),i=o.decompile(t);if(null===i)throw new Error("Unknown script error");return i.findIndex((t=>"number"!=typeof t&&(t.equals(e)||t.equals(r)||t.equals(n))))}function l(e,t,r){const{hashType:n}=t(e),i=[];switch(n&a.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&n){case a.Transaction.SIGHASH_ALL:break;case a.Transaction.SIGHASH_SINGLE:case a.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}return-1===i.indexOf(r)}t.isP2MS=f(u.p2ms),t.isP2PK=f(u.p2pk),t.isP2PKH=f(u.p2pkh),t.isP2WPKH=f(u.p2wpkh),t.isP2WSHScript=f(u.p2wsh),t.isP2SHScript=f(u.p2sh),t.isP2TR=f(u.p2tr),t.witnessStackToScriptWitness=function(e){let t=n.allocUnsafe(0);function r(e){const r=t.length,o=i.encodingLength(e);t=n.concat([t,n.allocUnsafe(o)]),i.encode(e,t,r)}var o;return r((o=e).length),o.forEach((function(e){r(e.length),function(e){t=n.concat([t,n.from(e)])}(e)})),t},t.pubkeyPositionInScript=c,t.pubkeyInScript=function(e,t){return-1!==c(e,t)},t.checkInputForSig=function(e,t){return function(e){let t=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return[];t=function(e){const t=e.finalScriptSig&&o.decompile(e.finalScriptSig)||[],r=e.finalScriptWitness&&o.decompile(e.finalScriptWitness)||[];return t.concat(r).filter((e=>n.isBuffer(e)&&o.isCanonicalScriptSignature(e))).map((e=>({signature:e})))}(e)}else t=e.partialSig;return t.map((e=>e.signature))}(e).some((e=>l(e,o.signature.decode,t)))},t.signatureBlocksAction=l},4344:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodingLength=void 0;const n=r(8417);function i(e){return e<n.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}t.encodingLength=i,t.encode=function(e,t,r){const o=i(t);return 1===o?e.writeUInt8(t,r):2===o?(e.writeUInt8(n.OPS.OP_PUSHDATA1,r),e.writeUInt8(t,r+1)):3===o?(e.writeUInt8(n.OPS.OP_PUSHDATA2,r),e.writeUInt16LE(t,r+1)):(e.writeUInt8(n.OPS.OP_PUSHDATA4,r),e.writeUInt32LE(t,r+1)),o},t.decode=function(e,t){const r=e.readUInt8(t);let i,o;if(r<n.OPS.OP_PUSHDATA1)i=r,o=1;else if(r===n.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;i=e.readUInt8(t+1),o=2}else if(r===n.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;i=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==n.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");i=e.readUInt32LE(t+1),o=5}return{opcode:r,number:i,size:o}}},7038:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.signature=t.number=t.isCanonicalScriptSignature=t.isDefinedHashType=t.isCanonicalPubKey=t.toStack=t.fromASM=t.toASM=t.decompile=t.compile=t.countNonPushOnlyOPs=t.isPushOnly=t.OPS=void 0;const i=r(3966),o=r(8417);Object.defineProperty(t,"OPS",{enumerable:!0,get:function(){return o.OPS}});const a=r(4344),s=r(9464),u=r(1043),f=r(8116),{typeforce:c}=f,l=o.OPS.OP_RESERVED;function h(e){return f.Buffer(e)||function(e){return f.Number(e)&&(e===o.OPS.OP_0||e>=o.OPS.OP_1&&e<=o.OPS.OP_16||e===o.OPS.OP_1NEGATE)}(e)}function d(e){return f.Array(e)&&e.every(h)}function p(e){return 0===e.length?o.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?l+e[0]:129===e[0]?o.OPS.OP_1NEGATE:void 0:void 0}function y(e){return n.isBuffer(e)}function g(e){return n.isBuffer(e)}function b(e){if(y(e))return e;c(f.Array,e);const t=e.reduce(((e,t)=>g(t)?1===t.length&&void 0!==p(t)?e+1:e+a.encodingLength(t.length)+t.length:e+1),0),r=n.allocUnsafe(t);let i=0;if(e.forEach((e=>{if(g(e)){const t=p(e);if(void 0!==t)return r.writeUInt8(t,i),void(i+=1);i+=a.encode(r,e.length,i),e.copy(r,i),i+=e.length}else r.writeUInt8(e,i),i+=1})),i!==r.length)throw new Error("Could not decode chunks");return r}function m(e){if(t=e,f.Array(t))return e;var t;c(f.Buffer,e);const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t>o.OPS.OP_0&&t<=o.OPS.OP_PUSHDATA4){const t=a.decode(e,n);if(null===t)return null;if(n+=t.size,n+t.number>e.length)return null;const i=e.slice(n,n+t.number);n+=t.number;const o=p(i);void 0!==o?r.push(o):r.push(i)}else r.push(t),n+=1}return r}function v(e){const t=-129&e;return t>0&&t<4}t.isPushOnly=d,t.countNonPushOnlyOPs=function(e){return e.length-e.filter(h).length},t.compile=b,t.decompile=m,t.toASM=function(e){return y(e)&&(e=m(e)),e.map((e=>{if(g(e)){const t=p(e);if(void 0===t)return e.toString("hex");e=t}return o.REVERSE_OPS[e]})).join(" ")},t.fromASM=function(e){return c(f.String,e),b(e.split(" ").map((e=>void 0!==o.OPS[e]?o.OPS[e]:(c(f.Hex,e),n.from(e,"hex")))))},t.toStack=function(e){return e=m(e),c(d,e),e.map((e=>g(e)?e:e===o.OPS.OP_0?n.allocUnsafe(0):s.encode(e-l)))},t.isCanonicalPubKey=function(e){return f.isPoint(e)},t.isDefinedHashType=v,t.isCanonicalScriptSignature=function(e){return!!n.isBuffer(e)&&!!v(e[e.length-1])&&i.check(e.slice(0,-1))},t.number=s,t.signature=u},9464:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decode=void 0,t.decode=function(e,t,r){t=t||4,r=void 0===r||r;const n=e.length;if(0===n)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&!(127&e[n-1]||!(n<=1)&&128&e[n-2]))throw new Error("Non-minimally encoded script number");if(5===n){const t=e.readUInt32LE(0),r=e.readUInt8(4);return 128&r?-(4294967296*(-129&r)+t):4294967296*r+t}let i=0;for(let t=0;t<n;++t)i|=e[t]<<8*t;return 128&e[n-1]?-(i&~(128<<8*(n-1))):i},t.encode=function(e){let t=Math.abs(e);const r=(i=t)>2147483647?5:i>8388607?4:i>32767?3:i>127?2:i>0?1:0;var i;const o=n.allocUnsafe(r),a=e<0;for(let e=0;e<r;++e)o.writeUInt8(255&t,e),t>>=8;return 128&o[r-1]?o.writeUInt8(a?128:0,r-1):a&&(o[r-1]|=128),o}},1043:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.encode=t.decode=void 0;const i=r(3966),o=r(7038),a=r(8116),{typeforce:s}=a,u=n.alloc(1,0);function f(e){let t=0;for(;0===e[t];)++t;return t===e.length?u:128&(e=e.slice(t))[0]?n.concat([u,e],1+e.length):e}function c(e){0===e[0]&&(e=e.slice(1));const t=n.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}t.decode=function(e){const t=e.readUInt8(e.length-1);if(!(0,o.isDefinedHashType)(t))throw new Error("Invalid hashType "+t);const r=i.decode(e.slice(0,-1)),a=c(r.r),s=c(r.s);return{signature:n.concat([a,s],64),hashType:t}},t.encode=function(e,t){if(s({signature:a.BufferN(64),hashType:a.UInt8},{signature:e,hashType:t}),!(0,o.isDefinedHashType)(t))throw new Error("Invalid hashType "+t);const r=n.allocUnsafe(1);r.writeUInt8(t,0);const u=f(e.slice(0,32)),c=f(e.slice(32,64));return n.concat([i.encode(u,c),r])}},2021:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.Transaction=void 0;const i=r(606),o=r(1944),a=r(7038),s=r(7038),u=r(8116),{typeforce:f}=u;function c(e){const t=e.length;return i.varuint.encodingLength(t)+t}const l=n.allocUnsafe(0),h=[],d=n.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),p=n.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),y=n.from("ffffffffffffffff","hex"),g={script:l,valueBuffer:y};class b{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(e,t){const r=new i.BufferReader(e),n=new b;n.version=r.readInt32();const o=r.readUInt8(),a=r.readUInt8();let s=!1;o===b.ADVANCED_TRANSACTION_MARKER&&a===b.ADVANCED_TRANSACTION_FLAG?s=!0:r.offset-=2;const u=r.readVarInt();for(let e=0;e<u;++e)n.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:h});const f=r.readVarInt();for(let e=0;e<f;++e)n.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(s){for(let e=0;e<u;++e)n.ins[e].witness=r.readVector();if(!n.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(n.locktime=r.readUInt32(),t)return n;if(r.offset!==e.length)throw new Error("Transaction has unexpected data");return n}static fromHex(e){return b.fromBuffer(n.from(e,"hex"),!1)}static isCoinbaseHash(e){f(u.Hash256bit,e);for(let t=0;t<32;++t)if(0!==e[t])return!1;return!0}isCoinbase(){return 1===this.ins.length&&b.isCoinbaseHash(this.ins[0].hash)}addInput(e,t,r,n){return f(u.tuple(u.Hash256bit,u.UInt32,u.maybe(u.UInt32),u.maybe(u.Buffer)),arguments),u.Null(r)&&(r=b.DEFAULT_SEQUENCE),this.ins.push({hash:e,index:t,script:n||l,sequence:r,witness:h})-1}addOutput(e,t){return f(u.tuple(u.Buffer,u.Satoshi),arguments),this.outs.push({script:e,value:t})-1}hasWitnesses(){return this.ins.some((e=>0!==e.witness.length))}weight(){return 3*this.byteLength(!1)+this.byteLength(!0)}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(e=!0){const t=e&&this.hasWitnesses();return(t?10:8)+i.varuint.encodingLength(this.ins.length)+i.varuint.encodingLength(this.outs.length)+this.ins.reduce(((e,t)=>e+40+c(t.script)),0)+this.outs.reduce(((e,t)=>e+8+c(t.script)),0)+(t?this.ins.reduce(((e,t)=>e+function(e){const t=e.length;return i.varuint.encodingLength(t)+e.reduce(((e,t)=>e+c(t)),0)}(t.witness)),0):0)}clone(){const e=new b;return e.version=this.version,e.locktime=this.locktime,e.ins=this.ins.map((e=>({hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}))),e.outs=this.outs.map((e=>({script:e.script,value:e.value}))),e}hashForSignature(e,t,r){if(f(u.tuple(u.UInt32,u.Buffer,u.Number),arguments),e>=this.ins.length)return p;const i=a.compile(a.decompile(t).filter((e=>e!==s.OPS.OP_CODESEPARATOR))),c=this.clone();if((31&r)===b.SIGHASH_NONE)c.outs=[],c.ins.forEach(((t,r)=>{r!==e&&(t.sequence=0)}));else if((31&r)===b.SIGHASH_SINGLE){if(e>=this.outs.length)return p;c.outs.length=e+1;for(let t=0;t<e;t++)c.outs[t]=g;c.ins.forEach(((t,r)=>{r!==e&&(t.sequence=0)}))}r&b.SIGHASH_ANYONECANPAY?(c.ins=[c.ins[e]],c.ins[0].script=i):(c.ins.forEach((e=>{e.script=l})),c.ins[e].script=i);const h=n.allocUnsafe(c.byteLength(!1)+4);return h.writeInt32LE(r,h.length-4),c.__toBuffer(h,0,!1),o.hash256(h)}hashForWitnessV1(e,t,r,a,s,h){if(f(u.tuple(u.UInt32,f.arrayOf(u.Buffer),f.arrayOf(u.Satoshi),u.UInt32),arguments),r.length!==this.ins.length||t.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const d=a===b.SIGHASH_DEFAULT?b.SIGHASH_ALL:a&b.SIGHASH_OUTPUT_MASK,p=(a&b.SIGHASH_INPUT_MASK)===b.SIGHASH_ANYONECANPAY,y=d===b.SIGHASH_NONE,g=d===b.SIGHASH_SINGLE;let m=l,v=l,w=l,_=l,E=l;if(!p){let e=i.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((t=>{e.writeSlice(t.hash),e.writeUInt32(t.index)})),m=o.sha256(e.end()),e=i.BufferWriter.withCapacity(8*this.ins.length),r.forEach((t=>e.writeUInt64(t))),v=o.sha256(e.end()),e=i.BufferWriter.withCapacity(t.map(c).reduce(((e,t)=>e+t))),t.forEach((t=>e.writeVarSlice(t))),w=o.sha256(e.end()),e=i.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((t=>e.writeUInt32(t.sequence))),_=o.sha256(e.end())}if(y||g){if(g&&e<this.outs.length){const t=this.outs[e],r=i.BufferWriter.withCapacity(8+c(t.script));r.writeUInt64(t.value),r.writeVarSlice(t.script),E=o.sha256(r.end())}}else{const e=this.outs.map((e=>8+c(e.script))).reduce(((e,t)=>e+t)),t=i.BufferWriter.withCapacity(e);this.outs.forEach((e=>{t.writeUInt64(e.value),t.writeVarSlice(e.script)})),E=o.sha256(t.end())}const S=(s?2:0)+(h?1:0),k=174-(p?49:0)-(y?32:0)+(h?32:0)+(s?37:0),T=i.BufferWriter.withCapacity(k);if(T.writeUInt8(a),T.writeInt32(this.version),T.writeUInt32(this.locktime),T.writeSlice(m),T.writeSlice(v),T.writeSlice(w),T.writeSlice(_),y||g||T.writeSlice(E),T.writeUInt8(S),p){const n=this.ins[e];T.writeSlice(n.hash),T.writeUInt32(n.index),T.writeUInt64(r[e]),T.writeVarSlice(t[e]),T.writeUInt32(n.sequence)}else T.writeUInt32(e);if(h){const e=i.BufferWriter.withCapacity(c(h));e.writeVarSlice(h),T.writeSlice(o.sha256(e.end()))}return g&&T.writeSlice(E),s&&(T.writeSlice(s),T.writeUInt8(0),T.writeUInt32(4294967295)),o.taggedHash("TapSighash",n.concat([n.from([0]),T.end()]))}hashForWitnessV0(e,t,r,a){f(u.tuple(u.UInt32,u.Buffer,u.Satoshi,u.UInt32),arguments);let s,l=n.from([]),h=d,p=d,y=d;if(a&b.SIGHASH_ANYONECANPAY||(l=n.allocUnsafe(36*this.ins.length),s=new i.BufferWriter(l,0),this.ins.forEach((e=>{s.writeSlice(e.hash),s.writeUInt32(e.index)})),p=o.hash256(l)),a&b.SIGHASH_ANYONECANPAY||(31&a)===b.SIGHASH_SINGLE||(31&a)===b.SIGHASH_NONE||(l=n.allocUnsafe(4*this.ins.length),s=new i.BufferWriter(l,0),this.ins.forEach((e=>{s.writeUInt32(e.sequence)})),y=o.hash256(l)),(31&a)!==b.SIGHASH_SINGLE&&(31&a)!==b.SIGHASH_NONE){const e=this.outs.reduce(((e,t)=>e+8+c(t.script)),0);l=n.allocUnsafe(e),s=new i.BufferWriter(l,0),this.outs.forEach((e=>{s.writeUInt64(e.value),s.writeVarSlice(e.script)})),h=o.hash256(l)}else if((31&a)===b.SIGHASH_SINGLE&&e<this.outs.length){const t=this.outs[e];l=n.allocUnsafe(8+c(t.script)),s=new i.BufferWriter(l,0),s.writeUInt64(t.value),s.writeVarSlice(t.script),h=o.hash256(l)}l=n.allocUnsafe(156+c(t)),s=new i.BufferWriter(l,0);const g=this.ins[e];return s.writeInt32(this.version),s.writeSlice(p),s.writeSlice(y),s.writeSlice(g.hash),s.writeUInt32(g.index),s.writeVarSlice(t),s.writeUInt64(r),s.writeUInt32(g.sequence),s.writeSlice(h),s.writeUInt32(this.locktime),s.writeUInt32(a),o.hash256(l)}getHash(e){return e&&this.isCoinbase()?n.alloc(32,0):o.hash256(this.__toBuffer(void 0,void 0,e))}getId(){return(0,i.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(e,t){return this.__toBuffer(e,t,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(e,t){f(u.tuple(u.Number,u.Buffer),arguments),this.ins[e].script=t}setWitness(e,t){f(u.tuple(u.Number,[u.Buffer]),arguments),this.ins[e].witness=t}__toBuffer(e,t,r=!1){e||(e=n.allocUnsafe(this.byteLength(r)));const o=new i.BufferWriter(e,t||0);o.writeInt32(this.version);const a=r&&this.hasWitnesses();return a&&(o.writeUInt8(b.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(b.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach((e=>{o.writeSlice(e.hash),o.writeUInt32(e.index),o.writeVarSlice(e.script),o.writeUInt32(e.sequence)})),o.writeVarInt(this.outs.length),this.outs.forEach((e=>{void 0!==e.value?o.writeUInt64(e.value):o.writeSlice(e.valueBuffer),o.writeVarSlice(e.script)})),a&&this.ins.forEach((e=>{o.writeVector(e.witness)})),o.writeUInt32(this.locktime),void 0!==t?e.slice(t,o.offset):e}}t.Transaction=b,b.DEFAULT_SEQUENCE=4294967295,b.SIGHASH_DEFAULT=0,b.SIGHASH_ALL=1,b.SIGHASH_NONE=2,b.SIGHASH_SINGLE=3,b.SIGHASH_ANYONECANPAY=128,b.SIGHASH_OUTPUT_MASK=3,b.SIGHASH_INPUT_MASK=128,b.ADVANCED_TRANSACTION_MARKER=0,b.ADVANCED_TRANSACTION_FLAG=1},8116:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.oneOf=t.Null=t.BufferN=t.Function=t.UInt32=t.UInt8=t.tuple=t.maybe=t.Hex=t.Buffer=t.String=t.Boolean=t.Array=t.Number=t.Hash256bit=t.Hash160bit=t.Buffer256bit=t.isTaptree=t.isTapleaf=t.TAPLEAF_VERSION_MASK=t.Satoshi=t.isPoint=t.stacksEqual=t.typeforce=void 0;const n=r(8287);t.typeforce=r(8676);const i=n.Buffer.alloc(32,0),o=n.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");function a(e){return!(!e||!("output"in e)||!n.Buffer.isBuffer(e.output)||void 0!==e.version&&(e.version&t.TAPLEAF_VERSION_MASK)!==e.version)}t.stacksEqual=function(e,t){return e.length===t.length&&e.every(((e,r)=>e.equals(t[r])))},t.isPoint=function(e){if(!n.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;const t=e[0],r=e.slice(1,33);if(0===r.compare(i))return!1;if(r.compare(o)>=0)return!1;if((2===t||3===t)&&33===e.length)return!0;const a=e.slice(33);return 0!==a.compare(i)&&!(a.compare(o)>=0)&&4===t&&65===e.length},t.Satoshi=function(e){return t.typeforce.UInt53(e)&&e<=21e14},t.TAPLEAF_VERSION_MASK=254,t.isTapleaf=a,t.isTaptree=function e(r){return(0,t.Array)(r)?2===r.length&&r.every((t=>e(t))):a(r)},t.Buffer256bit=t.typeforce.BufferN(32),t.Hash160bit=t.typeforce.BufferN(20),t.Hash256bit=t.typeforce.BufferN(32),t.Number=t.typeforce.Number,t.Array=t.typeforce.Array,t.Boolean=t.typeforce.Boolean,t.String=t.typeforce.String,t.Buffer=t.typeforce.Buffer,t.Hex=t.typeforce.Hex,t.maybe=t.typeforce.maybe,t.tuple=t.typeforce.tuple,t.UInt8=t.typeforce.UInt8,t.UInt32=t.typeforce.UInt32,t.Function=t.typeforce.Function,t.BufferN=t.typeforce.BufferN,t.Null=t.typeforce.Null,t.oneOf=t.typeforce.oneOf},6763:(e,t,r)=>{const n=r(5364);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9204:(e,t,r)=>{var n=r(6763);e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),i=e(r),o=r.length+4,a=new Uint8Array(o);return a.set(r,0),a.set(i.subarray(0,4),r.length),n.encode(a,o)},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},1889:(e,t,r)=>{var{sha256:n}=r(2623),i=r(9204);e.exports=i((function(e){return n(n(e))}))},8287:(e,t,r)=>{const n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const a=2147483647;function s(e){if(e>a)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return f(e,t,r)}function f(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=s(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if($(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if($(e,ArrayBuffer)||e&&$(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&($(e,SharedArrayBuffer)||e&&$(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const i=function(e){if(u.isBuffer(e)){const t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Z(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),s(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=s(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,u.prototype),n}function p(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||$(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(e).length;default:if(i)return n?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;o<s;o++)if(f(e,o)===f(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===u)return n*a}else-1!==n&&(o-=o-n),n=-1}else for(r+u>s&&(r=s-u),o=r;o>=0;o--){let r=!0;for(let n=0;n<u;n++)if(f(e,o+n)!==f(t,n)){r=!1;break}if(r)return o}return-1}function w(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const o=t.length;let a;for(n>o/2&&(n=o/2),a=0;a<n;++a){const n=parseInt(t.substr(2*a,2),16);if(Z(n))return a;e[r+a]=n}return a}function _(e,t,r,n){return X(W(t,e.length-r),e,r,n)}function E(e,t,r,n){return X(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return X(q(t),e,r,n)}function k(e,t,r,n){return X(function(e,t){let r,n,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(o=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.kMaxLength=a,u.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return f(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)}(e,t,r)},u.allocUnsafe=function(e){return l(e)},u.allocUnsafeSlow=function(e){return l(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if($(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),$(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=u.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if($(t,Uint8Array))i+t.length>n.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)b(this,t,t+1);return this},u.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)b(this,t,t+3),b(this,t+1,t+2);return this},u.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)b(this,t,t+7),b(this,t+1,t+6),b(this,t+2,t+5),b(this,t+3,t+4);return this},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(u.prototype[o]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if($(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0);const s=Math.min(o,a),f=this.slice(n,i),c=e.slice(t,r);for(let e=0;e<s;++e)if(f[e]!==c[e]){o=f[e],a=c[e];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function I(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function O(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function x(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=Y[e[n]];return i}function M(e,t,r){const n=e.slice(t,r);let i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function N(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,r,n,i,o){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){K(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function C(e,t,r,n,i){K(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},u.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),u.prototype.readBigInt64BE=J((function(e){G(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||R(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=J((function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=J((function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{const o=u.isBuffer(e)?e:u.from(e,n),a=o.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%a]}return this};const j={};function H(e,t,r){j[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function F(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function K(e,t,r,n,i,o){if(e>r||e<t){const n="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(n,i,o)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw G(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function $(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function J(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},6168:(e,t,r)=>{var n=r(2861).Buffer,i=r(8310).Transform,o=r(3141).I;function a(e){i.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}r(6698)(a,i),a.prototype.update=function(e,t,r){"string"==typeof e&&(e=n.from(e,t));var i=this._update(e);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},a.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},a.prototype._finalOrDigest=function(e){var t=this.__final()||n.alloc(0);return e&&(t=this._toString(t,e,!0)),t},a.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},e.exports=a},7108:(e,t,r)=>{var n=r(6698),i=r(320),o=r(6011),a=r(2802),s=r(6168);function u(e){s.call(this,"digest"),this._hash=e}n(u,s),u.prototype._update=function(e){this._hash.update(e)},u.prototype._final=function(){return this._hash.digest()},e.exports=function(e){return"md5"===(e=e.toLowerCase())?new i:"rmd160"===e||"ripemd160"===e?new o:new u(a(e))}},320:(e,t,r)=>{var n=r(320);e.exports=function(e){return(new n).update(e).digest()}},5170:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.ECPairFactory=t.networks=void 0;const i=r(5249);t.networks=i;const o=r(953),a=r(3209),s=r(7513),u=r(709),f=o.typeforce.maybe(o.typeforce.compile({compressed:o.maybe(o.Boolean),network:o.maybe(o.Network)}));t.ECPairFactory=function(e){function t(t,r){if(o.typeforce(o.Buffer256bit,t),!e.isPrivate(t))throw new TypeError("Private key not in range [1, n)");return o.typeforce(f,r),new c(t,void 0,r)}function r(t,r){return o.typeforce(e.isPoint,t),o.typeforce(f,r),new c(void 0,t,r)}(0,u.testEcc)(e);class c{__D;__Q;compressed;network;lowR;constructor(t,r,o){this.__D=t,this.__Q=r,this.lowR=!1,void 0===o&&(o={}),this.compressed=void 0===o.compressed||o.compressed,this.network=o.network||i.bitcoin,void 0!==r&&(this.__Q=n.from(e.pointCompress(r,this.compressed)))}get privateKey(){return this.__D}get publicKey(){if(!this.__Q){const t=e.pointFromScalar(this.__D,this.compressed);this.__Q=n.from(t)}return this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return s.encode(this.network.wif,this.__D,this.compressed)}tweak(e){return this.privateKey?this.tweakFromPrivateKey(e):this.tweakFromPublicKey(e)}sign(t,r){if(!this.__D)throw new Error("Missing private key");if(void 0===r&&(r=this.lowR),!1===r)return n.from(e.sign(t,this.__D));{let r=e.sign(t,this.__D);const i=n.alloc(32,0);let o=0;for(;r[0]>127;)o++,i.writeUIntLE(o,0,6),r=e.sign(t,this.__D,i);return n.from(r)}}signSchnorr(t){if(!this.privateKey)throw new Error("Missing private key");if(!e.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return n.from(e.signSchnorr(t,this.privateKey))}verify(t,r){return e.verify(t,this.publicKey,r)}verifySchnorr(t,r){if(!e.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return e.verifySchnorr(t,this.publicKey.subarray(1,33),r)}tweakFromPublicKey(t){const i=32===(o=this.publicKey).length?o:o.slice(1,33);var o;const a=e.xOnlyPointAddTweak(i,t);if(!a||null===a.xOnlyPubkey)throw new Error("Cannot tweak public key!");const s=n.from([0===a.parity?2:3]);return r(n.concat([s,a.xOnlyPubkey]),{network:this.network,compressed:this.compressed})}tweakFromPrivateKey(r){const i=3!==this.publicKey[0]&&(4!==this.publicKey[0]||1&~this.publicKey[64])?this.privateKey:e.privateNegate(this.privateKey),o=e.privateAdd(i,r);if(!o)throw new Error("Invalid tweaked private key!");return t(n.from(o),{network:this.network,compressed:this.compressed})}}return{isPoint:function(t){return e.isPoint(t)},fromPrivateKey:t,fromPublicKey:r,fromWIF:function(e,r){const n=s.decode(e),a=n.version;if(o.Array(r)){if(!(r=r.filter((e=>a===e.wif)).pop()))throw new Error("Unknown network version")}else if(r=r||i.bitcoin,a!==r.wif)throw new Error("Invalid network version");return t(n.privateKey,{compressed:n.compressed,network:r})},makeRandom:function(r){o.typeforce(f,r),void 0===r&&(r={});const n=r.rng||a;let i;do{i=n(32),o.typeforce(o.Buffer256bit,i)}while(!e.isPrivate(i));return t(i,r)}}}},8700:(e,t,r)=>{t.dg=void 0;var n=r(5170);Object.defineProperty(t,"dg",{enumerable:!0,get:function(){return n.ECPairFactory}})},5249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.testnet=t.bitcoin=void 0,t.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},t.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239}},709:(e,t,r)=>{var n=r(8287).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.testEcc=void 0;const i=e=>n.from(e,"hex");function o(e){if(!e)throw new Error("ecc library invalid")}t.testEcc=function(e){o(e.isPoint(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(!e.isPoint(i("030000000000000000000000000000000000000000000000000000000000000005"))),o(e.isPrivate(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(!e.isPrivate(i("0000000000000000000000000000000000000000000000000000000000000000"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),o(!e.isPrivate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),o(n.from(e.privateAdd(i("0000000000000000000000000000000000000000000000000000000000000001"),i("0000000000000000000000000000000000000000000000000000000000000000"))).equals(i("0000000000000000000000000000000000000000000000000000000000000001"))),o(null===e.privateAdd(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),i("0000000000000000000000000000000000000000000000000000000000000003"))),o(n.from(e.privateAdd(i("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),i("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"))).equals(i("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24"))),o(n.from(e.privateNegate(i("0000000000000000000000000000000000000000000000000000000000000001"))).equals(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),o(n.from(e.privateNegate(i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(i("0000000000000000000000000000000000000000000000000000000000000003"))),o(n.from(e.privateNegate(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792"))),o(n.from(e.pointCompress(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!0)).equals(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(n.from(e.pointCompress(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!1)).equals(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),o(n.from(e.pointCompress(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!0)).equals(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),o(n.from(e.pointCompress(i("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!1)).equals(i("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),o(n.from(e.pointFromScalar(i("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(i("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),o(null===e.xOnlyPointAddTweak(i("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")));let t=e.xOnlyPointAddTweak(i("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),i("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));o(n.from(t.xOnlyPubkey).equals(i("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&1===t.parity),t=e.xOnlyPointAddTweak(i("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),i("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")),o(n.from(t.xOnlyPubkey).equals(i("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"))&&0===t.parity),o(n.from(e.sign(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),o(e.verify(i("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),i("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),i("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),e.signSchnorr&&o(n.from(e.signSchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),i("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),e.verifySchnorr&&o(e.verifySchnorr(i("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),i("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),i("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}},953:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.maybe=t.Boolean=t.Array=t.Buffer256bit=t.Network=t.typeforce=void 0,t.typeforce=r(8676),t.Network=t.typeforce.compile({messagePrefix:t.typeforce.oneOf(t.typeforce.Buffer,t.typeforce.String),bip32:{public:t.typeforce.UInt32,private:t.typeforce.UInt32},pubKeyHash:t.typeforce.UInt8,scriptHash:t.typeforce.UInt8,wif:t.typeforce.UInt8}),t.Buffer256bit=t.typeforce.BufferN(32),t.Array=t.typeforce.Array,t.Boolean=t.typeforce.Boolean,t.maybe=t.typeforce.maybe},7007:e=>{var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function f(e,t,r,n){var i,o,a,f;if(s(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=u(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,f=c,console&&console.warn&&console.warn(f)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=c.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var f=u.length,c=p(u,f);for(r=0;r<f;++r)n(c[r],this,t)}return!0},o.prototype.addListener=function(e,t){return f(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return f(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,l(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,l(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,a;if(s(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},4729:(e,t,r)=>{var n=r(2861).Buffer,i=r(1603).Transform;function o(e){i.call(this),this._block=n.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(6698)(o,i),o.prototype._transform=function(e,t,r){var n=null;try{this.update(e,t)}catch(e){n=e}r(n)},o.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(e){t=e}e(t)},o.prototype.update=function(e,t){if(function(e,t){if(!n.isBuffer(e)&&"string"!=typeof e)throw new TypeError("Data must be a string or a buffer")}(e),this._finalized)throw new Error("Digest already called");n.isBuffer(e)||(e=n.from(e,t));for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)r[o++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var a=0,s=8*e.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();void 0!==e&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},2260:e=>{var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,a,s,u;if("string"==typeof t&&(o="not ",t.substr(0,4)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var f=("number"!=typeof u&&(u=0),u+1>(s=e).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(n(t,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},2818:(e,t,r)=>{var n=r(3184),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(6736),a=r(2192);r(6698)(c,o);for(var s=i(a.prototype),u=0;u<s.length;u++){var f=s[u];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||n.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},5860:(e,t,r)=>{e.exports=i;var n=r(3054);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(6698)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},6736:(e,t,r)=>{var n,i=r(3184);e.exports=T,T.ReadableState=k,r(7007).EventEmitter;var o,a=function(e,t){return e.listeners(t).length},s=r(1181),u=r(8287).Buffer,f=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},c=r(2382);o=c&&c.debuglog?c.debuglog("stream"):function(){};var l,h,d,p=r(2389),y=r(1468),g=r(8775).getHighWaterMark,b=r(2260).F,m=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(T,s);var E=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(e,t,i){n=n||r(2818),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(3141).I),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function T(e){if(n=n||r(2818),!(this instanceof T))return new T(e);var t=this instanceof n;this._readableState=new k(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function A(e,t,r,n,i){o("readableAddChunk",t);var a,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,M(e)))}}(e,s);else if(i||(a=function(e,t){var r,n;return n=t,u.isBuffer(n)||n instanceof f||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(s,t)),a)E(e,a);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),n)s.endEmitted?E(e,new _):P(e,s,t,!0);else if(s.ended)E(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?P(e,s,t,!1):N(e,s)):P(e,s,t,!1)}else n||(s.reading=!1,N(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function P(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),N(e,t)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=y.destroy,T.prototype._undestroy=y.undestroy,T.prototype._destroy=function(e,t){t(e)},T.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=u.from(e,t),t=""),r=!0),A(this,e,t,!1,r)},T.prototype.unshift=function(e){return A(this,e,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(e){l||(l=r(3141).I);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var I=1073741824;function O(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(M,e))}function M(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function B(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function C(e){o("readable nexttick read 0"),e.read(0)}function L(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function j(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(H,t,e))}function H(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}T.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):x(this),null;if(0===(e=O(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=O(r,t))),null===(n=e>0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(e){E(this,new w("_read()"))},T.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===i.stdout||e===i.stderr?y:u;function u(){o("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",(function t(i,a){o("onunpipe"),i===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",f),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",l),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}));var f=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,U(e))}}(r);e.on("drain",f);var c=!1;function l(t){o("ondata");var i=e.write(t);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==F(n.pipes,e))&&!c&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){o("onerror",t),y(),e.removeListener("error",h),0===a(e,"error")&&E(e,t)}function d(){e.removeListener("finish",p),y()}function p(){o("onfinish"),e.removeListener("close",d),y()}function y(){o("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),e},T.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},T.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(C,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),r},T.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(L,e,t))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(4743)),h(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),T._fromList=D,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(e,t){return void 0===d&&(d=r(5049)),d(T,e,t)})},3054:(e,t,r)=>{e.exports=c;var n=r(2260).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(2818);function f(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);u.call(this,e),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(6698)(c,u),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},2192:(e,t,r)=>{var n,i=r(3184);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=T,T.WritableState=k;var a,s={deprecate:r(4643)},u=r(1181),f=r(8287).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(1468),h=r(8775).getHighWaterMark,d=r(2260).F,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function S(){}function k(e,t,a){n=n||r(2818),e=e||{},"boolean"!=typeof a&&(a=t instanceof n),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(M,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),M(e,t))}(e,r,n,t,o);else{var a=O(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||I(e,r),n?i.nextTick(P,e,r,a,o):P(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function T(e){var t=this instanceof(n=n||r(2818));if(!t&&!a.call(T,this))return new T(e);this._writableState=new k(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function A(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function P(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),M(e,t)}function I(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,A(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback;if(A(e,t,!1,t.objectMode?1:f.length,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),M(e,t)}))}function M(e,t){var r=O(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(x,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(6698)(T,u),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===T&&e&&e._writableState instanceof k}})):a=function(e){return e instanceof this},T.prototype.pipe=function(){E(this,new b)},T.prototype.write=function(e,t,r){var n,o=this._writableState,a=!1,s=!o.objectMode&&(n=e,f.isBuffer(n)||n instanceof c);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(e,t){var r=new w;E(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var o;return null===r?o=new v:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(E(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else A(e,t,!1,s,n,i,o);return u}(this,o,s,e,t,r)),a},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||I(this,e))},T.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new y("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,M(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=l.destroy,T.prototype._undestroy=l.undestroy,T.prototype._destroy=function(e,t){t(e)}},4743:(e,t,r)=>{var n,i=r(3184);function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(5826),s=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function y(e){var t=e[s];if(null!==t){var r=e[d].read();null!==r&&(e[l]=null,e[s]=null,e[u]=null,t(p(r,!1)))}}function g(e){i.nextTick(y,e)}var b=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[f];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[f]?r(e[f]):t(p(void 0,!0))}))}));var r,n=this[l];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(p(void 0,!0)):t[h](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[h])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),b);e.exports=function(e){var t,r=Object.create(m,(o(t={},d,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,f,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,h,{value:function(e,t){var n=r[d].read();n?(r[l]=null,r[s]=null,r[u]=null,e(p(n,!1))):(r[s]=e,r[u]=t)},writable:!0}),t));return r[l]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[u];return null!==t&&(r[l]=null,r[s]=null,r[u]=null,t(e)),void(r[f]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[u]=null,n(p(void 0,!0))),r[c]=!0})),e.on("readable",g.bind(null,r)),r}},2389:(e,t,r)=>{function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var u=r(8287).Buffer,f=r(8460).inspect,c=f&&f.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return u.alloc(0);for(var t,r,n,i=u.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,u.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=u.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return f(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},1468:(e,t,r)=>{var n=r(3184);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},5826:(e,t,r)=>{var n=r(2260).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||c()},f=t._writableState&&t._writableState.finished,c=function(){s=!1,f=!0,a||o.call(t)},l=t._readableState&&t._readableState.endEmitted,h=function(){a=!1,l=!0,s||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return a&&!l?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):s&&!f?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},y=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",p),t.req?y():t.on("request",y)):s&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",h),t.on("finish",c),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",c),t.removeListener("abort",p),t.removeListener("request",y),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",p)}}},5049:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},9434:(e,t,r)=>{var n,i=r(2260).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e){e()}function f(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var c,l=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var h=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(5826)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}(e,o,i>0,(function(e){c||(c=e),e&&h.forEach(u),o||(h.forEach(u),l(c))}))}));return t.reduce(f)}},8775:(e,t,r)=>{var n=r(2260).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},1181:(e,t,r)=>{e.exports=r(7007).EventEmitter},1603:(e,t,r)=>{(t=e.exports=r(6736)).Stream=t,t.Readable=t,t.Writable=r(2192),t.Duplex=r(2818),t.Transform=r(3054),t.PassThrough=r(5860),t.finished=r(5826),t.pipeline=r(9434)},251:(e,t)=>{t.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,f=u>>1,c=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=s;c>0;o=256*o+e[t+l],l+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+e[t+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-1:1)*a*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var a,s,u,f=8*o-i-1,c=(1<<f)-1,l=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=c?(s=0,a=c):a+l>=1?(s=(t*u-1)*Math.pow(2,i),a+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;e[r+d]=255&a,d+=p,a/=256,f-=8);e[r+d-p]|=128*y}},6698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},3209:(e,t,r)=>{var n=r(3184),i=65536,o=r(2861).Buffer,a=r.g.crypto||r.g.msCrypto;a&&a.getRandomValues?e.exports=function(e,t){if(e>4294967295)throw new RangeError("requested too many random bytes");var r=o.allocUnsafe(e);if(e>0)if(e>i)for(var s=0;s<e;s+=i)a.getRandomValues(r.slice(s,s+i));else a.getRandomValues(r);return"function"==typeof t?n.nextTick((function(){t(null,r)})):r}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}},6011:(e,t,r)=>{var n=r(8287).Buffer,i=r(6698),o=r(4729),a=new Array(16),s=[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],u=[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],f=[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],c=[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],l=[0,1518500249,1859775393,2400959708,2840853838],h=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(e,t){return e<<t|e>>>32-t}function y(e,t,r,n,i,o,a,s){return p(e+(t^r^n)+o+a|0,s)+i|0}function g(e,t,r,n,i,o,a,s){return p(e+(t&r|~t&n)+o+a|0,s)+i|0}function b(e,t,r,n,i,o,a,s){return p(e+((t|~r)^n)+o+a|0,s)+i|0}function m(e,t,r,n,i,o,a,s){return p(e+(t&n|r&~n)+o+a|0,s)+i|0}function v(e,t,r,n,i,o,a,s){return p(e+(t^(r|~n))+o+a|0,s)+i|0}i(d,o),d.prototype._update=function(){for(var e=a,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,w=0|this._a,_=0|this._b,E=0|this._c,S=0|this._d,k=0|this._e,T=0;T<80;T+=1){var A,P;T<16?(A=y(r,n,i,o,d,e[s[T]],l[0],f[T]),P=v(w,_,E,S,k,e[u[T]],h[0],c[T])):T<32?(A=g(r,n,i,o,d,e[s[T]],l[1],f[T]),P=m(w,_,E,S,k,e[u[T]],h[1],c[T])):T<48?(A=b(r,n,i,o,d,e[s[T]],l[2],f[T]),P=b(w,_,E,S,k,e[u[T]],h[2],c[T])):T<64?(A=m(r,n,i,o,d,e[s[T]],l[3],f[T]),P=g(w,_,E,S,k,e[u[T]],h[3],c[T])):(A=v(r,n,i,o,d,e[s[T]],l[4],f[T]),P=y(w,_,E,S,k,e[u[T]],h[4],c[T])),r=d,d=o,o=p(i,10),i=n,n=A,w=k,k=S,S=p(E,10),E=_,_=P}var I=this._b+i+S|0;this._b=this._c+o+k|0,this._c=this._d+d+w|0,this._d=this._e+r+_|0,this._e=this._a+n+E|0,this._a=I},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var e=n.alloc?n.alloc(20):new n(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e},e.exports=d},2861:(e,t,r)=>{var n=r(8287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},392:(e,t,r)=>{var n=r(2861).Buffer;function i(e,t){this._block=n.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}i.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=n.from(e,t));for(var r=this._block,i=this._blockSize,o=e.length,a=this._len,s=0;s<o;){for(var u=a%i,f=Math.min(o-s,i-u),c=0;c<f;c++)r[u+c]=e[s+c];s+=f,(a+=f)%i==0&&this._update(r)}return this._len+=o,this},i.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},2802:(e,t,r)=>{var n=e.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t};n.sha=r(7816),n.sha1=r(3737),n.sha224=r(6710),n.sha256=r(4107),n.sha384=r(2827),n.sha512=r(2890)},7816:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e){return e<<30|e>>>2}function c(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)r[l]=e.readInt32BE(4*l);for(;l<80;++l)r[l]=r[l-3]^r[l-8]^r[l-14]^r[l-16];for(var h=0;h<80;++h){var d=~~(h/20),p=0|((t=n)<<5|t>>>27)+c(d,i,o,s)+u+r[h]+a[d];u=s,s=o,o=f(i),i=n,n=p}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},3737:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e){return e<<5|e>>>27}function c(e){return e<<30|e>>>2}function l(e,t,r,n){return 0===e?t&r|~t&n:2===e?t&r|t&n|r&n:t^r^n}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,h=0;h<16;++h)r[h]=e.readInt32BE(4*h);for(;h<80;++h)r[h]=(t=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|t>>>31;for(var d=0;d<80;++d){var p=~~(d/20),y=f(n)+l(p,i,o,s)+u+r[d]+a[p]|0;u=s,s=o,o=c(i),i=n,n=y}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=u},6710:(e,t,r)=>{var n=r(6698),i=r(4107),o=r(392),a=r(2861).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=u},4107:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function f(e,t,r){return r^e&(t^r)}function c(e,t,r){return e&t|r&(e|t)}function l(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function h(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function d(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(e){for(var t,r=this._w,n=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,y=0|this._g,g=0|this._h,b=0;b<16;++b)r[b]=e.readInt32BE(4*b);for(;b<64;++b)r[b]=0|(((t=r[b-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+r[b-7]+d(r[b-15])+r[b-16];for(var m=0;m<64;++m){var v=g+h(u)+f(u,p,y)+a[m]+r[m]|0,w=l(n)+c(n,i,o)|0;g=y,y=p,p=u,u=s+v|0,s=o,o=i,i=n,n=v+w|0}this._a=n+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=y+this._g|0,this._h=g+this._h|0},u.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=u},2827:(e,t,r)=>{var n=r(6698),i=r(2890),o=r(392),a=r(2861).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var e=a.allocUnsafe(48);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=u},2890:(e,t,r)=>{var n=r(6698),i=r(392),o=r(2861).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function f(e,t,r){return r^e&(t^r)}function c(e,t,r){return e&t|r&(e|t)}function l(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function h(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function d(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function p(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function y(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function g(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function b(e,t){return e>>>0<t>>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(e){for(var t=this._w,r=0|this._ah,n=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,m=0|this._gh,v=0|this._hh,w=0|this._al,_=0|this._bl,E=0|this._cl,S=0|this._dl,k=0|this._el,T=0|this._fl,A=0|this._gl,P=0|this._hl,I=0;I<32;I+=2)t[I]=e.readInt32BE(4*I),t[I+1]=e.readInt32BE(4*I+4);for(;I<160;I+=2){var O=t[I-30],x=t[I-30+1],M=d(O,x),N=p(x,O),R=y(O=t[I-4],x=t[I-4+1]),B=g(x,O),C=t[I-14],L=t[I-14+1],U=t[I-32],D=t[I-32+1],j=N+L|0,H=M+C+b(j,N)|0;H=(H=H+R+b(j=j+B|0,B)|0)+U+b(j=j+D|0,D)|0,t[I]=H,t[I+1]=j}for(var F=0;F<160;F+=2){H=t[F],j=t[F+1];var K=c(r,n,i),G=c(w,_,E),V=l(r,w),z=l(w,r),W=h(s,k),q=h(k,s),X=a[F],$=a[F+1],Z=f(s,u,m),Y=f(k,T,A),J=P+q|0,Q=v+W+b(J,P)|0;Q=(Q=(Q=Q+Z+b(J=J+Y|0,Y)|0)+X+b(J=J+$|0,$)|0)+H+b(J=J+j|0,j)|0;var ee=z+G|0,te=V+K+b(ee,z)|0;v=m,P=A,m=u,A=T,u=s,T=k,s=o+Q+b(k=S+J|0,S)|0,o=i,S=E,i=n,E=_,n=r,_=w,r=Q+te+b(w=J+ee|0,J)|0}this._al=this._al+w|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+S|0,this._el=this._el+k|0,this._fl=this._fl+T|0,this._gl=this._gl+A|0,this._hl=this._hl+P|0,this._ah=this._ah+r+b(this._al,w)|0,this._bh=this._bh+n+b(this._bl,_)|0,this._ch=this._ch+i+b(this._cl,E)|0,this._dh=this._dh+o+b(this._dl,S)|0,this._eh=this._eh+s+b(this._el,k)|0,this._fh=this._fh+u+b(this._fl,T)|0,this._gh=this._gh+m+b(this._gl,A)|0,this._hh=this._hh+v+b(this._hl,P)|0},u.prototype._hash=function(){var e=o.allocUnsafe(64);function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=u},8310:(e,t,r)=>{e.exports=i;var n=r(7007).EventEmitter;function i(){n.call(this)}r(6698)(i,n),i.Readable=r(6891),i.Writable=r(1999),i.Duplex=r(8101),i.Transform=r(9083),i.PassThrough=r(3681),i.finished=r(4257),i.pipeline=r(5267),i.Stream=i,i.prototype.pipe=function(e,t){var r=this;function i(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),e.on("drain",o),e._isStdio||t&&!1===t.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,e.end())}function u(){a||(a=!0,"function"==typeof e.destroy&&e.destroy())}function f(e){if(c(),0===n.listenerCount(this,"error"))throw e}function c(){r.removeListener("data",i),e.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",f),e.removeListener("error",f),r.removeListener("end",c),r.removeListener("close",c),e.removeListener("close",c)}return r.on("error",f),e.on("error",f),r.on("end",c),r.on("close",c),e.on("close",c),e.emit("pipe",r),e}},2463:e=>{var t={};function r(e,r,n){n||(n=Error);var i=function(e){var t,n;function i(t,n,i){return e.call(this,function(e,t,n){return"string"==typeof r?r:r(e,t,n)}(t,n,i))||this}return n=e,(t=i).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,i}(n);i.prototype.name=n.name,i.prototype.code=e,t[e]=i}function n(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}r("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(e,t,r){var i,o,a,s,u;if("string"==typeof t&&(o="not ",t.substr(0,4)===o)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))a="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var f=("number"!=typeof u&&(u=0),u+1>(s=e).length||-1===s.indexOf(".",u)?"argument":"property");a='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(n(t,"type"))}return a+". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.F=t},8101:(e,t,r)=>{var n=r(3184),i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};e.exports=c;var o=r(6891),a=r(1999);r(6698)(c,o);for(var s=i(a.prototype),u=0;u<s.length;u++){var f=s[u];c.prototype[f]||(c.prototype[f]=a.prototype[f])}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||n.nextTick(h,this)}function h(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},3681:(e,t,r)=>{e.exports=i;var n=r(9083);function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}r(6698)(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},6891:(e,t,r)=>{var n,i=r(3184);e.exports=T,T.ReadableState=k,r(7007).EventEmitter;var o,a=function(e,t){return e.listeners(t).length},s=r(1396),u=r(8287).Buffer,f=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},c=r(7199);o=c&&c.debuglog?c.debuglog("stream"):function(){};var l,h,d,p=r(1766),y=r(4347),g=r(6644).getHighWaterMark,b=r(2463).F,m=b.ERR_INVALID_ARG_TYPE,v=b.ERR_STREAM_PUSH_AFTER_EOF,w=b.ERR_METHOD_NOT_IMPLEMENTED,_=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(6698)(T,s);var E=y.errorOrDestroy,S=["error","close","destroy","pause","resume"];function k(e,t,i){n=n||r(8101),e=e||{},"boolean"!=typeof i&&(i=t instanceof n),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=g(this,e,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(l||(l=r(3141).I),this.decoder=new l(e.encoding),this.encoding=e.encoding)}function T(e){if(n=n||r(8101),!(this instanceof T))return new T(e);var t=this instanceof n;this._readableState=new k(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),s.call(this)}function A(e,t,r,n,i){o("readableAddChunk",t);var a,s=e._readableState;if(null===t)s.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?x(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,M(e)))}}(e,s);else if(i||(a=function(e,t){var r,n;return n=t,u.isBuffer(n)||n instanceof f||"string"==typeof t||void 0===t||e.objectMode||(r=new m("chunk",["string","Buffer","Uint8Array"],t)),r}(s,t)),a)E(e,a);else if(s.objectMode||t&&t.length>0)if("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),n)s.endEmitted?E(e,new _):P(e,s,t,!0);else if(s.ended)E(e,new v);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||0!==t.length?P(e,s,t,!1):N(e,s)):P(e,s,t,!1)}else n||(s.reading=!1,N(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function P(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&x(e)),N(e,t)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=y.destroy,T.prototype._undestroy=y.undestroy,T.prototype._destroy=function(e,t){t(e)},T.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=u.from(e,t),t=""),r=!0),A(this,e,t,!1,r)},T.prototype.unshift=function(e){return A(this,e,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(e){l||(l=r(3141).I);var t=new l(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var I=1073741824;function O(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=I?e=I:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function x(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,i.nextTick(M,e))}function M(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,U(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function B(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function C(e){o("readable nexttick read 0"),e.read(0)}function L(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),U(e),t.flowing&&!t.reading&&e.read(0)}function U(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function D(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function j(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,i.nextTick(H,t,e))}function H(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function F(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}T.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?j(this):x(this),null;if(0===(e=O(e,t))&&t.ended)return 0===t.length&&j(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=O(r,t))),null===(n=e>0?D(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&j(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(e){E(this,new w("_read()"))},T.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,o("pipe count=%d opts=%j",n.pipesCount,t);var s=t&&!1===t.end||e===i.stdout||e===i.stderr?y:u;function u(){o("onend"),e.end()}n.endEmitted?i.nextTick(s):r.once("end",s),e.on("unpipe",(function t(i,a){o("onunpipe"),i===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,o("cleanup"),e.removeListener("close",d),e.removeListener("finish",p),e.removeListener("drain",f),e.removeListener("error",h),e.removeListener("unpipe",t),r.removeListener("end",u),r.removeListener("end",y),r.removeListener("data",l),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}));var f=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,U(e))}}(r);e.on("drain",f);var c=!1;function l(t){o("ondata");var i=e.write(t);o("dest.write",i),!1===i&&((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==F(n.pipes,e))&&!c&&(o("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}function h(t){o("onerror",t),y(),e.removeListener("error",h),0===a(e,"error")&&E(e,t)}function d(){e.removeListener("finish",p),y()}function p(){o("onfinish"),e.removeListener("close",d),y()}function y(){o("unpipe"),r.unpipe(e)}return r.on("data",l),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",h),e.once("close",d),e.once("finish",p),e.emit("pipe",r),n.flowing||(o("pipe resume"),r.resume()),e},T.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(t.pipes,e);return-1===a||(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},T.prototype.on=function(e,t){var r=s.prototype.on.call(this,e,t),n=this._readableState;return"data"===e?(n.readableListening=this.listenerCount("readable")>0,!1!==n.flowing&&this.resume()):"readable"===e&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,o("on readable",n.length,n.reading),n.length?x(this):n.reading||i.nextTick(C,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,t){var r=s.prototype.removeListener.call(this,e,t);return"readable"===e&&i.nextTick(B,this),r},T.prototype.removeAllListeners=function(e){var t=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||i.nextTick(B,this),t},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,i.nextTick(L,e,t))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),r.objectMode&&null==i||(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<S.length;a++)e.on(S[a],this.emit.bind(this,S[a]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===h&&(h=r(5034)),h(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),T._fromList=D,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(e,t){return void 0===d&&(d=r(968)),d(T,e,t)})},9083:(e,t,r)=>{e.exports=c;var n=r(2463).F,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,a=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=n.ERR_TRANSFORM_WITH_LENGTH_0,u=r(8101);function f(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);u.call(this,e),this._transformState={afterTransform:f.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new s;if(e._transformState.transforming)throw new a;return e.push(null)}r(6698)(c,u),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,r){r(new i("_transform()"))},c.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},1999:(e,t,r)=>{var n,i=r(3184);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(undefined),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}e.exports=T,T.WritableState=k;var a,s={deprecate:r(4643)},u=r(1396),f=r(8287).Buffer,c=(void 0!==r.g?r.g:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},l=r(4347),h=r(6644).getHighWaterMark,d=r(2463).F,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,v=d.ERR_STREAM_NULL_VALUES,w=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,E=l.errorOrDestroy;function S(){}function k(e,t,a){n=n||r(8101),e=e||{},"boolean"!=typeof a&&(a=t instanceof n),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=h(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var r=e._writableState,n=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(r),t)!function(e,t,r,n,o){--t.pendingcb,r?(i.nextTick(o,n),i.nextTick(M,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),M(e,t))}(e,r,n,t,o);else{var a=O(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||I(e,r),n?i.nextTick(P,e,r,a,o):P(e,r,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function T(e){var t=this instanceof(n=n||r(8101));if(!t&&!a.call(T,this))return new T(e);this._writableState=new k(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),u.call(this)}function A(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new m("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function P(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),M(e,t)}function I(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,A(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,l=r.callback;if(A(e,t,!1,t.objectMode?1:f.length,f,c,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function O(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final((function(r){t.pendingcb--,r&&E(e,r),t.prefinished=!0,e.emit("prefinish"),M(e,t)}))}function M(e,t){var r=O(t);if(r&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,i.nextTick(x,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}r(6698)(T,u),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:s.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===T&&e&&e._writableState instanceof k}})):a=function(e){return e instanceof this},T.prototype.pipe=function(){E(this,new b)},T.prototype.write=function(e,t,r){var n,o=this._writableState,a=!1,s=!o.objectMode&&(n=e,f.isBuffer(n)||n instanceof c);return s&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(r=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof r&&(r=S),o.ending?function(e,t){var r=new w;E(e,r),i.nextTick(t,r)}(this,r):(s||function(e,t,r,n){var o;return null===r?o=new v:"string"==typeof r||t.objectMode||(o=new p("chunk",["string","Buffer"],r)),!o||(E(e,o),i.nextTick(n,o),!1)}(this,o,e,r))&&(o.pendingcb++,a=function(e,t,r,n,i,o){if(!r){var a=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,r)),t}(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=t.objectMode?1:n.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else A(e,t,!1,s,n,i,o);return u}(this,o,s,e,t,r)),a},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||I(this,e))},T.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new y("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||function(e,t,r){t.ending=!0,M(e,t),r&&(t.finished?i.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}(this,n,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=l.destroy,T.prototype._undestroy=l.undestroy,T.prototype._destroy=function(e,t){t(e)}},5034:(e,t,r)=>{var n,i=r(3184);function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=r(4257),s=Symbol("lastResolve"),u=Symbol("lastReject"),f=Symbol("error"),c=Symbol("ended"),l=Symbol("lastPromise"),h=Symbol("handlePromise"),d=Symbol("stream");function p(e,t){return{value:e,done:t}}function y(e){var t=e[s];if(null!==t){var r=e[d].read();null!==r&&(e[l]=null,e[s]=null,e[u]=null,t(p(r,!1)))}}function g(e){i.nextTick(y,e)}var b=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(n={get stream(){return this[d]},next:function(){var e=this,t=this[f];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(t,r){i.nextTick((function(){e[f]?r(e[f]):t(p(void 0,!0))}))}));var r,n=this[l];if(n)r=new Promise(function(e,t){return function(r,n){e.then((function(){t[c]?r(p(void 0,!0)):t[h](r,n)}),n)}}(n,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[h])}return this[l]=r,r}},Symbol.asyncIterator,(function(){return this})),o(n,"return",(function(){var e=this;return new Promise((function(t,r){e[d].destroy(null,(function(e){e?r(e):t(p(void 0,!0))}))}))})),n),b);e.exports=function(e){var t,r=Object.create(m,(o(t={},d,{value:e,writable:!0}),o(t,s,{value:null,writable:!0}),o(t,u,{value:null,writable:!0}),o(t,f,{value:null,writable:!0}),o(t,c,{value:e._readableState.endEmitted,writable:!0}),o(t,h,{value:function(e,t){var n=r[d].read();n?(r[l]=null,r[s]=null,r[u]=null,e(p(n,!1))):(r[s]=e,r[u]=t)},writable:!0}),t));return r[l]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[u];return null!==t&&(r[l]=null,r[s]=null,r[u]=null,t(e)),void(r[f]=e)}var n=r[s];null!==n&&(r[l]=null,r[s]=null,r[u]=null,n(p(void 0,!0))),r[c]=!0})),e.on("readable",g.bind(null,r)),r}},1766:(e,t,r)=>{function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var u=r(8287).Buffer,f=r(3779).inspect,c=f&&f.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,r;return t=e,(r=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return u.alloc(0);for(var t,r,n,i=u.allocUnsafe(e>>>0),o=this.head,a=0;o;)t=o.data,r=i,n=a,u.prototype.copy.call(t,r,n),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=u.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:c,value:function(e,t){return f(this,i(i({},t),{},{depth:0,customInspect:!1}))}}])&&a(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()},4347:(e,t,r)=>{var n=r(3184);function i(e,t){a(e,t),o(e)}function o(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function a(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var r=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,n.nextTick(a,this,e)):n.nextTick(a,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!t&&e?r._writableState?r._writableState.errorEmitted?n.nextTick(o,r):(r._writableState.errorEmitted=!0,n.nextTick(i,r,e)):n.nextTick(i,r,e):t?(n.nextTick(o,r),t(e)):n.nextTick(o,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}},4257:(e,t,r)=>{var n=r(2463).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var a=r.readable||!1!==r.readable&&t.readable,s=r.writable||!1!==r.writable&&t.writable,u=function(){t.writable||c()},f=t._writableState&&t._writableState.finished,c=function(){s=!1,f=!0,a||o.call(t)},l=t._readableState&&t._readableState.endEmitted,h=function(){a=!1,l=!0,s||o.call(t)},d=function(e){o.call(t,e)},p=function(){var e;return a&&!l?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):s&&!f?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},y=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",p),t.req?y():t.on("request",y)):s&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",h),t.on("finish",c),!1!==r.error&&t.on("error",d),t.on("close",p),function(){t.removeListener("complete",c),t.removeListener("abort",p),t.removeListener("request",y),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("end",h),t.removeListener("error",d),t.removeListener("close",p)}}},968:e=>{e.exports=function(){throw new Error("Readable.from is not available in the browser")}},5267:(e,t,r)=>{var n,i=r(2463).F,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e){e()}function f(e,t){return e.pipe(t)}e.exports=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var c,l=function(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var h=t.map((function(e,i){var o=i<t.length-1;return function(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===n&&(n=r(4257)),n(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}(e,o,i>0,(function(e){c||(c=e),e&&h.forEach(u),o||(h.forEach(u),l(c))}))}));return t.reduce(f)}},6644:(e,t,r)=>{var n=r(2463).F.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},1396:(e,t,r)=>{e.exports=r(7007).EventEmitter},3141:(e,t,r)=>{var n=r(5003).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=l,t=3;break;default:return this.write=h,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function c(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function l(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.I=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=a(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=a(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},5003:(e,t,r)=>{var n=r(8287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function a(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=a),o(i,a),a.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},a.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},1061:(e,t,r)=>{var n=r(2113);function i(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function o(e){return n.Nil(e)?"":i(e.constructor)}function a(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function s(e){return n.Function(e)?e.toJSON?e.toJSON():i(e):n.Array(e)?"Array":e&&n.Object(e)?"Object":void 0!==e?e:""}function u(e,t,r){var i=function(e){return n.Function(e)?"":n.String(e)?JSON.stringify(e):e&&n.Object(e)?"":e}(t);return"Expected "+s(e)+", got"+(""!==r?" "+r:"")+(""!==i?" "+i:"")}function f(e,t,r){r=r||o(t),this.message=u(e,t,r),a(this,f),this.__type=e,this.__value=t,this.__valueTypeName=r}function c(e,t,r,n,i){e?(i=i||o(n),this.message=function(e,t,r,n,i){var o='" of type ';return"key"===t&&(o='" with key type '),u('property "'+s(r)+o+s(e),n,i)}(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',a(this,f),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,c.prototype=Object.create(Error.prototype),c.prototype.constructor=f,e.exports={TfTypeError:f,TfPropertyTypeError:c,tfCustomError:function(e,t){return new f(e,{},t)},tfSubError:function(e,t,r){return e instanceof c?(t=t+"."+e.__property,e=new c(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof f&&(e=new c(e.__type,t,r,e.__value,e.__valueTypeName)),a(e),e},tfJSON:s,getValueTypeName:o}},9542:(e,t,r)=>{var n=r(8287).Buffer,i=r(2113),o=r(1061);function a(e){return n.isBuffer(e)}function s(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function u(e,t){var r=e.toJSON();function n(n){if(!e(n))return!1;if(n.length===t)return!0;throw o.tfCustomError(r+"(Length: "+t+")",r+"(Length: "+n.length+")")}return n.toJSON=function(){return r},n}var f=u.bind(null,i.Array),c=u.bind(null,a),l=u.bind(null,s),h=u.bind(null,i.String),d=Math.pow(2,53)-1,p={ArrayN:f,Buffer:a,BufferN:c,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:s,HexN:l,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-d&&e<=d&&Math.floor(e)===e},Range:function(e,t,r){function n(n,i){return r(n,i)&&n>e&&n<t}return r=r||i.Number,n.toJSON=function(){return`${r.toJSON()} between [${e}, ${t}]`},n},StringN:h,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=d&&Math.floor(e)===e}};for(var y in p)p[y].toJSON=function(e){return e}.bind(null,y);e.exports=p},8676:(e,t,r)=>{var n=r(1061),i=r(2113),o=n.tfJSON,a=n.TfTypeError,s=n.TfPropertyTypeError,u=n.tfSubError,f=n.getValueTypeName,c={arrayOf:function(e,t){function r(r,n){return!!i.Array(r)&&!i.Nil(r)&&!(void 0!==t.minLength&&r.length<t.minLength)&&!(void 0!==t.maxLength&&r.length>t.maxLength)&&(void 0===t.length||r.length===t.length)&&r.every((function(t,r){try{return h(e,t,n)}catch(e){throw u(e,r)}}))}return e=l(e),t=t||{},r.toJSON=function(){var r="["+o(e)+"]";return void 0!==t.length?r+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(r+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),r},r},maybe:function e(t){function r(r,n){return i.Nil(r)||t(r,n,e)}return t=l(t),r.toJSON=function(){return"?"+o(t)},r},map:function(e,t){function r(r,n){if(!i.Object(r))return!1;if(i.Nil(r))return!1;for(var o in r){try{t&&h(t,o,n)}catch(e){throw u(e,o,"key")}try{var a=r[o];h(e,a,n)}catch(e){throw u(e,o)}}return!0}return e=l(e),t&&(t=l(t)),r.toJSON=t?function(){return"{"+o(t)+": "+o(e)+"}"}:function(){return"{"+o(e)+"}"},r},object:function(e){var t={};for(var r in e)t[r]=l(e[r]);function n(e,r){if(!i.Object(e))return!1;if(i.Nil(e))return!1;var n;try{for(n in t)h(t[n],e[n],r)}catch(e){throw u(e,n)}if(r)for(n in e)if(!t[n])throw new s(void 0,n);return!0}return n.toJSON=function(){return o(t)},n},anyOf:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return e.some((function(e){try{return h(e,t,r)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(o).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return e.every((function(e){try{return h(e,t,r)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(o).join(" & ")},t},quacksLike:function(e){function t(t){return e===f(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(l);function t(t,r){return!i.Nil(t)&&!i.Nil(t.length)&&(!r||t.length===e.length)&&e.every((function(e,n){try{return h(e,t[n],r)}catch(e){throw u(e,n)}}))}return t.toJSON=function(){return"("+e.map(o).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function l(e){if(i.String(e))return"?"===e[0]?c.maybe(e.slice(1)):i[e]||c.quacksLike(e);if(e&&i.Object(e)){if(i.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return c.arrayOf(e[0])}return c.object(e)}return i.Function(e)?e:c.value(e)}function h(e,t,r,n){if(i.Function(e)){if(e(t,r))return!0;throw new a(n||e,t)}return h(l(e),t,r)}for(var d in c.oneOf=c.anyOf,i)h[d]=i[d];for(d in c)h[d]=c[d];var p=r(9542);for(d in p)h[d]=p[d];h.compile=l,h.TfTypeError=a,h.TfPropertyTypeError=s,e.exports=h},2113:e=>{var t={Array:function(e){return null!=e&&e.constructor===Array},Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==typeof e},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var r in t.Null=t.Nil,t)t[r].toJSON=function(e){return e}.bind(null,r);e.exports=t},4643:(e,t,r)=>{function n(e){try{if(!r.g.localStorage)return!1}catch(e){return!1}var t=r.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}},8469:(e,t,r)=>{var n=r(2861).Buffer,i=9007199254740991;function o(e){if(e<0||e>i||e%1!=0)throw new RangeError("value out of range")}function a(e){return o(e),e<253?1:e<=65535?3:e<=4294967295?5:9}e.exports={encode:function e(t,r,i){if(o(t),r||(r=n.allocUnsafe(a(t))),!n.isBuffer(r))throw new TypeError("buffer must be a Buffer instance");return i||(i=0),t<253?(r.writeUInt8(t,i),e.bytes=1):t<=65535?(r.writeUInt8(253,i),r.writeUInt16LE(t,i+1),e.bytes=3):t<=4294967295?(r.writeUInt8(254,i),r.writeUInt32LE(t,i+1),e.bytes=5):(r.writeUInt8(255,i),r.writeUInt32LE(t>>>0,i+1),r.writeUInt32LE(t/4294967296|0,i+5),e.bytes=9),r},decode:function e(t,r){if(!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");r||(r=0);var i=t.readUInt8(r);if(i<253)return e.bytes=1,i;if(253===i)return e.bytes=3,t.readUInt16LE(r+1);if(254===i)return e.bytes=5,t.readUInt32LE(r+1);e.bytes=9;var a=t.readUInt32LE(r+1),s=4294967296*t.readUInt32LE(r+5)+a;return o(s),s},encodingLength:a}},7513:(e,t,r)=>{var n=r(8287).Buffer,i=r(7701);function o(e,t){if(void 0!==t&&e[0]!==t)throw new Error("Invalid network version");if(33===e.length)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(34!==e.length)throw new Error("Invalid WIF length");if(1!==e[33])throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function a(e,t,r){var i=new n(r?34:33);return i.writeUInt8(e,0),t.copy(i,1),r&&(i[33]=1),i}e.exports={decode:function(e,t){return o(i.decode(e),t)},decodeRaw:o,encode:function(e,t,r){return"number"==typeof e?i.encode(a(e,t,r)):i.encode(a(e.version,e.privateKey,e.compressed))},encodeRaw:a}},1448:(e,t,r)=>{var n=r(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(255!==t[a])throw new TypeError(o+" is ambiguous");t[a]=i}var s=e.length,u=e.charAt(0),f=Math.log(s)/Math.log(256),c=Math.log(256)/Math.log(s);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return n.alloc(0);for(var r=0,i=0,o=0;e[r]===u;)i++,r++;for(var a=(e.length-r)*f+1>>>0,c=new Uint8Array(a);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var h=0,d=a-1;(0!==l||h<o)&&-1!==d;d--,h++)l+=s*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,r++}for(var p=a-o;p!==a&&0===c[p];)p++;var y=n.allocUnsafe(i+(a-p));y.fill(0,0,i);for(var g=i;p!==a;)y[g++]=c[p++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,a=t.length;o!==a&&0===t[o];)o++,r++;for(var f=(a-o)*c+1>>>0,l=new Uint8Array(f);o!==a;){for(var h=t[o],d=0,p=f-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*l[p]>>>0,l[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===l[y];)y++;for(var g=u.repeat(r);y<f;++y)g+=e.charAt(l[y]);return g},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},3119:(e,t,r)=>{var n=r(1448);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},8016:(e,t,r)=>{var n=r(3119),i=r(2861).Buffer;e.exports=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=e(t);return n.encode(i.concat([t,r],t.length+4))},decode:function(e){var r=t(n.decode(e));if(!r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=n.decodeUnsafe(e);if(r)return t(r)}}}},7701:(e,t,r)=>{var n=r(7108),i=r(8016);e.exports=i((function(e){var t=n("sha256").update(e).digest();return n("sha256").update(t).digest()}))},1324:(e,t,r)=>{e.exports=function e(t,n,i){function o(s,u){if(!n[s]){if(!t[s]){var f=void 0;if(!u&&f)return undefined(s,!0);if(a)return a(s,!0);throw(f=new Error("Cannot find module '"+s+"'")).code="MODULE_NOT_FOUND",r(718)}f=n[s]={exports:{}},t[s][0].call(f.exports,(function(e){return o(t[s][1][e]||e)}),f,f.exports,e,t,n,i)}return n[s].exports}for(var a=void 0,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.version="4.0.49"},{}],2:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./utils/properties");function i(){n.setType(this,"Signer")}i.isSigner=function(e){return n.isType(e,"Signer")},e=i,r.Signer=e},{"./utils/properties":74}],3:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./utils/bignumber");r.AddressZero="0x0000000000000000000000000000000000000000",r.HashZero="0x0000000000000000000000000000000000000000000000000000000000000000",r.EtherSymbol="Ξ",e=n.bigNumberify(-1),r.NegativeOne=e,e=n.bigNumberify(0),r.Zero=e,e=n.bigNumberify(1),r.One=e,e=n.bigNumberify(2),r.Two=e,e=n.bigNumberify("1000000000000000000"),r.WeiPerEther=e,n=n.bigNumberify("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),r.MaxUint256=n},{"./utils/bignumber":63}],4:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./constants"),u=o(e("./errors")),f=e("./utils/abi-coder"),c=e("./utils/address"),l=e("./utils/bignumber"),h=e("./utils/bytes"),d=e("./utils/interface"),p=e("./utils/properties"),y=e("./providers/abstract-provider"),g=e("./abstract-signer"),b=(i(m,a=g.Signer),m.prototype.getAddress=function(){return Promise.resolve(this.address)},m.prototype._fail=function(e,t){return Promise.resolve().then((function(){u.throwError(e,u.UNSUPPORTED_OPERATION,{operation:t})}))},m.prototype.signMessage=function(e){return this._fail("VoidSigner cannot sign messages","signMessage")},m.prototype.sendTransaction=function(e){return this._fail("VoidSigner cannot sign transactions","sendTransaction")},m.prototype.connect=function(e){return new m(this.address,e)},m);function m(e,t){var r=a.call(this)||this;return p.defineReadOnly(r,"address",e),p.defineReadOnly(r,"provider",t),r}r.VoidSigner=b;var v={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};function w(e,t,r){var n=e.interface.functions[t];return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var o={},a=null;if(t.length===n.inputs.length+1&&"object"==typeof t[t.length-1])for(var c in null!=(o=p.shallowCopy(t.pop())).blockTag&&(a=o.blockTag),delete o.blockTag,o)if(!v[c])throw new Error("unknown transaction override "+c);if(t.length!=n.inputs.length)throw new Error("incorrect number of arguments");return["data","to"].forEach((function(e){null!=o[e]&&u.throwError("cannot override "+e,u.UNSUPPORTED_OPERATION,{operation:e})})),o.to=e._deployed(a).then((function(){return e.addressPromise})),function e(t,r,n){if(Array.isArray(n)){var i=[];return n.forEach((function(n,o){var a;a=Array.isArray(r)?r[o]:r[n.name],i.push(e(t,a,n))})),Promise.all(i)}if("address"===n.type)return t.resolveName(r);if("tuple"===n.type)return e(t,r,n.components);var o=n.type.match(/(.*)(\[[0-9]*\]$)/);if(o){if(!Array.isArray(r))throw new Error("invalid value for array");var a=[],s={components:n.components,type:o[1]};return r.forEach((function(r){a.push(e(t,r,s))})),Promise.all(a)}return Promise.resolve(r)}(e.provider,t,n.inputs).then((function(t){if(o.data=n.encode(t),"call"===n.type)return r?Promise.resolve(s.Zero):(e.provider||u.throwError("call (constant functions) require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"call"}),["gasLimit","gasPrice","value"].forEach((function(e){if(null!=o[e])throw new Error("call cannot override "+e)})),null==o.from&&e.signer&&(o.from=e.signer.getAddress()),e.provider.call(o,a).then((function(r){var i;h.hexDataLength(r)%32==4&&"0x08c379a0"===h.hexDataSlice(r,0,4)&&(i=f.defaultAbiCoder.decode(["string"],h.hexDataSlice(r,4)),u.throwError("call revert exception",u.CALL_EXCEPTION,{address:e.address,args:t,method:n.signature,errorSignature:"Error(string)",errorArgs:[i],reason:i,transaction:o}));try{var a=n.decode(r);return 1===n.outputs.length?a[0]:a}catch(i){throw"0x"===r&&0<n.outputs.length&&u.throwError("call exception",u.CALL_EXCEPTION,{address:e.address,method:n.signature,args:t}),i}})));if("transaction"===n.type)return r?(e.provider||u.throwError("estimate gas require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"estimateGas"}),null==o.from&&e.signer&&(o.from=e.signer.getAddress()),e.provider.estimateGas(o)):(null==o.gasLimit&&null!=n.gas&&(o.gasLimit=l.bigNumberify(n.gas).add(21e3)),e.signer||u.throwError("sending a transaction requires a signer",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=o.from&&u.throwError("cannot override from in a transaction",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),e.signer.sendTransaction(o).then((function(t){var r=t.wait.bind(t);return t.wait=function(t){return r(t).then((function(t){return t.events=t.logs.map((function(r){var n=p.deepCopy(r);return(r=e.interface.parseLog(r))&&(n.args=r.values,n.decode=r.decode,n.event=r.name,n.eventSignature=r.signature),n.removeListener=function(){return e.provider},n.getBlock=function(){return e.provider.getBlock(t.blockHash)},n.getTransaction=function(){return e.provider.getTransaction(t.transactionHash)},n.getTransactionReceipt=function(){return Promise.resolve(t)},n})),t}))},t})));throw new Error("invalid type - "+n.type)}))}}function _(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.join(":"):""):"*"}var E=(S.prototype.deployed=function(){return this._deployed()},S.prototype._deployed=function(e){var t=this;return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((function(){return t})):this._deployedPromise=this.provider.getCode(this.address,e).then((function(e){return"0x"===e&&u.throwError("contract not deployed",u.UNSUPPORTED_OPERATION,{contractAddress:t.address,operation:"getDeployed"}),t}))),this._deployedPromise},S.prototype.fallback=function(e){var t=this;this.signer||u.throwError("sending a transaction requires a signer",u.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});var r=p.shallowCopy(e||{});return["from","to"].forEach((function(e){null!=r[e]&&u.throwError("cannot override "+e,u.UNSUPPORTED_OPERATION,{operation:e})})),r.to=this.addressPromise,this.deployed().then((function(){return t.signer.sendTransaction(r)}))},S.prototype.connect=function(e){return"string"==typeof e&&(e=new b(e,this.provider)),e=new S(this.address,this.interface,e),this.deployTransaction&&p.defineReadOnly(e,"deployTransaction",this.deployTransaction),e},S.prototype.attach=function(e){return new S(e,this.interface,this.signer||this.provider)},S.isIndexed=function(e){return d.Interface.isIndexed(e)},S.prototype._getEventFilter=function(e){var t=this;if("string"==typeof e){if("*"===e)return{prepareEvent:function(e){var r=t.interface.parseLog(e);return r&&(e.args=r.values,e.decode=r.decode,e.event=r.name,e.eventSignature=r.signature),[e]},eventTag:"*",filter:{address:this.address}};-1!==e.indexOf("(")&&(e=f.formatSignature(f.parseSignature("event "+e)));var r=this.interface.events[e];r||u.throwError("unknown event - "+e,u.INVALID_ARGUMENT,{argumnet:"eventName",value:e});var n={address:this.address,topics:[r.topic]};return{prepareEvent:function(e){var t=r.decode(e.data,e.topics);return e.args=t,(t=Array.prototype.slice.call(t)).push(e),t},event:r,eventTag:_(n),filter:n}}n={address:this.address};var i=null;if(e.topics&&e.topics[0])for(var o in n.topics=e.topics,this.interface.events)if(-1!==o.indexOf("(")&&(o=this.interface.events[o]).topic===e.topics[0].toLowerCase()){i=o;break}return{prepareEvent:function(e){if(!i)return[e];var t=i.decode(e.data,e.topics);return e.args=t,(t=Array.prototype.slice.call(t)).push(e),t},event:i,eventTag:_(n),filter:n}},S.prototype._addEventListener=function(e,t,r){var n=this;function i(r){var i=p.deepCopy(r),o=e.prepareEvent(i);e.event&&(i.decode=e.event.decode,i.event=e.event.name,i.eventSignature=e.event.signature),i.removeListener=function(){n.removeListener(e.filter,t)},i.getBlock=function(){return n.provider.getBlock(r.blockHash)},i.getTransaction=function(){return n.provider.getTransaction(r.transactionHash)},i.getTransactionReceipt=function(){return n.provider.getTransactionReceipt(r.transactionHash)},n.emit.apply(n,[e.filter].concat(o))}this.provider||u.throwError("events require a provider or a signer with a provider",u.UNSUPPORTED_OPERATION,{operation:"once"}),this.provider.on(e.filter,i),this._events.push({eventFilter:e,listener:t,wrappedListener:i,once:r})},S.prototype.on=function(e,t){return this._addEventListener(this._getEventFilter(e),t,!1),this},S.prototype.once=function(e,t){return this._addEventListener(this._getEventFilter(e),t,!0),this},S.prototype.addListener=function(e,t){return this.on(e,t)},S.prototype.emit=function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(!this.provider)return!1;var i=!1,o=this._getEventFilter(e);return this._events=this._events.filter((function(e){return e.eventFilter.eventTag!==o.eventTag||(setTimeout((function(){e.listener.apply(t,r)}),0),i=!0,!e.once)})),i},S.prototype.listenerCount=function(e){if(!this.provider)return 0;var t=this._getEventFilter(e);return this._events.filter((function(e){return e.eventFilter.eventTag===t.eventTag})).length},S.prototype.listeners=function(e){if(!this.provider)return[];var t=this._getEventFilter(e);return this._events.filter((function(e){return e.eventFilter.eventTag===t.eventTag})).map((function(e){return e.listener}))},S.prototype.removeAllListeners=function(e){var t=this;if(!this.provider)return this;var r=this._getEventFilter(e);return this._events=this._events.filter((function(e){return e.eventFilter.eventTag!==r.eventTag||(t.provider.removeListener(e.eventFilter.filter,e.wrappedListener),!1)})),this},S.prototype.removeListener=function(e,t){var r=this;if(!this.provider)return this;var n=!1,i=this._getEventFilter(e);return this._events=this._events.filter((function(e){return e.eventFilter.eventTag!==i.eventTag||e.listener!==t||(r.provider.removeListener(e.eventFilter.filter,e.wrappedListener),!!n||!(n=!0))})),this},S);function S(e,t,r){var n=this;if(u.checkNew(this,S),d.Interface.isInterface(t)?p.defineReadOnly(this,"interface",t):p.defineReadOnly(this,"interface",new d.Interface(t)),g.Signer.isSigner(r)?(p.defineReadOnly(this,"provider",r.provider),p.defineReadOnly(this,"signer",r)):y.Provider.isProvider(r)?(p.defineReadOnly(this,"provider",r),p.defineReadOnly(this,"signer",null)):u.throwError("invalid signer or provider",u.INVALID_ARGUMENT,{arg:"signerOrProvider",value:r}),p.defineReadOnly(this,"estimate",{}),p.defineReadOnly(this,"functions",{}),p.defineReadOnly(this,"filters",{}),Object.keys(this.interface.events).forEach((function(e){var t=n.interface.events[e];p.defineReadOnly(n.filters,e,(function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return{address:n.address,topics:t.encodeTopics(e)}}))})),this._events=[],p.defineReadOnly(this,"address",e),this.provider)p.defineReadOnly(this,"addressPromise",this.provider.resolveName(e).then((function(e){if(null==e)throw new Error("name not found");return e})).catch((function(e){throw e})));else try{p.defineReadOnly(this,"addressPromise",Promise.resolve(c.getAddress(e)))}catch(t){u.throwError("provider is required to use non-address contract address",u.INVALID_ARGUMENT,{argument:"addressOrName",value:e})}Object.keys(this.interface.functions).forEach((function(e){var t=w(n,e,!1);null==n[e]?p.defineReadOnly(n,e,t):u.warn("WARNING: Multiple definitions for "+e),null==n.functions[e]&&(p.defineReadOnly(n.functions,e,t),p.defineReadOnly(n.estimate,e,w(n,e,!0)))}))}function k(e,t,r){var n=null;"string"==typeof t?n=t:h.isArrayish(t)?n=h.hexlify(t):"string"==typeof t.object?n=t.object:u.throwError("bytecode must be a valid hex string",u.INVALID_ARGUMENT,{arg:"bytecode",value:t}),"0x"!==n.substring(0,2)&&(n="0x"+n),h.isHexString(n)||u.throwError("bytecode must be a valid hex string",u.INVALID_ARGUMENT,{arg:"bytecode",value:t}),n.length%2!=0&&u.throwError("bytecode must be valid data (even length)",u.INVALID_ARGUMENT,{arg:"bytecode",value:t}),p.defineReadOnly(this,"bytecode",n),d.Interface.isInterface(e)?p.defineReadOnly(this,"interface",e):p.defineReadOnly(this,"interface",new d.Interface(e)),r&&!g.Signer.isSigner(r)&&u.throwError("invalid signer",u.INVALID_ARGUMENT,{arg:"signer",value:null}),p.defineReadOnly(this,"signer",r||null)}r.Contract=E,k.prototype.getDeployTransaction=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r={};if(e.length===this.interface.deployFunction.inputs.length+1)for(var n in r=p.shallowCopy(e.pop()))if(!v[n])throw new Error("unknown transaction override "+n);return["data","from","to"].forEach((function(e){null!=r[e]&&u.throwError("cannot override "+e,u.UNSUPPORTED_OPERATION,{operation:e})})),u.checkArgumentCount(e.length,this.interface.deployFunction.inputs.length," in Contract constructor"),r.data=this.interface.deployFunction.encode(this.bytecode,e),r},k.prototype.deploy=function(){for(var e=this,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.getDeployTransaction.apply(this,t);return this.signer.sendTransaction(n).then((function(t){var r=new E(c.getContractAddress(t),e.interface,e.signer);return p.defineReadOnly(r,"deployTransaction",t),r}))},k.prototype.attach=function(e){return new E(e,this.interface,this.signer)},k.prototype.connect=function(e){return new k(this.interface,this.bytecode,e)},k.fromSolidity=function(e,t){null==e&&u.throwError("missing compiler output",u.MISSING_ARGUMENT,{argument:"compilerOutput"});var r=(e="string"==typeof e?JSON.parse(e):e).abi,n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new k(r,n,t)},i=k,r.ContractFactory=i},{"./abstract-signer":2,"./constants":3,"./errors":5,"./providers/abstract-provider":50,"./utils/abi-coder":59,"./utils/address":60,"./utils/bignumber":63,"./utils/bytes":64,"./utils/interface":69,"./utils/properties":74}],5:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./_version");r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.MISSING_NEW="MISSING_NEW",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.NUMERIC_FAULT="NUMERIC_FAULT",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED";var i=!(r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION"),o=!1;function a(e,t,i){if(o)throw new Error("unknown error");t=t||r.UNKNOWN_ERROR,i=i||{};var a=[];Object.keys(i).forEach((function(e){try{a.push(e+"="+JSON.stringify(i[e]))}catch(t){a.push(e+"="+JSON.stringify(i[e].toString()))}})),a.push("version="+n.version);var s=e;a.length&&(e+=" ("+a.join(", ")+")");var u=new Error(e);throw u.reason=s,u.code=t,Object.keys(i).forEach((function(e){u[e]=i[e]})),u}r.throwError=a,r.checkNew=function(e,t){e instanceof t||a("missing new",r.MISSING_NEW,{name:t.name})},r.checkArgumentCount=function(e,t,n){n=n||"",e<t&&a("missing argument"+n,r.MISSING_ARGUMENT,{count:e,expectedCount:t}),t<e&&a("too many arguments"+n,r.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})},r.setCensorship=function(e,t){i&&a("error censorship permanent",r.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),o=!!e,i=!!t},r.checkNormalize=function(){try{if(["NFD","NFC","NFKD","NFKC"].forEach((function(e){try{"test".normalize(e)}catch(t){throw new Error("missing "+e)}})),String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){a("platform missing String.prototype.normalize",r.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:e.message})}};var s={debug:1,default:2,info:2,warn:3,error:4,off:5},u=s.default;function f(e,t){u>s[e]||console.log.apply(console,t)}function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];f("warn",e)}r.setLogLevel=function(e){var t=s[e];null!=t?u=t:c("invliad log level - "+e)},r.warn=c,r.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];f("info",e)}},{"./_version":1}],6:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./contract");r.Contract=i.Contract,r.ContractFactory=i.ContractFactory,r.VoidSigner=i.VoidSigner,i=e("./abstract-signer"),r.Signer=i.Signer,i=e("./wallet"),r.Wallet=i.Wallet,i=n(e("./constants")),r.constants=i;var o=n(e("./errors"));r.errors=o;var a=n(e("./providers"));r.providers=a;var s=n(e("./utils"));r.utils=s,n=n(e("./wordlists")),r.wordlists=n,n=e("./utils/shims"),r.platform=n.platform,e=e("./_version"),r.version=e.version,r.getDefaultProvider=function(e){var t=s.getNetwork(e=null==e?"homestead":e);return t&&t._defaultProvider||o.throwError("unsupported getDefaultProvider network",o.UNSUPPORTED_OPERATION,{operation:"getDefaultProvider",network:e}),t._defaultProvider(a)}},{"./_version":1,"./abstract-signer":2,"./constants":3,"./contract":4,"./errors":5,"./providers":54,"./utils":68,"./utils/shims":80,"./wallet":88,"./wordlists":89}],7:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0}),n=n(e("./ethers")),r.ethers=n,function(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}(e("./ethers"))},{"./ethers":6}],8:[function(e,t,r){!function(e){function n(e){return parseInt(e)===e}function i(e){if(n(e.length)){for(var t=0;t<e.length;t++)if(!n(e[t])||e[t]<0||255<e[t])return;return 1}}function o(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t?e.slice?e.slice():Array.prototype.slice.call(e):e;if(Array.isArray(e)){if(!i(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(n(e.length)&&i(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function a(e){return new Uint8Array(e)}function s(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var u,f={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r<e.length;){var n=e.charCodeAt(r++);37===n?(t.push(parseInt(e.substr(r,2),16)),r+=2):t.push(n)}return o(t)},fromBytes:function(e){for(var t=[],r=0;r<e.length;){var n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):191<n&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},c=(u="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r<e.length;r+=2)t.push(parseInt(e.substr(r,2),16));return t},fromBytes:function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];t.push(u[(240&n)>>4]+u[15&n])}return t.join("")}}),l={16:10,24:12,32:14},h=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[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],p=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],y=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],g=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],b=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],m=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],v=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],w=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],_=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],E=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],S=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],k=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],T=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],A=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function P(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}var I=function(e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};I.prototype._prepare=function(){var e=l[this.key.length];if(null==e)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var t=0;t<=e;t++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);var r,n=4*(e+1),i=this.key.length/4,o=P(this.key);for(t=0;t<i;t++)this._Ke[r=t>>2][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,s=0,u=i;u<n;){if(a=o[i-1],o[0]^=d[a>>16&255]<<24^d[a>>8&255]<<16^d[255&a]<<8^d[a>>24&255]^h[s]<<24,s+=1,8!=i)for(t=1;t<i;t++)o[t]^=o[t-1];else{for(t=1;t<i/2;t++)o[t]^=o[t-1];for(a=o[i/2-1],o[i/2]^=d[255&a]^d[a>>8&255]<<8^d[a>>16&255]<<16^d[a>>24&255]<<24,t=i/2+1;t<i;t++)o[t]^=o[t-1]}for(t=0;t<i&&u<n;)this._Ke[f=u>>2][c=u%4]=o[t],this._Kd[e-f][c]=o[t++],u++}for(var f=1;f<e;f++)for(var c=0;c<4;c++)a=this._Kd[f][c],this._Kd[f][c]=S[a>>24&255]^k[a>>16&255]^T[a>>8&255]^A[255&a]},I.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=P(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o<t;o++){for(i=0;i<4;i++)r[i]=y[n[i]>>24&255]^g[n[(i+1)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^m[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Ke[t][i],u[4*i]=255&(d[n[i]>>24&255]^s>>24),u[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),u[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return u},I.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=P(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o<t;o++){for(i=0;i<4;i++)r[i]=v[n[i]>>24&255]^w[n[(i+3)%4]>>16&255]^_[n[(i+2)%4]>>8&255]^E[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var s,u=a(16);for(i=0;i<4;i++)s=this._Kd[t][i],u[4*i]=255&(p[n[i]>>24&255]^s>>24),u[4*i+1]=255&(p[n[(i+3)%4]>>16&255]^s>>16),u[4*i+2]=255&(p[n[(i+2)%4]>>8&255]^s>>8),u[4*i+3]=255&(p[255&n[(i+1)%4]]^s);return u};var O=function(e){if(!(this instanceof O))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new I(e)};O.prototype.encrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.encrypt(r),t,n);return t},O.prototype.decrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16)s(e,r,0,n,n+16),s(r=this._aes.decrypt(r),t,n);return t};var x=function(e,t){if(!(this instanceof x))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=a(16);this._lastCipherblock=o(t,!0),this._aes=new I(e)};x.prototype.encrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16){s(e,r,0,n,n+16);for(var i=0;i<16;i++)r[i]^=this._lastCipherblock[i];this._lastCipherblock=this._aes.encrypt(r),s(this._lastCipherblock,t,n)}return t},x.prototype.decrypt=function(e){if((e=o(e)).length%16!=0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n<e.length;n+=16){s(e,r,0,n,n+16),r=this._aes.decrypt(r);for(var i=0;i<16;i++)t[n+i]=r[i]^this._lastCipherblock[i];s(e,this._lastCipherblock,0,n,n+16)}return t};var M=function(e,t,r){if(!(this instanceof M))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 size)")}else t=a(16);this.segmentSize=r=r||1,this._shiftRegister=o(t,!0),this._aes=new I(e)};M.prototype.encrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var t=o(e,!0),r=0;r<t.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)t[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(t,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return t},M.prototype.decrypt=function(e){if(e.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var t=o(e,!0),r=0;r<t.length;r+=this.segmentSize){for(var n=this._aes.encrypt(this._shiftRegister),i=0;i<this.segmentSize;i++)t[r+i]^=n[i];s(this._shiftRegister,this._shiftRegister,0,this.segmentSize),s(e,this._shiftRegister,16-this.segmentSize,r,r+this.segmentSize)}return t};var N=function(e,t){if(!(this instanceof N))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",t){if(16!=t.length)throw new Error("invalid initialation vector size (must be 16 bytes)")}else t=a(16);this._lastPrecipher=o(t,!0),this._lastPrecipherIndex=16,this._aes=new I(e)};N.prototype.encrypt=function(e){for(var t=o(e,!0),r=0;r<t.length;r++)16===this._lastPrecipherIndex&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),t[r]^=this._lastPrecipher[this._lastPrecipherIndex++];return t},N.prototype.decrypt=N.prototype.encrypt;var R=function(e){if(!(this instanceof R))throw Error("Counter must be instanitated with `new`");"number"==typeof(e=0===e||e?e:1)?(this._counter=a(16),this.setValue(e)):this.setBytes(e)};R.prototype.setValue=function(e){if("number"!=typeof e||parseInt(e)!=e)throw new Error("invalid counter value (must be an integer)");for(var t=15;0<=t;--t)this._counter[t]=e%256,e>>=8},R.prototype.setBytes=function(e){if(16!=(e=o(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},R.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var B=function(e,t){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof R||(t=new R(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new I(e)};B.prototype.encrypt=function(e){for(var t=o(e,!0),r=0;r<t.length;r++)16===this._remainingCounterIndex&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),t[r]^=this._remainingCounter[this._remainingCounterIndex++];return t},B.prototype.decrypt=B.prototype.encrypt,f={AES:I,Counter:R,ModeOfOperation:{ecb:O,cbc:x,cfb:M,ofb:N,ctr:B},utils:{hex:c,utf8:f},padding:{pkcs7:{pad:function(e){var t=16-(e=o(e,!0)).length%16,r=a(e.length+t);s(e,r);for(var n=e.length;n<r.length;n++)r[n]=t;return r},strip:function(e){if((e=o(e,!0)).length<16)throw new Error("PKCS#7 invalid length");var t=e[e.length-1];if(16<t)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n<t;n++)if(e[r+n]!==t)throw new Error("PKCS#7 invalid padding byte");var i=a(r);return s(e,i,0,0,r),i}}},_arrayTest:{coerceArray:o,createArray:a,copyArray:s}},void 0!==r?t.exports=f:(e.aesjs&&(f._aesjs=e.aesjs),e.aesjs=f)}(this)},{}],9:[function(e,t,r){!function(t,r){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){function r(){}e.super_=t,r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function o(e,t,r){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,(this.red=null)!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var a;"object"==typeof t?t.exports=o:r.BN=o,(o.BN=o).wordSize=26;try{a=("undefined"!=typeof window&&void 0!==window.Buffer?window:e("buffer")).Buffer}catch(t){}function s(e,t){return 65<=(t=e.charCodeAt(t))&&t<=70?t-55:97<=t&&t<=102?t-87:t-48&15}function u(e,t,r){var n=s(e,r);return t<=r-1&&(n|=s(e,r-1)<<4),n}function f(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=n,i+=49<=s?s-49+10:17<=s?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return 0<e.cmp(t)?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);n((t="hex"===t?16:t)===(0|t)&&2<=t&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},o.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},o.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i,o,a=0;a<this.length;a++)this.words[a]=0;var s=0;if("be"===r)for(a=e.length-1,i=0;0<=a;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=a=0;a<e.length;a+=3)o=e[a]|e[a+1]<<8|e[a+2]<<16,this.words[i]|=o<<s&67108863,this.words[i+1]=o>>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o=0,a=0;if("be"===r)for(n=e.length-1;t<=n;n-=2)i=u(e,t,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=u(e,t,n)<<o,this.words[a]|=67108863&i,18<=o?(o-=18,this.words[a+=1]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;i=i/t|0;for(var o=e.length-r,a=o%--n,s=Math.min(o,o-a)+r,u=0,c=r;c<s;c+=n)u=f(e,c,c+n,t),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!=a){var l=1;for(u=f(e,c,e.length,t),c=0;c<a;c++)l*=t;this.imuln(l),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;1<this.length&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0,i=(n=(r.length=n)-1|0,(a=(0|e.words[0])*(0|t.words[0]))/67108864|0);r.words[0]=67108863&a;for(var o=1;o<n;o++){for(var a,s=i>>>26,u=67108863&i,f=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=f;c++)s+=(a=(0|e.words[o-c|0])*(0|t.words[c])+u)/67108864|0,u=67108863&a;r.words[o]=0|u,i=0|s}return 0!==i?r.words[o]=0|i:r.length--,r.strip()}o.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){u="";for(var r=0,i=0,o=0;o<this.length;o++){var a=this.words[o],s=(16777215&(a<<r|i)).toString(16),u=0!=(i=a>>>24-r&16777215)||o!==this.length-1?c[6-s.length]+s+u:s+u;26<=(r+=2)&&(r-=26,o--)}for(0!==i&&(u=i.toString(16)+u);u.length%t!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}if(e===(0|e)&&2<=e&&e<=36){var f=l[e],d=h[e];for(u="",(p=this.clone()).negative=0;!p.isZero();){var p,y=p.modn(d).toString(e);u=(p=p.idivn(d)).isZero()?y+u:c[f-y.length]+y+u}for(this.isZero()&&(u="0"+u);u.length%t!=0;)u="0"+u;return 0!==this.negative?"-"+u:u}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2<this.length&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(0<o,"Requested array length <= 0"),this.strip(),t="le"===t;var a,s,u=new e(o),f=this.clone();if(t){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[s]=a;for(;s<o;s++)u[s]=0}else{for(s=0;s<o-i;s++)u[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),u[o-s-1]=a}return u},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e;return e=0,4096<=t&&(e+=13,t>>>=13),64<=t&&(e+=7,t>>>=7),8<=t&&(e+=4,t>>>=4),2<=t&&(e+=2,t>>>=2),e+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e;return e=0,!(8191&t)&&(e+=13,t>>>=13),!(127&t)&&(e+=7,t>>>=7),!(15&t)&&(e+=4,t>>>=4),!(3&t)&&(e+=2,t>>>=2),!(1&t)&&e++,e},o.prototype.bitLength=function(){var e=this.words[this.length-1];return e=this._countBits(e),26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return n(!(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return n(!(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){for(var t,r=this.length>e.length?(t=this,e):(t=e,this),n=0;n<r.length;n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return n(!(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26);e%=26,this._expand(t),0<e&&t--;for(var r=0;r<t;r++)this.words[r]=67108863&~this.words[r];return 0<e&&(this.words[r]=~this.words[r]&67108863>>26-e),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&0<=e);var r=e/26|0;return e%=26,this._expand(1+r),this.words[r]=t?this.words[r]|1<<e:this.words[r]&~(1<<e),this.strip()},o.prototype.iadd=function(e){var t,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();for(var n=this.length>e.length?(r=this,e):(r=e,this),i=0,o=0;o<n.length;o++)t=(0|r.words[o])+(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<r.length;o++)t=(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;for(var i=0<n?(r=this,e):(r=e,this),o=0,a=0;a<i.length;a++)o=(t=(0|r.words[a])-(0|i.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<r.length;a++)o=(t=(0|r.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<r.length&&r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this.length=Math.max(this.length,a),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};var p=function(e,t,r){var n,i,o,a=e.words,s=t.words,u=r.words,f=8191&(n=0|a[0]),c=n>>>13,l=8191&(z=0|a[1]),h=z>>>13,d=8191&(W=0|a[2]),p=W>>>13,y=8191&(i=0|a[3]),g=i>>>13,b=8191&(q=0|a[4]),m=q>>>13,v=8191&(X=0|a[5]),w=X>>>13,_=8191&(o=0|a[6]),E=o>>>13,S=8191&($=0|a[7]),k=$>>>13,T=8191&(Z=0|a[8]),A=Z>>>13,P=8191&(Y=0|a[9]),I=Y>>>13,O=8191&(J=0|s[0]),x=J>>>13,M=0|s[1],N=8191&M,R=M>>>13,B=0|s[2],C=8191&B,L=B>>>13,U=8191&(Q=0|s[3]),D=Q>>>13,j=0|s[4],H=8191&j,F=j>>>13,K=0|s[5],G=8191&K,V=K>>>13,z=8191&(n=0|s[6]),W=n>>>13,q=8191&(i=0|s[7]),X=i>>>13,$=8191&(o=0|s[8]),Z=o>>>13,Y=8191&(a=0|s[9]),J=a>>>13;r.negative=e.negative^t.negative,r.length=19;var Q=(0+Math.imul(f,O)|0)+((8191&(B=(B=Math.imul(f,x))+Math.imul(c,O)|0))<<13)|0,ee=((j=Math.imul(c,x))+(B>>>13)|0)+(Q>>>26)|0;return Q&=67108863,M=Math.imul(l,O),B=(B=Math.imul(l,x))+Math.imul(h,O)|0,j=Math.imul(h,x),K=(ee+(M+Math.imul(f,N)|0)|0)+((8191&(B=(B=B+Math.imul(f,R)|0)+Math.imul(c,N)|0))<<13)|0,ee=((j=j+Math.imul(c,R)|0)+(B>>>13)|0)+(K>>>26)|0,K&=67108863,M=Math.imul(d,O),B=(B=Math.imul(d,x))+Math.imul(p,O)|0,j=Math.imul(p,x),M=M+Math.imul(l,N)|0,B=(B=B+Math.imul(l,R)|0)+Math.imul(h,N)|0,j=j+Math.imul(h,R)|0,n=(ee+(M+Math.imul(f,C)|0)|0)+((8191&(B=(B=B+Math.imul(f,L)|0)+Math.imul(c,C)|0))<<13)|0,ee=((j=j+Math.imul(c,L)|0)+(B>>>13)|0)+(n>>>26)|0,n&=67108863,M=Math.imul(y,O),B=(B=Math.imul(y,x))+Math.imul(g,O)|0,j=Math.imul(g,x),M=M+Math.imul(d,N)|0,B=(B=B+Math.imul(d,R)|0)+Math.imul(p,N)|0,j=j+Math.imul(p,R)|0,M=M+Math.imul(l,C)|0,B=(B=B+Math.imul(l,L)|0)+Math.imul(h,C)|0,j=j+Math.imul(h,L)|0,i=(ee+(M+Math.imul(f,U)|0)|0)+((8191&(B=(B=B+Math.imul(f,D)|0)+Math.imul(c,U)|0))<<13)|0,ee=((j=j+Math.imul(c,D)|0)+(B>>>13)|0)+(i>>>26)|0,i&=67108863,M=Math.imul(b,O),B=(B=Math.imul(b,x))+Math.imul(m,O)|0,j=Math.imul(m,x),M=M+Math.imul(y,N)|0,B=(B=B+Math.imul(y,R)|0)+Math.imul(g,N)|0,j=j+Math.imul(g,R)|0,M=M+Math.imul(d,C)|0,B=(B=B+Math.imul(d,L)|0)+Math.imul(p,C)|0,j=j+Math.imul(p,L)|0,M=M+Math.imul(l,U)|0,B=(B=B+Math.imul(l,D)|0)+Math.imul(h,U)|0,j=j+Math.imul(h,D)|0,o=(ee+(M+Math.imul(f,H)|0)|0)+((8191&(B=(B=B+Math.imul(f,F)|0)+Math.imul(c,H)|0))<<13)|0,ee=((j=j+Math.imul(c,F)|0)+(B>>>13)|0)+(o>>>26)|0,o&=67108863,M=Math.imul(v,O),B=(B=Math.imul(v,x))+Math.imul(w,O)|0,j=Math.imul(w,x),M=M+Math.imul(b,N)|0,B=(B=B+Math.imul(b,R)|0)+Math.imul(m,N)|0,j=j+Math.imul(m,R)|0,M=M+Math.imul(y,C)|0,B=(B=B+Math.imul(y,L)|0)+Math.imul(g,C)|0,j=j+Math.imul(g,L)|0,M=M+Math.imul(d,U)|0,B=(B=B+Math.imul(d,D)|0)+Math.imul(p,U)|0,j=j+Math.imul(p,D)|0,M=M+Math.imul(l,H)|0,B=(B=B+Math.imul(l,F)|0)+Math.imul(h,H)|0,j=j+Math.imul(h,F)|0,s=(ee+(M+Math.imul(f,G)|0)|0)+((8191&(B=(B=B+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0,ee=((j=j+Math.imul(c,V)|0)+(B>>>13)|0)+(s>>>26)|0,s&=67108863,M=Math.imul(_,O),B=(B=Math.imul(_,x))+Math.imul(E,O)|0,j=Math.imul(E,x),M=M+Math.imul(v,N)|0,B=(B=B+Math.imul(v,R)|0)+Math.imul(w,N)|0,j=j+Math.imul(w,R)|0,M=M+Math.imul(b,C)|0,B=(B=B+Math.imul(b,L)|0)+Math.imul(m,C)|0,j=j+Math.imul(m,L)|0,M=M+Math.imul(y,U)|0,B=(B=B+Math.imul(y,D)|0)+Math.imul(g,U)|0,j=j+Math.imul(g,D)|0,M=M+Math.imul(d,H)|0,B=(B=B+Math.imul(d,F)|0)+Math.imul(p,H)|0,j=j+Math.imul(p,F)|0,M=M+Math.imul(l,G)|0,B=(B=B+Math.imul(l,V)|0)+Math.imul(h,G)|0,j=j+Math.imul(h,V)|0,a=(ee+(M+Math.imul(f,z)|0)|0)+((8191&(B=(B=B+Math.imul(f,W)|0)+Math.imul(c,z)|0))<<13)|0,ee=((j=j+Math.imul(c,W)|0)+(B>>>13)|0)+(a>>>26)|0,a&=67108863,M=Math.imul(S,O),B=(B=Math.imul(S,x))+Math.imul(k,O)|0,j=Math.imul(k,x),M=M+Math.imul(_,N)|0,B=(B=B+Math.imul(_,R)|0)+Math.imul(E,N)|0,j=j+Math.imul(E,R)|0,M=M+Math.imul(v,C)|0,B=(B=B+Math.imul(v,L)|0)+Math.imul(w,C)|0,j=j+Math.imul(w,L)|0,M=M+Math.imul(b,U)|0,B=(B=B+Math.imul(b,D)|0)+Math.imul(m,U)|0,j=j+Math.imul(m,D)|0,M=M+Math.imul(y,H)|0,B=(B=B+Math.imul(y,F)|0)+Math.imul(g,H)|0,j=j+Math.imul(g,F)|0,M=M+Math.imul(d,G)|0,B=(B=B+Math.imul(d,V)|0)+Math.imul(p,G)|0,j=j+Math.imul(p,V)|0,M=M+Math.imul(l,z)|0,B=(B=B+Math.imul(l,W)|0)+Math.imul(h,z)|0,j=j+Math.imul(h,W)|0,e=(ee+(M+Math.imul(f,q)|0)|0)+((8191&(B=(B=B+Math.imul(f,X)|0)+Math.imul(c,q)|0))<<13)|0,ee=((j=j+Math.imul(c,X)|0)+(B>>>13)|0)+(e>>>26)|0,e&=67108863,M=Math.imul(T,O),B=(B=Math.imul(T,x))+Math.imul(A,O)|0,j=Math.imul(A,x),M=M+Math.imul(S,N)|0,B=(B=B+Math.imul(S,R)|0)+Math.imul(k,N)|0,j=j+Math.imul(k,R)|0,M=M+Math.imul(_,C)|0,B=(B=B+Math.imul(_,L)|0)+Math.imul(E,C)|0,j=j+Math.imul(E,L)|0,M=M+Math.imul(v,U)|0,B=(B=B+Math.imul(v,D)|0)+Math.imul(w,U)|0,j=j+Math.imul(w,D)|0,M=M+Math.imul(b,H)|0,B=(B=B+Math.imul(b,F)|0)+Math.imul(m,H)|0,j=j+Math.imul(m,F)|0,M=M+Math.imul(y,G)|0,B=(B=B+Math.imul(y,V)|0)+Math.imul(g,G)|0,j=j+Math.imul(g,V)|0,M=M+Math.imul(d,z)|0,B=(B=B+Math.imul(d,W)|0)+Math.imul(p,z)|0,j=j+Math.imul(p,W)|0,M=M+Math.imul(l,q)|0,B=(B=B+Math.imul(l,X)|0)+Math.imul(h,q)|0,j=j+Math.imul(h,X)|0,t=(ee+(M+Math.imul(f,$)|0)|0)+((8191&(B=(B=B+Math.imul(f,Z)|0)+Math.imul(c,$)|0))<<13)|0,ee=((j=j+Math.imul(c,Z)|0)+(B>>>13)|0)+(t>>>26)|0,t&=67108863,M=Math.imul(P,O),B=(B=Math.imul(P,x))+Math.imul(I,O)|0,j=Math.imul(I,x),M=M+Math.imul(T,N)|0,B=(B=B+Math.imul(T,R)|0)+Math.imul(A,N)|0,j=j+Math.imul(A,R)|0,M=M+Math.imul(S,C)|0,B=(B=B+Math.imul(S,L)|0)+Math.imul(k,C)|0,j=j+Math.imul(k,L)|0,M=M+Math.imul(_,U)|0,B=(B=B+Math.imul(_,D)|0)+Math.imul(E,U)|0,j=j+Math.imul(E,D)|0,M=M+Math.imul(v,H)|0,B=(B=B+Math.imul(v,F)|0)+Math.imul(w,H)|0,j=j+Math.imul(w,F)|0,M=M+Math.imul(b,G)|0,B=(B=B+Math.imul(b,V)|0)+Math.imul(m,G)|0,j=j+Math.imul(m,V)|0,M=M+Math.imul(y,z)|0,B=(B=B+Math.imul(y,W)|0)+Math.imul(g,z)|0,j=j+Math.imul(g,W)|0,M=M+Math.imul(d,q)|0,B=(B=B+Math.imul(d,X)|0)+Math.imul(p,q)|0,j=j+Math.imul(p,X)|0,M=M+Math.imul(l,$)|0,B=(B=B+Math.imul(l,Z)|0)+Math.imul(h,$)|0,j=j+Math.imul(h,Z)|0,f=(ee+(M+Math.imul(f,Y)|0)|0)+((8191&(B=(B=B+Math.imul(f,J)|0)+Math.imul(c,Y)|0))<<13)|0,ee=((j=j+Math.imul(c,J)|0)+(B>>>13)|0)+(f>>>26)|0,f&=67108863,M=Math.imul(P,N),B=(B=Math.imul(P,R))+Math.imul(I,N)|0,j=Math.imul(I,R),M=M+Math.imul(T,C)|0,B=(B=B+Math.imul(T,L)|0)+Math.imul(A,C)|0,j=j+Math.imul(A,L)|0,M=M+Math.imul(S,U)|0,B=(B=B+Math.imul(S,D)|0)+Math.imul(k,U)|0,j=j+Math.imul(k,D)|0,M=M+Math.imul(_,H)|0,B=(B=B+Math.imul(_,F)|0)+Math.imul(E,H)|0,j=j+Math.imul(E,F)|0,M=M+Math.imul(v,G)|0,B=(B=B+Math.imul(v,V)|0)+Math.imul(w,G)|0,j=j+Math.imul(w,V)|0,M=M+Math.imul(b,z)|0,B=(B=B+Math.imul(b,W)|0)+Math.imul(m,z)|0,j=j+Math.imul(m,W)|0,M=M+Math.imul(y,q)|0,B=(B=B+Math.imul(y,X)|0)+Math.imul(g,q)|0,j=j+Math.imul(g,X)|0,M=M+Math.imul(d,$)|0,B=(B=B+Math.imul(d,Z)|0)+Math.imul(p,$)|0,j=j+Math.imul(p,Z)|0,l=(ee+(M+Math.imul(l,Y)|0)|0)+((8191&(B=(B=B+Math.imul(l,J)|0)+Math.imul(h,Y)|0))<<13)|0,ee=((j=j+Math.imul(h,J)|0)+(B>>>13)|0)+(l>>>26)|0,l&=67108863,M=Math.imul(P,C),B=(B=Math.imul(P,L))+Math.imul(I,C)|0,j=Math.imul(I,L),M=M+Math.imul(T,U)|0,B=(B=B+Math.imul(T,D)|0)+Math.imul(A,U)|0,j=j+Math.imul(A,D)|0,M=M+Math.imul(S,H)|0,B=(B=B+Math.imul(S,F)|0)+Math.imul(k,H)|0,j=j+Math.imul(k,F)|0,M=M+Math.imul(_,G)|0,B=(B=B+Math.imul(_,V)|0)+Math.imul(E,G)|0,j=j+Math.imul(E,V)|0,M=M+Math.imul(v,z)|0,B=(B=B+Math.imul(v,W)|0)+Math.imul(w,z)|0,j=j+Math.imul(w,W)|0,M=M+Math.imul(b,q)|0,B=(B=B+Math.imul(b,X)|0)+Math.imul(m,q)|0,j=j+Math.imul(m,X)|0,M=M+Math.imul(y,$)|0,B=(B=B+Math.imul(y,Z)|0)+Math.imul(g,$)|0,j=j+Math.imul(g,Z)|0,d=(ee+(M+Math.imul(d,Y)|0)|0)+((8191&(B=(B=B+Math.imul(d,J)|0)+Math.imul(p,Y)|0))<<13)|0,ee=((j=j+Math.imul(p,J)|0)+(B>>>13)|0)+(d>>>26)|0,d&=67108863,M=Math.imul(P,U),B=(B=Math.imul(P,D))+Math.imul(I,U)|0,j=Math.imul(I,D),M=M+Math.imul(T,H)|0,B=(B=B+Math.imul(T,F)|0)+Math.imul(A,H)|0,j=j+Math.imul(A,F)|0,M=M+Math.imul(S,G)|0,B=(B=B+Math.imul(S,V)|0)+Math.imul(k,G)|0,j=j+Math.imul(k,V)|0,M=M+Math.imul(_,z)|0,B=(B=B+Math.imul(_,W)|0)+Math.imul(E,z)|0,j=j+Math.imul(E,W)|0,M=M+Math.imul(v,q)|0,B=(B=B+Math.imul(v,X)|0)+Math.imul(w,q)|0,j=j+Math.imul(w,X)|0,M=M+Math.imul(b,$)|0,B=(B=B+Math.imul(b,Z)|0)+Math.imul(m,$)|0,j=j+Math.imul(m,Z)|0,y=(ee+(M+Math.imul(y,Y)|0)|0)+((8191&(B=(B=B+Math.imul(y,J)|0)+Math.imul(g,Y)|0))<<13)|0,ee=((j=j+Math.imul(g,J)|0)+(B>>>13)|0)+(y>>>26)|0,y&=67108863,M=Math.imul(P,H),B=(B=Math.imul(P,F))+Math.imul(I,H)|0,j=Math.imul(I,F),M=M+Math.imul(T,G)|0,B=(B=B+Math.imul(T,V)|0)+Math.imul(A,G)|0,j=j+Math.imul(A,V)|0,M=M+Math.imul(S,z)|0,B=(B=B+Math.imul(S,W)|0)+Math.imul(k,z)|0,j=j+Math.imul(k,W)|0,M=M+Math.imul(_,q)|0,B=(B=B+Math.imul(_,X)|0)+Math.imul(E,q)|0,j=j+Math.imul(E,X)|0,M=M+Math.imul(v,$)|0,B=(B=B+Math.imul(v,Z)|0)+Math.imul(w,$)|0,j=j+Math.imul(w,Z)|0,b=(ee+(M+Math.imul(b,Y)|0)|0)+((8191&(B=(B=B+Math.imul(b,J)|0)+Math.imul(m,Y)|0))<<13)|0,ee=((j=j+Math.imul(m,J)|0)+(B>>>13)|0)+(b>>>26)|0,b&=67108863,M=Math.imul(P,G),B=(B=Math.imul(P,V))+Math.imul(I,G)|0,j=Math.imul(I,V),M=M+Math.imul(T,z)|0,B=(B=B+Math.imul(T,W)|0)+Math.imul(A,z)|0,j=j+Math.imul(A,W)|0,M=M+Math.imul(S,q)|0,B=(B=B+Math.imul(S,X)|0)+Math.imul(k,q)|0,j=j+Math.imul(k,X)|0,M=M+Math.imul(_,$)|0,B=(B=B+Math.imul(_,Z)|0)+Math.imul(E,$)|0,j=j+Math.imul(E,Z)|0,v=(ee+(M+Math.imul(v,Y)|0)|0)+((8191&(B=(B=B+Math.imul(v,J)|0)+Math.imul(w,Y)|0))<<13)|0,ee=((j=j+Math.imul(w,J)|0)+(B>>>13)|0)+(v>>>26)|0,v&=67108863,M=Math.imul(P,z),B=(B=Math.imul(P,W))+Math.imul(I,z)|0,j=Math.imul(I,W),M=M+Math.imul(T,q)|0,B=(B=B+Math.imul(T,X)|0)+Math.imul(A,q)|0,j=j+Math.imul(A,X)|0,M=M+Math.imul(S,$)|0,B=(B=B+Math.imul(S,Z)|0)+Math.imul(k,$)|0,j=j+Math.imul(k,Z)|0,_=(ee+(M+Math.imul(_,Y)|0)|0)+((8191&(B=(B=B+Math.imul(_,J)|0)+Math.imul(E,Y)|0))<<13)|0,ee=((j=j+Math.imul(E,J)|0)+(B>>>13)|0)+(_>>>26)|0,_&=67108863,M=Math.imul(P,q),B=(B=Math.imul(P,X))+Math.imul(I,q)|0,j=Math.imul(I,X),M=M+Math.imul(T,$)|0,B=(B=B+Math.imul(T,Z)|0)+Math.imul(A,$)|0,j=j+Math.imul(A,Z)|0,S=(ee+(M+Math.imul(S,Y)|0)|0)+((8191&(B=(B=B+Math.imul(S,J)|0)+Math.imul(k,Y)|0))<<13)|0,ee=((j=j+Math.imul(k,J)|0)+(B>>>13)|0)+(S>>>26)|0,S&=67108863,M=Math.imul(P,$),B=(B=Math.imul(P,Z))+Math.imul(I,$)|0,j=Math.imul(I,Z),T=(ee+(M+Math.imul(T,Y)|0)|0)+((8191&(B=(B=B+Math.imul(T,J)|0)+Math.imul(A,Y)|0))<<13)|0,ee=((j=j+Math.imul(A,J)|0)+(B>>>13)|0)+(T>>>26)|0,T&=67108863,Y=(ee+Math.imul(P,Y)|0)+((8191&(B=(B=Math.imul(P,J))+Math.imul(I,Y)|0))<<13)|0,ee=((j=Math.imul(I,J))+(B>>>13)|0)+(Y>>>26)|0,Y&=67108863,u[0]=Q,u[1]=K,u[2]=n,u[3]=i,u[4]=o,u[5]=s,u[6]=a,u[7]=e,u[8]=t,u[9]=f,u[10]=l,u[11]=d,u[12]=y,u[13]=b,u[14]=v,u[15]=_,u[16]=S,u[17]=T,u[18]=Y,0!=ee&&(u[19]=ee,r.length++),r};function y(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=d),o.prototype.mulTo=function(e,t){var r=this.length+e.length;return t=(10===this.length&&10===e.length?p:r<63?d:r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o<r.length-1;o++){for(var a=i,s=(i=0,67108863&n),u=Math.min(o,t.length-1),f=Math.max(0,o-e.length+1);f<=u;f++){var c,l=(0|e.words[o-f])*(0|t.words[f]);s=67108863&(c=(c=67108863&l)+s|0),i+=(a=(a=a+(l/67108864|0)|0)+(c>>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}:y)(this,e,t),t},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},g.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a<o;a++)n[a]=t[e[a]],i[a]=r[e[a]]},g.prototype.transform=function(e,t,r,n,i,o){this.permute(o,e,t,r,n,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),f=Math.sin(2*Math.PI/s),c=0;c<i;c+=s)for(var l=u,h=f,d=0;d<a;d++){var p=r[c+d],y=n[c+d],g=r[c+d+a],b=l*g-h*(m=n[c+d+a]),m=l*m+h*g;r[c+d]=p+(g=b),n[c+d]=y+m,r[c+d+a]=p-g,n[c+d+a]=y-m,d!==s&&(b=u*l-f*h,h=u*h+f*l,l=b)}},g.prototype.guessLen13b=function(e,t){e=1&(n=1|Math.max(t,e));for(var r=0,n=n/2|0;n;n>>>=1)r++;return 1<<r+1+e},g.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},g.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},g.prototype.convert13b=function(e,t,r,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],r[2*a]=8191&o,r[2*a+1]=8191&(o>>>=13),o>>>=13;for(a=2*t;a<i;++a)r[a]=0;n(0===o),n(!(-8192&o))},g.prototype.stub=function(e){for(var t=new Array(e),r=0;r<e;r++)t[r]=0;return t},g.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),o=this.stub(n),a=new Array(n),s=new Array(n),u=new Array(n),f=new Array(n),c=new Array(n),l=new Array(n),h=r.words;h.length=n,this.convert13b(e.words,e.length,a,n),this.convert13b(t.words,t.length,f,n),this.transform(a,o,s,u,n,i),this.transform(f,o,c,l,n,i);for(var d=0;d<n;d++){var p=s[d]*c[d]-u[d]*l[d];u[d]=s[d]*l[d]+u[d]*c[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,h,o,n,i),this.conjugate(h,o,n),this.normalize13b(h,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),y(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){n("number"==typeof e),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(0|this.words[r])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r<t.length;r++){var n=r%26;t[r]=(e.words[r/26|0]&1<<n)>>>n}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},o.prototype.iushln=function(e){n("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t;if(0!=t){for(var o=0,a=0;a<this.length;a++){var s=this.words[a]&i,u=(0|this.words[a])-s<<t;this.words[a]=u|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(0!=r){for(a=this.length-1;0<=a;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},o.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,r){n("number"==typeof e&&0<=e);var i=t?(t-t%26)/26:0,o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var f=0;f<a;f++)u.words[f]=this.words[f];u.length=a}if(0!==a)if(this.length>a)for(this.length-=a,f=0;f<this.length;f++)this.words[f]=this.words[f+a];else this.words[0]=0,this.length=1;var c=0;for(f=this.length-1;0<=f&&(0!==c||i<=f);f--){var l=0|this.words[f];this.words[f]=c<<26-o|l>>>o,c=l&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&0<=e);var t=e%26;return e=(e-t)/26,!(this.length<=e||!(this.words[e]&1<<t))},o.prototype.imaskn=function(e){n("number"==typeof e&&0<=e);var t=e%26;return e=(e-t)/26,n(0===this.negative,"imaskn works only with positive numbers"),this.length<=e?this:(0!=t&&e++,this.length=Math.min(e,this.length),0!=t&&(this.words[this.length-1]&=67108863^67108863>>>t<<t),this.strip())},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?(1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(e),this.negative=1),this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&67108864<=this.words[t];t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r;this._expand(i);for(var o=0,a=0;a<e.length;a++){var s=(0|this.words[a+r])+o,u=(0|e.words[a])*t;o=((s-=67108863&u)>>26)-(u/67108864|0),this.words[a+r]=67108863&s}for(;a<this.length-r;a++)o=(s=(0|this.words[a+r])+o)>>26,this.words[a+r]=67108863&s;if(0===o)return this.strip();for(n(-1===o),a=o=0;a<this.length;a++)o=(s=-(0|this.words[a])+o)>>26,this.words[a]=67108863&s;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,a=0|i.words[i.length-1];0!=(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==t){(s=new o(null)).length=1+u,s.words=new Array(s.length);for(var f=0;f<s.length;f++)s.words[f]=0}0===(e=n.clone()._ishlnsubmul(i,1,u)).negative&&(n=e,s&&(s.words[u]=1));for(var c=u-1;0<=c;c--){var l=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(l=Math.min(l/a|0,67108863),n._ishlnsubmul(i,l,c);0!==n.negative;)l--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);s&&(s.words[c]=l)}return s&&s.strip(),n.strip(),"div"!==t&&0!=r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),{div:i="mod"!==t?s.div.neg():i,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1);return e=e.andln(1),(n=r.cmp(n))<0||1===e&&0===n?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;0<=i;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());for(var t=this,r=e.clone(),i=(t=0!==t.negative?t.umod(e):t.clone(),new o(1)),a=new o(0),s=new o(0),u=new o(1),f=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),l=t.clone();!t.isZero();){for(var h=0,d=1;!(t.words[0]&d)&&h<26;++h,d<<=1);if(0<h)for(t.iushrn(h);0<h--;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(l)),i.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(0<p)for(r.iushrn(p);0<p--;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(l)),s.iushrn(1),u.iushrn(1);0<=t.cmp(r)?(t.isub(r),i.isub(s),a.isub(u)):(r.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());for(var t,r=this,i=e.clone(),a=(r=0!==r.negative?r.umod(e):r.clone(),new o(1)),s=new o(0),u=i.clone();0<r.cmpn(1)&&0<i.cmpn(1);){for(var f=0,c=1;!(r.words[0]&c)&&f<26;++f,c<<=1);if(0<f)for(r.iushrn(f);0<f--;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var l=0,h=1;!(i.words[0]&h)&&l<26;++l,h<<=1);if(0<l)for(i.iushrn(l);0<l--;)s.isOdd()&&s.iadd(u),s.iushrn(1);0<=r.cmp(i)?(r.isub(i),a.isub(s)):(i.isub(r),s.isub(a))}return(t=0===r.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0;for(var n=r.negative=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return!(1&this.words[0])},o.prototype.isOdd=function(){return!(1&~this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e),e=(e-(t=e%26))/26;var t=1<<t;if(this.length<=e)return this._expand(1+e),this.words[e]|=t,this;for(var r=t,i=e;0!==r&&i<this.length;i++){var o=0|this.words[i];r=(o+=r)>>>26,o&=67108863,this.words[i]=o}return 0!==r&&(this.words[i]=r,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t=e<0;return 0===this.negative||t?0===this.negative&&t?1:(this.strip(),e=1<this.length?1:(n((e=t?-e:e)<=67108863,"Number is too big"),(t=0|this.words[0])===e?0:t<e?-1:1),0!==this.negative?0|-e:e):-1},o.prototype.cmp=function(e){return 0!==this.negative&&0===e.negative?-1:0===this.negative&&0!==e.negative?1:(e=this.ucmp(e),0!==this.negative?0|-e:e)},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,r=this.length-1;0<=r;r--){var n=0|this.words[r],i=0|e.words[r];if(n!=i){n<i?t=-1:i<n&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return 0<=this.cmpn(e)},o.prototype.gte=function(e){return 0<=this.cmp(e)},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){var t;"string"==typeof e?(t=o._prime(e),this.m=t.p,this.prime=t):(n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null)}function k(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}m.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){for(var t,r=e;this.split(r,this.tmp),(t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength())>this.n;);return 0===(e=t<this.n?-1:r.ucmp(this.p))?(r.words[0]=0,r.length=1):0<e?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(v,m),v.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n<r;n++)t.words[n]=e.words[n];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,n=10;n<e.length;n++){var o=0|e.words[n];e.words[n-10]=(4194303&o)<<4|i>>>22,i=o}0==(e.words[n-10]=i>>>=22)&&10<e.length?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(w,m),i(_,m),i(E,m),E.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=19*(0|e.words[r])+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new _;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return b[e]=t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(!(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return(this.prime?this.prime.ireduce(e):e.umod(this.m))._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){return this._verify2(e,t),0<=(t=e.add(t)).cmp(this.m)&&t.isub(this.m),t._forceRed(this)},S.prototype.iadd=function(e,t){return this._verify2(e,t),0<=(t=e.iadd(t)).cmp(this.m)&&t.isub(this.m),t},S.prototype.sub=function(e,t){return this._verify2(e,t),(t=e.sub(t)).cmpn(0)<0&&t.iadd(this.m),t._forceRed(this)},S.prototype.isub=function(e,t){return this._verify2(e,t),(t=e.isub(t)).cmpn(0)<0&&t.iadd(this.m),t},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t)return t=this.m.add(new o(1)).iushrn(2),this.pow(e,t);for(var r=this.m.subn(1),i=0;!r.isZero()&&0===r.andln(1);)i++,r.iushrn(1);n(!r.isZero());for(var a=new o(1).toRed(this),s=a.redNeg(),u=this.m.subn(1).iushrn(1),f=new o(2*(f=this.m.bitLength())*f).toRed(this);0!==this.pow(f,u).cmp(s);)f.redIAdd(s);for(var c=this.pow(f,r),l=this.pow(e,r.addn(1).iushrn(1)),h=this.pow(e,r),d=i;0!==h.cmp(a);){for(var p=h,y=0;0!==p.cmp(a);y++)p=p.redSqr();n(y<d);var g=this.pow(c,new o(1).iushln(d-y-1));l=l.redMul(g),c=g.redSqr(),h=h.redMul(c),d=y}return l},S.prototype.invm=function(e){return 0!==(e=e._invmp(this.m)).negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},S.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),n=t.length-1;0<=n;n--){for(var f=t.words[n],c=u-1;0<=c;c--){var l=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!=l||0!==a?(a<<=1,a|=l,(4==++s||0===n&&0===c)&&(i=this.mul(i,r[a]),a=s=0)):s=0}u=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){return(e=e.clone()).red=null,e},o.mont=function(e){return new k(e)},i(k,S),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){return(e=this.imod(e.mul(this.rinv))).red=null,e},k.prototype.imul=function(e,t){return e.isZero()||t.isZero()?(e.words[0]=0,e.length=1,e):(t=(e=e.imul(t)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),t=e=e.isub(t).iushrn(this.shift),0<=e.cmp(this.m)?t=e.isub(this.m):e.cmpn(0)<0&&(t=e.iadd(this.m)),t._forceRed(this))},k.prototype.mul=function(e,t){return e.isZero()||t.isZero()?new o(0)._forceRed(this):(t=(e=e.mul(t)).maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),t=e=e.isub(t).iushrn(this.shift),0<=e.cmp(this.m)?t=e.isub(this.m):e.cmpn(0)<0&&(t=e.iadd(this.m)),t._forceRed(this))},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===t||t,this)},{buffer:11}],10:[function(e,t,n){(function(e){(function(){t.exports=function(t){return t=new Uint8Array(t),(e.crypto||e.msCrypto).getRandomValues(t),t}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,r){},{}],12:[function(e,t,r){r.version=e("../package.json").version,r.utils=e("./elliptic/utils"),r.rand=e("brorand"),r.curve=e("./elliptic/curve"),r.curves=e("./elliptic/curves"),r.ec=e("./elliptic/ec"),r.eddsa=e("./elliptic/eddsa")},{"../package.json":25,"./elliptic/curve":15,"./elliptic/curves":18,"./elliptic/ec":19,"./elliptic/eddsa":22,"./elliptic/utils":24,brorand:10}],13:[function(e,t,r){var n=e("bn.js"),i=e("../utils"),o=i.getNAF,a=i.getJSF,s=i.assert;function u(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0,!(t=this.n&&this.p.div(this.n))||0<t.cmpn(100)?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(e,t){this.curve=e,this.type=t,this.precomputed=null}(t.exports=u).prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(e,t){s(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength);t=(1<<r.step+1)-(r.step%2==0?2:1),t/=3;for(var i=[],a=0;a<n.length;a+=r.step){for(var u=0,f=a+r.step-1;a<=f;f--)u=(u<<1)+n[f];i.push(u)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=t;0<h;h--){for(a=0;a<i.length;a++)(u=i[a])===h?l=l.mixedAdd(r.points[a]):u===-h&&(l=l.mixedAdd(r.points[a].neg()));c=c.add(l)}return c.toP()},u.prototype._wnafMul=function(e,t){for(var r=e._getNAFPoints(4),n=r.wnd,i=r.points,a=o(t,n,this._bitLength),u=this.jpoint(null,null,null),f=a.length-1;0<=f;f--){for(var c=0;0<=f&&0===a[f];f--)c++;if(0<=f&&c++,u=u.dblp(c),f<0)break;var l=a[f];s(0!==l),u="affine"===e.type?0<l?u.mixedAdd(i[l-1>>1]):u.mixedAdd(i[-l-1>>1].neg()):0<l?u.add(i[l-1>>1]):u.add(i[-l-1>>1].neg())}return"affine"===e.type?u.toP():u},u.prototype._wnafMulAdd=function(e,t,r,n,i){for(var s=this._wnafT1,u=this._wnafT2,f=this._wnafT3,c=0,l=0;l<n;l++){var h,d=(h=t[l])._getNAFPoints(e);s[l]=d.wnd,u[l]=d.points}for(l=n-1;1<=l;l-=2){var p=l-1,y=l;if(1===s[p]&&1===s[y]){var g=[t[p],null,null,t[y]];0===t[p].y.cmp(t[y].y)?(g[1]=t[p].add(t[y]),g[2]=t[p].toJ().mixedAdd(t[y].neg())):0===t[p].y.cmp(t[y].y.redNeg())?(g[1]=t[p].toJ().mixedAdd(t[y]),g[2]=t[p].add(t[y].neg())):(g[1]=t[p].toJ().mixedAdd(t[y]),g[2]=t[p].toJ().mixedAdd(t[y].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],m=a(r[p],r[y]);for(c=Math.max(m[0].length,c),f[p]=new Array(c),f[y]=new Array(c),T=0;T<c;T++){var v=0|m[0][T],w=0|m[1][T];f[p][T]=b[3*(1+v)+(1+w)],f[y][T]=0,u[p]=g}}else f[p]=o(r[p],s[p],this._bitLength),f[y]=o(r[y],s[y],this._bitLength),c=Math.max(f[p].length,c),c=Math.max(f[y].length,c)}var _=this.jpoint(null,null,null),E=this._wnafT4;for(l=c;0<=l;l--){for(var S=0;0<=l;){for(var k=!0,T=0;T<n;T++)E[T]=0|f[T][l],0!==E[T]&&(k=!1);if(!k)break;S++,l--}if(0<=l&&S++,_=_.dblp(S),l<0)break;for(T=0;T<n;T++){var A=E[T];0!==A&&(0<A?h=u[T][A-1>>1]:A<0&&(h=u[T][-A-1>>1].neg()),_="affine"===h.type?_.mixedAdd(h):_.add(h))}}for(l=0;l<n;l++)u[l]=null;return i?_:_.toP()},(u.BasePoint=f).prototype.eq=function(){throw new Error("Not implemented")},f.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(e,t){if(e=i.toArray(e,t),t=this.p.byteLength(),(4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*t)return 6===e[0]?s(e[e.length-1]%2==0):7===e[0]&&s(e[e.length-1]%2==1),this.point(e.slice(1,1+t),e.slice(1+t,1+2*t));if((2===e[0]||3===e[0])&&e.length-1===t)return this.pointFromX(e.slice(1,1+t),3===e[0]);throw new Error("Unknown point format")},f.prototype.encodeCompressed=function(e){return this.encode(e,!0)},f.prototype._encode=function(e){var t=this.curve.p.byteLength(),r=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",t))},f.prototype.encode=function(e,t){return i.encode(this._encode(t),e)},f.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},f.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},f.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)n=n.dbl();r.push(n)}return{step:e,points:r}},f.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],r=(1<<e)-1,n=1==r?null:this.dbl(),i=1;i<r;i++)t[i]=t[i-1].add(n);return{wnd:e,points:t}},f.prototype._getBeta=function(){return null},f.prototype.dblp=function(e){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},{"../utils":24,"bn.js":9}],14:[function(e,t,r){t.exports={}},{}],15:[function(e,t,r){r.base=e("./base"),r.short=e("./short"),r.mont=e("./mont"),r.edwards=e("./edwards")},{"./base":13,"./edwards":14,"./mont":16,"./short":17}],16:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],17:[function(e,t,r){var n=e("../utils"),i=e("bn.js"),o=e("inherits"),a=e("./base"),s=n.assert;function u(e){a.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.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(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(e,t,r,n){a.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(e,t,r,n){a.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),(t.exports=u).prototype._getEndomorphism=function(e){var t,r,n;if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3))return r=(e.beta?new i(e.beta,16):r=(n=this._getEndoRoots(this.p))[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red),e.lambda?t=new i(e.lambda,16):(n=this._getEndoRoots(this.n),0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(r))?t=n[0]:(t=n[1],s(0===this.g.mul(t).x.cmp(this.g.x.redMul(r))))),{beta:r,lambda:t,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(t)}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=(e=(r=new i(2).toRed(t).redInvm()).redNeg(),new i(3).toRed(t).redNeg().redSqrt().redMul(r));return[e.redAdd(r).fromRed(),e.redSub(r).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,o,a,s=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=e,f=this.n.clone(),c=new i(1),l=new i(0),h=new i(0),d=new i(1),p=0;0!==u.cmpn(0);){var y=f.div(u),g=f.sub(y.mul(u)),b=h.sub(y.mul(c));if(y=d.sub(y.mul(l)),!n&&g.cmp(s)<0)t=a.neg(),r=c,n=g.neg(),o=b;else if(n&&2==++p)break;f=u,u=a=g,h=c,c=b,d=l,l=y}var m=g.neg(),v=b;return e=n.sqr().add(o.sqr()),0<=m.sqr().add(v.sqr()).cmp(e)&&(m=t,v=r),n.negative&&(n=n.neg(),o=o.neg()),m.negative&&(m=m.neg(),v=v.neg()),[{a:n,b:o},{a:m,b:v}]},u.prototype._endoSplit=function(e){var t=(o=this.endo.basis)[0],r=(a=o[1]).b.mul(e).divRound(this.n),n=t.b.neg().mul(e).divRound(this.n),i=r.mul(t.a),o=n.mul(a.a),a=(t=r.mul(t.b),n.mul(a.b));return{k1:e.sub(i).sub(o),k2:t.add(a).neg()}},u.prototype.pointFromX=function(e,t){var r=(e=(e=new i(e,16)).red?e:e.toRed(this.red)).redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");return r=n.fromRed().isOdd(),(t&&!r||!t&&r)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y;return e=this.a.redMul(t),e=t.redSqr().redMul(t).redIAdd(e).redIAdd(this.b),0===r.redSqr().redISub(e).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),n[2*o]=s,n[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}r=this._wnafMulAdd(1,n,i,2*o,r);for(var f=0;f<2*o;f++)n[f]=null,i[f]=null;return r},o(f,a.BasePoint),u.prototype.point=function(e,t,r){return new f(this,e,t,r)},u.prototype.pointFromJSON=function(e,t){return f.fromJSON(this,e,t)},f.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t,r,n=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);return e&&(t=this.curve,r=function(e){return t.point(e.x.redMul(t.endo.beta),e.y)},(e.beta=n).precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}),n}},f.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},f.fromJSON=function(e,t,r){"string"==typeof t&&(t=JSON.parse(t));var n=e.point(t[0],t[1],r);if(!t[2])return n;function i(t){return e.point(t[0],t[1],r)}return t=t[2],n.precomputed={beta:null,doubles:t.doubles&&{step:t.doubles.step,points:[n].concat(t.doubles.points.map(i))},naf:t.naf&&{wnd:t.naf.wnd,points:[n].concat(t.naf.points.map(i))}},n},f.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);e=(t=0!==(t=this.y.redSub(e.y)).cmpn(0)?t.redMul(this.x.redSub(e.x).redInvm()):t).redSqr().redISub(this.x).redISub(e.x);var t=t.redMul(this.x.redSub(e)).redISub(this.y);return this.curve.point(e,t)},f.prototype.dbl=function(){if(this.inf)return this;if(0===(r=this.y.redAdd(this.y)).cmpn(0))return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),r=r.redInvm();return r=(e=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(r)).redSqr().redISub(this.x.redAdd(this.x)),e=e.redMul(this.x.redSub(r)).redISub(this.y),this.curve.point(r,e)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){return t=[this,t],r=[e,r],this.curve.endo?this.curve._endoWnafMulAdd(t,r):this.curve._wnafMulAdd(1,t,r,2)},f.prototype.jmulAdd=function(e,t,r){return t=[this,t],r=[e,r],this.curve.endo?this.curve._endoWnafMulAdd(t,r,!0):this.curve._wnafMulAdd(1,t,r,2,!0)},f.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},f.prototype.neg=function(e){if(this.inf)return this;var t,r=this.curve.point(this.x,this.y.redNeg());return e&&this.precomputed&&(t=this.precomputed,e=function(e){return e.neg()},r.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(e)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(e)}}),r},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,a.BasePoint),u.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=(r=this.z.redInvm()).redSqr(),t=this.x.redMul(e),r=this.y.redMul(e).redMul(r);return this.curve.point(t,r)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z));return t=n.redSub(i),r=o.redSub(a),0===t.cmpn(0)?0!==r.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(a=(i=t.redSqr()).redMul(t),n=n.redMul(i),i=r.redSqr().redIAdd(a).redISub(n).redISub(n),a=r.redMul(n.redISub(i)).redISub(o.redMul(a)),t=this.z.redMul(e.z).redMul(t),this.curve.jpoint(i,a,t))},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z);return e=r.redSub(n),t=i.redSub(o),0===e.cmpn(0)?0!==t.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl():(o=(n=e.redSqr()).redMul(e),r=r.redMul(n),n=t.redSqr().redIAdd(o).redISub(r).redISub(r),o=t.redMul(r.redISub(n)).redISub(i.redMul(o)),e=this.z.redMul(e),this.curve.jpoint(n,o,e))},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r<e;r++)t=t.dbl();return t}var n=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),f=a.redAdd(a);for(r=0;r<e;r++){var c=o.redSqr(),l=(d=f.redSqr()).redSqr(),h=c.redAdd(c).redIAdd(c).redIAdd(n.redMul(u)),d=(c=o.redMul(d),h.redSqr().redISub(c.redAdd(c)));c=c.redISub(d),h=(h=h.redMul(c)).redIAdd(h).redISub(l),c=f.redMul(s),r+1<e&&(u=u.redMul(l)),o=d,s=c,f=h}return this.curve.jpoint(o,f.redMul(i),s)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},c.prototype._zeroDbl=function(){var e,t,r,n,i,o=this.zOne?(r=this.x.redSqr(),e=(n=this.y.redSqr()).redSqr(),i=(i=this.x.redAdd(n).redSqr().redISub(r).redISub(e)).redIAdd(i),n=(t=r.redAdd(r).redIAdd(r)).redSqr().redISub(i).redISub(i),r=(r=(r=e.redIAdd(e)).redIAdd(r)).redIAdd(r),t=t.redMul(i.redISub(e=n)).redISub(r),this.y.redAdd(this.y)):(i=this.x.redSqr(),o=(n=this.y.redSqr()).redSqr(),r=(r=this.x.redAdd(n).redSqr().redISub(i).redISub(o)).redIAdd(r),i=(n=i.redAdd(i).redIAdd(i)).redSqr(),o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o),e=i.redISub(r).redISub(r),t=n.redMul(r.redISub(e)).redISub(o),(o=this.y.redMul(this.z)).redIAdd(o));return this.curve.jpoint(e,t,o)},c.prototype._threeDbl=function(){var e,t,r,n,i,o,a,s;return this.zOne?(a=this.x.redSqr(),r=(e=this.y.redSqr()).redSqr(),o=(o=this.x.redAdd(e).redSqr().redISub(a).redISub(r)).redIAdd(o),t=n=(s=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a)).redSqr().redISub(o).redISub(o),i=(i=(i=r.redIAdd(r)).redIAdd(i)).redIAdd(i),e=s.redMul(o.redISub(n)).redISub(i),a=this.y.redAdd(this.y)):(r=this.z.redSqr(),s=this.y.redSqr(),o=this.x.redMul(s),n=(n=this.x.redSub(r).redMul(this.x.redAdd(r))).redAdd(n).redIAdd(n),o=(i=(i=o.redIAdd(o)).redIAdd(i)).redAdd(i),t=n.redSqr().redISub(o),a=this.y.redAdd(this.z).redSqr().redISub(s).redISub(r),s=(s=(s=(s=s.redSqr()).redIAdd(s)).redIAdd(s)).redIAdd(s),e=n.redMul(i.redISub(t)).redISub(s)),this.curve.jpoint(t,e,a)},c.prototype._dbl=function(){var e=this.curve.a,t=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),o=t.redSqr(),a=r.redSqr();return e=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),t=(i=(i=t.redAdd(t)).redIAdd(i)).redMul(a),i=e.redSqr().redISub(t.redAdd(t)),t=t.redISub(i),a=(a=(a=(a=a.redSqr()).redIAdd(a)).redIAdd(a)).redIAdd(a),a=e.redMul(t).redISub(a),n=r.redAdd(r).redMul(n),this.curve.jpoint(i,a,n)},c.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),n=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(n);return e=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),n=(n=(n=(n=n.redIAdd(n)).redIAdd(n)).redIAdd(n)).redIAdd(n),o=i.redIAdd(a).redSqr().redISub(o).redISub(e).redISub(n),t=(t=(t=t.redMul(o)).redIAdd(t)).redIAdd(t),t=(t=(t=this.x.redMul(e).redISub(t)).redIAdd(t)).redIAdd(t),o=(o=(o=(o=this.y.redMul(o.redMul(n.redISub(o)).redISub(a.redMul(e)))).redIAdd(o)).redIAdd(o)).redIAdd(o),e=this.z.redAdd(a).redSqr().redISub(r).redISub(e),this.curve.jpoint(t,o,e)},c.prototype.mul=function(e,t){return e=new i(e,t),this.curve._wnafMul(this,e)},c.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),r=e.z.redSqr();return 0===this.x.redMul(r).redISub(e.x.redMul(t)).cmpn(0)&&(t=t.redMul(this.z),r=r.redMul(e.z),0===this.y.redMul(r).redISub(e.y.redMul(t)).cmpn(0))},c.prototype.eqXToP=function(e){var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(r))return!0;for(var n=e.clone(),i=this.curve.redN.redMul(t);;){if(n.iadd(this.curve.n),0<=n.cmp(this.curve.p))return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},c.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../utils":24,"./base":13,"bn.js":9,inherits:39}],18:[function(e,t,r){var n,i=r,o=(r=e("hash.js"),e("./curve")),a=e("./utils").assert;function s(e){"short"===e.type?this.curve=new o.short(e):"edwards"===e.type?this.curve=new o.edwards(e):this.curve=new o.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new s(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=s,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"./curve":15,"./precomputed/secp256k1":23,"./utils":24,"hash.js":26}],19:[function(e,t,r){var n=e("bn.js"),i=e("hmac-drbg"),o=e("../utils"),a=e("../curves"),s=e("brorand"),u=o.assert,f=e("./key"),c=e("./signature");function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(u(Object.prototype.hasOwnProperty.call(a,e),"Unknown curve "+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=l).prototype.keyPair=function(e){return new f(this,e)},l.prototype.keyFromPrivate=function(e,t){return f.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return f.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){for(var t=new i({hash:this.hash,pers:(e=e||{}).pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||s(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var a=new n(t.generate(r));if(!(0<a.cmp(o)))return a.iaddn(1),this.keyFromPrivate(a)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return 0<r&&(e=e.ushrn(r)),!t&&0<=e.cmp(this.n)?e.sub(this.n):e},l.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o=o||{},t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var a=this.n.byteLength(),s=(r=t.getPrivate().toArray("be",a),a=e.toArray("be",a),new i({hash:this.hash,entropy:r,nonce:a,pers:o.pers,persEnc:o.persEnc||"utf8"})),u=this.n.sub(new n(1)),f=0;;f++){var l=o.k?o.k(f):new n(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||0<=l.cmp(u))){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)&&0!==(l=(l=l.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e))).umod(this.n)).cmpn(0))return d=(h.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0),o.canonical&&0<l.cmp(this.nh)&&(l=this.n.sub(l),d^=1),new c({r:p,s:l,recoveryParam:d})}}}},l.prototype.verify=function(e,t,r,i){return e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i),i=(t=new c(t,"hex")).r,t=t.s,!(i.cmpn(1)<0||0<=i.cmp(this.n))&&!(t.cmpn(1)<0||0<=t.cmp(this.n))&&(e=(t=t.invm(this.n)).mul(e).umod(this.n),t=t.mul(i).umod(this.n),this.curve._maxwellTrick?!(o=this.g.jmulAdd(e,r.getPublic(),t)).isInfinity()&&o.eqXToP(i):!(o=this.g.mulAdd(e,r.getPublic(),t)).isInfinity()&&0===o.getX().umod(this.n).cmp(i));var o},l.prototype.recoverPubKey=function(e,t,r,i){u((3&r)===r,"The recovery param is more than two bits"),t=new c(t,i);var o=this.n,a=new n(e),s=t.r;if(i=t.s,e=1&r,r>>=1,0<=s.cmp(this.curve.p.umod(this.curve.n))&&r)throw new Error("Unable to find sencond key candinate");return s=r?this.curve.pointFromX(s.add(this.curve.n),e):this.curve.pointFromX(s,e),t=t.r.invm(o),a=o.sub(a).mul(t).umod(o),o=i.mul(t).umod(o),this.g.mulAdd(a,s,o)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new c(t,n)).recoveryParam)return t.recoveryParam;for(var i,o=0;o<4;o++){try{i=this.recoverPubKey(e,t,o)}catch(e){continue}if(i.eq(r))return o}throw new Error("Unable to find valid recovery factor")}},{"../curves":18,"../utils":24,"./key":20,"./signature":21,"bn.js":9,brorand:10,"hmac-drbg":38}],20:[function(e,t,r){var n=e("bn.js"),i=e("../utils").assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},{"../utils":24,"bn.js":9}],21:[function(e,t,r){var n=e("bn.js"),i=e("../utils"),o=i.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function s(){this.place=0}function u(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0==n||4<n)return!1;for(var i=0,o=0,a=t.place;o<n;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function f(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t<r;)t++;return 0===t?e:e.slice(t)}function c(e,t){if(t<128)e.push(t);else{var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=a).prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new s;if(48!==e[r.place++])return!1;var o=u(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;if(!1===(t=u(e,r)))return!1;if(o=e.slice(r.place,t+r.place),r.place+=t,2!==e[r.place++])return!1;if(!1===(t=u(e,r)))return!1;if(e.length!==t+r.place)return!1;if(r=e.slice(r.place,t+r.place),0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===r[0]){if(!(128&r[1]))return!1;r=r.slice(1)}return this.r=new n(o),this.s=new n(r),!(this.recoveryParam=null)},a.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=f(t),r=f(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];return c(n,t.length),(n=n.concat(t)).push(2),c(n,r.length),t=n.concat(r),c(n=[48],t.length),n=n.concat(t),i.encode(n,e)}},{"../utils":24,"bn.js":9}],22:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],23:[function(e,t,r){t.exports=void 0},{}],24:[function(e,t,r){var n=r,i=e("bn.js");r=e("minimalistic-assert"),e=e("minimalistic-crypto-utils"),n.assert=r,n.toArray=e.toArray,n.zero2=e.zero2,n.toHex=e.toHex,n.encode=e.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<n.length;a++){var s,u=o.andln(i-1);o.isOdd()?o.isubn(s=(i>>1)-1<u?(i>>1)-u:u):s=0,n[a]=s,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;0<e.cmpn(-i)||0<t.cmpn(-o);){var a,s=e.andln(3)+i&3,u=t.andln(3)+o&3;3===u&&(u=-1),a=1&(s=3===s?-1:s)?3!=(n=e.andln(7)+i&7)&&5!==n||2!==u?s:-s:0,r[0].push(a),u=1&u?3!=(n=t.andln(7)+o&7)&&5!==n||2!==s?u:-u:0,r[1].push(u),2*i===a+1&&(i=1-i),2*o===u+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},{"bn.js":9,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],25:[function(e,t,r){t.exports={version:"6.5.4"}},{}],26:[function(e,t,r){r.utils=e("./hash/utils"),r.common=e("./hash/common"),r.sha=e("./hash/sha"),r.ripemd=e("./hash/ripemd"),r.hmac=e("./hash/hmac"),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},{"./hash/common":27,"./hash/hmac":28,"./hash/ripemd":29,"./hash/sha":30,"./hash/utils":37}],27:[function(e,t,r){var n=e("./utils"),i=e("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}(r.BlockHash=o).prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){t=(e=this.pending).length%this._delta8,this.pending=e.slice(e.length-t,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-t,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},o.prototype.digest=function(e){return this.update(this._pad()),i(null===this.pending),this._digest(e)},o.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,r=t-(e+this.padLength)%t,n=new Array(r+this.padLength);n[0]=128;for(var i=1;i<r;i++)n[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)n[i++]=0;n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=e>>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o<this.padLength;o++)n[i++]=0;return n}},{"./utils":37,"minimalistic-assert":41}],28:[function(e,t,r){var n=e("./utils"),i=e("minimalistic-assert");function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}(t.exports=o).prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},o.prototype.update=function(e,t){return this.inner.update(e,t),this},o.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}},{"./utils":37,"minimalistic-assert":41}],29:[function(e,t,r){var n=e("./utils"),i=(e=e("./common"),n.rotl32),o=n.sum32,a=n.sum32_3,s=n.sum32_4,u=e.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function c(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}n.inherits(f,u),(r.ripemd160=f).blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r,n=v=this.h[0],u=S=this.h[1],f=E=this.h[2],y=_=this.h[3],g=w=this.h[4],b=0;b<80;b++){var m=o(i(s(v,c(b,S,E,_),e[l[b]+t],(r=b)<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838),d[b]),w),v=w,w=_,_=i(E,10),E=S,S=m;m=o(i(s(n,c(79-b,u,f,y),e[h[b]+t],(r=b)<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0),p[b]),g),n=g,g=y,y=i(f,10),f=u,u=m}m=a(this.h[1],E,y),this.h[1]=a(this.h[2],_,g),this.h[2]=a(this.h[3],w,n),this.h[3]=a(this.h[4],v,u),this.h[4]=a(this.h[0],S,f),this.h[0]=m},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var l=[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],h=[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],d=[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],p=[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]},{"./common":27,"./utils":37}],30:[function(e,t,r){r.sha1=e("./sha/1"),r.sha224=e("./sha/224"),r.sha256=e("./sha/256"),r.sha384=e("./sha/384"),r.sha512=e("./sha/512")},{"./sha/1":31,"./sha/224":32,"./sha/256":33,"./sha/384":34,"./sha/512":35}],31:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],32:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],33:[function(e,t,r){var n=e("../utils"),i=e("../common"),o=e("./common"),a=e("minimalistic-assert"),s=n.sum32,u=n.sum32_4,f=n.sum32_5,c=o.ch32,l=o.maj32,h=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,g=i.BlockHash,b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}n.inherits(m,g),(t.exports=m).blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n<r.length;n++)r[n]=u(y(r[n-2]),r[n-7],p(r[n-15]),r[n-16]);var i=this.h[0],o=this.h[1],g=this.h[2],b=this.h[3],m=this.h[4],v=this.h[5],w=this.h[6],_=this.h[7];for(a(this.k.length===r.length),n=0;n<r.length;n++){var E=f(_,d(m),c(m,v,w),this.k[n],r[n]),S=s(h(i),l(i,o,g));_=w,w=v,v=m,m=s(b,E),b=g,g=o,o=i,i=s(E,S)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],g),this.h[3]=s(this.h[3],b),this.h[4]=s(this.h[4],m),this.h[5]=s(this.h[5],v),this.h[6]=s(this.h[6],w),this.h[7]=s(this.h[7],_)},m.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"./common":36,"minimalistic-assert":41}],34:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{dup:14}],35:[function(e,t,r){var n=e("../utils"),i=e("../common"),o=e("minimalistic-assert"),a=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,f=n.shr64_lo,c=n.sum64,l=n.sum64_hi,h=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,g=n.sum64_5_lo,b=i.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;b.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}n.inherits(v,b),(t.exports=v).blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n<r.length;n+=2){var i=function(e,t){return(t=a(e,t,19)^a(t,e,29)^(t=u(e,t,6)))<0&&(t+=4294967296),t}(r[n-4],r[n-3]),o=function(e,t){return(t=s(e,t,19)^s(t,e,29)^(t=f(e,t,6)))<0&&(t+=4294967296),t}(r[n-4],r[n-3]),c=r[n-14],l=r[n-13],h=function(e,t){return(t=a(e,t,1)^a(e,t,8)^(t=u(e,t,7)))<0&&(t+=4294967296),t}(r[n-30],r[n-29]),y=function(e,t){return(t=s(e,t,1)^s(e,t,8)^(t=f(e,t,7)))<0&&(t+=4294967296),t}(r[n-30],r[n-29]),g=r[n-32],b=r[n-31];r[n]=d(i,o,c,l,h,y,g,b),r[n+1]=p(i,o,c,l,h,y,g,b)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var r=this.W,n=this.h[0],i=this.h[1],u=this.h[2],f=this.h[3],d=this.h[4],p=this.h[5],b=this.h[6],m=this.h[7],v=this.h[8],w=this.h[9],_=this.h[10],E=this.h[11],S=this.h[12],k=this.h[13],T=this.h[14],A=this.h[15];o(this.k.length===r.length);for(var P=0;P<r.length;P+=2){var I=T,O=A,x=function(e,t){return(e=a(e,t,14)^a(e,t,18)^(e=a(t,e,9)))<0&&(e+=4294967296),e}(v,w),M=function(e,t){return(e=s(e,t,14)^s(e,t,18)^(e=s(t,e,9)))<0&&(e+=4294967296),e}(v,w),N=function(e,t,r){return(r=e&t^~e&r)<0&&(r+=4294967296),r}(v,_,S),R=function(e,t,r){return(r=e&t^~e&r)<0&&(r+=4294967296),r}(w,E,k),B=this.k[P],C=this.k[P+1],L=r[P],U=r[P+1],D=y(I,O,x,M,N,R,B,C,L,U);L=g(I,O,x,M,N,R,B,C,L,U),I=function(e,t){return(e=a(e,t,28)^a(t,e,2)^(e=a(t,e,7)))<0&&(e+=4294967296),e}(n,i),O=function(e,t){return(e=s(e,t,28)^s(t,e,2)^(e=s(t,e,7)))<0&&(e+=4294967296),e}(n,i),x=function(e,t,r){return(r=e&t^e&r^t&r)<0&&(r+=4294967296),r}(n,u,d),M=function(e,t,r){return(r=e&t^e&r^t&r)<0&&(r+=4294967296),r}(i,f,p),U=l(I,O,x,M),M=h(I,O,x,M),T=S,A=k,S=_,k=E,_=v,E=w,v=l(b,m,D,L),w=h(m,m,D,L),b=d,m=p,d=u,p=f,u=n,f=i,n=l(D,L,U,M),i=h(D,L,U,M)}c(this.h,0,n,i),c(this.h,2,u,f),c(this.h,4,d,p),c(this.h,6,b,m),c(this.h,8,v,w),c(this.h,10,_,E),c(this.h,12,S,k),c(this.h,14,T,A)},v.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"big"):n.split32(this.h,"big")}},{"../common":27,"../utils":37,"minimalistic-assert":41}],36:[function(e,t,r){var n=e("../utils").rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}r.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?t^r^n:2===e?o(t,r,n):void 0},r.ch32=i,r.maj32=o,r.p32=function(e,t,r){return e^t^r},r.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},r.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},r.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":37}],37:[function(e,t,r){var n=e("minimalistic-assert");function i(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function a(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}e=e("inherits"),r.inherits=e,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var n=0;n<e.length;n++){var i=(o=e.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},r.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=o(e[r].toString(16));return t},r.htonl=i,r.toHex32=function(e,t){for(var r="",n=0;n<e.length;n++){var o=e[n];r+=a((o="little"===t?i(o):o).toString(16))}return r},r.zero2=o,r.zero8=a,r.join32=function(e,t,r,i){n((r-=t)%4==0);for(var o=new Array(r/4),a=0,s=t;a<o.length;a++,s+=4){var u="big"===i?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s];o[a]=u>>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n<e.length;n++,i+=4){var o=e[n];"big"===t?(r[i]=o>>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<<t|e>>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0;e[t]=(o<n?1:0)+r+i>>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0<t?1:0)+e+r>>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,a,s){var u=0,f=t;return u+=(f=t+n>>>0)<t?1:0,u+=(f=f+o>>>0)<o?1:0,e+r+i+a+(u+=(f=f+s>>>0)<s?1:0)>>>0},r.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,a,s,u,f){var c=0,l=t;return c+=(l=t+n>>>0)<t?1:0,c+=(l=l+o>>>0)<o?1:0,c+=(l=l+s>>>0)<s?1:0,e+r+i+a+u+(c+=(l=l+f>>>0)<f?1:0)>>>0},r.sum64_5_lo=function(e,t,r,n,i,o,a,s,u,f){return t+n+o+s+f>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:39,"minimalistic-assert":41}],38:[function(e,t,r){var n=e("hash.js"),i=e("minimalistic-crypto-utils"),o=e("minimalistic-assert");function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex");e=i.toArray(e.pers,e.persEnc||"hex"),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,e)}(t.exports=a).prototype._init=function(e,t,r){r=e.concat(t).concat(r),this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,r,n){"string"!=typeof t&&(n=r,r=t,t=null),e=i.toArray(e,t),r=i.toArray(r,n),o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);return n=o.slice(0,e),this._update(r),this._reseed++,i.encode(n,t)}},{"hash.js":26,"minimalistic-assert":41,"minimalistic-crypto-utils":42}],39:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){var r;t&&(e.super_=t,(r=function(){}).prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e)}},{}],40:[function(e,t,n){(function(e,r){(function(){!function(){for(var n="object"==typeof window?window:{},i=!(n=!n.JS_SHA3_NO_NODE_JS&&"object"==typeof e&&e.versions&&e.versions.node?r:n).JS_SHA3_NO_COMMON_JS&&"object"==typeof t&&t.exports,o="0123456789abcdef".split(""),a=[0,8,16,24],s=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],u=[224,256,384,512],f=["hex","buffer","arrayBuffer","array"],c=function(e,t,r){return function(n){return new _(e,t,e).update(n)[r]()}},l=function(e,t,r){return function(n,i){return new _(e,t,i).update(n)[r]()}},h=function(e,t){var r=c(e,t,"hex");r.create=function(){return new _(e,t,e)},r.update=function(e){return r.create().update(e)};for(var n=0;n<f.length;++n){var i=f[n];r[i]=c(e,t,i)}return r},d=[{name:"keccak",padding:[1,256,65536,16777216],bits:u,createMethod:h},{name:"sha3",padding:[6,1536,393216,100663296],bits:u,createMethod:h},{name:"shake",padding:[31,7936,2031616,520093696],bits:[128,256],createMethod:function(e,t){var r=l(e,t,"hex");r.create=function(r){return new _(e,t,r)},r.update=function(e,t){return r.create(t).update(e)};for(var n=0;n<f.length;++n){var i=f[n];r[i]=l(e,t,i)}return r}}],p={},y=[],g=0;g<d.length;++g)for(var b=d[g],m=b.bits,v=0;v<m.length;++v){var w=b.name+"_"+m[v];y.push(w),p[w]=b.createMethod(m[v],b.padding)}function _(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}_.prototype.update=function(e){for(var t,r,n="string"!=typeof e,i=(e=n&&e.constructor===ArrayBuffer?new Uint8Array(e):e).length,o=this.blocks,s=this.byteCount,u=this.blockCount,f=0,c=this.s;f<i;){if(this.reset)for(this.reset=!1,o[0]=this.block,t=1;t<u+1;++t)o[t]=0;if(n)for(t=this.start;f<i&&t<s;++f)o[t>>2]|=e[f]<<a[3&t++];else for(t=this.start;f<i&&t<s;++f)(r=e.charCodeAt(f))<128?o[t>>2]|=r<<a[3&t++]:(r<2048?o[t>>2]|=(192|r>>6)<<a[3&t++]:(r<55296||57344<=r?o[t>>2]|=(224|r>>12)<<a[3&t++]:(r=65536+((1023&r)<<10|1023&e.charCodeAt(++f)),o[t>>2]|=(240|r>>18)<<a[3&t++],o[t>>2]|=(128|r>>12&63)<<a[3&t++]),o[t>>2]|=(128|r>>6&63)<<a[3&t++]),o[t>>2]|=(128|63&r)<<a[3&t++]);if(s<=(this.lastByteIndex=t)){for(this.start=t-s,this.block=o[u],t=0;t<u;++t)c[t]^=o[t];E(c),this.reset=!0}else this.start=t}return this},_.prototype.finalize=function(){var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];E(n)},_.prototype.toString=_.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,s=0,u="";s<n;){for(a=0;a<t&&s<n;++a,++s)e=r[a],u+=o[e>>4&15]+o[15&e]+o[e>>12&15]+o[e>>8&15]+o[e>>20&15]+o[e>>16&15]+o[e>>28&15]+o[e>>24&15];s%t==0&&(E(r),a=0)}return i&&(e=r[a],0<i&&(u+=o[e>>4&15]+o[15&e]),1<i&&(u+=o[e>>12&15]+o[e>>8&15]),2<i&&(u+=o[e>>20&15]+o[e>>16&15])),u},_.prototype.arrayBuffer=function(){this.finalize();for(var e=this.blockCount,t=this.s,r=this.outputBlocks,n=this.extraBytes,i=0,o=0,a=this.outputBits>>3,s=n?new ArrayBuffer(r+1<<2):new ArrayBuffer(a),u=new Uint32Array(s);o<r;){for(i=0;i<e&&o<r;++i,++o)u[o]=t[i];o%e==0&&E(t)}return n&&(u[i]=t[i],s=s.slice(0,a)),s},_.prototype.buffer=_.prototype.arrayBuffer,_.prototype.digest=_.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<r&&s<i;++a,++s)t=n[a],u[e=s<<2]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r==0&&E(n)}return o&&(e=s<<2,t=n[a],0<o&&(u[e]=255&t),1<o&&(u[e+1]=t>>8&255),2<o&&(u[e+2]=t>>16&255)),u};var E=function(e){for(var t,r,n,i,o,a,u,f,c,l,h,d,p,y,g,b,m,v,w,_,E,S,k,T,A,P,I,O,x,M,N,R,B,C,L,U,D,j,H,F,K,G,V,z,W,q,X,$,Z,Y,J=0;J<48;J+=2)I=e[0]^e[10]^e[20]^e[30]^e[40],O=e[1]^e[11]^e[21]^e[31]^e[41],F=e[2]^e[12]^e[22]^e[32]^e[42],H=e[3]^e[13]^e[23]^e[33]^e[43],R=e[4]^e[14]^e[24]^e[34]^e[44],N=e[5]^e[15]^e[25]^e[35]^e[45],q=e[6]^e[16]^e[26]^e[36]^e[46],W=e[7]^e[17]^e[27]^e[37]^e[47],p=e[8]^e[18]^e[28]^e[38]^e[48],l=(y=e[9]^e[19]^e[29]^e[39]^e[49])^(H<<1|F>>>31),e[0]^=c=p^(F<<1|H>>>31),e[1]^=l,e[10]^=c,e[11]^=l,e[20]^=c,e[21]^=l,e[30]^=c,e[31]^=l,e[40]^=c,e[41]^=l,l=O^(N<<1|R>>>31),e[2]^=c=I^(R<<1|N>>>31),e[3]^=l,e[12]^=c,e[13]^=l,e[22]^=c,e[23]^=l,e[32]^=c,e[33]^=l,e[42]^=c,e[43]^=l,l=H^(W<<1|q>>>31),e[4]^=c=F^(q<<1|W>>>31),e[5]^=l,e[14]^=c,e[15]^=l,e[24]^=c,e[25]^=l,e[34]^=c,e[35]^=l,e[44]^=c,e[45]^=l,l=N^(y<<1|p>>>31),e[6]^=c=R^(p<<1|y>>>31),e[7]^=l,e[16]^=c,e[17]^=l,e[26]^=c,e[27]^=l,e[36]^=c,e[37]^=l,e[46]^=c,e[47]^=l,l=W^(O<<1|I>>>31),e[8]^=c=q^(I<<1|O>>>31),e[9]^=l,e[18]^=c,e[19]^=l,e[28]^=c,e[29]^=l,e[38]^=c,e[39]^=l,e[48]^=c,e[49]^=l,t=e[0],r=e[1],B=e[11]<<4|e[10]>>>28,C=e[10]<<4|e[11]>>>28,g=e[20]<<3|e[21]>>>29,b=e[21]<<3|e[20]>>>29,X=e[31]<<9|e[30]>>>23,$=e[30]<<9|e[31]>>>23,x=e[40]<<18|e[41]>>>14,M=e[41]<<18|e[40]>>>14,E=e[2]<<1|e[3]>>>31,S=e[3]<<1|e[2]>>>31,n=e[13]<<12|e[12]>>>20,i=e[12]<<12|e[13]>>>20,L=e[22]<<10|e[23]>>>22,U=e[23]<<10|e[22]>>>22,m=e[33]<<13|e[32]>>>19,v=e[32]<<13|e[33]>>>19,Z=e[42]<<2|e[43]>>>30,Y=e[43]<<2|e[42]>>>30,K=e[5]<<30|e[4]>>>2,G=e[4]<<30|e[5]>>>2,k=e[14]<<6|e[15]>>>26,T=e[15]<<6|e[14]>>>26,o=e[25]<<11|e[24]>>>21,a=e[24]<<11|e[25]>>>21,D=e[34]<<15|e[35]>>>17,j=e[35]<<15|e[34]>>>17,w=e[45]<<29|e[44]>>>3,_=e[44]<<29|e[45]>>>3,h=e[6]<<28|e[7]>>>4,d=e[7]<<28|e[6]>>>4,V=e[17]<<23|e[16]>>>9,z=e[16]<<23|e[17]>>>9,A=e[26]<<25|e[27]>>>7,P=e[27]<<25|e[26]>>>7,u=e[36]<<21|e[37]>>>11,f=e[37]<<21|e[36]>>>11,H=e[47]<<24|e[46]>>>8,F=e[46]<<24|e[47]>>>8,N=e[8]<<27|e[9]>>>5,R=e[9]<<27|e[8]>>>5,p=e[18]<<20|e[19]>>>12,y=e[19]<<20|e[18]>>>12,W=e[29]<<7|e[28]>>>25,q=e[28]<<7|e[29]>>>25,I=e[38]<<8|e[39]>>>24,O=e[39]<<8|e[38]>>>24,c=e[48]<<14|e[49]>>>18,l=e[49]<<14|e[48]>>>18,e[0]=t^~n&o,e[1]=r^~i&a,e[10]=h^~p&g,e[11]=d^~y&b,e[20]=E^~k&A,e[21]=S^~T&P,e[30]=N^~B&L,e[31]=R^~C&U,e[40]=K^~V&W,e[41]=G^~z&q,e[2]=n^~o&u,e[3]=i^~a&f,e[12]=p^~g&m,e[13]=y^~b&v,e[22]=k^~A&I,e[23]=T^~P&O,e[32]=B^~L&D,e[33]=C^~U&j,e[42]=V^~W&X,e[43]=z^~q&$,e[4]=o^~u&c,e[5]=a^~f&l,e[14]=g^~m&w,e[15]=b^~v&_,e[24]=A^~I&x,e[25]=P^~O&M,e[34]=L^~D&H,e[35]=U^~j&F,e[44]=W^~X&Z,e[45]=q^~$&Y,e[6]=u^~c&t,e[7]=f^~l&r,e[16]=m^~w&h,e[17]=v^~_&d,e[26]=I^~x&E,e[27]=O^~M&S,e[36]=D^~H&N,e[37]=j^~F&R,e[46]=X^~Z&K,e[47]=$^~Y&G,e[8]=c^~t&n,e[9]=l^~r&i,e[18]=w^~h&p,e[19]=_^~d&y,e[28]=x^~E&k,e[29]=M^~S&T,e[38]=H^~N&B,e[39]=F^~R&C,e[48]=Z^~K&V,e[49]=Y^~G&z,e[0]^=s[J],e[1]^=s[J+1]};if(i)t.exports=p;else for(g=0;g<y.length;++g)n[y[g]]=p[y[g]]}()}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:43}],41:[function(e,t,r){(t.exports=function(e,t){if(!e)throw new Error(t||"Assertion failed")}).equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},{}],42:[function(e,t,r){function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r<e.length;r++)t+=n(e[r].toString(16));return t}r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"!=typeof e){for(var n=0;n<e.length;n++)r[n]=0|e[n];return r}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16));else for(n=0;n<e.length;n++){var i=(o=e.charCodeAt(n))>>8,o=255&o;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},{}],43:[function(e,t,r){t.exports={browser:!0}},{}],44:[function(e,t,r){(function(e){(function(){function n(e){var t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=1779033703,n=3144134277,i=1013904242,o=2773480762,a=1359893119,s=2600822924,u=528734635,f=1541459225,c=new Array(64);function l(e){for(var l=0,h=e.length;64<=h;){for(var d,p,y,g,b=r,m=n,v=i,w=o,_=a,E=s,S=u,k=f,T=0;T<16;T++)c[T]=(255&e[p=l+4*T])<<24|(255&e[p+1])<<16|(255&e[p+2])<<8|255&e[p+3];for(T=16;T<64;T++)y=((d=c[T-2])>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,d=c[T-15],c[T]=(y+c[T-7]|0)+((g=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3)+c[T-16]|0)|0;for(T=0;T<64;T++)y=(((_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7))+(_&E^~_&S)|0)+(k+(t[T]+c[T]|0)|0)|0,g=((b>>>2|b<<30)^(b>>>13|b<<19)^(b>>>22|b<<10))+(b&m^b&v^m&v)|0,k=S,S=E,E=_,_=w+y|0,w=v,v=m,m=b,b=y+g|0;r=r+b|0,n=n+m|0,i=i+v|0,o=o+w|0,a=a+_|0,s=s+E|0,u=u+S|0,f=f+k|0,l+=64,h-=64}}l(e);var h,d=e.length%64,p=e.length/536870912|0,y=e.length<<3,g=d<56?56:120,b=e.slice(e.length-d,e.length);for(b.push(128),h=1+d;h<g;h++)b.push(0);return b.push(p>>>24&255),b.push(p>>>16&255),b.push(p>>>8&255),b.push(p>>>0&255),b.push(y>>>24&255),b.push(y>>>16&255),b.push(y>>>8&255),b.push(y>>>0&255),l(b),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255,f>>>24&255,f>>>16&255,f>>>8&255,f>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);for(var i=64+t.length+4,o=new Array(i),a=new Array(64),s=[],u=0;u<64;u++)o[u]=54;for(u=0;u<e.length;u++)o[u]^=e[u];for(u=0;u<t.length;u++)o[64+u]=t[u];for(u=i-4;u<i;u++)o[u]=0;for(u=0;u<64;u++)a[u]=92;for(u=0;u<e.length;u++)a[u]^=e[u];function f(){for(var e=i-1;i-4<=e;e--){if(o[e]++,o[e]<=255)return;o[e]=0}}for(;32<=r;)f(),s=s.concat(n(a.concat(n(o)))),r-=32;return 0<r&&(f(),s=s.concat(n(a.concat(n(o))).slice(0,r))),s}function o(e,t,r,n,i){var o;for(u(e,16*(2*r-1),i,0,16),o=0;o<2*r;o++)s(e,16*o,i,16),function(e,t){u(e,0,t,0,16);for(var r=8;0<r;r-=2)t[4]^=a(t[0]+t[12],7),t[8]^=a(t[4]+t[0],9),t[12]^=a(t[8]+t[4],13),t[0]^=a(t[12]+t[8],18),t[9]^=a(t[5]+t[1],7),t[13]^=a(t[9]+t[5],9),t[1]^=a(t[13]+t[9],13),t[5]^=a(t[1]+t[13],18),t[14]^=a(t[10]+t[6],7),t[2]^=a(t[14]+t[10],9),t[6]^=a(t[2]+t[14],13),t[10]^=a(t[6]+t[2],18),t[3]^=a(t[15]+t[11],7),t[7]^=a(t[3]+t[15],9),t[11]^=a(t[7]+t[3],13),t[15]^=a(t[11]+t[7],18),t[1]^=a(t[0]+t[3],7),t[2]^=a(t[1]+t[0],9),t[3]^=a(t[2]+t[1],13),t[0]^=a(t[3]+t[2],18),t[6]^=a(t[5]+t[4],7),t[7]^=a(t[6]+t[5],9),t[4]^=a(t[7]+t[6],13),t[5]^=a(t[4]+t[7],18),t[11]^=a(t[10]+t[9],7),t[8]^=a(t[11]+t[10],9),t[9]^=a(t[8]+t[11],13),t[10]^=a(t[9]+t[8],18),t[12]^=a(t[15]+t[14],7),t[13]^=a(t[12]+t[15],9),t[14]^=a(t[13]+t[12],13),t[15]^=a(t[14]+t[13],18);for(r=0;r<16;++r)e[r]+=t[r]}(i,n),u(i,0,e,t+16*o,16);for(o=0;o<r;o++)u(e,t+2*o*16,e,16*o,16);for(o=0;o<r;o++)u(e,t+16*(2*o+1),e,16*(o+r),16)}function a(e,t){return e<<t|e>>>32-t}function s(e,t,r,n){for(var i=0;i<n;i++)r[i]^=e[t+i]}function u(e,t,r,n,i){for(;i--;)r[n++]=e[t++]}function f(e){if(e&&"number"==typeof e.length){for(var t=0;t<e.length;t++){if("number"!=typeof e[t])return;var r=parseInt(e[t]);if(r!=e[t]||r<0||256<=r)return}return 1}}function c(e,t){var r=parseInt(e);if(e!=r)throw new Error("invalid "+t);return r}function l(t,r,n,a,l,h,p){if(!p)throw new Error("missing callback");if(n=c(n,"N"),a=c(a,"r"),l=c(l,"p"),h=c(h,"dkLen"),0===n||n&n-1)throw new Error("N must be power of 2");if(d/128/a<n)throw new Error("N too large");if(d/128/l<a)throw new Error("r too large");if(!f(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!f(r))throw new Error("salt must be an array or buffer");r=Array.prototype.slice.call(r);for(var y=i(t,r,128*l*a),g=new Uint32Array(32*l*a),b=0;b<g.length;b++){var m=4*b;g[b]=(255&y[3+m])<<24|(255&y[2+m])<<16|(255&y[1+m])<<8|255&y[0+m]}var v,w,_=new Uint32Array(64*a),E=new Uint32Array(32*a*n),S=32*a,k=new Uint32Array(16),T=new Uint32Array(16),A=l*n*2,P=0,I=null,O=!1,x=0,M=0,N=parseInt(1e3/a),R=void 0!==e?e:setTimeout,B=function(){if(O)return p(new Error("cancelled"),P/A);switch(x){case 0:u(g,w=32*M*a,_,0,S),x=1,v=0;case 1:N<(r=n-v)&&(r=N);for(var e=0;e<r;e++)u(_,0,E,(v+e)*S,S),o(_,S,a,k,T);if(v+=r,P+=r,(c=parseInt(1e3*P/A))!==I){if(O=p(null,P/A))break;I=c}if(v<n)break;v=0,x=2;case 2:var r;for(N<(r=n-v)&&(r=N),e=0;e<r;e++){var f=_[16*(2*a-1)]&n-1;s(E,f*S,_,S),o(_,S,a,k,T)}if(v+=r,P+=r,(c=parseInt(1e3*P/A))!==I){if(O=p(null,P/A))break;I=c}if(v<n)break;if(u(_,0,g,w,S),++M<l){x=0;break}for(y=[],e=0;e<g.length;e++)y.push(255&g[e]),y.push(g[e]>>8&255),y.push(g[e]>>16&255),y.push(g[e]>>24&255);var c=i(t,y,h);return p(null,1,c)}R(B)};B()}var h,d;h=this,d=2147483647,void 0!==r?t.exports=l:h&&(h.scrypt&&(h._scrypt=h.scrypt),h.scrypt=l)}).call(this)}).call(this,e("timers").setImmediate)},{timers:46}],45:[function(e,t,n){(function(e,t,r){(function(){!function(t,r){var n,i,o,a,s,u,f,c;function l(e){return i[n]=h.apply(r,e),n++}function h(e){var t=[].slice.call(arguments,1);return function(){"function"==typeof e?e.apply(r,t):new Function(""+e)()}}function d(e){if(o)setTimeout(h(d,e),0);else{var t=i[e];if(t){o=!0;try{t()}finally{p(e),o=!1}}}}function p(e){delete i[e]}t.setImmediate||(n=1,o=!(i={}),a=t.document,c=(c=Object.getPrototypeOf&&Object.getPrototypeOf(t))&&c.setTimeout?c:t,"[object process]"==={}.toString.call(t.process)?s=function(){var t=l(arguments);return e.nextTick(h(d,t)),t}:function(){if(t.postMessage&&!t.importScripts){var e=!0,r=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=r,e}}()?function(){function e(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(r)&&d(+e.data.slice(r.length))}var r="setImmediate$"+Math.random()+"$";t.addEventListener?t.addEventListener("message",e,!1):t.attachEvent("onmessage",e),s=function(){var e=l(arguments);return t.postMessage(r+e,"*"),e}}():s=t.MessageChannel?((f=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(){var e=l(arguments);return f.port2.postMessage(e),e}):a&&"onreadystatechange"in a.createElement("script")?(u=a.documentElement,function(){var e=l(arguments),t=a.createElement("script");return t.onreadystatechange=function(){d(e),t.onreadystatechange=null,u.removeChild(t),t=null},u.appendChild(t),e}):function(){var e=l(arguments);return setTimeout(h(d,e),0),e},c.setImmediate=s,c.clearImmediate=p)}("undefined"==typeof self?void 0===t?this:t:self)}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").clearImmediate)},{_process:43,timers:46}],46:[function(e,t,n){(function(e){(function(){t.exports={setImmediate:e.setImmediate}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],47:[function(e,t,n){(function(e){(function(){var r,n,i;e.crypto&&crypto.getRandomValues&&(r=new Uint8Array(16),n=function(){return crypto.getRandomValues(r),r}),n||(i=new Array(16),n=function(){for(var e,t=0;t<16;t++)!(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}),t.exports=n}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],48:[function(e,t,r){for(var n=e("./rng"),i=[],o={},a=0;a<256;a++)i[a]=(a+256).toString(16).substr(1),o[i[a]]=a;function s(e,t){return t=t||0,i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+"-"+i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]+i[e[t++]]}var u=[1|(e=n())[0],e[1],e[2],e[3],e[4],e[5]],f=16383&(e[6]<<8|e[7]),c=0,l=0;function h(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;a++)t[i+a]=o[a];return t||s(o)}(e=h).v1=function(e,t,r){var n=t&&r||0,i=t||[],o=void 0!==(e=e||{}).clockseq?e.clockseq:f,a=void 0!==e.msecs?e.msecs:(new Date).getTime(),h=void 0!==e.nsecs?e.nsecs:l+1;if((r=a-c+(h-l)/1e4)<0&&void 0===e.clockseq&&(o=o+1&16383),1e4<=(h=(r<0||c<a)&&void 0===e.nsecs?0:h))throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=a,f=o,h=(1e4*(268435455&(a+=122192928e5))+(l=h))%4294967296,i[n++]=h>>>24&255,i[n++]=h>>>16&255,i[n++]=h>>>8&255,i[n++]=255&h,a=a/4294967296*1e4&268435455,i[n++]=a>>>8&255,i[n++]=255&a,i[n++]=a>>>24&15|16,i[n++]=a>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var d=e.node||u,p=0;p<6;p++)i[n+p]=d[p];return t||s(i)},e.v4=h,e.parse=function(e,t,r){var n=t&&r||0,i=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,(function(e){i<16&&(t[n+i++]=o[e])}));i<16;)t[n+i++]=0;return t},e.unparse=s,t.exports=e},{"./rng":47}],49:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});try{t.exports.XMLHttpRequest=XMLHttpRequest}catch(e){console.log("Warning: XMLHttpRequest is not defined"),t.exports.XMLHttpRequest=null}},{}],50:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../utils/properties");function i(){n.setType(this,"Provider")}i.isProvider=function(e){return n.isType(e,"Provider")},e=i,r.Provider=e},{"../utils/properties":74}],51:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("../utils/address"),s=e("../utils/bignumber"),u=e("../utils/bytes"),f=e("../constants"),c=e("../utils/hash"),l=e("../utils/networks"),h=e("../utils/properties"),d=e("../utils/rlp"),p=e("../utils/transaction"),y=e("../utils/utf8"),g=e("../utils/web"),b=o(e("../errors")),m=e("./abstract-provider");function v(e,t){var r,n={};for(r in e)try{var i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}function w(e,t){return function(r){return null==r?t:e(r)}}function _(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");var r=[];return t.forEach((function(t){r.push(e(t))})),r}}function E(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),32===u.hexDataLength(e))?e.toLowerCase():(b.throwError("invalid hash",b.INVALID_ARGUMENT,{arg:"hash",value:e}),null)}function S(e){return s.bigNumberify(e).toNumber()}function k(e){if(!u.isHexString(e))throw new Error("invalid uint256");for(;e.length<66;)e="0x0"+e.substring(2);return e}function T(e){if(null==e)return"latest";if("earliest"===e)return"0x0";if("latest"===e||"pending"===e)return e;if("number"==typeof e)return u.hexStripZeros(u.hexlify(e));if(u.isHexString(e))return u.hexStripZeros(e);throw new Error("invalid blockTag")}var A={hash:E,blockHash:w(E,null),blockNumber:w(S,null),transactionIndex:w(S,null),confirmations:w(S,null),from:a.getAddress,gasPrice:s.bigNumberify,gasLimit:s.bigNumberify,to:w(a.getAddress,null),value:s.bigNumberify,nonce:S,data:u.hexlify,r:w(k),s:w(k),v:w(S),creates:w(a.getAddress,null),raw:w(u.hexlify)};function P(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&s.bigNumberify(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=a.getContractAddress(e)),e.raw||e.v&&e.r&&e.s&&(r=[u.stripZeros(u.hexlify(e.nonce)),u.stripZeros(u.hexlify(e.gasPrice)),u.stripZeros(u.hexlify(e.gasLimit)),e.to||"0x",u.stripZeros(u.hexlify(e.value||"0x")),u.hexlify(e.data||"0x"),u.stripZeros(u.hexlify(e.v||"0x")),u.stripZeros(u.hexlify(e.r)),u.stripZeros(u.hexlify(e.s))],e.raw=d.encode(r));var t=v(A,e),r=e.networkId;return null!=e.chainId&&null==r&&null==t.v&&(r=e.chainId),"number"!=typeof(r=u.isHexString(r)?s.bigNumberify(r).toNumber():r)&&null!=t.v&&((r=(t.v-35)/2)<0&&(r=0),r=parseInt(r)),t.networkId=r="number"!=typeof r?0:r,null==t.chainId&&null!=r&&(t.chainId=r),t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}var I={hash:E,parentHash:E,number:S,timestamp:S,nonce:w(u.hexlify),difficulty:function(e){e=s.bigNumberify(e);try{return e.toNumber()}catch(e){}return null},gasLimit:s.bigNumberify,gasUsed:s.bigNumberify,miner:a.getAddress,extraData:u.hexlify,transactions:w(_(E))},O=h.shallowCopy(I);function x(e,t){return null!=e.author&&null==e.miner&&(e.miner=e.author),v(t?O:I,e)}O.transactions=w(_(P));var M={from:w(a.getAddress),nonce:w(S),gasLimit:w(s.bigNumberify),gasPrice:w(s.bigNumberify),to:w(a.getAddress),value:w(s.bigNumberify),data:w(u.hexlify)};function N(e){return v(M,e)}var R={transactionLogIndex:w(S),transactionIndex:S,blockNumber:S,transactionHash:E,address:a.getAddress,topics:_(E),data:u.hexlify,logIndex:S,blockHash:E},B={to:w(a.getAddress,null),from:w(a.getAddress,null),contractAddress:w(a.getAddress,null),transactionIndex:S,root:w(E),gasUsed:s.bigNumberify,logsBloom:w(u.hexlify),blockHash:E,transactionHash:E,logs:_((function(e){return v(R,e)})),blockNumber:S,confirmations:w(S,null),cumulativeGasUsed:s.bigNumberify,status:w(S)};function C(e){return Array.isArray(e)?e.forEach((function(e){C(e)})):null!=e&&E(e),e}var L,U,D={fromBlock:w(T,void 0),toBlock:w(T,void 0),address:w(a.getAddress,void 0),topics:w(C,void 0)},j={blockHash:w(E,void 0),address:w(a.getAddress,void 0),topics:w(C,void 0)},H={blockNumber:w(S),blockHash:w(E),transactionIndex:S,removed:w((function(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===e)return!0;if("false"===e)return!1}throw new Error("invaid boolean - "+e)})),address:a.getAddress,data:(L=u.hexlify,"0x",function(e){return e?L(e):"0x"}),topics:_(E),transactionHash:E,logIndex:S};function F(e){return v(H,e)}function K(e){return e.map((function(e){return"string"==typeof e?e:Array.isArray(e)?(e.forEach((function(e){null!==e&&32!==u.hexDataLength(e)&&b.throwError("invalid topic",b.INVALID_ARGUMENT,{argument:"topic",value:e})})),e.join(",")):null===e?"":b.throwError("invalid topic value",b.INVALID_ARGUMENT,{argument:"topic",value:e})})).join("&")}function G(e){if("string"==typeof e){if(20===u.hexDataLength(e))return"address:"+a.getAddress(e);if(e=e.toLowerCase(),32===u.hexDataLength(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter::"+K(e);if(e&&"object"==typeof e)return"filter:"+(e.address||"")+":"+K(e.topics||[])}throw new Error("invalid event - "+e)}function V(){return(new Date).getTime()}function z(e){var t,r=U.call(this)||this;return b.checkNew(r,m.Provider),e instanceof Promise?(h.defineReadOnly(r,"ready",e.then((function(e){return h.defineReadOnly(r,"_network",e),e}))),r.ready.catch((function(e){}))):(t=l.getNetwork(null==e?"homestead":e))?(h.defineReadOnly(r,"_network",t),h.defineReadOnly(r,"ready",Promise.resolve(r._network))):b.throwError("invalid network",b.INVALID_ARGUMENT,{arg:"network",value:e}),r._lastBlockNumber=-2,r._balances={},r._events=[],r._pollingInterval=4e3,r._emitted={block:-2},r._fastQueryDate=0,r}i(z,U=m.Provider),z.prototype._doPoll=function(){var e=this;this.getBlockNumber().then((function(t){if(e.polling&&(e._setFastBlockNumber(t),t!==e._lastBlockNumber)){-2===e._emitted.block&&(e._emitted.block=t-1);for(var r=e._emitted.block+1;r<=t;r++)e.emit("block",r);e._emitted.block!==t&&(e._emitted.block=t,Object.keys(e._emitted).forEach((function(r){var n;"block"===r||"pending"!==(n=e._emitted[r])&&12<t-n&&delete e._emitted[r]}))),-2===e._lastBlockNumber&&(e._lastBlockNumber=t-1);var n={},i={};return e._events.forEach((function(e){i[e.tag]=!0})),Object.keys(i).forEach((function(r){var i=r.split(":");switch(i[0]){case"tx":var o=i[1];e.getTransactionReceipt(o).then((function(t){return t&&null!=t.blockNumber&&(e._emitted["t:"+o]=t.blockNumber,e.emit(o,t)),null})).catch((function(t){e.emit("error",t)}));break;case"address":var a=i[1];e._balances[a]&&(n[a]=e._balances[a]),e.getBalance(a,"latest").then((function(t){var r=e._balances[a];if(!r||!t.eq(r))return e._balances[a]=t,e.emit(a,t),null})).catch((function(t){e.emit("error",t)}));break;case"filter":var s=i[2].split(/&/g).map((function(e){var t=e.split(",");return 1===t.length?""===t[0]?null:e:t.map((function(e){return""===e?null:e}))})),u={address:i[1],fromBlock:e._lastBlockNumber+1,toBlock:t,topics:s};u.address||delete u.address,e.getLogs(u).then((function(t){if(0!==t.length)return t.forEach((function(t){e._emitted["b:"+t.blockHash]=t.blockNumber,e._emitted["t:"+t.transactionHash]=t.blockNumber,e.emit(u,t)})),null})).catch((function(t){e.emit("error",t)}))}})),e._lastBlockNumber=t,e._balances=n,null}})).catch((function(e){})),this.doPoll()},z.prototype.resetEventsBlock=function(e){this._lastBlockNumber=e-1,this.polling&&this._doPoll()},Object.defineProperty(z.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),z.prototype.getNetwork=function(){return this.ready},Object.defineProperty(z.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(z.prototype,"polling",{get:function(){return null!=this._poller},set:function(e){var t=this;setTimeout((function(){e&&!t._poller?(t._poller=setInterval(t._doPoll.bind(t),t.pollingInterval),t._doPoll()):!e&&t._poller&&(clearInterval(t._poller),t._poller=null)}),0)},enumerable:!0,configurable:!0}),Object.defineProperty(z.prototype,"pollingInterval",{get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t._doPoll()}),this._pollingInterval))},enumerable:!0,configurable:!0}),z.prototype._getFastBlockNumber=function(){var e=this,t=V();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise},z.prototype._setFastBlockNumber=function(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=V(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))},z.prototype.waitForTransaction=function(e,t){var r=this;return null==t&&(t=1),this.getTransactionReceipt(e).then((function(n){return 0===t||n&&n.confirmations>=t?n:new Promise((function(n){var i=function(o){o.confirmations<t||(r.removeListener(e,i),n(o))};r.on(e,i)}))}))},z.prototype.getBlockNumber=function(){var e=this;return this.ready.then((function(){return e.perform("getBlockNumber",{}).then((function(t){var r=parseInt(t);if(r!=t)throw new Error("invalid response - getBlockNumber");return e._setFastBlockNumber(r),r}))}))},z.prototype.getGasPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getGasPrice",{}).then((function(e){return s.bigNumberify(e)}))}))},z.prototype.getBalance=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,n=e.blockTag;return r._getAddress(t).then((function(e){return e={address:e,blockTag:T(n)},r.perform("getBalance",e).then((function(e){return s.bigNumberify(e)}))}))}))}))},z.prototype.getTransactionCount=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,n=e.blockTag;return r._getAddress(t).then((function(e){return e={address:e,blockTag:T(n)},r.perform("getTransactionCount",e).then((function(e){return s.bigNumberify(e).toNumber()}))}))}))}))},z.prototype.getCode=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,blockTag:t}).then((function(e){var t=e.addressOrName,n=e.blockTag;return r._getAddress(t).then((function(e){return e={address:e,blockTag:T(n)},r.perform("getCode",e).then((function(e){return u.hexlify(e)}))}))}))}))},z.prototype.getStorageAt=function(e,t,r){var n=this;return this.ready.then((function(){return h.resolveProperties({addressOrName:e,position:t,blockTag:r}).then((function(e){var t=e.addressOrName,r=e.position,i=e.blockTag;return n._getAddress(t).then((function(e){return e={address:e,blockTag:T(i),position:u.hexStripZeros(u.hexlify(r))},n.perform("getStorageAt",e).then((function(e){return u.hexlify(e)}))}))}))}))},z.prototype.sendTransaction=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties({signedTransaction:e}).then((function(e){var r=e.signedTransaction;return e={signedTransaction:u.hexlify(r)},t.perform("sendTransaction",e).then((function(e){return t._wrapTransaction(p.parse(r),e)}),(function(e){throw e.transaction=p.parse(r),e.transaction.hash&&(e.transactionHash=e.transaction.hash),e}))}))}))},z.prototype._wrapTransaction=function(e,t){var r=this;if(null!=t&&32!==u.hexDataLength(t))throw new Error("invalid response - sendTransaction");var n=e;return null!=t&&e.hash!==t&&b.throwError("Transaction hash mismatch from Provider.sendTransaction.",b.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=function(t){return 0!==t&&(r._emitted["t:"+e.hash]="pending"),r.waitForTransaction(e.hash,t).then((function(n){return null==n&&0===t?null:(r._emitted["t:"+e.hash]=n.blockNumber,0===n.status&&b.throwError("transaction failed",b.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e}),n)}))},n},z.prototype.call=function(e,t){var r=this,n=h.shallowCopy(e);return this.ready.then((function(){return h.resolveProperties({blockTag:t,tx:n}).then((function(e){var t=e.blockTag;return e=e.tx,r._resolveNames(e,["to","from"]).then((function(e){return e={blockTag:T(t),transaction:N(e)},r.perform("call",e).then((function(e){return u.hexlify(e)}))}))}))}))},z.prototype.estimateGas=function(e){var t=this,r={to:e.to,from:e.from,data:e.data,gasPrice:e.gasPrice,value:e.value};return this.ready.then((function(){return h.resolveProperties(r).then((function(e){return t._resolveNames(e,["to","from"]).then((function(e){return e={transaction:N(e)},t.perform("estimateGas",e).then((function(e){return s.bigNumberify(e)}))}))}))}))},z.prototype.getBlock=function(e,t){var r=this;return this.ready.then((function(){return h.resolveProperties({blockHashOrBlockTag:e}).then((function(e){e=e.blockHashOrBlockTag;try{var n=u.hexlify(e);if(32===u.hexDataLength(n))return g.poll((function(){return r.perform("getBlock",{blockHash:n,includeTransactions:!!t}).then((function(e){return null==e?null==r._emitted["b:"+n]?null:void 0:x(e,t)}))}),{onceBlock:r})}catch(e){}try{var i=-128,o=T(e);return u.isHexString(o)&&(i=parseInt(o.substring(2),16)),g.poll((function(){return r.perform("getBlock",{blockTag:o,includeTransactions:!!t}).then((function(e){return null==e?i<=r._emitted.block?void 0:null:x(e,t)}))}),{onceBlock:r})}catch(e){}throw new Error("invalid block hash or block tag")}))}))},z.prototype.getTransaction=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties({transactionHash:e}).then((function(e){var r=e.transactionHash,n={transactionHash:E(r,!0)};return g.poll((function(){return t.perform("getTransaction",n).then((function(e){if(null==e)return null==t._emitted["t:"+r]?null:void 0;var n=z.checkTransactionResponse(e);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations)return t._getFastBlockNumber().then((function(e){return e=e-n.blockNumber+1,n.confirmations=e=e<=0?1:e,t._wrapTransaction(n)}));return t._wrapTransaction(n)}))}),{onceBlock:t})}))}))},z.prototype.getTransactionReceipt=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties({transactionHash:e}).then((function(e){var r=e.transactionHash,n={transactionHash:E(r,!0)};return g.poll((function(){return t.perform("getTransactionReceipt",n).then((function(e){if(null==e)return null==t._emitted["t:"+r]?null:void 0;if(null!=e.blockHash){var n,i=((e=v(B,n=e)).logs.forEach((function(e,t){null==e.transactionLogIndex&&(e.transactionLogIndex=t)})),null!=n.status&&(e.byzantium=!0),e);if(null==i.blockNumber)i.confirmations=0;else if(null==i.confirmations)return t._getFastBlockNumber().then((function(e){return e=e-i.blockNumber+1,i.confirmations=e=e<=0?1:e,i}));return i}}))}),{onceBlock:t})}))}))},z.prototype.getLogs=function(e){var t=this;return this.ready.then((function(){return h.resolveProperties(e).then((function(e){return t._resolveNames(e,["address"]).then((function(e){return e={filter:e&&e.blockHash?v(j,e):v(D,e)},t.perform("getLogs",e).then((function(e){return _(F)(e)}))}))}))}))},z.prototype.getEtherPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getEtherPrice",{}).then((function(e){return e}))}))},z.prototype._getAddress=function(e){return this.resolveName(e).then((function(t){return null==t&&b.throwError("ENS name not configured",b.UNSUPPORTED_OPERATION,{operation:"resolveName("+JSON.stringify(e)+")"}),t}))},z.prototype._resolveNames=function(e,t){var r=[],n=h.shallowCopy(e);return t.forEach((function(e){null!=n[e]&&r.push(this._getAddress(n[e]).then((function(t){n[e]=t})))}),this),Promise.all(r).then((function(){return n}))},z.prototype._getResolver=function(e){var t=this;return this.getNetwork().then((function(r){r.ensAddress||b.throwError("network does not support ENS",b.UNSUPPORTED_OPERATION,{operation:"ENS",network:r.name});var n="0x0178b8bf"+c.namehash(e).substring(2);return n={to:r.ensAddress,data:n},t.call(n).then((function(e){return 32!==u.hexDataLength(e)||(e=a.getAddress(u.hexDataSlice(e,12)))===f.AddressZero?null:e}))}))},z.prototype.resolveName=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.resolveName(e)}));try{return Promise.resolve(a.getAddress(e))}catch(t){if(u.isHexString(e))throw t}var r=this,n=c.namehash(e);return this._getResolver(e).then((function(e){if(null==e)return null;var t="0x3b3b57de"+n.substring(2);return r.call({to:e,data:t})})).then((function(e){return 32!==u.hexDataLength(e)||(e=a.getAddress(u.hexDataSlice(e,12)))===f.AddressZero?null:e}))},z.prototype.lookupAddress=function(e){var t=this;if(e instanceof Promise)return e.then((function(e){return t.lookupAddress(e)}));var r=(e=a.getAddress(e)).substring(2)+".addr.reverse",n=c.namehash(r),i=this;return this._getResolver(r).then((function(e){if(!e)return null;var t="0x691f3431"+n.substring(2);return i.call({to:e,data:t})})).then((function(t){if(null==t)return null;if((t=t.substring(2)).length<64)return null;if((t=t.substring(64)).length<64)return null;var r=s.bigNumberify("0x"+t.substring(0,64)).toNumber();if(2*r>(t=t.substring(64)).length)return null;var n=y.toUtf8String("0x"+t.substring(0,2*r));return i.resolveName(n).then((function(t){return t!=e?null:n}))}))},z.checkTransactionResponse=P,z.prototype.doPoll=function(){},z.prototype.perform=function(e,t){return b.throwError(e+" not implemented",b.NOT_IMPLEMENTED,{operation:e}),null},z.prototype._startPending=function(){b.warn("WARNING: this provider does not support pending events")},z.prototype._stopPending=function(){},z.prototype._addEventListener=function(e,t,r){this._events.push({tag:G(e),listener:t,once:r}),"pending"===e&&this._startPending(),this.polling=!0},z.prototype.on=function(e,t){return this._addEventListener(e,t,!1),this},z.prototype.once=function(e,t){return this._addEventListener(e,t,!0),this},z.prototype.addEventListener=function(e,t){return this.on(e,t)},z.prototype.emit=function(e){for(var t=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=!1,o=G(e);return this._events=this._events.filter((function(e){return e.tag!==o||(setTimeout((function(){e.listener.apply(t,r)}),0),i=!0,!e.once)})),0===this.listenerCount()&&(this.polling=!1),i},z.prototype.listenerCount=function(e){if(!e)return this._events.length;var t=G(e);return this._events.filter((function(e){return e.tag===t})).length},z.prototype.listeners=function(e){var t=G(e);return this._events.filter((function(e){return e.tag===t})).map((function(e){return e.listener}))},z.prototype.removeAllListeners=function(e){var t;return null==e?(this._events=[],this._stopPending()):(t=G(e),this._events=this._events.filter((function(e){return e.tag!==t})),"pending"===e&&this._stopPending()),0===this._events.length&&(this.polling=!1),this},z.prototype.removeListener=function(e,t){var r=!1,n=G(e);return this._events=this._events.filter((function(e){return e.tag!==n||e.listener!=t||!!r||!(r=!0)})),"pending"===e&&0===this.listenerCount("pending")&&this._stopPending(),0===this.listenerCount()&&(this.polling=!1),this},i=z,r.BaseProvider=i,h.defineReadOnly(m.Provider,"inherits",h.inheritable(m.Provider))},{"../constants":3,"../errors":5,"../utils/address":60,"../utils/bignumber":63,"../utils/bytes":64,"../utils/hash":65,"../utils/networks":72,"../utils/properties":74,"../utils/rlp":76,"../utils/transaction":83,"../utils/utf8":85,"../utils/web":86,"./abstract-provider":50}],52:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./base-provider"),s=e("../utils/bytes"),u=e("../utils/properties"),f=e("../utils/web"),c=o(e("../errors"));function l(e){var t,r,n=[];for(t in e)null!=e[t]&&(r=s.hexlify(e[t]),{gasLimit:!0,gasPrice:!0,nonce:!0,value:!0}[t]&&(r=s.hexStripZeros(r)),n.push(t+"="+r));return n.join("&")}function h(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1==e.status&&"OK"==e.message)return e.result;var t=new Error("invalid response");throw t.result=JSON.stringify(e),t}function d(e){if("2.0"!=e.jsonrpc)throw(t=new Error("invalid response")).result=JSON.stringify(e),t;if(e.error){var t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function p(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}var y;function g(e,t){var r=y.call(this,e)||this;c.checkNew(r,g),e="invalid";var n=null;switch(e=r.network?r.network.name:e){case"homestead":n="https://api.etherscan.io";break;case"ropsten":n="https://api-ropsten.etherscan.io";break;case"rinkeby":n="https://api-rinkeby.etherscan.io";break;case"kovan":n="https://api-kovan.etherscan.io";break;case"goerli":n="https://api-goerli.etherscan.io";break;default:throw new Error("unsupported network")}return u.defineReadOnly(r,"baseUrl",n),u.defineReadOnly(r,"apiKey",t||"8FG3JMZ9USS4NTA6YKEKHINU56SEPPVBJR"),r}i(g,y=a.BaseProvider),g.prototype.perform=function(e,t){var r,n=this,i=this.baseUrl,o="";function a(e,t){return f.fetchJson(e,null,t||d).then((function(t){return n.emit("debug",{action:"perform",request:e,response:t,provider:n}),t}))}switch(this.apiKey&&(o+="&apikey="+this.apiKey),e){case"getBlockNumber":return a(i+="/api?module=proxy&action=eth_blockNumber"+o);case"getGasPrice":return a(i+="/api?module=proxy&action=eth_gasPrice"+o);case"getBalance":return i+="/api?module=account&action=balance&address="+t.address,a(i+="&tag="+t.blockTag+o,h);case"getTransactionCount":return i+="/api?module=proxy&action=eth_getTransactionCount&address="+t.address,a(i+="&tag="+t.blockTag+o);case"getCode":return i+="/api?module=proxy&action=eth_getCode&address="+t.address,a(i+="&tag="+t.blockTag+o,d);case"getStorageAt":return i+="/api?module=proxy&action=eth_getStorageAt&address="+t.address,i+="&position="+t.position,a(i+="&tag="+t.blockTag+o,d);case"sendTransaction":return i+="/api?module=proxy&action=eth_sendRawTransaction&hex="+t.signedTransaction,a(i+=o).catch((function(e){throw e.responseText&&(0<=e.responseText.toLowerCase().indexOf("insufficient funds")&&c.throwError("insufficient funds",c.INSUFFICIENT_FUNDS,{}),0<=e.responseText.indexOf("same hash was already imported")&&c.throwError("nonce has already been used",c.NONCE_EXPIRED,{}),0<=e.responseText.indexOf("another transaction with same nonce")&&c.throwError("replacement fee too low",c.REPLACEMENT_UNDERPRICED,{})),e}));case"getBlock":return t.blockTag?(i+="/api?module=proxy&action=eth_getBlockByNumber&tag="+t.blockTag,t.includeTransactions?i+="&boolean=true":i+="&boolean=false",a(i+=o)):Promise.reject(new Error("getBlock by blockHash not implemeneted"));case"getTransaction":return i+="/api?module=proxy&action=eth_getTransactionByHash&txhash="+t.transactionHash,a(i+=o);case"getTransactionReceipt":return i+="/api?module=proxy&action=eth_getTransactionReceipt&txhash="+t.transactionHash,a(i+=o);case"call":return i+="/api?module=proxy&action=eth_call"+(r=(r=l(t.transaction))&&"&"+r),"latest"!==t.blockTag?Promise.reject(new Error("EtherscanProvider does not support blockTag for call")):a(i+=o);case"estimateGas":return i+="/api?module=proxy&action=eth_estimateGas&"+(r=(r=l(t.transaction))&&"&"+r),a(i+=o);case"getLogs":i+="/api?module=logs&action=getLogs";try{if(t.filter.fromBlock&&(i+="&fromBlock="+p(t.filter.fromBlock)),t.filter.toBlock&&(i+="&toBlock="+p(t.filter.toBlock)),t.filter.blockHash)try{c.throwError("Etherscan does not support blockHash filters",c.UNSUPPORTED_OPERATION,{operation:"getLogs(blockHash)"})}catch(e){return Promise.reject(e)}if(t.filter.address&&(i+="&address="+t.filter.address),t.filter.topics&&0<t.filter.topics.length){if(1<t.filter.topics.length)throw new Error("unsupported topic format");var s=t.filter.topics[0];if("string"!=typeof s||66!==s.length)throw new Error("unsupported topic0 format");i+="&topic0="+s}}catch(e){return Promise.reject(e)}var u=this;return a(i+=o,h).then((function(e){var t={},r=Promise.resolve();return e.forEach((function(e){r=r.then((function(){return null!=e.blockHash?null:(e.blockHash=t[e.transactionHash],null==e.blockHash?u.getTransaction(e.transactionHash).then((function(r){return t[e.transactionHash]=r.blockHash,e.blockHash=r.blockHash,null})):null)}))})),r.then((function(){return e}))}));case"getEtherPrice":return"homestead"!==this.network.name?Promise.resolve(0):(i+="/api?module=stats&action=ethprice",a(i+=o,h).then((function(e){return parseFloat(e.ethusd)})))}return y.prototype.perform.call(this,e,t)},g.prototype.getHistory=function(e,t,r){var n=this,i=this.baseUrl,o="";return this.apiKey&&(o+="&apikey="+this.apiKey),null==t&&(t=0),null==r&&(r=99999999),this.resolveName(e).then((function(e){return i+="/api?module=account&action=txlist&address="+e,i+="&startblock="+t,i+="&endblock="+r,i+="&sort=asc"+o,f.fetchJson(i,null,h).then((function(e){n.emit("debug",{action:"getHistory",request:i,response:e,provider:n});var t=[];return e.forEach((function(e){["contractAddress","to"].forEach((function(t){""==e[t]&&delete e[t]})),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);var r=a.BaseProvider.checkTransactionResponse(e);e.timeStamp&&(r.timestamp=parseInt(e.timeStamp)),t.push(r)})),t}))}))},i=g,r.EtherscanProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/properties":74,"../utils/web":86,"./base-provider":51}],53:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./base-provider"),u=o(e("../errors"));function f(e){var t=!0,r=null;return e.forEach((function(n){null!=n?null!=r?r.name===n.name&&r.chainId===n.chainId&&(r.ensAddress===n.ensAddress||null==r.ensAddress&&null==n.ensAddress)||u.throwError("provider mismatch",u.INVALID_ARGUMENT,{arg:"networks",value:e}):r=n:t=!1})),t}function c(e){var t,r=this;if(0===e.length)throw new Error("no providers");return r=f(e.map((function(e){return e.network})))?a.call(this,e[0].network)||this:(t=Promise.all(e.map((function(e){return e.getNetwork()}))).then((function(e){return f(e)||u.throwError("getNetwork returned null",u.UNKNOWN_ERROR,{}),e[0]})),a.call(this,t)||this),u.checkNew(r,c),r._providers=e.slice(0),r}i(c,a=s.BaseProvider),Object.defineProperty(c.prototype,"providers",{get:function(){return this._providers.slice(0)},enumerable:!0,configurable:!0}),c.prototype.perform=function(e,t){var r=this.providers;return new Promise((function(n,i){var o=null;!function a(){r.length?r.shift().perform(e,t).then((function(e){return n(e)})).catch((function(e){o=o||e,setTimeout(a,0)})):i(o)}()}))},i=c,r.FallbackProvider=i},{"../errors":5,"./base-provider":51}],54:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./abstract-provider");r.Provider=n.Provider,n=e("./base-provider"),r.BaseProvider=n.BaseProvider,n=e("./etherscan-provider"),r.EtherscanProvider=n.EtherscanProvider,n=e("./fallback-provider"),r.FallbackProvider=n.FallbackProvider,n=e("./ipc-provider"),r.IpcProvider=n.IpcProvider,n=e("./infura-provider"),r.InfuraProvider=n.InfuraProvider,n=e("./json-rpc-provider"),r.JsonRpcProvider=n.JsonRpcProvider,r.JsonRpcSigner=n.JsonRpcSigner,e=e("./web3-provider"),r.Web3Provider=e.Web3Provider},{"./abstract-provider":50,"./base-provider":51,"./etherscan-provider":52,"./fallback-provider":53,"./infura-provider":55,"./ipc-provider":56,"./json-rpc-provider":57,"./web3-provider":58}],55:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./json-rpc-provider"),u=e("../utils/bytes"),f=e("../utils/networks"),c=e("../utils/properties"),l=o(e("../errors"));function h(e,t){var r=this,n=f.getNetwork(null==e?"homestead":e);null==t&&(t="7d0d81d0919f4f05b9ab6634be01ee73");var i=null;switch(n.name){case"homestead":i="mainnet.infura.io";break;case"ropsten":i="ropsten.infura.io";break;case"rinkeby":i="rinkeby.infura.io";break;case"goerli":i="goerli.infura.io";break;case"kovan":i="kovan.infura.io";break;default:l.throwError("unsupported network",l.INVALID_ARGUMENT,{argument:"network",value:e})}return u.isHexString("0x"+t,16)?(r=a.call(this,"https://"+i+"/v3/"+t,n)||this,c.defineReadOnly(r,"apiAccessToken",null),c.defineReadOnly(r,"projectId",t)):(l.warn("The legacy INFURA apiAccesToken API is deprecated; please upgrade to a Project ID instead (see INFURA dshboard; https://infura.io)"),r=a.call(this,"https://"+i+"/"+t,n)||this,c.defineReadOnly(r,"apiAccessToken",t),c.defineReadOnly(r,"projectId",null)),l.checkNew(r,h),r}i(h,a=s.JsonRpcProvider),h.prototype._startPending=function(){l.warn("WARNING: INFURA does not support pending filters")},h.prototype.getSigner=function(e){return l.throwError("INFURA does not support signing",l.UNSUPPORTED_OPERATION,{operation:"getSigner"})},h.prototype.listAccounts=function(){return Promise.resolve([])},i=h,r.InfuraProvider=i},{"../errors":5,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"./json-rpc-provider":57}],56:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0})},{}],57:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("./base-provider"),s=e("../abstract-signer"),u=o(e("../errors")),f=e("../utils/address"),c=e("../utils/bytes"),l=e("../utils/networks"),h=e("../utils/properties"),d=e("../utils/utf8"),p=e("../utils/web");function y(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function g(e){return e&&e.toLowerCase()}var b,m={},v=42,w=(i(_,b=s.Signer),_.prototype.getAddress=function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&u.throwError("unknown account #"+e._index,u.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e._address=f.getAddress(t[e._index]),e._address}))},_.prototype.getBalance=function(e){return this.provider.getBalance(this.getAddress(),e)},_.prototype.getTransactionCount=function(e){return this.provider.getTransactionCount(this.getAddress(),e)},_.prototype.sendUncheckedTransaction=function(e){var t=this;e=h.shallowCopy(e);var r,n=this.getAddress().then((function(e){return e&&e.toLowerCase()}));return null==e.gasLimit&&((r=h.shallowCopy(e)).from=n,e.gasLimit=this.provider.estimateGas(r)),Promise.all([h.resolveProperties(e),n]).then((function(e){var r=e[0],n=k.hexlifyTransaction(r);return n.from=e[1],t.provider.send("eth_sendTransaction",[n]).then((function(e){return e}),(function(e){throw e.responseText&&(0<=e.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{transaction:r}),0<=e.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{transaction:r}),0<=e.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{transaction:r})),e}))}))},_.prototype.sendTransaction=function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return p.poll((function(){return t.provider.getTransaction(e).then((function(r){if(null!==r)return t.provider._wrapTransaction(r,e)}))}),{fastRetry:250,onceBlock:t.provider}).catch((function(t){throw t.transactionHash=e,t}))}))},_.prototype.signMessage=function(e){var t=this,r="string"==typeof e?d.toUtf8Bytes(e):e;return this.getAddress().then((function(e){return t.provider.send("eth_sign",[e.toLowerCase(),c.hexlify(r)])}))},_.prototype.unlock=function(e){var t=this.provider;return this.getAddress().then((function(r){return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))},_);function _(e,t,r){var n=b.call(this)||this;if(u.checkNew(n,_),e!==m)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return h.defineReadOnly(n,"provider",t),r?"string"==typeof r?h.defineReadOnly(n,"_address",f.getAddress(r)):"number"==typeof r?h.defineReadOnly(n,"_index",r):u.throwError("invalid address or index",u.INVALID_ARGUMENT,{argument:"addressOrIndex",value:r}):h.defineReadOnly(n,"_index",0),n}r.JsonRpcSigner=w;var E,S={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0},k=(i(T,E=a.BaseProvider),T.prototype.getSigner=function(e){return new w(m,this,e)},T.prototype.listAccounts=function(){return this.send("eth_accounts",[]).then((function(e){return e.map((function(e){return f.getAddress(e)}))}))},T.prototype.send=function(e,t){var r=this,n={method:e,params:t,id:v++,jsonrpc:"2.0"};return p.fetchJson(this.connection,JSON.stringify(n),y).then((function(e){return r.emit("debug",{action:"send",request:n,response:e,provider:r}),e}))},T.prototype.perform=function(e,t){switch(e){case"getBlockNumber":return this.send("eth_blockNumber",[]);case"getGasPrice":return this.send("eth_gasPrice",[]);case"getBalance":return this.send("eth_getBalance",[g(t.address),t.blockTag]);case"getTransactionCount":return this.send("eth_getTransactionCount",[g(t.address),t.blockTag]);case"getCode":return this.send("eth_getCode",[g(t.address),t.blockTag]);case"getStorageAt":return this.send("eth_getStorageAt",[g(t.address),t.position,t.blockTag]);case"sendTransaction":return this.send("eth_sendRawTransaction",[t.signedTransaction]).catch((function(e){throw e.responseText&&(0<e.responseText.indexOf("insufficient funds")&&u.throwError("insufficient funds",u.INSUFFICIENT_FUNDS,{}),0<e.responseText.indexOf("nonce too low")&&u.throwError("nonce has already been used",u.NONCE_EXPIRED,{}),0<e.responseText.indexOf("replacement transaction underpriced")&&u.throwError("replacement fee too low",u.REPLACEMENT_UNDERPRICED,{})),e}));case"getBlock":return t.blockTag?this.send("eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]):t.blockHash?this.send("eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]):Promise.reject(new Error("invalid block tag or block hash"));case"getTransaction":return this.send("eth_getTransactionByHash",[t.transactionHash]);case"getTransactionReceipt":return this.send("eth_getTransactionReceipt",[t.transactionHash]);case"call":return this.send("eth_call",[T.hexlifyTransaction(t.transaction,{from:!0}),t.blockTag]);case"estimateGas":return this.send("eth_estimateGas",[T.hexlifyTransaction(t.transaction,{from:!0})]);case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=g(t.filter.address)),this.send("eth_getLogs",[t.filter])}return u.throwError(e+" not implemented",u.NOT_IMPLEMENTED,{operation:e}),null},T.prototype._startPending=function(){var e,t;null==this._pendingFilter&&(t=(e=this).send("eth_newPendingTransactionFilter",[]),(this._pendingFilter=t).then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;var n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return 1e3,new Promise((function(e){setTimeout((function(){e()}),1e3)}))}))})).then((function(){return e._pendingFilter==t?(setTimeout((function(){n()}),0),null):void e.send("eth_uninstallFilter",[r])})).catch((function(e){}))}(),r})).catch((function(e){})))},T.prototype._stopPending=function(){this._pendingFilter=null},T.hexlifyTransaction=function(e,t){var r=h.shallowCopy(S);if(t)for(var n in t)t[n]&&(r[n]=!0);h.checkProperties(e,r);var i={};return["gasLimit","gasPrice","nonce","value"].forEach((function(t){var r;null!=e[t]&&(r=c.hexStripZeros(c.hexlify(e[t])),i[t="gasLimit"===t?"gas":t]=r)})),["from","to","data"].forEach((function(t){null!=e[t]&&(i[t]=c.hexlify(e[t]))})),i},T);function T(e,t){var r=this;return"string"==typeof e&&null===t&&l.getNetwork(e)&&(t=e,e=null),t||(t=new Promise((function(e,t){setTimeout((function(){r.send("net_version",[]).then((function(t){return e(l.getNetwork(parseInt(t)))})).catch((function(e){t(e)}))}))}))),r=E.call(this,t)||this,u.checkNew(r,T),r.connection="string"==typeof(e=e||"http://localhost:8545")?{url:e}:e,r}r.JsonRpcProvider=k},{"../abstract-signer":2,"../errors":5,"../utils/address":60,"../utils/bytes":64,"../utils/networks":72,"../utils/properties":74,"../utils/utf8":85,"../utils/web":86,"./base-provider":51}],58:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./json-rpc-provider"),u=e("../utils/properties"),f=o(e("../errors")),c=42;function l(e,t){return t=a.call(this,e.host||e.path||"",t)||this,f.checkNew(t,l),e&&(e.sendAsync?t._sendAsync=e.sendAsync.bind(e):e.send&&(t._sendAsync=e.send.bind(e))),e&&t._sendAsync||f.throwError("invalid web3Provider",f.INVALID_ARGUMENT,{arg:"web3Provider",value:e}),u.defineReadOnly(t,"_web3Provider",e),u.defineReadOnly(t,"provider",e),t}i(l,a=s.JsonRpcProvider),l.prototype.send=function(e,t){var r=this;return"eth_sign"==e&&this._web3Provider.isMetaMask&&(e="personal_sign",t=[t[1],t[0]]),new Promise((function(n,i){var o={method:e,params:t,id:c++,jsonrpc:"2.0"};r._sendAsync(o,(function(e,t){if(e)i(e);else{if(t.error)return(e=new Error(t.error.message)).code=t.error.code,e.data=t.error.data,void i(e);n(t.result)}}))}))},i=l,r.Web3Provider=i},{"../errors":5,"../utils/properties":74,"./json-rpc-provider":57}],59:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a=e("../constants"),s=o(e("../errors")),u=e("./address"),f=e("./bignumber"),c=e("./bytes"),l=e("./utf8"),h=e("./properties"),d=new RegExp(/^bytes([0-9]*)$/),p=new RegExp(/^(u?int)([0-9]*)$/),y=new RegExp(/^(.*)\[([0-9]*)\]$/);r.defaultCoerceFunc=function(e,t){return(e=e.match(p))&&parseInt(e[2])<=48?t.toNumber():t};var g=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),b=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function m(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}function v(e,t){var r=e;function n(e){throw new Error('unexpected character "'+r[e]+'" at position '+e+' in "'+r+'"')}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,a=0;a<e.length;a++){var s=e[a];switch(s){case"(":o.state.allowParams||n(a),o.state.allowType=!1,o.type=m(o.type),o.components=[{type:"",name:"",parent:o,state:{allowType:!0}}],o=o.components[0];break;case")":delete o.state,t&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=m(o.type);var u=o;(o=o.parent)||n(a),delete u.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,t&&"indexed"===o.name&&(o.indexed=!0,o.name=""),o.type=m(o.type),u={type:"",name:"",parent:o.parent,state:{allowType:!0}},o.parent.components.push(u),delete o.parent,o=u;break;case" ":o.state.allowType&&""!==o.type&&(o.type=m(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&""!==o.name&&(t&&"indexed"===o.name?(o.indexed=!0,o.name=""):o.state.allowName=!1);break;case"[":o.state.allowArray||n(a),o.type+=s,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||n(a),o.type+=s,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=s,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=s,delete o.state.allowArray):o.state.readArray?o.type+=s:n(a)}}if(o.parent)throw new Error("unexpected eof");return delete i.state,t&&"indexed"===o.name&&(o.indexed=!0,o.name=""),i.type=m(i.type),i}function w(e){return ie(r.defaultCoerceFunc,e).type}function _(e,t,r,n,i){this.coerceFunc=e,this.name=t,this.type=r,this.localName=n,this.dynamic=i}r.parseParamType=function(e){return v(e,!0)},r.formatParamType=w,r.formatSignature=function(e){return e.name+"("+e.inputs.map(w).join(",")+")"},r.parseSignature=function(e){if("string"==typeof e)return"event "===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).substring(0,6)?function(e){var t={anonymous:!1,inputs:[],name:"",type:"event"},r=e.match(g);if(!r)throw new Error("invalid event: "+e);if(t.name=r[1].trim(),re(r[2]).forEach((function(e){(e=v(e,!0)).indexed=!!e.indexed,t.inputs.push(e)})),r[3].split(" ").forEach((function(e){switch(e){case"anonymous":t.anonymous=!0;break;case"":break;default:s.info("unknown modifier: "+e)}})),t.name&&!t.name.match(b))throw new Error('invalid identifier: "'+t.name+'"');return t}(e.substring(6).trim()):function(e){var t={constant:!1,gas:null,inputs:[],name:"",outputs:[],payable:!1,stateMutability:null,type:"function"},r=e.split("@");if(1!==r.length){if(2<r.length)throw new Error("invalid signature");if(!r[1].match(/^[0-9]+$/))throw new Error("invalid signature gas");t.gas=f.bigNumberify(r[1]),e=r[0]}if(!(e=(r=e.split(" returns "))[0].match(g)))throw new Error("invalid signature");if(t.name=e[1].trim(),!t.name.match(b))throw new Error('invalid identifier: "'+e[1]+'"');if(re(e[2]).forEach((function(e){t.inputs.push(v(e))})),e[3].split(" ").forEach((function(e){switch(e){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:s.info("unknown modifier: "+e)}})),1<r.length){if(""!=(r=r[1].match(g))[1].trim()||""!=r[3].trim())throw new Error("unexpected tokens");re(r[2]).forEach((function(e){t.outputs.push(v(e))}))}if("constructor"===t.name){if(t.type="constructor",t.outputs.length)throw new Error("constructor may not have outputs");delete t.name,delete t.outputs}return t}((e="function "===e.substring(0,9)?e.substring(9):e).trim());throw new Error("unknown signature")};var E,S=(i(k,E=_),k.prototype.encode=function(e){return this.coder.encode(e)},k.prototype.decode=function(e,t){return this.coder.decode(e,t)},k);function k(e){var t=E.call(this,e.coerceFunc,e.name,e.type,void 0,e.dynamic)||this;return h.defineReadOnly(t,"coder",e),t}var T,A=(i(P,T=_),P.prototype.encode=function(e){return c.arrayify([])},P.prototype.decode=function(e,t){if(t>e.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},P);function P(e,t){return T.call(this,e,"null","",t,!1)||this}var I,O=(i(x,I=_),x.prototype.encode=function(e){try{var t=f.bigNumberify(e);if(this.signed){var r=a.MaxUint256.maskn(8*this.size-1);if(t.gt(r))throw new Error("out-of-bounds");if(r=r.add(a.One).mul(a.NegativeOne),t.lt(r))throw new Error("out-of-bounds")}else if(t.lt(a.Zero)||t.gt(a.MaxUint256.maskn(8*this.size)))throw new Error("out-of-bounds");return t=t.toTwos(8*this.size).maskn(8*this.size),this.signed&&(t=t.fromTwos(8*this.size).toTwos(256)),c.padZeros(c.arrayify(t),32)}catch(t){s.throwError("invalid number value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:e})}return null},x.prototype.decode=function(e,t){e.length<t+32&&s.throwError("insufficient data for "+this.name+" type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:c.hexlify(e.slice(t,t+32))});var r=32-this.size;return t=f.bigNumberify(e.slice(t+r,t+32)),t=this.signed?t.fromTwos(8*this.size):t.maskn(8*this.size),{consumed:32,value:this.coerceFunc(this.name,t)}},x);function x(e,t,r,n){var i=this,o=(r?"int":"uint")+8*t;return(i=I.call(this,e,o,o,n,!1)||this).size=t,i.signed=r,i}var M,N=new O((function(e,t){return t}),32,!1,"none"),R=(i(B,M=_),B.prototype.encode=function(e){return N.encode(e?1:0)},B.prototype.decode=function(e,t){try{var r=N.decode(e,t)}catch(e){throw"insufficient data for uint256 type"===e.reason&&s.throwError("insufficient data for boolean type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"boolean",value:e.value}),e}return{consumed:r.consumed,value:this.coerceFunc("bool",!r.value.isZero())}},B);function B(e,t){return M.call(this,e,"bool","bool",t,!1)||this}var C,L=(i(U,C=_),U.prototype.encode=function(e){var t=new Uint8Array(32);try{var r=c.arrayify(e);if(r.length!==this.length)throw new Error("incorrect data length");t.set(r)}catch(t){s.throwError("invalid "+this.name+" value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:t.value||e})}return t},U.prototype.decode=function(e,t){return e.length<t+32&&s.throwError("insufficient data for "+this.name+" type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:this.name,value:c.hexlify(e.slice(t,t+32))}),{consumed:32,value:this.coerceFunc(this.name,c.hexlify(e.slice(t,t+this.length)))}},U);function U(e,t,r){var n=this,i="bytes"+t;return(n=C.call(this,e,i,i,r,!1)||this).length=t,n}var D,j,H,F=(i(K,D=_),K.prototype.encode=function(e){var t=new Uint8Array(32);try{t.set(c.arrayify(u.getAddress(e)),12)}catch(t){s.throwError("invalid address",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:e})}return t},K.prototype.decode=function(e,t){return e.length<t+32&&s.throwError("insufficient data for address type",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"address",value:c.hexlify(e.slice(t,t+32))}),{consumed:32,value:this.coerceFunc("address",u.getAddress(c.hexlify(e.slice(t+12,t+32))))}},K);function K(e,t){return D.call(this,e,"address","address",t,!1)||this}function G(e){var t=32*Math.ceil(e.length/32);return t=new Uint8Array(t-e.length),c.concat([N.encode(e.length),e,t])}function V(e,t,r){e.length<t+32&&s.throwError("insufficient data for dynamicBytes length",s.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:c.hexlify(e.slice(t,t+32))});var n=N.decode(e,t).value;try{n=n.toNumber()}catch(e){s.throwError("dynamic bytes count too large",s.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:n.toString()})}return e.length<t+32+n&&s.throwError("insufficient data for dynamicBytes type",s.INVALID_ARGUMENT,{arg:r,coderType:"dynamicBytes",value:c.hexlify(e.slice(t,t+32+n))}),{consumed:32+32*Math.ceil(n/32),value:e.slice(t+32,t+32+n)}}function z(e,t){return j.call(this,e,"bytes","bytes",t,!0)||this}function W(e,t){return H.call(this,e,"string","string",t,!0)||this}function q(e){return 32*Math.ceil(e/32)}function X(e,t){var r;Array.isArray(t)||(t&&"object"==typeof t?(r=[],e.forEach((function(e){r.push(t[e.localName])})),t=r):s.throwError("invalid tuple value",s.INVALID_ARGUMENT,{coderType:"tuple",value:t})),e.length!==t.length&&s.throwError("types/value length mismatch",s.INVALID_ARGUMENT,{coderType:"tuple",value:t});var n=[];e.forEach((function(e,r){n.push({dynamic:e.dynamic,value:e.encode(t[r])})}));var i=0,o=0;n.forEach((function(e){e.dynamic?(i+=32,o+=q(e.value.length)):i+=q(e.value.length)}));var a=0,u=i,f=new Uint8Array(i+o);return n.forEach((function(e){e.dynamic?(f.set(N.encode(u),a),a+=32,f.set(e.value,u),u+=q(e.value.length)):(f.set(e.value,a),a+=q(e.value.length))})),f}function $(e,t,r){var n=r,i=0,o=[];return e.forEach((function(e){var a,s;e.dynamic?(a=N.decode(t,r),(s=e.decode(t,n+a.value.toNumber())).consumed=a.consumed):s=e.decode(t,r),null!=s.value&&o.push(s.value),r+=s.consumed,i+=s.consumed})),e.forEach((function(e,t){(e=e.localName)&&null==o[e="length"===e?"_length":e]&&(o[e]=o[t])})),{value:o,consumed:i}}i(z,j=_),z.prototype.encode=function(e){try{return G(c.arrayify(e))}catch(e){s.throwError("invalid bytes value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"bytes",value:e.value})}return null},z.prototype.decode=function(e,t){return(t=V(e,t,this.localName)).value=this.coerceFunc("bytes",c.hexlify(t.value)),t},o=z,i(W,H=_),W.prototype.encode=function(e){return"string"!=typeof e&&s.throwError("invalid string value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"string",value:e}),G(l.toUtf8Bytes(e))},W.prototype.decode=function(e,t){return(t=V(e,t,this.localName)).value=this.coerceFunc("string",l.toUtf8String(t.value)),t},e=W;var Z,Y=(i(J,Z=_),J.prototype.encode=function(e){Array.isArray(e)||s.throwError("expected array value",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:e});var t=this.length,r=new Uint8Array(0);-1===t&&(t=e.length,r=N.encode(t)),s.checkArgumentCount(t,e.length," in coder array"+(this.localName?" "+this.localName:""));for(var n=[],i=0;i<e.length;i++)n.push(this.coder);return c.concat([r,X(n,e)])},J.prototype.decode=function(e,t){var r=0,n=this.length;if(-1===n){try{var i=N.decode(e,t)}catch(e){s.throwError("insufficient data for dynamic array length",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:e.value})}try{n=i.value.toNumber()}catch(e){s.throwError("array count too large",s.INVALID_ARGUMENT,{arg:this.localName,coderType:"array",value:i.value.toString()})}r+=i.consumed,t+=i.consumed}for(var o=[],a=0;a<n;a++)o.push(new S(this.coder));return(t=$(o,e,t)).consumed+=r,t.value=this.coerceFunc(this.type,t.value),t},J);function J(e,t,r,n){var i=this,o=t.type+"["+(0<=r?r:"")+"]",a=-1===r||t.dynamic;return(i=Z.call(this,e,"array",o,n,a)||this).coder=t,i.length=r,i}var Q,ee=(i(te,Q=_),te.prototype.encode=function(e){return X(this.coders,e)},te.prototype.decode=function(e,t){return(t=$(this.coders,e,t)).value=this.coerceFunc(this.type,t.value),t},te);function te(e,t,r){var n=this,i=!1,o=[];t.forEach((function(e){e.dynamic&&(i=!0),o.push(e.type)}));var a="tuple("+o.join(",")+")";return(n=Q.call(this,e,"tuple",a,r,i)||this).coders=t,n}function re(e){e=e.trim();for(var t=[],r="",n=0,i=0;i<e.length;i++){var o=e[i];if(","===o&&0===n)t.push(r),r="";else if(r+=o,"("===o)n++;else if(")"===o&&-1==--n)throw new Error("unbalanced parenthsis")}return r&&t.push(r),t}var ne={address:F,bool:R,string:e,bytes:o};function ie(e,t){var r,n,i;if(i=ne[t.type])return new i(e,t.name);if(i=t.type.match(p))return(0===(o=parseInt(i[2]||"256"))||256<o||o%8!=0)&&s.throwError("invalid "+i[1]+" bit length",s.INVALID_ARGUMENT,{arg:"param",value:t}),new O(e,o/8,"int"===i[1],t.name);if(i=t.type.match(d))return(0===(o=parseInt(i[1]))||32<o)&&s.throwError("invalid bytes length",s.INVALID_ARGUMENT,{arg:"param",value:t}),new L(e,o,t.name);if(i=t.type.match(y)){var o=parseInt(i[2]||"-1");return(t=h.shallowCopy(t)).type=i[1],t=h.deepCopy(t),new Y(e,ie(e,t),o,t.name)}return"tuple"===t.type.substring(0,5)?(r=e,i=t.components,o=t.name,n=[],(i=i||[]).forEach((function(e){n.push(ie(r,e))})),new ee(r,n,o)):""===t.type?new A(e,t.name):(s.throwError("invalid type",s.INVALID_ARGUMENT,{arg:"type",value:t.type}),null)}function oe(e){s.checkNew(this,oe),e=e||r.defaultCoerceFunc,h.defineReadOnly(this,"coerceFunc",e)}oe.prototype.encode=function(e,t){e.length!==t.length&&s.throwError("types/values length mismatch",s.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var r=[];return e.forEach((function(e){var t;t="string"==typeof e?v(e):e,r.push(ie(this.coerceFunc,t))}),this),c.hexlify(new ee(this.coerceFunc,r,"_").encode(t))},oe.prototype.decode=function(e,t){var r=[];return e.forEach((function(e){var t;t="string"==typeof e?v(e):h.deepCopy(e),r.push(ie(this.coerceFunc,t))}),this),new ee(this.coerceFunc,r,"_").decode(c.arrayify(t),0).value},o=oe,r.AbiCoder=o,r.defaultAbiCoder=new o},{"../constants":3,"../errors":5,"./address":60,"./bignumber":63,"./bytes":64,"./properties":74,"./utf8":85}],60:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("bn.js")),o=e("./bytes"),a=e("./keccak256"),s=e("./rlp"),u=e("../errors");function f(e){"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]{40}$/)||u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e});for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),n=0;n<40;n++)r[n]=t[n].charCodeAt(0);r=o.arrayify(a.keccak256(r));for(var i=0;i<40;i+=2)8<=r[i>>1]>>4&&(t[i]=t[i].toUpperCase()),8<=(15&r[i>>1])&&(t[i+1]=t[i+1].toUpperCase());return"0x"+t.join("")}for(var c={},l=0;l<10;l++)c[String(l)]=String(l);for(l=0;l<26;l++)c[String.fromCharCode(65+l)]=String(10+l);var h,d=Math.floor((h=9007199254740991,Math.log10?Math.log10(h):Math.log(h)/Math.LN10));function p(e){e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00";var t="";for(e.split("").forEach((function(e){t+=c[e]}));t.length>=d;){var r=t.substring(0,d);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function y(e){var t=null;if("string"!=typeof e&&u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))t=f(e="0x"!==e.substring(0,2)?"0x"+e:e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&u.throwError("bad address checksum",u.INVALID_ARGUMENT,{arg:"address",value:e});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==p(e)&&u.throwError("bad icap checksum",u.INVALID_ARGUMENT,{arg:"address",value:e}),t=new i.default.BN(e.substring(4),36).toString(16);t.length<40;)t="0"+t;t=f("0x"+t)}else u.throwError("invalid address",u.INVALID_ARGUMENT,{arg:"address",value:e});return t}r.getAddress=y,r.getIcapAddress=function(e){for(var t=new i.default.BN(y(e).substring(2),16).toString(36).toUpperCase();t.length<30;)t="0"+t;return"XE"+p("XE00"+t)+t},r.getContractAddress=function(e){if(!e.from)throw new Error("missing from address");var t=e.nonce;return y("0x"+a.keccak256(s.encode([y(e.from),o.stripZeros(o.hexlify(t))])).substring(26))},r.getCreate2Address=function(e){var t=e.initCodeHash;e.initCode&&(t?a.keccak256(e.initCode)!==t&&u.throwError("initCode/initCodeHash mismatch",u.INVALID_ARGUMENT,{arg:"options",value:e}):t=a.keccak256(e.initCode)),t||u.throwError("missing initCode or initCodeHash",u.INVALID_ARGUMENT,{arg:"options",value:e});var r=y(e.from),n=o.arrayify(e.salt);return 32!==n.length&&u.throwError("invalid salt",u.INVALID_ARGUMENT,{arg:"options",value:e}),y("0x"+a.keccak256(o.concat(["0xff",r,n,t])).substring(26))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./rlp":76,"bn.js":9}],61:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../utils/bytes");t.exports={decode:function(e){e=atob(e);for(var t=[],r=0;r<e.length;r++)t.push(e.charCodeAt(r));return n.arrayify(t)},encode:function(e){e=n.arrayify(e);for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}}},{"../utils/bytes":64}],62:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bytes"),i=e("./properties"),o=(a.prototype.encode=function(e){var t=n.arrayify(e);if(0===t.length)return"";for(var r=[0],i=0;i<t.length;++i){for(var o=t[i],a=0;a<r.length;++a)o+=r[a]<<8,r[a]=o%this.base,o=o/this.base|0;for(;0<o;)r.push(o%this.base),o=o/this.base|0}for(var s="",u=0;0===t[u]&&u<t.length-1;++u)s+=this._leader;for(var f=r.length-1;0<=f;--f)s+=this.alphabet[r[f]];return s},a.prototype.decode=function(e){if("string"!=typeof e)throw new TypeError("Expected String");var t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(var r=0;r<e.length;r++){var i=this._alphabetMap[e[r]];if(void 0===i)throw new Error("Non-base"+this.base+" character");for(var o=i,a=0;a<t.length;++a)o+=t[a]*this.base,t[a]=255&o,o>>=8;for(;0<o;)t.push(255&o),o>>=8}for(var s=0;e[s]===this._leader&&s<e.length-1;++s)t.push(0);return n.arrayify(new Uint8Array(t.reverse()))},a);function a(e){i.defineReadOnly(this,"alphabet",e),i.defineReadOnly(this,"base",e.length),i.defineReadOnly(this,"_alphabetMap",{}),i.defineReadOnly(this,"_leader",e.charAt(0));for(var t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}e=new(r.BaseX=o)("abcdefghijklmnopqrstuvwxyz234567"),r.Base32=e,o=new o("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),r.Base58=o},{"./bytes":64,"./properties":74}],63:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var o=n(e("bn.js")),a=e("./bytes"),s=e("./properties"),u=i(e("../errors")),f=new o.default.BN(-1);function c(e){return"-"===(e=e.toString(16))[0]?e.length%2==0?"-0x0"+e.substring(1):"-0x"+e.substring(1):e.length%2==1?"0x0"+e:"0x"+e}function l(e){return d(g(e))}function h(e){return new p(c(e))}function d(e){return"-"===(e=e._hex)[0]?new o.default.BN(e.substring(3),16).mul(f):new o.default.BN(e.substring(2),16)}var p=(y.prototype.fromTwos=function(e){return h(d(this).fromTwos(e))},y.prototype.toTwos=function(e){return h(d(this).toTwos(e))},y.prototype.abs=function(){return"-"===this._hex[0]?h(d(this).mul(f)):this},y.prototype.add=function(e){return h(d(this).add(l(e)))},y.prototype.sub=function(e){return h(d(this).sub(l(e)))},y.prototype.div=function(e){return g(e).isZero()&&u.throwError("division by zero",u.NUMERIC_FAULT,{operation:"divide",fault:"division by zero"}),h(d(this).div(l(e)))},y.prototype.mul=function(e){return h(d(this).mul(l(e)))},y.prototype.mod=function(e){return h(d(this).mod(l(e)))},y.prototype.pow=function(e){return h(d(this).pow(l(e)))},y.prototype.maskn=function(e){return h(d(this).maskn(e))},y.prototype.eq=function(e){return d(this).eq(l(e))},y.prototype.lt=function(e){return d(this).lt(l(e))},y.prototype.lte=function(e){return d(this).lte(l(e))},y.prototype.gt=function(e){return d(this).gt(l(e))},y.prototype.gte=function(e){return d(this).gte(l(e))},y.prototype.isZero=function(){return d(this).isZero()},y.prototype.toNumber=function(){try{return d(this).toNumber()}catch(e){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}return null},y.prototype.toString=function(){return d(this).toString(10)},y.prototype.toHexString=function(){return this._hex},y.isBigNumber=function(e){return s.isType(e,"BigNumber")},y);function y(e){if(u.checkNew(this,y),s.setType(this,"BigNumber"),"string"==typeof e)a.isHexString(e)?s.defineReadOnly(this,"_hex",e="0x"==e?"0x0":e):"-"===e[0]&&a.isHexString(e.substring(1))?s.defineReadOnly(this,"_hex",e):e.match(/^-?[0-9]*$/)?s.defineReadOnly(this,"_hex",c(new o.default.BN(e=""==e?"0":e))):u.throwError("invalid BigNumber string value",u.INVALID_ARGUMENT,{arg:"value",value:e});else if("number"==typeof e){parseInt(String(e))!==e&&u.throwError("underflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"underflow",value:e,outputValue:parseInt(String(e))});try{s.defineReadOnly(this,"_hex",c(new o.default.BN(e)))}catch(e){u.throwError("overflow",u.NUMERIC_FAULT,{operation:"setValue",fault:"overflow",details:e.message})}}else e instanceof y?s.defineReadOnly(this,"_hex",e._hex):e.toHexString?s.defineReadOnly(this,"_hex",c(l(e.toHexString()))):e._hex&&a.isHexString(e._hex)?s.defineReadOnly(this,"_hex",e._hex):a.isArrayish(e)?s.defineReadOnly(this,"_hex",c(new o.default.BN(a.hexlify(e).substring(2),16))):u.throwError("invalid BigNumber value",u.INVALID_ARGUMENT,{arg:"value",value:e})}function g(e){return p.isBigNumber(e)?e:new p(e)}r.BigNumber=p,r.bigNumberify=g},{"../errors":5,"./bytes":64,"./properties":74,"bn.js":9}],64:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors"));function o(e){return!!e.toHexString}function a(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function s(e){if(!e||parseInt(String(e.length))!=e.length||"string"==typeof e)return!1;for(var t=0;t<e.length;t++){var r=e[t];if(r<0||256<=r||parseInt(String(r))!=r)return!1}return!0}function u(e){if(null==e&&i.throwError("cannot convert null value to array",i.INVALID_ARGUMENT,{arg:"value",value:e}),"string"!=typeof(e=o(e)?e.toHexString():e))return s(e)?a(new Uint8Array(e)):(i.throwError("invalid arrayify value",null,{arg:"value",value:e,type:typeof e}),null);var t=e.match(/^(0x)?[0-9a-fA-F]*$/);t||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==t[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:e}),(e=e.substring(2)).length%2&&(e="0"+e);for(var r=[],n=0;n<e.length;n+=2)r.push(parseInt(e.substr(n,2),16));return a(new Uint8Array(r))}function f(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=u(e[n]);t.push(i),r+=i.length}var o=new Uint8Array(r),s=0;for(n=0;n<t.length;n++)o.set(t[n],s),s+=t[n].length;return a(o)}function c(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}r.isHexable=o,r.isArrayish=s,r.arrayify=u,r.concat=f,r.stripZeros=function(e){var t=u(e);if(0===t.length)return t;for(var r=0;0===t[r];)r++;return r?t.slice(r):t},r.padZeros=function(e,t){if(t<(e=u(e)).length)throw new Error("cannot pad");var r=new Uint8Array(t);return r.set(e,t-e.length),a(r)},r.isHexString=c;var l="0123456789abcdef";function h(e){if(o(e))return e.toHexString();if("number"==typeof e){e<0&&i.throwError("cannot hexlify negative value",i.INVALID_ARGUMENT,{arg:"value",value:e}),9007199254740991<=e&&i.throwError("out-of-range",i.NUMERIC_FAULT,{operartion:"hexlify",fault:"out-of-safe-range"});for(var t="";e;)t=l[15&e]+t,e=Math.floor(e/16);return t.length?"0x"+(t=t.length%2?"0"+t:t):"0x00"}if("string"==typeof e){var r=e.match(/^(0x)?[0-9a-fA-F]*$/);return r||i.throwError("invalid hexidecimal string",i.INVALID_ARGUMENT,{arg:"value",value:e}),"0x"!==r[1]&&i.throwError("hex string must have 0x prefix",i.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2?"0x0"+e.substring(2):e}if(s(e)){for(var n=[],a=0;a<e.length;a++){var u=e[a];n.push(l[(240&u)>>4]+l[15&u])}return"0x"+n.join("")}return i.throwError("invalid hexlify value",null,{arg:"value",value:e}),"never"}function d(e,t){for(c(e)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:e});e.length<2*t+2;)e="0x0"+e.substring(2);return e}function p(e){var t=0,r="0x",n="0x";if((o=e)&&null!=o.r&&null!=o.s){null==e.v&&null==e.recoveryParam&&i.throwError("at least on of recoveryParam or v must be specified",i.INVALID_ARGUMENT,{argument:"signature",value:e}),r=d(e.r,32),n=d(e.s,32),"string"==typeof(t=e.v)&&(t=parseInt(t,16));var o=e.recoveryParam;t=27+(o=null==o&&null!=e.v?1-t%2:o)}else{if(65!==(e=u(e)).length)throw new Error("invalid signature");r=h(e.slice(0,32)),n=h(e.slice(32,64)),27!==(t=e[64])&&28!==t&&(t=27+t%2)}return{r,s:n,recoveryParam:t-27,v:t}}r.hexlify=h,r.hexDataLength=function(e){return c(e)&&e.length%2==0?(e.length-2)/2:null},r.hexDataSlice=function(e,t,r){return c(e)||i.throwError("invalid hex data",i.INVALID_ARGUMENT,{arg:"value",value:e}),e.length%2!=0&&i.throwError("hex data length must be even",i.INVALID_ARGUMENT,{arg:"value",value:e}),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)},r.hexStripZeros=function(e){for(c(e)||i.throwError("invalid hex string",i.INVALID_ARGUMENT,{arg:"value",value:e});3<e.length&&"0x0"===e.substring(0,3);)e="0x"+e.substring(3);return e},r.hexZeroPad=d,r.splitSignature=p,r.joinSignature=function(e){return h(f([(e=p(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},{"../errors":5}],65:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors")),o=e("./bytes"),a=e("./utf8"),s=e("./keccak256"),u=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),f=new RegExp("^((.*)\\.)?([^.]+)$"),c=new RegExp("^[a-z0-9.-]*$");r.namehash=function(e){"string"!=typeof e&&i.throwError("invalid address - "+String(e),i.INVALID_ARGUMENT,{argument:"name",value:e}),(e=e.toLowerCase()).match(c)||i.throwError("contains invalid UseSTD3ASCIIRules characters",i.INVALID_ARGUMENT,{argument:"name",value:e});for(var t=u;e.length;){var r=e.match(f),n=a.toUtf8Bytes(r[3]);t=s.keccak256(o.concat([t,s.keccak256(n)])),e=r[2]||""}return o.hexlify(t)},r.id=function(e){return s.keccak256(a.toUtf8Bytes(e))},r.hashMessage=function(e){return s.keccak256(o.concat([a.toUtf8Bytes("Ethereum Signed Message:\n"),a.toUtf8Bytes(String(e.length)),"string"==typeof e?a.toUtf8Bytes(e):e]))}},{"../errors":5,"./bytes":64,"./keccak256":71,"./utf8":85}],66:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors")),o=e("../wordlists/lang-en"),a=e("./basex"),s=e("./bytes"),u=e("./bignumber"),f=e("./utf8"),c=e("./pbkdf2"),l=e("./hmac"),h=e("./properties"),d=e("./secp256k1"),p=e("./sha2"),y=u.bigNumberify("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),g=f.toUtf8Bytes("Bitcoin seed"),b=2147483648;function m(e){return(1<<e)-1<<8-e}function v(e){return s.hexZeroPad(s.hexlify(e),32)}function w(e){var t=s.hexDataSlice(p.sha256(p.sha256(e)),0,4);return a.Base58.encode(s.concat([e,t]))}var _={};r.defaultPath="m/44'/60'/0'/0/0";var E=(Object.defineProperty(S.prototype,"extendedKey",{get:function(){if(256<=this.depth)throw new Error("Depth too large!");return w(s.concat([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",s.hexlify(this.depth),this.parentFingerprint,s.hexZeroPad(s.hexlify(this.index),4),this.chainCode,null!=this.privateKey?s.concat(["0x00",this.privateKey]):this.publicKey]))},enumerable:!0,configurable:!0}),S.prototype.neuter=function(){return new S(_,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,null,this.path)},S.prototype._derive=function(e){if(4294967295<e)throw new Error("invalid index - "+String(e));var t=this.path;t&&(t+="/"+(e&~b));var r=new Uint8Array(37);if(e&b){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(s.arrayify(this.privateKey),1),t&&(t+="'")}else r.set(s.arrayify(this.publicKey));for(var n=24;0<=n;n-=8)r[33+(n>>3)]=e>>24-n&255;var i=(f=l.computeHmac(l.SupportedAlgorithms.sha512,this.chainCode,r)).slice(0,32),o=f.slice(32),a=null,f=null;return this.privateKey?a=v(u.bigNumberify(i).add(this.privateKey).mod(y)):f=new d.KeyPair(s.hexlify(i))._addPoint(this.publicKey),new S(_,a,f,this.fingerprint,v(o),e,this.depth+1,this.mnemonic,t)},S.prototype.derivePath=function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var r=this,n=0;n<t.length;n++){var i=t[n];if(i.match(/^[0-9]+'$/)){var o=parseInt(i.substring(0,i.length-1));if(b<=o)throw new Error("invalid path index - "+i);r=r._derive(b+o)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);if(o=parseInt(i),b<=o)throw new Error("invalid path index - "+i);r=r._derive(o)}}return r},S.isHDNode=function(e){return h.isType(e,"HDNode")},S);function S(e,t,r,n,o,a,u,f,c){if(i.checkNew(this,S),e!==_)throw new Error("HDNode constructor cannot be called directly");t?(t=new d.KeyPair(t),h.defineReadOnly(this,"privateKey",t.privateKey),h.defineReadOnly(this,"publicKey",t.compressedPublicKey)):(h.defineReadOnly(this,"privateKey",null),h.defineReadOnly(this,"publicKey",s.hexlify(r))),h.defineReadOnly(this,"parentFingerprint",n),h.defineReadOnly(this,"fingerprint",s.hexDataSlice(p.ripemd160(p.sha256(this.publicKey)),0,4)),h.defineReadOnly(this,"address",d.computeAddress(this.publicKey)),h.defineReadOnly(this,"chainCode",o),h.defineReadOnly(this,"index",a),h.defineReadOnly(this,"depth",u),h.defineReadOnly(this,"mnemonic",f),h.defineReadOnly(this,"path",c),h.setType(this,"HDNode")}function k(e,t){if((e=s.arrayify(e)).length<16||64<e.length)throw new Error("invalid seed");return e=s.arrayify(l.computeHmac(l.SupportedAlgorithms.sha512,g,e)),new E(_,v(e.slice(0,32)),null,"0x00000000",v(e.slice(32)),0,0,t,"m")}function T(e,t){return t=f.toUtf8Bytes("mnemonic"+(t=t||""),f.UnicodeNormalizationForm.NFKD),s.hexlify(c.pbkdf2(f.toUtf8Bytes(e,f.UnicodeNormalizationForm.NFKD),t,2048,64,"sha512"))}function A(e,t){t=t||o.langEn,i.checkNormalize();var r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");for(var n=s.arrayify(new Uint8Array(Math.ceil(11*r.length/8))),a=0,u=0;u<r.length;u++){var f=t.getWordIndex(r[u].normalize("NFKD"));if(-1===f)throw new Error("invalid mnemonic");for(var c=0;c<11;c++)f&1<<10-c&&(n[a>>3]|=1<<7-a%8),a++}var l=32*r.length/3,h=m(r.length/3);if(e=s.arrayify(p.sha256(n.slice(0,l/8)))[0],(e&=h)!=(n[n.length-1]&h))throw new Error("invalid checksum");return s.hexlify(n.slice(0,l/8))}function P(e,t){if((e=s.arrayify(e)).length%4!=0||e.length<16||32<e.length)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i<e.length;i++)8<n?(r[r.length-1]<<=8,r[r.length-1]|=e[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[i]>>8-n,r.push(e[i]&(1<<8-n)-1),n+=3);var a=s.arrayify(p.sha256(e))[0],u=e.length/4;return a&=m(u),r[r.length-1]<<=u,r[r.length-1]|=a>>8-u,(t=t||o.langEn).join(r.map((function(e){return t.getWord(e)})))}r.HDNode=E,r.fromExtendedKey=function(e){var t=a.Base58.decode(e);82===t.length&&w(t.slice(0,78))===e||i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"});var r=t[4],n=s.hexlify(t.slice(5,9)),o=parseInt(s.hexlify(t.slice(9,13)).substring(2),16),u=s.hexlify(t.slice(13,45)),f=t.slice(45,78);switch(s.hexlify(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new E(_,null,s.hexlify(f),n,u,o,r,null,null);case"0x0488ade4":case"0x04358394":if(0!==f[0])break;return new E(_,s.hexlify(f.slice(1)),null,n,u,o,r,null,null)}return i.throwError("invalid extended key",i.INVALID_ARGUMENT,{argument:"extendedKey",value:"[REDACTED]"})},r.fromMnemonic=function(e,t,r){return k(T(e=P(A(e,t),t),r),e)},r.fromSeed=function(e){return k(e,null)},r.mnemonicToSeed=T,r.mnemonicToEntropy=A,r.entropyToMnemonic=P,r.isValidMnemonic=function(e,t){try{return A(e,t),!0}catch(e){}return!1}},{"../errors":5,"../wordlists/lang-en":90,"./basex":62,"./bignumber":63,"./bytes":64,"./hmac":67,"./pbkdf2":73,"./properties":74,"./secp256k1":77,"./sha2":79,"./utf8":85}],67:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i,o=n(e("hash.js")),a=e("../utils/bytes"),s=n(e("../errors"));(e=i=r.SupportedAlgorithms||(r.SupportedAlgorithms={})).sha256="sha256",e.sha512="sha512",r.computeHmac=function(e,t,r){return i[e]||s.throwError("unsupported algorithm "+e,s.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),a.arrayify(o.hmac(o[e],a.arrayify(t)).update(a.arrayify(r)).digest())}},{"../errors":5,"../utils/bytes":64,"hash.js":26}],68:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./abi-coder");r.AbiCoder=i.AbiCoder,r.defaultAbiCoder=i.defaultAbiCoder,r.formatSignature=i.formatSignature,r.formatParamType=i.formatParamType,r.parseSignature=i.parseSignature,r.parseParamType=i.parseParamType,i=e("./address"),r.getAddress=i.getAddress,r.getContractAddress=i.getContractAddress,r.getCreate2Address=i.getCreate2Address,r.getIcapAddress=i.getIcapAddress,i=n(e("./base64")),r.base64=i,i=e("./bignumber"),r.BigNumber=i.BigNumber,r.bigNumberify=i.bigNumberify,i=e("./bytes"),r.arrayify=i.arrayify,r.concat=i.concat,r.hexDataSlice=i.hexDataSlice,r.hexDataLength=i.hexDataLength,r.hexlify=i.hexlify,r.hexStripZeros=i.hexStripZeros,r.hexZeroPad=i.hexZeroPad,r.isHexString=i.isHexString,r.joinSignature=i.joinSignature,r.padZeros=i.padZeros,r.splitSignature=i.splitSignature,r.stripZeros=i.stripZeros,i=e("./hash"),r.hashMessage=i.hashMessage,r.id=i.id,r.namehash=i.namehash,i=n(e("./hdnode")),r.HDNode=i,i=e("./interface"),r.Interface=i.Interface,i=e("./json-wallet"),r.getJsonWalletAddress=i.getJsonWalletAddress,i=e("./keccak256"),r.keccak256=i.keccak256,i=e("./sha2"),r.sha256=i.sha256,i=e("./solidity"),r.solidityKeccak256=i.keccak256,r.solidityPack=i.pack,r.soliditySha256=i.sha256,i=e("./random-bytes"),r.randomBytes=i.randomBytes,i=e("./networks"),r.getNetwork=i.getNetwork,i=e("./properties"),r.checkProperties=i.checkProperties,r.deepCopy=i.deepCopy,r.defineReadOnly=i.defineReadOnly,r.resolveProperties=i.resolveProperties,r.shallowCopy=i.shallowCopy,n=n(e("./rlp")),r.RLP=n,n=e("./secp256k1"),r.computeAddress=n.computeAddress,r.computePublicKey=n.computePublicKey,r.recoverAddress=n.recoverAddress,r.recoverPublicKey=n.recoverPublicKey,r.verifyMessage=n.verifyMessage,n=e("./signing-key"),r.SigningKey=n.SigningKey,n=e("./transaction"),r.populateTransaction=n.populateTransaction,n=e("./transaction"),r.parseTransaction=n.parse,r.serializeTransaction=n.serialize,n=e("./utf8"),r.formatBytes32String=n.formatBytes32String,r.parseBytes32String=n.parseBytes32String,r.toUtf8Bytes=n.toUtf8Bytes,r.toUtf8String=n.toUtf8String,n=e("./units"),r.commify=n.commify,r.formatEther=n.formatEther,r.parseEther=n.parseEther,r.formatUnits=n.formatUnits,r.parseUnits=n.parseUnits,n=e("./web"),r.fetchJson=n.fetchJson,r.poll=n.poll,n=e("./hmac"),r.SupportedAlgorithms=n.SupportedAlgorithms,n=e("./utf8"),r.UnicodeNormalizationForm=n.UnicodeNormalizationForm,e=e("./wordlist"),r.Wordlist=e.Wordlist},{"./abi-coder":59,"./address":60,"./base64":61,"./bignumber":63,"./bytes":64,"./hash":65,"./hdnode":66,"./hmac":67,"./interface":69,"./json-wallet":70,"./keccak256":71,"./networks":72,"./properties":74,"./random-bytes":75,"./rlp":76,"./secp256k1":77,"./sha2":79,"./signing-key":81,"./solidity":82,"./transaction":83,"./units":84,"./utf8":85,"./web":86,"./wordlist":87}],69:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./address"),u=e("./abi-coder"),f=e("./bignumber"),c=e("./bytes"),l=e("./hash"),h=e("./keccak256"),d=e("./properties"),p=o(e("../errors")),y=function(e){d.setType(this,"Indexed"),d.defineReadOnly(this,"hash",e)},g=(e=function(e){for(var t in d.setType(this,"Description"),e)d.defineReadOnly(this,t,d.deepCopy(e[t],!0));Object.freeze(this)},i(b,a=e),b.prototype.encode=function(e,t){c.isHexString(e)||p.throwError("invalid contract bytecode",p.INVALID_ARGUMENT,{arg:"bytecode",value:e}),p.checkArgumentCount(t.length,this.inputs.length," in Interface constructor");try{return e+u.defaultAbiCoder.encode(this.inputs,t).substring(2)}catch(e){p.throwError("invalid constructor argument",p.INVALID_ARGUMENT,{arg:e.arg,reason:e.reason,value:e.value})}return null},b);function b(){return null!==a&&a.apply(this,arguments)||this}var m,v=(i(w,m=e),w.prototype.encode=function(e){p.checkArgumentCount(e.length,this.inputs.length," in interface function "+this.name);try{return this.sighash+u.defaultAbiCoder.encode(this.inputs,e).substring(2)}catch(e){p.throwError("invalid input argument",p.INVALID_ARGUMENT,{arg:e.arg,reason:e.reason,value:e.value})}return null},w.prototype.decode=function(e){try{return u.defaultAbiCoder.decode(this.outputs,c.arrayify(e))}catch(t){p.throwError("invalid data for function output",p.INVALID_ARGUMENT,{arg:"data",errorArg:t.arg,errorValue:t.value,value:e,reason:t.reason})}},w);function w(){return null!==m&&m.apply(this,arguments)||this}var _,E=(i(S,_=e),S);function S(){return null!==_&&_.apply(this,arguments)||this}var k,T=(i(A,k=e),A.prototype.encodeTopics=function(e){var t=this;e.length>this.inputs.length&&p.throwError("too many arguments for "+this.name,p.UNEXPECTED_ARGUMENT,{maxCount:e.length,expectedCount:this.inputs.length});var r=[];for(this.anonymous||r.push(this.topic),e.forEach((function(e,n){var i=t.inputs[n];i.indexed?null==e?r.push(null):"string"===i.type?r.push(l.id(e)):"bytes"===i.type?r.push(h.keccak256(e)):-1!==i.type.indexOf("[")||"tuple"===i.type.substring(0,5)?p.throwError("filtering with tuples or arrays not implemented yet; bug us on GitHub",p.NOT_IMPLEMENTED,{operation:"filter(array|tuple)"}):("address"===i.type&&s.getAddress(e),r.push(c.hexZeroPad(c.hexlify(e),32).toLowerCase())):null!=e&&p.throwError("cannot filter non-indexed parameters; must be null",p.INVALID_ARGUMENT,{argument:i.name||n,value:e})}));r.length&&null===r[r.length-1];)r.pop();return r},A.prototype.decode=function(e,t){null==t||this.anonymous||(t=t.slice(1));var r,n=[],i=[],o=[];this.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||0<=e.type.indexOf("[")||"tuple"===e.type.substring(0,5)?(n.push({type:"bytes32",name:e.name||""}),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))})),null!=t&&(r=u.defaultAbiCoder.decode(n,c.concat(t)));var a=u.defaultAbiCoder.decode(i,c.arrayify(e)),s={},f=0,l=0;return this.inputs.forEach((function(e,n){e.indexed?null==t?s[n]=new y(null):o[n]?s[n]=new y(r[l++]):s[n]=r[l++]:s[n]=a[f++],e.name&&(s[e.name]=s[n])})),s.length=this.inputs.length,new E(s)},A);function A(){return null!==k&&k.apply(this,arguments)||this}var P,I=(i(O,P=e),O);function O(){return null!==P&&P.apply(this,arguments)||this}var x,M=(i(N,x=e),N);function N(){return null!==x&&x.apply(this,arguments)||this}function R(e){switch(e.type){case"constructor":var t=new g({inputs:e.inputs,payable:null==e.payable||!!e.payable});this.deployFunction||(this.deployFunction=t);break;case"function":var r=u.formatSignature(e).replace(/tuple/g,""),n=l.id(r).substring(0,10),i=!1;null!=e.constant?i=e.constant:null!=e.stateMutability&&(i="view"==e.stateMutability||"pure"==e.stateMutability),t=new v({inputs:e.inputs,outputs:e.outputs,gas:e.gas,payable:null==e.payable||!!e.payable,type:i?"call":"transaction",name:e.name,signature:r,sighash:n}),e.name&&(null==this.functions[e.name]?d.defineReadOnly(this.functions,e.name,t):p.warn("WARNING: Multiple definitions for "+e.name)),null==this.functions[t.signature]&&d.defineReadOnly(this.functions,t.signature,t);break;case"event":r=u.formatSignature(e).replace(/tuple/g,""),t=new T({name:e.name,signature:r,inputs:e.inputs,topic:l.id(r),anonymous:!!e.anonymous}),e.name&&null==this.events[e.name]&&d.defineReadOnly(this.events,e.name,t),null==this.events[t.signature]&&d.defineReadOnly(this.events,t.signature,t);break;case"receive":case"fallback":break;default:p.warn("WARNING: unsupported ABI type - "+e.type)}}function B(e){if(p.checkNew(this,B),"string"==typeof e){try{e=JSON.parse(e)}catch(t){p.throwError("could not parse ABI JSON",p.INVALID_ARGUMENT,{arg:"abi",errorMessage:t.message,value:e})}if(!Array.isArray(e))return p.throwError("invalid abi",p.INVALID_ARGUMENT,{arg:"abi",value:e}),null}d.defineReadOnly(this,"functions",{}),d.defineReadOnly(this,"events",{});var t=[];e.forEach((function(e){"string"==typeof e&&(e=u.parseSignature(e)),t.push(e)})),d.defineReadOnly(this,"abi",d.deepCopy(t,!0)),t.forEach(R,this),this.deployFunction||R.call(this,{type:"constructor",inputs:[]}),d.setType(this,"Interface")}B.prototype.parseTransaction=function(e){var t,r=e.data.substring(0,10).toLowerCase();for(t in this.functions)if(-1!==t.indexOf("(")){var n=this.functions[t];if(n.sighash===r){var i=u.defaultAbiCoder.decode(n.inputs,"0x"+e.data.substring(10));return new I({args:i,decode:n.decode,name:n.name,signature:n.signature,sighash:n.sighash,value:f.bigNumberify(e.value||"0")})}}return null},B.prototype.parseLog=function(e){for(var t in this.events)if(-1!==t.indexOf("(")&&!(t=this.events[t]).anonymous&&t.topic===e.topics[0])return new M({decode:t.decode,name:t.name,signature:t.signature,topic:t.topic,values:t.decode(e.data,e.topics)});return null},B.isInterface=function(e){return d.isType(e,"Interface")},B.isIndexed=function(e){return d.isType(e,"Indexed")},e=B,r.Interface=e},{"../errors":5,"./abi-coder":59,"./address":60,"./bignumber":63,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74}],70:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./address");function i(e){try{var t=JSON.parse(e)}catch(e){return!1}return t.encseed&&t.ethaddr}function o(e){try{var t=JSON.parse(e)}catch(e){return!1}return!(!t.version||parseInt(t.version)!==t.version||3!==parseInt(t.version))}r.isCrowdsaleWallet=i,r.isSecretStorageWallet=o,r.getJsonWalletAddress=function(e){if(i(e))try{return n.getAddress(JSON.parse(e).ethaddr)}catch(e){return null}if(o(e))try{return n.getAddress(JSON.parse(e).address)}catch(e){return null}return null}},{"./address":60}],71:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("js-sha3"),i=e("./bytes");r.keccak256=function(e){return"0x"+n.keccak_256(i.arrayify(e))}},{"./bytes":64,"js-sha3":40}],72:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors"));function o(e){return function(t){var r=[];return t.InfuraProvider&&r.push(new t.InfuraProvider(e)),t.EtherscanProvider&&r.push(new t.EtherscanProvider(e)),0===r.length?null:t.FallbackProvider?new t.FallbackProvider(r):r[0]}}function a(e,t){return function(r){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null}}var s={unspecified:{chainId:0,name:"unspecified"},homestead:n={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:o("homestead")},mainnet:n,morden:{chainId:2,name:"morden"},ropsten:e={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:o("ropsten")},testnet:e,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:o("rinkeby")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:o("goerli")},kovan:{chainId:42,name:"kovan",_defaultProvider:o("kovan")},classic:{chainId:61,name:"classic",_defaultProvider:a("https://web3.gastracker.io","classic")},classicTestnet:{chainId:62,name:"classicTestnet",_defaultProvider:a("https://web3.gastracker.io/morden","classicTestnet")}};r.getNetwork=function(e){if(null==e)return null;if("number"==typeof e){for(var t in s)if((t=s[t]).chainId===e)return{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress||null,_defaultProvider:t._defaultProvider||null};return{chainId:e,name:"unknown"}}if("string"!=typeof e)return(r=s[e.name])?(0!==e.chainId&&e.chainId!==r.chainId&&i.throwError("network chainId mismatch",i.INVALID_ARGUMENT,{arg:"network",value:e}),{name:e.name,chainId:r.chainId,ensAddress:e.ensAddress||r.ensAddress||null,_defaultProvider:e._defaultProvider||r._defaultProvider||null}):("number"!=typeof e.chainId&&i.throwError("invalid network chainId",i.INVALID_ARGUMENT,{arg:"network",value:e}),e);var r=s[e];return null==r?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}},{"../errors":5}],73:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../utils/bytes"),i=e("./hmac");r.pbkdf2=function(e,t,r,o,a){var s;e=n.arrayify(e),t=n.arrayify(t);var u,f,c=1,l=new Uint8Array(o),h=new Uint8Array(t.length+4);h.set(t);for(var d=1;d<=c;d++){h[t.length]=d>>24&255,h[t.length+1]=d>>16&255,h[t.length+2]=d>>8&255,h[t.length+3]=255&d;var p=i.computeHmac(a,e,h);s||(s=p.length,f=new Uint8Array(s),u=o-((c=Math.ceil(o/s))-1)*s),f.set(p);for(var y=1;y<r;y++){p=i.computeHmac(a,e,p);for(var g=0;g<s;g++)f[g]^=p[g]}var b=(d-1)*s,m=d===c?u:s;l.set(n.arrayify(f).slice(0,m),b)}return n.arrayify(l)}},{"../utils/bytes":64,"./hmac":67}],74:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("../errors"));function o(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function a(e,t){return e&&e._ethersType===t}r.defineReadOnly=o,r.setType=function(e,t){Object.defineProperty(e,"_ethersType",{configurable:!1,value:t,writable:!1})},r.isType=a,r.resolveProperties=function(e){var t={},r=[];return Object.keys(e).forEach((function(n){var i=e[n];i instanceof Promise?r.push(i.then((function(e){return t[n]=e,null}))):t[n]=i})),Promise.all(r).then((function(){return t}))},r.checkProperties=function(e,t){e&&"object"==typeof e||i.throwError("invalid object",i.INVALID_ARGUMENT,{argument:"object",value:e}),Object.keys(e).forEach((function(r){t[r]||i.throwError("invalid object key - "+r,i.INVALID_ARGUMENT,{argument:"transaction",value:e,key:r})}))},r.shallowCopy=function(e){var t,r={};for(t in e)r[t]=e[t];return r};var s={boolean:!0,number:!0,string:!0};r.deepCopy=function e(t,r){if(null==t||s[typeof t])return t;if(Array.isArray(t)){var n=t.map((function(t){return e(t,r)}));return r&&Object.freeze(n),n}if("object"==typeof t){if(a(t,"BigNumber"))return t;if(a(t,"Description"))return t;if(a(t,"Indexed"))return t;var i;for(i in n={},t){var u=t[i];void 0!==u&&o(n,i,e(u,r))}return r&&Object.freeze(n),n}if("function"==typeof t)return t;throw new Error("Cannot deepCopy "+typeof t)},r.inheritable=function e(t){return function(r){var n,i;i=t,(n=r).super_=i,n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(r,"inherits",e(r))}}},{"../errors":5}],75:[function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0});var r=e("../utils/bytes"),i=e("../utils/properties"),o=t.crypto||t.msCrypto;function a(e){if(e<=0||1024<e||parseInt(String(e))!=e)throw new Error("invalid length");return e=new Uint8Array(e),o.getRandomValues(e),r.arrayify(e)}o&&o.getRandomValues||(console.log("WARNING: Missing strong random number source; using weak randomBytes"),o={getRandomValues:function(e){for(var t=0;t<20;t++)for(var r=0;r<e.length;r++)t?e[r]^=Math.trunc(256*Math.random()):e[r]=Math.trunc(256*Math.random());return e},_weakCrypto:!0}),n.randomBytes=a,!0===o._weakCrypto&&i.defineReadOnly(a,"_weakCrypto",!0)}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/bytes":64,"../utils/properties":74}],76:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bytes");function i(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function o(e,t,r){for(var n=0,i=0;i<r;i++)n=256*n+e[t+i];return n}function a(e,t,r,n){for(var i=[];r<t+1+n;){var o=s(e,r);if(i.push(o.result),t+1+n<(r+=o.consumed))throw new Error("invalid rlp")}return{consumed:1+n,result:i}}function s(e,t){if(0===e.length)throw new Error("invalid rlp data");if(248<=e[t]){if(t+1+(r=e[t]-247)>e.length)throw new Error("too short");if(t+1+r+(i=o(e,t+1,r))>e.length)throw new Error("to short");return a(e,t,t+1+r,r+i)}if(192<=e[t]){if(t+1+(i=e[t]-192)>e.length)throw new Error("invalid rlp data");return a(e,t,t+1,i)}if(184<=e[t]){var r;if(t+1+(r=e[t]-183)>e.length)throw new Error("invalid rlp data");if(t+1+r+(i=o(e,t+1,r))>e.length)throw new Error("invalid rlp data");return{consumed:1+r+i,result:n.hexlify(e.slice(t+1+r,t+1+r+i))}}if(128<=e[t]){var i;if(t+1+(i=e[t]-128)>e.length)throw new Error("invalid rlp data");return{consumed:1+i,result:n.hexlify(e.slice(t+1,t+1+i))}}return{consumed:1,result:n.hexlify(e[t])}}r.encode=function(e){return n.hexlify(function e(t){if(Array.isArray(t)){var r=[];return t.forEach((function(t){r=r.concat(e(t))})),r.length<=55?(r.unshift(192+r.length),r):((o=i(r.length)).unshift(247+o.length),o.concat(r))}var o;return 1===(t=Array.prototype.slice.call(n.arrayify(t))).length&&t[0]<=127?t:t.length<=55?(t.unshift(128+t.length),t):((o=i(t.length)).unshift(183+o.length),o.concat(t))}(e))},r.decode=function(e){var t=n.arrayify(e);if((e=s(t,0)).consumed!==t.length)throw new Error("invalid rlp data");return e.result}},{"./bytes":64}],77:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("elliptic"),o=e("./address"),a=e("./bytes"),s=e("./hash"),u=e("./keccak256"),f=e("./properties"),c=n(e("../errors")),l=null;function h(){return l=l||new i.ec("secp256k1")}var d=(p.prototype.sign=function(e){return{recoveryParam:(e=h().keyFromPrivate(a.arrayify(this.privateKey)).sign(a.arrayify(e),{canonical:!0})).recoveryParam,r:a.hexZeroPad("0x"+e.r.toString(16),32),s:a.hexZeroPad("0x"+e.s.toString(16),32),v:27+e.recoveryParam}},p.prototype.computeSharedSecret=function(e){var t=h().keyFromPrivate(a.arrayify(this.privateKey));return e=h().keyFromPublic(a.arrayify(y(e))),a.hexZeroPad("0x"+t.derive(e.getPublic()).toString(16),32)},p.prototype._addPoint=function(e){var t=h().keyFromPublic(a.arrayify(this.publicKey));return e=h().keyFromPublic(a.arrayify(e)),"0x"+t.pub.add(e.pub).encodeCompressed("hex")},p);function p(e){e=h().keyFromPrivate(a.arrayify(e)),f.defineReadOnly(this,"privateKey",a.hexlify(e.priv.toArray("be",32))),f.defineReadOnly(this,"publicKey","0x"+e.getPublic(!1,"hex")),f.defineReadOnly(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),f.defineReadOnly(this,"publicKeyBytes",e.getPublic().encode(null,!0))}function y(e,t){return 32!==(e=a.arrayify(e)).length?33===e.length?t?a.hexlify(e):"0x"+h().keyFromPublic(e).getPublic(!1,"hex"):65===e.length?t?"0x"+h().keyFromPublic(e).getPublic(!0,"hex"):a.hexlify(e):(c.throwError("invalid public or private key",c.INVALID_ARGUMENT,{arg:"key",value:"[REDACTED]"}),null):(e=new d(e),t?e.compressedPublicKey:e.publicKey)}function g(e){return e="0x"+y(e).slice(4),o.getAddress("0x"+u.keccak256(e).substring(26))}function b(e,t){var r=a.splitSignature(t);return t={r:a.arrayify(r.r),s:a.arrayify(r.s)},"0x"+h().recoverPubKey(a.arrayify(e),t,r.recoveryParam).encode("hex",!1)}function m(e,t){return g(b(a.arrayify(e),t))}r.KeyPair=d,r.computePublicKey=y,r.computeAddress=g,r.recoverPublicKey=b,r.recoverAddress=m,r.verifyMessage=function(e,t){return m(s.hashMessage(e),t)}},{"../errors":5,"./address":60,"./bytes":64,"./hash":65,"./keccak256":71,"./properties":74,elliptic:12}],78:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var o=n(e("aes-js")),a=n(e("scrypt-js")),s=n(e("uuid")),u=e("./signing-key"),f=i(e("./hdnode")),c=e("./address"),l=e("./bytes"),h=e("./pbkdf2"),d=e("./keccak256"),p=e("./utf8"),y=e("./random-bytes");function g(e){return"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),l.arrayify(e)}function b(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function m(e){return"string"==typeof e?p.toUtf8Bytes(e,p.UnicodeNormalizationForm.NFKC):l.arrayify(e)}function v(e,t){for(var r=e,n=t.toLowerCase().split("/"),i=0;i<n.length;i++){var o,a=null;for(o in r)if(o.toLowerCase()===n[i]){a=r[o];break}if(null===a)return null;r=a}return r}r.decryptCrowdsale=function(e,t){var r=JSON.parse(e);t=m(t);var n=c.getAddress(v(r,"ethaddr"));if(!(e=g(v(r,"encseed")))||e.length%16!=0)throw new Error("invalid encseed");r=h.pbkdf2(t,t,2e3,32,"sha256").slice(0,16),t=e.slice(0,16),e=e.slice(16),t=new o.default.ModeOfOperation.cbc(r,t);for(var i=l.arrayify(t.decrypt(e)),a=(i=o.default.padding.pkcs7.strip(i),""),s=0;s<i.length;s++)a+=String.fromCharCode(i[s]);if(e=p.toUtf8Bytes(a),(e=new u.SigningKey(d.keccak256(e))).address!==n)throw new Error("corrupt crowdsale wallet");return e},r.decrypt=function(e,t,r){function n(e,t){var r=g(v(i,"crypto/ciphertext"));if(l.hexlify((s=e.slice(16,32),d.keccak256(l.concat([s,r])))).substring(2)!==v(i,"crypto/mac").toLowerCase())return t(new Error("invalid password")),null;var n=function(e,t){if("aes-128-ctr"!==v(i,"crypto/cipher"))return null;var r=g(v(i,"crypto/cipherparams/iv"));return r=new o.default.Counter(r),r=new o.default.ModeOfOperation.ctr(e,r),l.arrayify(r.decrypt(t))}(e.slice(0,16),r),a=e.slice(32,64);if(!n)return t(new Error("unsupported cipher")),null;var s=new u.SigningKey(n);if(i.address&&s.address!==c.getAddress(i.address))return t(new Error("address mismatch")),null;if(r=v(i,"x-ethers/locale"),"0.1"===v(i,"x-ethers/version")&&(null==r||"en"===r)){if(e=g(v(i,"x-ethers/mnemonicCiphertext")),r=g(v(i,"x-ethers/mnemonicCounter")),r=new o.default.Counter(r),a=new o.default.ModeOfOperation.ctr(a,r),r=v(i,"x-ethers/path")||f.defaultPath,e=l.arrayify(a.decrypt(e)),e=f.entropyToMnemonic(e),(r=f.fromMnemonic(e).derivePath(r)).privateKey!=l.hexlify(n))return t(new Error("mnemonic mismatch")),null;s=new u.SigningKey(r)}return s}var i=JSON.parse(e),s=m(t);return new Promise((function(e,t){if((p=v(i,"crypto/kdf"))&&"string"==typeof p)if("scrypt"===p.toLowerCase()){var o=g(v(i,"crypto/kdfparams/salt")),u=parseInt(v(i,"crypto/kdfparams/n")),f=parseInt(v(i,"crypto/kdfparams/r")),c=parseInt(v(i,"crypto/kdfparams/p"));u&&f&&c?u&u-1?t(new Error("unsupported key-derivation function parameter value for N")):32===(d=parseInt(v(i,"crypto/kdfparams/dklen")))?(r&&r(0),a.default(s,o,u,f,c,64,(function(i,o,a){if(i)i.progress=o,t(i);else if(a)(a=n(a=l.arrayify(a),t))&&(r&&r(1),e(a));else if(r)return r(o)}))):t(new Error("unsupported key-derivation derived-key length")):t(new Error("unsupported key-derivation function parameters"))}else if("pbkdf2"===p.toLowerCase()){if(o=g(v(i,"crypto/kdfparams/salt")),c=null,"hmac-sha256"===(p=v(i,"crypto/kdfparams/prf")))c="sha256";else{if("hmac-sha512"!==p)return void t(new Error("unsupported prf"));c="sha512"}var d,p=parseInt(v(i,"crypto/kdfparams/c"));32===(d=parseInt(v(i,"crypto/kdfparams/dklen")))?(c=n(c=h.pbkdf2(s,o,p,d,c),t))&&e(c):t(new Error("unsupported key-derivation derived-key length"))}else t(new Error("unsupported key-derivation function"));else t(new Error("unsupported key-derivation function"))}))},r.encrypt=function(e,t,r,n){"function"!=typeof r||n||(n=r,r={}),r=r||{};var i;if(32!==(i=u.SigningKey.isSigningKey(e)?l.arrayify(e.privateKey):l.arrayify(e)).length)throw new Error("invalid private key");var c=m(t),h=null;if(r.entropy&&(h=l.arrayify(r.entropy)),r.mnemonic)if(h){if(f.entropyToMnemonic(h)!==r.mnemonic)throw new Error("entropy and mnemonic mismatch")}else h=l.arrayify(f.mnemonicToEntropy(r.mnemonic,r.wordlist));var p=r.path;h&&!p&&(p=f.defaultPath);var g,v=(v=r.client)||"ethers.js",w=(g=r.salt?l.arrayify(r.salt):y.randomBytes(32),null);if(r.iv){if(16!==(w=l.arrayify(r.iv)).length)throw new Error("invalid iv")}else w=y.randomBytes(16);var _=null;if(r.uuid){if(16!==(_=l.arrayify(r.uuid)).length)throw new Error("invalid uuid")}else _=y.randomBytes(16);var E=1<<17,S=8,k=1;return r.scrypt&&(r.scrypt.N&&(E=r.scrypt.N),r.scrypt.r&&(S=r.scrypt.r),r.scrypt.p&&(k=r.scrypt.p)),new Promise((function(e,t){n&&n(0),a.default(c,g,E,S,k,64,(function(a,f,c){if(a)a.progress=f,t(a);else if(c){var m=(c=l.arrayify(c)).slice(0,16),T=c.slice(16,32),A=c.slice(32,64);a=new u.SigningKey(i).address,c=new o.default.Counter(w),c=new o.default.ModeOfOperation.ctr(m,c),c=l.arrayify(c.encrypt(i)),T=d.keccak256(l.concat([T,c])),a={address:a.substring(2).toLowerCase(),id:s.default.v4({random:_}),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:l.hexlify(w).substring(2)},ciphertext:l.hexlify(c).substring(2),kdf:"scrypt",kdfparams:{salt:l.hexlify(g).substring(2),n:E,dklen:32,p:k,r:S},mac:T.substring(2)}},h&&(c=y.randomBytes(16),T=new o.default.Counter(c),A=new o.default.ModeOfOperation.ctr(A,T),T=l.arrayify(A.encrypt(h)),A=(A=new Date).getUTCFullYear()+"-"+b(A.getUTCMonth()+1,2)+"-"+b(A.getUTCDate(),2)+"T"+b(A.getUTCHours(),2)+"-"+b(A.getUTCMinutes(),2)+"-"+b(A.getUTCSeconds(),2)+".0Z",a["x-ethers"]={client:v,gethFilename:"UTC--"+A+"--"+a.address,mnemonicCounter:l.hexlify(c).substring(2),mnemonicCiphertext:l.hexlify(T).substring(2),path:p,version:"0.1"},r.wordlist&&"string"==typeof r.wordlist.locale&&(a["x-ethers"].locale=r.wordlist.locale)),n&&n(1),e(JSON.stringify(a))}else if(n)return n(f)}))}))}},{"./address":60,"./bytes":64,"./hdnode":66,"./keccak256":71,"./pbkdf2":73,"./random-bytes":75,"./signing-key":81,"./utf8":85,"aes-js":8,"scrypt-js":44,uuid:48}],79:[function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var i=n(e("hash.js")),o=e("./bytes");r.ripemd160=function(e){return"0x"+i.default.ripemd160().update(o.arrayify(e)).digest("hex")},r.sha256=function(e){return"0x"+i.default.sha256().update(o.arrayify(e)).digest("hex")},r.sha512=function(e){return"0x"+i.default.sha512().update(o.arrayify(e)).digest("hex")}},{"./bytes":64,"hash.js":26}],80:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),e("setimmediate"),r.platform="browser"},{setimmediate:45}],81:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("./hdnode"),o=e("./bytes"),a=e("./properties"),s=e("./secp256k1"),u=n(e("../errors"));function f(e){u.checkNew(this,f);var t;t=i.HDNode.isHDNode(e)?(a.defineReadOnly(this,"mnemonic",e.mnemonic),a.defineReadOnly(this,"path",e.path),o.arrayify(e.privateKey)):("string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e),o.arrayify(e));try{32!==t.length&&u.throwError("exactly 32 bytes required",u.INVALID_ARGUMENT,{arg:"privateKey",value:"[REDACTED]"})}catch(t){e={arg:"privateKey",reason:t.reason,value:"[REDACTED]"},t.value&&("number"==typeof t.value.length&&(e.length=t.value.length),e.type=typeof t.value),u.throwError("invalid private key",t.code,e)}a.defineReadOnly(this,"privateKey",o.hexlify(t)),a.defineReadOnly(this,"keyPair",new s.KeyPair(t)),a.defineReadOnly(this,"publicKey",this.keyPair.publicKey),a.defineReadOnly(this,"address",s.computeAddress(this.keyPair.publicKey)),a.setType(this,"SigningKey")}f.prototype.signDigest=function(e){return this.keyPair.sign(e)},f.prototype.computeSharedSecret=function(e){return this.keyPair.computeSharedSecret(o.arrayify(e))},f.isSigningKey=function(e){return a.isType(e,"SigningKey")},e=f,r.SigningKey=e},{"../errors":5,"./bytes":64,"./hdnode":66,"./properties":74,"./secp256k1":77}],82:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("./bignumber"),i=e("./bytes"),o=e("./utf8"),a=e("./keccak256"),s=e("./sha2"),u=new RegExp("^bytes([0-9]+)$"),f=new RegExp("^(u?int)([0-9]*)$"),c=new RegExp("^(.*)\\[([0-9]*)\\]$");function l(e,t){if(e.length!=t.length)throw new Error("type/value count mismatch");var r=[];return e.forEach((function(e,a){r.push(function e(t,r,a){switch(t){case"address":return a?i.padZeros(r,32):i.arrayify(r);case"string":return o.toUtf8Bytes(r);case"bytes":return i.arrayify(r);case"bool":return r=r?"0x01":"0x00",a?i.padZeros(r,32):i.arrayify(r)}var s=t.match(f);if(s){if((l=parseInt(s[2]||"256"))%8!=0||0===l||256<l)throw new Error("invalid number type - "+t);return a&&(l=256),r=n.bigNumberify(r).toTwos(l),i.padZeros(r,l/8)}if(s=t.match(u)){var l=parseInt(s[1]);if(String(l)!=s[1]||0===l||32<l)throw new Error("invalid number type - "+t);if(i.arrayify(r).byteLength!==l)throw new Error("invalid value for "+t);return a?i.arrayify((r+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):r}if((s=t.match(c))&&Array.isArray(r)){var h=s[1];if(parseInt(s[2]||String(r.length))!=r.length)throw new Error("invalid value for "+t);var d=[];return r.forEach((function(t){d.push(e(h,t,!0))})),i.concat(d)}throw new Error("unknown type - "+t)}(e,t[a]))})),i.hexlify(i.concat(r))}r.pack=l,r.keccak256=function(e,t){return a.keccak256(l(e,t))},r.sha256=function(e,t){return s.sha256(l(e,t))}},{"./bignumber":63,"./bytes":64,"./keccak256":71,"./sha2":79,"./utf8":85}],83:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("../constants"),o=n(e("../errors")),a=e("./secp256k1"),s=e("./address"),u=e("./bignumber"),f=e("./bytes"),c=e("./keccak256"),l=e("./properties"),h=n(e("./rlp")),d=e("../providers/abstract-provider");function p(e){return"0x"===e?i.Zero:u.bigNumberify(e)}var y=[{name:"nonce",maxLength:32},{name:"gasPrice",maxLength:32},{name:"gasLimit",maxLength:32},{name:"to",length:20},{name:"value",maxLength:32},{name:"data"}],g={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0};r.serialize=function(e,t){l.checkProperties(e,g);var r=[];y.forEach((function(t){var n=e[t.name]||[];n=f.arrayify(f.hexlify(n)),t.length&&n.length!==t.length&&0<n.length&&o.throwError("invalid length for "+t.name,o.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:n}),t.maxLength&&(n=f.stripZeros(n)).length>t.maxLength&&o.throwError("invalid length for "+t.name,o.INVALID_ARGUMENT,{arg:"transaction"+t.name,value:n}),r.push(f.hexlify(n))})),null!=e.chainId&&0!==e.chainId&&(r.push(f.hexlify(e.chainId)),r.push("0x"),r.push("0x"));var n=h.encode(r);return t?(t=27+(n=f.splitSignature(t)).recoveryParam,9===r.length&&(r.pop(),r.pop(),r.pop(),t+=2*e.chainId+8),r.push(f.hexlify(t)),r.push(f.stripZeros(f.arrayify(n.r))),r.push(f.stripZeros(f.arrayify(n.s))),h.encode(r)):n},r.parse=function(e){9!==(n=h.decode(e)).length&&6!==n.length&&o.throwError("invalid raw transaction",o.INVALID_ARGUMENT,{arg:"rawTransactin",value:e});var t={nonce:p(n[0]).toNumber(),gasPrice:p(n[1]),gasLimit:p(n[2]),to:"0x"===(r=n[3])?null:s.getAddress(r),value:p(n[4]),data:n[5],chainId:0};if(6===n.length)return t;try{t.v=u.bigNumberify(n[6]).toNumber()}catch(e){return o.info(e),t}if(t.r=f.hexZeroPad(n[7],32),t.s=f.hexZeroPad(n[8],32),u.bigNumberify(t.r).isZero()&&u.bigNumberify(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);var r=t.v-27,n=n.slice(0,6);0!==t.chainId&&(n.push(f.hexlify(t.chainId)),n.push("0x"),n.push("0x"),r-=2*t.chainId+8),n=c.keccak256(h.encode(n));try{t.from=a.recoverAddress(n,{r:f.hexlify(t.r),s:f.hexlify(t.s),recoveryParam:r})}catch(e){o.info(e)}t.hash=c.keccak256(e)}return t},r.populateTransaction=function(e,t,r){d.Provider.isProvider(t)||o.throwError("missing provider",o.INVALID_ARGUMENT,{argument:"provider",value:t}),l.checkProperties(e,g);var n=l.shallowCopy(e);return null!=n.to&&(n.to=t.resolveName(n.to)),null==n.gasPrice&&(n.gasPrice=t.getGasPrice()),null==n.nonce&&(n.nonce=t.getTransactionCount(r)),null==n.gasLimit&&((e=l.shallowCopy(n)).from=r,n.gasLimit=t.estimateGas(e)),null==n.chainId&&(n.chainId=t.getNetwork().then((function(e){return e.chainId}))),l.resolveProperties(n)}},{"../constants":3,"../errors":5,"../providers/abstract-provider":50,"./address":60,"./bignumber":63,"./bytes":64,"./keccak256":71,"./properties":74,"./rlp":76,"./secp256k1":77}],84:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i,o=e("../constants"),a=n(e("../errors")),s=e("./bignumber"),u={};function f(e){return{decimals:e.length-1,tenPower:s.bigNumberify(e)}}function c(e){var t=u[String(e).toLowerCase()];if(!t&&"number"==typeof e&&parseInt(String(e))==e&&0<=e&&e<=256){for(var r="1",n=0;n<e;n++)r+="0";t=f(r)}return t||a.throwError("invalid unitType",a.INVALID_ARGUMENT,{argument:"name",value:e}),t}function l(e,t){for(var r=c(t),n=(t=(e=s.bigNumberify(e)).lt(o.Zero),(e=t?e.mul(o.NegativeOne):e).mod(r.tenPower).toString());n.length<r.decimals;)n="0"+n;return n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1],e=e.div(r.tenPower).toString()+"."+n,t?"-"+e:e}function h(e,t){var r=c(t=null==t?18:t);if("string"==typeof e&&e.match(/^-?[0-9.,]+$/)||a.throwError("invalid decimal value",a.INVALID_ARGUMENT,{arg:"value",value:e}),0===r.decimals)return s.bigNumberify(e);var n="-"===e.substring(0,1);"."===(e=n?e.substring(1):e)&&a.throwError("missing value",a.INVALID_ARGUMENT,{arg:"value",value:e}),2<(t=e.split(".")).length&&a.throwError("too many decimal points",a.INVALID_ARGUMENT,{arg:"value",value:e}),e=t[0];var i=t[1];for(e=e||"0",(i=i||"0").length>r.decimals&&a.throwError("underflow occurred",a.NUMERIC_FAULT,{operation:"division",fault:"underflow"});i.length<r.decimals;)i+="0";return t=s.bigNumberify(e),e=s.bigNumberify(i),e=t.mul(r.tenPower).add(e),n?e.mul(o.NegativeOne):e}i="1",["wei","kwei","Mwei","Gwei","szabo","finney","ether"].forEach((function(e){var t=f(i);u[e.toLowerCase()]=t,u[String(t.decimals)]=t,i+="000"})),r.commify=function(e){var t=String(e).split(".");(2<t.length||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&a.throwError("invalid value",a.INVALID_ARGUMENT,{argument:"value",value:e});var r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0"),e="",2===t.length&&(e="."+(t[1]||"0"));for(var i=[];r.length;){if(r.length<=3){i.unshift(r);break}var o=r.length-3;i.unshift(r.substring(o)),r=r.substring(0,o)}return n+i.join(",")+e},r.formatUnits=l,r.parseUnits=h,r.formatEther=function(e){return l(e,18)},r.parseEther=function(e){return h(e,18)}},{"../constants":3,"../errors":5,"./bignumber":63}],85:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../constants"),o=e("../errors"),a=e("./bytes");function s(e,t){(t=void 0===t?n.current:t)!=n.current&&(o.checkNormalize(),e=e.normalize(t));for(var r=[],i=0;i<e.length;i++){var s=e.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(63&s|128);else if(55296==(64512&s)){i++;var u=e.charCodeAt(i);if(i>=e.length||56320!=(64512&u))throw new Error("invalid utf-8 string");r.push((s=65536+((1023&s)<<10)+(1023&u))>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(63&s|128)}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(63&s|128)}return a.arrayify(r)}function u(e,t){e=a.arrayify(e);for(var r="",n=0;n<e.length;){var i=e[n++];if(i>>7){var o=null,s=null;if(192==(224&i))o=1,s=127;else if(224==(240&i))o=2,s=2047;else{if(240!=(248&i)){if(t)continue;if(128==(192&i))throw new Error("invalid utf8 byte sequence; unexpected continuation byte");throw new Error("invalid utf8 byte sequence; invalid prefix")}o=3,s=65535}if(n+o>e.length){if(!t)throw new Error("invalid utf8 byte sequence; too short");for(;n<e.length&&e[n]>>6==2;n++);}else{for(var u=i&(1<<8-o-1)-1,f=0;f<o;f++){var c=e[n];if(128!=(192&c)){u=null;break}u=u<<6|63&c,n++}if(null!==u)if(u<=s){if(!t)throw new Error("invalid utf8 byte sequence; overlong")}else if(1114111<u){if(!t)throw new Error("invalid utf8 byte sequence; out-of-range")}else if(55296<=u&&u<=57343){if(!t)throw new Error("invalid utf8 byte sequence; utf-16 surrogate")}else u<=65535?r+=String.fromCharCode(u):(u-=65536,r+=String.fromCharCode(55296+(u>>10&1023),56320+(1023&u)));else if(!t)throw new Error("invalid utf8 byte sequence; invalid continuation byte")}}else r+=String.fromCharCode(i)}return r}(e=n=r.UnicodeNormalizationForm||(r.UnicodeNormalizationForm={})).current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD",r.toUtf8Bytes=s,r.toUtf8String=u,r.formatBytes32String=function(e){if(31<(e=s(e)).length)throw new Error("bytes32 string must be less than 32 bytes");return a.hexlify(a.concat([e,i.HashZero]).slice(0,32))},r.parseBytes32String=function(e){var t=a.arrayify(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===t[r-1];)r--;return u(t.slice(0,r))}},{"../constants":3,"../errors":5,"./bytes":64}],86:[function(e,t,r){var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var i=e("xmlhttprequest"),o=e("./base64"),a=e("./properties"),s=e("./utf8"),u=n(e("../errors"));r.fetchJson=function(e,t,r){var n,a={},f=null,c=12e4;if("string"==typeof e)f=e;else if("object"==typeof e){if(null==e.url&&u.throwError("missing URL",u.MISSING_ARGUMENT,{arg:"url"}),f=e.url,"number"==typeof e.timeout&&0<e.timeout&&(c=e.timeout),e.headers)for(var l in e.headers)a[l.toLowerCase()]={key:l,value:String(e.headers[l])};null!=e.user&&null!=e.password&&("https:"!==f.substring(0,6)&&!0!==e.allowInsecure&&u.throwError("basic authentication requires a secure https url",u.INVALID_ARGUMENT,{arg:"url",url:f,user:e.user,password:"[REDACTED]"}),n=e.user+":"+e.password,a.authorization={key:"Authorization",value:"Basic "+o.encode(s.toUtf8Bytes(n))})}return new Promise((function(e,n){function o(){null!=u&&(clearTimeout(u),u=null)}var s=new i.XMLHttpRequest,u=null;u=setTimeout((function(){null!=u&&(u=null,n(new Error("timeout")),setTimeout((function(){s.abort()}),0))}),c),t?(s.open("POST",f,!0),a["content-type"]={key:"Content-Type",value:"application/json"}):s.open("GET",f,!0),Object.keys(a).forEach((function(e){e=a[e],s.setRequestHeader(e.key,e.value)})),s.onreadystatechange=function(){if(4===s.readyState){if(200!=s.status){o();var i=new Error("invalid response - "+s.status);return i.statusCode=s.status,s.responseText&&(i.responseText=s.responseText),void n(i)}var a=null;try{a=JSON.parse(s.responseText)}catch(i){o();var u=new Error("invalid json response");return u.orginialError=i,u.responseText=s.responseText,null!=t&&(u.requestBody=t),u.url=f,void n(u)}if(r)try{a=r(a)}catch(i){return o(),i.url=f,i.body=t,i.responseText=s.responseText,void n(i)}o(),e(a)}},s.onerror=function(e){o(),n(e)};try{null!=t?s.send(t):s.send()}catch(u){o();var l=new Error("connection error");l.error=u,n(l)}}))},r.poll=function(e,t){return t=t||{},null==(t=a.shallowCopy(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){var i=null,o=!1,a=function(){return!o&&(o=!0,i&&clearTimeout(i),!0)};t.timeout&&(i=setTimeout((function(){a()&&n(new Error("timeout"))}),t.timeout));var s=t.fastRetry||null,u=0;!function i(){return e().then((function(e){return void 0!==e?a()&&r(e):t.onceBlock?t.onceBlock.once("block",i):o||(u++,(e=(e=t.interval*parseInt(String(Math.random()*Math.pow(2,u))))<t.floor?t.floor:e)>t.ceiling&&(e=t.ceiling),s&&(u--,e=s,s=null),setTimeout(i,e)),null}),(function(e){a()&&n(e)}))}()}))}},{"../errors":5,"./base64":61,"./properties":74,"./utf8":85,xmlhttprequest:49}],87:[function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0});var t=e("../utils/hash"),r=e("../utils/properties");n.check=function(e){for(var r=[],n=0;n<2048;n++){var i=e.getWord(n);if(n!==e.getWordIndex(i))return"0x";r.push(i)}return t.id(r.join("\n")+"\n")};var i=(o.prototype.split=function(e){return e.toLowerCase().split(/ +/g)},o.prototype.join=function(e){return e.join(" ")},o);function o(e){r.defineReadOnly(this,"locale",e)}n.Wordlist=i,n.register=function(e,t){t=t||e.locale}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/hash":65,"../utils/properties":74}],88:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t};Object.defineProperty(r,"__esModule",{value:!0});var a,s=e("./utils/bytes"),u=e("./utils/hash"),f=e("./utils/hdnode"),c=e("./utils/json-wallet"),l=e("./utils/keccak256"),h=e("./utils/properties"),d=e("./utils/random-bytes"),p=o(e("./utils/secret-storage")),y=e("./utils/signing-key"),g=e("./utils/transaction"),b=e("./abstract-signer"),m=e("./providers/abstract-provider"),v=o(e("./errors"));function w(e,t){var r=a.call(this)||this;return v.checkNew(r,w),y.SigningKey.isSigningKey(e)?h.defineReadOnly(r,"signingKey",e):h.defineReadOnly(r,"signingKey",new y.SigningKey(e)),h.defineReadOnly(r,"provider",t),r}i(w,a=b.Signer),Object.defineProperty(w.prototype,"address",{get:function(){return this.signingKey.address},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"mnemonic",{get:function(){return this.signingKey.mnemonic},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"path",{get:function(){return this.signingKey.path},enumerable:!0,configurable:!0}),Object.defineProperty(w.prototype,"privateKey",{get:function(){return this.signingKey.privateKey},enumerable:!0,configurable:!0}),w.prototype.connect=function(e){return m.Provider.isProvider(e)||v.throwError("invalid provider",v.INVALID_ARGUMENT,{argument:"provider",value:e}),new w(this.signingKey,e)},w.prototype.getAddress=function(){return Promise.resolve(this.address)},w.prototype.sign=function(e){var t=this;return h.resolveProperties(e).then((function(e){var r=g.serialize(e);return r=t.signingKey.signDigest(l.keccak256(r)),g.serialize(e,r)}))},w.prototype.signMessage=function(e){return Promise.resolve(s.joinSignature(this.signingKey.signDigest(u.hashMessage(e))))},w.prototype.getBalance=function(e){if(!this.provider)throw new Error("missing provider");return this.provider.getBalance(this.address,e)},w.prototype.getTransactionCount=function(e){if(!this.provider)throw new Error("missing provider");return this.provider.getTransactionCount(this.address,e)},w.prototype.sendTransaction=function(e){var t=this;if(!this.provider)throw new Error("missing provider");return null==e.nonce&&((e=h.shallowCopy(e)).nonce=this.getTransactionCount("pending")),g.populateTransaction(e,this.provider,this.address).then((function(e){return t.sign(e).then((function(e){return t.provider.sendTransaction(e)}))}))},w.prototype.encrypt=function(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t=t||{},this.mnemonic&&((t=h.shallowCopy(t)).mnemonic=this.mnemonic,t.path=this.path),p.encrypt(this.privateKey,e,t,r)},w.createRandom=function(e){var t=d.randomBytes(16);return(e=e||{}).extraEntropy&&(t=s.arrayify(l.keccak256(s.concat([t,e.extraEntropy])).substring(0,34))),t=f.entropyToMnemonic(t,e.locale),w.fromMnemonic(t,e.path,e.locale)},w.fromEncryptedJson=function(e,t,r){if(c.isCrowdsaleWallet(e))try{r&&r(0);var n=p.decryptCrowdsale(e,t);return r&&r(1),Promise.resolve(new w(n))}catch(e){return Promise.reject(e)}else if(c.isSecretStorageWallet(e))return p.decrypt(e,t,r).then((function(e){return new w(e)}));return Promise.reject("invalid wallet JSON")},w.fromMnemonic=function(e,t,r){return t=t||f.defaultPath,new w(f.fromMnemonic(e,r).derivePath(t))},i=w,r.Wallet=i},{"./abstract-signer":2,"./errors":5,"./providers/abstract-provider":50,"./utils/bytes":64,"./utils/hash":65,"./utils/hdnode":66,"./utils/json-wallet":70,"./utils/keccak256":71,"./utils/properties":74,"./utils/random-bytes":75,"./utils/secret-storage":78,"./utils/signing-key":81,"./utils/transaction":83}],89:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),e=e("../wordlists/lang-en").langEn,r.en=e},{"../wordlists/lang-en":90}],90:[function(e,t,r){var n,i=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0});var o,a=e("../utils/wordlist"),s=null;function u(e){if(null==s&&(s="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==a.check(e)))throw s=null,new Error("BIP39 Wordlist for en (English) FAILED")}function f(){return o.call(this,"en")||this}i=new(i(f,o=a.Wordlist),f.prototype.getWord=function(e){return u(this),s[e]},f.prototype.getWordIndex=function(e){return u(this),s.indexOf(e)},f),r.langEn=i,a.register(i)},{"../utils/wordlist":87}]},{},[7])(7)},718:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=718,e.exports=t},3184:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,u=[],f=!1,c=-1;function l(){f&&s&&(f=!1,s.length?u=s.concat(u):c=-1,u.length&&h())}function h(){if(!f){var e=a(l);f=!0;for(var t=u.length;t;){for(s=u,u=[];++c<t;)s&&s[c].run();c=-1,t=u.length}s=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new d(e,t)),1!==u.length||f||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},8460:()=>{},2382:()=>{},3779:()=>{},7199:()=>{},8772:(e,t,r)=>{r.d(t,{Vy:()=>fe});var n={d:(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},i={};n.d(i,{q$:()=>se,Vy:()=>ue,$7:()=>o,rE:()=>a});var o={};n.r(o),n.d(o,{DebugLevel:()=>se,Logger:()=>ue,version:()=>a});var a="1.0.1";function s(e,t){e=e.replace("#","");var r=parseInt(e,16),n=Math.round(2.55*t),i=(r>>16)+n,o=(r>>8&255)+n,a=(255&r)+n;return(16777216+65536*(i<255?i<1?0:i:255)+256*(o<255?o<1?0:o:255)+(a<255?a<1?0:a:255)).toString(16).slice(1)}const u=(e=0)=>t=>`[${t+e}m`,f=(e=0)=>t=>`[${38+e};5;${t}m`,c=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(l.modifier),Object.keys(l.color),Object.keys(l.bgColor);const h=function(){const e=new Map;for(const[t,r]of Object.entries(l)){for(const[t,n]of Object.entries(r))l[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=l[t],e.set(n[0],n[1]);Object.defineProperty(l,t,{value:r,enumerable:!1})}return Object.defineProperty(l,"codes",{value:e,enumerable:!1}),l.color.close="",l.bgColor.close="",l.color.ansi=u(),l.color.ansi256=f(),l.color.ansi16m=c(),l.bgColor.ansi=u(10),l.bgColor.ansi256=f(10),l.bgColor.ansi16m=c(10),Object.defineProperties(l,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map((e=>e+e)).join(""));const n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>l.rgbToAnsi256(...l.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const i=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(i/6)/5,n=i%6/5}const i=2*Math.max(t,r,n);if(0===i)return 30;let o=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===i&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>l.ansi256ToAnsi(l.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>l.ansi256ToAnsi(l.hexToAnsi256(e)),enumerable:!1}}),l}(),d=(()=>{if(navigator.userAgentData){const e=navigator.userAgentData.brands.find((({brand:e})=>"Chromium"===e));if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(navigator.userAgent)?1:0})(),p=0!==d&&{level:d,hasBasic:!0,has256:d>=2,has16m:d>=3},y={stdout:p,stderr:p};function g(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const i=t.length;let o=0,a="";do{a+=e.slice(o,n)+t+r,o=n+i,n=e.indexOf(t,o)}while(-1!==n);return a+=e.slice(o),a}const{stdout:b,stderr:m}=y,v=Symbol("GENERATOR"),w=Symbol("STYLER"),_=Symbol("IS_EMPTY"),E=["ansi","ansi","ansi256","ansi16m"],S=Object.create(null);class k{constructor(e){return T(e)}}const T=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=b?b.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,A.prototype),t};function A(e){return T(e)}Object.setPrototypeOf(A.prototype,Function.prototype);for(const[e,t]of Object.entries(h))S[e]={get(){const r=M(this,x(t.open,t.close,this[w]),this[_]);return Object.defineProperty(this,e,{value:r}),r}};S.visible={get(){const e=M(this,this[w],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const P=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?h[r].ansi16m(...n):"ansi256"===t?h[r].ansi256(h.rgbToAnsi256(...n)):h[r].ansi(h.rgbToAnsi(...n)):"hex"===e?P("rgb",t,r,...h.hexToRgb(...n)):h[r][e](...n),I=["rgb","hex","ansi256"];for(const e of I)S[e]={get(){const{level:t}=this;return function(...r){const n=x(P(e,E[t],"color",...r),h.color.close,this[w]);return M(this,n,this[_])}}},S["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=x(P(e,E[t],"bgColor",...r),h.bgColor.close,this[w]);return M(this,n,this[_])}}};const O=Object.defineProperties((()=>{}),{...S,level:{enumerable:!0,get(){return this[v].level},set(e){this[v].level=e}}}),x=(e,t,r)=>{let n,i;return void 0===r?(n=e,i=t):(n=r.openAll+e,i=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:i,parent:r}},M=(e,t,r)=>{const n=(...e)=>N(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,O),n[v]=e,n[w]=t,n[_]=r,n},N=(e,t)=>{if(e.level<=0||!t)return e[_]?"":t;let r=e[w];if(void 0===r)return t;const{openAll:n,closeAll:i}=r;if(t.includes(""))for(;void 0!==r;)t=g(t,r.close,r.open),r=r.parent;const o=t.indexOf("\n");return-1!==o&&(t=function(e,t,r,n){let i=0,o="";do{const a="\r"===e[n-1];o+=e.slice(i,a?n-1:n)+t+(a?"\r\n":"\n")+r,i=n+1,n=e.indexOf("\n",i)}while(-1!==n);return o+=e.slice(i),o}(t,i,n,o)),n+t+i};function R(e){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(e)}function B(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function C(e,t,r){return(t=L(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(e){var t=function(e,t){if("object"!=R(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function U(e,t){return e.get(function(e,t,r){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:r;throw new TypeError("Private element is not present on this object")}(e,t))}Object.defineProperties(A.prototype,S),A(),A({level:m?m.level:0});var D=new WeakMap,j=new WeakMap,H=new WeakMap,F=new WeakMap,K=new WeakMap,G=new WeakMap,V=new WeakMap,z=new WeakMap,W=new WeakMap,q=new WeakMap,X=new WeakMap,$=new WeakMap,Z=new WeakMap,Y=new WeakMap,J=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new k;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),C(this,"chalk",void 0),C(this,"moduleName",""),C(this,"logColor","#00bfff"),C(this,"enableLogs",!0),C(this,"hideLogs",!1),B(this,D,"#ff00ff"),B(this,j,s(U(D,this),75)),B(this,H,"#9400d3"),B(this,F,s(U(H,this),15)),B(this,K,s(U(F,this),15)),B(this,G,"#7cfc00"),B(this,V,s(U(G,this),15)),B(this,z,"#ffdead"),B(this,W,s(U(z,this),15)),B(this,q,"#ff8c00"),B(this,X,s(U(q,this),15)),B(this,$,"#ff4500"),B(this,Z,s(U($,this),15)),B(this,Y,"#ffffff"),B(this,J,s(U(Y,this),15)),B(this,Q,"#8b0000"),B(this,ee,s(U(Q,this),15)),C(this,"prefix",""),this.chalk=t,this.moduleName=this.constructor.name},t=[{key:"setLogPrefix",value:function(e){this.prefix=e}},{key:"getStartPrefix",value:function(){return this.prefix}},{key:"disable",value:function(){this.enableLogs=!1}},{key:"enable",value:function(){this.enableLogs=!0}},{key:"fancyLog",value:function(e,t,r,n,i){this.enableLogs&&console.log(this.chalk.hex(U(D,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(U(Y,this))(e)+" "+this.chalk.hex(U(X,this))(t)+" "+this.chalk.hex(U(Y,this))(r)+" "+this.chalk.hex(U(K,this))(n)+" "+this.chalk.hex(U(Y,this))(i))}},{key:"log",value:function(){if(this.enableLogs&&!this.hideLogs){var e=s(this.logColor,15);console.log(this.chalk.hex(this.logColor)("".concat(this.getStartPrefix(),"[").concat(this.moduleName," LOG]: "))+this.chalk.hex(e).apply(void 0,arguments))}}},{key:"lightOrangeLog",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(X,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," LOG]: "))+this.chalk.hex(U(Y,this)).apply(void 0,arguments)))}},{key:"error",value:function(){this.enableLogs&&console.log(this.chalk.hex(U($,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," ERROR]: "))+this.chalk.hex(U(Z,this)).apply(void 0,arguments))}},{key:"warn",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(q,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," WARN]: "))+this.chalk.hex(U(X,this)).apply(void 0,arguments))}},{key:"debug",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(z,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(U(W,this)).apply(void 0,arguments)))}},{key:"success",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(G,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," SUCCESS]: "))+this.chalk.hex(U(V,this)).apply(void 0,arguments)))}},{key:"fail",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U($,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," FAIL]: "))+this.chalk.hex(U(Z,this)).apply(void 0,arguments)))}},{key:"debugBright",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(U(H,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(U(F,this)).apply(void 0,arguments)))}},{key:"important",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(D,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," IMPORTANT]: "))+this.chalk.hex(U(j,this)).apply(void 0,arguments))}},{key:"panic",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(Q,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," HELP PANIC]: "))+this.chalk.hex(U(ee,this)).apply(void 0,arguments))}},{key:"info",value:function(){this.enableLogs&&console.log(this.chalk.hex(U(D,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(U(Y,this)).apply(void 0,arguments))}},{key:"securityNotice",value:function(){this.enableLogs&&console.log(this.chalk.hex("#22d8e6")("".concat(this.getStartPrefix(),"[").concat(this.moduleName," SECURITY NOTICE]: "))+this.chalk.hex("#22e3e6").apply(void 0,arguments))}},{key:"traceLog",value:function(){this.enableLogs&&console.log(this.chalk.hex("#ffffff")("".concat(this.getStartPrefix(),"[").concat(this.moduleName," TRACE LOG]: "))+this.chalk.hex(U(J,this)).apply(void 0,arguments))}}],t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,L(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function re(e){return re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},re(e)}function ne(e,t,r){return t=oe(t),function(e,t){if(t&&("object"===re(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,ie()?Reflect.construct(t,r||[],oe(e).constructor):t.apply(e,r))}function ie(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ie=function(){return!!e})()}function oe(e){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oe(e)}function ae(e,t){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ae(e,t)}var se,ue=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ne(this,t)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ae(e,t)}(t,te),r=t,Object.defineProperty(r,"prototype",{writable:!1}),r;var r}();!function(e){e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e[e.TRACE=5]="TRACE",e[e.ALL=6]="ALL"}(se||(se={}));var fe=i.Vy},9004:(e,t,r)=>{function n(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function i(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}r.d(t,{n1:()=>K});const o=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),a=(e,t)=>e<<32-t|e>>>t;function s(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),n(e),e}new Uint8Array(new Uint32Array([287454020]).buffer)[0];class u{clone(){return this._cloneInto()}}function f(e){const t=t=>e().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}const c=(e,t,r)=>e&t^e&r^t&r;class l extends u{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=o(this.buffer)}update(e){i(this);const{view:t,buffer:r,blockLen:n}=this,a=(e=s(e)).length;for(let i=0;i<a;){const s=Math.min(n-this.pos,a-i);if(s!==n)r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=o(e);for(;n<=a-i;i+=n)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){i(this),function(e,t){n(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:a,isLE:s}=this;let{pos:u}=this;t[u++]=128,this.buffer.subarray(u).fill(0),this.padOffset>a-u&&(this.process(r,0),u=0);for(let e=u;e<a;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),u=n?4:0,f=n?0:4;e.setUint32(t+u,a,n),e.setUint32(t+f,s,n)}(r,a-8,BigInt(8*this.length),s),this.process(r,0);const f=o(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)f.setUint32(4*e,h[e],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const h=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),d=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),p=new Uint32Array(64);class y extends l{constructor(){super(64,32,8,!1),this.A=0|d[0],this.B=0|d[1],this.C=0|d[2],this.D=0|d[3],this.E=0|d[4],this.F=0|d[5],this.G=0|d[6],this.H=0|d[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)p[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=p[e-15],r=p[e-2],n=a(t,7)^a(t,18)^t>>>3,i=a(r,17)^a(r,19)^r>>>10;p[e]=i+p[e-7]+n+p[e-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:u,G:f,H:l}=this;for(let e=0;e<64;e++){const t=l+(a(s,6)^a(s,11)^a(s,25))+((d=s)&u^~d&f)+h[e]+p[e]|0,y=(a(r,2)^a(r,13)^a(r,22))+c(r,n,i)|0;l=f,f=u,u=s,s=o+t|0,o=i,i=n,n=r,r=t+y|0}var d;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,u=u+this.F|0,f=f+this.G|0,l=l+this.H|0,this.set(r,n,i,o,s,u,f,l)}roundClean(){p.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const g=f((()=>new y)),b=BigInt(2**32-1),m=BigInt(32);function v(e,t=!1){return t?{h:Number(e&b),l:Number(e>>m&b)}:{h:0|Number(e>>m&b),l:0|Number(e&b)}}const w=function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:a}=v(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]},_=(e,t,r)=>e>>>r,E=(e,t,r)=>e<<32-r|t>>>r,S=(e,t,r)=>e>>>r|t<<32-r,k=(e,t,r)=>e<<32-r|t>>>r,T=(e,t,r)=>e<<64-r|t>>>r-32,A=(e,t,r)=>e>>>r-32|t<<64-r,P=function(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},I=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),O=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,x=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),M=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,N=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,R=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),[B,C]=(()=>w(["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((e=>BigInt(e)))))(),L=new Uint32Array(80),U=new Uint32Array(80);class D extends l{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:a,Dl:s,Eh:u,El:f,Fh:c,Fl:l,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y]}set(e,t,r,n,i,o,a,s,u,f,c,l,h,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|f,this.Fh=0|c,this.Fl=0|l,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)L[r]=e.getUint32(t),U[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|L[e-15],r=0|U[e-15],n=S(t,r,1)^S(t,r,8)^_(t,r,7),i=k(t,r,1)^k(t,r,8)^E(t,r,7),o=0|L[e-2],a=0|U[e-2],s=S(o,a,19)^T(o,a,61)^_(o,a,6),u=k(o,a,19)^A(o,a,61)^E(o,a,6),f=x(i,u,U[e-7],U[e-16]),c=M(f,n,s,L[e-7],L[e-16]);L[e]=0|c,U[e]=0|f}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:a,Cl:s,Dh:u,Dl:f,Eh:c,El:l,Fh:h,Fl:d,Gh:p,Gl:y,Hh:g,Hl:b}=this;for(let e=0;e<80;e++){const t=S(c,l,14)^S(c,l,18)^T(c,l,41),m=k(c,l,14)^k(c,l,18)^A(c,l,41),v=c&h^~c&p,w=R(b,m,l&d^~l&y,C[e],U[e]),_=N(w,g,t,v,B[e],L[e]),E=0|w,x=S(r,n,28)^T(r,n,34)^T(r,n,39),M=k(r,n,28)^A(r,n,34)^A(r,n,39),D=r&i^r&a^i&a,j=n&o^n&s^o&s;g=0|p,b=0|y,p=0|h,y=0|d,h=0|c,d=0|l,({h:c,l}=P(0|u,0|f,0|_,0|E)),u=0|a,f=0|s,a=0|i,s=0|o,i=0|r,o=0|n;const H=I(E,M,j);r=O(H,_,x,D),n=0|H}({h:r,l:n}=P(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=P(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=P(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:f}=P(0|this.Dh,0|this.Dl,0|u,0|f)),({h:c,l}=P(0|this.Eh,0|this.El,0|c,0|l)),({h,l:d}=P(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=P(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=P(0|this.Hh,0|this.Hl,0|g,0|b)),this.set(r,n,i,o,a,s,u,f,c,l,h,d,p,y,g,b)}roundClean(){L.fill(0),U.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const j=f((()=>new D));var H=r(1324),F=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}();function K(e){switch(e){case"sha256":return g.create();case"sha512":return j.create()}(0,H.assertArgument)(!1,"invalid hashing algorithm name","algorithm",e)}F.crypto||F.msCrypto},6647:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.r(t),r.d(t,{__initializeContext:()=>O,isPoint:()=>x,isPointCompressed:()=>M,isPrivate:()=>R,isXOnlyPoint:()=>N,pointAdd:()=>B,pointAddScalar:()=>C,pointCompress:()=>L,pointFromScalar:()=>U,pointMultiply:()=>H,privateAdd:()=>F,privateNegate:()=>G,privateSub:()=>K,recover:()=>Z,sign:()=>W,signRecoverable:()=>q,signSchnorr:()=>X,verify:()=>$,verifySchnorr:()=>Y,xOnlyPointAddTweak:()=>V,xOnlyPointAddTweakCheck:()=>z,xOnlyPointFromPoint:()=>j,xOnlyPointFromScalar:()=>D});var i=r(5005),o=r(6597),a=r(3423),s=e([a]);a=(s.then?(await s)():s)[0];const u=new Uint8Array(a.A.memory.buffer),f=a.A.PRIVATE_INPUT.value,c=a.A.PUBLIC_KEY_INPUT.value,l=a.A.PUBLIC_KEY_INPUT2.value,h=a.A.X_ONLY_PUBLIC_KEY_INPUT.value,d=a.A.X_ONLY_PUBLIC_KEY_INPUT2.value,p=a.A.TWEAK_INPUT.value,y=a.A.HASH_INPUT.value,g=a.A.EXTRA_DATA_INPUT.value,b=a.A.SIGNATURE_INPUT.value,m=u.subarray(f,f+o.uS),v=u.subarray(c,c+o.Lv),w=u.subarray(l,l+o.Lv),_=u.subarray(h,h+o.Sl),E=u.subarray(d,d+o.Sl),S=u.subarray(p,p+o.jp),k=u.subarray(y,y+o.Ts),T=u.subarray(g,g+o.C9),A=u.subarray(b,b+o.JZ);function P(e,t){return void 0===e?void 0!==t?t.length:o.Ah:e?o.Ah:o.Lv}function I(e){try{return v.set(e),1===a.A.isPoint(e.length)}finally{v.fill(0)}}function O(){a.A.initializeContext()}function x(e){return o._n(e)&&I(e)}function M(e){return o.uE(e)&&I(e)}function N(e){return o.xm(e)&&I(e)}function R(e){return o.Gw(e)}function B(e,t,r){o.j4(e),o.j4(t);const n=P(r,e);try{return v.set(e),w.set(t),1===a.A.pointAdd(e.length,t.length,n)?v.slice(0,n):null}finally{v.fill(0),w.fill(0)}}function C(e,t,r){o.j4(e),o.ZO(t);const n=P(r,e);try{return v.set(e),S.set(t),1===a.A.pointAddScalar(e.length,n)?v.slice(0,n):null}finally{v.fill(0),S.fill(0)}}function L(e,t){o.j4(e);const r=P(t,e);try{return v.set(e),a.A.pointCompress(e.length,r),v.slice(0,r)}finally{v.fill(0)}}function U(e,t){o.w6(e);const r=P(t);try{return m.set(e),1===a.A.pointFromScalar(r)?v.slice(0,r):null}finally{m.fill(0),v.fill(0)}}function D(e){o.w6(e);try{return m.set(e),a.A.xOnlyPointFromScalar(),_.slice(0,o.Sl)}finally{m.fill(0),_.fill(0)}}function j(e){o.j4(e);try{return v.set(e),a.A.xOnlyPointFromPoint(e.length),_.slice(0,o.Sl)}finally{v.fill(0),_.fill(0)}}function H(e,t,r){o.j4(e),o.ZO(t);const n=P(r,e);try{return v.set(e),S.set(t),1===a.A.pointMultiply(e.length,n)?v.slice(0,n):null}finally{v.fill(0),S.fill(0)}}function F(e,t){o.w6(e),o.ZO(t);try{return m.set(e),S.set(t),1===a.A.privateAdd()?m.slice(0,o.uS):null}finally{m.fill(0),S.fill(0)}}function K(e,t){if(o.w6(e),o.ZO(t),o.be(t))return new Uint8Array(e);try{return m.set(e),S.set(t),1===a.A.privateSub()?m.slice(0,o.uS):null}finally{m.fill(0),S.fill(0)}}function G(e){o.w6(e);try{return m.set(e),a.A.privateNegate(),m.slice(0,o.uS)}finally{m.fill(0)}}function V(e,t){o.L6(e),o.ZO(t);try{_.set(e),S.set(t);const r=a.A.xOnlyPointAddTweak();return-1!==r?{parity:r,xOnlyPubkey:_.slice(0,o.Sl)}:null}finally{_.fill(0),S.fill(0)}}function z(e,t,r,n){o.L6(e),o.L6(r),o.ZO(t);const s=void 0!==n;s&&o.Iq(n);try{if(_.set(e),E.set(r),S.set(t),s)return 1===a.A.xOnlyPointAddTweakCheck(n);{a.A.xOnlyPointAddTweak();const e=_.slice(0,o.Sl);return 0===(0,i.UD)(e,r)}}finally{_.fill(0),E.fill(0),S.fill(0)}}function W(e,t,r){o.Fd(e),o.w6(t),o.F1(r);try{return k.set(e),m.set(t),void 0!==r&&T.set(r),a.A.sign(void 0===r?0:1),A.slice(0,o.JZ)}finally{k.fill(0),m.fill(0),void 0!==r&&T.fill(0),A.fill(0)}}function q(e,t,r){o.Fd(e),o.w6(t),o.F1(r);try{k.set(e),m.set(t),void 0!==r&&T.set(r);const n=a.A.signRecoverable(void 0===r?0:1);return{signature:A.slice(0,o.JZ),recoveryId:n}}finally{k.fill(0),m.fill(0),void 0!==r&&T.fill(0),A.fill(0)}}function X(e,t,r){o.Fd(e),o.w6(t),o.F1(r);try{return k.set(e),m.set(t),void 0!==r&&T.set(r),a.A.signSchnorr(void 0===r?0:1),A.slice(0,o.JZ)}finally{k.fill(0),m.fill(0),void 0!==r&&T.fill(0),A.fill(0)}}function $(e,t,r,n=!1){o.Fd(e),o.j4(t),o.fK(r);try{return k.set(e),v.set(t),A.set(r),1===a.A.verify(t.length,!0===n?1:0)}finally{k.fill(0),v.fill(0),A.fill(0)}}function Z(e,t,r,n=!1){o.Fd(e),o.fK(t),o.tT(t),2&r&&o.ML(t),o.Mf((()=>N(t.subarray(0,32))));const i=P(n);try{return k.set(e),A.set(t),1===a.A.recover(i,r)?v.slice(0,i):null}finally{k.fill(0),A.fill(0),v.fill(0)}}function Y(e,t,r){o.Fd(e),o.L6(t),o.fK(r);try{return k.set(e),_.set(t),A.set(r),1===a.A.verifySchnorr()}finally{k.fill(0),_.fill(0),A.fill(0)}}n()}catch(J){n(J)}}))},4086:(e,t,r)=>{function n(){const e=function(){const e=new Uint8Array(4);if("undefined"==typeof crypto)throw new Error("The crypto object is unavailable. This may occur if your environment does not support the Web Cryptography API.");return crypto.getRandomValues(e),e}();return(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3]}r.d(t,{q:()=>n})},6597:(e,t,r)=>{r.d(t,{Ah:()=>o,C9:()=>c,F1:()=>I,Fd:()=>P,Gw:()=>m,Iq:()=>E,JZ:()=>l,L6:()=>T,Lv:()=>a,ML:()=>N,Mf:()=>x,Sl:()=>s,Ts:()=>f,ZO:()=>A,_n:()=>w,be:()=>b,fK:()=>O,j4:()=>k,jp:()=>u,tT:()=>M,uE:()=>_,uS:()=>i,w6:()=>S,xm:()=>v});var n=r(6924);const i=32,o=33,a=65,s=32,u=32,f=32,c=32,l=64,h=new Uint8Array(32),d=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65]),p=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,69,81,35,25,80,183,95,196,64,45,161,114,47,201,186,238]);function y(e){return e instanceof Uint8Array}function g(e,t){for(let r=0;r<32;++r)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function b(e){return 0===g(e,h)}function m(e){return y(e)&&e.length===i&&g(e,h)>0&&g(e,d)<0}function v(e){return y(e)&&e.length===s}function w(e){return y(e)&&(e.length===o||e.length===a)}function _(e){return y(e)&&e.length===o}function E(e){0!==e&&1!==e&&(0,n.$8)(n.H_)}function S(e){m(e)||(0,n.$8)(n.hK)}function k(e){(function(e){return y(e)&&(e.length===o||e.length===a||e.length===s)})(e)||(0,n.$8)(n.Md)}function T(e){v(e)||(0,n.$8)(n.Md)}function A(e){(function(e){return y(e)&&e.length===u&&g(e,d)<0})(e)||(0,n.$8)(n._1)}function P(e){(function(e){return y(e)&&e.length===f})(e)||(0,n.$8)(n.EW)}function I(e){(function(e){return void 0===e||y(e)&&e.length===c})(e)||(0,n.$8)(n.pA)}function O(e){(function(e){return y(e)&&64===e.length&&g(e.subarray(0,32),d)<0&&g(e.subarray(32,64),d)<0})(e)||(0,n.$8)(n.u4)}function x(e){e()||(0,n.$8)(n.u4)}function M(e){b(e.subarray(0,32))&&(0,n.$8)(n.u4),b(e.subarray(32,64))&&(0,n.$8)(n.u4)}function N(e){(function(e){return y(e)&&64===e.length&&g(e.subarray(0,32),p)<0})(e)||(0,n.$8)(n.bU)}},6924:(e,t,r)=>{r.d(t,{$8:()=>h,EW:()=>a,H_:()=>f,Md:()=>i,_1:()=>o,bU:()=>c,hK:()=>n,pA:()=>u,u4:()=>s});const n=0,i=1,o=2,a=3,s=4,u=5,f=6,c=7,l={[n.toString()]:"Expected Private",[i.toString()]:"Expected Point",[o.toString()]:"Expected Tweak",[a.toString()]:"Expected Hash",[s.toString()]:"Expected Signature",[u.toString()]:"Expected Extra Data (32 bytes)",[f.toString()]:"Expected Parity (1 | 0)",[c.toString()]:"Bad Recovery Id"};function h(e){const t=l[e.toString()]||`Unknow error code: ${e}`;throw new TypeError(t)}},3423:(e,t,r)=>{r.a(e,(async(e,n)=>{try{r.d(t,{A:()=>a});var i=r(5598),o=e([i]);const a=i=(o.then?(await o)():o)[0];n()}catch(e){n(e)}}))},5005:(e,t,r)=>{r.d(t,{UD:()=>i});const n="0123456789abcdefABCDEF";function i(e,t){const r=Math.min(e.length,t.length);for(let n=0;n<r;++n)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return e.length===t.length?0:e.length>t.length?1:-1}n.split("").map((e=>e.codePointAt(0))),Array(256).fill(!0).map(((e,t)=>{const r=String.fromCodePoint(t),i=n.indexOf(r);return i<0?void 0:i<16?i:i-6})),new TextEncoder,new TextDecoder("ascii")},5598:(e,t,r)=>{var n=r(4086),i=r(6924);e.exports=r.v(t,e.id,"873e754d6c7c6e9361f1",{"./rand.js":{generateInt32:n.q},"./validate_error.js":{throwError:i.$8}})}},o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={id:e,exports:{}};return i[e](r,r.exports,a),r.exports}e="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",t="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",r="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",n=e=>{e&&e.d<1&&(e.d=1,e.forEach((e=>e.r--)),e.forEach((e=>e.r--?e.r++:e())))},a.a=(i,o,a)=>{var s;a&&((s=[]).d=-1);var u,f,c,l=new Set,h=i.exports,d=new Promise(((e,t)=>{c=t,f=e}));d[t]=h,d[e]=e=>(s&&e(s),l.forEach(e),d.catch((e=>{}))),i.exports=d,o((i=>{var o;u=(i=>i.map((i=>{if(null!==i&&"object"==typeof i){if(i[e])return i;if(i.then){var o=[];o.d=0,i.then((e=>{a[t]=e,n(o)}),(e=>{a[r]=e,n(o)}));var a={};return a[e]=e=>e(o),a}}var s={};return s[e]=e=>{},s[t]=i,s})))(i);var a=()=>u.map((e=>{if(e[r])throw e[r];return e[t]})),f=new Promise((t=>{(o=()=>t(a)).r=0;var r=e=>e!==s&&!l.has(e)&&(l.add(e),e&&!e.d&&(o.r++,e.push(o)));u.map((t=>t[e](r)))}));return o.r?f:a()}),(e=>(e?c(d[r]=e):f(h),n(s)))),s&&s.d<0&&(s.d=0)},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.v=(e,t,r,n)=>{var i=fetch(a.p+""+r+".module.wasm"),o=()=>i.then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,n))).then((t=>Object.assign(e,t.instance.exports)));return i.then((t=>"function"==typeof WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,n).then((t=>Object.assign(e,t.instance.exports)),(e=>{if("application/wasm"!==t.headers.get("Content-Type"))return console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",e),o();throw e})):o()))},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})();var s=a(4317),u=(s=await s).iy,f=s.G7,c=s.GF,l=s.wf,h=s.P8,d=s.z4,p=s.kd,y=s.cC,g=s.Wj,b=s.Bc,m=s.tm,v=s.Qc,w=s.dF,_=s.D_,E=s.aS,S=s.y4,k=s.uW,T=s.$7,A=s.rE,P=s.rR;export{u as AddressGenerator,f as BitcoinUtils,c as CalldataGenerator,l as Compressor,h as ContractBaseMetadata,d as DeploymentGenerator,p as EcKeyPair,y as FundingTransaction,g as Generator,b as InteractionTransaction,m as TapscriptVerificator,v as TransactionBuilder,w as TransactionFactory,_ as TransactionType,E as TweakedSigner,S as UTXOManager,k as Wallet,T as opnet,A as version,P as wBTC};