@btc-vision/transaction 1.0.7 → 1.0.8

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 (137) hide show
  1. package/Deploy.md +186 -0
  2. package/README.md +5 -0
  3. package/Wrap.md +192 -0
  4. package/browser/_version.d.ts +1 -1
  5. package/browser/index.js +1 -1
  6. package/browser/opnet.d.ts +6 -1
  7. package/browser/tests/deploy.d.ts +1 -0
  8. package/browser/tests/wrap.d.ts +1 -0
  9. package/browser/tests/wrapTest.d.ts +1 -0
  10. package/browser/transaction/TransactionFactory.d.ts +15 -1
  11. package/browser/transaction/builders/DeploymentTransaction.d.ts +40 -0
  12. package/browser/transaction/builders/InteractionTransaction.d.ts +2 -35
  13. package/browser/transaction/builders/SharedInteractionTransaction.d.ts +46 -0
  14. package/browser/transaction/builders/TransactionBuilder.d.ts +8 -1
  15. package/browser/transaction/builders/WrapTransaction.d.ts +27 -0
  16. package/browser/transaction/interfaces/ITransactionParameters.d.ts +16 -12
  17. package/browser/utils/BitcoinUtils.d.ts +1 -0
  18. package/browser/utxo/OPNetLimitedProvider.d.ts +10 -0
  19. package/browser/wbtc/Generate.d.ts +13 -0
  20. package/browser/wbtc/WrappedGenerationParameters.d.ts +11 -0
  21. package/build/_version.d.ts +1 -1
  22. package/build/_version.js +1 -1
  23. package/build/opnet.d.ts +6 -1
  24. package/build/opnet.js +6 -1
  25. package/build/tests/deploy.d.ts +1 -0
  26. package/build/tests/deploy.js +60 -0
  27. package/build/tests/test.js +3 -3
  28. package/build/tests/transfer.js +2 -2
  29. package/build/tests/wrap.d.ts +1 -0
  30. package/build/tests/wrap.js +64 -0
  31. package/build/tests/wrapTest.d.ts +1 -0
  32. package/build/tests/wrapTest.js +64 -0
  33. package/build/tests/wrapTestg.d.ts +1 -0
  34. package/build/tests/wrapTestg.js +66 -0
  35. package/build/transaction/TransactionFactory.d.ts +15 -1
  36. package/build/transaction/TransactionFactory.js +68 -0
  37. package/build/transaction/builders/DeploymentTransaction.d.ts +40 -0
  38. package/build/transaction/builders/DeploymentTransaction.js +216 -0
  39. package/build/transaction/builders/FundingTransaction.js +4 -1
  40. package/build/transaction/builders/InteractionTransaction.d.ts +2 -35
  41. package/build/transaction/builders/InteractionTransaction.js +4 -207
  42. package/build/transaction/builders/SharedInteractionTransaction.d.ts +46 -0
  43. package/build/transaction/builders/SharedInteractionTransaction.js +213 -0
  44. package/build/transaction/builders/TransactionBuilder.d.ts +8 -1
  45. package/build/transaction/builders/TransactionBuilder.js +19 -11
  46. package/build/transaction/builders/WrapTransaction.d.ts +27 -0
  47. package/build/transaction/builders/WrapTransaction.js +132 -0
  48. package/build/transaction/interfaces/ITransactionParameters.d.ts +16 -12
  49. package/build/utils/BitcoinUtils.d.ts +1 -0
  50. package/build/utils/BitcoinUtils.js +7 -0
  51. package/build/utxo/OPNetLimitedProvider.d.ts +10 -0
  52. package/build/utxo/OPNetLimitedProvider.js +85 -0
  53. package/build/utxo/OPNetUtils.d.ts +7 -0
  54. package/build/utxo/OPNetUtils.js +47 -0
  55. package/build/verification/TapscriptVerificator.js +3 -3
  56. package/build/wbtc/Generate.d.ts +13 -0
  57. package/build/wbtc/Generate.js +1 -0
  58. package/build/wbtc/WrappedGenerationParameters.d.ts +11 -0
  59. package/build/wbtc/WrappedGenerationParameters.js +16 -0
  60. package/bytecode/contract.wasm +0 -0
  61. package/docs/assets/navigation.js +1 -1
  62. package/docs/assets/search.js +1 -1
  63. package/docs/classes/AddressGenerator.html +2 -2
  64. package/docs/classes/BitcoinUtils.html +7 -3
  65. package/docs/classes/CalldataGenerator.html +10 -10
  66. package/docs/classes/Compressor.html +4 -4
  67. package/docs/classes/ContractBaseMetadata.html +4 -4
  68. package/docs/classes/DeploymentGenerator.html +9 -9
  69. package/docs/classes/DeploymentTransaction.html +368 -0
  70. package/docs/classes/EcKeyPair.html +16 -16
  71. package/docs/classes/FundingTransaction.html +50 -47
  72. package/docs/classes/Generator.html +9 -9
  73. package/docs/classes/InteractionTransaction.html +89 -109
  74. package/docs/classes/OPNetLimitedProvider.html +197 -0
  75. package/docs/classes/SharedInteractionTransaction.html +392 -0
  76. package/docs/classes/TapscriptVerificator.html +2 -2
  77. package/docs/classes/TransactionBuilder.html +53 -50
  78. package/docs/classes/TransactionFactory.html +11 -4
  79. package/docs/classes/TweakedSigner.html +2 -2
  80. package/docs/classes/Wallet.html +10 -10
  81. package/docs/classes/WrapTransaction.html +404 -0
  82. package/docs/classes/WrappedGeneration.html +187 -0
  83. package/docs/classes/wBTC.html +7 -7
  84. package/docs/enums/TransactionSequence.html +177 -0
  85. package/docs/enums/TransactionType.html +2 -2
  86. package/docs/hierarchy.html +1 -1
  87. package/docs/index.html +3 -1
  88. package/docs/interfaces/ContractAddressVerificationParams.html +2 -2
  89. package/docs/interfaces/DeploymentResult.html +177 -0
  90. package/docs/interfaces/FetchUTXOParams.html +2 -2
  91. package/docs/interfaces/GenerationConstraints.html +182 -0
  92. package/docs/interfaces/IDeploymentParameters.html +183 -0
  93. package/docs/interfaces/IFundingTransactionParameters.html +3 -3
  94. package/docs/interfaces/IInteractionParameters.html +4 -6
  95. package/docs/interfaces/ITransactionParameters.html +3 -3
  96. package/docs/interfaces/IWallet.html +4 -4
  97. package/docs/interfaces/IWrapParameters.html +186 -0
  98. package/docs/interfaces/NetworkInformation.html +2 -2
  99. package/docs/interfaces/PsbtInputExtended.html +1 -1
  100. package/docs/interfaces/PsbtOutputExtendedAddress.html +2 -2
  101. package/docs/interfaces/PsbtOutputExtendedScript.html +2 -2
  102. package/docs/interfaces/RawUTXOResponse.html +2 -2
  103. package/docs/interfaces/SharedInteractionParameters.html +183 -0
  104. package/docs/interfaces/TapLeafScript.html +2 -2
  105. package/docs/interfaces/TweakSettings.html +3 -3
  106. package/docs/interfaces/UTXO.html +2 -2
  107. package/docs/interfaces/UpdateInput.html +2 -2
  108. package/docs/interfaces/WrapResult.html +178 -0
  109. package/docs/interfaces/WrappedGenerationParameters.html +184 -0
  110. package/docs/modules.html +14 -4
  111. package/docs/types/PsbtOutputExtended.html +1 -1
  112. package/docs/variables/version.html +1 -1
  113. package/package.json +1 -1
  114. package/src/_version.ts +1 -1
  115. package/src/opnet.ts +8 -1
  116. package/src/tests/deploy.ts +81 -0
  117. package/src/tests/test.ts +3 -3
  118. package/src/tests/transfer.ts +2 -2
  119. package/src/tests/wrap.ts +89 -0
  120. package/src/tests/wrapTest.ts +88 -0
  121. package/src/transaction/TransactionFactory.ts +119 -1
  122. package/src/transaction/builders/DeploymentTransaction.ts +418 -0
  123. package/src/transaction/builders/FundingTransaction.ts +5 -1
  124. package/src/transaction/builders/InteractionTransaction.ts +5 -404
  125. package/src/transaction/builders/SharedInteractionTransaction.ts +432 -0
  126. package/src/transaction/builders/TransactionBuilder.ts +40 -15
  127. package/src/transaction/builders/WrapTransaction.ts +286 -0
  128. package/src/transaction/interfaces/ITransactionParameters.ts +20 -13
  129. package/src/utils/BitcoinUtils.ts +16 -0
  130. package/src/utxo/{UTXOManager.ts → OPNetLimitedProvider.ts} +53 -2
  131. package/src/verification/TapscriptVerificator.ts +3 -3
  132. package/src/wbtc/Generate.ts +30 -0
  133. package/src/wbtc/WrappedGenerationParameters.ts +33 -0
  134. package/tests/TransactionBuilder.test.ts +58 -58
  135. package/docs/classes/UTXOManager.html +0 -187
  136. package/docs/interfaces/ITransactionDataContractDeployment.html +0 -184
  137. package/docs/interfaces/ITransactionDataContractInteractionWrap.html +0 -186
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={3513:(e,t,r)=>{var n=r(8287).Buffer,i=r(9598),o=r(9615),a=r(2623);function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=s(i);const f="Expected Private",c="Expected Point",l="Expected Tweak",h="Expected Signature",d="Expected Extra Data (32 bytes)",p="Expected Scalar";u.utils.hmacSha256Sync=(e,...t)=>o.hmac(a.sha256,e,u.utils.concatBytes(...t)),u.utils.sha256Sync=(...e)=>a.sha256(u.utils.concatBytes(...e));const y=u.utils._normalizePrivateKey,g=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]),b=new Uint8Array(32),m=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 v(e,t){for(let r=0;r<32;++r)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function w(e){return 0===v(e,b)}function _(e){return e instanceof Uint8Array&&32===e.length&&!(v(e,g)>=0)}function E(e){return e instanceof Uint8Array&&64===e.length&&v(e.subarray(0,32),g)<0&&v(e.subarray(32,64),g)<0}function S(e){return e instanceof Uint8Array&&32===e.length}function k(e){return void 0===e||e instanceof Uint8Array&&32===e.length}function A(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function T(e){let t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>=0)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private scalar");t=A(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private scalar");if(32!==e.length)throw new Error("Expected 32 bytes of private scalar");r=e,t=A(u.utils.bytesToHex(r))}var r;if(t<0)throw new Error("Expected private scalar >= 0");return t}const P=(e,t,r)=>{const n=u.Point.fromHex(e),i=T(t),o=u.Point.BASE.multiplyAndAddUnsafe(n,i,BigInt(1));if(!o)throw new Error("Tweaked point at infinity");return o.toRawBytes(r)};function I(e,t){return void 0===e?void 0===t||N(t):!!e}function O(e){try{return e()}catch(e){return null}}function x(e,t){if(32===e.length!==t)return!1;try{return!!u.Point.fromHex(e)}catch(e){return!1}}function R(e){return x(e,!1)}function N(e){return x(e,!1)&&33===e.length}function M(e){return u.utils.isValidPrivateKey(e)}function B(e){return x(e,!0)}function L(e){if(!R(e))throw new Error(c);return e.slice(1,33)}function C(e,t){if(!M(e))throw new Error(f);return O((()=>u.getPublicKey(e,I(t))))}t.isPoint=R,t.isPointCompressed=N,t.isPrivate=M,t.isXOnlyPoint=B,t.pointAdd=function(e,t,r){if(!R(e)||!R(t))throw new Error(c);return O((()=>{const n=u.Point.fromHex(e),i=u.Point.fromHex(t);return n.equals(i.negate())?null:n.add(i).toRawBytes(I(r,e))}))},t.pointAddScalar=function(e,t,r){if(!R(e))throw new Error(c);if(!_(t))throw new Error(l);return O((()=>P(e,t,I(r,e))))},t.pointCompress=function(e,t){if(!R(e))throw new Error(c);return u.Point.fromHex(e).toRawBytes(I(t,e))},t.pointFromScalar=C,t.pointMultiply=function(e,t,r){if(!R(e))throw new Error(c);if(!_(t))throw new Error(l);return O((()=>((e,t,r)=>{const n=u.Point.fromHex(e),i="string"==typeof t?t:u.utils.bytesToHex(t),o=BigInt(`0x${i}`);return n.multiply(o).toRawBytes(r)})(e,t,I(r,e))))},t.privateAdd=function(e,t){if(!1===M(e))throw new Error(f);if(!1===_(t))throw new Error(l);return O((()=>((e,t)=>{const r=y(e),n=T(t),i=u.utils._bigintTo32Bytes(u.utils.mod(r+n,u.CURVE.n));return u.utils.isValidPrivateKey(i)?i:null})(e,t)))},t.privateNegate=function(e){if(!1===M(e))throw new Error(f);return(e=>{const t=y(e),r=u.utils._bigintTo32Bytes(u.CURVE.n-t);return u.utils.isValidPrivateKey(r)?r:null})(e)},t.privateSub=function(e,t){if(!1===M(e))throw new Error(f);if(!1===_(t))throw new Error(l);return O((()=>((e,t)=>{const r=y(e),n=T(t),i=u.utils._bigintTo32Bytes(u.utils.mod(r-n,u.CURVE.n));return u.utils.isValidPrivateKey(i)?i:null})(e,t)))},t.recover=function(e,t,r,n){if(!S(e))throw new Error("Expected Hash");if(!E(t)||!function(e){return!(w(e.subarray(0,32))||w(e.subarray(32,64)))}(t))throw new Error(h);if(2&r&&!function(e){return e instanceof Uint8Array&&64===e.length&&v(e.subarray(0,32),m)<0}(t))throw new Error("Bad Recovery Id");if(!B(t.subarray(0,32)))throw new Error(h);return u.recoverPublicKey(e,t,r,I(n))},t.sign=function(e,t,r){if(!M(t))throw new Error(f);if(!S(e))throw new Error(p);if(!k(r))throw new Error(d);return u.signSync(e,t,{der:!1,extraEntropy:r})},t.signRecoverable=function(e,t,r){if(!M(t))throw new Error(f);if(!S(e))throw new Error(p);if(!k(r))throw new Error(d);const[n,i]=u.signSync(e,t,{der:!1,extraEntropy:r,recovered:!0});return{signature:n,recoveryId:i}},t.signSchnorr=function(e,t,r=n.alloc(32,0)){if(!M(t))throw new Error(f);if(!S(e))throw new Error(p);if(!k(r))throw new Error(d);return u.schnorr.signSync(e,t,r)},t.verify=function(e,t,r,n){if(!R(t))throw new Error(c);if(!E(r))throw new Error(h);if(!S(e))throw new Error(p);return u.verify(r,e,t,{strict:n})},t.verifySchnorr=function(e,t,r){if(!B(t))throw new Error(c);if(!E(r))throw new Error(h);if(!S(e))throw new Error(p);return u.schnorr.verifySync(r,e,t)},t.xOnlyPointAddTweak=function(e,t){if(!B(e))throw new Error(c);if(!_(t))throw new Error(l);return O((()=>{const r=P(e,t,!0);return{parity:r[0]%2==1?1:0,xOnlyPubkey:r.slice(1)}}))},t.xOnlyPointFromPoint=L,t.xOnlyPointFromScalar=function(e){if(!M(e))throw new Error(f);return L(C(e))}},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]),I=0|T,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),R=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 M=i.default.add3L(I,x,N);r=i.default.add3H(M,P,O,R),n=0|M}({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")}},9598:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.Signature=t.Point=t.CURVE=void 0;const n=r(4923),i=BigInt(0),o=BigInt(1),a=BigInt(2),s=BigInt(3),u=BigInt(8),f=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});t.CURVE=f;const c=(e,t)=>(e+t/a)/t,l={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){const{n:t}=f,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=r,s=BigInt("0x100000000000000000000000000000000"),u=c(a*e,t),l=c(-n*e,t);let h=D(e-u*r-l*i,t),d=D(-u*n-l*a,t);const p=h>s,y=d>s;if(p&&(h=t-h),y&&(d=t-d),h>s||d>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:p,k1:h,k2neg:y,k2:d}}},h=32,d=32,p=h+1,y=2*h+1;function g(e){const{a:t,b:r}=f,n=D(e*e),i=D(n*e);return D(i+t*e+r)}const b=f.a===i;class m extends Error{constructor(e){super(e)}}function v(e){if(!(e instanceof w))throw new TypeError("JacobianPoint expected")}class w{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof S))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(S.ZERO)?w.ZERO:new w(e.x,e.y,o)}static toAffineBatch(e){const t=function(e,t=f.P){const r=new Array(e.length),n=H(e.reduce(((e,n,o)=>n===i?e:(r[o]=e,D(e*n,t))),o),t);return e.reduceRight(((e,n,o)=>n===i?e:(r[o]=D(e*r[o],t),D(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return w.toAffineBatch(e).map(w.fromAffine)}equals(e){v(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:a}=e,s=D(n*n),u=D(a*a),f=D(t*u),c=D(i*s),l=D(D(r*a)*u),h=D(D(o*n)*s);return f===c&&l===h}negate(){return new w(this.x,D(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=D(e*e),i=D(t*t),o=D(i*i),f=e+i,c=D(a*(D(f*f)-n-o)),l=D(s*n),h=D(l*l),d=D(h-a*c),p=D(l*(c-d)-u*o),y=D(a*t*r);return new w(d,p,y)}add(e){v(e);const{x:t,y:r,z:n}=this,{x:o,y:s,z:u}=e;if(o===i||s===i)return this;if(t===i||r===i)return e;const f=D(n*n),c=D(u*u),l=D(t*c),h=D(o*f),d=D(D(r*u)*c),p=D(D(s*n)*f),y=D(h-l),g=D(p-d);if(y===i)return g===i?this.double():w.ZERO;const b=D(y*y),m=D(y*b),_=D(l*b),E=D(g*g-m-a*_),S=D(g*(_-E)-d*m),k=D(n*u*y);return new w(E,S,k)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=w.ZERO;if("bigint"==typeof e&&e===i)return t;let r=j(e);if(r===o)return this;if(!b){let e=t,n=this;for(;r>i;)r&o&&(e=e.add(n)),n=n.double(),r>>=o;return e}let{k1neg:n,k1:a,k2neg:s,k2:u}=l.splitScalar(r),f=t,c=t,h=this;for(;a>i||u>i;)a&o&&(f=f.add(h)),u&o&&(c=c.add(h)),h=h.double(),a>>=o,u>>=o;return n&&(f=f.negate()),s&&(c=c.negate()),c=new w(D(c.x*l.beta),c.y,c.z),f.add(c)}precomputeWindow(e){const t=b?128/e+1:256/e+1,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(w.BASE)&&(t=S.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&E.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=w.normalizeZ(n),E.set(t,n)));let i=w.ZERO,a=w.BASE;const s=1+(b?128/r:256/r),u=2**(r-1),f=BigInt(2**r-1),c=2**r,l=BigInt(r);for(let t=0;t<s;t++){const r=t*u;let s=Number(e&f);e>>=l,s>u&&(s-=c,e+=o);const h=r,d=r+Math.abs(s)-1,p=t%2!=0,y=s<0;0===s?a=a.add(_(p,n[h])):i=i.add(_(y,n[d]))}return{p:i,f:a}}multiply(e,t){let r,n,i=j(e);if(b){const{k1neg:e,k1:o,k2neg:a,k2:s}=l.splitScalar(i);let{p:u,f}=this.wNAF(o,t),{p:c,f:h}=this.wNAF(s,t);u=_(e,u),c=_(a,c),c=new w(D(c.x*l.beta),c.y,c.z),r=u.add(c),n=f.add(h)}else{const{p:e,f:o}=this.wNAF(i,t);r=e,n=o}return w.normalizeZ([r,n])[0]}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(w.ZERO);null==e&&(e=i?u:H(n));const a=e,s=D(a*a),f=D(s*a),c=D(t*s),l=D(r*f),h=D(n*a);if(i)return S.ZERO;if(h!==o)throw new Error("invZ was invalid");return new S(c,l)}}function _(e,t){const r=t.negate();return e?r:t}w.BASE=new w(f.Gx,f.Gy,o),w.ZERO=new w(i,o,i);const E=new WeakMap;class S{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,E.delete(this)}hasEvenY(){return this.y%a===i}static fromCompressedHex(e){const t=32===e.length,r=C(t?e:e.subarray(1));if(!q(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=f,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),c=BigInt(88),l=e*e*e%t,h=l*l*e%t,d=F(h,s)*h%t,p=F(d,s)*h%t,y=F(p,a)*l%t,g=F(y,n)*y%t,b=F(g,i)*g%t,m=F(b,u)*b%t,v=F(m,c)*m%t,w=F(v,u)*b%t,_=F(w,s)*h%t,E=F(_,o)*g%t,S=F(E,r)*l%t,k=F(S,a);if(k*k%t!==e)throw new Error("Cannot find square root");return k}(g(r));const i=(n&o)===o;t?i&&(n=D(-n)):!(1&~e[0])!==i&&(n=D(-n));const u=new S(r,n);return u.assertValidity(),u}static fromUncompressedHex(e){const t=C(e.subarray(1,h+1)),r=C(e.subarray(h+1,2*h+1)),n=new S(t,r);return n.assertValidity(),n}static fromHex(e){const t=U(e),r=t.length,n=t[0];if(r===h)return this.fromCompressedHex(t);if(r===p&&(2===n||3===n))return this.fromCompressedHex(t);if(r===y&&4===n)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-${p} compressed bytes or ${y} uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return S.BASE.multiply($(e))}static fromSignature(e,t,r){const{r:n,s:i}=Y(t);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=K(U(e)),{n:a}=f,s=2===r||3===r?n+a:n,u=H(s,a),c=D(-o*u,a),l=D(i*u,a),h=1&r?"03":"02",d=S.fromHex(h+R(s)),p=S.BASE.multiplyAndAddUnsafe(d,c,l);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(e=!1){return L(this.toHex(e))}toHex(e=!1){const t=R(this.x);return e?`${this.hasEvenY()?"02":"03"}${t}`:`04${t}${R(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!q(t)||!q(r))throw new Error(e);const n=D(r*r);if(D(n-g(t))!==i)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new S(this.x,D(-this.y))}double(){return w.fromAffine(this).double().toAffine()}add(e){return w.fromAffine(this).add(w.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return w.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=w.fromAffine(this),a=t===i||t===o||this!==S.BASE?n.multiplyUnsafe(t):n.multiply(t),s=w.fromAffine(e).multiplyUnsafe(r),u=a.add(s);return u.equals(w.ZERO)?void 0:u.toAffine()}}function k(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function A(e){if(e.length<2||2!==e[0])throw new Error(`Invalid signature integer tag: ${O(e)}`);const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:C(r),left:e.subarray(t+2)}}t.Point=S,S.BASE=new S(f.Gx,f.Gy),S.ZERO=new S(i,i);class T{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=t?O(e):e;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new T(B(n.slice(0,64)),B(n.slice(64,128)))}static fromDER(e){const t=e instanceof Uint8Array;if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error(`Invalid signature tag: ${O(e)}`);if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=A(e.subarray(2)),{data:n,left:i}=A(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${O(i)}`);return{r:t,s:n}}(t?e:L(e));return new T(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!W(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!W(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=f.n>>o;return this.s>e}normalizeS(){return this.hasHighS()?new T(this.r,D(-this.s,f.n)):this}toDERRawBytes(){return L(this.toDERHex())}toDERHex(){const e=k(M(this.s)),t=k(M(this.r)),r=e.length/2,n=t.length/2,i=M(r),o=M(n);return`30${M(n+r+4)}02${o}${t}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return L(this.toCompactHex())}toCompactHex(){return R(this.r)+R(this.s)}}function P(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),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.Signature=T;const I=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function O(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=I[e[r]];return t}const x=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function R(e){if("bigint"!=typeof e)throw new Error("Expected bigint");if(!(i<=e&&e<x))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function N(e){const t=L(R(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function M(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function B(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function L(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function C(e){return B(O(e))}function U(e){return e instanceof Uint8Array?Uint8Array.from(e):L(e)}function j(e){if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"==typeof e&&W(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function D(e,t=f.P){const r=e%t;return r>=i?r:t+r}function F(e,t){const{P:r}=f;let n=e;for(;t-- >i;)n*=n,n%=r;return n}function H(e,t=f.P){if(e===i||t<=i)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=D(e,t),n=t,a=i,s=o,u=o,c=i;for(;r!==i;){const e=n/r,t=n%r,i=a-u*e,o=s-c*e;n=r,r=t,a=u,s=c,u=i,c=o}if(n!==o)throw new Error("invert: does not exist");return D(a,t)}function K(e,t=!1){const r=function(e){const t=8*e.length-8*d,r=C(e);return t>0?r>>BigInt(t):r}(e);if(t)return r;const{n}=f;return r>=n?r-n:r}let G,V;class z{constructor(e,t){if(this.hashLen=e,this.qByteLen=t,"number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}hmac(...e){return t.utils.hmacSha256(this.k,...e)}hmacSync(...e){return V(this.k,...e)}checkSync(){if("function"!=typeof V)throw new m("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(e=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(e=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=await this.hmac(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return P(...t)}generateSync(){this.checkSync(),this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return P(...t)}}function W(e){return i<e&&e<f.n}function q(e){return i<e&&e<f.P}function Z(e,t,r,n=!0){const{n:a}=f,s=K(e,!0);if(!W(s))return;const u=H(s,a),c=S.BASE.multiply(s),l=D(c.x,a);if(l===i)return;const h=D(u*D(t+r*l,a),a);if(h===i)return;let d=new T(l,h),p=(c.x===d.r?0:2)|Number(c.y&o);return n&&d.hasHighS()&&(d=d.normalizeS(),p^=1),{sig:d,recovery:p}}function $(e){let t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"==typeof e){if(e.length!==2*d)throw new Error("Expected 32 bytes of private key");t=B(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==d)throw new Error("Expected 32 bytes of private key");t=C(e)}if(!W(t))throw new Error("Expected private key: 0 < key < n");return t}function X(e){return e instanceof S?(e.assertValidity(),e):S.fromHex(e)}function Y(e){if(e instanceof T)return e.assertValidity(),e;try{return T.fromDER(e)}catch(t){return T.fromCompact(e)}}function J(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===p||n===y:r?n===2*p||n===2*y:e instanceof S}function Q(e){return C(e.length>h?e.slice(0,h):e)}function ee(e){const t=Q(e),r=D(t,f.n);return te(r<i?t:r)}function te(e){return N(e)}function re(e,r,n){if(null==e)throw new Error(`sign: expected valid message hash, not "${e}"`);const i=U(e),o=$(r),a=[te(o),ee(i)];if(null!=n){!0===n&&(n=t.utils.randomBytes(h));const e=U(n);if(e.length!==h)throw new Error(`sign: Expected ${h} bytes of extra data`);a.push(e)}return{seed:P(...a),m:Q(i),d:o}}function ne(e,t){const{sig:r,recovery:n}=e,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},t),a=i?r.toDERRawBytes():r.toCompactRawBytes();return o?[a,n]:a}t.getPublicKey=function(e,t=!1){return S.fromPrivateKey(e).toRawBytes(t)},t.recoverPublicKey=function(e,t,r,n=!1){return S.fromSignature(e,t,r).toRawBytes(n)},t.getSharedSecret=function(e,t,r=!1){if(J(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!J(t))throw new TypeError("getSharedSecret: second arg must be public key");const n=X(t);return n.assertValidity(),n.multiply($(e)).toRawBytes(r)},t.sign=async function(e,t,r={}){const{seed:n,m:i,d:o}=re(e,t,r.extraEntropy),a=new z(32,d);let s;for(await a.reseed(n);!(s=Z(await a.generate(),i,o,r.canonical));)await a.reseed();return ne(s,r)},t.signSync=function(e,t,r={}){const{seed:n,m:i,d:o}=re(e,t,r.extraEntropy),a=new z(32,d);let s;for(a.reseedSync(n);!(s=Z(a.generateSync(),i,o,r.canonical));)a.reseedSync();return ne(s,r)};const ie={strict:!0};function oe(e){return D(C(e),f.n)}t.verify=function(e,t,r,n=ie){let i;try{i=Y(e),t=U(t)}catch(e){return!1}const{r:o,s:a}=i;if(n.strict&&i.hasHighS())return!1;const s=K(t);let u;try{u=X(r)}catch(e){return!1}const{n:c}=f,l=H(a,c),h=D(s*l,c),d=D(o*l,c),p=S.BASE.multiplyAndAddUnsafe(u,h,d);return!!p&&D(p.x,c)===o};class ae{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=U(e);if(64!==t.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${t.length}`);const r=C(t.subarray(0,32)),n=C(t.subarray(32,64));return new ae(r,n)}assertValidity(){const{r:e,s:t}=this;if(!q(e)||!W(t))throw new Error("Invalid signature")}toHex(){return R(this.r)+R(this.s)}toRawBytes(){return L(this.toHex())}}class se{constructor(e,r,n=t.utils.randomBytes()){if(null==e)throw new TypeError(`sign: Expected valid message, not "${e}"`);this.m=U(e);const{x:i,scalar:o}=this.getScalar($(r));if(this.px=i,this.d=o,this.rand=U(n),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(e){const t=S.fromPrivateKey(e),r=t.hasEvenY()?e:f.n-e;return{point:t,scalar:r,x:t.toRawX()}}initNonce(e,t){return N(e^C(t))}finalizeNonce(e){const t=D(C(e),f.n);if(t===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:r,x:n,scalar:o}=this.getScalar(t);return{R:r,rx:n,k:o}}finalizeSig(e,t,r,n){return new ae(e.x,D(t+r*n,f.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:e,d:r,px:n,rand:i}=this,o=t.utils.taggedHash,a=this.initNonce(r,await o(de.aux,i)),{R:s,rx:u,k:f}=this.finalizeNonce(await o(de.nonce,a,n,e)),c=oe(await o(de.challenge,u,n,e)),l=this.finalizeSig(s,f,c,r);return await ce(l,e,n)||this.error(),l}calcSync(){const{m:e,d:r,px:n,rand:i}=this,o=t.utils.taggedHashSync,a=this.initNonce(r,o(de.aux,i)),{R:s,rx:u,k:f}=this.finalizeNonce(o(de.nonce,a,n,e)),c=oe(o(de.challenge,u,n,e)),l=this.finalizeSig(s,f,c,r);return le(l,e,n)||this.error(),l}}function ue(e,t,r){const n=e instanceof ae,i=n?e:ae.fromHex(e);return n&&i.assertValidity(),{...i,m:U(t),P:X(r)}}function fe(e,t,r,n){const i=S.BASE.multiplyAndAddUnsafe(t,$(r),D(-n,f.n));return!(!i||!i.hasEvenY()||i.x!==e)}async function ce(e,r,n){try{const{r:i,s:o,m:a,P:s}=ue(e,r,n),u=oe(await t.utils.taggedHash(de.challenge,N(i),s.toRawX(),a));return fe(i,s,o,u)}catch(e){return!1}}function le(e,r,n){try{const{r:i,s:o,m:a,P:s}=ue(e,r,n),u=oe(t.utils.taggedHashSync(de.challenge,N(i),s.toRawX(),a));return fe(i,s,o,u)}catch(e){if(e instanceof m)throw e;return!1}}t.schnorr={Signature:ae,getPublicKey:function(e){return S.fromPrivateKey(e).toRawX()},sign:async function(e,t,r){return new se(e,t,r).calc()},verify:ce,signSync:function(e,t,r){return new se(e,t,r).calcSync()},verifySync:le},S.BASE._setWindowSize(8);const he={node:n,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},de={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},pe={};t.utils={bytesToHex:O,hexToBytes:L,concatBytes:P,mod:D,invert:H,isValidPrivateKey(e){try{return $(e),!0}catch(e){return!1}},_bigintTo32Bytes:N,_normalizePrivateKey:$,hashToPrivateKey:e=>{e=U(e);const t=d+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return N(D(C(e),f.n-o)+o)},randomBytes:(e=32)=>{if(he.web)return he.web.getRandomValues(new Uint8Array(e));if(he.node){const{randomBytes:t}=he.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.hashToPrivateKey(t.utils.randomBytes(d+8)),precompute(e=8,t=S.BASE){const r=t===S.BASE?t:new S(t.x,t.y);return r._setWindowSize(e),r.multiply(s),r},sha256:async(...e)=>{if(he.web){const t=await he.web.subtle.digest("SHA-256",P(...e));return new Uint8Array(t)}if(he.node){const{createHash:t}=he.node,r=t("sha256");return e.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(he.web){const r=await he.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=P(...t),i=await he.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(he.node){const{createHmac:r}=he.node,n=r("sha256",e);return t.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(e,...r)=>{let n=pe[e];if(void 0===n){const r=await t.utils.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));n=P(r,r),pe[e]=n}return t.utils.sha256(n,...r)},taggedHashSync:(e,...t)=>{if("function"!=typeof G)throw new m("sha256Sync is undefined, you need to set it");let r=pe[e];if(void 0===r){const t=G(Uint8Array.from(e,(e=>e.charCodeAt(0))));r=P(t,t),pe[e]=r}return G(r,...t)},_JacobianPoint:w},Object.defineProperties(t.utils,{sha256Sync:{configurable:!1,get:()=>G,set(e){G||(G=e)}},hmacSha256Sync:{configurable:!1,get:()=>V,set(e){V||(V=e)}}})},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=O,T={};function P(e){if(e.message instanceof Error)throw e.message;throw new y(e)}function I(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 O(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];I.apply(void 0,[O,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=O,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 R(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 N(e){if("function"!=typeof e)throw new l("fn","Function",e);try{e()}catch(e){return e}return T}function M(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(!M(t=e()))throw new d("instance of Promise","promiseFn",t)}else{if(!M(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&&!R(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||R(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];I.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,N(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,N(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,I=S[r]+"\n".concat(w,"+ actual").concat(E," ").concat(_,"- expected").concat(E),O=" ".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 R=l[h],N=c[h],M=N!==R&&(!m(N,",")||N.slice(0,-1)!==R);M&&m(R,",")&&R.slice(0,-1)===N&&(M=!1,N+=","),M?(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(N),i+="\n".concat(_,"-").concat(E," ").concat(R),P+=2):(o+=i,i="",1!==x&&0!==h||(o+="\n ".concat(N),P++))}if(P>20&&h<k-2)return"".concat(I).concat(O,"\n").concat(o,"\n").concat(v,"...").concat(E).concat(i,"\n")+"".concat(v,"...").concat(E)}return"".concat(I).concat(u?O:"","\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,I=g.isBigIntObject,O=g.isSymbolObject,x=g.isFloat32Array,R=g.isFloat64Array;function N(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 M(e){return Object.keys(e).filter(N).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=M(e),p=M(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)&&!R(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=M(e),N=M(t);return g.length===N.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):I(e)?I(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):O(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(!V(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(!z(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(!W(a,e,b,m,r,i))return!1}else if(!(r||e.has(b)&&D(e.get(b),m,!1,i)||W(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 V(e,t,r){var n=G(r);return null!=n?n:t.has(n)&&!e.has(n)}function z(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 W(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)}}},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 R("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return R("__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=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=F(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),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}=M(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}=M(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 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 R(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 M(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}=z(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)=>z(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 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),Z(u)):s?(u=i,x(t,e,i,r),Z(u)):o?(u=n,O(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);I.call(this,e,a.DEFLATE)}function _(e){if(!(this instanceof _))return new _(e);I.call(this,e,a.INFLATE)}function E(e){if(!(this instanceof E))return new E(e);I.call(this,e,a.GZIP)}function S(e){if(!(this instanceof S))return new S(e);I.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);I.call(this,e,a.DEFLATERAW)}function A(e){if(!(this instanceof A))return new A(e);I.call(this,e,a.INFLATERAW)}function T(e){if(!(this instanceof T))return new T(e);I.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 I(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){O(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 O(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(I,o),I.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)},I.prototype.reset=function(){return u(this._handle,"zlib binding closed"),this._handle.reset()},I.prototype._flush=function(e){this._transform(i.alloc(0),"",e)},I.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))},I.prototype.close=function(e){O(this,e),n.nextTick(x,this)},I.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"))},I.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 O(this),new RangeError(c);var g=i.concat(d,p);return O(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,I),s.inherits(_,I),s.inherits(E,I),s.inherits(S,I),s.inherits(k,I),s.inherits(A,I),s.inherits(T,I)},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 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 T(this,t,r);case"ascii":return I(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(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(W(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 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 R(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 M(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||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||M(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||M(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||M(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||M(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||M(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||M(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||M(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);M(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);M(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||M(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||M(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||M(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||M(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||M(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]||V(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 V(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 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 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),I=A.call(Function.apply,Array.prototype.splice),O=A.call(Function.call,String.prototype.replace),x=A.call(Function.call,String.prototype.slice),R=A.call(Function.call,RegExp.prototype.exec),N=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,M=/\\(\\)?/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===R(/^%?[^%]*%?$/,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 O(e,N,(function(e,t,r,i){n[n.length]=r?O(i,M,"$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],I(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,R(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(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 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(R,e))}function R(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(M,e,t))}function M(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=O(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=O(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(R,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),R(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 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(),R(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,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 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"),R(e,t)}))}function R(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)(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||I(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,R(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 I(e){for(var t=e.length;--t>=0;)e[t]=0}function O(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,O(e.strm)}function R(e,t){e.pending_buf[e.pending++]=t}function N(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function M(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=M(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=M(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)),I(this.dyn_ltree),I(this.dyn_dtree),I(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),I(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*p+1),I(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,I(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,R(i,31),R(i,139),R(i,8),i.gzhead?(R(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)),R(i,255&i.gzhead.time),R(i,i.gzhead.time>>8&255),R(i,i.gzhead.time>>16&255),R(i,i.gzhead.time>>24&255),R(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),R(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(R(i,255&i.gzhead.extra.length),R(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):(R(i,0),R(i,0),R(i,0),R(i,0),R(i,0),R(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),R(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,N(i,h),0!==i.strstart&&(N(i,e.adler>>>16),N(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)),O(e),a=i.pending,i.pending!==i.pending_buf_size));)R(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)),O(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,R(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)),O(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,R(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&&O(e),i.pending+2<=i.pending_buf_size&&(R(i,255&e.adler),R(i,e.adler>>8&255),e.adler=0,i.status=k)):i.status=k),0!==i.pending){if(O(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&&(I(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),O(e),0===e.avail_out))return i.last_flush=-1,c}return 4!==t?c:i.wrap<=0?1:(2===i.wrap?(R(i,255&e.adler),R(i,e.adler>>8&255),R(i,e.adler>>16&255),R(i,e.adler>>24&255),R(i,255&e.total_in),R(i,e.total_in>>8&255),R(i,e.total_in>>16&255),R(i,e.total_in>>24&255)):(N(i,e.adler>>>16),N(i,65535&e.adler)),O(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&&(I(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,I,O,x,R,N,M,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,R=65535&D,!((O=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(R<16)w>>>=O,_-=O,r.lens[r.have++]=R;else{if(16===R){for(j=O+2;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(w>>>=O,_-=O,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===R){for(j=O+3;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}_-=O,L=0,T=3+(7&(w>>>=O)),w>>>=3,_-=3}else{for(j=O+7;_<j;){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}_-=O,L=0,T=11+(127&(w>>>=O)),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,R=65535&D,!((O=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(x&&!(240&x)){for(N=O,M=x,B=R;x=(D=r.lencode[B+((w&(1<<N+M)-1)>>N)])>>>16&255,R=65535&D,!(N+(O=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}w>>>=N,_-=N,r.back+=N}if(w>>>=O,_-=O,r.back+=O,r.length=R,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,R=65535&D,!((O=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(!(240&x)){for(N=O,M=x,B=R;x=(D=r.distcode[B+((w&(1<<N+M)-1)>>N)])>>>16&255,R=65535&D,!(N+(O=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}w>>>=N,_-=N,r.back+=N}if(w>>>=O,_-=O,r.back+=O,64&x){e.msg="invalid distance code",r.mode=h;break}r.offset=R,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),I=r.window}else I=p,P=b-r.offset,T=r.length;T>v&&(T=v),v-=T,r.length-=T;do{p[b++]=I[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,I=0,O=0,x=0,R=0,N=0,M=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?(M=U=l,m=19):1===e?(M=i,B-=257,U=o,j-=257,m=256):(M=a,U=s,m=-1),N=0,k=0,S=A,b=c,I=P,O=0,y=-1,g=(R=1<<P)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){v=S-O,l[k]<m?(w=0,_=l[k]):l[k]>m?(w=U[j+l[k]],_=M[B+l[k]]):(w=96,_=0),d=1<<S-O,A=p=1<<I;do{f[b+(N>>O)+(p-=d)]=v<<24|w<<16|_}while(0!==p);for(d=1<<S-1;N&d;)d>>=1;if(0!==d?(N&=d-1,N+=d):N=0,k++,0==--L[S]){if(S===T)break;S=t[r+l[k]]}if(S>P&&(N&g)!==y){for(0===O&&(O=P),b+=A,x=1<<(I=S-O);I+O<T&&!((x-=L[I+O])<=0);)I++,x<<=1;if(R+=1<<I,1===e&&R>852||2===e&&R>592)return 1;f[y=N&g]=P<<24|I<<16|b-c}}return 0!==N&&(f[b+N]=S-O<<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 I(e,t,r){P(e,r[2*t],r[2*t+1])}function O(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]=O(o[s]++,s))}}function R(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 N(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 M(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&&M(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!M(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?I(e,i,t):(I(e,(a=b[i])+o+1,t),0!==(s=c[a])&&P(e,i-=m[a],s),I(e,a=A(--n),r),0!==(s=l[a])&&P(e,n-=E[a],s))}while(u<e.last_lit);I(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{I(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(I(e,i,e.bl_tree),s--),I(e,16,e.bl_tree),P(e,s-3,2)):s<=10?(I(e,17,e.bl_tree),P(e,s-3,3)):(I(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){N(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]=O(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,R(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)),R(e),n&&N(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),I(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 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)}},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,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],R=d(O,x),N=p(x,O),M=y(O=t[I-4],x=t[I-4+1]),B=g(x,O),L=t[I-14],C=t[I-14+1],U=t[I-32],j=t[I-32+1],D=N+C|0,F=R+L+b(D,N)|0;F=(F=F+M+b(D=D+B|0,B)|0)+U+b(D=D+j|0,j)|0,t[I]=F,t[I+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),V=l(r,w),z=l(w,r),W=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+W+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=z+G|0,te=V+K+b(ee,z)|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,R(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(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 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(R,e))}function R(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(M,e,t))}function M(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=O(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=O(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(R,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),R(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 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(),R(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,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 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"),R(e,t)}))}function R(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)(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||I(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,R(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 I(e){return g(e,l)}function O(e){return g(e,h)}function x(e){return g(e,d)}function R(e){return u&&g(e,p)}function N(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=I,t.isStringObject=O,t.isBooleanObject=x,t.isBigIntObject=R,t.isSymbolObject=N,t.isBoxedPrimitive=function(e){return I(e)||O(e)||x(e)||R(e)||N(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)O(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")),O(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 I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(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(),I[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 R(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(R.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 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]^A[a>>8&255]^T[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 R=function(e,t,r){if(!(this instanceof R))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)};R.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},R.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 M=function(e){if(!(this instanceof M))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)};M.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},M.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},M.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 M||(t=new M(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:M,ModeOfOperation:{ecb:O,cbc:x,cfb:R,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&(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]),I=Y>>>13,O=8191&(J=0|s[0]),x=J>>>13,R=0|s[1],N=8191&R,M=R>>>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,V=K>>>13,z=8191&(n=0|s[6]),W=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,O)|0)+((8191&(B=(B=Math.imul(f,x))+Math.imul(c,O)|0))<<13)|0,ee=((D=Math.imul(c,x))+(B>>>13)|0)+(Q>>>26)|0;return Q&=67108863,R=Math.imul(l,O),B=(B=Math.imul(l,x))+Math.imul(h,O)|0,D=Math.imul(h,x),K=(ee+(R+Math.imul(f,N)|0)|0)+((8191&(B=(B=B+Math.imul(f,M)|0)+Math.imul(c,N)|0))<<13)|0,ee=((D=D+Math.imul(c,M)|0)+(B>>>13)|0)+(K>>>26)|0,K&=67108863,R=Math.imul(d,O),B=(B=Math.imul(d,x))+Math.imul(p,O)|0,D=Math.imul(p,x),R=R+Math.imul(l,N)|0,B=(B=B+Math.imul(l,M)|0)+Math.imul(h,N)|0,D=D+Math.imul(h,M)|0,n=(ee+(R+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,R=Math.imul(y,O),B=(B=Math.imul(y,x))+Math.imul(g,O)|0,D=Math.imul(g,x),R=R+Math.imul(d,N)|0,B=(B=B+Math.imul(d,M)|0)+Math.imul(p,N)|0,D=D+Math.imul(p,M)|0,R=R+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+(R+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,R=Math.imul(b,O),B=(B=Math.imul(b,x))+Math.imul(m,O)|0,D=Math.imul(m,x),R=R+Math.imul(y,N)|0,B=(B=B+Math.imul(y,M)|0)+Math.imul(g,N)|0,D=D+Math.imul(g,M)|0,R=R+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,R=R+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+(R+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,R=Math.imul(v,O),B=(B=Math.imul(v,x))+Math.imul(w,O)|0,D=Math.imul(w,x),R=R+Math.imul(b,N)|0,B=(B=B+Math.imul(b,M)|0)+Math.imul(m,N)|0,D=D+Math.imul(m,M)|0,R=R+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,R=R+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,R=R+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+(R+Math.imul(f,G)|0)|0)+((8191&(B=(B=B+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0,ee=((D=D+Math.imul(c,V)|0)+(B>>>13)|0)+(s>>>26)|0,s&=67108863,R=Math.imul(_,O),B=(B=Math.imul(_,x))+Math.imul(E,O)|0,D=Math.imul(E,x),R=R+Math.imul(v,N)|0,B=(B=B+Math.imul(v,M)|0)+Math.imul(w,N)|0,D=D+Math.imul(w,M)|0,R=R+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,R=R+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,R=R+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,R=R+Math.imul(l,G)|0,B=(B=B+Math.imul(l,V)|0)+Math.imul(h,G)|0,D=D+Math.imul(h,V)|0,a=(ee+(R+Math.imul(f,z)|0)|0)+((8191&(B=(B=B+Math.imul(f,W)|0)+Math.imul(c,z)|0))<<13)|0,ee=((D=D+Math.imul(c,W)|0)+(B>>>13)|0)+(a>>>26)|0,a&=67108863,R=Math.imul(S,O),B=(B=Math.imul(S,x))+Math.imul(k,O)|0,D=Math.imul(k,x),R=R+Math.imul(_,N)|0,B=(B=B+Math.imul(_,M)|0)+Math.imul(E,N)|0,D=D+Math.imul(E,M)|0,R=R+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,R=R+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,R=R+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,R=R+Math.imul(d,G)|0,B=(B=B+Math.imul(d,V)|0)+Math.imul(p,G)|0,D=D+Math.imul(p,V)|0,R=R+Math.imul(l,z)|0,B=(B=B+Math.imul(l,W)|0)+Math.imul(h,z)|0,D=D+Math.imul(h,W)|0,e=(ee+(R+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,R=Math.imul(A,O),B=(B=Math.imul(A,x))+Math.imul(T,O)|0,D=Math.imul(T,x),R=R+Math.imul(S,N)|0,B=(B=B+Math.imul(S,M)|0)+Math.imul(k,N)|0,D=D+Math.imul(k,M)|0,R=R+Math.imul(_,L)|0,B=(B=B+Math.imul(_,C)|0)+Math.imul(E,L)|0,D=D+Math.imul(E,C)|0,R=R+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,R=R+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,R=R+Math.imul(y,G)|0,B=(B=B+Math.imul(y,V)|0)+Math.imul(g,G)|0,D=D+Math.imul(g,V)|0,R=R+Math.imul(d,z)|0,B=(B=B+Math.imul(d,W)|0)+Math.imul(p,z)|0,D=D+Math.imul(p,W)|0,R=R+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+(R+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,R=Math.imul(P,O),B=(B=Math.imul(P,x))+Math.imul(I,O)|0,D=Math.imul(I,x),R=R+Math.imul(A,N)|0,B=(B=B+Math.imul(A,M)|0)+Math.imul(T,N)|0,D=D+Math.imul(T,M)|0,R=R+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,R=R+Math.imul(_,U)|0,B=(B=B+Math.imul(_,j)|0)+Math.imul(E,U)|0,D=D+Math.imul(E,j)|0,R=R+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,R=R+Math.imul(b,G)|0,B=(B=B+Math.imul(b,V)|0)+Math.imul(m,G)|0,D=D+Math.imul(m,V)|0,R=R+Math.imul(y,z)|0,B=(B=B+Math.imul(y,W)|0)+Math.imul(g,z)|0,D=D+Math.imul(g,W)|0,R=R+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,R=R+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+(R+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,R=Math.imul(P,N),B=(B=Math.imul(P,M))+Math.imul(I,N)|0,D=Math.imul(I,M),R=R+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,R=R+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,R=R+Math.imul(_,F)|0,B=(B=B+Math.imul(_,H)|0)+Math.imul(E,F)|0,D=D+Math.imul(E,H)|0,R=R+Math.imul(v,G)|0,B=(B=B+Math.imul(v,V)|0)+Math.imul(w,G)|0,D=D+Math.imul(w,V)|0,R=R+Math.imul(b,z)|0,B=(B=B+Math.imul(b,W)|0)+Math.imul(m,z)|0,D=D+Math.imul(m,W)|0,R=R+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,R=R+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+(R+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,R=Math.imul(P,L),B=(B=Math.imul(P,C))+Math.imul(I,L)|0,D=Math.imul(I,C),R=R+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,R=R+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,R=R+Math.imul(_,G)|0,B=(B=B+Math.imul(_,V)|0)+Math.imul(E,G)|0,D=D+Math.imul(E,V)|0,R=R+Math.imul(v,z)|0,B=(B=B+Math.imul(v,W)|0)+Math.imul(w,z)|0,D=D+Math.imul(w,W)|0,R=R+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,R=R+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+(R+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,R=Math.imul(P,U),B=(B=Math.imul(P,j))+Math.imul(I,U)|0,D=Math.imul(I,j),R=R+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,R=R+Math.imul(S,G)|0,B=(B=B+Math.imul(S,V)|0)+Math.imul(k,G)|0,D=D+Math.imul(k,V)|0,R=R+Math.imul(_,z)|0,B=(B=B+Math.imul(_,W)|0)+Math.imul(E,z)|0,D=D+Math.imul(E,W)|0,R=R+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,R=R+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+(R+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,R=Math.imul(P,F),B=(B=Math.imul(P,H))+Math.imul(I,F)|0,D=Math.imul(I,H),R=R+Math.imul(A,G)|0,B=(B=B+Math.imul(A,V)|0)+Math.imul(T,G)|0,D=D+Math.imul(T,V)|0,R=R+Math.imul(S,z)|0,B=(B=B+Math.imul(S,W)|0)+Math.imul(k,z)|0,D=D+Math.imul(k,W)|0,R=R+Math.imul(_,q)|0,B=(B=B+Math.imul(_,Z)|0)+Math.imul(E,q)|0,D=D+Math.imul(E,Z)|0,R=R+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+(R+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,R=Math.imul(P,G),B=(B=Math.imul(P,V))+Math.imul(I,G)|0,D=Math.imul(I,V),R=R+Math.imul(A,z)|0,B=(B=B+Math.imul(A,W)|0)+Math.imul(T,z)|0,D=D+Math.imul(T,W)|0,R=R+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,R=R+Math.imul(_,$)|0,B=(B=B+Math.imul(_,X)|0)+Math.imul(E,$)|0,D=D+Math.imul(E,X)|0,v=(ee+(R+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,R=Math.imul(P,z),B=(B=Math.imul(P,W))+Math.imul(I,z)|0,D=Math.imul(I,W),R=R+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,R=R+Math.imul(S,$)|0,B=(B=B+Math.imul(S,X)|0)+Math.imul(k,$)|0,D=D+Math.imul(k,X)|0,_=(ee+(R+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,R=Math.imul(P,q),B=(B=Math.imul(P,Z))+Math.imul(I,q)|0,D=Math.imul(I,Z),R=R+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+(R+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,R=Math.imul(P,$),B=(B=Math.imul(P,X))+Math.imul(I,$)|0,D=Math.imul(I,X),A=(ee+(R+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(I,Y)|0))<<13)|0,ee=((D=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]=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 I=A,O=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),R=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),M=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(I,O,x,R,N,M,B,L,C,U);C=g(I,O,x,R,N,M,B,L,C,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),R=function(e,t,r){return(r=e&t^e&r^t&r)<0&&(r+=4294967296),r}(i,f,p),U=l(I,O,x,R),R=h(I,O,x,R),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,R),i=h(j,C,U,R)}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,I,O,x,R,N,M,B,L,C,U,j,D,F,H,K,G,V,z,W,q,Z,$,X,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],H=e[2]^e[12]^e[22]^e[32]^e[42],F=e[3]^e[13]^e[23]^e[33]^e[43],M=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])^(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=O^(N<<1|M>>>31),e[2]^=c=I^(M<<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=F^(W<<1|q>>>31),e[4]^=c=H^(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=M^(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,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,R=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,V=e[17]<<23|e[16]>>>9,z=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,N=e[8]<<27|e[9]>>>5,M=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&T,e[21]=S^~A&P,e[30]=N^~B&C,e[31]=M^~L&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^~T&I,e[23]=A^~P&O,e[32]=B^~C&j,e[33]=L^~U&D,e[42]=V^~W&Z,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]=T^~I&x,e[25]=P^~O&R,e[34]=C^~j&F,e[35]=U^~D&H,e[44]=W^~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]=I^~x&E,e[27]=O^~R&S,e[36]=j^~F&N,e[37]=D^~H&M,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]=R^~S&A,e[38]=F^~N&B,e[39]=H^~M&L,e[48]=X^~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,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,I=null,O=!1,x=0,R=0,N=parseInt(1e3/a),M=void 0!==e?e:setTimeout,B=function(){if(O)return p(new Error("cancelled"),P/T);switch(x){case 0:u(g,w=32*R*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,A);if(v+=r,P+=r,(c=parseInt(1e3*P/T))!==I){if(O=p(null,P/T))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,A)}if(v+=r,P+=r,(c=parseInt(1e3*P/T))!==I){if(O=p(null,P/T))break;I=c}if(v<n)break;if(u(_,0,g,w,S),++R<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)}M(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 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 R={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(R,e)}var M={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(M,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 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:A(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:A(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:A(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:A(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:A(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=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")}))}))},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(D,e):v(j,e)},t.perform("getLogs",e).then((function(e){return _(H)(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(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 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 R,N=new O((function(e,t){return t}),32,!1,"none"),M=(i(B,R=_),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 R.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([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 D.call(this,e,"bytes","bytes",t,!0)||this}function W(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(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,D=_),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,F=_),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 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=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,Z(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=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:M,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 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,I=(i(O,P=e),O);function O(){return null!==P&&P.apply(this,arguments)||this}var x,R=(i(N,x=e),N);function N(){return null!==x&&x.apply(this,arguments)||this}function M(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(M,this),this.deployFunction||M.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 R({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}},4923:()=>{},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}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var o=Object.create(null);i.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,i.d(o,a),o},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{i.d(o,{iy:()=>Pe,G7:()=>Dr,GF:()=>D,wf:()=>f,P8:()=>fr,z4:()=>Z,kd:()=>P,cC:()=>Br,Wj:()=>g,Bc:()=>Xr,tm:()=>er,Qc:()=>$t,dF:()=>nn,D_:()=>kr,aS:()=>Ar,y4:()=>dn,uW:()=>or,$7:()=>e,rE:()=>t,rR:()=>mr});var e={};i.r(e),i.d(e,{AddressGenerator:()=>Pe,BitcoinUtils:()=>Dr,CalldataGenerator:()=>D,Compressor:()=>f,ContractBaseMetadata:()=>fr,DeploymentGenerator:()=>Z,EcKeyPair:()=>P,FundingTransaction:()=>Br,Generator:()=>g,InteractionTransaction:()=>Xr,TapscriptVerificator:()=>er,TransactionBuilder:()=>$t,TransactionFactory:()=>nn,TransactionType:()=>kr,TweakedSigner:()=>Ar,UTXOManager:()=>dn,Wallet:()=>or,version:()=>t,wBTC:()=>mr});var t="1.0.6",r=i(8559),n=i.n(r);function a(e){return a="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},a(e)}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"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"compress",value:function(t){return n().gzipSync(t,e.zlibOptions)}},{key:"decompress",value:function(t){return n().gunzipSync(t,e.zlibOptions)}}])}();!function(e,t,r){(t=u(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(f,"zlibOptions",{level:9,maxOutputLength:16777216});var c=i(1757),l=i(8287).Buffer;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){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 p(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}var g=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,"senderPubKey",void 0),p(this,"contractSaltPubKey",void 0),p(this,"network",c.o8.bitcoin),this.senderPubKey=t,this.contractSaltPubKey=r,this.network=n}return function(e,t,r){return t&&d(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"splitBufferIntoChunks",value:function(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DATA_CHUNK_SIZE,n=[],i=0;i<t.length;i+=r){for(var o=Math.min(r,t.length-i),a=l.alloc(o),s=0;s<o;s++)a.writeUInt8(t[i+s],s);n.push([a])}return n}}])}();p(g,"DATA_CHUNK_SIZE",512),p(g,"MAGIC",l.from("bsi","utf-8"));var b=i(852),m=i(8700),v=i(3513),w=i.t(v,2),_=i(8287).Buffer;function E(e){return E="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},E(e)}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,A(n.key),n)}}function k(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=E(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}(0,c.f0)(w);var T="function"==typeof b.Ay?b.Ay:b.Ay.BIP32Factory,P=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&S(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"fromWIF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin;return this.ECPair.fromWIF(e,t)}},{key:"fromPrivateKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.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]:c.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]:c.o8.bitcoin,n=this.verifyPubKeys(e,r),i=c.KT.p2wsh({redeem:c.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]:c.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]:c.o8.bitcoin,r=c.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]:c.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]:c.o8.bitcoin;return!!c.hl.toOutputScript(e,t)}},{key:"getLegacyAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin,r=c.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]:c.o8.bitcoin;return this.ECPair.makeRandom({network:e})}},{key:"fromSeed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin;return this.BIP32.fromSeed(e,t)}},{key:"getTaprootAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin,r=e.publicKey.slice(1,33),n=_.concat([_.from([81,32]),r]);return c.hl.fromOutputScript(n,t)}},{key:"getTaprootAddressFromAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin,r=c.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]:c.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})}}])}();k(P,"BIP32",T(w)),k(P,"ECPair",(0,m.dg)(w));var I=i(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 x(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||R(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.")}()}function R(e,t){if(e){if("string"==typeof e)return N(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)?N(e,t):void 0}}function N(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 M(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,B(n.key),n)}}function B(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 L(e,t,r){return t=U(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||[],U(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 U(e){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},U(e)}function j(e,t){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},j(e,t)}var D=function(e){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),L(this,t,[e,r,n])}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&&j(e,t)}(t,e),function(e,t,r){return t&&M(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"compile",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=this.splitBufferIntoChunks(e);if(!o.length)throw new Error("No data chunks found");var a=[this.senderPubKey,c.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,c.Ez.OP_CHECKSIGVERIFY,c.Ez.OP_HASH160,c.Et.hash160(this.senderPubKey),c.Ez.OP_EQUALVERIFY,c.Ez.OP_HASH160,c.Et.hash160(t),c.Ez.OP_EQUALVERIFY,c.Ez.OP_DEPTH,c.Ez.OP_1,c.Ez.OP_NUMEQUAL,c.Ez.OP_IF,g.MAGIC];if(n.length>0){var s,u,f=this.getPubKeyAsBuffer(n),l=this.splitBufferIntoChunks(f);if(a=(s=a).concat.apply(s,[c.Ez.OP_0].concat(x(l))),!i)throw new Error("Minimum signatures must be provided");if(i>255)throw new Error("Minimum signatures cannot exceed 255");var h=I.alloc(2);h.writeUint16LE(i,0),a=(u=a).concat.apply(u,[c.Ez.OP_1,h])}var d=(a=(r=a).concat.apply(r,[c.Ez.OP_1NEGATE].concat(x(o),[c.Ez.OP_ELSE,c.Ez.OP_1,c.Ez.OP_ENDIF]))).flat(),p=c.K$.compile(d);if(!c.K$.decompile(p))throw new Error("Failed to decompile script??");return p}},{key:"getPubKeyAsBuffer",value:function(e){var t,r=I.alloc(0),n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=R(e))){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}}}}(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(!P.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=I.concat([r,i])}}catch(e){n.e(e)}finally{n.f()}var o=f.compress(r);return o.byteLength>=r.byteLength?r:o}}])}(g);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 H(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 K(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 G(e){var t=function(e,t){if("object"!=F(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==F(t)?t:t+""}function V(e,t,r){return t=W(t),function(e,t){if(t&&("object"==F(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,z()?Reflect.construct(t,r||[],W(e).constructor):t.apply(e,r))}function z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(z=function(){return!!e})()}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},W(e)}function q(e,t){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},q(e,t)}var Z=function(e){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),V(this,t,[e,r,n])}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&&q(e,t)}(t,e),function(e,t,r){return t&&K(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"compile",value:function(e,t){var r=this.getAsm(e,t),n=c.K$.compile(r);if(!c.K$.decompile(n))throw new Error("Failed to decompile script??");return n}},{key:"getAsm",value:function(e,t){var r=this.splitBufferIntoChunks(e);return[this.senderPubKey,c.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,c.Ez.OP_CHECKSIGVERIFY,c.Ez.OP_HASH160,c.Et.hash160(this.senderPubKey),c.Ez.OP_EQUALVERIFY,c.Ez.OP_HASH256,c.Et.hash256(t),c.Ez.OP_EQUALVERIFY,c.Ez.OP_DEPTH,c.Ez.OP_1,c.Ez.OP_NUMEQUAL,c.Ez.OP_IF,g.MAGIC,c.Ez.OP_1NEGATE].concat(function(e){return function(e){if(Array.isArray(e))return H(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 H(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)?H(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),[c.Ez.OP_ELSE,c.Ez.OP_1,c.Ez.OP_ENDIF]).flat()}}])}(g);function $(e,...t){if(!function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}(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 X(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")}const Y=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),J=(e,t)=>e<<32-t|e>>>t;function Q(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)),$(e),e}new Uint8Array(new Uint32Array([287454020]).buffer)[0];class ee{clone(){return this._cloneInto()}}function te(e){const t=t=>e().update(Q(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}const re=(e,t,r)=>e&t^~e&r,ne=(e,t,r)=>e&t^e&r^t&r;class ie extends ee{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=Y(this.buffer)}update(e){X(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=Q(e)).length;for(let o=0;o<i;){const a=Math.min(n-this.pos,i-o);if(a!==n)r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=Y(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){X(this),function(e,t){$(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:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;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,n-8,BigInt(8*this.length),i),this.process(r,0);const a=Y(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=s/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)a.setUint32(4*e,f[e],i)}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 oe=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]),ae=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),se=new Uint32Array(64);class ue extends ie{constructor(){super(64,32,8,!1),this.A=0|ae[0],this.B=0|ae[1],this.C=0|ae[2],this.D=0|ae[3],this.E=0|ae[4],this.F=0|ae[5],this.G=0|ae[6],this.H=0|ae[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)se[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=se[e-15],r=se[e-2],n=J(t,7)^J(t,18)^t>>>3,i=J(r,17)^J(r,19)^r>>>10;se[e]=i+se[e-7]+n+se[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:f}=this;for(let e=0;e<64;e++){const t=f+(J(a,6)^J(a,11)^J(a,25))+re(a,s,u)+oe[e]+se[e]|0,c=(J(r,2)^J(r,13)^J(r,22))+ne(r,n,i)|0;f=u,u=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+c|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,n,i,o,a,s,u,f)}roundClean(){se.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const fe=te((()=>new ue)),ce=BigInt(2**32-1),le=BigInt(32);function he(e,t=!1){return t?{h:Number(e&ce),l:Number(e>>le&ce)}:{h:0|Number(e>>le&ce),l:0|Number(e&ce)}}const de={fromBig:he,split: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}=he(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]},toBig:(e,t)=>BigInt(e>>>0)<<le|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:function(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},pe=de,[ye,ge]=(()=>pe.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)))))(),be=new Uint32Array(80),me=new Uint32Array(80);class ve extends ie{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)be[r]=e.getUint32(t),me[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|be[e-15],r=0|me[e-15],n=pe.rotrSH(t,r,1)^pe.rotrSH(t,r,8)^pe.shrSH(t,r,7),i=pe.rotrSL(t,r,1)^pe.rotrSL(t,r,8)^pe.shrSL(t,r,7),o=0|be[e-2],a=0|me[e-2],s=pe.rotrSH(o,a,19)^pe.rotrBH(o,a,61)^pe.shrSH(o,a,6),u=pe.rotrSL(o,a,19)^pe.rotrBL(o,a,61)^pe.shrSL(o,a,6),f=pe.add4L(i,u,me[e-7],me[e-16]),c=pe.add4H(f,n,s,be[e-7],be[e-16]);be[e]=0|c,me[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=pe.rotrSH(c,l,14)^pe.rotrSH(c,l,18)^pe.rotrBH(c,l,41),m=pe.rotrSL(c,l,14)^pe.rotrSL(c,l,18)^pe.rotrBL(c,l,41),v=c&h^~c&p,w=l&d^~l&y,_=pe.add5L(b,m,w,ge[e],me[e]),E=pe.add5H(_,g,t,v,ye[e],be[e]),S=0|_,k=pe.rotrSH(r,n,28)^pe.rotrBH(r,n,34)^pe.rotrBH(r,n,39),A=pe.rotrSL(r,n,28)^pe.rotrBL(r,n,34)^pe.rotrBL(r,n,39),T=r&i^r&a^i&a,P=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}=pe.add(0|u,0|f,0|E,0|S)),u=0|a,f=0|s,a=0|i,s=0|o,i=0|r,o=0|n;const I=pe.add3L(S,A,P);r=pe.add3H(I,E,k,T),n=0|I}({h:r,l:n}=pe.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=pe.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=pe.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:f}=pe.add(0|this.Dh,0|this.Dl,0|u,0|f)),({h:c,l}=pe.add(0|this.Eh,0|this.El,0|c,0|l)),({h,l:d}=pe.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=pe.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=pe.add(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(){be.fill(0),me.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 we=te((()=>new ve));var _e=i(1324),Ee=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")}();Ee.crypto||Ee.msCrypto;var Se=i(2343);function ke(e){return ke="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},ke(e)}function Ae(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,Te(n.key),n)}}function Te(e){var t=function(e,t){if("object"!=ke(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ke(t)?t:t+""}(0,c.f0)(w);var Pe=function(){return function(e,t,r){return r&&Ae(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),0,[{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 function(e){switch(e){case"sha256":return fe.create();case"sha512":return we.create()}(0,_e.assertArgument)(!1,"invalid hashing algorithm name","algorithm",e)}("ripemd160").update(e).digest()}},{key:"toSegwitAddress",value:function(e,t){var r=Se.bech32.toWords(e);return r.unshift(0),Se.bech32.encode(t.bech32,r)}}])}(),Ie=i(477),Oe=i(606),xe={d:(e,t)=>{for(var r in t)xe.o(t,r)&&!xe.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})}},Re={};xe.d(Re,{q$:()=>Bt,Vy:()=>Lt,$7:()=>Ne,rE:()=>Me});var Ne={};xe.r(Ne),xe.d(Ne,{DebugLevel:()=>Bt,Logger:()=>Lt,version:()=>Me});var Me="1.0.1";function Be(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 Le=(e=0)=>t=>`[${t+e}m`,Ce=(e=0)=>t=>`[${38+e};5;${t}m`,Ue=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,je={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(je.modifier),Object.keys(je.color),Object.keys(je.bgColor);const De=function(){const e=new Map;for(const[t,r]of Object.entries(je)){for(const[t,n]of Object.entries(r))je[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=je[t],e.set(n[0],n[1]);Object.defineProperty(je,t,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:e,enumerable:!1}),je.color.close="",je.bgColor.close="",je.color.ansi=Le(),je.color.ansi256=Ce(),je.color.ansi16m=Ue(),je.bgColor.ansi=Le(10),je.bgColor.ansi256=Ce(10),je.bgColor.ansi16m=Ue(10),Object.defineProperties(je,{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=>je.rgbToAnsi256(...je.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)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}(),Fe=(()=>{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})(),He=0!==Fe&&{level:Fe,hasBasic:!0,has256:Fe>=2,has16m:Fe>=3},Ke={stdout:He,stderr:He};function Ge(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:Ve,stderr:ze}=Ke,We=Symbol("GENERATOR"),qe=Symbol("STYLER"),Ze=Symbol("IS_EMPTY"),$e=["ansi","ansi","ansi256","ansi16m"],Xe=Object.create(null);class Ye{constructor(e){return Je(e)}}const Je=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=Ve?Ve.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,Qe.prototype),t};function Qe(e){return Je(e)}Object.setPrototypeOf(Qe.prototype,Function.prototype);for(const[e,t]of Object.entries(De))Xe[e]={get(){const r=it(this,nt(t.open,t.close,this[qe]),this[Ze]);return Object.defineProperty(this,e,{value:r}),r}};Xe.visible={get(){const e=it(this,this[qe],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const et=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?De[r].ansi16m(...n):"ansi256"===t?De[r].ansi256(De.rgbToAnsi256(...n)):De[r].ansi(De.rgbToAnsi(...n)):"hex"===e?et("rgb",t,r,...De.hexToRgb(...n)):De[r][e](...n),tt=["rgb","hex","ansi256"];for(const e of tt)Xe[e]={get(){const{level:t}=this;return function(...r){const n=nt(et(e,$e[t],"color",...r),De.color.close,this[qe]);return it(this,n,this[Ze])}}},Xe["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=nt(et(e,$e[t],"bgColor",...r),De.bgColor.close,this[qe]);return it(this,n,this[Ze])}}};const rt=Object.defineProperties((()=>{}),{...Xe,level:{enumerable:!0,get(){return this[We].level},set(e){this[We].level=e}}}),nt=(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}},it=(e,t,r)=>{const n=(...e)=>ot(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,rt),n[We]=e,n[qe]=t,n[Ze]=r,n},ot=(e,t)=>{if(e.level<=0||!t)return e[Ze]?"":t;let r=e[qe];if(void 0===r)return t;const{openAll:n,closeAll:i}=r;if(t.includes(""))for(;void 0!==r;)t=Ge(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 at(e){return at="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},at(e)}function st(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 ut(e,t,r){return(t=ft(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ft(e){var t=function(e,t){if("object"!=at(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==at(t)?t:t+""}function ct(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(Qe.prototype,Xe),Qe(),Qe({level:ze?ze.level:0});var lt=new WeakMap,ht=new WeakMap,dt=new WeakMap,pt=new WeakMap,yt=new WeakMap,gt=new WeakMap,bt=new WeakMap,mt=new WeakMap,vt=new WeakMap,wt=new WeakMap,_t=new WeakMap,Et=new WeakMap,St=new WeakMap,kt=new WeakMap,At=new WeakMap,Tt=new WeakMap,Pt=new WeakMap,It=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ye;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ut(this,"chalk",void 0),ut(this,"moduleName",""),ut(this,"logColor","#00bfff"),ut(this,"enableLogs",!0),ut(this,"hideLogs",!1),st(this,lt,"#ff00ff"),st(this,ht,Be(ct(lt,this),75)),st(this,dt,"#9400d3"),st(this,pt,Be(ct(dt,this),15)),st(this,yt,Be(ct(pt,this),15)),st(this,gt,"#7cfc00"),st(this,bt,Be(ct(gt,this),15)),st(this,mt,"#ffdead"),st(this,vt,Be(ct(mt,this),15)),st(this,wt,"#ff8c00"),st(this,_t,Be(ct(wt,this),15)),st(this,Et,"#ff4500"),st(this,St,Be(ct(Et,this),15)),st(this,kt,"#ffffff"),st(this,At,Be(ct(kt,this),15)),st(this,Tt,"#8b0000"),st(this,Pt,Be(ct(Tt,this),15)),ut(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(ct(lt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(ct(kt,this))(e)+" "+this.chalk.hex(ct(_t,this))(t)+" "+this.chalk.hex(ct(kt,this))(r)+" "+this.chalk.hex(ct(yt,this))(n)+" "+this.chalk.hex(ct(kt,this))(i))}},{key:"log",value:function(){if(this.enableLogs&&!this.hideLogs){var e=Be(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(ct(_t,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," LOG]: "))+this.chalk.hex(ct(kt,this)).apply(void 0,arguments)))}},{key:"error",value:function(){this.enableLogs&&console.log(this.chalk.hex(ct(Et,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," ERROR]: "))+this.chalk.hex(ct(St,this)).apply(void 0,arguments))}},{key:"warn",value:function(){this.enableLogs&&console.log(this.chalk.hex(ct(wt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," WARN]: "))+this.chalk.hex(ct(_t,this)).apply(void 0,arguments))}},{key:"debug",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(ct(mt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(ct(vt,this)).apply(void 0,arguments)))}},{key:"success",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(ct(gt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," SUCCESS]: "))+this.chalk.hex(ct(bt,this)).apply(void 0,arguments)))}},{key:"fail",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(ct(Et,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," FAIL]: "))+this.chalk.hex(ct(St,this)).apply(void 0,arguments)))}},{key:"debugBright",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(ct(dt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(ct(pt,this)).apply(void 0,arguments)))}},{key:"important",value:function(){this.enableLogs&&console.log(this.chalk.hex(ct(lt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," IMPORTANT]: "))+this.chalk.hex(ct(ht,this)).apply(void 0,arguments))}},{key:"panic",value:function(){this.enableLogs&&console.log(this.chalk.hex(ct(Tt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," HELP PANIC]: "))+this.chalk.hex(ct(Pt,this)).apply(void 0,arguments))}},{key:"info",value:function(){this.enableLogs&&console.log(this.chalk.hex(ct(lt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(ct(kt,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(ct(At,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,ft(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ot(e){return Ot="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},Ot(e)}function xt(e,t,r){return t=Nt(t),function(e,t){if(t&&("object"===Ot(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,Rt()?Reflect.construct(t,r||[],Nt(e).constructor):t.apply(e,r))}function Rt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Rt=function(){return!!e})()}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nt(e)}function Mt(e,t){return Mt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Mt(e,t)}var Bt,Lt=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),xt(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&&Mt(e,t)}(t,It),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"}(Bt||(Bt={}));var Ct=Re.Vy,Ut=i(8287).Buffer;function jt(e){return jt="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},jt(e)}function Dt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ft(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 Ft(e,t){if(e){if("string"==typeof e)return Ht(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)?Ht(e,t):void 0}}function Ht(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 Kt(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,Zt(n.key),n)}}function Gt(e,t,r){return t=zt(t),function(e,t){if(t&&("object"==jt(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,Vt()?Reflect.construct(t,r||[],zt(e).constructor):t.apply(e,r))}function Vt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vt=function(){return!!e})()}function zt(e){return zt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},zt(e)}function Wt(e,t){return Wt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Wt(e,t)}function qt(e,t,r){return(t=Zt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Zt(e){var t=function(e,t){if("object"!=jt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jt(t)?t:t+""}var $t=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),qt(r=Gt(this,t),"logColor","#785def"),qt(r,"transactionFee",0n),qt(r,"transaction",void 0),qt(r,"inputs",[]),qt(r,"updateInputs",[]),qt(r,"outputs",[]),qt(r,"feeOutput",null),qt(r,"signed",!1),qt(r,"tapData",null),qt(r,"scriptData",null),qt(r,"totalInputAmount",void 0),qt(r,"signer",void 0),qt(r,"network",void 0),qt(r,"feeRate",void 0),qt(r,"priorityFee",void 0),qt(r,"utxos",void 0),qt(r,"to",void 0),qt(r,"from",void 0),qt(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||P.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 c.iL({network:r.network}),r}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&&Wt(e,t)}(t,e),function(e,t,r){return t&&Kt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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(!P.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=Dt(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=Dt(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=Dt(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=Dt(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:Ut.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=Ut.allocUnsafe(0);function n(e){var t=r.length,n=Oe.varuint.encodingLength(e);r=Ut.concat([r,Ut.allocUnsafe(n)]),Oe.varuint.encode(e,r,t)}return n((t=e).length),t.forEach((function(e){n(e.length),function(e){r=Ut.concat([r,Ut.from(e)])}(e)})),r}},{key:"internalInit",value:function(){this.verifyUTXOValidity(),this.scriptData=c.KT.p2tr(this.generateScriptAddress()),this.tapData=c.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=function(e){return function(e){if(Array.isArray(e))return Ht(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Ft(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.")}()}(this.outputs);return this.feeOutput&&e.push(this.feeOutput),e}},{key:"verifyUTXOValidity",value:function(){var e,t=Dt(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,Ie.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 c.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.")}}])}(Ct);qt($t,"LOCK_LEAF_SCRIPT",c.K$.compile([c.Ez.OP_0])),qt($t,"MINIMUM_DUST",330n),(0,c.f0)(w);var Xt=i(8287).Buffer;function Yt(e){return Yt="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},Yt(e)}function Jt(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,Qt(n.key),n)}}function Qt(e){var t=function(e,t){if("object"!=Yt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Yt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Yt(t)?t:t+""}var er=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&Jt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"getContractAddress",value:function(t){var r=t.network||c.o8.bitcoin,n=[{output:new Z(t.deployerPubKeyXOnly,(0,Ie.toXOnly)(t.contractSaltPubKey),r).compile(t.bytecode,t.originalSalt),version:e.TAP_SCRIPT_VERSION},{output:$t.LOCK_LEAF_SCRIPT,version:e.TAP_SCRIPT_VERSION}];return e.generateAddressFromScript(t,n)}},{key:"getContractSeed",value:function(e,t,r){var n=c.default.crypto.hash256(t),i=Xt.concat([e,r,n]);return c.default.crypto.hash256(i)}},{key:"generateContractVirtualAddress",value:function(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.o8.bitcoin,o=e.getContractSeed(t,r,n);return Pe.generatePKSH(o,i)}},{key:"generateAddressFromScript",value:function(e,t){var r=e.network||c.o8.bitcoin,n={internalPubkey:e.deployerPubKeyXOnly,network:r,scriptTree:t};return c.KT.p2tr(n).address}}])}();function tr(e){return tr="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},tr(e)}function rr(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,ir(n.key),n)}}function nr(e,t,r){return(t=ir(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ir(e){var t=function(e,t){if("object"!=tr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tr(t)?t:t+""}!function(e,t,r){(t=Qt(t))in e?Object.defineProperty(e,t,{value:192,enumerable:!0,configurable:!0,writable:!0}):e[t]=192}(er,"TAP_SCRIPT_VERSION");var or=function(){return function(e,t,r){return t&&rr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),nr(this,"network",void 0),nr(this,"_keypair",void 0),nr(this,"_p2wpkh",void 0),nr(this,"_p2tr",void 0),this.network=r,this._keypair=P.fromWIF(t.privateKey,this.network),this._p2wpkh=P.getP2WPKHAddress(this._keypair,this.network),this._p2tr=P.getTaprootAddress(this._keypair,this.network)}),[{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,Ie.toXOnly)(this.keypair.publicKey)}}])}();function ar(e){return ar="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},ar(e)}function sr(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,ur(n.key),n)}}function ur(e){var t=function(e,t){if("object"!=ar(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ar(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ar(t)?t:t+""}var fr=function(){return function(e,t,r){return t&&sr(e.prototype,t),r&&sr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,r){(t=ur(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"network",void 0),this.network=t}),[{key:"getAddress",value:function(){return this.address}}],[{key:"getAddress",value:function(){throw arguments.length>0&&void 0!==arguments[0]||c.o8.bitcoin,new Error("Method not implemented.")}}])}();function cr(e){return cr="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},cr(e)}function lr(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,br(n.key),n)}}function hr(e,t,r){return t=pr(t),function(e,t){if(t&&("object"==cr(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,dr()?Reflect.construct(t,r||[],pr(e).constructor):t.apply(e,r))}function dr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(dr=function(){return!!e})()}function pr(e){return pr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pr(e)}function yr(e,t){return yr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},yr(e,t)}function gr(e,t,r){return(t=br(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function br(e){var t=function(e,t){if("object"!=cr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cr(t)?t:t+""}var mr=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),gr(e=hr(this,t,[r]),"network",void 0),gr(e,"tokenName","Wrapped Bitcoin"),gr(e,"tokenSymbol","wBTC"),gr(e,"decimals",8),gr(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&&yr(e,t)}(t,e),function(e,t,r){return r&&lr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,0,[{key:"getAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.o8.bitcoin;switch(e){case c.o8.bitcoin:case c.o8.regtest:return"bcrt1pcw0828yjrtlrc6mkp3lkq30j7wc7slsh7k7dyh53mrs4f8d74l6qumhqp4";case c.o8.testnet:return"tb1pq64lx73fwyrdp4asvl7xt5r5qvxvt9wy82x75taqtzvd64f58nasansurj";default:throw new Error("Invalid network: ".concat(e))}}}])}(fr),vr=i(2218),wr=i(8287).Buffer;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 Er(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,Sr(n.key),n)}}function Sr(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+""}(0,c.f0)(w);var kr,Ar=function(){return function(e,t,r){return r&&Er(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),0,[{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=v.privateNegate(r));var n=v.privateAdd(r,(0,vr.tapTweakHash)((0,Ie.toXOnly)(e.publicKey),t.tweakHash));if(!n)throw new Error("Invalid tweaked private key!");return P.fromPrivateKey(wr.from(n),t.network)}}])}();function Tr(e){return Tr="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},Tr(e)}function Pr(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,Mr(n.key),n)}}function Ir(e,t,r){return t=xr(t),function(e,t){if(t&&("object"==Tr(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,Or()?Reflect.construct(t,r||[],xr(e).constructor):t.apply(e,r))}function Or(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Or=function(){return!!e})()}function xr(e){return xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xr(e)}function Rr(e,t){return Rr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Rr(e,t)}function Nr(e,t,r){return(t=Mr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Mr(e){var t=function(e,t){if("object"!=Tr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Tr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Tr(t)?t:t+""}!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"}(kr||(kr={}));var Br=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Nr(r=Ir(this,t,[e]),"type",kr.FUNDING),Nr(r,"childTransactionRequiredFees",void 0),r.childTransactionRequiredFees=e.childTransactionRequiredFees,r.internalInit(),r}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&&Rr(e,t)}(t,e),function(e,t,r){return t&&Pr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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}}])}($t),Lr=i(8287).Buffer;function Cr(e){return Cr="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},Cr(e)}function Ur(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,jr(n.key),n)}}function jr(e){var t=function(e,t){if("object"!=Cr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Cr(t)?t:t+""}var Dr=function(){return function(e,t,r){return r&&Ur(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),0,[{key:"btcToSatoshi",value:function(e){return BigInt(1e8*e)}},{key:"rndBytes",value:function(){var e=crypto.getRandomValues(new Uint8Array(64));return Lr.from(e)}}])}();function Fr(e){return Fr="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},Fr(e)}function Hr(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 Kr(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,$r(n.key),n)}}function Gr(e,t,r){return t=Wr(t),function(e,t){if(t&&("object"==Fr(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,Vr()?Reflect.construct(t,r||[],Wr(e).constructor):t.apply(e,r))}function Vr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Vr=function(){return!!e})()}function zr(){return zr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=Wr(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},zr.apply(null,arguments)}function Wr(e){return Wr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Wr(e)}function qr(e,t){return qr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},qr(e,t)}function Zr(e,t,r){return(t=$r(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $r(e){var t=function(e,t){if("object"!=Fr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Fr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fr(t)?t:t+""}var Xr=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Zr(r=Gr(this,t,[e]),"type",kr.INTERACTION),Zr(r,"randomBytes",void 0),Zr(r,"targetScriptRedeem",null),Zr(r,"leftOverFundsScriptRedeem",null),Zr(r,"compiledTargetScript",void 0),Zr(r,"scriptTree",void 0),Zr(r,"tapLeafScript",null),Zr(r,"calldataGenerator",void 0),Zr(r,"calldata",void 0),Zr(r,"contractSecret",r.generateSecret()),Zr(r,"tweakedSigner",void 0),Zr(r,"scriptSigner",void 0),Zr(r,"interactionPubKeys",void 0),Zr(r,"minimumSignatures",void 0),Zr(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=f.compress(e.calldata),r.interactionPubKeys=e.pubKeys||[],r.minimumSignatures=e.minimumSignatures||0,r.randomBytes=e.randomBytes||Dr.rndBytes(),r.scriptSigner=r.generateKeyPairFromSeed(),r.calldataGenerator=new D(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 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&&qr(e,t)}(t,e),function(e,t,r){return t&&Kr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"getContractSecret",value:function(){return this.contractSecret}},{key:"getRndBytes",value:function(){return this.randomBytes}},{key:"generateSecret",value:function(){return c.hl.fromBech32(this.to).data}},{key:"tweakSigner",value:function(){this.tweakedSigner=this.getTweakedSigner()}},{key:"scriptSignerXOnlyPubKey",value:function(){return(0,Ie.toXOnly)(this.scriptSigner.publicKey)}},{key:"generateKeyPairFromSeed",value:function(){return P.fromSeedKeyPair(this.randomBytes,this.network)}},{key:"addInputsFromUTXO",value:function(){if(!this.tapLeafScript)throw new Error("Tap leaf script is required");var e,t=function(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 Hr(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)?Hr(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,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}}}}(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)):zr(Wr(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()),Ar.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}]}}])}($t);function Yr(e){return Yr="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},Yr(e)}function Jr(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 Qr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Jr(Object(r),!0).forEach((function(t){en(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function en(e,t,r){return(t=rn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tn(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,rn(n.key),n)}}function rn(e){var t=function(e,t){if("object"!=Yr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Yr(t)?t:t+""}var nn=function(){return function(e,t,r){return t&&tn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),[{key:"signInteraction",value:function(e){var t=new Xr(e);t.signTransaction();var r=t.getFundingTransactionParameters(),n=new Br(r).signTransaction();if(!n)throw new Error("Could not sign funding transaction.");var i=n.outs[0],o={transactionId:n.getId(),outputIndex:0,scriptPubKey:{hex:i.script.toString("hex"),address:t.getScriptAddress()},value:BigInt(i.value)},a=Qr(Qr({},e),{},{utxos:[o],randomBytes:t.getRndBytes()}),s=new Xr(a).signTransaction();return[n.toHex(),s.toHex()]}}])}();function on(e){return on="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},on(e)}function an(){an=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),s=new x(n||[]);return i(a,"_invoke",{value:T(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",g={};function b(){}function m(){}function v(){}var w={};f(w,a,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(R([])));E&&E!==r&&n.call(E,a)&&(w=E);var S=v.prototype=b.prototype=Object.create(w);function k(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function r(i,o,a,s){var u=l(e[i],e,o);if("throw"!==u.type){var f=u.arg,c=f.value;return c&&"object"==on(c)&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(c).then((function(e){f.value=e,a(f)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function T(t,r,n){var i=h;return function(o,a){if(i===p)throw Error("Generator is already running");if(i===y){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=P(s,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var f=l(t,r,n);if("normal"===f.type){if(i=n.done?y:d,f.arg===g)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(i=y,n.method="throw",n.arg=f.arg)}}}function P(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,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;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,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(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 O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function R(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(on(t)+" is not iterable")}return m.prototype=v,i(S,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:m,configurable:!0}),m.displayName=f(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,f(e,u,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(A.prototype),f(A.prototype,s,(function(){return this})),t.AsyncIterator=A,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new A(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(S),f(S,u,"Generator"),f(S,a,(function(){return this})),f(S,"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,x.prototype={constructor:x,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(O),!t)for(var r in this)"t"===r.charAt(0)&&n.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 i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),O(r),g}},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;O(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),g}},t}function sn(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 un(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)?un(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,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 un(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 fn(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 cn(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,hn(n.key),n)}}function ln(e,t,r){return(t=hn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hn(e){var t=function(e,t){if("object"!=on(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=on(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==on(t)?t:t+""}var dn=function(){return function(e,t,r){return t&&cn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ln(this,"opnetAPIUrl",void 0),ln(this,"utxoPath","address/utxos"),this.opnetAPIUrl=t}),[{key:"fetchUTXO",value:(e=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){fn(o,n,i,a,s,"next",e)}function s(e){fn(o,n,i,a,s,"throw",e)}a(void 0)}))}}(an().mark((function e(t){var r,n,i,o,a,s,u,f,c,l,h,d;return an().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((i=e.sent).ok){e.next=7;break}throw new Error("Failed to fetch UTXO data: ".concat(i.statusText));case 7:return e.next=9,i.json();case 9:if(0!==(o=e.sent).length){e.next=12;break}throw new Error("No UTXO found");case 12:if(a=o.filter((function(e){return BigInt(e.value)>=t.minAmount})),0!==a.length){e.next=15;break}throw new Error("No UTXO found (minAmount)");case 15:s=[],u=0n,f=t.requestedAmount,c=sn(a),e.prev=19,c.s();case 21:if((l=c.n()).done){e.next=30;break}if(h=l.value,d=BigInt(h.value),u+=d,s.push({transactionId:h.transactionId,outputIndex:h.outputIndex,value:d,scriptPubKey:h.scriptPubKey}),!(u+d>f)){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),c.e(e.t0);case 35:return e.prev=35,c.f(),e.finish(35);case 38:return e.abrupt("return",s);case 39:case"end":return e.stop()}}),e,this,[[19,32,35,38]])}))),function(t){return e.apply(this,arguments)})}]);var e}()})();var a=o.iy,s=o.G7,u=o.GF,f=o.wf,c=o.P8,l=o.z4,h=o.kd,d=o.cC,p=o.Wj,y=o.Bc,g=o.tm,b=o.Qc,m=o.dF,v=o.D_,w=o.aS,_=o.y4,E=o.uW,S=o.$7,k=o.rE,A=o.rR;export{a as AddressGenerator,s as BitcoinUtils,u as CalldataGenerator,f as Compressor,c as ContractBaseMetadata,l as DeploymentGenerator,h as EcKeyPair,d as FundingTransaction,p as Generator,y as InteractionTransaction,g as TapscriptVerificator,b as TransactionBuilder,m as TransactionFactory,v as TransactionType,w as TweakedSigner,_ as UTXOManager,E as Wallet,S as opnet,k as version,A as wBTC};
2
+ var e,t,r={3513:(e,t,r)=>{var n=r(8287).Buffer,i=r(9598),o=r(9615),a=r(2623);function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=s(i);const f="Expected Private",c="Expected Point",l="Expected Tweak",h="Expected Signature",d="Expected Extra Data (32 bytes)",p="Expected Scalar";u.utils.hmacSha256Sync=(e,...t)=>o.hmac(a.sha256,e,u.utils.concatBytes(...t)),u.utils.sha256Sync=(...e)=>a.sha256(u.utils.concatBytes(...e));const y=u.utils._normalizePrivateKey,g=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]),b=new Uint8Array(32),m=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 v(e,t){for(let r=0;r<32;++r)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function w(e){return 0===v(e,b)}function _(e){return e instanceof Uint8Array&&32===e.length&&!(v(e,g)>=0)}function E(e){return e instanceof Uint8Array&&64===e.length&&v(e.subarray(0,32),g)<0&&v(e.subarray(32,64),g)<0}function S(e){return e instanceof Uint8Array&&32===e.length}function k(e){return void 0===e||e instanceof Uint8Array&&32===e.length}function A(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function T(e){let t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>=0)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private scalar");t=A(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private scalar");if(32!==e.length)throw new Error("Expected 32 bytes of private scalar");r=e,t=A(u.utils.bytesToHex(r))}var r;if(t<0)throw new Error("Expected private scalar >= 0");return t}const O=(e,t,r)=>{const n=u.Point.fromHex(e),i=T(t),o=u.Point.BASE.multiplyAndAddUnsafe(n,i,BigInt(1));if(!o)throw new Error("Tweaked point at infinity");return o.toRawBytes(r)};function P(e,t){return void 0===e?void 0===t||N(t):!!e}function I(e){try{return e()}catch(e){return null}}function x(e,t){if(32===e.length!==t)return!1;try{return!!u.Point.fromHex(e)}catch(e){return!1}}function R(e){return x(e,!1)}function N(e){return x(e,!1)&&33===e.length}function M(e){return u.utils.isValidPrivateKey(e)}function B(e){return x(e,!0)}function L(e){if(!R(e))throw new Error(c);return e.slice(1,33)}function U(e,t){if(!M(e))throw new Error(f);return I((()=>u.getPublicKey(e,P(t))))}t.isPoint=R,t.isPointCompressed=N,t.isPrivate=M,t.isXOnlyPoint=B,t.pointAdd=function(e,t,r){if(!R(e)||!R(t))throw new Error(c);return I((()=>{const n=u.Point.fromHex(e),i=u.Point.fromHex(t);return n.equals(i.negate())?null:n.add(i).toRawBytes(P(r,e))}))},t.pointAddScalar=function(e,t,r){if(!R(e))throw new Error(c);if(!_(t))throw new Error(l);return I((()=>O(e,t,P(r,e))))},t.pointCompress=function(e,t){if(!R(e))throw new Error(c);return u.Point.fromHex(e).toRawBytes(P(t,e))},t.pointFromScalar=U,t.pointMultiply=function(e,t,r){if(!R(e))throw new Error(c);if(!_(t))throw new Error(l);return I((()=>((e,t,r)=>{const n=u.Point.fromHex(e),i="string"==typeof t?t:u.utils.bytesToHex(t),o=BigInt(`0x${i}`);return n.multiply(o).toRawBytes(r)})(e,t,P(r,e))))},t.privateAdd=function(e,t){if(!1===M(e))throw new Error(f);if(!1===_(t))throw new Error(l);return I((()=>((e,t)=>{const r=y(e),n=T(t),i=u.utils._bigintTo32Bytes(u.utils.mod(r+n,u.CURVE.n));return u.utils.isValidPrivateKey(i)?i:null})(e,t)))},t.privateNegate=function(e){if(!1===M(e))throw new Error(f);return(e=>{const t=y(e),r=u.utils._bigintTo32Bytes(u.CURVE.n-t);return u.utils.isValidPrivateKey(r)?r:null})(e)},t.privateSub=function(e,t){if(!1===M(e))throw new Error(f);if(!1===_(t))throw new Error(l);return I((()=>((e,t)=>{const r=y(e),n=T(t),i=u.utils._bigintTo32Bytes(u.utils.mod(r-n,u.CURVE.n));return u.utils.isValidPrivateKey(i)?i:null})(e,t)))},t.recover=function(e,t,r,n){if(!S(e))throw new Error("Expected Hash");if(!E(t)||!function(e){return!(w(e.subarray(0,32))||w(e.subarray(32,64)))}(t))throw new Error(h);if(2&r&&!function(e){return e instanceof Uint8Array&&64===e.length&&v(e.subarray(0,32),m)<0}(t))throw new Error("Bad Recovery Id");if(!B(t.subarray(0,32)))throw new Error(h);return u.recoverPublicKey(e,t,r,P(n))},t.sign=function(e,t,r){if(!M(t))throw new Error(f);if(!S(e))throw new Error(p);if(!k(r))throw new Error(d);return u.signSync(e,t,{der:!1,extraEntropy:r})},t.signRecoverable=function(e,t,r){if(!M(t))throw new Error(f);if(!S(e))throw new Error(p);if(!k(r))throw new Error(d);const[n,i]=u.signSync(e,t,{der:!1,extraEntropy:r,recovered:!0});return{signature:n,recoveryId:i}},t.signSchnorr=function(e,t,r=n.alloc(32,0)){if(!M(t))throw new Error(f);if(!S(e))throw new Error(p);if(!k(r))throw new Error(d);return u.schnorr.signSync(e,t,r)},t.verify=function(e,t,r,n){if(!R(t))throw new Error(c);if(!E(r))throw new Error(h);if(!S(e))throw new Error(p);return u.verify(r,e,t,{strict:n})},t.verifySchnorr=function(e,t,r){if(!B(t))throw new Error(c);if(!E(r))throw new Error(h);if(!S(e))throw new Error(p);return u.schnorr.verifySync(r,e,t)},t.xOnlyPointAddTweak=function(e,t){if(!B(e))throw new Error(c);if(!_(t))throw new Error(l);return I((()=>{const r=O(e,t,!0);return{parity:r[0]%2==1?1:0,xOnlyPubkey:r.slice(1)}}))},t.xOnlyPointFromPoint=L,t.xOnlyPointFromScalar=function(e){if(!M(e))throw new Error(f);return L(U(e))}},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]),O=i.default.add5H(T,_,t,k,a[e],u[e]),P=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),R=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|O,0|P)),d=0|l,p=0|h,l=0|o,h=0|c,o=0|r,c=0|n;const M=i.default.add3L(P,x,N);r=i.default.add3H(M,O,I,R),n=0|M}({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")}},9598:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.Signature=t.Point=t.CURVE=void 0;const n=r(4923),i=BigInt(0),o=BigInt(1),a=BigInt(2),s=BigInt(3),u=BigInt(8),f=Object.freeze({a:i,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")});t.CURVE=f;const c=(e,t)=>(e+t/a)/t,l={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar(e){const{n:t}=f,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=r,s=BigInt("0x100000000000000000000000000000000"),u=c(a*e,t),l=c(-n*e,t);let h=D(e-u*r-l*i,t),d=D(-u*n-l*a,t);const p=h>s,y=d>s;if(p&&(h=t-h),y&&(d=t-d),h>s||d>s)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:p,k1:h,k2neg:y,k2:d}}},h=32,d=32,p=h+1,y=2*h+1;function g(e){const{a:t,b:r}=f,n=D(e*e),i=D(n*e);return D(i+t*e+r)}const b=f.a===i;class m extends Error{constructor(e){super(e)}}function v(e){if(!(e instanceof w))throw new TypeError("JacobianPoint expected")}class w{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof S))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(S.ZERO)?w.ZERO:new w(e.x,e.y,o)}static toAffineBatch(e){const t=function(e,t=f.P){const r=new Array(e.length),n=H(e.reduce(((e,n,o)=>n===i?e:(r[o]=e,D(e*n,t))),o),t);return e.reduceRight(((e,n,o)=>n===i?e:(r[o]=D(e*r[o],t),D(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return w.toAffineBatch(e).map(w.fromAffine)}equals(e){v(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:a}=e,s=D(n*n),u=D(a*a),f=D(t*u),c=D(i*s),l=D(D(r*a)*u),h=D(D(o*n)*s);return f===c&&l===h}negate(){return new w(this.x,D(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=D(e*e),i=D(t*t),o=D(i*i),f=e+i,c=D(a*(D(f*f)-n-o)),l=D(s*n),h=D(l*l),d=D(h-a*c),p=D(l*(c-d)-u*o),y=D(a*t*r);return new w(d,p,y)}add(e){v(e);const{x:t,y:r,z:n}=this,{x:o,y:s,z:u}=e;if(o===i||s===i)return this;if(t===i||r===i)return e;const f=D(n*n),c=D(u*u),l=D(t*c),h=D(o*f),d=D(D(r*u)*c),p=D(D(s*n)*f),y=D(h-l),g=D(p-d);if(y===i)return g===i?this.double():w.ZERO;const b=D(y*y),m=D(y*b),_=D(l*b),E=D(g*g-m-a*_),S=D(g*(_-E)-d*m),k=D(n*u*y);return new w(E,S,k)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){const t=w.ZERO;if("bigint"==typeof e&&e===i)return t;let r=j(e);if(r===o)return this;if(!b){let e=t,n=this;for(;r>i;)r&o&&(e=e.add(n)),n=n.double(),r>>=o;return e}let{k1neg:n,k1:a,k2neg:s,k2:u}=l.splitScalar(r),f=t,c=t,h=this;for(;a>i||u>i;)a&o&&(f=f.add(h)),u&o&&(c=c.add(h)),h=h.double(),a>>=o,u>>=o;return n&&(f=f.negate()),s&&(c=c.negate()),c=new w(D(c.x*l.beta),c.y,c.z),f.add(c)}precomputeWindow(e){const t=b?128/e+1:256/e+1,r=[];let n=this,i=n;for(let o=0;o<t;o++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(w.BASE)&&(t=S.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&E.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=w.normalizeZ(n),E.set(t,n)));let i=w.ZERO,a=w.BASE;const s=1+(b?128/r:256/r),u=2**(r-1),f=BigInt(2**r-1),c=2**r,l=BigInt(r);for(let t=0;t<s;t++){const r=t*u;let s=Number(e&f);e>>=l,s>u&&(s-=c,e+=o);const h=r,d=r+Math.abs(s)-1,p=t%2!=0,y=s<0;0===s?a=a.add(_(p,n[h])):i=i.add(_(y,n[d]))}return{p:i,f:a}}multiply(e,t){let r,n,i=j(e);if(b){const{k1neg:e,k1:o,k2neg:a,k2:s}=l.splitScalar(i);let{p:u,f}=this.wNAF(o,t),{p:c,f:h}=this.wNAF(s,t);u=_(e,u),c=_(a,c),c=new w(D(c.x*l.beta),c.y,c.z),r=u.add(c),n=f.add(h)}else{const{p:e,f:o}=this.wNAF(i,t);r=e,n=o}return w.normalizeZ([r,n])[0]}toAffine(e){const{x:t,y:r,z:n}=this,i=this.equals(w.ZERO);null==e&&(e=i?u:H(n));const a=e,s=D(a*a),f=D(s*a),c=D(t*s),l=D(r*f),h=D(n*a);if(i)return S.ZERO;if(h!==o)throw new Error("invZ was invalid");return new S(c,l)}}function _(e,t){const r=t.negate();return e?r:t}w.BASE=new w(f.Gx,f.Gy,o),w.ZERO=new w(i,o,i);const E=new WeakMap;class S{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,E.delete(this)}hasEvenY(){return this.y%a===i}static fromCompressedHex(e){const t=32===e.length,r=U(t?e:e.subarray(1));if(!q(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=f,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),c=BigInt(88),l=e*e*e%t,h=l*l*e%t,d=F(h,s)*h%t,p=F(d,s)*h%t,y=F(p,a)*l%t,g=F(y,n)*y%t,b=F(g,i)*g%t,m=F(b,u)*b%t,v=F(m,c)*m%t,w=F(v,u)*b%t,_=F(w,s)*h%t,E=F(_,o)*g%t,S=F(E,r)*l%t,k=F(S,a);if(k*k%t!==e)throw new Error("Cannot find square root");return k}(g(r));const i=(n&o)===o;t?i&&(n=D(-n)):!(1&~e[0])!==i&&(n=D(-n));const u=new S(r,n);return u.assertValidity(),u}static fromUncompressedHex(e){const t=U(e.subarray(1,h+1)),r=U(e.subarray(h+1,2*h+1)),n=new S(t,r);return n.assertValidity(),n}static fromHex(e){const t=C(e),r=t.length,n=t[0];if(r===h)return this.fromCompressedHex(t);if(r===p&&(2===n||3===n))return this.fromCompressedHex(t);if(r===y&&4===n)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-${p} compressed bytes or ${y} uncompressed bytes, not ${r}`)}static fromPrivateKey(e){return S.BASE.multiply($(e))}static fromSignature(e,t,r){const{r:n,s:i}=Y(t);if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");const o=K(C(e)),{n:a}=f,s=2===r||3===r?n+a:n,u=H(s,a),c=D(-o*u,a),l=D(i*u,a),h=1&r?"03":"02",d=S.fromHex(h+R(s)),p=S.BASE.multiplyAndAddUnsafe(d,c,l);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(e=!1){return L(this.toHex(e))}toHex(e=!1){const t=R(this.x);return e?`${this.hasEvenY()?"02":"03"}${t}`:`04${t}${R(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{x:t,y:r}=this;if(!q(t)||!q(r))throw new Error(e);const n=D(r*r);if(D(n-g(t))!==i)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new S(this.x,D(-this.y))}double(){return w.fromAffine(this).double().toAffine()}add(e){return w.fromAffine(this).add(w.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return w.fromAffine(this).multiply(e,this).toAffine()}multiplyAndAddUnsafe(e,t,r){const n=w.fromAffine(this),a=t===i||t===o||this!==S.BASE?n.multiplyUnsafe(t):n.multiply(t),s=w.fromAffine(e).multiplyUnsafe(r),u=a.add(s);return u.equals(w.ZERO)?void 0:u.toAffine()}}function k(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function A(e){if(e.length<2||2!==e[0])throw new Error(`Invalid signature integer tag: ${I(e)}`);const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:U(r),left:e.subarray(t+2)}}t.Point=S,S.BASE=new S(f.Gx,f.Gy),S.ZERO=new S(i,i);class T{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!t)throw new TypeError(`${r}: Expected string or Uint8Array`);const n=t?I(e):e;if(128!==n.length)throw new Error(`${r}: Expected 64-byte hex`);return new T(B(n.slice(0,64)),B(n.slice(64,128)))}static fromDER(e){const t=e instanceof Uint8Array;if("string"!=typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error(`Invalid signature tag: ${I(e)}`);if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=A(e.subarray(2)),{data:n,left:i}=A(r);if(i.length)throw new Error(`Invalid signature: left bytes after parsing: ${I(i)}`);return{r:t,s:n}}(t?e:L(e));return new T(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!z(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!z(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=f.n>>o;return this.s>e}normalizeS(){return this.hasHighS()?new T(this.r,D(-this.s,f.n)):this}toDERRawBytes(){return L(this.toDERHex())}toDERHex(){const e=k(M(this.s)),t=k(M(this.r)),r=e.length/2,n=t.length/2,i=M(r),o=M(n);return`30${M(n+r+4)}02${o}${t}02${i}${e}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return L(this.toCompactHex())}toCompactHex(){return R(this.r)+R(this.s)}}function O(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),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.Signature=T;const P=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function I(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=P[e[r]];return t}const x=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function R(e){if("bigint"!=typeof e)throw new Error("Expected bigint");if(!(i<=e&&e<x))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function N(e){const t=L(R(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function M(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function B(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt(`0x${e}`)}function L(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function U(e){return B(I(e))}function C(e){return e instanceof Uint8Array?Uint8Array.from(e):L(e)}function j(e){if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"==typeof e&&z(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function D(e,t=f.P){const r=e%t;return r>=i?r:t+r}function F(e,t){const{P:r}=f;let n=e;for(;t-- >i;)n*=n,n%=r;return n}function H(e,t=f.P){if(e===i||t<=i)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=D(e,t),n=t,a=i,s=o,u=o,c=i;for(;r!==i;){const e=n/r,t=n%r,i=a-u*e,o=s-c*e;n=r,r=t,a=u,s=c,u=i,c=o}if(n!==o)throw new Error("invert: does not exist");return D(a,t)}function K(e,t=!1){const r=function(e){const t=8*e.length-8*d,r=U(e);return t>0?r>>BigInt(t):r}(e);if(t)return r;const{n}=f;return r>=n?r-n:r}let G,V;class W{constructor(e,t){if(this.hashLen=e,this.qByteLen=t,"number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}hmac(...e){return t.utils.hmacSha256(this.k,...e)}hmacSync(...e){return V(this.k,...e)}checkSync(){if("function"!=typeof V)throw new m("hmacSha256Sync needs to be set")}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(e=new Uint8Array){this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(e=new Uint8Array){this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=await this.hmac(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return O(...t)}generateSync(){this.checkSync(),this.incr();let e=0;const t=[];for(;e<this.qByteLen;){this.v=this.hmacSync(this.v);const r=this.v.slice();t.push(r),e+=this.v.length}return O(...t)}}function z(e){return i<e&&e<f.n}function q(e){return i<e&&e<f.P}function Z(e,t,r,n=!0){const{n:a}=f,s=K(e,!0);if(!z(s))return;const u=H(s,a),c=S.BASE.multiply(s),l=D(c.x,a);if(l===i)return;const h=D(u*D(t+r*l,a),a);if(h===i)return;let d=new T(l,h),p=(c.x===d.r?0:2)|Number(c.y&o);return n&&d.hasHighS()&&(d=d.normalizeS(),p^=1),{sig:d,recovery:p}}function $(e){let t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"==typeof e){if(e.length!==2*d)throw new Error("Expected 32 bytes of private key");t=B(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==d)throw new Error("Expected 32 bytes of private key");t=U(e)}if(!z(t))throw new Error("Expected private key: 0 < key < n");return t}function X(e){return e instanceof S?(e.assertValidity(),e):S.fromHex(e)}function Y(e){if(e instanceof T)return e.assertValidity(),e;try{return T.fromDER(e)}catch(t){return T.fromCompact(e)}}function J(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===p||n===y:r?n===2*p||n===2*y:e instanceof S}function Q(e){return U(e.length>h?e.slice(0,h):e)}function ee(e){const t=Q(e),r=D(t,f.n);return te(r<i?t:r)}function te(e){return N(e)}function re(e,r,n){if(null==e)throw new Error(`sign: expected valid message hash, not "${e}"`);const i=C(e),o=$(r),a=[te(o),ee(i)];if(null!=n){!0===n&&(n=t.utils.randomBytes(h));const e=C(n);if(e.length!==h)throw new Error(`sign: Expected ${h} bytes of extra data`);a.push(e)}return{seed:O(...a),m:Q(i),d:o}}function ne(e,t){const{sig:r,recovery:n}=e,{der:i,recovered:o}=Object.assign({canonical:!0,der:!0},t),a=i?r.toDERRawBytes():r.toCompactRawBytes();return o?[a,n]:a}t.getPublicKey=function(e,t=!1){return S.fromPrivateKey(e).toRawBytes(t)},t.recoverPublicKey=function(e,t,r,n=!1){return S.fromSignature(e,t,r).toRawBytes(n)},t.getSharedSecret=function(e,t,r=!1){if(J(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!J(t))throw new TypeError("getSharedSecret: second arg must be public key");const n=X(t);return n.assertValidity(),n.multiply($(e)).toRawBytes(r)},t.sign=async function(e,t,r={}){const{seed:n,m:i,d:o}=re(e,t,r.extraEntropy),a=new W(32,d);let s;for(await a.reseed(n);!(s=Z(await a.generate(),i,o,r.canonical));)await a.reseed();return ne(s,r)},t.signSync=function(e,t,r={}){const{seed:n,m:i,d:o}=re(e,t,r.extraEntropy),a=new W(32,d);let s;for(a.reseedSync(n);!(s=Z(a.generateSync(),i,o,r.canonical));)a.reseedSync();return ne(s,r)};const ie={strict:!0};function oe(e){return D(U(e),f.n)}t.verify=function(e,t,r,n=ie){let i;try{i=Y(e),t=C(t)}catch(e){return!1}const{r:o,s:a}=i;if(n.strict&&i.hasHighS())return!1;const s=K(t);let u;try{u=X(r)}catch(e){return!1}const{n:c}=f,l=H(a,c),h=D(s*l,c),d=D(o*l,c),p=S.BASE.multiplyAndAddUnsafe(u,h,d);return!!p&&D(p.x,c)===o};class ae{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=C(e);if(64!==t.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${t.length}`);const r=U(t.subarray(0,32)),n=U(t.subarray(32,64));return new ae(r,n)}assertValidity(){const{r:e,s:t}=this;if(!q(e)||!z(t))throw new Error("Invalid signature")}toHex(){return R(this.r)+R(this.s)}toRawBytes(){return L(this.toHex())}}class se{constructor(e,r,n=t.utils.randomBytes()){if(null==e)throw new TypeError(`sign: Expected valid message, not "${e}"`);this.m=C(e);const{x:i,scalar:o}=this.getScalar($(r));if(this.px=i,this.d=o,this.rand=C(n),32!==this.rand.length)throw new TypeError("sign: Expected 32 bytes of aux randomness")}getScalar(e){const t=S.fromPrivateKey(e),r=t.hasEvenY()?e:f.n-e;return{point:t,scalar:r,x:t.toRawX()}}initNonce(e,t){return N(e^U(t))}finalizeNonce(e){const t=D(U(e),f.n);if(t===i)throw new Error("sign: Creation of signature failed. k is zero");const{point:r,x:n,scalar:o}=this.getScalar(t);return{R:r,rx:n,k:o}}finalizeSig(e,t,r,n){return new ae(e.x,D(t+r*n,f.n)).toRawBytes()}error(){throw new Error("sign: Invalid signature produced")}async calc(){const{m:e,d:r,px:n,rand:i}=this,o=t.utils.taggedHash,a=this.initNonce(r,await o(de.aux,i)),{R:s,rx:u,k:f}=this.finalizeNonce(await o(de.nonce,a,n,e)),c=oe(await o(de.challenge,u,n,e)),l=this.finalizeSig(s,f,c,r);return await ce(l,e,n)||this.error(),l}calcSync(){const{m:e,d:r,px:n,rand:i}=this,o=t.utils.taggedHashSync,a=this.initNonce(r,o(de.aux,i)),{R:s,rx:u,k:f}=this.finalizeNonce(o(de.nonce,a,n,e)),c=oe(o(de.challenge,u,n,e)),l=this.finalizeSig(s,f,c,r);return le(l,e,n)||this.error(),l}}function ue(e,t,r){const n=e instanceof ae,i=n?e:ae.fromHex(e);return n&&i.assertValidity(),{...i,m:C(t),P:X(r)}}function fe(e,t,r,n){const i=S.BASE.multiplyAndAddUnsafe(t,$(r),D(-n,f.n));return!(!i||!i.hasEvenY()||i.x!==e)}async function ce(e,r,n){try{const{r:i,s:o,m:a,P:s}=ue(e,r,n),u=oe(await t.utils.taggedHash(de.challenge,N(i),s.toRawX(),a));return fe(i,s,o,u)}catch(e){return!1}}function le(e,r,n){try{const{r:i,s:o,m:a,P:s}=ue(e,r,n),u=oe(t.utils.taggedHashSync(de.challenge,N(i),s.toRawX(),a));return fe(i,s,o,u)}catch(e){if(e instanceof m)throw e;return!1}}t.schnorr={Signature:ae,getPublicKey:function(e){return S.fromPrivateKey(e).toRawX()},sign:async function(e,t,r){return new se(e,t,r).calc()},verify:ce,signSync:function(e,t,r){return new se(e,t,r).calcSync()},verifySync:le},S.BASE._setWindowSize(8);const he={node:n,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0},de={challenge:"BIP0340/challenge",aux:"BIP0340/aux",nonce:"BIP0340/nonce"},pe={};t.utils={bytesToHex:I,hexToBytes:L,concatBytes:O,mod:D,invert:H,isValidPrivateKey(e){try{return $(e),!0}catch(e){return!1}},_bigintTo32Bytes:N,_normalizePrivateKey:$,hashToPrivateKey:e=>{e=C(e);const t=d+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return N(D(U(e),f.n-o)+o)},randomBytes:(e=32)=>{if(he.web)return he.web.getRandomValues(new Uint8Array(e));if(he.node){const{randomBytes:t}=he.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.hashToPrivateKey(t.utils.randomBytes(d+8)),precompute(e=8,t=S.BASE){const r=t===S.BASE?t:new S(t.x,t.y);return r._setWindowSize(e),r.multiply(s),r},sha256:async(...e)=>{if(he.web){const t=await he.web.subtle.digest("SHA-256",O(...e));return new Uint8Array(t)}if(he.node){const{createHash:t}=he.node,r=t("sha256");return e.forEach((e=>r.update(e))),Uint8Array.from(r.digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(he.web){const r=await he.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=O(...t),i=await he.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(he.node){const{createHmac:r}=he.node,n=r("sha256",e);return t.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:async(e,...r)=>{let n=pe[e];if(void 0===n){const r=await t.utils.sha256(Uint8Array.from(e,(e=>e.charCodeAt(0))));n=O(r,r),pe[e]=n}return t.utils.sha256(n,...r)},taggedHashSync:(e,...t)=>{if("function"!=typeof G)throw new m("sha256Sync is undefined, you need to set it");let r=pe[e];if(void 0===r){const t=G(Uint8Array.from(e,(e=>e.charCodeAt(0))));r=O(t,t),pe[e]=r}return G(r,...t)},_JacobianPoint:w},Object.defineProperties(t.utils,{sha256Sync:{configurable:!1,get:()=>G,set(e){G||(G=e)}},hmacSha256Sync:{configurable:!1,get:()=>V,set(e){V||(V=e)}}})},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 O(e){if(e.message instanceof Error)throw e.message;throw new y(e)}function P(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];P.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&&O({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&&O({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)||O({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)&&O({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)||O({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)&&O({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)||O({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)&&O({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 R(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}O({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 N(e){if("function"!=typeof e)throw new l("fn","Function",e);try{e()}catch(e){return e}return T}function M(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(!M(t=e()))throw new d("instance of Promise","promiseFn",t)}else{if(!M(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";O({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(a).concat(o),stackStartFn:e})}if(r&&!R(t,r,n,e))throw t}function U(e,t,r,n){if(t!==T){if("string"==typeof r&&(n=r,r=void 0),!r||R(t,r)){var i=n?": ".concat(n):".",o="doesNotReject"===e.name?"rejection":"exception";O({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 C(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];P.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,N(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];U.apply(void 0,[e,N(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 U.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){C(t,r,n,e,"match")},A.doesNotMatch=function e(t,r,n){C(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 O=0,P=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]),O++),o+="\n ".concat(l[h-1]),O++),a=h,i+="\n".concat(_,"-").concat(E," ").concat(l[h]),O++;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]),O++),o+="\n ".concat(c[h-1]),O++),a=h,o+="\n".concat(w,"+").concat(E," ").concat(c[h]),O++;else{var R=l[h],N=c[h],M=N!==R&&(!m(N,",")||N.slice(0,-1)!==R);M&&m(R,",")&&R.slice(0,-1)===N&&(M=!1,N+=","),M?(x>1&&h>2&&(x>4?(o+="\n".concat(v,"...").concat(E),u=!0):x>3&&(o+="\n ".concat(c[h-2]),O++),o+="\n ".concat(c[h-1]),O++),a=h,o+="\n".concat(w,"+").concat(E," ").concat(N),i+="\n".concat(_,"-").concat(E," ").concat(R),O+=2):(o+=i,i="",1!==x&&0!==h||(o+="\n ".concat(N),O++))}if(O>20&&h<k-2)return"".concat(P).concat(I,"\n").concat(o,"\n").concat(v,"...").concat(E).concat(i,"\n")+"".concat(v,"...").concat(E)}return"".concat(P).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="",O=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(O,"\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,O=g.isBooleanObject,P=g.isBigIntObject,I=g.isSymbolObject,x=g.isFloat32Array,R=g.isFloat64Array;function N(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 M(e){return Object.keys(e).filter(N).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,U=1,C=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=M(e),p=M(t);return d.length===p.length&&H(e,t,r,n,U,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)&&!R(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=M(e),N=M(t);return g.length===N.length&&H(e,t,r,n,L,g)}if(E(e))return!(!E(t)||e.size!==t.size)&&H(e,t,r,n,C);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):O(e)?O(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):P(e)?P(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===U&&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===C){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(!V(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(!W(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===U)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 V(e,t,r){var n=G(r);return null!=n?n:t.has(n)&&!e.has(n)}function W(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)}}},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=>{O(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),O(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 R("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}getFee(){return R("__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=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)&&!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=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),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))?C(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=>C(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,U(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,U(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}=M(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}=M(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=C(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 O(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 P(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=P(c.p2sh,"Redeem script"),x=P(c.p2wsh,"Witness script");function R(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 M(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}=W(e,t,r);return(0,y.isP2TR)(n)?n.subarray(2,34):null}function U(e){return 64===e.length?e:e.subarray(0,64)}function C(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)=>W(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 V(e,t,r){const{script:n}=W(e,t,r);return n}function W(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);P.call(this,e,a.DEFLATE)}function _(e){if(!(this instanceof _))return new _(e);P.call(this,e,a.INFLATE)}function E(e){if(!(this instanceof E))return new E(e);P.call(this,e,a.GZIP)}function S(e){if(!(this instanceof S))return new S(e);P.call(this,e,a.GUNZIP)}function k(e){if(!(this instanceof k))return new k(e);P.call(this,e,a.DEFLATERAW)}function A(e){if(!(this instanceof A))return new A(e);P.call(this,e,a.INFLATERAW)}function T(e){if(!(this instanceof T))return new T(e);P.call(this,e,a.UNZIP)}function O(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 P(e,r){var n=this;if(this._opts=e=e||{},this._chunkSize=e.chunkSize||t.Z_DEFAULT_CHUNK,o.call(this,e),e.flush&&!O(e.flush))throw new Error("Invalid flush flag: "+e.flush);if(e.finishFlush&&!O(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(P,o),P.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)},P.prototype.reset=function(){return u(this._handle,"zlib binding closed"),this._handle.reset()},P.prototype._flush=function(e){this._transform(i.alloc(0),"",e)},P.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))},P.prototype.close=function(e){I(this,e),n.nextTick(x,this)},P.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"))},P.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,P),s.inherits(_,P),s.inherits(E,P),s.inherits(S,P),s.inherits(k,P),s.inherits(A,P),s.inherits(T,P)},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 P(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 R(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<=O)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=O));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 O=4096;function P(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 R(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 M(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 U(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 C(e,t,r,n,o){return t=+t,r>>>=0,o||U(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||U(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||M(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||M(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||M(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||M(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||M(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||M(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||M(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);M(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);M(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||M(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||M(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||M(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||M(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||M(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 C(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return C(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]||V(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 V(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 W=/[^+/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(W,"")).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),O=A.call(Function.call,Array.prototype.concat),P=A.call(Function.apply,Array.prototype.splice),I=A.call(Function.call,String.prototype.replace),x=A.call(Function.call,String.prototype.slice),R=A.call(Function.call,RegExp.prototype.exec),N=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,M=/\\(\\)?/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===R(/^%?[^%]*%?$/,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,N,(function(e,t,r,i){n[n.length]=r?I(i,M,"$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],P(r,O([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,R(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 _):O(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?O(e,s,t,!1):N(e,s)):O(e,s,t,!1)}else n||(s.reading=!1,N(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function O(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(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 P=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>=P?e=P:(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(R,e))}function R(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,C(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(M,e,t))}function M(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 U(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(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,C(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(U,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(R,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),R(e,t))}(e,r,n,t,o);else{var a=I(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||P(e,r),n?i.nextTick(O,e,r,a,o):O(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 O(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function P(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"),R(e,t)}))}function R(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||P(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,R(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 O(e){return(e<<1)-(e>4?9:0)}function P(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 R(e,t){e.pending_buf[e.pending++]=t}function N(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function M(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=M(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 U(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=M(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 C(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)),P(this.dyn_ltree),P(this.dyn_dtree),P(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),P(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*p+1),P(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,P(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 C(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 C(4,4,8,4,L),new C(4,5,16,8,L),new C(4,6,32,32,L),new C(4,4,16,16,U),new C(8,16,32,32,U),new C(8,16,128,128,U),new C(8,32,128,256,U),new C(32,128,258,1024,U),new C(32,258,258,4096,U)],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,R(i,31),R(i,139),R(i,8),i.gzhead?(R(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)),R(i,255&i.gzhead.time),R(i,i.gzhead.time>>8&255),R(i,i.gzhead.time>>16&255),R(i,i.gzhead.time>>24&255),R(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),R(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(R(i,255&i.gzhead.extra.length),R(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):(R(i,0),R(i,0),R(i,0),R(i,0),R(i,0),R(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),R(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,N(i,h),0!==i.strstart&&(N(i,e.adler>>>16),N(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));)R(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,R(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,R(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&&(R(i,255&e.adler),R(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&&O(t)<=O(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&&(P(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?(R(i,255&e.adler),R(i,e.adler>>8&255),R(i,e.adler>>16&255),R(i,e.adler>>24&255),R(i,255&e.total_in),R(i,e.total_in>>8&255),R(i,e.total_in>>16&255),R(i,e.total_in>>24&255)):(N(i,e.adler>>>16),N(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&&(P(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,O,P,I,x,R,N,M,B,L,U,C,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,U=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,C={bits:r.lenbits},U=s(0,r.lens,0,19,r.lencode,0,r.work,C),r.lenbits=C.bits,U){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,R=65535&D,!((I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(R<16)w>>>=I,_-=I,r.lens[r.have++]=R;else{if(16===R){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===R){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,C={bits:r.lenbits},U=s(1,r.lens,0,r.nlen,r.lencode,0,r.work,C),r.lenbits=C.bits,U){e.msg="invalid literal/lengths set",r.mode=h;break}if(r.distbits=6,r.distcode=r.distdyn,C={bits:r.distbits},U=s(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,C),r.distbits=C.bits,U){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,R=65535&D,!((I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(x&&!(240&x)){for(N=I,M=x,B=R;x=(D=r.lencode[B+((w&(1<<N+M)-1)>>N)])>>>16&255,R=65535&D,!(N+(I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}w>>>=N,_-=N,r.back+=N}if(w>>>=I,_-=I,r.back+=I,r.length=R,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,R=65535&D,!((I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}if(!(240&x)){for(N=I,M=x,B=R;x=(D=r.distcode[B+((w&(1<<N+M)-1)>>N)])>>>16&255,R=65535&D,!(N+(I=D>>>24)<=_);){if(0===m)break e;m--,w+=d[g++]<<_,_+=8}w>>>=N,_-=N,r.back+=N}if(w>>>=I,_-=I,r.back+=I,64&x){e.msg="invalid distance code",r.mode=h;break}r.offset=R,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,O=r.wsize-T):O=r.wnext-T,T>r.length&&(T=r.length),P=r.window}else P=p,O=b-r.offset,T=r.length;T>v&&(T=v),v-=T,r.length-=T;do{p[b++]=P[O++]}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:U=1;break e;case h:U=-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)&&U===u&&(U=-5),U)},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,O=0,P=0,I=0,x=0,R=0,N=0,M=null,B=0,L=new n.Buf16(16),U=new n.Buf16(16),C=null,j=0;for(S=0;S<=15;S++)L[S]=0;for(k=0;k<u;k++)L[t[r+k]]++;for(O=E,T=15;T>=1&&0===L[T];T--);if(O>T&&(O=T),0===T)return f[c++]=20971520,f[c++]=20971520,h.bits=1,0;for(A=1;A<T&&0===L[A];A++);for(O<A&&(O=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(U[1]=0,S=1;S<15;S++)U[S+1]=U[S]+L[S];for(k=0;k<u;k++)0!==t[r+k]&&(l[U[t[r+k]]++]=k);if(0===e?(M=C=l,m=19):1===e?(M=i,B-=257,C=o,j-=257,m=256):(M=a,C=s,m=-1),N=0,k=0,S=A,b=c,P=O,I=0,y=-1,g=(R=1<<O)-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){v=S-I,l[k]<m?(w=0,_=l[k]):l[k]>m?(w=C[j+l[k]],_=M[B+l[k]]):(w=96,_=0),d=1<<S-I,A=p=1<<P;do{f[b+(N>>I)+(p-=d)]=v<<24|w<<16|_}while(0!==p);for(d=1<<S-1;N&d;)d>>=1;if(0!==d?(N&=d-1,N+=d):N=0,k++,0==--L[S]){if(S===T)break;S=t[r+l[k]]}if(S>O&&(N&g)!==y){for(0===I&&(I=O),b+=A,x=1<<(P=S-I);P+I<T&&!((x-=L[P+I])<=0);)P++,x<<=1;if(R+=1<<P,1===e&&R>852||2===e&&R>592)return 1;f[y=N&g]=O<<24|P<<16|b-c}}return 0!==N&&(f[b+N]=S-I<<24|64<<16),h.bits=O,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 O(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 P(e,t,r){O(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 R(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 N(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 M(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&&M(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!M(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?P(e,i,t):(P(e,(a=b[i])+o+1,t),0!==(s=c[a])&&O(e,i-=m[a],s),P(e,a=A(--n),r),0!==(s=l[a])&&O(e,n-=E[a],s))}while(u<e.last_lit);P(e,256,t)}function U(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 C(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{P(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(P(e,i,e.bl_tree),s--),P(e,16,e.bl_tree),O(e,s-3,2)):s<=10?(P(e,17,e.bl_tree),O(e,s-3,3)):(P(e,18,e.bl_tree),O(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){O(e,0+(i?1:0),3),function(e,t,r,i){N(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,R(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)),U(e,e.l_desc),U(e,e.d_desc),s=function(e){var t;for(C(e,e.dyn_ltree,e.l_desc.max_code),C(e,e.dyn_dtree,e.d_desc.max_code),U(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?(O(e,2+(n?1:0),3),L(e,p,y)):(O(e,4+(n?1:0),3),function(e,t,r,n){var i;for(O(e,t-257,5),O(e,r-1,5),O(e,n-4,4),i=0;i<n;i++)O(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)),R(e),n&&N(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){O(e,2,3),P(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,O;A<16?(T=y(r,n,i,o,d,e[s[A]],l[0],f[A]),O=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]),O=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]),O=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]),O=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]),O=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=_,_=O}var P=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=P},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,O=0|this._hl,P=0;P<32;P+=2)t[P]=e.readInt32BE(4*P),t[P+1]=e.readInt32BE(4*P+4);for(;P<160;P+=2){var I=t[P-30],x=t[P-30+1],R=d(I,x),N=p(x,I),M=y(I=t[P-4],x=t[P-4+1]),B=g(x,I),L=t[P-14],U=t[P-14+1],C=t[P-32],j=t[P-32+1],D=N+U|0,F=R+L+b(D,N)|0;F=(F=F+M+b(D=D+B|0,B)|0)+C+b(D=D+j|0,j)|0,t[P]=F,t[P+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),V=l(r,w),W=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=O+q|0,Q=v+z+b(J,O)|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=W+G|0,te=V+K+b(ee,W)|0;v=m,O=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+O|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,O)|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,R(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 _):O(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?O(e,s,t,!1):N(e,s)):O(e,s,t,!1)}else n||(s.reading=!1,N(e,s));return!s.ended&&(s.length<s.highWaterMark||0===s.length)}function O(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(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 P=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>=P?e=P:(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(R,e))}function R(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,C(e)}function N(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(M,e,t))}function M(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 U(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(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,C(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(U,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(R,e,t),e._writableState.errorEmitted=!0,E(e,n)):(o(n),e._writableState.errorEmitted=!0,E(e,n),R(e,t))}(e,r,n,t,o);else{var a=I(r)||e.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||P(e,r),n?i.nextTick(O,e,r,a,o):O(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 O(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),R(e,t)}function P(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"),R(e,t)}))}function R(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||P(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,R(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 O(e){return void 0!==A&&(void 0===T.working&&(T.working=T(new A)),T.working?T(e):e instanceof A)}function P(e){return g(e,l)}function I(e){return g(e,h)}function x(e){return g(e,d)}function R(e){return u&&g(e,p)}function N(e){return f&&g(e,y)}t.isSharedArrayBuffer=O,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=P,t.isStringObject=I,t.isBooleanObject=x,t.isBigIntObject=R,t.isSymbolObject=N,t.isBoxedPrimitive=function(e){return P(e)||I(e)||x(e)||R(e)||N(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(E(e)||O(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 O(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 P=["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=[O((e=new Date).getHours()),O(e.getMinutes()),O(e.getSeconds())].join(":"),[e.getDate(),P[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 R(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(R.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 O(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 P=function(e){if(!(this instanceof P))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:o(e,!0)}),this._prepare()};P.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=O(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]},P.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=O(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},P.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=O(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 P(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 P(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 R=function(e,t,r){if(!(this instanceof R))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 P(e)};R.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},R.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 P(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 M=function(e){if(!(this instanceof M))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)};M.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},M.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},M.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 M||(t=new M(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new P(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:P,Counter:M,ModeOfOperation:{ecb:I,cbc:x,cfb:R,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&(W=0|a[1]),h=W>>>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,O=8191&(Y=0|a[9]),P=Y>>>13,I=8191&(J=0|s[0]),x=J>>>13,R=0|s[1],N=8191&R,M=R>>>13,B=0|s[2],L=8191&B,U=B>>>13,C=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,V=K>>>13,W=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,R=Math.imul(l,I),B=(B=Math.imul(l,x))+Math.imul(h,I)|0,D=Math.imul(h,x),K=(ee+(R+Math.imul(f,N)|0)|0)+((8191&(B=(B=B+Math.imul(f,M)|0)+Math.imul(c,N)|0))<<13)|0,ee=((D=D+Math.imul(c,M)|0)+(B>>>13)|0)+(K>>>26)|0,K&=67108863,R=Math.imul(d,I),B=(B=Math.imul(d,x))+Math.imul(p,I)|0,D=Math.imul(p,x),R=R+Math.imul(l,N)|0,B=(B=B+Math.imul(l,M)|0)+Math.imul(h,N)|0,D=D+Math.imul(h,M)|0,n=(ee+(R+Math.imul(f,L)|0)|0)+((8191&(B=(B=B+Math.imul(f,U)|0)+Math.imul(c,L)|0))<<13)|0,ee=((D=D+Math.imul(c,U)|0)+(B>>>13)|0)+(n>>>26)|0,n&=67108863,R=Math.imul(y,I),B=(B=Math.imul(y,x))+Math.imul(g,I)|0,D=Math.imul(g,x),R=R+Math.imul(d,N)|0,B=(B=B+Math.imul(d,M)|0)+Math.imul(p,N)|0,D=D+Math.imul(p,M)|0,R=R+Math.imul(l,L)|0,B=(B=B+Math.imul(l,U)|0)+Math.imul(h,L)|0,D=D+Math.imul(h,U)|0,i=(ee+(R+Math.imul(f,C)|0)|0)+((8191&(B=(B=B+Math.imul(f,j)|0)+Math.imul(c,C)|0))<<13)|0,ee=((D=D+Math.imul(c,j)|0)+(B>>>13)|0)+(i>>>26)|0,i&=67108863,R=Math.imul(b,I),B=(B=Math.imul(b,x))+Math.imul(m,I)|0,D=Math.imul(m,x),R=R+Math.imul(y,N)|0,B=(B=B+Math.imul(y,M)|0)+Math.imul(g,N)|0,D=D+Math.imul(g,M)|0,R=R+Math.imul(d,L)|0,B=(B=B+Math.imul(d,U)|0)+Math.imul(p,L)|0,D=D+Math.imul(p,U)|0,R=R+Math.imul(l,C)|0,B=(B=B+Math.imul(l,j)|0)+Math.imul(h,C)|0,D=D+Math.imul(h,j)|0,o=(ee+(R+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,R=Math.imul(v,I),B=(B=Math.imul(v,x))+Math.imul(w,I)|0,D=Math.imul(w,x),R=R+Math.imul(b,N)|0,B=(B=B+Math.imul(b,M)|0)+Math.imul(m,N)|0,D=D+Math.imul(m,M)|0,R=R+Math.imul(y,L)|0,B=(B=B+Math.imul(y,U)|0)+Math.imul(g,L)|0,D=D+Math.imul(g,U)|0,R=R+Math.imul(d,C)|0,B=(B=B+Math.imul(d,j)|0)+Math.imul(p,C)|0,D=D+Math.imul(p,j)|0,R=R+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+(R+Math.imul(f,G)|0)|0)+((8191&(B=(B=B+Math.imul(f,V)|0)+Math.imul(c,G)|0))<<13)|0,ee=((D=D+Math.imul(c,V)|0)+(B>>>13)|0)+(s>>>26)|0,s&=67108863,R=Math.imul(_,I),B=(B=Math.imul(_,x))+Math.imul(E,I)|0,D=Math.imul(E,x),R=R+Math.imul(v,N)|0,B=(B=B+Math.imul(v,M)|0)+Math.imul(w,N)|0,D=D+Math.imul(w,M)|0,R=R+Math.imul(b,L)|0,B=(B=B+Math.imul(b,U)|0)+Math.imul(m,L)|0,D=D+Math.imul(m,U)|0,R=R+Math.imul(y,C)|0,B=(B=B+Math.imul(y,j)|0)+Math.imul(g,C)|0,D=D+Math.imul(g,j)|0,R=R+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,R=R+Math.imul(l,G)|0,B=(B=B+Math.imul(l,V)|0)+Math.imul(h,G)|0,D=D+Math.imul(h,V)|0,a=(ee+(R+Math.imul(f,W)|0)|0)+((8191&(B=(B=B+Math.imul(f,z)|0)+Math.imul(c,W)|0))<<13)|0,ee=((D=D+Math.imul(c,z)|0)+(B>>>13)|0)+(a>>>26)|0,a&=67108863,R=Math.imul(S,I),B=(B=Math.imul(S,x))+Math.imul(k,I)|0,D=Math.imul(k,x),R=R+Math.imul(_,N)|0,B=(B=B+Math.imul(_,M)|0)+Math.imul(E,N)|0,D=D+Math.imul(E,M)|0,R=R+Math.imul(v,L)|0,B=(B=B+Math.imul(v,U)|0)+Math.imul(w,L)|0,D=D+Math.imul(w,U)|0,R=R+Math.imul(b,C)|0,B=(B=B+Math.imul(b,j)|0)+Math.imul(m,C)|0,D=D+Math.imul(m,j)|0,R=R+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,R=R+Math.imul(d,G)|0,B=(B=B+Math.imul(d,V)|0)+Math.imul(p,G)|0,D=D+Math.imul(p,V)|0,R=R+Math.imul(l,W)|0,B=(B=B+Math.imul(l,z)|0)+Math.imul(h,W)|0,D=D+Math.imul(h,z)|0,e=(ee+(R+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,R=Math.imul(A,I),B=(B=Math.imul(A,x))+Math.imul(T,I)|0,D=Math.imul(T,x),R=R+Math.imul(S,N)|0,B=(B=B+Math.imul(S,M)|0)+Math.imul(k,N)|0,D=D+Math.imul(k,M)|0,R=R+Math.imul(_,L)|0,B=(B=B+Math.imul(_,U)|0)+Math.imul(E,L)|0,D=D+Math.imul(E,U)|0,R=R+Math.imul(v,C)|0,B=(B=B+Math.imul(v,j)|0)+Math.imul(w,C)|0,D=D+Math.imul(w,j)|0,R=R+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,R=R+Math.imul(y,G)|0,B=(B=B+Math.imul(y,V)|0)+Math.imul(g,G)|0,D=D+Math.imul(g,V)|0,R=R+Math.imul(d,W)|0,B=(B=B+Math.imul(d,z)|0)+Math.imul(p,W)|0,D=D+Math.imul(p,z)|0,R=R+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+(R+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,R=Math.imul(O,I),B=(B=Math.imul(O,x))+Math.imul(P,I)|0,D=Math.imul(P,x),R=R+Math.imul(A,N)|0,B=(B=B+Math.imul(A,M)|0)+Math.imul(T,N)|0,D=D+Math.imul(T,M)|0,R=R+Math.imul(S,L)|0,B=(B=B+Math.imul(S,U)|0)+Math.imul(k,L)|0,D=D+Math.imul(k,U)|0,R=R+Math.imul(_,C)|0,B=(B=B+Math.imul(_,j)|0)+Math.imul(E,C)|0,D=D+Math.imul(E,j)|0,R=R+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,R=R+Math.imul(b,G)|0,B=(B=B+Math.imul(b,V)|0)+Math.imul(m,G)|0,D=D+Math.imul(m,V)|0,R=R+Math.imul(y,W)|0,B=(B=B+Math.imul(y,z)|0)+Math.imul(g,W)|0,D=D+Math.imul(g,z)|0,R=R+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,R=R+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+(R+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,R=Math.imul(O,N),B=(B=Math.imul(O,M))+Math.imul(P,N)|0,D=Math.imul(P,M),R=R+Math.imul(A,L)|0,B=(B=B+Math.imul(A,U)|0)+Math.imul(T,L)|0,D=D+Math.imul(T,U)|0,R=R+Math.imul(S,C)|0,B=(B=B+Math.imul(S,j)|0)+Math.imul(k,C)|0,D=D+Math.imul(k,j)|0,R=R+Math.imul(_,F)|0,B=(B=B+Math.imul(_,H)|0)+Math.imul(E,F)|0,D=D+Math.imul(E,H)|0,R=R+Math.imul(v,G)|0,B=(B=B+Math.imul(v,V)|0)+Math.imul(w,G)|0,D=D+Math.imul(w,V)|0,R=R+Math.imul(b,W)|0,B=(B=B+Math.imul(b,z)|0)+Math.imul(m,W)|0,D=D+Math.imul(m,z)|0,R=R+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,R=R+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+(R+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,R=Math.imul(O,L),B=(B=Math.imul(O,U))+Math.imul(P,L)|0,D=Math.imul(P,U),R=R+Math.imul(A,C)|0,B=(B=B+Math.imul(A,j)|0)+Math.imul(T,C)|0,D=D+Math.imul(T,j)|0,R=R+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,R=R+Math.imul(_,G)|0,B=(B=B+Math.imul(_,V)|0)+Math.imul(E,G)|0,D=D+Math.imul(E,V)|0,R=R+Math.imul(v,W)|0,B=(B=B+Math.imul(v,z)|0)+Math.imul(w,W)|0,D=D+Math.imul(w,z)|0,R=R+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,R=R+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+(R+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,R=Math.imul(O,C),B=(B=Math.imul(O,j))+Math.imul(P,C)|0,D=Math.imul(P,j),R=R+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,R=R+Math.imul(S,G)|0,B=(B=B+Math.imul(S,V)|0)+Math.imul(k,G)|0,D=D+Math.imul(k,V)|0,R=R+Math.imul(_,W)|0,B=(B=B+Math.imul(_,z)|0)+Math.imul(E,W)|0,D=D+Math.imul(E,z)|0,R=R+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,R=R+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+(R+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,R=Math.imul(O,F),B=(B=Math.imul(O,H))+Math.imul(P,F)|0,D=Math.imul(P,H),R=R+Math.imul(A,G)|0,B=(B=B+Math.imul(A,V)|0)+Math.imul(T,G)|0,D=D+Math.imul(T,V)|0,R=R+Math.imul(S,W)|0,B=(B=B+Math.imul(S,z)|0)+Math.imul(k,W)|0,D=D+Math.imul(k,z)|0,R=R+Math.imul(_,q)|0,B=(B=B+Math.imul(_,Z)|0)+Math.imul(E,q)|0,D=D+Math.imul(E,Z)|0,R=R+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+(R+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,R=Math.imul(O,G),B=(B=Math.imul(O,V))+Math.imul(P,G)|0,D=Math.imul(P,V),R=R+Math.imul(A,W)|0,B=(B=B+Math.imul(A,z)|0)+Math.imul(T,W)|0,D=D+Math.imul(T,z)|0,R=R+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,R=R+Math.imul(_,$)|0,B=(B=B+Math.imul(_,X)|0)+Math.imul(E,$)|0,D=D+Math.imul(E,X)|0,v=(ee+(R+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,R=Math.imul(O,W),B=(B=Math.imul(O,z))+Math.imul(P,W)|0,D=Math.imul(P,z),R=R+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,R=R+Math.imul(S,$)|0,B=(B=B+Math.imul(S,X)|0)+Math.imul(k,$)|0,D=D+Math.imul(k,X)|0,_=(ee+(R+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,R=Math.imul(O,q),B=(B=Math.imul(O,Z))+Math.imul(P,q)|0,D=Math.imul(P,Z),R=R+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+(R+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,R=Math.imul(O,$),B=(B=Math.imul(O,X))+Math.imul(P,$)|0,D=Math.imul(P,X),A=(ee+(R+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(O,Y)|0)+((8191&(B=(B=Math.imul(O,J))+Math.imul(P,Y)|0))<<13)|0,ee=((D=Math.imul(P,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 O=0;O<r.length;O+=2){var P=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),R=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),M=function(e,t,r){return(r=e&t^~e&r)<0&&(r+=4294967296),r}(w,E,k),B=this.k[O],L=this.k[O+1],U=r[O],C=r[O+1],j=y(P,I,x,R,N,M,B,L,U,C);U=g(P,I,x,R,N,M,B,L,U,C),P=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),R=function(e,t,r){return(r=e&t^e&r^t&r)<0&&(r+=4294967296),r}(i,f,p),C=l(P,I,x,R),R=h(P,I,x,R),A=S,T=k,S=_,k=E,_=v,E=w,v=l(b,m,j,U),w=h(m,m,j,U),b=d,m=p,d=u,p=f,u=n,f=i,n=l(j,U,C,R),i=h(j,U,C,R)}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,O,P,I,x,R,N,M,B,L,U,C,j,D,F,H,K,G,V,W,z,q,Z,$,X,Y,J=0;J<48;J+=2)P=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],M=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],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^(N<<1|M>>>31),e[2]^=c=P^(M<<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=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=N^(y<<1|p>>>31),e[6]^=c=M^(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|P>>>31),e[8]^=c=q^(P<<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,R=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,U=e[22]<<10|e[23]>>>22,C=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,V=e[17]<<23|e[16]>>>9,W=e[16]<<23|e[17]>>>9,T=e[26]<<25|e[27]>>>7,O=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,N=e[8]<<27|e[9]>>>5,M=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,P=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&O,e[30]=N^~B&U,e[31]=M^~L&C,e[40]=K^~V&z,e[41]=G^~W&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&P,e[23]=A^~O&I,e[32]=B^~U&j,e[33]=L^~C&D,e[42]=V^~z&Z,e[43]=W^~q&$,e[4]=o^~u&c,e[5]=a^~f&l,e[14]=g^~m&w,e[15]=b^~v&_,e[24]=T^~P&x,e[25]=O^~I&R,e[34]=U^~j&F,e[35]=C^~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]=P^~x&E,e[27]=I^~R&S,e[36]=j^~F&N,e[37]=D^~H&M,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]=R^~S&A,e[38]=F^~N&B,e[39]=H^~M&L,e[48]=X^~K&V,e[49]=Y^~G&W,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,O=0,P=null,I=!1,x=0,R=0,N=parseInt(1e3/a),M=void 0!==e?e:setTimeout,B=function(){if(I)return p(new Error("cancelled"),O/T);switch(x){case 0:u(g,w=32*R*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,A);if(v+=r,O+=r,(c=parseInt(1e3*O/T))!==P){if(I=p(null,O/T))break;P=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,A)}if(v+=r,O+=r,(c=parseInt(1e3*O/T))!==P){if(I=p(null,O/T))break;P=c}if(v<n)break;if(u(_,0,g,w,S),++R<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)}M(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 O(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 P={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(P);function x(e,t){return null!=e.author&&null==e.miner&&(e.miner=e.author),v(t?I:P,e)}I.transactions=w(_(O));var R={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(R,e)}var M={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(M,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 U,C,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:(U=u.hexlify,"0x",function(e){return e?U(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 V(){return(new Date).getTime()}function W(e){var t,r=C.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(W,C=m.Provider),W.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()},W.prototype.resetEventsBlock=function(e){this._lastBlockNumber=e-1,this.polling&&this._doPoll()},Object.defineProperty(W.prototype,"network",{get:function(){return this._network},enumerable:!0,configurable:!0}),W.prototype.getNetwork=function(){return this.ready},Object.defineProperty(W.prototype,"blockNumber",{get:function(){return this._fastBlockNumber},enumerable:!0,configurable:!0}),Object.defineProperty(W.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(W.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}),W.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},W.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)))},W.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)}))}))},W.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}))}))},W.prototype.getGasPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getGasPrice",{}).then((function(e){return s.bigNumberify(e)}))}))},W.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)}))}))}))}))},W.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()}))}))}))}))},W.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)}))}))}))}))},W.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)}))}))}))}))},W.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}))}))}))},W.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},W.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:N(e)},r.perform("call",e).then((function(e){return u.hexlify(e)}))}))}))}))},W.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)}))}))}))}))},W.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")}))}))},W.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=W.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})}))}))},W.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})}))}))},W.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)}))}))}))}))},W.prototype.getEtherPrice=function(){var e=this;return this.ready.then((function(){return e.perform("getEtherPrice",{}).then((function(e){return e}))}))},W.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}))},W.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}))},W.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}))}))},W.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}))},W.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}))}))},W.checkTransactionResponse=O,W.prototype.doPoll=function(){},W.prototype.perform=function(e,t){return b.throwError(e+" not implemented",b.NOT_IMPLEMENTED,{operation:e}),null},W.prototype._startPending=function(){b.warn("WARNING: this provider does not support pending events")},W.prototype._stopPending=function(){},W.prototype._addEventListener=function(e,t,r){this._events.push({tag:G(e),listener:t,once:r}),"pending"===e&&this._startPending(),this.polling=!0},W.prototype.on=function(e,t){return this._addEventListener(e,t,!1),this},W.prototype.once=function(e,t){return this._addEventListener(e,t,!0),this},W.prototype.addEventListener=function(e,t){return this.on(e,t)},W.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},W.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},W.prototype.listeners=function(e){var t=G(e);return this._events.filter((function(e){return e.tag===t})).map((function(e){return e.listener}))},W.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},W.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=W,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(O,A=_),O.prototype.encode=function(e){return c.arrayify([])},O.prototype.decode=function(e,t){if(t>e.length)throw new Error("invalid null");return{consumed:0,value:this.coerceFunc("null",void 0)}},O);function O(e,t){return A.call(this,e,"null","",t,!1)||this}var P,I=(i(x,P=_),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=P.call(this,e,o,o,n,!1)||this).size=t,i.signed=r,i}var R,N=new I((function(e,t){return t}),32,!1,"none"),M=(i(B,R=_),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 R.call(this,e,"bool","bool",t,!1)||this}var L,U=(i(C,L=_),C.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},C.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)))}},C);function C(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([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 W(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(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(W,D=_),W.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},W.prototype.decode=function(e,t){return(t=V(e,t,this.localName)).value=this.coerceFunc("bytes",c.hexlify(t.value)),t},o=W,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=V(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=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,Z(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=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:M,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 U(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 O(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=O(T(e,t),t),r),e)},r.fromSeed=function(e){return k(e,null)},r.mnemonicToSeed=A,r.mnemonicToEntropy=T,r.entropyToMnemonic=O,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 O,P=(i(I,O=e),I);function I(){return null!==O&&O.apply(this,arguments)||this}var x,R=(i(N,x=e),N);function N(){return null!==x&&x.apply(this,arguments)||this}function M(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(M,this),this.deployFunction||M.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 P({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 R({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}},4923:()=>{},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}}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var o=n[e]={exports:{}};return r[e](o,o.exports,i),o.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var o=Object.create(null);i.r(o);var a={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;"object"==typeof s&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach((e=>a[e]=()=>r[e]));return a.default=()=>r,i.d(o,a),o},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{i.d(o,{iy:()=>Le,G7:()=>Zr,GF:()=>D,wf:()=>f,P8:()=>mr,z4:()=>Z,qT:()=>On,kd:()=>O,cC:()=>Gr,Wj:()=>g,Bc:()=>pn,yo:()=>vi,aw:()=>an,tm:()=>fr,Qc:()=>ir,dF:()=>ri,Wb:()=>Vt,D_:()=>Mr,aS:()=>Br,uW:()=>pr,FV:()=>$n,UB:()=>fi,$7:()=>e,rE:()=>t,rR:()=>Or});var e={};i.r(e),i.d(e,{AddressGenerator:()=>Le,BitcoinUtils:()=>Zr,CalldataGenerator:()=>D,Compressor:()=>f,ContractBaseMetadata:()=>mr,DeploymentGenerator:()=>Z,DeploymentTransaction:()=>On,EcKeyPair:()=>O,FundingTransaction:()=>Gr,Generator:()=>g,InteractionTransaction:()=>pn,OPNetLimitedProvider:()=>vi,SharedInteractionTransaction:()=>an,TapscriptVerificator:()=>fr,TransactionBuilder:()=>ir,TransactionFactory:()=>ri,TransactionSequence:()=>Vt,TransactionType:()=>Mr,TweakedSigner:()=>Br,Wallet:()=>pr,WrapTransaction:()=>$n,WrappedGeneration:()=>fi,version:()=>t,wBTC:()=>Or});var t="1.0.8",r=i(8559),n=i.n(r);function a(e){return a="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},a(e)}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"!=a(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"compress",value:function(t){return n().gzipSync(t,e.zlibOptions)}},{key:"decompress",value:function(t){return n().gunzipSync(t,e.zlibOptions)}}])}();!function(e,t,r){(t=u(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(f,"zlibOptions",{level:9,maxOutputLength:16777216});var c=i(1757),l=i(8287).Buffer;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){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 p(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e,t){if("object"!=h(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}var g=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),p(this,"senderPubKey",void 0),p(this,"contractSaltPubKey",void 0),p(this,"network",c.o8.bitcoin),this.senderPubKey=t,this.contractSaltPubKey=r,this.network=n}return function(e,t,r){return t&&d(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"splitBufferIntoChunks",value:function(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DATA_CHUNK_SIZE,n=[],i=0;i<t.length;i+=r){for(var o=Math.min(r,t.length-i),a=l.alloc(o),s=0;s<o;s++)a.writeUInt8(t[i+s],s);n.push([a])}return n}}])}();p(g,"DATA_CHUNK_SIZE",512),p(g,"MAGIC",l.from("bsi","utf-8"));var b=i(852),m=i(8700),v=i(3513),w=i.t(v,2),_=i(8287).Buffer;function E(e){return E="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},E(e)}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,A(n.key),n)}}function k(e,t,r){return(t=A(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=E(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==E(t)?t:t+""}(0,c.f0)(w);var T="function"==typeof b.Ay?b.Ay:b.Ay.BIP32Factory,O=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&S(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"fromWIF",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin;return this.ECPair.fromWIF(e,t)}},{key:"fromPrivateKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.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]:c.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]:c.o8.bitcoin,n=this.verifyPubKeys(e,r),i=c.KT.p2wsh({redeem:c.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]:c.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]:c.o8.bitcoin,r=c.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]:c.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]:c.o8.bitcoin;return!!c.hl.toOutputScript(e,t)}},{key:"getLegacyAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin,r=c.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]:c.o8.bitcoin;return this.ECPair.makeRandom({network:e})}},{key:"fromSeed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin;return this.BIP32.fromSeed(e,t)}},{key:"getTaprootAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin,r=e.publicKey.slice(1,33),n=_.concat([_.from([81,32]),r]);return c.hl.fromOutputScript(n,t)}},{key:"getTaprootAddressFromAddress",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin,r=c.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]:c.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})}}])}();k(O,"BIP32",T(w)),k(O,"ECPair",(0,m.dg)(w));var P=i(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 x(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||R(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.")}()}function R(e,t){if(e){if("string"==typeof e)return N(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)?N(e,t):void 0}}function N(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 M(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,B(n.key),n)}}function B(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+""}function L(e,t,r){return t=C(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,U()?Reflect.construct(t,r||[],C(e).constructor):t.apply(e,r))}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(U=function(){return!!e})()}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},C(e)}function j(e,t){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},j(e,t)}var D=function(e){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),L(this,t,[e,r,n])}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&&j(e,t)}(t,e),function(e,t,r){return t&&M(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"compile",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=this.splitBufferIntoChunks(e);if(!o.length)throw new Error("No data chunks found");var a=[this.senderPubKey,c.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,c.Ez.OP_CHECKSIGVERIFY,c.Ez.OP_HASH160,c.Et.hash160(this.senderPubKey),c.Ez.OP_EQUALVERIFY,c.Ez.OP_HASH160,c.Et.hash160(t),c.Ez.OP_EQUALVERIFY,c.Ez.OP_DEPTH,c.Ez.OP_1,c.Ez.OP_NUMEQUAL,c.Ez.OP_IF,g.MAGIC];if(n.length>0){var s,u,f=this.getPubKeyAsBuffer(n),l=this.splitBufferIntoChunks(f);if(a=(s=a).concat.apply(s,[c.Ez.OP_0].concat(x(l))),!i)throw new Error("Minimum signatures must be provided");if(i>255)throw new Error("Minimum signatures cannot exceed 255");var h=P.alloc(2);h.writeUint16LE(i,0),a=(u=a).concat.apply(u,[c.Ez.OP_1,h])}var d=(a=(r=a).concat.apply(r,[c.Ez.OP_1NEGATE].concat(x(o),[c.Ez.OP_ELSE,c.Ez.OP_1,c.Ez.OP_ENDIF]))).flat(),p=c.K$.compile(d);if(!c.K$.decompile(p))throw new Error("Failed to decompile script??");return p}},{key:"getPubKeyAsBuffer",value:function(e){var t,r=P.alloc(0),n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=R(e))){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}}}}(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(!O.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=P.concat([r,i])}}catch(e){n.e(e)}finally{n.f()}var o=f.compress(r);return o.byteLength>=r.byteLength?r:o}}])}(g);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 H(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 K(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 G(e){var t=function(e,t){if("object"!=F(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=F(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==F(t)?t:t+""}function V(e,t,r){return t=z(t),function(e,t){if(t&&("object"==F(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,W()?Reflect.construct(t,r||[],z(e).constructor):t.apply(e,r))}function W(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(W=function(){return!!e})()}function z(e){return z=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},z(e)}function q(e,t){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},q(e,t)}var Z=function(e){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),V(this,t,[e,r,n])}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&&q(e,t)}(t,e),function(e,t,r){return t&&K(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"compile",value:function(e,t){var r=this.getAsm(e,t),n=c.K$.compile(r);if(!c.K$.decompile(n))throw new Error("Failed to decompile script??");return n}},{key:"getAsm",value:function(e,t){var r=this.splitBufferIntoChunks(e);return[this.senderPubKey,c.Ez.OP_CHECKSIGVERIFY,this.contractSaltPubKey,c.Ez.OP_CHECKSIGVERIFY,c.Ez.OP_HASH160,c.Et.hash160(this.senderPubKey),c.Ez.OP_EQUALVERIFY,c.Ez.OP_HASH256,c.Et.hash256(t),c.Ez.OP_EQUALVERIFY,c.Ez.OP_DEPTH,c.Ez.OP_1,c.Ez.OP_NUMEQUAL,c.Ez.OP_IF,g.MAGIC,c.Ez.OP_1NEGATE].concat(function(e){return function(e){if(Array.isArray(e))return H(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 H(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)?H(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),[c.Ez.OP_ELSE,c.Ez.OP_1,c.Ez.OP_ENDIF]).flat()}}])}(g);function $(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function X(e,...t){if(!function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}(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 Y(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");$(e.outputLen),$(e.blockLen)}function J(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")}const Q=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ee=(e,t)=>e<<32-t|e>>>t;function te(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)),X(e),e}new Uint8Array(new Uint32Array([287454020]).buffer)[0];class re{clone(){return this._cloneInto()}}const ne={}.toString;function ie(e){const t=t=>e().update(te(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}class oe extends re{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Y(e);const r=te(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 n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return J(this),this.iHash.update(e),this}digestInto(e){J(this),X(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()}}const ae=(e,t,r)=>new oe(e,t).update(r).digest();ae.create=(e,t)=>new oe(e,t);const se=(e,t,r)=>e&t^~e&r,ue=(e,t,r)=>e&t^e&r^t&r;class fe extends re{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=Q(this.buffer)}update(e){J(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=te(e)).length;for(let o=0;o<i;){const a=Math.min(n-this.pos,i-o);if(a!==n)r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=Q(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){J(this),function(e,t){X(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:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;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,n-8,BigInt(8*this.length),i),this.process(r,0);const a=Q(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=s/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)a.setUint32(4*e,f[e],i)}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 ce=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]),le=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),he=new Uint32Array(64);class de extends fe{constructor(){super(64,32,8,!1),this.A=0|le[0],this.B=0|le[1],this.C=0|le[2],this.D=0|le[3],this.E=0|le[4],this.F=0|le[5],this.G=0|le[6],this.H=0|le[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)he[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=he[e-15],r=he[e-2],n=ee(t,7)^ee(t,18)^t>>>3,i=ee(r,17)^ee(r,19)^r>>>10;he[e]=i+he[e-7]+n+he[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:f}=this;for(let e=0;e<64;e++){const t=f+(ee(a,6)^ee(a,11)^ee(a,25))+se(a,s,u)+ce[e]+he[e]|0,c=(ee(r,2)^ee(r,13)^ee(r,22))+ue(r,n,i)|0;f=u,u=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+c|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,n,i,o,a,s,u,f)}roundClean(){he.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const pe=ie((()=>new de)),ye=BigInt(2**32-1),ge=BigInt(32);function be(e,t=!1){return t?{h:Number(e&ye),l:Number(e>>ge&ye)}:{h:0|Number(e>>ge&ye),l:0|Number(e&ye)}}const me={fromBig:be,split: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}=be(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]},toBig:(e,t)=>BigInt(e>>>0)<<ge|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:function(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},ve=me,[we,_e]=(()=>ve.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)))))(),Ee=new Uint32Array(80),Se=new Uint32Array(80);class ke extends fe{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)Ee[r]=e.getUint32(t),Se[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Ee[e-15],r=0|Se[e-15],n=ve.rotrSH(t,r,1)^ve.rotrSH(t,r,8)^ve.shrSH(t,r,7),i=ve.rotrSL(t,r,1)^ve.rotrSL(t,r,8)^ve.shrSL(t,r,7),o=0|Ee[e-2],a=0|Se[e-2],s=ve.rotrSH(o,a,19)^ve.rotrBH(o,a,61)^ve.shrSH(o,a,6),u=ve.rotrSL(o,a,19)^ve.rotrBL(o,a,61)^ve.shrSL(o,a,6),f=ve.add4L(i,u,Se[e-7],Se[e-16]),c=ve.add4H(f,n,s,Ee[e-7],Ee[e-16]);Ee[e]=0|c,Se[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=ve.rotrSH(c,l,14)^ve.rotrSH(c,l,18)^ve.rotrBH(c,l,41),m=ve.rotrSL(c,l,14)^ve.rotrSL(c,l,18)^ve.rotrBL(c,l,41),v=c&h^~c&p,w=l&d^~l&y,_=ve.add5L(b,m,w,_e[e],Se[e]),E=ve.add5H(_,g,t,v,we[e],Ee[e]),S=0|_,k=ve.rotrSH(r,n,28)^ve.rotrBH(r,n,34)^ve.rotrBH(r,n,39),A=ve.rotrSL(r,n,28)^ve.rotrBL(r,n,34)^ve.rotrBL(r,n,39),T=r&i^r&a^i&a,O=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}=ve.add(0|u,0|f,0|E,0|S)),u=0|a,f=0|s,a=0|i,s=0|o,i=0|r,o=0|n;const P=ve.add3L(S,A,O);r=ve.add3H(P,E,k,T),n=0|P}({h:r,l:n}=ve.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=ve.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=ve.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:f}=ve.add(0|this.Dh,0|this.Dl,0|u,0|f)),({h:c,l}=ve.add(0|this.Eh,0|this.El,0|c,0|l)),({h,l:d}=ve.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=ve.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=ve.add(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(){Ee.fill(0),Se.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 Ae=ie((()=>new ke));var Te=i(1324),Oe=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")}(),Pe=Oe.crypto||Oe.msCrypto;function Ie(e){switch(e){case"sha256":return pe.create();case"sha512":return Ae.create()}(0,Te.assertArgument)(!1,"invalid hashing algorithm name","algorithm",e)}const xe={createHash:Ie,createHmac:function(e,t){var r={sha256:pe,sha512:Ae}[e];return(0,Te.assertArgument)(null!=r,"invalid hmac algorithm","algorithm",e),ae.create(r,t)},pbkdf2Sync:function(e,t,r,n,i){var o={sha256:pe,sha512:Ae}[i];return(0,Te.assertArgument)(null!=o,"invalid pbkdf2 algorithm","algorithm",i),function(e,t,r,n){const{c:i,dkLen:o,DK:a,PRF:s,PRFSalt:u}=function(e,t,r,n){Y(e);const i=function(e,t){if(void 0!==t&&"[object Object]"!==ne.call(t))throw new Error("Options should be object or undefined");return Object.assign({dkLen:32,asyncTick:10},t)}(0,n),{c:o,dkLen:a,asyncTick:s}=i;if($(o),$(a),$(s),o<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const u=te(t),f=te(r),c=new Uint8Array(a),l=ae.create(e,u),h=l._cloneInto().update(f);return{c:o,dkLen:a,asyncTick:s,DK:c,PRF:l,PRFSalt:h}}(e,t,r,n);let f;const c=new Uint8Array(4),l=Q(c),h=new Uint8Array(s.outputLen);for(let e=1,t=0;t<o;e++,t+=s.outputLen){const r=a.subarray(t,t+s.outputLen);l.setInt32(0,e,!1),(f=u._cloneInto(f)).update(c).digestInto(h),r.set(h.subarray(0,r.length));for(let e=1;e<i;e++){s._cloneInto(f).update(h).digestInto(h);for(let e=0;e<r.length;e++)r[e]^=h[e]}}return function(e,t,r,n,i){return e.destroy(),t.destroy(),n&&n.destroy(),i.fill(0),r}(s,u,a,f,h)}(o,e,t,{c:r,dkLen:n})},randomBytes:function(e){assert(null!=Pe,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),(0,Te.assertArgument)(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);var t=new Uint8Array(e);return Pe.getRandomValues(t),t}};var Re=i(2343);function Ne(e){return Ne="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},Ne(e)}function Me(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,Be(n.key),n)}}function Be(e){var t=function(e,t){if("object"!=Ne(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ne(t)?t:t+""}(0,c.f0)(w);var Le=function(){return function(e,t,r){return r&&Me(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),0,[{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 Ie("ripemd160").update(e).digest()}},{key:"toSegwitAddress",value:function(e,t){var r=Re.bech32.toWords(e);return r.unshift(0),Re.bech32.encode(t.bech32,r)}}])}(),Ue=i(477),Ce=i(606),je={d:(e,t)=>{for(var r in t)je.o(t,r)&&!je.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})}},De={};je.d(De,{q$:()=>Kt,Vy:()=>Gt,$7:()=>Fe,rE:()=>He});var Fe={};je.r(Fe),je.d(Fe,{DebugLevel:()=>Kt,Logger:()=>Gt,version:()=>He});var He="1.0.1";function Ke(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 Ge=(e=0)=>t=>`[${t+e}m`,Ve=(e=0)=>t=>`[${38+e};5;${t}m`,We=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,ze={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(ze.modifier),Object.keys(ze.color),Object.keys(ze.bgColor);const qe=function(){const e=new Map;for(const[t,r]of Object.entries(ze)){for(const[t,n]of Object.entries(r))ze[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=ze[t],e.set(n[0],n[1]);Object.defineProperty(ze,t,{value:r,enumerable:!1})}return Object.defineProperty(ze,"codes",{value:e,enumerable:!1}),ze.color.close="",ze.bgColor.close="",ze.color.ansi=Ge(),ze.color.ansi256=Ve(),ze.color.ansi16m=We(),ze.bgColor.ansi=Ge(10),ze.bgColor.ansi256=Ve(10),ze.bgColor.ansi16m=We(10),Object.defineProperties(ze,{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=>ze.rgbToAnsi256(...ze.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)=>ze.ansi256ToAnsi(ze.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>ze.ansi256ToAnsi(ze.hexToAnsi256(e)),enumerable:!1}}),ze}(),Ze=(()=>{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})(),$e=0!==Ze&&{level:Ze,hasBasic:!0,has256:Ze>=2,has16m:Ze>=3},Xe={stdout:$e,stderr:$e};function Ye(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:Je,stderr:Qe}=Xe,et=Symbol("GENERATOR"),tt=Symbol("STYLER"),rt=Symbol("IS_EMPTY"),nt=["ansi","ansi","ansi256","ansi16m"],it=Object.create(null);class ot{constructor(e){return at(e)}}const at=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=Je?Je.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,st.prototype),t};function st(e){return at(e)}Object.setPrototypeOf(st.prototype,Function.prototype);for(const[e,t]of Object.entries(qe))it[e]={get(){const r=ht(this,lt(t.open,t.close,this[tt]),this[rt]);return Object.defineProperty(this,e,{value:r}),r}};it.visible={get(){const e=ht(this,this[tt],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const ut=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?qe[r].ansi16m(...n):"ansi256"===t?qe[r].ansi256(qe.rgbToAnsi256(...n)):qe[r].ansi(qe.rgbToAnsi(...n)):"hex"===e?ut("rgb",t,r,...qe.hexToRgb(...n)):qe[r][e](...n),ft=["rgb","hex","ansi256"];for(const e of ft)it[e]={get(){const{level:t}=this;return function(...r){const n=lt(ut(e,nt[t],"color",...r),qe.color.close,this[tt]);return ht(this,n,this[rt])}}},it["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=lt(ut(e,nt[t],"bgColor",...r),qe.bgColor.close,this[tt]);return ht(this,n,this[rt])}}};const ct=Object.defineProperties((()=>{}),{...it,level:{enumerable:!0,get(){return this[et].level},set(e){this[et].level=e}}}),lt=(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}},ht=(e,t,r)=>{const n=(...e)=>dt(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,ct),n[et]=e,n[tt]=t,n[rt]=r,n},dt=(e,t)=>{if(e.level<=0||!t)return e[rt]?"":t;let r=e[tt];if(void 0===r)return t;const{openAll:n,closeAll:i}=r;if(t.includes(""))for(;void 0!==r;)t=Ye(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 pt(e){return pt="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},pt(e)}function yt(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 gt(e,t,r){return(t=bt(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bt(e){var t=function(e,t){if("object"!=pt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pt(t)?t:t+""}function mt(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(st.prototype,it),st(),st({level:Qe?Qe.level:0});var vt=new WeakMap,wt=new WeakMap,_t=new WeakMap,Et=new WeakMap,St=new WeakMap,kt=new WeakMap,At=new WeakMap,Tt=new WeakMap,Ot=new WeakMap,Pt=new WeakMap,It=new WeakMap,xt=new WeakMap,Rt=new WeakMap,Nt=new WeakMap,Mt=new WeakMap,Bt=new WeakMap,Lt=new WeakMap,Ut=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ot;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),gt(this,"chalk",void 0),gt(this,"moduleName",""),gt(this,"logColor","#00bfff"),gt(this,"enableLogs",!0),gt(this,"hideLogs",!1),yt(this,vt,"#ff00ff"),yt(this,wt,Ke(mt(vt,this),75)),yt(this,_t,"#9400d3"),yt(this,Et,Ke(mt(_t,this),15)),yt(this,St,Ke(mt(Et,this),15)),yt(this,kt,"#7cfc00"),yt(this,At,Ke(mt(kt,this),15)),yt(this,Tt,"#ffdead"),yt(this,Ot,Ke(mt(Tt,this),15)),yt(this,Pt,"#ff8c00"),yt(this,It,Ke(mt(Pt,this),15)),yt(this,xt,"#ff4500"),yt(this,Rt,Ke(mt(xt,this),15)),yt(this,Nt,"#ffffff"),yt(this,Mt,Ke(mt(Nt,this),15)),yt(this,Bt,"#8b0000"),yt(this,Lt,Ke(mt(Bt,this),15)),gt(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(mt(vt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(mt(Nt,this))(e)+" "+this.chalk.hex(mt(It,this))(t)+" "+this.chalk.hex(mt(Nt,this))(r)+" "+this.chalk.hex(mt(St,this))(n)+" "+this.chalk.hex(mt(Nt,this))(i))}},{key:"log",value:function(){if(this.enableLogs&&!this.hideLogs){var e=Ke(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(mt(It,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," LOG]: "))+this.chalk.hex(mt(Nt,this)).apply(void 0,arguments)))}},{key:"error",value:function(){this.enableLogs&&console.log(this.chalk.hex(mt(xt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," ERROR]: "))+this.chalk.hex(mt(Rt,this)).apply(void 0,arguments))}},{key:"warn",value:function(){this.enableLogs&&console.log(this.chalk.hex(mt(Pt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," WARN]: "))+this.chalk.hex(mt(It,this)).apply(void 0,arguments))}},{key:"debug",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(mt(Tt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(mt(Ot,this)).apply(void 0,arguments)))}},{key:"success",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(mt(kt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," SUCCESS]: "))+this.chalk.hex(mt(At,this)).apply(void 0,arguments)))}},{key:"fail",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(mt(xt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," FAIL]: "))+this.chalk.hex(mt(Rt,this)).apply(void 0,arguments)))}},{key:"debugBright",value:function(){this.enableLogs&&(this.hideLogs||console.log(this.chalk.hex(mt(_t,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," DEBUG]: "))+this.chalk.hex(mt(Et,this)).apply(void 0,arguments)))}},{key:"important",value:function(){this.enableLogs&&console.log(this.chalk.hex(mt(vt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," IMPORTANT]: "))+this.chalk.hex(mt(wt,this)).apply(void 0,arguments))}},{key:"panic",value:function(){this.enableLogs&&console.log(this.chalk.hex(mt(Bt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," HELP PANIC]: "))+this.chalk.hex(mt(Lt,this)).apply(void 0,arguments))}},{key:"info",value:function(){this.enableLogs&&console.log(this.chalk.hex(mt(vt,this))("".concat(this.getStartPrefix(),"[").concat(this.moduleName," INFO]: "))+this.chalk.hex(mt(Nt,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(mt(Mt,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,bt(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ct(e){return Ct="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},Ct(e)}function jt(e,t,r){return t=Ft(t),function(e,t){if(t&&("object"===Ct(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,Dt()?Reflect.construct(t,r||[],Ft(e).constructor):t.apply(e,r))}function Dt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Dt=function(){return!!e})()}function Ft(e){return Ft=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Ft(e)}function Ht(e,t){return Ht=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Ht(e,t)}var Kt,Gt=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),jt(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&&Ht(e,t)}(t,Ut),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"}(Kt||(Kt={}));var Vt,Wt=De.Vy,zt=i(8287).Buffer;function qt(e){return qt="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},qt(e)}function Zt(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=$t(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 $t(e,t){if(e){if("string"==typeof e)return Xt(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)?Xt(e,t):void 0}}function Xt(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 Yt(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,nr(n.key),n)}}function Jt(e,t,r){return t=er(t),function(e,t){if(t&&("object"==qt(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,Qt()?Reflect.construct(t,r||[],er(e).constructor):t.apply(e,r))}function Qt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Qt=function(){return!!e})()}function er(e){return er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},er(e)}function tr(e,t){return tr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},tr(e,t)}function rr(e,t,r){return(t=nr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nr(e){var t=function(e,t){if("object"!=qt(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=qt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qt(t)?t:t+""}!function(e){e[e.REPLACE_BY_FEE=4294967293]="REPLACE_BY_FEE",e[e.FINAL=4294967295]="FINAL"}(Vt||(Vt={}));var ir=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),rr(r=Jt(this,t),"logColor","#785def"),rr(r,"transactionFee",0n),rr(r,"sequence",Vt.REPLACE_BY_FEE),rr(r,"transaction",void 0),rr(r,"inputs",[]),rr(r,"updateInputs",[]),rr(r,"outputs",[]),rr(r,"feeOutput",null),rr(r,"signed",!1),rr(r,"tapData",null),rr(r,"scriptData",null),rr(r,"totalInputAmount",void 0),rr(r,"signer",void 0),rr(r,"network",void 0),rr(r,"feeRate",void 0),rr(r,"priorityFee",void 0),rr(r,"utxos",void 0),rr(r,"to",void 0),rr(r,"from",void 0),rr(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||void 0,r.from=t.getFrom(e.from,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 c.iL({network:r.network}),r}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&&tr(e,t)}(t,e),function(e,t,r){return t&&Yt(e.prototype,t),r&&Yt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{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,childTransactionRequiredValue: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&&!O.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");this.sequence=Vt.FINAL;var e,t=Zt(this.inputs);try{for(t.s();!(e=t.n()).done;)e.value.sequence=Vt.FINAL}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=Zt(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=Zt(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=Zt(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:zt.from(r.scriptPubKey.hex,"hex")},sequence:this.sequence};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"witnessStackToScriptWitness",value:function(e){var t,r=zt.allocUnsafe(0);function n(e){var t=r.length,n=Ce.varuint.encodingLength(e);r=zt.concat([r,zt.allocUnsafe(n)]),Ce.varuint.encode(e,r,t)}return n((t=e).length),t.forEach((function(e){n(e.length),function(e){r=zt.concat([r,zt.from(e)])}(e)})),r}},{key:"internalInit",value:function(){this.verifyUTXOValidity(),this.scriptData=c.KT.p2tr(this.generateScriptAddress()),this.tapData=c.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=function(e){return function(e){if(Array.isArray(e))return Xt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||$t(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.")}()}(this.outputs);return this.feeOutput&&e.push(this.feeOutput),e}},{key:"verifyUTXOValidity",value:function(){var e,t=Zt(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,Ue.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 c.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.")}}],[{key:"getFrom",value:function(e,t,r){return e||O.getTaprootAddress(t,r)}}])}(Wt);rr(ir,"LOCK_LEAF_SCRIPT",c.K$.compile([c.Ez.OP_0])),rr(ir,"MINIMUM_DUST",330n),(0,c.f0)(w);var or=i(8287).Buffer;function ar(e){return ar="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},ar(e)}function sr(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,ur(n.key),n)}}function ur(e){var t=function(e,t){if("object"!=ar(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ar(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ar(t)?t:t+""}var fr=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&sr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"getContractAddress",value:function(t){var r=t.network||c.o8.bitcoin,n=[{output:new Z(t.deployerPubKeyXOnly,(0,Ue.toXOnly)(t.contractSaltPubKey),r).compile(t.bytecode,t.originalSalt),version:e.TAP_SCRIPT_VERSION},{output:ir.LOCK_LEAF_SCRIPT,version:e.TAP_SCRIPT_VERSION}];return e.generateAddressFromScript(t,n)}},{key:"getContractSeed",value:function(e,t,r){var n=c.Et.hash256(t),i=or.concat([e,r,n]);return c.Et.hash256(i)}},{key:"generateContractVirtualAddress",value:function(t,r,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.o8.bitcoin,o=e.getContractSeed(t,r,n);return Le.generatePKSH(o,i)}},{key:"generateAddressFromScript",value:function(e,t){var r=e.network||c.o8.bitcoin,n={internalPubkey:e.deployerPubKeyXOnly,network:r,scriptTree:t};return c.KT.p2tr(n).address}}])}();function cr(e){return cr="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},cr(e)}function lr(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,dr(n.key),n)}}function hr(e,t,r){return(t=dr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dr(e){var t=function(e,t){if("object"!=cr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=cr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==cr(t)?t:t+""}!function(e,t,r){(t=ur(t))in e?Object.defineProperty(e,t,{value:192,enumerable:!0,configurable:!0,writable:!0}):e[t]=192}(fr,"TAP_SCRIPT_VERSION");var pr=function(){return function(e,t,r){return t&&lr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),hr(this,"network",void 0),hr(this,"_keypair",void 0),hr(this,"_p2wpkh",void 0),hr(this,"_p2tr",void 0),this.network=r,this._keypair=O.fromWIF(t.privateKey,this.network),this._p2wpkh=O.getP2WPKHAddress(this._keypair,this.network),this._p2tr=O.getTaprootAddress(this._keypair,this.network)}),[{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,Ue.toXOnly)(this.keypair.publicKey)}}])}();function yr(e){return yr="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},yr(e)}function gr(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,br(n.key),n)}}function br(e){var t=function(e,t){if("object"!=yr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=yr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==yr(t)?t:t+""}var mr=function(){return function(e,t,r){return t&&gr(e.prototype,t),r&&gr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.o8.bitcoin;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),function(e,t,r){(t=br(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"network",void 0),this.network=t}),[{key:"getAddress",value:function(){return this.address}}],[{key:"getAddress",value:function(){throw arguments.length>0&&void 0!==arguments[0]||c.o8.bitcoin,new Error("Method not implemented.")}}])}();function vr(e){return vr="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},vr(e)}function wr(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,Tr(n.key),n)}}function _r(e,t,r){return t=Sr(t),function(e,t){if(t&&("object"==vr(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,Er()?Reflect.construct(t,r||[],Sr(e).constructor):t.apply(e,r))}function Er(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Er=function(){return!!e})()}function Sr(e){return Sr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Sr(e)}function kr(e,t){return kr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},kr(e,t)}function Ar(e,t,r){return(t=Tr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tr(e){var t=function(e,t){if("object"!=vr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==vr(t)?t:t+""}var Or=function(e){function t(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.o8.bitcoin;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Ar(e=_r(this,t,[r]),"network",void 0),Ar(e,"tokenName","Wrapped Bitcoin"),Ar(e,"tokenSymbol","wBTC"),Ar(e,"decimals",8),Ar(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&&kr(e,t)}(t,e),function(e,t,r){return r&&wr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,0,[{key:"getAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.o8.bitcoin;switch(e){case c.o8.bitcoin:case c.o8.regtest:return"bcrt1pcw0828yjrtlrc6mkp3lkq30j7wc7slsh7k7dyh53mrs4f8d74l6qumhqp4";case c.o8.testnet:return"tb1pq64lx73fwyrdp4asvl7xt5r5qvxvt9wy82x75taqtzvd64f58nasansurj";default:throw new Error("Invalid network: ".concat(e))}}}])}(mr),Pr=i(2218),Ir=i(8287).Buffer;function xr(e){return xr="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},xr(e)}function Rr(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,Nr(n.key),n)}}function Nr(e){var t=function(e,t){if("object"!=xr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=xr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xr(t)?t:t+""}(0,c.f0)(w);var Mr,Br=function(){return function(e,t,r){return r&&Rr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),0,[{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=v.privateNegate(r));var n=v.privateAdd(r,(0,Pr.tapTweakHash)((0,Ue.toXOnly)(e.publicKey),t.tweakHash));if(!n)throw new Error("Invalid tweaked private key!");return O.fromPrivateKey(Ir.from(n),t.network)}}])}();function Lr(e){return Lr="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},Lr(e)}function Ur(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,Kr(n.key),n)}}function Cr(e,t,r){return t=Dr(t),function(e,t){if(t&&("object"==Lr(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,jr()?Reflect.construct(t,r||[],Dr(e).constructor):t.apply(e,r))}function jr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(jr=function(){return!!e})()}function Dr(e){return Dr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Dr(e)}function Fr(e,t){return Fr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Fr(e,t)}function Hr(e,t,r){return(t=Kr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Kr(e){var t=function(e,t){if("object"!=Lr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Lr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Lr(t)?t:t+""}!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"}(Mr||(Mr={}));var Gr=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Hr(r=Cr(this,t,[e]),"type",Mr.FUNDING),Hr(r,"childTransactionRequiredFees",void 0),r.childTransactionRequiredFees=e.childTransactionRequiredValue,r.internalInit(),r}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&&Fr(e,t)}(t,e),function(e,t,r){return t&&Ur(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"buildTransaction",value:function(){if(!this.to)throw new Error("Recipient address is required");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}}])}(ir),Vr=i(8287).Buffer;function Wr(e){return Wr="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},Wr(e)}function zr(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,qr(n.key),n)}}function qr(e){var t=function(e,t){if("object"!=Wr(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Wr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Wr(t)?t:t+""}var Zr=function(){return function(e,t,r){return r&&zr(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),0,[{key:"btcToSatoshi",value:function(e){return BigInt(1e8*e)}},{key:"rndBytes",value:function(){var e=xe.getRandomValues(new Uint8Array(64));return Vr.from(e)}},{key:"opnetHash",value:function(e){var t=xe.createHash("sha512");t.update(e);var r=t.digest();return"0x".concat(r.toString("hex"))}}])}();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 Xr(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 Yr(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,on(n.key),n)}}function Jr(e,t,r){return t=tn(t),function(e,t){if(t&&("object"==$r(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,Qr()?Reflect.construct(t,r||[],tn(e).constructor):t.apply(e,r))}function Qr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Qr=function(){return!!e})()}function en(){return en="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=tn(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},en.apply(null,arguments)}function tn(e){return tn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tn(e)}function rn(e,t){return rn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},rn(e,t)}function nn(e,t,r){return(t=on(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function on(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+""}var an=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),nn(r=Jr(this,t,[e]),"randomBytes",void 0),nn(r,"targetScriptRedeem",null),nn(r,"leftOverFundsScriptRedeem",null),nn(r,"tapLeafScript",null),nn(r,"calldataGenerator",void 0),nn(r,"calldata",void 0),nn(r,"tweakedSigner",void 0),nn(r,"scriptSigner",void 0),nn(r,"interactionPubKeys",[]),nn(r,"minimumSignatures",0),nn(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=f.compress(e.calldata),r.randomBytes=e.randomBytes||Zr.rndBytes(),r.scriptSigner=r.generateKeyPairFromSeed(),r.calldataGenerator=new D(r.internalPubKeyToXOnly(),r.scriptSignerXOnlyPubKey(),r.network),r}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&&rn(e,t)}(t,e),function(e,t,r){return t&&Yr(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"getContractSecret",value:function(){return this.contractSecret}},{key:"getRndBytes",value:function(){return this.randomBytes}},{key:"generateSecret",value:function(){if(!this.to)throw new Error("To address is required");return c.hl.fromBech32(this.to).data}},{key:"tweakSigner",value:function(){this.tweakedSigner=this.getTweakedSigner()}},{key:"scriptSignerXOnlyPubKey",value:function(){return(0,Ue.toXOnly)(this.scriptSigner.publicKey)}},{key:"generateKeyPairFromSeed",value:function(){return O.fromSeedKeyPair(this.randomBytes,this.network)}},{key:"addInputsFromUTXO",value:function(){if(!this.tapLeafScript)throw new Error("Tap leaf script is required");var e,t=function(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 Xr(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)?Xr(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,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}}}}(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:this.sequence};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"buildTransaction",value:function(){if(!this.to)throw new Error("To address is required");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)):en(tn(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:"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}]}},{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()),Br.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}}])}(ir);function sn(e){return sn="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},sn(e)}function un(e,t,r){return t=cn(t),function(e,t){if(t&&("object"==sn(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,fn()?Reflect.construct(t,r||[],cn(e).constructor):t.apply(e,r))}function fn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(fn=function(){return!!e})()}function cn(e){return cn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},cn(e)}function ln(e,t){return ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ln(e,t)}function hn(e,t,r){return(t=dn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dn(e){var t=function(e,t){if("object"!=sn(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=sn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==sn(t)?t:t+""}var pn=function(e){function t(e){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),hn(r=un(this,t,[e]),"type",Mr.INTERACTION),hn(r,"compiledTargetScript",void 0),hn(r,"scriptTree",void 0),hn(r,"tapLeafScript",null),hn(r,"contractSecret",void 0),r.contractSecret=r.generateSecret(),r.compiledTargetScript=r.calldataGenerator.compile(r.calldata,r.contractSecret,r.interactionPubKeys,r.minimumSignatures),r.scriptTree=r.getScriptTree(),r.internalInit(),r}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&&ln(e,t)}(t,e),function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}(an),yn=i(8287).Buffer;function gn(e){return gn="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},gn(e)}function bn(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 mn(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,An(n.key),n)}}function vn(e,t,r){return t=En(t),function(e,t){if(t&&("object"==gn(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,wn()?Reflect.construct(t,r||[],En(e).constructor):t.apply(e,r))}function wn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(wn=function(){return!!e})()}function _n(){return _n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=En(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},_n.apply(null,arguments)}function En(e){return En=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},En(e)}function Sn(e,t){return Sn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Sn(e,t)}function kn(e,t,r){return(t=An(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function An(e){var t=function(e,t){if("object"!=gn(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=gn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gn(t)?t:t+""}var Tn,On=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),kn(r=vn(this,t,[e]),"type",Mr.DEPLOYMENT),kn(r,"_contractAddress",void 0),kn(r,"targetScriptRedeem",null),kn(r,"leftOverFundsScriptRedeem",null),kn(r,"compiledTargetScript",void 0),kn(r,"scriptTree",void 0),kn(r,"tweakedSigner",void 0),kn(r,"tapLeafScript",null),kn(r,"deploymentGenerator",void 0),kn(r,"contractSeed",void 0),kn(r,"bytecode",void 0),kn(r,"contractSigner",void 0),kn(r,"randomBytes",void 0),kn(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");var n=[r.randomBytes,r.internalPubKeyToXOnly(),t.tapScriptSig[0].signature,t.tapScriptSig[1].signature].concat(r.tapLeafScript.script).concat(r.tapLeafScript.controlBlock);return{finalScriptWitness:r.witnessStackToScriptWitness(n)}})),r.bytecode=f.compress(e.bytecode),!r.bytecode)throw new Error("Bytecode is required");return r.randomBytes=e.randomBytes||Zr.rndBytes(),r.contractSeed=r.getContractSeed(),r.contractSigner=O.fromSeedKeyPair(r.contractSeed,r.network),r.deploymentGenerator=new Z(r.internalPubKeyToXOnly(),r.contractSignerXOnlyPubKey(),r.network),r.compiledTargetScript=r.deploymentGenerator.compile(r.bytecode,r.randomBytes),r.scriptTree=r.getScriptTree(),r.internalInit(),r._contractAddress=Le.generatePKSH(r.contractSeed,r.network),r}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&&Sn(e,t)}(t,e),function(e,t,r){return t&&mn(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"contractAddress",get:function(){return this._contractAddress}},{key:"p2trAddress",get:function(){return this.to||this.getScriptAddress()}},{key:"getRndBytes",value:function(){return this.randomBytes}},{key:"contractSignerXOnlyPubKey",value:function(){return(0,Ue.toXOnly)(this.contractSigner.publicKey)}},{key:"addInputsFromUTXO",value:function(){if(!this.tapLeafScript)throw new Error("Tap leaf script is required");var e,t=function(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 bn(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)?bn(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,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}}}}(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()||r.scriptPubKey.hex},tapLeafScript:[this.tapLeafScript],sequence:this.sequence};this.addInput(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"buildTransaction",value:function(){this.to||(this.to=this.getScriptAddress());var e=this.contractSigner?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.contractSigner?(e.signInput(0,this.contractSigner),e.signInput(0,this.getSignerKey()),e.finalizeInput(0,this.customFinalizer)):_n(En(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.contractSigner?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:"getContractSeed",value:function(){if(!this.bytecode)throw new Error("Bytecode is required");var e=this.internalPubKeyToXOnly(),t=c.Et.hash256(this.randomBytes),r=c.Et.hash256(this.bytecode),n=yn.concat([e,t,r]);return c.Et.hash256(n)}},{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()),Br.tweakSigner(this.signer,t)}},{key:"getPubKeys",value:function(){var e=[this.signer.publicKey];return this.contractSigner&&e.push(this.contractSigner.publicKey),e}},{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 ir.LOCK_LEAF_SCRIPT}},{key:"getScriptTree",value:function(){if(!this.bytecode)throw new Error("Contract bytecode is required");return this.generateRedeemScripts(),[{output:this.compiledTargetScript,version:192},{output:this.getLeafScript(),version:192}]}}])}(ir),Pn=i(8287).Buffer;class In{static EXPECTED_BUFFER_LENGTH=32;static bufferToUint8Array(e){if(Pn.isBuffer(e)){const t=e.byteLength,r=new ArrayBuffer(t),n=new Uint8Array(r);for(let r=0;r<t;++r)n[r]=e[r];return n}return e}static uint8ArrayToHex(e){return Pn.from(e,0,e.byteLength).toString("hex")}static hexToUint8Array(e){e.startsWith("0x")&&(e=e.substr(2)),e.length%2!=0&&(e="0"+e);const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.substr(2*n,2),16);return r}static pointerToUint8Array(e){const t=e.toString(16).padStart(64,"0");return In.hexToUint8Array(t)}static uint8ArrayToPointer(e){const t=In.uint8ArrayToHex(e);return BigInt("0x"+t)}static valueToUint8Array(e){const t=e.toString(16).padStart(64,"0");return In.hexToUint8Array(t)}static uint8ArrayToValue(e){const t=In.uint8ArrayToHex(e);return t?BigInt("0x"+t):BigInt(0)}}class xn{eventType;eventDataSelector;eventData;constructor(e,t,r){this.eventType=e,this.eventDataSelector=t,this.eventData=r}}class Rn{buffer;currentOffset=0;constructor(e){this.buffer=new DataView(e.buffer)}setBuffer(e){this.buffer=new DataView(e.buffer),this.currentOffset=0}readEvents(){const e=[],t=this.readU8();if(t>8)throw new Error("Too many events to decode.");for(let r=0;r<t;r++){const t=this.readEvent();e.push(t)}return e}readEvent(){const e=this.readStringWithLength(),t=this.readU64(),r=this.readBytesWithLength(256);return new xn(e,t,r)}readBytesWithLength(e=0){const t=this.readU32();if(e>0&&t>e)throw new Error("Data length exceeds maximum length.");return this.readBytes(t)}readSelectors(){const e=new Map,t=this.readU16();for(let r=0;r<t;r++){const t=this.readABISelector();e.set(t.name,t.selector)}return e}readABISelector(){return{name:this.readStringWithLength(),selector:this.readSelector()}}readViewSelectorsMap(){const e=new Map,t=this.readU16();for(let r=0;r<t;r++){const t=this.readAddress(),r=this.readSelectors();e.set(t,r)}return e}readMethodSelectorsMap(){const e=new Map,t=this.readU16();for(let r=0;r<t;r++){const t=this.readAddress(),r=this.readMethodSelectors();e.set(t,r)}return e}readMethodSelectors(){const e=new Set,t=this.readU16();for(let r=0;r<t;r++)e.add(this.readSelector());return e}readTuple(){const e=this.readU32(),t=new Array(e);for(let r=0;r<e;r++)t[r]=this.readU256();return t}readU8(){return this.verifyEnd(this.currentOffset+1),this.buffer.getUint8(this.currentOffset++)}readU16(){this.verifyEnd(this.currentOffset+2);const e=this.buffer.getUint16(this.currentOffset,!0);return this.currentOffset+=2,e}readU32(e=!0){this.verifyEnd(this.currentOffset+4);const t=this.buffer.getUint32(this.currentOffset,e);return this.currentOffset+=4,t}readU64(){this.verifyEnd(this.currentOffset+8);const e=this.buffer.getBigUint64(this.currentOffset,!0);return this.currentOffset+=8,e}readStorage(){const e=this.readU32(),t=new Map;for(let r=0;r<e;r++){const e=this.readAddress(),r=this.readU32(),n=new Map;for(let e=0;e<r;e++){const e=this.readU256(),t=this.readU256();n.set(e,t)}t.set(e,n)}return t}readU256(){const e=this.readBytes(32);return BigInt("0x"+e.reduce(((e,t)=>e+t.toString(16).padStart(2,"0")),""))}readBytes(e,t=!1){let r=new Uint8Array(e);this.verifyEnd(this.currentOffset+e);for(let n=0;n<e;n++){const i=this.readU8();if(t&&0===i){r=r.slice(0,n),this.currentOffset+=e-(n+1);break}r[n]=i}return r}readString(e){const t=new TextDecoder,r=this.readBytes(e,!0);return t.decode(r)}readSelector(){return this.readU32(!1)}readStringWithLength(){const e=this.readU16();return this.readString(e)}readBoolean(){return 0!==this.readU8()}readFloat(){const e=this.buffer.getFloat32(this.currentOffset,!0);return this.currentOffset+=4,e}readDouble(){const e=this.buffer.getFloat64(this.currentOffset,!0);return this.currentOffset+=8,e}readAddress(){return this.readString(64)}getOffset(){return this.currentOffset}setOffset(e){this.currentOffset=e}verifyEnd(e){if(this.currentOffset>this.buffer.byteLength)throw new Error(`Expected to read ${e} bytes but read ${this.currentOffset} bytes`)}verifyChecksum(){const e=this.readU32();let t=0;for(let e=0;e<this.buffer.byteLength;e++)t+=this.buffer.getUint8(e);if(t%=2**32,t!==e)throw new Error("Invalid checksum for buffer")}}function Nn(e,t){const r=BigInt.asUintN(32,e),n=e>>32n,i=BigInt.asUintN(32,t),o=t>>32n;return r*i+(n*i<<32n)+(r*o<<32n)+(n*o<<64n)}!function(e){e[e.U8=0]="U8",e[e.U16=1]="U16",e[e.U32=2]="U32",e[e.U64=3]="U64",e[e.U256=4]="U256",e[e.ADDRESS=5]="ADDRESS",e[e.STRING=6]="STRING",e[e.BOOLEAN=7]="BOOLEAN"}(Tn||(Tn={}));class Mn{trackDataTypes;currentOffset=0;buffer;selectorDatatype=[];constructor(e=0,t=!1){this.trackDataTypes=t,this.buffer=this.getDefaultBuffer(e)}writeU8(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.U8),this.allocSafe(1),this.buffer.setUint8(this.currentOffset++,e)}writeU16(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.U16),this.allocSafe(2),this.buffer.setUint16(this.currentOffset,e,!0),this.currentOffset+=2}writeU32(e,t=!0){this.trackDataTypes&&this.selectorDatatype.push(Tn.U32),this.allocSafe(4),this.buffer.setUint32(this.currentOffset,e,t),this.currentOffset+=4}writeU64(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.U64),this.allocSafe(8),this.buffer.setBigUint64(this.currentOffset,e,!0),this.currentOffset+=8}writeSelector(e){this.writeU32(e,!1)}writeBoolean(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.BOOLEAN),this.writeU8(e?1:0)}writeU256(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.U256),this.allocSafe(32);const t=In.valueToUint8Array(e);if(32!==t.byteLength)throw console.log("Invalid u256 value:",t),new Error(`Invalid u256 value: ${e}`);for(let e=0;e<t.byteLength;e++)this.writeU8(t[e])}writeBytes(e){this.allocSafe(e.byteLength);for(let t=0;t<e.byteLength;t++)this.writeU8(e[t])}writeString(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.STRING),this.allocSafe(e.length);for(let t=0;t<e.length;t++)this.writeU8(e.charCodeAt(t))}writeAddress(e){this.trackDataTypes&&this.selectorDatatype.push(Tn.ADDRESS);const t=this.fromAddress(e);this.writeBytes(t)}writeStringWithLength(e){this.allocSafe(e.length+2),this.writeU16(e.length),this.writeString(e)}writeViewSelectorMap(e){this.writeU16(e.size),e.forEach(((e,t,r)=>{this.writeAddress(t),this.writeSelectors(e)}))}writeMethodSelectorsMap(e){this.writeU16(e.size),e.forEach(((e,t,r)=>{this.writeAddress(t),this.writeMethodSelectorMap(e)}))}getBuffer(e=!0){const t=new Uint8Array(this.buffer.byteLength);for(let e=0;e<this.buffer.byteLength;e++)t[e]=this.buffer.getUint8(e);return e&&this.clear(),t}reset(){this.currentOffset=0,this.buffer=this.getDefaultBuffer(4)}writeStorage(e){this.reset(),this.writeU32(e.size);const t=Array.from(e.keys()),r=Array.from(e.values());for(let e=0;e<t.length;e++){const n=t[e],i=r[e];this.writeAddress(n),this.writeU32(i.size);const o=Array.from(i.keys());for(let e=0;e<o.length;e++){const t=o[e];this.writeU256(t);const r=i.get(t);if(null==r)throw new Error("Slot value not found.");this.writeU256(r)}}}writeTuple(e){this.allocSafe(4+32*e.length),this.writeU32(e.length);for(let t=0;t<e.length;t++)this.writeU256(e[t])}toBytesReader(){return new Rn(this.getBuffer())}getOffset(){return this.currentOffset}setOffset(e){this.currentOffset=e}clear(){this.currentOffset=0,this.buffer=this.getDefaultBuffer(),this.selectorDatatype=[]}allocSafe(e){this.currentOffset+e>this.buffer.byteLength&&this.resize(e)}writeABISelector(e,t){this.writeStringWithLength(e),this.writeSelector(t)}getSelectorDataType(){return 0===this.selectorDatatype.length?0n:function(e,t=0){let r=BigInt(3735928559^t),n=BigInt(1103547991^t);for(let t,i=0;i<e.length;i++)t=BigInt(e[i]),r=Nn(r^t,0x85ebca77n),n=Nn(n^t,0xc2b2ae3dn);return r^=Nn(r^n>>15n,0x735a2d97n),n^=Nn(n^r>>15n,0xcaf649a9n),r^=n>>16n,n^=r>>16n,2097152n*(0xffffffffffffffffn&n)+(r>>11n)&0xffffffffffffffffn}(this.selectorDatatype)}getChecksum(){let e=0;for(let t=0;t<this.buffer.byteLength;t++)e+=this.buffer.getUint8(t);return e%2**32}writeMethodSelectorMap(e){this.writeU16(e.size),e.forEach(((e,t,r)=>{this.writeSelector(e)}))}writeSelectors(e){this.writeU16(e.size),e.forEach(((e,t,r)=>{this.writeABISelector(t,e)}))}fromAddress(e){if(e.length>64)throw new Error("Address is too long");const t=new Uint8Array(64);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);for(let r=e.length;r<64;r++)t[r]=0;return t}resize(e){const t=new Uint8Array(this.buffer.byteLength+e);for(let e=0;e<this.buffer.byteLength;e++)t[e]=this.buffer.getUint8(e);this.buffer=new DataView(t.buffer)}getDefaultBuffer(e=0){return new DataView(new ArrayBuffer(e))}}var Bn,Ln=i(2802),Un=i(8287).Buffer;!function(e){e.UINT8="UINT8",e.UINT16="UINT16",e.UINT32="UINT32",e.BOOL="BOOL",e.ADDRESS="ADDRESS",e.STRING="STRING",e.BYTES32="BYTES32",e.UINT256="UINT256",e.TUPLE="TUPLE"}(Bn||(Bn={}));var Cn=i(8287).Buffer;function jn(e){return jn="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},jn(e)}function Dn(e){return function(e){if(Array.isArray(e))return Fn(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 Fn(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)?Fn(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.")}()}function Fn(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 Hn(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,qn(n.key),n)}}function Kn(e,t,r){return t=Vn(t),function(e,t){if(t&&("object"==jn(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,Gn()?Reflect.construct(t,r||[],Vn(e).constructor):t.apply(e,r))}function Gn(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Gn=function(){return!!e})()}function Vn(e){return Vn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Vn(e)}function Wn(e,t){return Wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Wn(e,t)}function zn(e,t,r){return(t=qn(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qn(e){var t=function(e,t){if("object"!=jn(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=jn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==jn(t)?t:t+""}var Zn=new class{constructor(){}decodeData(e,t){const r=new Rn(e),n=[];for(let e=0;e<t.length;e++)switch(t[e]){case Bn.UINT8:n.push(r.readU8());break;case Bn.UINT16:n.push(r.readU16());break;case Bn.UINT32:n.push(r.readU32());break;case Bn.BYTES32:n.push(r.readBytes(32));break;case Bn.BOOL:n.push(r.readBoolean());break;case Bn.ADDRESS:n.push(r.readAddress());break;case Bn.STRING:n.push(r.readStringWithLength());break;case Bn.UINT256:n.push(r.readU256());break;case Bn.TUPLE:n.push(r.readTuple())}return n}encodePointer(e){const t=this.sha256(e),r=Un.alloc(In.EXPECTED_BUFFER_LENGTH),n=t.slice(0,In.EXPECTED_BUFFER_LENGTH);for(let e=0;e<In.EXPECTED_BUFFER_LENGTH;e++)r[e]=n[e];return BigInt("0x"+r.toString("hex"))}encodePointerHash(e,t){const r=new Uint8Array(In.EXPECTED_BUFFER_LENGTH+2);r[0]=255&e,r[1]=e>>8&255;const n=this.bigIntToUint8Array(t,In.EXPECTED_BUFFER_LENGTH);r.set(n,2);const i=this.sha256(r);if(i.byteLength!==In.EXPECTED_BUFFER_LENGTH)throw new Error("Invalid hash length");return i}encodeSelector(e){return this.sha256(e).slice(0,4).toString("hex")}numericSelectorToHex(e){return e.toString(16)}bigIntToUint8Array(e,t){const r=new Uint8Array(t),n=In.valueToUint8Array(e);for(let e=0;e<t;e++)r[e]=n[e]||0;return r}sha256(e){return(new Ln.sha256).update(e).digest()}},$n=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e.amount<ir.MINIMUM_DUST)throw new Error("Amount is below dust limit");var n=e.receiver||ir.getFrom(e.from,e.signer,e.network);if(e.calldata=t.generateMintCalldata(e.amount,n),zn(r=Kn(this,t,[e]),"type",Mr.WBTC_WRAP),zn(r,"vault",void 0),zn(r,"amount",void 0),zn(r,"receiver",void 0),zn(r,"compiledTargetScript",void 0),zn(r,"scriptTree",void 0),zn(r,"tapLeafScript",null),zn(r,"contractSecret",void 0),zn(r,"wbtc",void 0),r.wbtc=new Or(e.network),r.vault=e.generationParameters.vault,r.to=r.wbtc.getAddress(),r.receiver=n,r.amount=e.amount,r.contractSecret=r.generateSecret(),!r.verifyPublicKeysConstraints(e.generationParameters))throw new Error("Oops. Your wrapping request have been decline! It failed security checks!");return r.compiledTargetScript=r.calldataGenerator.compile(r.calldata,r.contractSecret,r.interactionPubKeys,r.minimumSignatures),r.scriptTree=r.getScriptTree(),r.internalInit(),r}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&&Wn(e,t)}(t,e),function(e,t,r){return t&&Hn(e.prototype,t),r&&Hn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"verifyPublicKeysConstraints",value:function(e){if(e.constraints.minimum<2)throw new Error("Minimum signatures must be at least 2");if(e.keys.length<e.constraints.transactionMinimum||e.keys.length<e.constraints.minimum)throw new Error("Not enough pub keys");if(e.keys.length>255)throw new Error("Too many pub keys");var t=this.generateVaultAddress(e.pubKeys,e.constraints.minimum);if(t!==e.vault)throw new Error("Invalid vault address. Expected: ".concat(t," Got: ").concat(e.vault));var r=this.generateChecksumSalt(e,this.amount,e.vault),n=Zr.opnetHash(r);if(n!==e.signature)throw new Error("Invalid checksum. Expected: ".concat(n," Got: ").concat(e.signature));return!0}},{key:"buildTransaction",value:function(){if(!this.to)throw new Error("To address is required");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.addVaultOutput(),this.addRefundOutput(t+this.amount)}},{key:"addVaultOutput",value:function(){if(!this.vault)throw new Error("No vault address provided");var e={address:this.vault,value:Number(this.amount)};this.addOutput(e)}},{key:"generateVaultAddress",value:function(e,t){return O.generateMultiSigAddress(e,t,this.network)}},{key:"generateChecksumSalt",value:function(e,t,r){var n=e.constraints.version,i=e.constraints.timestamp,o=Cn.alloc(12+n.length);return o.writeBigInt64BE(BigInt(i),0),o.writeInt16BE(e.constraints.minimum,8),o.writeInt16BE(e.constraints.transactionMinimum,10),o.write(n,12,n.length,"utf-8"),Cn.concat([].concat(Dn(e.pubKeys),Dn(e.entities.map((function(e){return Cn.from(e,"utf-8")}))),[o,Cn.from(t.toString(),"utf-8"),Cn.from(r,"utf-8")]))}}],[{key:"generateMintCalldata",value:function(e,r){if(!e)throw new Error("Amount is required");if(!r)throw new Error("To address is required");var n=new Mn;return n.writeSelector(t.WRAP_SELECTOR),n.writeAddress(r),n.writeU256(e),Cn.from(n.getBuffer())}}])}(an);function Xn(e){return Xn="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},Xn(e)}function Yn(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 Jn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(r),!0).forEach((function(t){Qn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Qn(e,t,r){return(t=ti(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ei(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,ti(n.key),n)}}function ti(e){var t=function(e,t){if("object"!=Xn(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=Xn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Xn(t)?t:t+""}zn($n,"WRAP_SELECTOR",Number("0x"+Zn.encodeSelector("mint")));var ri=function(){return function(e,t,r){return t&&ei(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}),[{key:"signInteraction",value:function(e){var t=new pn(e);t.signTransaction();var r=t.getFundingTransactionParameters(),n=new Gr(r).signTransaction();if(!n)throw new Error("Could not sign funding transaction.");var i=n.outs[0],o={transactionId:n.getId(),outputIndex:0,scriptPubKey:{hex:i.script.toString("hex"),address:t.getScriptAddress()},value:BigInt(i.value)},a=Jn(Jn({},e),{},{utxos:[o],randomBytes:t.getRndBytes()}),s=new pn(a).signTransaction();return[n.toHex(),s.toHex()]}},{key:"signDeployment",value:function(e){var t=new On(e);t.signTransaction();var r=t.getFundingTransactionParameters(),n=new Gr(r).signTransaction();if(!n)throw new Error("Could not sign funding transaction.");var i=n.outs[0],o={transactionId:n.getId(),outputIndex:0,scriptPubKey:{hex:i.script.toString("hex"),address:t.getScriptAddress()},value:BigInt(i.value)},a=Jn(Jn({},e),{},{utxos:[o],randomBytes:t.getRndBytes()}),s=new On(a),u=s.signTransaction();return{transaction:[n.toHex(),u.toHex()],contractAddress:s.contractAddress,p2trAddress:s.p2trAddress}}},{key:"wrap",value:function(e){var t=new $n(e);t.signTransaction();var r=t.getFundingTransactionParameters();r.childTransactionRequiredValue+=e.amount;var n=new Gr(r).signTransaction();if(!n)throw new Error("Could not sign funding transaction.");var i=n.outs[0],o={transactionId:n.getId(),outputIndex:0,scriptPubKey:{hex:i.script.toString("hex"),address:t.getScriptAddress()},value:BigInt(i.value)},a=Jn(Jn({},e),{},{utxos:[o],randomBytes:t.getRndBytes()}),s=new $n(a),u=s.signTransaction();return{transaction:[n.toHex(),u.toHex()],vaultAddress:s.vault,amount:s.amount,receiverAddress:s.receiver}}}])}(),ni=i(8287).Buffer;function ii(e){return ii="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},ii(e)}function oi(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,ui(n.key),n)}}function ai(e,t,r){return t&&oi(e.prototype,t),r&&oi(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function si(e,t,r){return(t=ui(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ui(e){var t=function(e,t){if("object"!=ii(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ii(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ii(t)?t:t+""}var fi=ai((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),si(this,"constraints",void 0),si(this,"entities",void 0),si(this,"keys",void 0),si(this,"signature",void 0),si(this,"vault",void 0),si(this,"pubKeys",void 0),this.constraints=t.constraints,this.entities=t.entities,this.keys=t.keys,this.signature=t.signature,this.vault=t.vault,this.pubKeys=this.keys.map((function(e){return ni.from(e,"base64")}))}));function ci(e){return ci="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},ci(e)}function li(){li=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),s=new x(n||[]);return i(a,"_invoke",{value:T(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",g={};function b(){}function m(){}function v(){}var w={};f(w,a,(function(){return this}));var _=Object.getPrototypeOf,E=_&&_(_(R([])));E&&E!==r&&n.call(E,a)&&(w=E);var S=v.prototype=b.prototype=Object.create(w);function k(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function r(i,o,a,s){var u=l(e[i],e,o);if("throw"!==u.type){var f=u.arg,c=f.value;return c&&"object"==ci(c)&&n.call(c,"__await")?t.resolve(c.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(c).then((function(e){f.value=e,a(f)}),(function(e){return r("throw",e,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,i){r(e,n,t,i)}))}return o=o?o.then(i,i):i()}})}function T(t,r,n){var i=h;return function(o,a){if(i===p)throw Error("Generator is already running");if(i===y){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===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===h)throw i=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var f=l(t,r,n);if("normal"===f.type){if(i=n.done?y:d,f.arg===g)continue;return{value:f.arg,done:n.done}}"throw"===f.type&&(i=y,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")),g;var o=l(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;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,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function R(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(ci(t)+" is not iterable")}return m.prototype=v,i(S,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:m,configurable:!0}),m.displayName=f(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,f(e,u,"GeneratorFunction")),e.prototype=Object.create(S),e},t.awrap=function(e){return{__await:e}},k(A.prototype),f(A.prototype,s,(function(){return this})),t.AsyncIterator=A,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new A(c(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(S),f(S,u,"Generator"),f(S,a,(function(){return this})),f(S,"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,x.prototype={constructor:x,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(I),!t)for(var r in this)"t"===r.charAt(0)&&n.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 i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),f=n.call(a,"finallyLoc");if(u&&f){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!f)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),I(r),g}},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;I(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),g}},t}function hi(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 di(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)?di(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,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 di(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 pi(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 yi(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){pi(o,n,i,a,s,"next",e)}function s(e){pi(o,n,i,a,s,"throw",e)}a(void 0)}))}}function gi(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,mi(n.key),n)}}function bi(e,t,r){return(t=mi(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mi(e){var t=function(e,t){if("object"!=ci(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=ci(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ci(t)?t:t+""}var vi=function(){return function(e,t,r){return t&&gi(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),bi(this,"opnetAPIUrl",void 0),bi(this,"utxoPath","address/utxos"),bi(this,"rpc","json-rpc"),this.opnetAPIUrl=t}),[{key:"fetchUTXO",value:(t=yi(li().mark((function e(t){var r,n,i,o,a,s,u,f,c,l,h,d;return li().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((i=e.sent).ok){e.next=7;break}throw new Error("Failed to fetch UTXO data: ".concat(i.statusText));case 7:return e.next=9,i.json();case 9:if(0!==(o=e.sent).length){e.next=12;break}throw new Error("No UTXO found");case 12:if(a=o.filter((function(e){return BigInt(e.value)>=t.minAmount})),0!==a.length){e.next=15;break}throw new Error("No UTXO found (minAmount)");case 15:s=[],u=0n,f=t.requestedAmount,c=hi(a),e.prev=19,c.s();case 21:if((l=c.n()).done){e.next=30;break}if(h=l.value,d=BigInt(h.value),u+=d,s.push({transactionId:h.transactionId,outputIndex:h.outputIndex,value:d,scriptPubKey:h.scriptPubKey}),!(u>f)){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),c.e(e.t0);case 35:return e.prev=35,c.f(),e.finish(35);case 38:return e.abrupt("return",s);case 39:case"end":return e.stop()}}),e,this,[[19,32,35,38]])}))),function(e){return t.apply(this,arguments)})},{key:"fetchWrapParameters",value:(e=yi(li().mark((function e(t){var r,n,i,o,a;return li().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",method:"btc_generate",params:[0,t.toString()],id:1})},n="".concat(this.opnetAPIUrl,"/api/v1/").concat(this.rpc),e.prev=2,e.next=5,fetch(n,r);case 5:if((i=e.sent).ok){e.next=8;break}throw new Error("Failed to fetch wrap parameters: ".concat(i.statusText));case 8:return e.next=10,i.json();case 10:if(o=e.sent){e.next=13;break}throw new Error("No wrap parameters found");case 13:if(a=o.result){e.next=16;break}throw new Error("No wrap parameters found");case 16:if(!("error"in a)){e.next=18;break}throw new Error("Something went wrong while fetching wrap parameters");case 18:return e.abrupt("return",new fi(a));case 21:e.prev=21,e.t0=e.catch(2),console.error("Failed to fetch wrap parameters: ".concat(e.t0.stack));case 24:case"end":return e.stop()}}),e,this,[[2,21]])}))),function(t){return e.apply(this,arguments)})}]);var e,t}()})();var a=o.iy,s=o.G7,u=o.GF,f=o.wf,c=o.P8,l=o.z4,h=o.qT,d=o.kd,p=o.cC,y=o.Wj,g=o.Bc,b=o.yo,m=o.aw,v=o.tm,w=o.Qc,_=o.dF,E=o.Wb,S=o.D_,k=o.aS,A=o.uW,T=o.FV,O=o.UB,P=o.$7,I=o.rE,x=o.rR;export{a as AddressGenerator,s as BitcoinUtils,u as CalldataGenerator,f as Compressor,c as ContractBaseMetadata,l as DeploymentGenerator,h as DeploymentTransaction,d as EcKeyPair,p as FundingTransaction,y as Generator,g as InteractionTransaction,b as OPNetLimitedProvider,m as SharedInteractionTransaction,v as TapscriptVerificator,w as TransactionBuilder,_ as TransactionFactory,E as TransactionSequence,S as TransactionType,k as TweakedSigner,A as Wallet,T as WrapTransaction,O as WrappedGeneration,P as opnet,I as version,x as wBTC};