@libp2p/pnet 1.0.0-856ccd708 → 1.0.0-863b3de03

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- > Connection protection management for libp2p leveraging PSK encryption via XSalsa20.
1
+ # @libp2p/pnet
2
2
 
3
3
  [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
4
4
  [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
@@ -9,6 +9,21 @@
9
9
 
10
10
  # About
11
11
 
12
+ <!--
13
+
14
+ !IMPORTANT!
15
+
16
+ Everything in this README between "# About" and "# Install" is automatically
17
+ generated and will be overwritten the next time the doc generator is run.
18
+
19
+ To make changes to this section, please update the @packageDocumentation section
20
+ of src/index.js or src/index.ts
21
+
22
+ To experiment with formatting, please run "npm run docs" from the root of this
23
+ repo and examine the changes made.
24
+
25
+ -->
26
+
12
27
  Connection protection management for libp2p leveraging PSK encryption via XSalsa20.
13
28
 
14
29
  ## Example
@@ -53,7 +68,7 @@ node -e "import('@libp2p/pnet').then(({ generateKey }) => generateKey(process.st
53
68
 
54
69
  ### Programmatically
55
70
 
56
- ```js
71
+ ```TypeScript
57
72
  import fs from 'fs'
58
73
  import { generateKey } from '@libp2p/pnet'
59
74
 
@@ -85,8 +100,8 @@ Loading this module through a script tag will make it's exports available as `Li
85
100
 
86
101
  Licensed under either of
87
102
 
88
- - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
89
- - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
103
+ - Apache 2.0, ([LICENSE-APACHE](https://github.com/libp2p/js-libp2p/blob/main/packages/pnet/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
104
+ - MIT ([LICENSE-MIT](https://github.com/libp2p/js-libp2p/blob/main/packages/pnet/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
90
105
 
91
106
  # Contribution
92
107
 
package/dist/index.min.js CHANGED
@@ -1,80 +1,10 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PPnet = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PPnet=(()=>{var gi=Object.create;var lt=Object.defineProperty;var pi=Object.getOwnPropertyDescriptor;var yi=Object.getOwnPropertyNames;var mi=Object.getPrototypeOf,Ai=Object.prototype.hasOwnProperty;var yr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),q=(r,e)=>{for(var t in e)lt(r,t,{get:e[t],enumerable:!0})},mn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of yi(e))!Ai.call(r,s)&&s!==t&&lt(r,s,{get:()=>e[s],enumerable:!(n=pi(e,s))||n.enumerable});return r};var An=(r,e,t)=>(t=r!=null?gi(mi(r)):{},mn(e||!r||!r.__esModule?lt(t,"default",{value:r,enumerable:!0}):t,r)),bi=r=>mn(lt({},"__esModule",{value:!0}),r);var ts=yr(_e=>{"use strict";var Ho="[object ArrayBuffer]",le=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Ho}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),s=r.toUint8Array(t);if(n.length!==s.byteLength)return!1;for(let i=0;i<n.length;i++)if(n[i]!==s[i])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let s=new Uint8Array(n),i=0;for(let o of t){let l=this.toUint8Array(o);s.set(l,i),i+=l.length}return e[e.length-1]instanceof Function?this.toView(s,e[e.length-1]):s.buffer}},en="string",Fo=/^[0-9a-f]+$/i,Oo=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Qo=/^[a-zA-Z0-9-_]+$/,xt=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);return n.buffer}static toString(e){let t=le.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return decodeURIComponent(escape(n))}},Y=class{static toString(e,t=!1){let n=le.toArrayBuffer(e),s=new DataView(n),i="";for(let o=0;o<n.byteLength;o+=2){let l=s.getUint16(o,t);i+=String.fromCharCode(l)}return i}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),s=new DataView(n);for(let i=0;i<e.length;i++)s.setUint16(i*2,e.charCodeAt(i),t);return n}},vt=class r{static isHex(e){return typeof e===en&&Fo.test(e)}static isBase64(e){return typeof e===en&&Oo.test(e)}static isBase64Url(e){return typeof e===en&&Qo.test(e)}static ToString(e,t="utf8"){let n=le.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Y.toString(n,!0);case"utf16":case"utf16be":return Y.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Y.fromString(e,!0);case"utf16":case"utf16be":return Y.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=le.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return xt.fromString(e);case"utf16":case"utf16be":return Y.fromString(e);case"utf16le":case"usc2":return Y.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return xt.toString(e);case"utf16":case"utf16be":return Y.toString(e);case"utf16le":case"usc2":return Y.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);return n.buffer}static ToBinary(e){let t=le.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return n}static ToHex(e){let t=le.toUint8Array(e),n="",s=t.length;for(let i=0;i<s;i++){let o=t[i];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let s=0;s<t.length;s=s+2){let i=t.slice(s,s+2);n[s/2]=parseInt(i,16)}return n.buffer}static ToUtf16String(e,t=!1){return Y.toString(e,t)}static FromUtf16String(e,t=!1){return Y.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};vt.DEFAULT_UTF8_ENCODING="utf8";function jo(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let s=arguments[n];for(let i in s)t[i]=s[i]}return t}function Go(...r){let e=r.map(s=>s.byteLength).reduce((s,i)=>s+i),t=new Uint8Array(e),n=0;return r.map(s=>new Uint8Array(s)).forEach(s=>{for(let i of s)t[n++]=i}),t.buffer}function $o(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<r.byteLength;s++)if(t[s]!==n[s])return!1;return!0}_e.BufferSourceConverter=le;_e.Convert=vt;_e.assign=jo;_e.combine=Go;_e.isEqual=$o});var ri=yr((Th,ti)=>{var ha=(r,e)=>function(){return e||(0,r[Object.keys(r)[0]])((e={exports:{}}).exports,e),e.exports},da=(()=>{for(var r=new Uint8Array(128),e=0;e<64;e++)r[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var n=t.length,s=new Uint8Array((n-(t[n-1]=="=")-(t[n-2]=="="))*3/4|0),i=0,o=0;i<n;){var l=r[t.charCodeAt(i++)],c=r[t.charCodeAt(i++)],f=r[t.charCodeAt(i++)],h=r[t.charCodeAt(i++)];s[o++]=l<<2|c>>4,s[o++]=c<<4|f>>2,s[o++]=f<<6|h}return s}})(),ga=ha({"wasm-binary:./xsalsa20.wat"(r,e){e.exports=da("AGFzbQEAAAABGgNgBn9/f39/fwBgBn9/f39+fwF+YAN/f38AAwcGAAEBAgICBQUBAQroBwcoAwZtZW1vcnkCAAx4c2Fsc2EyMF94b3IAAAxjb3JlX3NhbHNhMjAABArqEQYYACAAIAEgAiADIAQgACkDACAFEAE3AwALPQBB8AAgAyAFEAMgACABIAIgA0EQaiAEQfAAEAJB8ABCADcDAEH4AEIANwMAQYABQgA3AwBBiAFCADcDAAuHBQEBfyACQQBGBEBCAA8LQdAAIAUpAwA3AwBB2AAgBUEIaikDADcDAEHgACAFQRBqKQMANwMAQegAIAVBGGopAwA3AwBBACADKQMANwMAQQggBDcDAAJAA0AgAkHAAEkNAUEQQQBB0AAQBSAAIAEpAwBBECkDAIU3AwAgAEEIaiABQQhqKQMAQRgpAwCFNwMAIABBEGogAUEQaikDAEEgKQMAhTcDACAAQRhqIAFBGGopAwBBKCkDAIU3AwAgAEEgaiABQSBqKQMAQTApAwCFNwMAIABBKGogAUEoaikDAEE4KQMAhTcDACAAQTBqIAFBMGopAwBBwAApAwCFNwMAIABBOGogAUE4aikDAEHIACkDAIU3AwBBCEEIKQMAQgF8NwMAIABBwABqIQAgAUHAAGohASACQcAAayECDAALC0EIKQMAIQQgAkEASwRAQRBBAEHQABAFAkACQAJAAkACQAJAAkACQCACQQhuDgcHBgUEAwIBAAsgAEE4aiABQThqKQMAQcgAKQMAhTcDAAsgAEEwaiABQTBqKQMAQcAAKQMAhTcDAAsgAEEoaiABQShqKQMAQTgpAwCFNwMACyAAQSBqIAFBIGopAwBBMCkDAIU3AwALIABBGGogAUEYaikDAEEoKQMAhTcDAAsgAEEQaiABQRBqKQMAQSApAwCFNwMACyAAQQhqIAFBCGopAwBBGCkDAIU3AwALIAAgASkDAEEQKQMAhTcDAAtBEEIANwMAQRhCADcDAEEgQgA3AwBBKEIANwMAQTBCADcDAEE4QgA3AwBBwABCADcDAEHIAEIANwMAQdAAQgA3AwBB2ABCADcDAEHgAEIANwMAQegAQgA3AwAgBA8LnQUBEX9B5fDBiwYhA0HuyIGZAyEIQbLaiMsHIQ1B9MqB2QYhEiACKAIAIQQgAkEEaigCACEFIAJBCGooAgAhBiACQQxqKAIAIQcgAkEQaigCACEOIAJBFGooAgAhDyACQRhqKAIAIRAgAkEcaigCACERIAEoAgAhCSABQQRqKAIAIQogAUEIaigCACELIAFBDGooAgAhDEEUIRMCQANAIBNBAEYNASAHIAMgD2pBB3dzIQcgCyAHIANqQQl3cyELIA8gCyAHakENd3MhDyADIA8gC2pBEndzIQMgDCAIIARqQQd3cyEMIBAgDCAIakEJd3MhECAEIBAgDGpBDXdzIQQgCCAEIBBqQRJ3cyEIIBEgDSAJakEHd3MhESAFIBEgDWpBCXdzIQUgCSAFIBFqQQ13cyEJIA0gCSAFakESd3MhDSAGIBIgDmpBB3dzIQYgCiAGIBJqQQl3cyEKIA4gCiAGakENd3MhDiASIA4gCmpBEndzIRIgBCADIAZqQQd3cyEEIAUgBCADakEJd3MhBSAGIAUgBGpBDXdzIQYgAyAGIAVqQRJ3cyEDIAkgCCAHakEHd3MhCSAKIAkgCGpBCXdzIQogByAKIAlqQQ13cyEHIAggByAKakESd3MhCCAOIA0gDGpBB3dzIQ4gCyAOIA1qQQl3cyELIAwgCyAOakENd3MhDCANIAwgC2pBEndzIQ0gDyASIBFqQQd3cyEPIBAgDyASakEJd3MhECARIBAgD2pBDXdzIREgEiARIBBqQRJ3cyESIBNBAmshEwwACwsgACADNgIAIABBBGogCDYCACAAQQhqIA02AgAgAEEMaiASNgIAIABBEGogCTYCACAAQRRqIAo2AgAgAEEYaiALNgIAIABBHGogDDYCAAsKACAAIAEgAhAFC90GASF/QeXwwYsGIQNB7siBmQMhCEGy2ojLByENQfTKgdkGIRIgAigCACEEIAJBBGooAgAhBSACQQhqKAIAIQYgAkEMaigCACEHIAJBEGooAgAhDiACQRRqKAIAIQ8gAkEYaigCACEQIAJBHGooAgAhESABKAIAIQkgAUEEaigCACEKIAFBCGooAgAhCyABQQxqKAIAIQwgAyETIAQhFCAFIRUgBiEWIAchFyAIIRggCSEZIAohGiALIRsgDCEcIA0hHSAOIR4gDyEfIBAhICARISEgEiEiQRQhIwJAA0AgI0EARg0BIAcgAyAPakEHd3MhByALIAcgA2pBCXdzIQsgDyALIAdqQQ13cyEPIAMgDyALakESd3MhAyAMIAggBGpBB3dzIQwgECAMIAhqQQl3cyEQIAQgECAMakENd3MhBCAIIAQgEGpBEndzIQggESANIAlqQQd3cyERIAUgESANakEJd3MhBSAJIAUgEWpBDXdzIQkgDSAJIAVqQRJ3cyENIAYgEiAOakEHd3MhBiAKIAYgEmpBCXdzIQogDiAKIAZqQQ13cyEOIBIgDiAKakESd3MhEiAEIAMgBmpBB3dzIQQgBSAEIANqQQl3cyEFIAYgBSAEakENd3MhBiADIAYgBWpBEndzIQMgCSAIIAdqQQd3cyEJIAogCSAIakEJd3MhCiAHIAogCWpBDXdzIQcgCCAHIApqQRJ3cyEIIA4gDSAMakEHd3MhDiALIA4gDWpBCXdzIQsgDCALIA5qQQ13cyEMIA0gDCALakESd3MhDSAPIBIgEWpBB3dzIQ8gECAPIBJqQQl3cyEQIBEgECAPakENd3MhESASIBEgEGpBEndzIRIgI0ECayEjDAALCyAAIAMgE2o2AgAgAEEEaiAEIBRqNgIAIABBCGogBSAVajYCACAAQQxqIAYgFmo2AgAgAEEQaiAHIBdqNgIAIABBFGogCCAYajYCACAAQRhqIAkgGWo2AgAgAEEcaiAKIBpqNgIAIABBIGogCyAbajYCACAAQSRqIAwgHGo2AgAgAEEoaiANIB1qNgIAIABBLGogDiAeajYCACAAQTBqIA8gH2o2AgAgAEE0aiAQICBqNgIAIABBOGogESAhajYCACAAQTxqIBIgImo2AgAL")}}),pa=ga(),ya=new WebAssembly.Module(pa);ti.exports=r=>new WebAssembly.Instance(ya,r).exports});var oi=yr((_h,ii)=>{var at=typeof WebAssembly<"u"&&ri()(),gr=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]),ne=144,Me=ne,dr=[];ii.exports=se;se.NONCEBYTES=24;se.KEYBYTES=32;se.core_hsalsa20=si;se.SIGMA=gr;function se(r,e){if(!(this instanceof se))return new se(r,e);if(!r||r.length<24)throw new Error("nonce must be at least 24 bytes");if(!e||e.length<32)throw new Error("key must be at least 32 bytes");this._xor=at?new pr(r,e):new fn(r,e)}se.prototype.update=function(r,e){if(!r)throw new Error("input must be Uint8Array or Buffer");return e||(e=new Uint8Array(r.length)),r.length&&this._xor.update(r,e),e};se.prototype.final=se.prototype.finalize=function(){this._xor.finalize(),this._xor=null};function pr(r,e){dr.length||(dr.push(ne),ne+=64),this._pointer=dr.pop(),this._nonce=this._pointer+8,this._key=this._nonce+24,this._overflow=0,this._memory=new Uint8Array(at.memory.buffer),this._memory.fill(0,this._pointer,this._pointer+8),this._memory.set(r,this._nonce),this._memory.set(e,this._key)}pr.prototype.realloc=function(r){at.memory.grow(Math.ceil(Math.abs(r-this._memory.length)/65536)),this._memory=new Uint8Array(at.memory.buffer)};pr.prototype.update=function(r,e){var t=this._overflow+r.length,n=ne+this._overflow;Me=ne+t,Me>=this._memory.length&&this.realloc(Me),this._memory.set(r,n),at.xsalsa20_xor(this._pointer,ne,ne,t,this._nonce,this._key),e.set(this._memory.subarray(n,ne+t)),this._overflow=t&63};pr.prototype.finalize=function(){this._memory.fill(0,this._pointer,this._key+32),Me>ne&&(this._memory.fill(0,ne,Me),Me=0),dr.push(this._pointer)};function fn(r,e){this._s=new Uint8Array(32),this._z=new Uint8Array(16),this._overflow=0,si(this._s,r,e,gr);for(var t=0;t<8;t++)this._z[t]=r[t+16]}fn.prototype.update=function(r,e){for(var t=new Uint8Array(64),n=0,s=this._overflow,i=r.length+this._overflow,o=this._z,l=-this._overflow,c=-this._overflow;i>=64;){for(ni(t,o,this._s,gr);s<64;s++)e[c+s]=r[l+s]^t[s];for(n=1,s=8;s<16;s++)n+=o[s]&255|0,o[s]=n&255,n>>>=8;i-=64,c+=64,l+=64,s=0}if(i>0)for(ni(t,o,this._s,gr);s<i;s++)e[c+s]=r[l+s]^t[s];this._overflow=i&63};fn.prototype.finalize=function(){this._s.fill(0),this._z.fill(0)};function ni(r,e,t,n){for(var s=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,i=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,o=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,l=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,c=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,f=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,h=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,u=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,g=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,I=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,p=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,E=t[16]&255|(t[17]&255)<<8|(t[18]&255)<<16|(t[19]&255)<<24,y=t[20]&255|(t[21]&255)<<8|(t[22]&255)<<16|(t[23]&255)<<24,k=t[24]&255|(t[25]&255)<<8|(t[26]&255)<<16|(t[27]&255)<<24,D=t[28]&255|(t[29]&255)<<8|(t[30]&255)<<16|(t[31]&255)<<24,_=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,m=s,b=i,v=o,w=l,x=c,B=f,S=h,N=u,C=g,R=I,U=p,V=E,M=y,K=k,P=D,T=_,a,Ke=0;Ke<20;Ke+=2)a=m+M|0,x^=a<<7|a>>>25,a=x+m|0,C^=a<<9|a>>>23,a=C+x|0,M^=a<<13|a>>>19,a=M+C|0,m^=a<<18|a>>>14,a=B+b|0,R^=a<<7|a>>>25,a=R+B|0,K^=a<<9|a>>>23,a=K+R|0,b^=a<<13|a>>>19,a=b+K|0,B^=a<<18|a>>>14,a=U+S|0,P^=a<<7|a>>>25,a=P+U|0,v^=a<<9|a>>>23,a=v+P|0,S^=a<<13|a>>>19,a=S+v|0,U^=a<<18|a>>>14,a=T+V|0,w^=a<<7|a>>>25,a=w+T|0,N^=a<<9|a>>>23,a=N+w|0,V^=a<<13|a>>>19,a=V+N|0,T^=a<<18|a>>>14,a=m+w|0,b^=a<<7|a>>>25,a=b+m|0,v^=a<<9|a>>>23,a=v+b|0,w^=a<<13|a>>>19,a=w+v|0,m^=a<<18|a>>>14,a=B+x|0,S^=a<<7|a>>>25,a=S+B|0,N^=a<<9|a>>>23,a=N+S|0,x^=a<<13|a>>>19,a=x+N|0,B^=a<<18|a>>>14,a=U+R|0,V^=a<<7|a>>>25,a=V+U|0,C^=a<<9|a>>>23,a=C+V|0,R^=a<<13|a>>>19,a=R+C|0,U^=a<<18|a>>>14,a=T+P|0,M^=a<<7|a>>>25,a=M+T|0,K^=a<<9|a>>>23,a=K+M|0,P^=a<<13|a>>>19,a=P+K|0,T^=a<<18|a>>>14;m=m+s|0,b=b+i|0,v=v+o|0,w=w+l|0,x=x+c|0,B=B+f|0,S=S+h|0,N=N+u|0,C=C+g|0,R=R+I|0,U=U+p|0,V=V+E|0,M=M+y|0,K=K+k|0,P=P+D|0,T=T+_|0,r[0]=m>>>0&255,r[1]=m>>>8&255,r[2]=m>>>16&255,r[3]=m>>>24&255,r[4]=b>>>0&255,r[5]=b>>>8&255,r[6]=b>>>16&255,r[7]=b>>>24&255,r[8]=v>>>0&255,r[9]=v>>>8&255,r[10]=v>>>16&255,r[11]=v>>>24&255,r[12]=w>>>0&255,r[13]=w>>>8&255,r[14]=w>>>16&255,r[15]=w>>>24&255,r[16]=x>>>0&255,r[17]=x>>>8&255,r[18]=x>>>16&255,r[19]=x>>>24&255,r[20]=B>>>0&255,r[21]=B>>>8&255,r[22]=B>>>16&255,r[23]=B>>>24&255,r[24]=S>>>0&255,r[25]=S>>>8&255,r[26]=S>>>16&255,r[27]=S>>>24&255,r[28]=N>>>0&255,r[29]=N>>>8&255,r[30]=N>>>16&255,r[31]=N>>>24&255,r[32]=C>>>0&255,r[33]=C>>>8&255,r[34]=C>>>16&255,r[35]=C>>>24&255,r[36]=R>>>0&255,r[37]=R>>>8&255,r[38]=R>>>16&255,r[39]=R>>>24&255,r[40]=U>>>0&255,r[41]=U>>>8&255,r[42]=U>>>16&255,r[43]=U>>>24&255,r[44]=V>>>0&255,r[45]=V>>>8&255,r[46]=V>>>16&255,r[47]=V>>>24&255,r[48]=M>>>0&255,r[49]=M>>>8&255,r[50]=M>>>16&255,r[51]=M>>>24&255,r[52]=K>>>0&255,r[53]=K>>>8&255,r[54]=K>>>16&255,r[55]=K>>>24&255,r[56]=P>>>0&255,r[57]=P>>>8&255,r[58]=P>>>16&255,r[59]=P>>>24&255,r[60]=T>>>0&255,r[61]=T>>>8&255,r[62]=T>>>16&255,r[63]=T>>>24&255}function si(r,e,t,n){for(var s=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,i=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,o=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,l=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,c=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,f=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,h=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,u=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,g=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,I=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,p=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,E=t[16]&255|(t[17]&255)<<8|(t[18]&255)<<16|(t[19]&255)<<24,y=t[20]&255|(t[21]&255)<<8|(t[22]&255)<<16|(t[23]&255)<<24,k=t[24]&255|(t[25]&255)<<8|(t[26]&255)<<16|(t[27]&255)<<24,D=t[28]&255|(t[29]&255)<<8|(t[30]&255)<<16|(t[31]&255)<<24,_=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,m=s,b=i,v=o,w=l,x=c,B=f,S=h,N=u,C=g,R=I,U=p,V=E,M=y,K=k,P=D,T=_,a,Ke=0;Ke<20;Ke+=2)a=m+M|0,x^=a<<7|a>>>25,a=x+m|0,C^=a<<9|a>>>23,a=C+x|0,M^=a<<13|a>>>19,a=M+C|0,m^=a<<18|a>>>14,a=B+b|0,R^=a<<7|a>>>25,a=R+B|0,K^=a<<9|a>>>23,a=K+R|0,b^=a<<13|a>>>19,a=b+K|0,B^=a<<18|a>>>14,a=U+S|0,P^=a<<7|a>>>25,a=P+U|0,v^=a<<9|a>>>23,a=v+P|0,S^=a<<13|a>>>19,a=S+v|0,U^=a<<18|a>>>14,a=T+V|0,w^=a<<7|a>>>25,a=w+T|0,N^=a<<9|a>>>23,a=N+w|0,V^=a<<13|a>>>19,a=V+N|0,T^=a<<18|a>>>14,a=m+w|0,b^=a<<7|a>>>25,a=b+m|0,v^=a<<9|a>>>23,a=v+b|0,w^=a<<13|a>>>19,a=w+v|0,m^=a<<18|a>>>14,a=B+x|0,S^=a<<7|a>>>25,a=S+B|0,N^=a<<9|a>>>23,a=N+S|0,x^=a<<13|a>>>19,a=x+N|0,B^=a<<18|a>>>14,a=U+R|0,V^=a<<7|a>>>25,a=V+U|0,C^=a<<9|a>>>23,a=C+V|0,R^=a<<13|a>>>19,a=R+C|0,U^=a<<18|a>>>14,a=T+P|0,M^=a<<7|a>>>25,a=M+T|0,K^=a<<9|a>>>23,a=K+M|0,P^=a<<13|a>>>19,a=P+K|0,T^=a<<18|a>>>14;r[0]=m>>>0&255,r[1]=m>>>8&255,r[2]=m>>>16&255,r[3]=m>>>24&255,r[4]=B>>>0&255,r[5]=B>>>8&255,r[6]=B>>>16&255,r[7]=B>>>24&255,r[8]=U>>>0&255,r[9]=U>>>8&255,r[10]=U>>>16&255,r[11]=U>>>24&255,r[12]=T>>>0&255,r[13]=T>>>8&255,r[14]=T>>>16&255,r[15]=T>>>24&255,r[16]=S>>>0&255,r[17]=S>>>8&255,r[18]=S>>>16&255,r[19]=S>>>24&255,r[20]=N>>>0&255,r[21]=N>>>8&255,r[22]=N>>>16&255,r[23]=N>>>24&255,r[24]=C>>>0&255,r[25]=C>>>8&255,r[26]=C>>>16&255,r[27]=C>>>24&255,r[28]=R>>>0&255,r[29]=R>>>8&255,r[30]=R>>>16&255,r[31]=R>>>24&255}});var Aa={};q(Aa,{generateKey:()=>ui,preSharedKey:()=>ma});var ka=Symbol.for("@libp2p/connection");var Sa=Symbol.for("@libp2p/content-routing");var Ra=Symbol.for("@libp2p/peer-discovery");var Ta=Symbol.for("@libp2p/peer-id");var La=Symbol.for("@libp2p/peer-routing");var wn;(function(r){r.Accept="accept",r.Ignore="ignore",r.Reject="reject"})(wn||(wn={}));var Ka=Symbol.for("@libp2p/transport");var xn;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(xn||(xn={}));var H=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var mr=class extends Event{detail;constructor(e,t){super(e,t),this.detail=t?.detail}},Fa=globalThis.CustomEvent??mr;var vr={};q(vr,{base58btc:()=>W,base58flickr:()=>ki});var ml=new Uint8Array(0);function vn(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function ie(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function Bn(r){return new TextEncoder().encode(r)}function En(r){return new TextDecoder().decode(r)}function wi(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=s}var l=r.length,c=r.charAt(0),f=Math.log(l)/Math.log(256),h=Math.log(256)/Math.log(l);function u(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var E=0,y=0,k=0,D=p.length;k!==D&&p[k]===0;)k++,E++;for(var _=(D-k)*h+1>>>0,m=new Uint8Array(_);k!==D;){for(var b=p[k],v=0,w=_-1;(b!==0||v<y)&&w!==-1;w--,v++)b+=256*m[w]>>>0,m[w]=b%l>>>0,b=b/l>>>0;if(b!==0)throw new Error("Non-zero carry");y=v,k++}for(var x=_-y;x!==_&&m[x]===0;)x++;for(var B=c.repeat(E);x<_;++x)B+=r.charAt(m[x]);return B}function g(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var E=0;if(p[E]!==" "){for(var y=0,k=0;p[E]===c;)y++,E++;for(var D=(p.length-E)*f+1>>>0,_=new Uint8Array(D);p[E];){var m=t[p.charCodeAt(E)];if(m===255)return;for(var b=0,v=D-1;(m!==0||b<k)&&v!==-1;v--,b++)m+=l*_[v]>>>0,_[v]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");k=b,E++}if(p[E]!==" "){for(var w=D-k;w!==D&&_[w]===0;)w++;for(var x=new Uint8Array(y+(D-w)),B=y;w!==D;)x[B++]=_[w++];return x}}}function I(p){var E=g(p);if(E)return E;throw new Error(`Non-${e} character`)}return{encode:u,decodeUnsafe:g,decode:I}}var xi=wi,vi=xi,In=vi;var Ar=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},br=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Sn(this,e)}},wr=class{decoders;constructor(e){this.decoders=e}or(e){return Sn(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Sn(r,e){return new wr({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var xr=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,s){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=s,this.encoder=new Ar(e,t,n),this.decoder=new br(e,t,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Ee({name:r,prefix:e,encode:t,decode:n}){return new xr(r,e,t,n)}function de({name:r,prefix:e,alphabet:t}){let{encode:n,decode:s}=In(t,r);return Ee({prefix:e,name:r,encode:n,decode:i=>ie(s(i))})}function Bi(r,e,t,n){let s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),l=0,c=0,f=0;for(let h=0;h<i;++h){let u=s[r[h]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|u,l+=t,l>=8&&(l-=8,o[f++]=255&c>>l)}if(l>=t||255&c<<8-l)throw new SyntaxError("Unexpected end of data");return o}function Ei(r,e,t){let n=e[e.length-1]==="=",s=(1<<t)-1,i="",o=0,l=0;for(let c=0;c<r.length;++c)for(l=l<<8|r[c],o+=8;o>t;)o-=t,i+=e[s&l>>o];if(o!==0&&(i+=e[s&l<<t-o]),n)for(;i.length*t&7;)i+="=";return i}function L({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Ee({prefix:e,name:r,encode(s){return Ei(s,n,t)},decode(s){return Bi(s,n,t,r)}})}var W=de({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ki=de({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Er={};q(Er,{identity:()=>Dn});var Ii=Rn,Nn=128,Si=127,Ni=~Si,Ci=Math.pow(2,31);function Rn(r,e,t){e=e||[],t=t||0;for(var n=t;r>=Ci;)e[t++]=r&255|Nn,r/=128;for(;r&Ni;)e[t++]=r&255|Nn,r>>>=7;return e[t]=r|0,Rn.bytes=t-n+1,e}var Ri=Br,Ui=128,Cn=127;function Br(r,n){var t=0,n=n||0,s=0,i=n,o,l=r.length;do{if(i>=l)throw Br.bytes=0,new RangeError("Could not decode varint");o=r[i++],t+=s<28?(o&Cn)<<s:(o&Cn)*Math.pow(2,s),s+=7}while(o>=Ui);return Br.bytes=i-n,t}var Ti=Math.pow(2,7),_i=Math.pow(2,14),Li=Math.pow(2,21),Di=Math.pow(2,28),Vi=Math.pow(2,35),Mi=Math.pow(2,42),Ki=Math.pow(2,49),Pi=Math.pow(2,56),Hi=Math.pow(2,63),Fi=function(r){return r<Ti?1:r<_i?2:r<Li?3:r<Di?4:r<Vi?5:r<Mi?6:r<Ki?7:r<Pi?8:r<Hi?9:10},Oi={encode:Ii,decode:Ri,encodingLength:Fi},Qi=Oi,Pe=Qi;function He(r,e=0){return[Pe.decode(r,e),Pe.decode.bytes]}function ke(r,e,t=0){return Pe.encode(r,e,t),e}function Ie(r){return Pe.encodingLength(r)}function be(r,e){let t=e.byteLength,n=Ie(r),s=n+Ie(t),i=new Uint8Array(s+t);return ke(r,i,0),ke(t,i,n),i.set(e,s),new Se(r,t,e,i)}function Un(r){let e=ie(r),[t,n]=He(e),[s,i]=He(e.subarray(n)),o=e.subarray(n+i);if(o.byteLength!==s)throw new Error("Incorrect length");return new Se(t,s,o,e)}function Tn(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&vn(r.bytes,t.bytes)}}var Se=class{code;size;digest;bytes;constructor(e,t,n,s){this.code=e,this.size=t,this.digest=n,this.bytes=s}};var _n=0,ji="identity",Ln=ie;function Gi(r){return be(_n,Ln(r))}var Dn={code:_n,name:ji,encode:Ln,digest:Gi};var Sr={};q(Sr,{sha256:()=>Oe,sha512:()=>$i});function Ir({name:r,code:e,encode:t}){return new kr(r,e,t)}var kr=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?be(this.code,t):t.then(n=>be(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Mn(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var Oe=Ir({name:"sha2-256",code:18,encode:Mn("SHA-256")}),$i=Ir({name:"sha2-512",code:19,encode:Mn("SHA-512")});function Ne(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function ge(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function oe(r=0){return globalThis.Buffer?.alloc!=null?ge(globalThis.Buffer.alloc(r)):new Uint8Array(r)}function z(r=0){return globalThis.Buffer?.allocUnsafe!=null?ge(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function we(r,e){if(globalThis.Buffer!=null)return ge(globalThis.Buffer.concat(r,e));e==null&&(e=r.reduce((s,i)=>s+i.length,0));let t=z(e),n=0;for(let s of r)t.set(s,n),n+=s.length;return ge(t)}var Nr={};q(Nr,{base10:()=>qi});var qi=de({prefix:"9",name:"base10",alphabet:"0123456789"});var Cr={};q(Cr,{base16:()=>zi,base16upper:()=>Ji});var zi=L({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ji=L({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Rr={};q(Rr,{base2:()=>Yi});var Yi=L({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ur={};q(Ur,{base256emoji:()=>to});var Kn=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Wi=Kn.reduce((r,e,t)=>(r[t]=e,r),[]),Xi=Kn.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Zi(r){return r.reduce((e,t)=>(e+=Wi[t],e),"")}function eo(r){let e=[];for(let t of r){let n=Xi[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var to=Ee({prefix:"\u{1F680}",name:"base256emoji",encode:Zi,decode:eo});var Tr={};q(Tr,{base32:()=>Ce,base32hex:()=>io,base32hexpad:()=>ao,base32hexpadupper:()=>lo,base32hexupper:()=>oo,base32pad:()=>no,base32padupper:()=>so,base32upper:()=>ro,base32z:()=>co});var Ce=L({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ro=L({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),no=L({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),so=L({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),io=L({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),oo=L({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ao=L({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),lo=L({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),co=L({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var _r={};q(_r,{base36:()=>uo,base36upper:()=>fo});var uo=de({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fo=de({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Lr={};q(Lr,{base64:()=>ft,base64pad:()=>ho,base64url:()=>go,base64urlpad:()=>po});var ft=L({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ho=L({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),go=L({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),po=L({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Dr={};q(Dr,{base8:()=>yo});var yo=L({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Vr={};q(Vr,{identity:()=>mo});var mo=Ee({prefix:"\0",name:"identity",encode:r=>En(r),decode:r=>Bn(r)});var Gl=new TextEncoder,$l=new TextDecoder;function Pn(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return xo(t,Mr(r),e??W.encoder);default:return vo(t,Mr(r),e??Ce.encoder)}}var Hn=new WeakMap;function Mr(r){let e=Hn.get(r);if(e==null){let t=new Map;return Hn.set(r,t),t}return e}var ht=class r{code;version;multihash;bytes;"/";constructor(e,t,n,s){this.code=t,this.version=e,this.multihash=n,this.bytes=s,this["/"]=s}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==Qe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Bo)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=be(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&Tn(e.multihash,n.multihash)}toString(e){return Pn(this,e)}toJSON(){return{"/":Pn(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:s,multihash:i,bytes:o}=t;return new r(n,s,i,o??Fn(n,s,i.bytes))}else if(t[Eo]===!0){let{version:n,multihash:s,code:i}=t,o=Un(s);return r.create(n,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==Qe)throw new Error(`Version 0 CID must use dag-pb (code: ${Qe}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let s=Fn(e,t,n.bytes);return new r(e,t,n,s)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,Qe,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,s=ie(e.subarray(n,n+t.multihashSize));if(s.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=s.subarray(t.multihashSize-t.digestSize),o=new Se(t.multihashCode,t.digestSize,i,s);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[u,g]=He(e.subarray(t));return t+=g,u},s=n(),i=Qe;if(s===18?(s=0,t=0):i=n(),s!==0&&s!==1)throw new RangeError(`Invalid CID version ${s}`);let o=t,l=n(),c=n(),f=t+c,h=f-o;return{version:s,codec:i,multihashCode:l,digestSize:c,multihashSize:h,size:f}}static parse(e,t){let[n,s]=wo(e,t),i=r.decode(s);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Mr(i).set(n,e),i}};function wo(r,e){switch(r[0]){case"Q":{let t=e??W;return[W.prefix,t.decode(`${W.prefix}${r}`)]}case W.prefix:{let t=e??W;return[W.prefix,t.decode(r)]}case Ce.prefix:{let t=e??Ce;return[Ce.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function xo(r,e,t){let{prefix:n}=t;if(n!==W.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let s=e.get(n);if(s==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return s}function vo(r,e,t){let{prefix:n}=t,s=e.get(n);if(s==null){let i=t.encode(r);return e.set(n,i),i}else return s}var Qe=112,Bo=18;function Fn(r,e,t){let n=Ie(r),s=n+Ie(e),i=new Uint8Array(s+t.byteLength);return ke(r,i,0),ke(e,i,n),i.set(t,s),i}var Eo=Symbol.for("@ipld/js-cid/CID");var Kr={...Vr,...Rr,...Dr,...Nr,...Cr,...Tr,..._r,...vr,...Lr,...Ur},lc={...Sr,...Er};function Qn(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var On=Qn("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Pr=Qn("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=z(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),ko={utf8:On,"utf-8":On,hex:Kr.base16,latin1:Pr,ascii:Pr,binary:Pr,...Kr},dt=ko;function X(r,e="utf8"){let t=dt[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?ge(globalThis.Buffer.from(r,"utf-8")):t.decoder.decode(`${t.prefix}${r}`)}var gt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Io=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Io)throw new Error("Non little-endian hardware is not supported");var xc={}.toString;function jn(r=32){if(gt&&typeof gt.getRandomValues=="function")return gt.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var Hr=new Float32Array([-0]),pe=new Uint8Array(Hr.buffer);function $n(r,e,t){Hr[0]=r,e[t]=pe[0],e[t+1]=pe[1],e[t+2]=pe[2],e[t+3]=pe[3]}function qn(r,e){return pe[0]=r[e],pe[1]=r[e+1],pe[2]=r[e+2],pe[3]=r[e+3],Hr[0]}var Fr=new Float64Array([-0]),F=new Uint8Array(Fr.buffer);function zn(r,e,t){Fr[0]=r,e[t]=F[0],e[t+1]=F[1],e[t+2]=F[2],e[t+3]=F[3],e[t+4]=F[4],e[t+5]=F[5],e[t+6]=F[6],e[t+7]=F[7]}function Jn(r,e){return F[0]=r[e],F[1]=r[e+1],F[2]=r[e+2],F[3]=r[e+3],F[4]=r[e+4],F[5]=r[e+5],F[6]=r[e+6],F[7]=r[e+7],Fr[0]}var Co=BigInt(Number.MAX_SAFE_INTEGER),Ro=BigInt(Number.MIN_SAFE_INTEGER),G=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return xe;if(e<Co&&e>Ro)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,s=e-(n<<32n);return t&&(n=~n|0n,s=~s|0n,++s>Yn&&(s=0n,++n>Yn&&(n=0n))),new r(Number(s),Number(n))}static fromNumber(e){if(e===0)return xe;let t=e<0;t&&(e=-e);let n=e>>>0,s=(e-n)/4294967296>>>0;return t&&(s=~s>>>0,n=~n>>>0,++n>4294967295&&(n=0,++s>4294967295&&(s=0))),new r(n,s)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):xe}},xe=new G(0,0);xe.toBigInt=function(){return 0n};xe.zzEncode=xe.zzDecode=function(){return this};xe.length=function(){return 1};var Yn=4294967296n;function Wn(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Xn(r,e,t){if(t-e<1)return"";let s,i=[],o=0,l;for(;e<t;)l=r[e++],l<128?i[o++]=l:l>191&&l<224?i[o++]=(l&31)<<6|r[e++]&63:l>239&&l<365?(l=((l&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[o++]=55296+(l>>10),i[o++]=56320+(l&1023)):i[o++]=(l&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((s??(s=[])).push(String.fromCharCode.apply(String,i)),o=0);return s!=null?(o>0&&s.push(String.fromCharCode.apply(String,i.slice(0,o))),s.join("")):String.fromCharCode.apply(String,i.slice(0,o))}function Or(r,e,t){let n=t,s,i;for(let o=0;o<r.length;++o)s=r.charCodeAt(o),s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&((i=r.charCodeAt(o+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++o,e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128);return t-n}function Z(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function pt(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var Qr=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Z(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Z(this,4);return pt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Z(this,4);return pt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Z(this,4);let e=qn(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Z(this,4);let e=Jn(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw Z(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Xn(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Z(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Z(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new G(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw Z(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw Z(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Z(this,8);let e=pt(this.buf,this.pos+=4),t=pt(this.buf,this.pos+=4);return new G(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function jr(r){return new Qr(r instanceof Uint8Array?r:r.subarray())}function yt(r,e){let t=jr(r);return e.decode(t)}function Gr(r){let e=r??8192,t=e>>>1,n,s=e;return function(o){if(o<1||o>t)return z(o);s+o>e&&(n=z(e),s=0);let l=n.subarray(s,s+=o);return s&7&&(s=(s|7)+1),l}}var ve=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function $r(){}var zr=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Uo=Gr();function To(r){return globalThis.Buffer!=null?z(r):Uo(r)}var $e=class{len;head;tail;states;constructor(){this.len=0,this.head=new ve($r,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new ve(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Jr((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(je,10,G.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=G.fromBigInt(e);return this._push(je,t.length(),t)}uint64Number(e){let t=G.fromNumber(e);return this._push(je,t.length(),t)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=G.fromBigInt(e).zzEncode();return this._push(je,t.length(),t)}sint64Number(e){let t=G.fromNumber(e).zzEncode();return this._push(je,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(qr,1,e?1:0)}fixed32(e){return this._push(Ge,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=G.fromBigInt(e);return this._push(Ge,4,t.lo)._push(Ge,4,t.hi)}fixed64Number(e){let t=G.fromNumber(e);return this._push(Ge,4,t.lo)._push(Ge,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push($n,4,e)}double(e){return this._push(zn,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(qr,1,0):this.uint32(t)._push(Lo,t,e)}string(e){let t=Wn(e);return t!==0?this.uint32(t)._push(Or,t,e):this._push(qr,1,0)}fork(){return this.states=new zr(this),this.head=this.tail=new ve($r,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ve($r,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=To(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function qr(r,e,t){e[t]=r&255}function _o(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var Jr=class extends ve{next;constructor(e,t){super(_o,e,t),this.next=void 0}};function je(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function Ge(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function Lo(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&($e.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(Do,e,r),this},$e.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(Vo,e,r),this});function Do(r,e,t){e.set(r,t)}function Vo(r,e,t){r.length<40?Or(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(X(r),t)}function Yr(){return new $e}function mt(r,e){let t=Yr();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Re;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Re||(Re={}));function At(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function Wr(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,o){let l=e(i);o.int32(l)},n=function(i){let o=i.int32();return e(o)};return At("enum",Re.VARINT,t,n)}function bt(r,e){return At("message",Re.LENGTH_DELIMITED,r,e)}var J;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.Secp256k1="Secp256k1"})(J||(J={}));var Xr;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.Secp256k1=2]="Secp256k1"})(Xr||(Xr={}));(function(r){r.codec=()=>Wr(Xr)})(J||(J={}));var Ue;(function(r){let e;r.codec=()=>(e==null&&(e=bt((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),J.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n)=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let o=t.uint32();switch(o>>>3){case 1:s.Type=J.codec().decode(t);break;case 2:s.Data=t.bytes();break;default:t.skipType(o&7);break}}return s})),e),r.encode=t=>mt(t,r.codec()),r.decode=t=>yt(t,r.codec())})(Ue||(Ue={}));var Te;(function(r){let e;r.codec=()=>(e==null&&(e=bt((t,n,s={})=>{s.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),J.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),s.lengthDelimited!==!1&&n.ldelim()},(t,n)=>{let s={},i=n==null?t.len:t.pos+n;for(;t.pos<i;){let o=t.uint32();switch(o>>>3){case 1:s.Type=J.codec().decode(t);break;case 2:s.Data=t.bytes();break;default:t.skipType(o&7);break}}return s})),e),r.encode=t=>mt(t,r.codec()),r.decode=t=>yt(t,r.codec())})(Te||(Te={}));function ye(r,e="utf8"){let t=dt[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):t.encoder.encode(r).substring(1)}var Ko={"P-256":256,"P-384":384,"P-521":521},Po=Object.keys(Ko),Iu=Po.join(" / ");function ae(r){if(isNaN(r)||r<=0)throw new H("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return jn(r)}var A=An(ts());function Be(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function me(r,e,t=-1){let n=t,s=r,i=0,o=Math.pow(2,e);for(let l=1;l<8;l++){if(r<o){let c;if(n<0)c=new ArrayBuffer(l),i=l;else{if(n<l)return new ArrayBuffer(0);c=new ArrayBuffer(n),i=n}let f=new Uint8Array(c);for(let h=l-1;h>=0;h--){let u=Math.pow(2,h*e);f[i-h-1]=Math.floor(s/u),s-=f[i-h-1]*u}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function Bt(...r){let e=0,t=0;for(let i of r)e+=i.length;let n=new ArrayBuffer(e),s=new Uint8Array(n);for(let i of r)s.set(i,t),t+=i.length;return s}function tn(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let l=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(l||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let l=0;l<this.valueHex.byteLength;l++)t[l]=0;t[0]=r[0]&128;let n=Be(t,8),s=new ArrayBuffer(this.valueHex.byteLength),i=new Uint8Array(s);for(let l=0;l<this.valueHex.byteLength;l++)i[l]=r[l];return i[0]&=127,Be(i,8)-n}function rs(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,l=me(o,8,n),c=new Uint8Array(l);return c[0]|=128,l}let s=me(e,8,n),i=new Uint8Array(s);if(i[0]&128){let o=s.slice(0),l=new Uint8Array(o);s=new ArrayBuffer(s.byteLength+1),i=new Uint8Array(s);for(let c=0;c<o.byteLength;c++)i[c+1]=l[c];i[0]=0}return s}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function ns(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let s=0;s<t.length;s++)if(t[s]!==n[s])return!1;return!0}function $(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,s=new Array(n);for(let o=0;o<n;o++)s[o]="0";return s.join("").concat(t)}var Ou=Math.log(2);function Et(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function rn(r){let e=0,t=0;for(let s=0;s<r.length;s++){let i=r[s];e+=i.byteLength}let n=new Uint8Array(e);for(let s=0;s<r.length;s++){let i=r[s];n.set(new Uint8Array(i),t),t+=i.byteLength}return n.buffer}function fe(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var ze=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return rn(this.items)}},qe=[new Uint8Array([1])],ss="0123456789";var De="",ee=new ArrayBuffer(0),nn=new Uint8Array(0),Je="EndOfContent",os="OCTET STRING",as="BIT STRING";function he(r){var e;return e=class extends r{constructor(...n){var s;super(...n);let i=n[0]||{};this.isHexOnly=(s=i.isHexOnly)!==null&&s!==void 0?s:!1,this.valueHexView=i.valueHex?A.BufferSourceConverter.toUint8Array(i.valueHex):nn}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,s,i){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!fe(this,o,s,i))return-1;let l=s+i;return this.valueHexView=o.subarray(s,l),this.valueHexView.length?(this.blockLength=i,l):(this.warnings.push("Zero buffer length"),s)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",ee)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:A.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var ce=class{constructor({blockLength:e=0,error:t=De,warnings:n=[],valueBeforeDecode:s=nn}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=A.BufferSourceConverter.toUint8Array(s)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:A.Convert.ToHex(this.valueBeforeDecodeView)}}};ce.NAME="baseBlock";var Q=class extends ce{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Q.NAME="valueBlock";var kt=class extends he(ce){constructor({idBlock:e={}}={}){var t,n,s,i;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?A.BufferSourceConverter.toUint8Array(e.valueHex):nn,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(s=e.tagNumber)!==null&&s!==void 0?s:-1,this.isConstructed=(i=e.isConstructed)!==null&&i!==void 0?i:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",ee}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let s=new Uint8Array(1);if(!e){let i=this.tagNumber;i&=31,t|=i,s[0]=t}return s.buffer}if(!this.isHexOnly){let s=me(this.tagNumber,7),i=new Uint8Array(s),o=s.byteLength,l=new Uint8Array(o+1);if(l[0]=t|31,!e){for(let c=0;c<o-1;c++)l[c+1]=i[c]|128;l[o]=i[o-1]}return l.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let s=this.valueHexView;for(let i=0;i<s.length-1;i++)n[i+1]=s[i]|128;n[this.valueHexView.byteLength]=s[s.length-1]}return n.buffer}fromBER(e,t,n){let s=A.BufferSourceConverter.toUint8Array(e);if(!fe(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;switch(i[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(i[0]&32)===32,this.isHexOnly=!1;let l=i[0]&31;if(l!==31)this.tagNumber=l,this.blockLength=1;else{let c=1,f=this.valueHexView=new Uint8Array(255),h=255;for(;i[c]&128;){if(f[c-1]=i[c]&127,c++,c>=i.length)return this.error="End of input reached before message was fully decoded",-1;if(c===h){h+=255;let g=new Uint8Array(h);for(let I=0;I<f.length;I++)g[I]=f[I];f=this.valueHexView=new Uint8Array(h)}}this.blockLength=c+1,f[c-1]=i[c]&127;let u=new Uint8Array(c);for(let g=0;g<c;g++)u[g]=f[g];f=this.valueHexView=new Uint8Array(c),f.set(u),this.blockLength<=9?this.tagNumber=Be(f,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};kt.NAME="identificationBlock";var It=class extends ce{constructor({lenBlock:e={}}={}){var t,n,s;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(s=e.length)!==null&&s!==void 0?s:0}fromBER(e,t,n){let s=A.BufferSourceConverter.toUint8Array(e);if(!fe(this,s,t,n))return-1;let i=s.subarray(t,t+n);if(i.length===0)return this.error="Zero buffer length",-1;if(i[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=i[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(i[0]&128),this.longFormUsed===!1)return this.length=i[0],this.blockLength=1,t+this.blockLength;let o=i[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>i.length)return this.error="End of input reached before message was fully decoded",-1;let l=t+1,c=s.subarray(l,l+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Be(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let s=me(this.length,8);if(s.byteLength>127)return this.error="Too big length",ee;if(t=new ArrayBuffer(s.byteLength+1),e)return t;let i=new Uint8Array(s);n=new Uint8Array(t),n[0]=s.byteLength|128;for(let o=0;o<s.byteLength;o++)n[o+1]=i[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};It.NAME="lengthBlock";var d={},O=class extends ce{constructor({name:e=De,optional:t=!1,primitiveSchema:n,...s}={},i){super(s),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new kt(s),this.lenBlock=new It(s),this.valueBlock=i?new i(s):new Q(s)}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}toBER(e,t){let n=t||new ze;t||ls(this);let s=this.idBlock.toBER(e);if(n.write(s),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let i=this.valueBlock.toBER(e);this.lenBlock.length=i.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(i)}return t?ee:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():A.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${A.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return ns(t,n)}};O.NAME="BaseBlock";function ls(r){if(r instanceof d.Constructed)for(let e of r.valueBlock.value)ls(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var St=class extends O{constructor({value:e=De,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};St.NAME="BaseStringBlock";var Nt=class extends he(Q){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};Nt.NAME="PrimitiveValueBlock";var cs,Ct=class extends O{constructor(e={}){super(e,Nt),this.idBlock.isConstructed=!1}};cs=Ct;d.Primitive=cs;Ct.NAME="PRIMITIVE";function zo(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function sn(r,e=0,t=r.length){let n=e,s=new O({},Q),i=new ce;if(!fe(i,r,e,t))return s.error=i.error,{offset:-1,result:s};if(!r.subarray(e,e+t).length)return s.error="Zero buffer length",{offset:-1,result:s};let l=s.idBlock.fromBER(r,e,t);if(s.idBlock.warnings.length&&s.warnings.concat(s.idBlock.warnings),l===-1)return s.error=s.idBlock.error,{offset:-1,result:s};if(e=l,t-=s.idBlock.blockLength,l=s.lenBlock.fromBER(r,e,t),s.lenBlock.warnings.length&&s.warnings.concat(s.lenBlock.warnings),l===-1)return s.error=s.lenBlock.error,{offset:-1,result:s};if(e=l,t-=s.lenBlock.blockLength,!s.idBlock.isConstructed&&s.lenBlock.isIndefiniteForm)return s.error="Indefinite length form used for primitive encoding form",{offset:-1,result:s};let c=O;switch(s.idBlock.tagClass){case 1:if(s.idBlock.tagNumber>=37&&s.idBlock.isHexOnly===!1)return s.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:s};switch(s.idBlock.tagNumber){case 0:if(s.idBlock.isConstructed&&s.lenBlock.length>0)return s.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:s};c=d.EndOfContent;break;case 1:c=d.Boolean;break;case 2:c=d.Integer;break;case 3:c=d.BitString;break;case 4:c=d.OctetString;break;case 5:c=d.Null;break;case 6:c=d.ObjectIdentifier;break;case 10:c=d.Enumerated;break;case 12:c=d.Utf8String;break;case 13:c=d.RelativeObjectIdentifier;break;case 14:c=d.TIME;break;case 15:return s.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:s};case 16:c=d.Sequence;break;case 17:c=d.Set;break;case 18:c=d.NumericString;break;case 19:c=d.PrintableString;break;case 20:c=d.TeletexString;break;case 21:c=d.VideotexString;break;case 22:c=d.IA5String;break;case 23:c=d.UTCTime;break;case 24:c=d.GeneralizedTime;break;case 25:c=d.GraphicString;break;case 26:c=d.VisibleString;break;case 27:c=d.GeneralString;break;case 28:c=d.UniversalString;break;case 29:c=d.CharacterString;break;case 30:c=d.BmpString;break;case 31:c=d.DATE;break;case 32:c=d.TimeOfDay;break;case 33:c=d.DateTime;break;case 34:c=d.Duration;break;default:{let f=s.idBlock.isConstructed?new d.Constructed:new d.Primitive;f.idBlock=s.idBlock,f.lenBlock=s.lenBlock,f.warnings=s.warnings,s=f}}break;case 2:case 3:case 4:default:c=s.idBlock.isConstructed?d.Constructed:d.Primitive}return s=zo(s,c),l=s.fromBER(r,e,s.lenBlock.isIndefiniteForm?t:s.lenBlock.length),s.valueBeforeDecodeView=r.subarray(n,n+s.blockLength),{offset:l,result:s}}function Jo(r,e){return r?1:e}var re=class extends Q{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let s=A.BufferSourceConverter.toUint8Array(e);if(!fe(this,s,t,n))return-1;if(this.valueBeforeDecodeView=s.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let i=t;for(;Jo(this.isIndefiniteForm,n)>0;){let o=sn(s,i,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(i=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===Je)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Je?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){let n=t||new ze;for(let s=0;s<this.value.length;s++)this.value[s].toBER(e,n);return t?ee:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};re.NAME="ConstructedValueBlock";var us,Ae=class extends O{constructor(e={}){super(e,re),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let s=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return s===-1?(this.error=this.valueBlock.error,s):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),s)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
3
- `).map(s=>` ${s}`).join(`
4
- `));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
5
- ${e.join(`
6
- `)}`:`${t} :`}};us=Ae;d.Constructed=us;Ae.NAME="CONSTRUCTED";var Rt=class extends Q{fromBER(e,t,n){return t}toBER(e){return ee}};Rt.override="EndOfContentValueBlock";var fs,Ut=class extends O{constructor(e={}){super(e,Rt),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};fs=Ut;d.EndOfContent=fs;Ut.NAME=Je;var hs,Ye=class extends O{constructor(e={}){super(e,Q),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){let n=new ArrayBuffer(2);if(!e){let s=new Uint8Array(n);s[0]=5,s[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};hs=Ye;d.Null=hs;Ye.NAME="NULL";var Tt=class extends he(Q){constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=A.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,n){let s=A.BufferSourceConverter.toUint8Array(e);return fe(this,s,t,n)?(this.valueHexView=s.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,tn.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}};Tt.NAME="BooleanValueBlock";var ds,_t=class extends O{constructor(e={}){super(e,Tt),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};ds=_t;d.Boolean=ds;_t.NAME="BOOLEAN";var Lt=class extends he(re){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,n){let s=0;if(this.isConstructed){if(this.isHexOnly=!1,s=re.prototype.fromBER.call(this,e,t,n),s===-1)return s;for(let i=0;i<this.value.length;i++){let o=this.value[i].constructor.NAME;if(o===Je){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(o!==os)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,s=super.fromBER(e,t,n),this.blockLength=n;return s}toBER(e,t){return this.isConstructed?re.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}};Lt.NAME="OctetStringValueBlock";var gs,We=class r extends O{constructor({idBlock:e={},lenBlock:t={},...n}={}){var s,i;(s=n.isConstructed)!==null&&s!==void 0||(n.isConstructed=!!(!((i=n.value)===null||i===void 0)&&i.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},Lt),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){let i=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(i.byteLength){let o=sn(i,0,i.byteLength);o.offset!==-1&&o.offset===n&&(this.valueBlock.value=[o.result])}}catch{}}return super.fromBER(e,t,n)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Ae.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${A.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let t of this.valueBlock.value)t instanceof r&&e.push(t.valueBlock.valueHexView);return A.BufferSourceConverter.concat(e)}};gs=We;d.OctetString=gs;We.NAME=os;var Dt=class extends he(re){constructor({unusedBits:e=0,isConstructed:t=!1,...n}={}){super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let s=-1;if(this.isConstructed){if(s=re.prototype.fromBER.call(this,e,t,n),s===-1)return s;for(let l of this.value){let c=l.constructor.NAME;if(c===Je){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(c!==as)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let f=l.valueBlock;if(this.unusedBits>0&&f.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=f.unusedBits}return s}let i=A.BufferSourceConverter.toUint8Array(e);if(!fe(this,i,t,n))return-1;let o=i.subarray(t,t+n);if(this.unusedBits=o[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let l=o.subarray(1);try{if(l.byteLength){let c=sn(l,0,l.byteLength);c.offset!==-1&&c.offset===n-1&&(this.value=[c.result])}}catch{}}return this.valueHexView=o.subarray(1),this.blockLength=o.length,t+n}toBER(e,t){if(this.isConstructed)return re.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return ee;let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}};Dt.NAME="BitStringValueBlock";var ps,Xe=class extends O{constructor({idBlock:e={},lenBlock:t={},...n}={}){var s,i;(s=n.isConstructed)!==null&&s!==void 0||(n.isConstructed=!!(!((i=n.value)===null||i===void 0)&&i.length)),super({idBlock:{isConstructed:n.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!n.isIndefiniteForm},...n},Dt),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ae.prototype.onAsciiEncoding.call(this);{let e=[],t=this.valueBlock.valueHexView;for(let s of t)e.push(s.toString(2).padStart(8,"0"));let n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}};ps=Xe;d.BitString=ps;Xe.NAME=as;var ys;function Yo(r,e){let t=new Uint8Array([0]),n=new Uint8Array(r),s=new Uint8Array(e),i=n.slice(0),o=i.length-1,l=s.slice(0),c=l.length-1,f=0,h=c<o?o:c,u=0;for(let g=h;g>=0;g--,u++){switch(!0){case u<l.length:f=i[o-u]+l[c-u]+t[0];break;default:f=i[o-u]+t[0]}switch(t[0]=f/10,!0){case u>=i.length:i=Bt(new Uint8Array([f%10]),i);break;default:i[o-u]=f%10}}return t[0]>0&&(i=Bt(t,i)),i}function is(r){if(r>=qe.length)for(let e=qe.length;e<=r;e++){let t=new Uint8Array([0]),n=qe[e-1].slice(0);for(let s=n.length-1;s>=0;s--){let i=new Uint8Array([(n[s]<<1)+t[0]]);t[0]=i[0]/10,n[s]=i[0]%10}t[0]>0&&(n=Bt(t,n)),qe.push(n)}return qe[r]}function Wo(r,e){let t=0,n=new Uint8Array(r),s=new Uint8Array(e),i=n.slice(0),o=i.length-1,l=s.slice(0),c=l.length-1,f,h=0;for(let u=c;u>=0;u--,h++)switch(f=i[o-h]-l[c-h]-t,!0){case f<0:t=1,i[o-h]=f+10;break;default:t=0,i[o-h]=f}if(t>0)for(let u=o-c+1;u>=0;u--,h++)if(f=i[o-h]-t,f<0)t=1,i[o-h]=f+10;else{t=0,i[o-h]=f;break}return i.slice()}var Ze=class extends he(Q){constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=tn.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(rs(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,s=0){let i=this.fromBER(e,t,n);if(i===-1)return i;let o=this.valueHexView;return o[0]===0&&o[1]&128?this.valueHexView=o.subarray(1):s!==0&&o.length<s&&(s-o.length>1&&(s=o.length+1),this.valueHexView=o.subarray(s-o.length)),i}toDER(e=!1){let t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){let s=super.fromBER(e,t,n);return s===-1||this.setValueHex(),s}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){let e=this.valueHexView.length*8-1,t=new Uint8Array(this.valueHexView.length*8/3),n=0,s,i=this.valueHexView,o="",l=!1;for(let c=i.byteLength-1;c>=0;c--){s=i[c];for(let f=0;f<8;f++){if((s&1)===1)switch(n){case e:t=Wo(is(n),t),o="-";break;default:t=Yo(t,is(n))}n++,s>>=1}}for(let c=0;c<t.length;c++)t[c]&&(l=!0),l&&(o+=ss.charAt(t[c]));return l===!1&&(o+=ss.charAt(0)),o}};ys=Ze;Ze.NAME="IntegerValueBlock";Object.defineProperty(ys.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var ms,Le=class r extends O{constructor(e={}){super(e,Ze),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Et(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Et();let t=BigInt(e),n=new ze,s=t.toString(16).replace(/^-/,""),i=new Uint8Array(A.Convert.FromHex(s));if(t<0){let l=new Uint8Array(i.length+(i[0]&128?1:0));l[0]|=128;let f=BigInt(`0x${A.Convert.ToHex(l)}`)+t,h=A.BufferSourceConverter.toUint8Array(A.Convert.FromHex(f.toString(16)));h[0]|=128,n.write(h)}else i[0]&128&&n.write(new Uint8Array([0])),n.write(i);return new r({valueHex:n.final()})}convertToDER(){let e=new r({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new r({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};ms=Le;d.Integer=ms;Le.NAME="INTEGER";var As,Vt=class extends Le{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};As=Vt;d.Enumerated=As;Vt.NAME="ENUMERATED";var et=class extends he(Q){constructor({valueDec:e=-1,isFirstSid:t=!1,...n}={}){super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;let s=A.BufferSourceConverter.toUint8Array(e);if(!fe(this,s,t,n))return-1;let i=s.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let l=0;l<n&&(this.valueHexView[l]=i[l]&127,this.blockLength++,!!(i[l]&128));l++);let o=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)o[l]=this.valueHexView[l];return this.valueHexView=o,i[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Be(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Et();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;let n=new Uint8Array(t.length/7);for(let s=0;s<n.length;s++)n[s]=parseInt(t.slice(s*7,s*7+7),2)+(s+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let s=this.valueHexView,i=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)i[o]=s[o]|128;return i[this.blockLength-1]=s[this.blockLength-1],i.buffer}let t=me(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ee;let n=new Uint8Array(t.byteLength);if(!e){let s=new Uint8Array(t),i=t.byteLength-1;for(let o=0;o<i;o++)n[o]=s[o]|128;n[i]=s[i]}return n}toString(){let e="";if(this.isHexOnly)e=A.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}};et.NAME="sidBlock";var Mt=class extends Q{constructor({value:e=De,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let s=t;for(;n>0;){let i=new et;if(s=i.fromBER(e,s,n),s===-1)return this.blockLength=0,this.error=i.error,s;this.value.length===0&&(i.isFirstSid=!0),this.blockLength+=i.blockLength,n-=i.blockLength,this.value.push(i)}return s}toBER(e){let t=[];for(let n=0;n<this.value.length;n++){let s=this.value[n].toBER(e);if(s.byteLength===0)return this.error=this.value[n].error,ee;t.push(s)}return rn(t)}fromString(e){this.value=[];let t=0,n=0,s="",i=!1;do if(n=e.indexOf(".",t),n===-1?s=e.substring(t):s=e.substring(t,n),t=n+1,i){let o=this.value[0],l=0;switch(o.valueDec){case 0:break;case 1:l=40;break;case 2:l=80;break;default:this.value=[];return}let c=parseInt(s,10);if(isNaN(c))return;o.valueDec=c+l,i=!1}else{let o=new et;if(s>Number.MAX_SAFE_INTEGER){Et();let l=BigInt(s);o.valueBigInt=l}else if(o.valueDec=parseInt(s,10),isNaN(o.valueDec))return;this.value.length||(o.isFirstSid=!0,i=!0),this.value.push(o)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let s=this.value[n].toString();n!==0&&(e=`${e}.`),t?(s=`{${s}}`,this.value[n].isFirstSid?e=`2.{${s} - 80}`:e+=s):e+=s}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};Mt.NAME="ObjectIdentifierValueBlock";var bs,tt=class extends O{constructor(e={}){super(e,Mt),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};bs=tt;d.ObjectIdentifier=bs;tt.NAME="OBJECT IDENTIFIER";var rt=class extends he(ce){constructor({valueDec:e=0,...t}={}){super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;let s=A.BufferSourceConverter.toUint8Array(e);if(!fe(this,s,t,n))return-1;let i=s.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let l=0;l<n&&(this.valueHexView[l]=i[l]&127,this.blockLength++,!!(i[l]&128));l++);let o=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)o[l]=this.valueHexView[l];return this.valueHexView=o,i[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Be(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let s=this.valueHexView,i=new Uint8Array(this.blockLength);for(let o=0;o<this.blockLength-1;o++)i[o]=s[o]|128;return i[this.blockLength-1]=s[this.blockLength-1],i.buffer}let t=me(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",ee;let n=new Uint8Array(t.byteLength);if(!e){let s=new Uint8Array(t),i=t.byteLength-1;for(let o=0;o<i;o++)n[o]=s[o]|128;n[i]=s[i]}return n.buffer}toString(){let e="";return this.isHexOnly?e=A.Convert.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}};rt.NAME="relativeSidBlock";var Kt=class extends Q{constructor({value:e=De,...t}={}){super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let s=t;for(;n>0;){let i=new rt;if(s=i.fromBER(e,s,n),s===-1)return this.blockLength=0,this.error=i.error,s;this.blockLength+=i.blockLength,n-=i.blockLength,this.value.push(i)}return s}toBER(e,t){let n=[];for(let s=0;s<this.value.length;s++){let i=this.value[s].toBER(e);if(i.byteLength===0)return this.error=this.value[s].error,ee;n.push(i)}return rn(n)}fromString(e){this.value=[];let t=0,n=0,s="";do{n=e.indexOf(".",t),n===-1?s=e.substring(t):s=e.substring(t,n),t=n+1;let i=new rt;if(i.valueDec=parseInt(s,10),isNaN(i.valueDec))return!0;this.value.push(i)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let s=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(s=`{${s}}`),e+=s}return e}toJSON(){let e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};Kt.NAME="RelativeObjectIdentifierValueBlock";var ws,Pt=class extends O{constructor(e={}){super(e,Kt),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}};ws=Pt;d.RelativeObjectIdentifier=ws;Pt.NAME="RelativeObjectIdentifier";var xs,nt=class extends Ae{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};xs=nt;d.Sequence=xs;nt.NAME="SEQUENCE";var vs,Ht=class extends Ae{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};vs=Ht;d.Set=vs;Ht.NAME="SET";var Ft=class extends he(Q){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=De}toJSON(){return{...super.toJSON(),value:this.value}}};Ft.NAME="StringValueBlock";var Ot=class extends Ft{};Ot.NAME="SimpleStringValueBlock";var j=class extends St{constructor({...e}={}){super(e,Ot)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,A.BufferSourceConverter.toUint8Array(e))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let s=0;s<t;s++)n[s]=e.charCodeAt(s);this.valueBlock.value=e}};j.NAME="SIMPLE STRING";var Qt=class extends j{fromBuffer(e){this.valueBlock.valueHexView=A.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=A.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=A.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(A.Convert.FromUtf8String(e)),this.valueBlock.value=e}};Qt.NAME="Utf8StringValueBlock";var Bs,ue=class extends Qt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};Bs=ue;d.Utf8String=Bs;ue.NAME="UTF8String";var jt=class extends j{fromBuffer(e){this.valueBlock.value=A.Convert.ToUtf16String(e),this.valueBlock.valueHexView=A.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(A.Convert.FromUtf16String(e))}};jt.NAME="BmpStringValueBlock";var Es,Gt=class extends jt{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};Es=Gt;d.BmpString=Es;Gt.NAME="BMPString";var $t=class extends j{fromBuffer(e){let t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let s=0;s<n.length;s+=4)n[s]=n[s+3],n[s+1]=n[s+2],n[s+2]=0,n[s+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let s=0;s<t;s++){let i=me(e.charCodeAt(s),8),o=new Uint8Array(i);if(o.length>4)continue;let l=4-o.length;for(let c=o.length-1;c>=0;c--)n[s*4+c+l]=o[c]}this.valueBlock.value=e}};$t.NAME="UniversalStringValueBlock";var ks,qt=class extends $t{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};ks=qt;d.UniversalString=ks;qt.NAME="UniversalString";var Is,zt=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};Is=zt;d.NumericString=Is;zt.NAME="NumericString";var Ss,Jt=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};Ss=Jt;d.PrintableString=Ss;Jt.NAME="PrintableString";var Ns,Yt=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};Ns=Yt;d.TeletexString=Ns;Yt.NAME="TeletexString";var Cs,Wt=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};Cs=Wt;d.VideotexString=Cs;Wt.NAME="VideotexString";var Rs,Xt=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};Rs=Xt;d.IA5String=Rs;Xt.NAME="IA5String";var Us,Zt=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};Us=Zt;d.GraphicString=Us;Zt.NAME="GraphicString";var Ts,st=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};Ts=st;d.VisibleString=Ts;st.NAME="VisibleString";var _s,er=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};_s=er;d.GeneralString=_s;er.NAME="GeneralString";var Ls,tr=class extends j{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};Ls=tr;d.CharacterString=Ls;tr.NAME="CharacterString";var Ds,it=class extends st{constructor({value:e,valueDate:t,...n}={}){if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let s=0;s<e.length;s++)this.valueBlock.valueHexView[s]=e.charCodeAt(s)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,A.BufferSourceConverter.toUint8Array(e)))}toBuffer(){let e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let s=0;s<e.length;s++)n[s]=e.charCodeAt(s);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let s=parseInt(n[1],10);s>=50?this.year=1900+s:this.year=2e3+s,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let t=new Array(7);return t[0]=$(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=$(this.month,2),t[2]=$(this.day,2),t[3]=$(this.hour,2),t[4]=$(this.minute,2),t[5]=$(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}};Ds=it;d.UTCTime=Ds;it.NAME="UTCTime";var Vs,rr=class extends it{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,n="",s="",i=0,o,l=0,c=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{let u=new Number(e[e.length-1]);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let u=1,g=n.indexOf("+"),I="";if(g===-1&&(g=n.indexOf("-"),u=-1),g!==-1){if(I=n.substring(g+1),n=n.substring(0,g),I.length!==2&&I.length!==4)throw new Error("Wrong input string for conversion");let p=parseInt(I.substring(0,2),10);if(isNaN(p.valueOf()))throw new Error("Wrong input string for conversion");if(l=u*p,I.length===4){if(p=parseInt(I.substring(2,4),10),isNaN(p.valueOf()))throw new Error("Wrong input string for conversion");c=u*p}}}let f=n.indexOf(".");if(f===-1&&(f=n.indexOf(",")),f!==-1){let u=new Number(`0${n.substring(f)}`);if(isNaN(u.valueOf()))throw new Error("Wrong input string for conversion");i=u.valueOf(),s=n.substring(0,f)}else s=n;switch(!0){case s.length===8:if(o=/(\d{4})(\d{2})(\d{2})/ig,f!==-1)throw new Error("Wrong input string for conversion");break;case s.length===10:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let u=60*i;this.minute=Math.floor(u),u=60*(u-this.minute),this.second=Math.floor(u),u=1e3*(u-this.second),this.millisecond=Math.floor(u)}break;case s.length===12:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let u=60*i;this.second=Math.floor(u),u=1e3*(u-this.second),this.millisecond=Math.floor(u)}break;case s.length===14:if(o=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let u=1e3*i;this.millisecond=Math.floor(u)}break;default:throw new Error("Wrong input string for conversion")}let h=o.exec(s);if(h===null)throw new Error("Wrong input string for conversion");for(let u=1;u<h.length;u++)switch(u){case 1:this.year=parseInt(h[u],10);break;case 2:this.month=parseInt(h[u],10);break;case 3:this.day=parseInt(h[u],10);break;case 4:this.hour=parseInt(h[u],10)+l;break;case 5:this.minute=parseInt(h[u],10)+c;break;case 6:this.second=parseInt(h[u],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){let u=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=u.getUTCFullYear(),this.month=u.getUTCMonth(),this.day=u.getUTCDay(),this.hour=u.getUTCHours(),this.minute=u.getUTCMinutes(),this.second=u.getUTCSeconds(),this.millisecond=u.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let t=[];return t.push($(this.year,4)),t.push($(this.month,2)),t.push($(this.day,2)),t.push($(this.hour,2)),t.push($(this.minute,2)),t.push($(this.second,2)),this.millisecond!==0&&(t.push("."),t.push($(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}};Vs=rr;d.GeneralizedTime=Vs;rr.NAME="GeneralizedTime";var Ms,nr=class extends ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};Ms=nr;d.DATE=Ms;nr.NAME="DATE";var Ks,sr=class extends ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};Ks=sr;d.TimeOfDay=Ks;sr.NAME="TimeOfDay";var Ps,ir=class extends ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};Ps=ir;d.DateTime=Ps;ir.NAME="DateTime";var Hs,or=class extends ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};Hs=or;d.Duration=Hs;or.NAME="Duration";var Fs,ar=class extends ue{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};Fs=ar;d.TIME=Fs;ar.NAME="TIME";var js=Symbol.for("@achingbrain/uint8arraylist");function Qs(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let s=t+n.byteLength;if(e<s)return{buf:n,index:e-t};t=s}throw new RangeError("index is out of bounds")}function lr(r){return!!r?.[js]}var ot=class r{bufs;length;[js]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(lr(n))t+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(lr(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Qs(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Qs(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(lr(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:s}=this._subList(e,t);return we(n,s)}subarray(e,t){let{bufs:n,length:s}=this._subList(e,t);return n.length===1?n[0]:we(n,s)}sublist(e,t){let{bufs:n,length:s}=this._subList(e,t),i=new r;return i.length=s,i.bufs=[...n],i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],s=0;for(let i=0;i<this.bufs.length;i++){let o=this.bufs[i],l=s,c=l+o.byteLength;if(s=c,e>=c)continue;let f=e>=l&&e<c,h=t>l&&t<=c;if(f&&h){if(e===l&&t===c){n.push(o);break}let u=e-l;n.push(o.subarray(u,u+(t-e)));break}if(f){if(e===0){n.push(o);continue}n.push(o.subarray(e-l));continue}if(h){if(t===c){n.push(o);break}n.push(o.subarray(0,t-l));break}n.push(o)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!lr(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let s=n.byteLength;if(s===0)throw new TypeError("search must be at least 1 byte long");let i=256,o=new Int32Array(i);for(let u=0;u<i;u++)o[u]=-1;for(let u=0;u<s;u++)o[n[u]]=u;let l=o,c=this.byteLength-n.byteLength,f=n.byteLength-1,h;for(let u=t;u<=c;u+=h){h=0;for(let g=f;g>=0;g--){let I=this.get(u+g);if(n[g]!==I){h=Math.max(1,g-l[I]);break}}if(h===0)return u}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=z(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let s=oe(2);new DataView(s.buffer,s.byteOffset,s.byteLength).setInt16(0,t,n),this.write(s,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let s=oe(4);new DataView(s.buffer,s.byteOffset,s.byteLength).setInt32(0,t,n),this.write(s,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let s=oe(8);new DataView(s.buffer,s.byteOffset,s.byteLength).setBigInt64(0,t,n),this.write(s,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=z(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let s=oe(2);new DataView(s.buffer,s.byteOffset,s.byteLength).setUint16(0,t,n),this.write(s,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let s=oe(4);new DataView(s.buffer,s.byteOffset,s.byteLength).setUint32(0,t,n),this.write(s,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let s=oe(8);new DataView(s.buffer,s.byteOffset,s.byteLength).setBigUint64(0,t,n),this.write(s,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let s=oe(4);new DataView(s.buffer,s.byteOffset,s.byteLength).setFloat32(0,t,n),this.write(s,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let s=oe(8);new DataView(s.buffer,s.byteOffset,s.byteLength).setFloat64(0,t,n),this.write(s,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Ne(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((s,i)=>s+i.byteLength,0)),n.length=t,n}};function te(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var cr=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=t??"ABORT_ERR"}};async function Gs(r,e,t){if(e==null)return r;if(e.aborted)return Promise.reject(new cr(t?.errorMessage,t?.errorCode));let n,s=new cr(t?.errorMessage,t?.errorCode);try{return await Promise.race([r,new Promise((i,o)=>{n=()=>{o(s)},e.addEventListener("abort",n)})])}finally{n!=null&&e.removeEventListener("abort",n)}}var on=class{needNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.needNext=te(),this.haveNext=te()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("Have next but next was undefined");let e=this.nextResult;return this.nextResult=void 0,this.needNext.resolve(),this.needNext=te(),e}async throw(e){return this.ended=!0,e!=null&&this.haveNext.reject(e),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return await this._push(void 0),e}async push(e,t){await this._push(e,t)}async end(e,t){e!=null?await this.throw(e):await this._push(void 0,t)}async _push(e,t){if(e!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");this.nextResult!=null&&await this.needNext.promise,e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=te(),await Gs(this.needNext.promise,t?.signal,t)}};function $s(){return new on}var ur=class extends Error{code;constructor(e,t){super(e),this.code=t}},an=class extends ur{type;constructor(e){super(e,"ABORT_ERR"),this.type="aborted"}};function qs(r,e){let t=$s();r.sink(t).catch(async o=>{await t.end(o)}),r.sink=async o=>{for await(let l of o)await t.push(l);await t.end()};let n=r.source;r.source[Symbol.iterator]!=null?n=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(n=r.source[Symbol.asyncIterator]());let s=new ot;return{read:async(o,l)=>{l?.signal?.throwIfAborted();let c,f=new Promise((h,u)=>{c=()=>{u(new an("Read aborted"))},l?.signal?.addEventListener("abort",c)});try{if(o==null){let{done:u,value:g}=await Promise.race([n.next(),f]);return u===!0?new ot:g}for(;s.byteLength<o;){let{value:u,done:g}=await Promise.race([n.next(),f]);if(g===!0)throw new ur("unexpected end of input","ERR_UNEXPECTED_EOF");s.append(u)}let h=s.sublist(0,o);return s.consume(o),h}finally{c!=null&&l?.signal?.removeEventListener("abort",c)}},write:async(o,l)=>{l?.signal?.throwIfAborted(),o instanceof Uint8Array?await t.push(o,l):await t.push(o.subarray(),l)},unwrap:()=>{if(s.byteLength>0){let o=r.source;r.source=async function*(){e?.yieldBytes===!1?yield s:yield*s,yield*o}()}return r}}}function sa(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:s=>{n.push(s)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var zs=sa;function ia(r){return r[Symbol.asyncIterator]!=null}function oa(r,e){if(ia(r))return async function*(){for await(let l of r)yield e(l)}();let t=zs(r),{value:n,done:s}=t.next();if(s===!0)return function*(){}();let i=e(n);if(typeof i.then=="function")return async function*(){yield await i;for await(let l of t)yield e(l)}();let o=e;return function*(){yield i;for(let l of t)yield o(l)}()}var Js=oa;function ln(){let r=te(),e=!1;return{sink:async t=>{if(e)throw new Error("already piped");e=!0,r.resolve(t)},source:async function*(){yield*await r.promise}()}}function Ys(){let r=ln(),e=ln();return[{source:r.source,sink:e.sink},{source:e.source,sink:r.sink}]}var fr=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Ve=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new fr(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new fr(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var cn=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function hr(r={}){return aa(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function aa(r,e){e=e??{};let t=e.onEnd,n=new Ve,s,i,o,l=te(),c=async()=>{try{return n.isEmpty()?o?{done:!0}:await new Promise((y,k)=>{i=D=>{i=null,n.push(D);try{y(r(n))}catch(_){k(_)}return s}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{l.resolve(),l=te()})}},f=y=>i!=null?i(y):(n.push(y),s),h=y=>(n=new Ve,i!=null?i({error:y}):(n.push({error:y}),s)),u=y=>{if(o)return s;if(e?.objectMode!==!0&&y?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return f({done:!1,value:y})},g=y=>o?s:(o=!0,y!=null?h(y):f({done:!0})),I=()=>(n=new Ve,g(),{done:!0}),p=y=>(g(y),{done:!0});if(s={[Symbol.asyncIterator](){return this},next:c,return:I,throw:p,push:u,end:g,get readableLength(){return n.size},onEmpty:async y=>{let k=y?.signal;if(k?.throwIfAborted(),n.isEmpty())return;let D,_;k!=null&&(D=new Promise((m,b)=>{_=()=>{b(new cn)},k.addEventListener("abort",_)}));try{await Promise.race([l.promise,D])}finally{_!=null&&k!=null&&k?.removeEventListener("abort",_)}}},t==null)return s;let E=s;return s={[Symbol.asyncIterator](){return this},next(){return E.next()},throw(y){return E.throw(y),t!=null&&(t(y),t=void 0),{done:!0}},return(){return E.return(),t!=null&&(t(),t=void 0),{done:!0}},push:u,end(y){return E.end(y),t!=null&&(t(y),t=void 0),s},get readableLength(){return E.readableLength},onEmpty:y=>E.onEmpty(y)},s}function la(r){return r[Symbol.asyncIterator]!=null}function ca(...r){let e=[];for(let t of r)la(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=hr({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let s of n)t.push(s)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var Ws=ca;function Xs(r,...e){if(r==null)throw new Error("Empty pipeline");if(un(r)){let n=r;r=()=>n.source}else if(ei(r)||Zs(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&un(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let n=1;n<t.length-1;n++)un(t[n])&&(t[n]=fa(t[n]));return ua(...t)}var ua=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},Zs=r=>r?.[Symbol.asyncIterator]!=null,ei=r=>r?.[Symbol.iterator]!=null,un=r=>r==null?!1:r.sink!=null&&r.source!=null,fa=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=hr({objectMode:!0});t.then(()=>{n.end()},o=>{n.end(o)});let s,i=r.source;if(Zs(i))s=async function*(){yield*i,n.end()};else if(ei(i))s=function*(){yield*i,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Ws(n,s())}return r.source};var pn=An(oi(),1);var hn="Your private shared key is invalid";var ai="No connection for the handshake provided";var li="ERR_INVALID_PARAMETERS";function ui(r){let e=ye(ae(gn),"base16"),t=X(`/key/swarm/psk/1.0.0/
2
+ "use strict";var Libp2PPnet=(()=>{var tr=Object.create;var ue=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var nr=Object.getOwnPropertyNames;var or=Object.getPrototypeOf,sr=Object.prototype.hasOwnProperty;var st=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),O=(r,e)=>{for(var t in e)ue(r,t,{get:e[t],enumerable:!0})},it=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of nr(e))!sr.call(r,o)&&o!==t&&ue(r,o,{get:()=>e[o],enumerable:!(n=rr(e,o))||n.enumerable});return r};var ir=(r,e,t)=>(t=r!=null?tr(or(r)):{},it(e||!r||!r.__esModule?ue(t,"default",{value:r,enumerable:!0}):t,r)),fr=r=>it(ue({},"__esModule",{value:!0}),r);var jt=st((ys,Vt)=>{var Cn=(r,e)=>function(){return e||(0,r[Object.keys(r)[0]])((e={exports:{}}).exports,e),e.exports},vn=(()=>{for(var r=new Uint8Array(128),e=0;e<64;e++)r[e<26?e+65:e<52?e+71:e<62?e-4:e*4-205]=e;return t=>{for(var n=t.length,o=new Uint8Array((n-(t[n-1]=="=")-(t[n-2]=="="))*3/4|0),i=0,f=0;i<n;){var a=r[t.charCodeAt(i++)],c=r[t.charCodeAt(i++)],w=r[t.charCodeAt(i++)],l=r[t.charCodeAt(i++)];o[f++]=a<<2|c>>4,o[f++]=c<<4|w>>2,o[f++]=w<<6|l}return o}})(),Qn=Cn({"wasm-binary:./xsalsa20.wat"(r,e){e.exports=vn("AGFzbQEAAAABGgNgBn9/f39/fwBgBn9/f39+fwF+YAN/f38AAwcGAAEBAgICBQUBAQroBwcoAwZtZW1vcnkCAAx4c2Fsc2EyMF94b3IAAAxjb3JlX3NhbHNhMjAABArqEQYYACAAIAEgAiADIAQgACkDACAFEAE3AwALPQBB8AAgAyAFEAMgACABIAIgA0EQaiAEQfAAEAJB8ABCADcDAEH4AEIANwMAQYABQgA3AwBBiAFCADcDAAuHBQEBfyACQQBGBEBCAA8LQdAAIAUpAwA3AwBB2AAgBUEIaikDADcDAEHgACAFQRBqKQMANwMAQegAIAVBGGopAwA3AwBBACADKQMANwMAQQggBDcDAAJAA0AgAkHAAEkNAUEQQQBB0AAQBSAAIAEpAwBBECkDAIU3AwAgAEEIaiABQQhqKQMAQRgpAwCFNwMAIABBEGogAUEQaikDAEEgKQMAhTcDACAAQRhqIAFBGGopAwBBKCkDAIU3AwAgAEEgaiABQSBqKQMAQTApAwCFNwMAIABBKGogAUEoaikDAEE4KQMAhTcDACAAQTBqIAFBMGopAwBBwAApAwCFNwMAIABBOGogAUE4aikDAEHIACkDAIU3AwBBCEEIKQMAQgF8NwMAIABBwABqIQAgAUHAAGohASACQcAAayECDAALC0EIKQMAIQQgAkEASwRAQRBBAEHQABAFAkACQAJAAkACQAJAAkACQCACQQhuDgcHBgUEAwIBAAsgAEE4aiABQThqKQMAQcgAKQMAhTcDAAsgAEEwaiABQTBqKQMAQcAAKQMAhTcDAAsgAEEoaiABQShqKQMAQTgpAwCFNwMACyAAQSBqIAFBIGopAwBBMCkDAIU3AwALIABBGGogAUEYaikDAEEoKQMAhTcDAAsgAEEQaiABQRBqKQMAQSApAwCFNwMACyAAQQhqIAFBCGopAwBBGCkDAIU3AwALIAAgASkDAEEQKQMAhTcDAAtBEEIANwMAQRhCADcDAEEgQgA3AwBBKEIANwMAQTBCADcDAEE4QgA3AwBBwABCADcDAEHIAEIANwMAQdAAQgA3AwBB2ABCADcDAEHgAEIANwMAQegAQgA3AwAgBA8LnQUBEX9B5fDBiwYhA0HuyIGZAyEIQbLaiMsHIQ1B9MqB2QYhEiACKAIAIQQgAkEEaigCACEFIAJBCGooAgAhBiACQQxqKAIAIQcgAkEQaigCACEOIAJBFGooAgAhDyACQRhqKAIAIRAgAkEcaigCACERIAEoAgAhCSABQQRqKAIAIQogAUEIaigCACELIAFBDGooAgAhDEEUIRMCQANAIBNBAEYNASAHIAMgD2pBB3dzIQcgCyAHIANqQQl3cyELIA8gCyAHakENd3MhDyADIA8gC2pBEndzIQMgDCAIIARqQQd3cyEMIBAgDCAIakEJd3MhECAEIBAgDGpBDXdzIQQgCCAEIBBqQRJ3cyEIIBEgDSAJakEHd3MhESAFIBEgDWpBCXdzIQUgCSAFIBFqQQ13cyEJIA0gCSAFakESd3MhDSAGIBIgDmpBB3dzIQYgCiAGIBJqQQl3cyEKIA4gCiAGakENd3MhDiASIA4gCmpBEndzIRIgBCADIAZqQQd3cyEEIAUgBCADakEJd3MhBSAGIAUgBGpBDXdzIQYgAyAGIAVqQRJ3cyEDIAkgCCAHakEHd3MhCSAKIAkgCGpBCXdzIQogByAKIAlqQQ13cyEHIAggByAKakESd3MhCCAOIA0gDGpBB3dzIQ4gCyAOIA1qQQl3cyELIAwgCyAOakENd3MhDCANIAwgC2pBEndzIQ0gDyASIBFqQQd3cyEPIBAgDyASakEJd3MhECARIBAgD2pBDXdzIREgEiARIBBqQRJ3cyESIBNBAmshEwwACwsgACADNgIAIABBBGogCDYCACAAQQhqIA02AgAgAEEMaiASNgIAIABBEGogCTYCACAAQRRqIAo2AgAgAEEYaiALNgIAIABBHGogDDYCAAsKACAAIAEgAhAFC90GASF/QeXwwYsGIQNB7siBmQMhCEGy2ojLByENQfTKgdkGIRIgAigCACEEIAJBBGooAgAhBSACQQhqKAIAIQYgAkEMaigCACEHIAJBEGooAgAhDiACQRRqKAIAIQ8gAkEYaigCACEQIAJBHGooAgAhESABKAIAIQkgAUEEaigCACEKIAFBCGooAgAhCyABQQxqKAIAIQwgAyETIAQhFCAFIRUgBiEWIAchFyAIIRggCSEZIAohGiALIRsgDCEcIA0hHSAOIR4gDyEfIBAhICARISEgEiEiQRQhIwJAA0AgI0EARg0BIAcgAyAPakEHd3MhByALIAcgA2pBCXdzIQsgDyALIAdqQQ13cyEPIAMgDyALakESd3MhAyAMIAggBGpBB3dzIQwgECAMIAhqQQl3cyEQIAQgECAMakENd3MhBCAIIAQgEGpBEndzIQggESANIAlqQQd3cyERIAUgESANakEJd3MhBSAJIAUgEWpBDXdzIQkgDSAJIAVqQRJ3cyENIAYgEiAOakEHd3MhBiAKIAYgEmpBCXdzIQogDiAKIAZqQQ13cyEOIBIgDiAKakESd3MhEiAEIAMgBmpBB3dzIQQgBSAEIANqQQl3cyEFIAYgBSAEakENd3MhBiADIAYgBWpBEndzIQMgCSAIIAdqQQd3cyEJIAogCSAIakEJd3MhCiAHIAogCWpBDXdzIQcgCCAHIApqQRJ3cyEIIA4gDSAMakEHd3MhDiALIA4gDWpBCXdzIQsgDCALIA5qQQ13cyEMIA0gDCALakESd3MhDSAPIBIgEWpBB3dzIQ8gECAPIBJqQQl3cyEQIBEgECAPakENd3MhESASIBEgEGpBEndzIRIgI0ECayEjDAALCyAAIAMgE2o2AgAgAEEEaiAEIBRqNgIAIABBCGogBSAVajYCACAAQQxqIAYgFmo2AgAgAEEQaiAHIBdqNgIAIABBFGogCCAYajYCACAAQRhqIAkgGWo2AgAgAEEcaiAKIBpqNgIAIABBIGogCyAbajYCACAAQSRqIAwgHGo2AgAgAEEoaiANIB1qNgIAIABBLGogDiAeajYCACAAQTBqIA8gH2o2AgAgAEE0aiAQICBqNgIAIABBOGogESAhajYCACAAQTxqIBIgImo2AgAL")}}),Sn=Qn(),Dn=new WebAssembly.Module(Sn);Vt.exports=r=>new WebAssembly.Instance(Dn,r).exports});var Ht=st((ws,Kt)=>{var ce=typeof WebAssembly<"u"&&jt()(),Ie=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]),G=144,re=G,Ee=[];Kt.exports=V;V.NONCEBYTES=24;V.KEYBYTES=32;V.core_hsalsa20=Pt;V.SIGMA=Ie;function V(r,e){if(!(this instanceof V))return new V(r,e);if(!r||r.length<24)throw new Error("nonce must be at least 24 bytes");if(!e||e.length<32)throw new Error("key must be at least 32 bytes");this._xor=ce?new Be(r,e):new Ze(r,e)}V.prototype.update=function(r,e){if(!r)throw new Error("input must be Uint8Array or Buffer");return e||(e=new Uint8Array(r.length)),r.length&&this._xor.update(r,e),e};V.prototype.final=V.prototype.finalize=function(){this._xor.finalize(),this._xor=null};function Be(r,e){Ee.length||(Ee.push(G),G+=64),this._pointer=Ee.pop(),this._nonce=this._pointer+8,this._key=this._nonce+24,this._overflow=0,this._memory=new Uint8Array(ce.memory.buffer),this._memory.fill(0,this._pointer,this._pointer+8),this._memory.set(r,this._nonce),this._memory.set(e,this._key)}Be.prototype.realloc=function(r){ce.memory.grow(Math.ceil(Math.abs(r-this._memory.length)/65536)),this._memory=new Uint8Array(ce.memory.buffer)};Be.prototype.update=function(r,e){var t=this._overflow+r.length,n=G+this._overflow;re=G+t,re>=this._memory.length&&this.realloc(re),this._memory.set(r,n),ce.xsalsa20_xor(this._pointer,G,G,t,this._nonce,this._key),e.set(this._memory.subarray(n,G+t)),this._overflow=t&63};Be.prototype.finalize=function(){this._memory.fill(0,this._pointer,this._key+32),re>G&&(this._memory.fill(0,G,re),re=0),Ee.push(this._pointer)};function Ze(r,e){this._s=new Uint8Array(32),this._z=new Uint8Array(16),this._overflow=0,Pt(this._s,r,e,Ie);for(var t=0;t<8;t++)this._z[t]=r[t+16]}Ze.prototype.update=function(r,e){for(var t=new Uint8Array(64),n=0,o=this._overflow,i=r.length+this._overflow,f=this._z,a=-this._overflow,c=-this._overflow;i>=64;){for(kt(t,f,this._s,Ie);o<64;o++)e[c+o]=r[a+o]^t[o];for(n=1,o=8;o<16;o++)n+=f[o]&255|0,f[o]=n&255,n>>>=8;i-=64,c+=64,a+=64,o=0}if(i>0)for(kt(t,f,this._s,Ie);o<i;o++)e[c+o]=r[a+o]^t[o];this._overflow=i&63};Ze.prototype.finalize=function(){this._s.fill(0),this._z.fill(0)};function kt(r,e,t,n){for(var o=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,i=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,f=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,a=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,c=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,w=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,l=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,h=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,I=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,q=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,p=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,m=t[16]&255|(t[17]&255)<<8|(t[18]&255)<<16|(t[19]&255)<<24,u=t[20]&255|(t[21]&255)<<8|(t[22]&255)<<16|(t[23]&255)<<24,E=t[24]&255|(t[25]&255)<<8|(t[26]&255)<<16|(t[27]&255)<<24,U=t[28]&255|(t[29]&255)<<8|(t[30]&255)<<16|(t[31]&255)<<24,N=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,A=o,d=i,b=f,x=a,g=c,y=w,B=l,C=h,v=I,Q=q,S=p,M=m,R=u,_=E,T=U,D=N,s,ne=0;ne<20;ne+=2)s=A+R|0,g^=s<<7|s>>>25,s=g+A|0,v^=s<<9|s>>>23,s=v+g|0,R^=s<<13|s>>>19,s=R+v|0,A^=s<<18|s>>>14,s=y+d|0,Q^=s<<7|s>>>25,s=Q+y|0,_^=s<<9|s>>>23,s=_+Q|0,d^=s<<13|s>>>19,s=d+_|0,y^=s<<18|s>>>14,s=S+B|0,T^=s<<7|s>>>25,s=T+S|0,b^=s<<9|s>>>23,s=b+T|0,B^=s<<13|s>>>19,s=B+b|0,S^=s<<18|s>>>14,s=D+M|0,x^=s<<7|s>>>25,s=x+D|0,C^=s<<9|s>>>23,s=C+x|0,M^=s<<13|s>>>19,s=M+C|0,D^=s<<18|s>>>14,s=A+x|0,d^=s<<7|s>>>25,s=d+A|0,b^=s<<9|s>>>23,s=b+d|0,x^=s<<13|s>>>19,s=x+b|0,A^=s<<18|s>>>14,s=y+g|0,B^=s<<7|s>>>25,s=B+y|0,C^=s<<9|s>>>23,s=C+B|0,g^=s<<13|s>>>19,s=g+C|0,y^=s<<18|s>>>14,s=S+Q|0,M^=s<<7|s>>>25,s=M+S|0,v^=s<<9|s>>>23,s=v+M|0,Q^=s<<13|s>>>19,s=Q+v|0,S^=s<<18|s>>>14,s=D+T|0,R^=s<<7|s>>>25,s=R+D|0,_^=s<<9|s>>>23,s=_+R|0,T^=s<<13|s>>>19,s=T+_|0,D^=s<<18|s>>>14;A=A+o|0,d=d+i|0,b=b+f|0,x=x+a|0,g=g+c|0,y=y+w|0,B=B+l|0,C=C+h|0,v=v+I|0,Q=Q+q|0,S=S+p|0,M=M+m|0,R=R+u|0,_=_+E|0,T=T+U|0,D=D+N|0,r[0]=A>>>0&255,r[1]=A>>>8&255,r[2]=A>>>16&255,r[3]=A>>>24&255,r[4]=d>>>0&255,r[5]=d>>>8&255,r[6]=d>>>16&255,r[7]=d>>>24&255,r[8]=b>>>0&255,r[9]=b>>>8&255,r[10]=b>>>16&255,r[11]=b>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=g>>>0&255,r[17]=g>>>8&255,r[18]=g>>>16&255,r[19]=g>>>24&255,r[20]=y>>>0&255,r[21]=y>>>8&255,r[22]=y>>>16&255,r[23]=y>>>24&255,r[24]=B>>>0&255,r[25]=B>>>8&255,r[26]=B>>>16&255,r[27]=B>>>24&255,r[28]=C>>>0&255,r[29]=C>>>8&255,r[30]=C>>>16&255,r[31]=C>>>24&255,r[32]=v>>>0&255,r[33]=v>>>8&255,r[34]=v>>>16&255,r[35]=v>>>24&255,r[36]=Q>>>0&255,r[37]=Q>>>8&255,r[38]=Q>>>16&255,r[39]=Q>>>24&255,r[40]=S>>>0&255,r[41]=S>>>8&255,r[42]=S>>>16&255,r[43]=S>>>24&255,r[44]=M>>>0&255,r[45]=M>>>8&255,r[46]=M>>>16&255,r[47]=M>>>24&255,r[48]=R>>>0&255,r[49]=R>>>8&255,r[50]=R>>>16&255,r[51]=R>>>24&255,r[52]=_>>>0&255,r[53]=_>>>8&255,r[54]=_>>>16&255,r[55]=_>>>24&255,r[56]=T>>>0&255,r[57]=T>>>8&255,r[58]=T>>>16&255,r[59]=T>>>24&255,r[60]=D>>>0&255,r[61]=D>>>8&255,r[62]=D>>>16&255,r[63]=D>>>24&255}function Pt(r,e,t,n){for(var o=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,i=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,f=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,a=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,c=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,w=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,l=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,h=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,I=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,q=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,p=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,m=t[16]&255|(t[17]&255)<<8|(t[18]&255)<<16|(t[19]&255)<<24,u=t[20]&255|(t[21]&255)<<8|(t[22]&255)<<16|(t[23]&255)<<24,E=t[24]&255|(t[25]&255)<<8|(t[26]&255)<<16|(t[27]&255)<<24,U=t[28]&255|(t[29]&255)<<8|(t[30]&255)<<16|(t[31]&255)<<24,N=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,A=o,d=i,b=f,x=a,g=c,y=w,B=l,C=h,v=I,Q=q,S=p,M=m,R=u,_=E,T=U,D=N,s,ne=0;ne<20;ne+=2)s=A+R|0,g^=s<<7|s>>>25,s=g+A|0,v^=s<<9|s>>>23,s=v+g|0,R^=s<<13|s>>>19,s=R+v|0,A^=s<<18|s>>>14,s=y+d|0,Q^=s<<7|s>>>25,s=Q+y|0,_^=s<<9|s>>>23,s=_+Q|0,d^=s<<13|s>>>19,s=d+_|0,y^=s<<18|s>>>14,s=S+B|0,T^=s<<7|s>>>25,s=T+S|0,b^=s<<9|s>>>23,s=b+T|0,B^=s<<13|s>>>19,s=B+b|0,S^=s<<18|s>>>14,s=D+M|0,x^=s<<7|s>>>25,s=x+D|0,C^=s<<9|s>>>23,s=C+x|0,M^=s<<13|s>>>19,s=M+C|0,D^=s<<18|s>>>14,s=A+x|0,d^=s<<7|s>>>25,s=d+A|0,b^=s<<9|s>>>23,s=b+d|0,x^=s<<13|s>>>19,s=x+b|0,A^=s<<18|s>>>14,s=y+g|0,B^=s<<7|s>>>25,s=B+y|0,C^=s<<9|s>>>23,s=C+B|0,g^=s<<13|s>>>19,s=g+C|0,y^=s<<18|s>>>14,s=S+Q|0,M^=s<<7|s>>>25,s=M+S|0,v^=s<<9|s>>>23,s=v+M|0,Q^=s<<13|s>>>19,s=Q+v|0,S^=s<<18|s>>>14,s=D+T|0,R^=s<<7|s>>>25,s=R+D|0,_^=s<<9|s>>>23,s=_+R|0,T^=s<<13|s>>>19,s=T+_|0,D^=s<<18|s>>>14;r[0]=A>>>0&255,r[1]=A>>>8&255,r[2]=A>>>16&255,r[3]=A>>>24&255,r[4]=y>>>0&255,r[5]=y>>>8&255,r[6]=y>>>16&255,r[7]=y>>>24&255,r[8]=S>>>0&255,r[9]=S>>>8&255,r[10]=S>>>16&255,r[11]=S>>>24&255,r[12]=D>>>0&255,r[13]=D>>>8&255,r[14]=D>>>16&255,r[15]=D>>>24&255,r[16]=B>>>0&255,r[17]=B>>>8&255,r[18]=B>>>16&255,r[19]=B>>>24&255,r[20]=C>>>0&255,r[21]=C>>>8&255,r[22]=C>>>16&255,r[23]=C>>>24&255,r[24]=v>>>0&255,r[25]=v>>>8&255,r[26]=v>>>16&255,r[27]=v>>>24&255,r[28]=Q>>>0&255,r[29]=Q>>>8&255,r[30]=Q>>>16&255,r[31]=Q>>>24&255}});var Ln={};O(Ln,{generateKey:()=>Wt,preSharedKey:()=>Nn});var J=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};var De={};O(De,{base58btc:()=>F,base58flickr:()=>lr});var Rn=new Uint8Array(0);function ft(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function j(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function at(r){return new TextEncoder().encode(r)}function ct(r){return new TextDecoder().decode(r)}function ar(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),f=i.charCodeAt(0);if(t[f]!==255)throw new TypeError(i+" is ambiguous");t[f]=o}var a=r.length,c=r.charAt(0),w=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var m=0,u=0,E=0,U=p.length;E!==U&&p[E]===0;)E++,m++;for(var N=(U-E)*l+1>>>0,A=new Uint8Array(N);E!==U;){for(var d=p[E],b=0,x=N-1;(d!==0||b<u)&&x!==-1;x--,b++)d+=256*A[x]>>>0,A[x]=d%a>>>0,d=d/a>>>0;if(d!==0)throw new Error("Non-zero carry");u=b,E++}for(var g=N-u;g!==N&&A[g]===0;)g++;for(var y=c.repeat(m);g<N;++g)y+=r.charAt(A[g]);return y}function I(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var m=0;if(p[m]!==" "){for(var u=0,E=0;p[m]===c;)u++,m++;for(var U=(p.length-m)*w+1>>>0,N=new Uint8Array(U);p[m];){var A=t[p.charCodeAt(m)];if(A===255)return;for(var d=0,b=U-1;(A!==0||d<E)&&b!==-1;b--,d++)A+=a*N[b]>>>0,N[b]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");E=d,m++}if(p[m]!==" "){for(var x=U-E;x!==U&&N[x]===0;)x++;for(var g=new Uint8Array(u+(U-x)),y=u;x!==U;)g[y++]=N[x++];return g}}}function q(p){var m=I(p);if(m)return m;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:I,decode:q}}var cr=ar,ur=cr,ht=ur;var Ce=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ve=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return At(this,e)}},Qe=class{decoders;constructor(e){this.decoders=e}or(e){return At(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function At(r,e){return new Qe({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Se=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Ce(e,t,n),this.decoder=new ve(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Y({name:r,prefix:e,encode:t,decode:n}){return new Se(r,e,t,n)}function P({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=ht(t,r);return Y({prefix:e,name:r,encode:n,decode:i=>j(o(i))})}function hr(r,e,t,n){let o={};for(let l=0;l<e.length;++l)o[e[l]]=l;let i=r.length;for(;r[i-1]==="=";)--i;let f=new Uint8Array(i*t/8|0),a=0,c=0,w=0;for(let l=0;l<i;++l){let h=o[r[l]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|h,a+=t,a>=8&&(a-=8,f[w++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return f}function Ar(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,i="",f=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],f+=8;f>t;)f-=t,i+=e[o&a>>f];if(f!==0&&(i+=e[o&a<<t-f]),n)for(;i.length*t&7;)i+="=";return i}function L({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Y({prefix:e,name:r,encode(o){return Ar(o,n,t)},decode(o){return hr(o,n,t,r)}})}var F=P({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lr=P({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Le={};O(Le,{identity:()=>Rr});var pr=dt,lt=128,dr=127,xr=~dr,gr=Math.pow(2,31);function dt(r,e,t){e=e||[],t=t||0;for(var n=t;r>=gr;)e[t++]=r&255|lt,r/=128;for(;r&xr;)e[t++]=r&255|lt,r>>>=7;return e[t]=r|0,dt.bytes=t-n+1,e}var br=Ne,yr=128,pt=127;function Ne(r,n){var t=0,n=n||0,o=0,i=n,f,a=r.length;do{if(i>=a)throw Ne.bytes=0,new RangeError("Could not decode varint");f=r[i++],t+=o<28?(f&pt)<<o:(f&pt)*Math.pow(2,o),o+=7}while(f>=yr);return Ne.bytes=i-n,t}var wr=Math.pow(2,7),mr=Math.pow(2,14),Er=Math.pow(2,21),Ir=Math.pow(2,28),Br=Math.pow(2,35),Cr=Math.pow(2,42),vr=Math.pow(2,49),Qr=Math.pow(2,56),Sr=Math.pow(2,63),Dr=function(r){return r<wr?1:r<mr?2:r<Er?3:r<Ir?4:r<Br?5:r<Cr?6:r<vr?7:r<Qr?8:r<Sr?9:10},Nr={encode:pr,decode:br,encodingLength:Dr},Lr=Nr,oe=Lr;function se(r,e=0){return[oe.decode(r,e),oe.decode.bytes]}function X(r,e,t=0){return oe.encode(r,e,t),e}function W(r){return oe.encodingLength(r)}function K(r,e){let t=e.byteLength,n=W(r),o=n+W(t),i=new Uint8Array(o+t);return X(r,i,0),X(t,i,n),i.set(e,o),new $(r,t,e,i)}function xt(r){let e=j(r),[t,n]=se(e),[o,i]=se(e.subarray(n)),f=e.subarray(n+i);if(f.byteLength!==o)throw new Error("Incorrect length");return new $(t,o,f,e)}function gt(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&ft(r.bytes,t.bytes)}}var $=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var bt=0,Ur="identity",yt=j;function Mr(r){return K(bt,yt(r))}var Rr={code:bt,name:Ur,encode:yt,digest:Mr};var Re={};O(Re,{sha256:()=>_r,sha512:()=>Tr});function Me({name:r,code:e,encode:t}){return new Ue(r,e,t)}var Ue=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?K(this.code,t):t.then(n=>K(this.code,n))}else throw Error("Unknown type, must be binary type")}};function mt(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var _r=Me({name:"sha2-256",code:18,encode:mt("SHA-256")}),Tr=Me({name:"sha2-512",code:19,encode:mt("SHA-512")});function Et(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function k(r=0){return new Uint8Array(r)}function H(r=0){return new Uint8Array(r)}function _e(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=H(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}var Te={};O(Te,{base10:()=>Or});var Or=P({prefix:"9",name:"base10",alphabet:"0123456789"});var Oe={};O(Oe,{base16:()=>qr,base16upper:()=>zr});var qr=L({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),zr=L({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var qe={};O(qe,{base2:()=>Fr});var Fr=L({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ze={};O(ze,{base256emoji:()=>Pr});var It=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Gr=It.reduce((r,e,t)=>(r[t]=e,r),[]),Vr=It.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function jr(r){return r.reduce((e,t)=>(e+=Gr[t],e),"")}function kr(r){let e=[];for(let t of r){let n=Vr[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Pr=Y({prefix:"\u{1F680}",name:"base256emoji",encode:jr,decode:kr});var Fe={};O(Fe,{base32:()=>Z,base32hex:()=>Yr,base32hexpad:()=>Wr,base32hexpadupper:()=>$r,base32hexupper:()=>Xr,base32pad:()=>Hr,base32padupper:()=>Jr,base32upper:()=>Kr,base32z:()=>Zr});var Z=L({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Kr=L({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Hr=L({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Jr=L({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Yr=L({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Xr=L({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Wr=L({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$r=L({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Zr=L({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ge={};O(Ge,{base36:()=>en,base36upper:()=>tn});var en=P({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tn=P({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ve={};O(Ve,{base64:()=>rn,base64pad:()=>nn,base64url:()=>on,base64urlpad:()=>sn});var rn=L({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),nn=L({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),on=L({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),sn=L({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var je={};O(je,{base8:()=>fn});var fn=L({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ke={};O(ke,{identity:()=>an});var an=Y({prefix:"\0",name:"identity",encode:r=>ct(r),decode:r=>at(r)});var ao=new TextEncoder,co=new TextDecoder;function Bt(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return An(t,Pe(r),e??F.encoder);default:return ln(t,Pe(r),e??Z.encoder)}}var Ct=new WeakMap;function Pe(r){let e=Ct.get(r);if(e==null){let t=new Map;return Ct.set(r,t),t}return e}var Ae=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==fe)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==pn)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=K(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&gt(e.multihash,n.multihash)}toString(e){return Bt(this,e)}toJSON(){return{"/":Bt(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:f}=t;return new r(n,o,i,f??vt(n,o,i.bytes))}else if(t[dn]===!0){let{version:n,multihash:o,code:i}=t,f=xt(o);return r.create(n,i,f)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==fe)throw new Error(`Version 0 CID must use dag-pb (code: ${fe}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=vt(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,fe,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=j(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),f=new $(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(f):r.createV1(t.codec,f),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[h,I]=se(e.subarray(t));return t+=I,h},o=n(),i=fe;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let f=t,a=n(),c=n(),w=t+c,l=w-f;return{version:o,codec:i,multihashCode:a,digestSize:c,multihashSize:l,size:w}}static parse(e,t){let[n,o]=hn(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pe(i).set(n,e),i}};function hn(r,e){switch(r[0]){case"Q":{let t=e??F;return[F.prefix,t.decode(`${F.prefix}${r}`)]}case F.prefix:{let t=e??F;return[F.prefix,t.decode(r)]}case Z.prefix:{let t=e??Z;return[Z.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function An(r,e,t){let{prefix:n}=t;if(n!==F.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o}function ln(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o}var fe=112,pn=18;function vt(r,e,t){let n=W(r),o=n+W(e),i=new Uint8Array(o+t.byteLength);return X(r,i,0),X(e,i,n),i.set(t,o),i}var dn=Symbol.for("@ipld/js-cid/CID");var Ke={...ke,...qe,...je,...Te,...Oe,...Fe,...Ge,...De,...Ve,...ze},vo={...Re,...Le};function St(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Qt=St("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),He=St("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=H(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),xn={utf8:Qt,"utf-8":Qt,hex:Ke.base16,latin1:He,ascii:He,binary:He,...Ke},le=xn;function pe(r,e="utf8"){let t=le[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}var de=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var _o=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var To={}.toString;function Dt(r=32){if(de&&typeof de.getRandomValues=="function")return de.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}function xe(r,e="utf8"){let t=le[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}function ee(r){if(isNaN(r)||r<=0)throw new J("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Dt(r)}function z(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var ge=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.name="AbortError",this.code=t??"ABORT_ERR"}};async function Nt(r,e,t){if(e==null)return r;if(e.aborted)return Promise.reject(new ge(t?.errorMessage,t?.errorCode));let n,o=new ge(t?.errorMessage,t?.errorCode);try{return await Promise.race([r,new Promise((i,f)=>{n=()=>{f(o)},e.addEventListener("abort",n)})])}finally{n!=null&&e.removeEventListener("abort",n)}}var Je=class{readNext;haveNext;ended;nextResult;constructor(){this.ended=!1,this.readNext=z(),this.haveNext=z()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=z(),e}async throw(e){return this.ended=!0,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return await this._push(void 0),e}async push(e,t){await this._push(e,t)}async end(e,t){e!=null?await this.throw(e):await this._push(void 0,t)}async _push(e,t){if(e!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=z(),await Nt(this.readNext.promise,t?.signal,t)}};function Lt(){return new Je}var Mt=Symbol.for("@achingbrain/uint8arraylist");function Ut(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function be(r){return!!r?.[Mt]}var ae=class r{bufs;length;[Mt]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(be(n))t+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(be(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Ut(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Ut(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(be(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return _e(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:_e(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),i=new r;return i.length=o,i.bufs=[...n],i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let f=this.bufs[i],a=o,c=a+f.byteLength;if(o=c,e>=c)continue;let w=e>=a&&e<c,l=t>a&&t<=c;if(w&&l){if(e===a&&t===c){n.push(f);break}let h=e-a;n.push(f.subarray(h,h+(t-e)));break}if(w){if(e===0){n.push(f);continue}n.push(f.subarray(e-a));continue}if(l){if(t===c){n.push(f);break}n.push(f.subarray(0,t-a));break}n.push(f)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!be(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,f=new Int32Array(i);for(let h=0;h<i;h++)f[h]=-1;for(let h=0;h<o;h++)f[n[h]]=h;let a=f,c=this.byteLength-n.byteLength,w=n.byteLength-1,l;for(let h=t;h<=c;h+=l){l=0;for(let I=w;I>=0;I--){let q=this.get(h+I);if(n[I]!==q){l=Math.max(1,I-a[q]);break}}if(l===0)return h}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=H(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=k(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=k(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=k(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=H(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=k(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=k(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=k(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=k(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=k(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Et(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,i)=>o+i.byteLength,0)),n.length=t,n}};var ye=class extends Error{code;constructor(e,t){super(e),this.code=t}},Ye=class extends ye{type;constructor(e){super(e,"ABORT_ERR"),this.type="aborted"}};function Rt(r,e){let t=Lt();r.sink(t).catch(async f=>{await t.end(f)}),r.sink=async f=>{for await(let a of f)await t.push(a);await t.end()};let n=r.source;r.source[Symbol.iterator]!=null?n=r.source[Symbol.iterator]():r.source[Symbol.asyncIterator]!=null&&(n=r.source[Symbol.asyncIterator]());let o=new ae;return{read:async(f,a)=>{a?.signal?.throwIfAborted();let c,w=new Promise((l,h)=>{c=()=>{h(new Ye("Read aborted"))},a?.signal?.addEventListener("abort",c)});try{if(f==null){let{done:h,value:I}=await Promise.race([n.next(),w]);return h===!0?new ae:I}for(;o.byteLength<f;){let{value:h,done:I}=await Promise.race([n.next(),w]);if(I===!0)throw new ye("unexpected end of input","ERR_UNEXPECTED_EOF");o.append(h)}let l=o.sublist(0,f);return o.consume(f),l}finally{c!=null&&a?.signal?.removeEventListener("abort",c)}},write:async(f,a)=>{a?.signal?.throwIfAborted(),f instanceof Uint8Array?await t.push(f,a):await t.push(f.subarray(),a)},unwrap:()=>{if(o.byteLength>0){let f=r.source;r.source=async function*(){e?.yieldBytes===!1?yield o:yield*o,yield*f}()}return r}}}function gn(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var _t=gn;function bn(r){return r[Symbol.asyncIterator]!=null}function yn(r,e){let t=0;if(bn(r))return async function*(){for await(let c of r)yield e(c,t++)}();let n=_t(r),{value:o,done:i}=n.next();if(i===!0)return function*(){}();let f=e(o,t++);if(typeof f.then=="function")return async function*(){yield await f;for await(let c of n)yield e(c,t++)}();let a=e;return function*(){yield f;for(let c of n)yield a(c,t++)}()}var Tt=yn;function Xe(){let r=z(),e=!1;return{sink:async t=>{if(e)throw new Error("already piped");e=!0,r.resolve(t)},source:async function*(){yield*await r.promise}()}}function Ot(){let r=Xe(),e=Xe();return[{source:r.source,sink:e.sink},{source:e.source,sink:r.sink}]}var we=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},te=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new we(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new we(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var We=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function me(r={}){return wn(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function wn(r,e){e=e??{};let t=e.onEnd,n=new te,o,i,f,a=z(),c=async()=>{try{return n.isEmpty()?f?{done:!0}:await new Promise((u,E)=>{i=U=>{i=null,n.push(U);try{u(r(n))}catch(N){E(N)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=z()})}},w=u=>i!=null?i(u):(n.push(u),o),l=u=>(n=new te,i!=null?i({error:u}):(n.push({error:u}),o)),h=u=>{if(f)return o;if(e?.objectMode!==!0&&u?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return w({done:!1,value:u})},I=u=>f?o:(f=!0,u!=null?l(u):w({done:!0})),q=()=>(n=new te,I(),{done:!0}),p=u=>(I(u),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:c,return:q,throw:p,push:h,end:I,get readableLength(){return n.size},onEmpty:async u=>{let E=u?.signal;if(E?.throwIfAborted(),n.isEmpty())return;let U,N;E!=null&&(U=new Promise((A,d)=>{N=()=>{d(new We)},E.addEventListener("abort",N)}));try{await Promise.race([a.promise,U])}finally{N!=null&&E!=null&&E?.removeEventListener("abort",N)}}},t==null)return o;let m=o;return o={[Symbol.asyncIterator](){return this},next(){return m.next()},throw(u){return m.throw(u),t!=null&&(t(u),t=void 0),{done:!0}},return(){return m.return(),t!=null&&(t(),t=void 0),{done:!0}},push:h,end(u){return m.end(u),t!=null&&(t(u),t=void 0),o},get readableLength(){return m.readableLength},onEmpty:u=>m.onEmpty(u)},o}function mn(r){return r[Symbol.asyncIterator]!=null}function En(...r){let e=[];for(let t of r)mn(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=me({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let o of n)t.push(o)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var qt=En;function zt(r,...e){if(r==null)throw new Error("Empty pipeline");if($e(r)){let n=r;r=()=>n.source}else if(Gt(r)||Ft(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&$e(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let n=1;n<t.length-1;n++)$e(t[n])&&(t[n]=Bn(t[n]));return In(...t)}var In=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},Ft=r=>r?.[Symbol.asyncIterator]!=null,Gt=r=>r?.[Symbol.iterator]!=null,$e=r=>r==null?!1:r.sink!=null&&r.source!=null,Bn=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=me({objectMode:!0});t.then(()=>{n.end()},f=>{n.end(f)});let o,i=r.source;if(Ft(i))o=async function*(){yield*i,n.end()};else if(Gt(i))o=function*(){yield*i,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return qt(n,o())}return r.source};var nt=ir(Ht(),1);var et="Your private shared key is invalid";var Jt="No connection for the handshake provided";var Yt="ERR_INVALID_PARAMETERS";function Wt(r){let e=xe(ee(rt),"base16"),t=pe(`/key/swarm/psk/1.0.0/
7
3
  /base16/
8
- `+e);r instanceof Uint8Array?r.set(t):r.write(t)}var dn=24,gn=32;function fi(r,e){let t=(0,pn.default)(r,e);return n=>async function*(){for await(let s of n)yield Uint8Array.from(t.update(s.subarray()))}()}function hi(r,e){return t=>async function*(){let n=(0,pn.default)(r,e);for await(let s of t)yield Uint8Array.from(n.update(s.subarray()))}()}function di(r){try{let e=ye(r).split(/(?:\r\n|\r|\n)/g),t=e.shift(),n=e.shift(),s=e.shift(),i=X(s??"","base16");if(i.byteLength!==gn)throw new Error(hn);return{tag:t,codecName:n,psk:i}}catch{throw new Error(hn)}}var yn=class{tag;log;psk;timeout;constructor(e,t){this.log=e.logger.forComponent("libp2p:pnet"),this.timeout=t.timeout??1e3;let n=di(t.psk);this.psk=n.psk,this.tag=n.tag??""}async protect(e){if(e==null)throw new H(ai,li);this.log("protecting the connection");let t=ae(dn),n=AbortSignal.timeout(this.timeout),s=qs(e),[,i]=await Promise.all([s.write(t,{signal:n}),s.read(dn,{signal:n})]),o=i.subarray();this.log("exchanged nonces");let[l,c]=Ys();return Xs(c,fi(t,this.psk),s.unwrap(),f=>Js(f,h=>h.subarray()),hi(o,this.psk),c).catch(this.log.error),{...e,...l}}};function ma(r){return e=>new yn(e,r)}return bi(Aa);})();
4
+ `+e);r instanceof Uint8Array?r.set(t):r.write(t)}var tt=24,rt=32;function $t(r,e){let t=(0,nt.default)(r,e);return n=>async function*(){for await(let o of n)yield Uint8Array.from(t.update(o.subarray()))}()}function Zt(r,e){return t=>async function*(){let n=(0,nt.default)(r,e);for await(let o of t)yield Uint8Array.from(n.update(o.subarray()))}()}function er(r){try{let e=xe(r).split(/(?:\r\n|\r|\n)/g),t=e.shift(),n=e.shift(),o=e.shift(),i=pe(o??"","base16");if(i.byteLength!==rt)throw new Error(et);return{tag:t,codecName:n,psk:i}}catch{throw new Error(et)}}var ot=class{tag;log;psk;timeout;constructor(e,t){this.log=e.logger.forComponent("libp2p:pnet"),this.timeout=t.timeout??1e3;let n=er(t.psk);this.psk=n.psk,this.tag=n.tag??""}async protect(e){if(e==null)throw new J(Jt,Yt);this.log("protecting the connection");let t=ee(tt),n=AbortSignal.timeout(this.timeout),o=Rt(e),[,i]=await Promise.all([o.write(t,{signal:n}),o.read(tt,{signal:n})]),f=i.subarray();this.log("exchanged nonces");let[a,c]=Ot();return zt(c,$t(t,this.psk),o.unwrap(),w=>Tt(w,l=>l.subarray()),Zt(f,this.psk),c).catch(this.log.error),{...e,...a}}};function Nn(r){return e=>new ot(e,r)}return fr(Ln);})();
9
5
  /*! Bundled license information:
10
6
 
11
- pvtsutils/build/index.js:
12
- (*!
13
- * MIT License
14
- *
15
- * Copyright (c) 2017-2022 Peculiar Ventures, LLC
16
- *
17
- * Permission is hereby granted, free of charge, to any person obtaining a copy
18
- * of this software and associated documentation files (the "Software"), to deal
19
- * in the Software without restriction, including without limitation the rights
20
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
- * copies of the Software, and to permit persons to whom the Software is
22
- * furnished to do so, subject to the following conditions:
23
- *
24
- * The above copyright notice and this permission notice shall be included in all
25
- * copies or substantial portions of the Software.
26
- *
27
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
- * SOFTWARE.
34
- *
35
- *)
36
-
37
7
  @noble/hashes/esm/utils.js:
38
8
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
39
-
40
- pvutils/build/utils.es.js:
41
- (*!
42
- Copyright (c) Peculiar Ventures, LLC
43
- *)
44
-
45
- asn1js/build/index.es.js:
46
- (*!
47
- * Copyright (c) 2014, GMO GlobalSign
48
- * Copyright (c) 2015-2022, Peculiar Ventures
49
- * All rights reserved.
50
- *
51
- * Author 2014-2019, Yury Strozhevsky
52
- *
53
- * Redistribution and use in source and binary forms, with or without modification,
54
- * are permitted provided that the following conditions are met:
55
- *
56
- * * Redistributions of source code must retain the above copyright notice, this
57
- * list of conditions and the following disclaimer.
58
- *
59
- * * Redistributions in binary form must reproduce the above copyright notice, this
60
- * list of conditions and the following disclaimer in the documentation and/or
61
- * other materials provided with the distribution.
62
- *
63
- * * Neither the name of the copyright holder nor the names of its
64
- * contributors may be used to endorse or promote products derived from
65
- * this software without specific prior written permission.
66
- *
67
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
68
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
69
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
70
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
71
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
72
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
73
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
74
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
75
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
76
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
77
- *
78
- *)
79
9
  */
80
10
  return Libp2PPnet}));
@@ -45,7 +45,7 @@
45
45
  *
46
46
  * ### Programmatically
47
47
  *
48
- * ```js
48
+ * ```TypeScript
49
49
  * import fs from 'fs'
50
50
  * import { generateKey } from '@libp2p/pnet'
51
51
  *
package/dist/src/index.js CHANGED
@@ -45,7 +45,7 @@
45
45
  *
46
46
  * ### Programmatically
47
47
  *
48
- * ```js
48
+ * ```TypeScript
49
49
  * import fs from 'fs'
50
50
  * import { generateKey } from '@libp2p/pnet'
51
51
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/pnet",
3
- "version": "1.0.0-856ccd708",
3
+ "version": "1.0.0-863b3de03",
4
4
  "description": "Implementation of Connection protection management via a shared secret",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/pnet#readme",
@@ -46,27 +46,29 @@
46
46
  "test:firefox": "aegir test -t browser -- --browser firefox",
47
47
  "test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
48
48
  "test:node": "aegir test -t node --cov",
49
- "dep-check": "aegir dep-check"
49
+ "dep-check": "aegir dep-check",
50
+ "doc-check": "aegir doc-check"
50
51
  },
51
52
  "dependencies": {
52
- "@libp2p/crypto": "3.0.4-856ccd708",
53
- "@libp2p/interface": "1.1.1-856ccd708",
54
- "it-byte-stream": "^1.0.5",
55
- "it-map": "^3.0.4",
53
+ "@libp2p/crypto": "4.1.3-863b3de03",
54
+ "@libp2p/interface": "1.4.1-863b3de03",
55
+ "it-byte-stream": "^1.0.10",
56
+ "it-map": "^3.1.0",
56
57
  "it-pair": "^2.0.6",
57
58
  "it-pipe": "^3.0.1",
58
59
  "it-stream-types": "^2.0.1",
59
- "uint8arraylist": "^2.4.7",
60
- "uint8arrays": "^5.0.0",
61
- "xsalsa20": "^1.1.0"
60
+ "uint8arraylist": "^2.4.8",
61
+ "uint8arrays": "^5.1.0",
62
+ "xsalsa20": "^1.2.0"
62
63
  },
63
64
  "devDependencies": {
64
- "@libp2p/interface-compliance-tests": "5.1.1-856ccd708",
65
- "@libp2p/logger": "4.0.4-856ccd708",
66
- "@libp2p/peer-id-factory": "4.0.3-856ccd708",
67
- "@multiformats/multiaddr": "^12.1.10",
68
- "@types/xsalsa20": "^1.1.0",
69
- "aegir": "^42.0.0",
70
- "it-all": "^3.0.3"
71
- }
65
+ "@libp2p/interface-compliance-tests": "5.4.6-863b3de03",
66
+ "@libp2p/logger": "4.0.14-863b3de03",
67
+ "@libp2p/peer-id-factory": "4.1.3-863b3de03",
68
+ "@multiformats/multiaddr": "^12.2.3",
69
+ "@types/xsalsa20": "^1.1.3",
70
+ "aegir": "^43.0.1",
71
+ "it-all": "^3.0.6"
72
+ },
73
+ "sideEffects": false
72
74
  }
package/src/index.ts CHANGED
@@ -45,7 +45,7 @@
45
45
  *
46
46
  * ### Programmatically
47
47
  *
48
- * ```js
48
+ * ```TypeScript
49
49
  * import fs from 'fs'
50
50
  * import { generateKey } from '@libp2p/pnet'
51
51
  *