@smartledger/bsv 5.3.0 → 5.3.1

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,33 @@ All notable changes to SmartLedger-BSV will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.3.1] - 2026-06-15
9
+
10
+ Patch release. Fixes browser-side Shamir secret sharing, which was broken in the
11
+ bundles since 5.1.0, and adds a real-browser CI gate so it can't regress again.
12
+
13
+ ### Fixed
14
+
15
+ - **Shamir secret sharing was broken in the browser bundles** (regressed in the
16
+ webpack 4→5 migration, 5.1.0). `secrets.js-grempe` is a UMD whose AMD branch
17
+ calls its factory **without** the `crypto` argument; webpack 5 provides
18
+ `define.amd`, so the bundle took that branch and `secrets.js` received
19
+ `crypto === undefined` — its CSPRNG init threw "Initialization failed" and
20
+ every `bsv.Shamir.split`/`combine` failed in browsers (Node was unaffected).
21
+ Fixed by disabling AMD parsing for `secrets.js-grempe` in the webpack config,
22
+ forcing the CommonJS branch (`factory(require('crypto'))`). All bundles
23
+ regenerated.
24
+ - **`tests/browser-smoke-test.html`** "preserves leading zero bytes" check used
25
+ a bare `Buffer` global (absent in browsers); now uses `bsv.deps.Buffer`.
26
+
27
+ ### Added
28
+
29
+ - **CI gate: headless-Chrome browser smoke test.** `npm run test:browser:ci`
30
+ runs `tests/browser-smoke-test.html` in real headless Chrome and now runs in
31
+ the Build job. This is the regression gate for browser-only paths (like the
32
+ Shamir CSPRNG) that the Node suite cannot exercise — and which let this
33
+ regression ship undetected across 5.1.0–5.3.0.
34
+
8
35
  ## [5.3.0] - 2026-06-15
9
36
 
10
37
  Completes the migration of **all** of bsv's secp256k1 cryptography to the
package/README.md CHANGED
@@ -72,7 +72,7 @@ const ok = SC.verifyScript(unlockScript, lockingScript, tx, inputIndex, satoshis
72
72
 
73
73
  ```bash
74
74
  # Install SmartLedger BSV v5.0.0
75
- npm install @smartledger/bsv@5.3.0
75
+ npm install @smartledger/bsv@5.3.1
76
76
 
77
77
  # Initialize DID:web issuer (generates ES256 keys)
78
78
  npx smartledger-bsv didweb init --domain example.com --alg ES256
@@ -181,42 +181,42 @@ console.log('Status:', status) // 'revoked'
181
181
  ### **Core Modules**
182
182
  | Module | Size | Use Case | CDN |
183
183
  |--------|------|----------|-----|
184
- | **bsv.min.js** | 1271KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js` |
185
- | **bsv.bundle.js** | 1271KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.3.0/bsv.bundle.js` |
184
+ | **bsv.min.js** | 1271KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js` |
185
+ | **bsv.bundle.js** | 1271KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.3.1/bsv.bundle.js` |
186
186
 
187
187
  ### **W3C Verifiable Credentials**
188
188
  | Module | Size | Use Case | CDN |
189
189
  |--------|------|----------|-----|
190
- | **🟢 bsv-didweb.min.js** | 453KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-didweb.min.js` |
191
- | **🟢 bsv-vcjwt.min.js** | 454KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-vcjwt.min.js` |
192
- | **🟢 bsv-statuslist.min.js** | 553KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-statuslist.min.js` |
193
- | **🟢 bsv-anchor.min.js** | 452KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.3.0/bsv-anchor.min.js` |
190
+ | **🟢 bsv-didweb.min.js** | 453KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-didweb.min.js` |
191
+ | **🟢 bsv-vcjwt.min.js** | 454KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-vcjwt.min.js` |
192
+ | **🟢 bsv-statuslist.min.js** | 553KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-statuslist.min.js` |
193
+ | **🟢 bsv-anchor.min.js** | 452KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.3.1/bsv-anchor.min.js` |
194
194
 
195
195
  ### **Smart Contract & Development**
196
196
  | Module | Size | Use Case | CDN |
197
197
  |--------|------|----------|-----|
198
- | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.3.0/bsv-smartcontract.min.js` |
199
- | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.3.0/bsv-covenant.min.js` |
200
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.3.0/bsv-script-helper.min.js` |
201
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.3.0/bsv-security.min.js` |
198
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.3.1/bsv-smartcontract.min.js` |
199
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.3.1/bsv-covenant.min.js` |
200
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.3.1/bsv-script-helper.min.js` |
201
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.3.1/bsv-security.min.js` |
202
202
 
203
203
  ### **Legal & Compliance**
204
204
  | Module | Size | Use Case | CDN |
205
205
  |--------|------|----------|-----|
206
- | **bsv-ltp.min.js** | 1271KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.3.0/bsv-ltp.min.js` |
207
- | **bsv-gdaf.min.js** | 1271KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.3.0/bsv-gdaf.min.js` |
206
+ | **bsv-ltp.min.js** | 1271KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.3.1/bsv-ltp.min.js` |
207
+ | **bsv-gdaf.min.js** | 1271KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.3.1/bsv-gdaf.min.js` |
208
208
 
209
209
  ### **Advanced Cryptography**
210
210
  | Module | Size | Use Case | CDN |
211
211
  |--------|------|----------|-----|
212
- | **bsv-shamir.min.js** | 476KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.3.0/bsv-shamir.min.js` |
212
+ | **bsv-shamir.min.js** | 476KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.3.1/bsv-shamir.min.js` |
213
213
 
214
214
  ### **Utilities**
215
215
  | Module | Size | Use Case | CDN |
216
216
  |--------|------|----------|-----|
217
- | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.3.0/bsv-ecies.min.js` |
218
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.3.0/bsv-message.min.js` |
219
- | **bsv-mnemonic.min.js** | 715KB | HD wallets | `unpkg.com/@smartledger/bsv@5.3.0/bsv-mnemonic.min.js` |
217
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.3.1/bsv-ecies.min.js` |
218
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.3.1/bsv-message.min.js` |
219
+ | **bsv-mnemonic.min.js** | 715KB | HD wallets | `unpkg.com/@smartledger/bsv@5.3.1/bsv-mnemonic.min.js` |
220
220
 
221
221
  ## ⚡ **2-Minute Quick Start**
222
222
 
@@ -227,7 +227,7 @@ Get started with Bitcoin SV development in under 2 minutes:
227
227
  npm install @smartledger/bsv
228
228
 
229
229
  # Or include in HTML
230
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
230
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
231
231
  ```
232
232
 
233
233
  > **🔒 v5.0.0 (production hardening — has breaking changes):** Shamir secret
@@ -327,8 +327,8 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
327
327
 
328
328
  ### 🔧 **Basic Development** (~1.3MB total)
329
329
  ```html
330
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
331
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-script-helper.min.js"></script>
330
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
331
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-script-helper.min.js"></script>
332
332
  <script>
333
333
  const privateKey = new bsv.PrivateKey();
334
334
  const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
@@ -337,9 +337,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
337
337
 
338
338
  ### 🔒 **Smart Contract Development** (~3.0MB total — each bundle re-embeds core BSV)
339
339
  ```html
340
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
341
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-covenant.min.js"></script>
342
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-smartcontract.min.js"></script>
340
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
341
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-covenant.min.js"></script>
342
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-smartcontract.min.js"></script>
343
343
  <script>
344
344
  const covenant = bsv.SmartContract.createCovenantBuilder()
345
345
  .extractField('amount').push(50000).greaterThanOrEqual().verify().build();
@@ -349,9 +349,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
349
349
 
350
350
  ### 🆕 **Legal & Identity Development** (~3.7MB total — each bundle re-embeds core BSV)
351
351
  ```html
352
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
353
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-ltp.min.js"></script>
354
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-gdaf.min.js"></script>
352
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
353
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-ltp.min.js"></script>
354
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-gdaf.min.js"></script>
355
355
  <script>
356
356
  // Legal Token Protocol
357
357
  const propertyToken = bsv.createPropertyToken({
@@ -365,9 +365,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
365
365
 
366
366
  ### 🆕 **Security & Cryptography** (~1.7MB total)
367
367
  ```html
368
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
369
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-security.min.js"></script>
370
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-shamir.min.js"></script>
368
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
369
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-security.min.js"></script>
370
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-shamir.min.js"></script>
371
371
  <script>
372
372
  // Threshold Cryptography
373
373
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -379,7 +379,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
379
379
 
380
380
  ### 🎯 **Everything Bundle** (~1.3MB)
381
381
  ```html
382
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.bundle.js"></script>
382
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.bundle.js"></script>
383
383
  <script>
384
384
  // Everything available immediately
385
385
  const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
@@ -488,8 +488,8 @@ const contractTx = covenant.createCovenantTransaction({
488
488
 
489
489
  #### 1. **Minimal Setup** - Core + Script Helper (~1.3MB)
490
490
  ```html
491
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
492
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-script-helper.min.js"></script>
491
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
492
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-script-helper.min.js"></script>
493
493
  <script>
494
494
  const tx = new bsv.Transaction();
495
495
  const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
@@ -498,9 +498,9 @@ const contractTx = covenant.createCovenantTransaction({
498
498
 
499
499
  #### 2. **DeFi Development** - Core + Covenants + Debug (~3.0MB — each bundle re-embeds core BSV)
500
500
  ```html
501
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
502
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-covenant.min.js"></script>
503
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-smartcontract.min.js"></script>
501
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
502
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-covenant.min.js"></script>
503
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-smartcontract.min.js"></script>
504
504
  <script>
505
505
  const covenant = new bsvCovenant.CovenantInterface();
506
506
  const debugInfo = SmartContract.interpretScript(script);
@@ -510,8 +510,8 @@ const contractTx = covenant.createCovenantTransaction({
510
510
 
511
511
  #### 3. **Security First** - Core + Enhanced Security (~1.3MB)
512
512
  ```html
513
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.min.js"></script>
514
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv-security.min.js"></script>
513
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.min.js"></script>
514
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv-security.min.js"></script>
515
515
  <script>
516
516
  const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
517
517
  const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
@@ -520,7 +520,7 @@ const contractTx = covenant.createCovenantTransaction({
520
520
 
521
521
  #### 4. **Everything Bundle** - One File Solution (~1.3MB)
522
522
  ```html
523
- <script src="https://unpkg.com/@smartledger/bsv@5.3.0/bsv.bundle.js"></script>
523
+ <script src="https://unpkg.com/@smartledger/bsv@5.3.1/bsv.bundle.js"></script>
524
524
  <script>
525
525
  // Everything available under bsv namespace
526
526
  const keys = bsv.SmartLedgerBundle.generateKeys();
@@ -809,7 +809,7 @@ const timelockScript = helper.createTimelockScript(
809
809
 
810
810
  See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
811
811
  table near the top for the full list of bundles with current sizes and
812
- canonical `unpkg.com/@smartledger/bsv@5.3.0/...` URLs.
812
+ canonical `unpkg.com/@smartledger/bsv@5.3.1/...` URLs.
813
813
 
814
814
  ## 🔐 Security
815
815
 
@@ -45,4 +45,4 @@ const re=BigInt(0),ie=BigInt(1);function ne(e,t){const r=t.negate();return e?r:t
45
45
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
46
46
  const ge=(e,t)=>(e+(e>=0?t:-t)/_e)/t;function me(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ye(e,t){P(e);const r={};for(let i of Object.keys(t))r[i]=void 0===e[i]?t[i]:e[i];return d(r.lowS,"lowS"),d(r.prehash,"prehash"),void 0!==r.format&&me(r.format),r}class ve extends Error{constructor(e=""){super(e)}}const be={Err:ve,_tlv:{encode:(e,t)=>{const{Err:r}=be;if(m(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if("string"!=typeof t)throw new TypeError('"data" expected string, got type='+typeof t);if(1&t.length)throw new r("tlv.encode: unpadded data");const i=t.length/2,n=y(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");const o=i>127?y(n.length/2|128):"";return y(e)+o+n+t},decode(e,t){const{Err:r}=be;t=o(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");const n=t[i++];let a=0;if(!!(128&n)){const e=127&n;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const o=t.subarray(i,i+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(const e of o)a=a<<8|e;if(i+=e,a<128)throw new r("tlv.decode(long): not minimal encoding")}else a=n;const s=t.subarray(i,i+a);if(s.length!==a)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(i+a)}}},_int:{encode(e){const{Err:t}=be;if(g(e),e<Se)throw new t("integer: negative integers are not allowed");let r=y(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){const{Err:t}=be;if(e.length<1)throw new t("invalid signature integer: empty");if(128&e[0])throw new t("invalid signature integer: negative");if(e.length>1&&0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return b(e)}},toSig(e){const{Err:t,_int:r,_tlv:i}=be,n=o(e,void 0,"signature"),{v:a,l:s}=i.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l:c}=i.decode(2,a),{v:l,l:h}=i.decode(2,c);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(u),s:r.decode(l)}},hexFromSig(e){const{_tlv:t,_int:r}=be,i=t.encode(2,r.encode(e.r))+t.encode(2,r.encode(e.s));return t.encode(48,i)}};Object.freeze(be._tlv),Object.freeze(be._int),Object.freeze(be);const Se=BigInt(0),we=BigInt(1),_e=BigInt(2),Oe=BigInt(3),Ie=BigInt(4);function Ee(e,t={}){const r=function(e,t,r={},i){if(void 0===i&&(i="edwards"===e),!t||"object"!=typeof t)throw new Error(`expected valid ${e} CURVE object`);for(const e of["p","n","h"]){const r=t[e];if(!("bigint"==typeof r&&r>re))throw new Error(`CURVE.${e} must be positive bigint`)}const n=de(t.p,r.Fp,i),o=de(t.n,r.Fn,i),a=["Gx","Gy","a","weierstrass"===e?"b":"d"];for(const e of a)if(!n.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:n,Fn:o}}("weierstrass",e,t),i=r.Fp,n=r.Fn;let a=r.CURVE;const{h:l,n:h}=a;P(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:f,allowInfinityPoint:p}=t;if(f&&(!i.is0(a.a)||"bigint"!=typeof f.beta||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const g=Pe(i,n);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const y=void 0===t.toBytes?function(e,t,r){if(p&&t.is0())return Uint8Array.of(0);const{x:n,y:o}=t.toAffine(),a=i.toBytes(n);if(d(r,"isCompressed"),r){m();const e=!i.isOdd(o);return u(Ae(e),a)}return u(Uint8Array.of(4),a,i.toBytes(o))}:t.toBytes,v=void 0===t.fromBytes?function(e){o(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:r}=g,n=e.length,a=e[0],s=e.subarray(1);if(p&&1===n&&0===a)return{x:i.ZERO,y:i.ZERO};if(n!==t||2!==a&&3!==a){if(n===r&&4===a){const e=i.BYTES,t=i.fromBytes(s.subarray(0,e)),r=i.fromBytes(s.subarray(e,2*e));if(!S(t,r))throw new Error("bad point: is not on curve");return{x:t,y:r}}throw new Error(`bad point: got length ${n}, expected compressed=${t} or uncompressed=${r}`)}{const e=i.fromBytes(s);if(!i.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=b(e);let r;try{r=i.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}m();return!(1&~a)!==i.isOdd(r)&&(r=i.neg(r)),{x:e,y:r}}}:t.fromBytes;function b(e){const t=i.sqr(e),r=i.mul(t,e);return i.add(i.add(r,i.mul(e,a.a)),a.b)}function S(e,t){const r=i.sqr(t),n=b(e);return i.eql(r,n)}if(!S(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const w=i.mul(i.pow(a.a,Oe),Ie),_=i.mul(i.sqr(a.b),BigInt(27));if(i.is0(i.add(w,_)))throw new Error("bad curve params: a or b");function O(e,t,r=!1){if(!i.isValid(t)||r&&i.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function k(e){if(!(e instanceof R))throw new Error("Weierstrass Point expected")}function x(e){if(!f||!f.basises)throw new Error("no endo");return function(e,t,r){I("scalar",e,Se,r);const[[i,n],[o,a]]=t,s=ge(a*e,r),u=ge(-n*e,r);let c=e-s*i-u*o,l=-s*n-u*a;const h=c<Se,f=l<Se;h&&(c=-c),f&&(l=-l);const p=A(Math.ceil(E(r)/2))+we;if(c<Se||c>=p||l<Se||l>=p)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:h,k1:c,k2neg:f,k2:l}}(e,f.basises,n.ORDER)}function T(e,t,r,n,o){return r=new R(i.mul(r.X,e),r.Y,r.Z),t=ne(n,t),r=ne(o,r),t.add(r)}class R{static BASE=new R(a.Gx,a.Gy,i.ONE);static ZERO=new R(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=n;X;Y;Z;constructor(e,t,r){this.X=O("x",e),this.Y=O("y",t,!0),this.Z=O("z",r),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!i.isValid(t)||!i.isValid(r))throw new Error("invalid affine point");if(e instanceof R)throw new Error("projective point not allowed");return i.is0(t)&&i.is0(r)?R.ZERO:new R(t,r,i.ONE)}static fromBytes(e){const t=R.fromAffine(v(o(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return R.fromBytes(c(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return N.createCache(this,e),t||this.multiply(Oe),this}assertValidity(){const e=this;if(e.is0()){if(t.allowInfinityPoint&&i.is0(e.X)&&i.eql(e.Y,i.ONE)&&i.is0(e.Z))return;throw new Error("bad point: ZERO")}const{x:r,y:n}=e.toAffine();if(!i.isValid(r)||!i.isValid(n))throw new Error("bad point: x or y not field elements");if(!S(r,n))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(e)}equals(e){k(e);const{X:t,Y:r,Z:n}=this,{X:o,Y:a,Z:s}=e,u=i.eql(i.mul(t,s),i.mul(o,n)),c=i.eql(i.mul(r,s),i.mul(a,n));return u&&c}negate(){return new R(this.X,i.neg(this.Y),this.Z)}double(){const{a:e,b:t}=a,r=i.mul(t,Oe),{X:n,Y:o,Z:s}=this;let u=i.ZERO,c=i.ZERO,l=i.ZERO,h=i.mul(n,n),f=i.mul(o,o),p=i.mul(s,s),d=i.mul(n,o);return d=i.add(d,d),l=i.mul(n,s),l=i.add(l,l),u=i.mul(e,l),c=i.mul(r,p),c=i.add(u,c),u=i.sub(f,c),c=i.add(f,c),c=i.mul(u,c),u=i.mul(d,u),l=i.mul(r,l),p=i.mul(e,p),d=i.sub(h,p),d=i.mul(e,d),d=i.add(d,l),l=i.add(h,h),h=i.add(l,h),h=i.add(h,p),h=i.mul(h,d),c=i.add(c,h),p=i.mul(o,s),p=i.add(p,p),h=i.mul(p,d),u=i.sub(u,h),l=i.mul(p,f),l=i.add(l,l),l=i.add(l,l),new R(u,c,l)}add(e){k(e);const{X:t,Y:r,Z:n}=this,{X:o,Y:s,Z:u}=e;let c=i.ZERO,l=i.ZERO,h=i.ZERO;const f=a.a,p=i.mul(a.b,Oe);let d=i.mul(t,o),g=i.mul(r,s),m=i.mul(n,u),y=i.add(t,r),v=i.add(o,s);y=i.mul(y,v),v=i.add(d,g),y=i.sub(y,v),v=i.add(t,n);let b=i.add(o,u);return v=i.mul(v,b),b=i.add(d,m),v=i.sub(v,b),b=i.add(r,n),c=i.add(s,u),b=i.mul(b,c),c=i.add(g,m),b=i.sub(b,c),h=i.mul(f,v),c=i.mul(p,m),h=i.add(c,h),c=i.sub(g,h),h=i.add(g,h),l=i.mul(c,h),g=i.add(d,d),g=i.add(g,d),m=i.mul(f,m),v=i.mul(p,v),g=i.add(g,m),m=i.sub(d,m),m=i.mul(f,m),v=i.add(v,m),d=i.mul(g,v),l=i.add(l,d),d=i.mul(b,v),c=i.mul(y,c),c=i.sub(c,d),d=i.mul(y,g),h=i.mul(b,h),h=i.add(h,d),new R(c,l,h)}subtract(e){return k(e),this.add(e.negate())}is0(){return this.equals(R.ZERO)}multiply(e){const{endo:r}=t;if(!n.isValidNot0(e))throw new RangeError("invalid scalar: out of range");let i,o;const a=e=>N.cached(this,e,e=>oe(R,e));if(r){const{k1neg:t,k1:n,k2neg:s,k2:u}=x(e),{p:c,f:l}=a(n),{p:h,f}=a(u);o=l.add(f),i=T(r.beta,c,h,t,s)}else{const{p:t,f:r}=a(e);i=t,o=r}return oe(R,[i,o])[0]}multiplyUnsafe(e){const{endo:r}=t,i=this,o=e;if(!n.isValid(o))throw new RangeError("invalid scalar: out of range");if(o===Se||i.is0())return R.ZERO;if(o===we)return i;if(N.hasCache(this))return this.multiply(o);if(r){const{k1neg:e,k1:t,k2neg:n,k2:a}=x(o),{p1:s,p2:u}=function(e,t,r,i){let n=t,o=e.ZERO,a=e.ZERO;for(;r>re||i>re;)r&ie&&(o=o.add(n)),i&ie&&(a=a.add(n)),n=n.double(),r>>=ie,i>>=ie;return{p1:o,p2:a}}(R,i,t,a);return T(r.beta,s,u,e,n)}return N.unsafe(i,o)}toAffine(e){let t=e;const{X:r,Y:n,Z:o}=this;if(i.eql(o,i.ONE))return{x:r,y:n};const a=this.is0();null==t&&(t=a?i.ONE:i.inv(o));const s=i.mul(r,t),u=i.mul(n,t),c=i.mul(o,t);if(a)return{x:i.ZERO,y:i.ZERO};if(!i.eql(c,i.ONE))throw new Error("invZ was invalid");return{x:s,y:u}}isTorsionFree(){const{isTorsionFree:e}=t;return l===we||(e?e(R,this):N.unsafe(this,h).is0())}clearCofactor(){const{clearCofactor:e}=t;return l===we?this:e?e(R,this):this.multiplyUnsafe(l)}isSmallOrder(){return l===we?this.is0():this.clearCofactor().is0()}toBytes(e=!0){return d(e,"isCompressed"),this.assertValidity(),y(R,this,e)}toHex(e=!0){return s(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const B=n.BITS,N=new pe(R,t.endo?Math.ceil(B/2):B);return B>=8&&R.BASE.precompute(8),Object.freeze(R.prototype),Object.freeze(R),R}function Ae(e){return Uint8Array.of(e?2:3)}function Pe(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ke(e,t={}){const{Fn:r}=e,i=void 0===t.randomBytes?h:t.randomBytes,n=Object.assign(Pe(e.Fp,r),{seed:Math.max(ee(r.ORDER),16)});function a(e){return e=void 0===e?i(n.seed):e,function(e,t,r=!1){o(e);const i=e.length,n=Q(t),a=Math.max(ee(t),16);if(i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const s=U(r?S(e):b(e),t-x)+x;return r?_(s,n):w(s,n)}(o(e,n.seed,"seed"),r.ORDER)}function s(t,i=!0){return e.BASE.multiply(r.fromBytes(t)).toBytes(i)}function u(e){const{secretKey:t,publicKey:i,publicKeyUncompressed:a}=n,s=r._lengths;if(!l(e))return;const u=o(e,void 0,"key").length,c=u===i||u===a,h=u===t||!!s?.includes(u);return c&&h?void 0:c}const c={isValidSecretKey:function(e){try{const t=r.fromBytes(e);return r.isValidNot0(t)}catch(e){return!1}},isValidPublicKey:function(t,r){const{publicKey:i,publicKeyUncompressed:o}=n;try{const n=t.length;return(!0!==r||n===i)&&((!1!==r||n===o)&&!!e.fromBytes(t))}catch(e){return!1}},randomSecretKey:a},f=function(e,t){return function(r){const i=e(r);return{secretKey:i,publicKey:t(i)}}}(a,s);return Object.freeze(c),Object.freeze(n),Object.freeze({getPublicKey:s,getSharedSecret:function(t,i,n=!0){if(!0===u(t))throw new Error("first arg must be private key");if(!1===u(i))throw new Error("second arg must be public key");const o=r.fromBytes(t);return e.fromBytes(i).multiply(o).toBytes(n)},keygen:f,Point:e,utils:c,lengths:n})}function xe(e,t,r={}){const i=t;(0,n.sd)(i),P(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const a=void 0===(r=Object.assign({},r)).randomBytes?h:r.randomBytes,f=void 0===r.hmac?(e,t)=>(0,te.hmac)(i,e,t):r.hmac,{Fp:p,Fn:d}=e,{ORDER:g,BITS:m}=d,{keygen:y,getPublicKey:v,getSharedSecret:S,utils:w,lengths:_}=ke(e,r),O={prehash:!0,lowS:"boolean"!=typeof r.lowS||r.lowS,format:"compact",extraEntropy:!1},E=g*_e+we<p.ORDER;function k(e){return e>g>>we}function x(e,t){if(!d.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function T(){if(E)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function R(e,t){me(t);const r=_.signature;return o(e,"compact"===t?r:"recovered"===t?r+1:void 0)}class B{r;s;recovery;constructor(e,t,r){if(this.r=x("r",e),this.s=x("s",t),null!=r){if(T(),![0,1,2,3].includes(r))throw new Error("invalid recovery id");this.recovery=r}Object.freeze(this)}static fromBytes(e,t=O.format){let r;if(R(e,t),"der"===t){const{r:t,s:r}=be.toSig(o(e));return new B(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));const i=_.signature/2,n=e.subarray(0,i),a=e.subarray(i,2*i);return new B(d.fromBytes(n),d.fromBytes(a),r)}static fromHex(e,t){return this.fromBytes(c(e),t)}assertRecovery(){const{recovery:e}=this;if(null==e)throw new Error("invalid recovery id: must be present");return e}addRecoveryBit(e){return new B(this.r,this.s,e)}recoverPublicKey(t){const{r,s:i}=this,n=this.assertRecovery(),a=2===n||3===n?r+g:r;if(!p.isValid(a))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const s=p.toBytes(a),c=e.fromBytes(u(Ae(!(1&n)),s)),l=d.inv(a),h=C(o(t,void 0,"msgHash")),f=d.create(-h*l),m=d.create(i*l),y=e.BASE.multiplyUnsafe(f).add(c.multiplyUnsafe(m));if(y.is0())throw new Error("invalid recovery: point at infinify");return y.assertValidity(),y}hasHighS(){return k(this.s)}toBytes(e=O.format){if(me(e),"der"===e)return c(be.hexFromSig(this));const{r:t,s:r}=this,i=d.toBytes(t),n=d.toBytes(r);return"recovered"===e?(T(),u(Uint8Array.of(this.assertRecovery()),i,n)):u(i,n)}toHex(e){return s(this.toBytes(e))}}Object.freeze(B.prototype),Object.freeze(B);const N=void 0===r.bits2int?function(e){if(e.length>8192)throw new Error("input is too large");const t=b(e),r=8*e.length-m;return r>0?t>>BigInt(r):t}:r.bits2int,C=void 0===r.bits2int_modN?function(e){return d.create(N(e))}:r.bits2int_modN,D=A(m);function M(e){return I("num < 2^"+m,e,Se,D),d.toBytes(e)}function j(e,t){return o(e,void 0,"message"),t?o(i(e),void 0,"prehashed message"):e}return Object.freeze({keygen:y,getPublicKey:v,getSharedSecret:S,utils:w,lengths:_,Point:e,sign:function(t,r,s={}){const{seed:c,k2sig:l}=function(t,r,i){const{lowS:n,prehash:s,extraEntropy:c}=ye(i,O);t=j(t,s);const l=C(t),h=d.fromBytes(r);if(!d.isValidNot0(h))throw new Error("invalid private key");const f=[M(h),M(l)];if(null!=c&&!1!==c){const e=!0===c?a(_.secretKey):c;f.push(o(e,void 0,"extraEntropy"))}const p=u(...f),g=l;return{seed:p,k2sig:function(t){const r=N(t);if(!d.isValidNot0(r))return;const i=d.inv(r),o=e.BASE.multiply(r).toAffine(),a=d.create(o.x);if(a===Se)return;const s=d.create(i*d.create(g+a*h));if(s===Se)return;let u=(o.x===a?0:2)|Number(o.y&we),c=s;return n&&k(s)&&(c=d.neg(s),u^=1),new B(a,c,E?void 0:u)}}}(t,r,s);return function(e,t,r){if((0,n.Fe)(e,"hashLen"),(0,n.Fe)(t,"qByteLen"),"function"!=typeof r)throw new TypeError("hmacFn must be a function");const i=e=>new Uint8Array(e),o=Uint8Array.of(),a=Uint8Array.of(0),s=Uint8Array.of(1);let c=i(e),l=i(e),h=0;const f=()=>{c.fill(1),l.fill(0),h=0},p=(...e)=>r(l,u(c,...e)),d=(e=o)=>{l=p(a,e),c=p(),0!==e.length&&(l=p(s,e),c=p())},g=()=>{if(h++>=1e3)throw new Error("drbg: tried max amount of iterations");let e=0;const r=[];for(;e<t;){c=p();const t=c.slice();r.push(t),e+=c.length}return u(...r)};return(e,t)=>{let r;for(f(),d(e);void 0===(r=t(g()));)d();return f(),r}}(i.outputLen,d.BYTES,f)(c,l).toBytes(s.format)},verify:function(t,r,i,n={}){const{lowS:a,prehash:s,format:u}=ye(n,O);if(i=o(i,void 0,"publicKey"),r=j(r,s),!l(t)){throw new Error("verify expects Uint8Array signature"+(t instanceof B?", use sig.toBytes()":""))}R(t,u);try{const n=B.fromBytes(t,u),o=e.fromBytes(i);if(a&&n.hasHighS())return!1;const{r:s,s:c}=n,l=C(r),h=d.inv(c),f=d.create(l*h),p=d.create(s*h),g=e.BASE.multiplyUnsafe(f).add(o.multiplyUnsafe(p));if(g.is0())return!1;return d.create(g.x)===s}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){const{prehash:i}=ye(r,O);return t=j(t,i),B.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:B,hash:i})}
47
47
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
48
- const Te={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Re={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Be=BigInt(2);const Ne=Z(Te.p,{sqrt:function(e){const t=Te.p,r=BigInt(3),i=BigInt(6),n=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),u=BigInt(88),c=e*e*e%t,l=c*c*e%t,h=L(l,r,t)*l%t,f=L(h,r,t)*l%t,p=L(f,Be,t)*c%t,d=L(p,n,t)*p%t,g=L(d,o,t)*d%t,m=L(g,s,t)*g%t,y=L(m,u,t)*m%t,v=L(y,s,t)*g%t,b=L(v,r,t)*l%t,S=L(b,a,t)*d%t,w=L(S,i,t)*c%t,_=L(w,Be,t);if(!Ne.eql(Ne.sqr(_),e))throw new Error("Cannot find square root");return _}}),Ce=Ee(Te,{Fp:Ne,endo:Re}),De=xe(Ce,i.sha256)},7474(e,t,r){"use strict";r.d(t,{hmac:()=>o});var i=r(508);class n{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if((0,i.sd)(e),(0,i.DO)(t,void 0,"key"),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 r=this.blockLen,n=new Uint8Array(r);n.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),(0,i.uH)(n)}update(e){return(0,i.CC)(this),this.iHash.update(e),this}digestInto(e){(0,i.CC)(this),(0,i.Ht)(e,this),this.finished=!0;const t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:t,iHash:r,finished:i,destroyed:n,blockLen:o,outputLen:a}=this;return e.finished=i,e.destroyed=n,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const o=(()=>{const e=(e,t,r)=>new n(e,t).update(r).digest();return e.create=(e,t)=>new n(e,t),e})()},4544(e,t,r){"use strict";r.d(t,{sha256:()=>j,sha512:()=>U});var i=r(508);function n(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}class a{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,i.O8)(this.buffer)}update(e){(0,i.CC)(this),(0,i.DO)(e);const{view:t,buffer:r,blockLen:n}=this,o=e.length;for(let a=0;a<o;){const s=Math.min(n-this.pos,o-a);if(s===n){const t=(0,i.O8)(e);for(;n<=o-a;a+=n)this.process(t,a);continue}r.set(e.subarray(a,a+s),this.pos),this.pos+=s,a+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,i.CC)(this),(0,i.Ht)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:a}=this;t[a++]=128,(0,i.uH)(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)t[e]=0;r.setBigUint64(n-8,BigInt(8*this.length),o),this.process(r,0);const s=(0,i.O8)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=u/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,l[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:n,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=n,e.length=i,e.pos=a,i%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const s=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),c=BigInt(2**32-1),l=BigInt(32);function h(e,t=!1){return t?{h:Number(e&c),l:Number(e>>l&c)}:{h:0|Number(e>>l&c),l:0|Number(e&c)}}function f(e,t=!1){const r=e.length;let i=new Uint32Array(r),n=new Uint32Array(r);for(let o=0;o<r;o++){const{h:r,l:a}=h(e[o],t);[i[o],n[o]]=[r,a]}return[i,n]}const p=(e,t,r)=>e>>>r,d=(e,t,r)=>e<<32-r|t>>>r,g=(e,t,r)=>e>>>r|t<<32-r,m=(e,t,r)=>e<<32-r|t>>>r,y=(e,t,r)=>e<<64-r|t>>>r-32,v=(e,t,r)=>e>>>r-32|t<<64-r;function b(e,t,r,i){const n=(t>>>0)+(i>>>0);return{h:e+r+(n/2**32|0)|0,l:0|n}}const S=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),w=(e,t,r,i)=>t+r+i+(e/2**32|0)|0,_=(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),O=(e,t,r,i,n)=>t+r+i+n+(e/2**32|0)|0,I=(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0),E=(e,t,r,i,n,o)=>t+r+i+n+o+(e/2**32|0)|0;const A=Uint32Array.from([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]),P=new Uint32Array(64);class k extends a{constructor(e){super(64,e,8,!1)}get(){const{A:e,B:t,C:r,D:i,E:n,F:o,G:a,H:s}=this;return[e,t,r,i,n,o,a,s]}set(e,t,r,i,n,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)P[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=P[e-15],r=P[e-2],n=(0,i.Ow)(t,7)^(0,i.Ow)(t,18)^t>>>3,o=(0,i.Ow)(r,17)^(0,i.Ow)(r,19)^r>>>10;P[e]=o+P[e-7]+n+P[e-16]|0}let{A:r,B:a,C:s,D:u,E:c,F:l,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,i.Ow)(c,6)^(0,i.Ow)(c,11)^(0,i.Ow)(c,25))+n(c,l,h)+A[e]+P[e]|0,p=((0,i.Ow)(r,2)^(0,i.Ow)(r,13)^(0,i.Ow)(r,22))+o(r,a,s)|0;f=h,h=l,l=c,c=u+t|0,u=s,s=a,a=r,r=t+p|0}r=r+this.A|0,a=a+this.B|0,s=s+this.C|0,u=u+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,a,s,u,c,l,h,f)}roundClean(){(0,i.uH)(P)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),(0,i.uH)(this.buffer)}}class x extends k{A=0|s[0];B=0|s[1];C=0|s[2];D=0|s[3];E=0|s[4];F=0|s[5];G=0|s[6];H=0|s[7];constructor(){super(32)}}const T=(()=>f(["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))))(),R=(()=>T[0])(),B=(()=>T[1])(),N=new Uint32Array(80),C=new Uint32Array(80);class D extends a{constructor(e){super(128,e,16,!1)}get(){const{Ah:e,Al:t,Bh:r,Bl:i,Ch:n,Cl:o,Dh:a,Dl:s,Eh:u,El:c,Fh:l,Fl:h,Gh:f,Gl:p,Hh:d,Hl:g}=this;return[e,t,r,i,n,o,a,s,u,c,l,h,f,p,d,g]}set(e,t,r,i,n,o,a,s,u,c,l,h,f,p,d,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|c,this.Fh=0|l,this.Fl=0|h,this.Gh=0|f,this.Gl=0|p,this.Hh=0|d,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)N[r]=e.getUint32(t),C[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|N[e-15],r=0|C[e-15],i=g(t,r,1)^g(t,r,8)^p(t,0,7),n=m(t,r,1)^m(t,r,8)^d(t,r,7),o=0|N[e-2],a=0|C[e-2],s=g(o,a,19)^y(o,a,61)^p(o,0,6),u=m(o,a,19)^v(o,a,61)^d(o,a,6),c=_(n,u,C[e-7],C[e-16]),l=O(c,i,s,N[e-7],N[e-16]);N[e]=0|l,C[e]=0|c}let{Ah:r,Al:i,Bh:n,Bl:o,Ch:a,Cl:s,Dh:u,Dl:c,Eh:l,El:h,Fh:f,Fl:A,Gh:P,Gl:k,Hh:x,Hl:T}=this;for(let e=0;e<80;e++){const t=g(l,h,14)^g(l,h,18)^y(l,h,41),p=m(l,h,14)^m(l,h,18)^v(l,h,41),d=l&f^~l&P,_=I(T,p,h&A^~h&k,B[e],C[e]),O=E(_,x,t,d,R[e],N[e]),D=0|_,M=g(r,i,28)^y(r,i,34)^y(r,i,39),j=m(r,i,28)^v(r,i,34)^v(r,i,39),U=r&n^r&a^n&a,L=i&o^i&s^o&s;x=0|P,T=0|k,P=0|f,k=0|A,f=0|l,A=0|h,({h:l,l:h}=b(0|u,0|c,0|O,0|D)),u=0|a,c=0|s,a=0|n,s=0|o,n=0|r,o=0|i;const H=S(D,j,L);r=w(H,O,M,U),i=0|H}({h:r,l:i}=b(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:o}=b(0|this.Bh,0|this.Bl,0|n,0|o)),({h:a,l:s}=b(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:c}=b(0|this.Dh,0|this.Dl,0|u,0|c)),({h:l,l:h}=b(0|this.Eh,0|this.El,0|l,0|h)),({h:f,l:A}=b(0|this.Fh,0|this.Fl,0|f,0|A)),({h:P,l:k}=b(0|this.Gh,0|this.Gl,0|P,0|k)),({h:x,l:T}=b(0|this.Hh,0|this.Hl,0|x,0|T)),this.set(r,i,n,o,a,s,u,c,l,h,f,A,P,k,x,T)}roundClean(){(0,i.uH)(N,C)}destroy(){this.destroyed=!0,(0,i.uH)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class M extends D{Ah=0|u[0];Al=0|u[1];Bh=0|u[2];Bl=0|u[3];Ch=0|u[4];Cl=0|u[5];Dh=0|u[6];Dl=0|u[7];Eh=0|u[8];El=0|u[9];Fh=0|u[10];Fl=0|u[11];Gh=0|u[12];Gl=0|u[13];Hh=0|u[14];Hl=0|u[15];constructor(){super(64)}}const j=(0,i.qj)(()=>new x,(0,i.nx)(1)),U=(0,i.qj)(()=>new M,(0,i.nx)(3))},508(e,t,r){"use strict";function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT}function n(e,t=""){if("number"!=typeof e){throw new TypeError(`${t&&`"${t}" `}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){throw new RangeError(`${t&&`"${t}" `}expected integer >= 0, got ${e}`)}}function o(e,t,r=""){const n=i(e),o=e?.length,a=void 0!==t;if(!n||a&&o!==t){const i=(r&&`"${r}" `)+"expected Uint8Array"+(a?` of length ${t}`:"")+", got "+(n?`length=${o}`:"type="+typeof e);if(!n)throw new TypeError(i);throw new RangeError(i)}return e}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new TypeError("Hash must wrapped by utils.createHasher");if(n(e.outputLen),n(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}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,void 0,"digestInto() output");const r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function c(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function l(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function h(e,t){return e<<32-t|e>>>t}r.d(t,{CC:()=>s,DO:()=>o,Fe:()=>n,Ht:()=>u,Id:()=>O,My:()=>d,O8:()=>l,Ow:()=>h,aT:()=>_,aY:()=>i,nx:()=>A,po:()=>E,qj:()=>I,sd:()=>a,uH:()=>c});const f=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),p=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function d(e){if(o(e),f)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=p[e[r]];return t}const g=48,m=57,y=65,v=70,b=97,S=102;function w(e){return e>=g&&e<=m?e-g:e>=y&&e<=v?e-(y-10):e>=b&&e<=S?e-(b-10):void 0}function _(e){if("string"!=typeof e)throw new TypeError("hex string expected, got "+typeof e);if(f)try{return Uint8Array.fromHex(e)}catch(e){if(e instanceof SyntaxError)throw new RangeError(e.message);throw e}const t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){const r=w(e.charCodeAt(n)),o=w(e.charCodeAt(n+1));if(void 0===r||void 0===o){const t=e[n]+e[n+1];throw new RangeError('hex string expected, got non-hex character "'+t+'" at index '+n)}i[t]=16*r+o}return i}function O(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];o(i),t+=i.length}const r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r}function I(e,t={}){const r=(t,r)=>e(r).update(t).digest(),i=e(void 0);return r.outputLen=i.outputLen,r.blockLen=i.blockLen,r.canXOF=i.canXOF,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}function E(e=32){n(e,"bytesLength");const t="object"==typeof globalThis?globalThis.crypto:null;if("function"!=typeof t?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const A=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})},9294(e,t,r){"use strict";r.d(t,{c:()=>i});var i=r(4233)},8330(e){"use strict";e.exports={rE:"5.3.0"}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={id:i,loaded:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.c=t,r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var i=r(r.s=5424);bsvCovenant=i})();
48
+ const Te={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Re={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Be=BigInt(2);const Ne=Z(Te.p,{sqrt:function(e){const t=Te.p,r=BigInt(3),i=BigInt(6),n=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),u=BigInt(88),c=e*e*e%t,l=c*c*e%t,h=L(l,r,t)*l%t,f=L(h,r,t)*l%t,p=L(f,Be,t)*c%t,d=L(p,n,t)*p%t,g=L(d,o,t)*d%t,m=L(g,s,t)*g%t,y=L(m,u,t)*m%t,v=L(y,s,t)*g%t,b=L(v,r,t)*l%t,S=L(b,a,t)*d%t,w=L(S,i,t)*c%t,_=L(w,Be,t);if(!Ne.eql(Ne.sqr(_),e))throw new Error("Cannot find square root");return _}}),Ce=Ee(Te,{Fp:Ne,endo:Re}),De=xe(Ce,i.sha256)},7474(e,t,r){"use strict";r.d(t,{hmac:()=>o});var i=r(508);class n{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if((0,i.sd)(e),(0,i.DO)(t,void 0,"key"),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 r=this.blockLen,n=new Uint8Array(r);n.set(t.length>r?e.create().update(t).digest():t);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),(0,i.uH)(n)}update(e){return(0,i.CC)(this),this.iHash.update(e),this}digestInto(e){(0,i.CC)(this),(0,i.Ht)(e,this),this.finished=!0;const t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});const{oHash:t,iHash:r,finished:i,destroyed:n,blockLen:o,outputLen:a}=this;return e.finished=i,e.destroyed=n,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const o=(()=>{const e=(e,t,r)=>new n(e,t).update(r).digest();return e.create=(e,t)=>new n(e,t),e})()},4544(e,t,r){"use strict";r.d(t,{sha256:()=>j,sha512:()=>U});var i=r(508);function n(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}class a{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=(0,i.O8)(this.buffer)}update(e){(0,i.CC)(this),(0,i.DO)(e);const{view:t,buffer:r,blockLen:n}=this,o=e.length;for(let a=0;a<o;){const s=Math.min(n-this.pos,o-a);if(s===n){const t=(0,i.O8)(e);for(;n<=o-a;a+=n)this.process(t,a);continue}r.set(e.subarray(a,a+s),this.pos),this.pos+=s,a+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,i.CC)(this),(0,i.Ht)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:a}=this;t[a++]=128,(0,i.uH)(this.buffer.subarray(a)),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)t[e]=0;r.setBigUint64(n-8,BigInt(8*this.length),o),this.process(r,0);const s=(0,i.O8)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const c=u/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)s.setUint32(4*e,l[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:n,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=n,e.length=i,e.pos=a,i%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const s=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),c=BigInt(2**32-1),l=BigInt(32);function h(e,t=!1){return t?{h:Number(e&c),l:Number(e>>l&c)}:{h:0|Number(e>>l&c),l:0|Number(e&c)}}function f(e,t=!1){const r=e.length;let i=new Uint32Array(r),n=new Uint32Array(r);for(let o=0;o<r;o++){const{h:r,l:a}=h(e[o],t);[i[o],n[o]]=[r,a]}return[i,n]}const p=(e,t,r)=>e>>>r,d=(e,t,r)=>e<<32-r|t>>>r,g=(e,t,r)=>e>>>r|t<<32-r,m=(e,t,r)=>e<<32-r|t>>>r,y=(e,t,r)=>e<<64-r|t>>>r-32,v=(e,t,r)=>e>>>r-32|t<<64-r;function b(e,t,r,i){const n=(t>>>0)+(i>>>0);return{h:e+r+(n/2**32|0)|0,l:0|n}}const S=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),w=(e,t,r,i)=>t+r+i+(e/2**32|0)|0,_=(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),O=(e,t,r,i,n)=>t+r+i+n+(e/2**32|0)|0,I=(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0),E=(e,t,r,i,n,o)=>t+r+i+n+o+(e/2**32|0)|0;const A=Uint32Array.from([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]),P=new Uint32Array(64);class k extends a{constructor(e){super(64,e,8,!1)}get(){const{A:e,B:t,C:r,D:i,E:n,F:o,G:a,H:s}=this;return[e,t,r,i,n,o,a,s]}set(e,t,r,i,n,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)P[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=P[e-15],r=P[e-2],n=(0,i.Ow)(t,7)^(0,i.Ow)(t,18)^t>>>3,o=(0,i.Ow)(r,17)^(0,i.Ow)(r,19)^r>>>10;P[e]=o+P[e-7]+n+P[e-16]|0}let{A:r,B:a,C:s,D:u,E:c,F:l,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,i.Ow)(c,6)^(0,i.Ow)(c,11)^(0,i.Ow)(c,25))+n(c,l,h)+A[e]+P[e]|0,p=((0,i.Ow)(r,2)^(0,i.Ow)(r,13)^(0,i.Ow)(r,22))+o(r,a,s)|0;f=h,h=l,l=c,c=u+t|0,u=s,s=a,a=r,r=t+p|0}r=r+this.A|0,a=a+this.B|0,s=s+this.C|0,u=u+this.D|0,c=c+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,a,s,u,c,l,h,f)}roundClean(){(0,i.uH)(P)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),(0,i.uH)(this.buffer)}}class x extends k{A=0|s[0];B=0|s[1];C=0|s[2];D=0|s[3];E=0|s[4];F=0|s[5];G=0|s[6];H=0|s[7];constructor(){super(32)}}const T=(()=>f(["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))))(),R=(()=>T[0])(),B=(()=>T[1])(),N=new Uint32Array(80),C=new Uint32Array(80);class D extends a{constructor(e){super(128,e,16,!1)}get(){const{Ah:e,Al:t,Bh:r,Bl:i,Ch:n,Cl:o,Dh:a,Dl:s,Eh:u,El:c,Fh:l,Fl:h,Gh:f,Gl:p,Hh:d,Hl:g}=this;return[e,t,r,i,n,o,a,s,u,c,l,h,f,p,d,g]}set(e,t,r,i,n,o,a,s,u,c,l,h,f,p,d,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|u,this.El=0|c,this.Fh=0|l,this.Fl=0|h,this.Gh=0|f,this.Gl=0|p,this.Hh=0|d,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)N[r]=e.getUint32(t),C[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|N[e-15],r=0|C[e-15],i=g(t,r,1)^g(t,r,8)^p(t,0,7),n=m(t,r,1)^m(t,r,8)^d(t,r,7),o=0|N[e-2],a=0|C[e-2],s=g(o,a,19)^y(o,a,61)^p(o,0,6),u=m(o,a,19)^v(o,a,61)^d(o,a,6),c=_(n,u,C[e-7],C[e-16]),l=O(c,i,s,N[e-7],N[e-16]);N[e]=0|l,C[e]=0|c}let{Ah:r,Al:i,Bh:n,Bl:o,Ch:a,Cl:s,Dh:u,Dl:c,Eh:l,El:h,Fh:f,Fl:A,Gh:P,Gl:k,Hh:x,Hl:T}=this;for(let e=0;e<80;e++){const t=g(l,h,14)^g(l,h,18)^y(l,h,41),p=m(l,h,14)^m(l,h,18)^v(l,h,41),d=l&f^~l&P,_=I(T,p,h&A^~h&k,B[e],C[e]),O=E(_,x,t,d,R[e],N[e]),D=0|_,M=g(r,i,28)^y(r,i,34)^y(r,i,39),j=m(r,i,28)^v(r,i,34)^v(r,i,39),U=r&n^r&a^n&a,L=i&o^i&s^o&s;x=0|P,T=0|k,P=0|f,k=0|A,f=0|l,A=0|h,({h:l,l:h}=b(0|u,0|c,0|O,0|D)),u=0|a,c=0|s,a=0|n,s=0|o,n=0|r,o=0|i;const H=S(D,j,L);r=w(H,O,M,U),i=0|H}({h:r,l:i}=b(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:o}=b(0|this.Bh,0|this.Bl,0|n,0|o)),({h:a,l:s}=b(0|this.Ch,0|this.Cl,0|a,0|s)),({h:u,l:c}=b(0|this.Dh,0|this.Dl,0|u,0|c)),({h:l,l:h}=b(0|this.Eh,0|this.El,0|l,0|h)),({h:f,l:A}=b(0|this.Fh,0|this.Fl,0|f,0|A)),({h:P,l:k}=b(0|this.Gh,0|this.Gl,0|P,0|k)),({h:x,l:T}=b(0|this.Hh,0|this.Hl,0|x,0|T)),this.set(r,i,n,o,a,s,u,c,l,h,f,A,P,k,x,T)}roundClean(){(0,i.uH)(N,C)}destroy(){this.destroyed=!0,(0,i.uH)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class M extends D{Ah=0|u[0];Al=0|u[1];Bh=0|u[2];Bl=0|u[3];Ch=0|u[4];Cl=0|u[5];Dh=0|u[6];Dl=0|u[7];Eh=0|u[8];El=0|u[9];Fh=0|u[10];Fl=0|u[11];Gh=0|u[12];Gl=0|u[13];Hh=0|u[14];Hl=0|u[15];constructor(){super(64)}}const j=(0,i.qj)(()=>new x,(0,i.nx)(1)),U=(0,i.qj)(()=>new M,(0,i.nx)(3))},508(e,t,r){"use strict";function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT}function n(e,t=""){if("number"!=typeof e){throw new TypeError(`${t&&`"${t}" `}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){throw new RangeError(`${t&&`"${t}" `}expected integer >= 0, got ${e}`)}}function o(e,t,r=""){const n=i(e),o=e?.length,a=void 0!==t;if(!n||a&&o!==t){const i=(r&&`"${r}" `)+"expected Uint8Array"+(a?` of length ${t}`:"")+", got "+(n?`length=${o}`:"type="+typeof e);if(!n)throw new TypeError(i);throw new RangeError(i)}return e}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw new TypeError("Hash must wrapped by utils.createHasher");if(n(e.outputLen),n(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}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,void 0,"digestInto() output");const r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function c(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function l(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function h(e,t){return e<<32-t|e>>>t}r.d(t,{CC:()=>s,DO:()=>o,Fe:()=>n,Ht:()=>u,Id:()=>O,My:()=>d,O8:()=>l,Ow:()=>h,aT:()=>_,aY:()=>i,nx:()=>A,po:()=>E,qj:()=>I,sd:()=>a,uH:()=>c});const f=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),p=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function d(e){if(o(e),f)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=p[e[r]];return t}const g=48,m=57,y=65,v=70,b=97,S=102;function w(e){return e>=g&&e<=m?e-g:e>=y&&e<=v?e-(y-10):e>=b&&e<=S?e-(b-10):void 0}function _(e){if("string"!=typeof e)throw new TypeError("hex string expected, got "+typeof e);if(f)try{return Uint8Array.fromHex(e)}catch(e){if(e instanceof SyntaxError)throw new RangeError(e.message);throw e}const t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){const r=w(e.charCodeAt(n)),o=w(e.charCodeAt(n+1));if(void 0===r||void 0===o){const t=e[n]+e[n+1];throw new RangeError('hex string expected, got non-hex character "'+t+'" at index '+n)}i[t]=16*r+o}return i}function O(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];o(i),t+=i.length}const r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r}function I(e,t={}){const r=(t,r)=>e(r).update(t).digest(),i=e(void 0);return r.outputLen=i.outputLen,r.blockLen=i.blockLen,r.canXOF=i.canXOF,r.create=t=>e(t),Object.assign(r,t),Object.freeze(r)}function E(e=32){n(e,"bytesLength");const t="object"==typeof globalThis?globalThis.crypto:null;if("function"!=typeof t?.getRandomValues)throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const A=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})},9294(e,t,r){"use strict";r.d(t,{c:()=>i});var i=r(4233)},8330(e){"use strict";e.exports={rE:"5.3.1"}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={id:i,loaded:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.c=t,r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var i=r(r.s=5424);bsvCovenant=i})();