@libp2p/webrtc 5.0.19-0862522fe → 5.0.19-4a85eb033
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/dist/index.min.js +2 -2
- package/package.json +8 -8
package/dist/index.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PWebrtc = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
2
|
-
"use strict";var Libp2PWebrtc=(()=>{var Sh=Object.create;var Fn=Object.defineProperty;var Bh=Object.getOwnPropertyDescriptor;var Ih=Object.getOwnPropertyNames;var Ch=Object.getPrototypeOf,kh=Object.prototype.hasOwnProperty;var Th=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Ct=(r,t)=>{for(var e in t)Fn(r,e,{get:t[e],enumerable:!0})},Nc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ih(t))!kh.call(r,o)&&o!==e&&Fn(r,o,{get:()=>t[o],enumerable:!(n=Bh(t,o))||n.enumerable});return r};var Nh=(r,t,e)=>(e=r!=null?Sh(Ch(r)):{},Nc(t||!r||!r.__esModule?Fn(e,"default",{value:r,enumerable:!0}):e,r)),Lh=r=>Nc(Fn({},"__esModule",{value:!0}),r);var Nl=Th(Tr=>{"use strict";var tm="[object ArrayBuffer]",be=class r{static isArrayBuffer(t){return Object.prototype.toString.call(t)===tm}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){let n=r.toUint8Array(t),o=r.toUint8Array(e);if(n.length!==o.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==o[s])return!1;return!0}static concat(...t){let e;Array.isArray(t[0])&&!(t[1]instanceof Function)||Array.isArray(t[0])&&t[1]instanceof Function?e=t[0]:t[t.length-1]instanceof Function?e=t.slice(0,t.length-1):e=t;let n=0;for(let i of e)n+=i.byteLength;let o=new Uint8Array(n),s=0;for(let i of e){let a=this.toUint8Array(i);o.set(a,s),s+=a.length}return t[t.length-1]instanceof Function?this.toView(o,t[t.length-1]):o.buffer}},la="string",em=/^[0-9a-f]+$/i,rm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,nm=/^[a-zA-Z0-9-_]+$/,po=class{static fromString(t){let e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n.buffer}static toString(t){let e=be.toUint8Array(t),n="";for(let s=0;s<e.length;s++)n+=String.fromCharCode(e[s]);return decodeURIComponent(escape(n))}},qt=class{static toString(t,e=!1){let n=be.toArrayBuffer(t),o=new DataView(n),s="";for(let i=0;i<n.byteLength;i+=2){let a=o.getUint16(i,e);s+=String.fromCharCode(a)}return s}static fromString(t,e=!1){let n=new ArrayBuffer(t.length*2),o=new DataView(n);for(let s=0;s<t.length;s++)o.setUint16(s*2,t.charCodeAt(s),e);return n}},mo=class r{static isHex(t){return typeof t===la&&em.test(t)}static isBase64(t){return typeof t===la&&rm.test(t)}static isBase64Url(t){return typeof t===la&&nm.test(t)}static ToString(t,e="utf8"){let n=be.toUint8Array(t);switch(e.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 qt.toString(n,!0);case"utf16":case"utf16be":return qt.toString(n);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return qt.fromString(t,!0);case"utf16":case"utf16be":return qt.fromString(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){let e=be.toUint8Array(t);if(typeof btoa<"u"){let n=this.ToString(e,"binary");return btoa(n)}else return Buffer.from(e).toString("base64")}static FromBase64(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(e)):new Uint8Array(Buffer.from(e,"base64")).buffer}static FromBase64Url(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.FromBinary(t);case"utf8":return po.fromString(t);case"utf16":case"utf16be":return qt.fromString(t);case"utf16le":case"usc2":return qt.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.ToBinary(t);case"utf8":return po.toString(t);case"utf16":case"utf16be":return qt.toString(t);case"utf16le":case"usc2":return qt.toString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromBinary(t){let e=t.length,n=new Uint8Array(e);for(let o=0;o<e;o++)n[o]=t.charCodeAt(o);return n.buffer}static ToBinary(t){let e=be.toUint8Array(t),n="";for(let o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n}static ToHex(t){let e=be.toUint8Array(t),n="",o=e.length;for(let s=0;s<o;s++){let i=e[s];i<16&&(n+="0"),n+=i.toString(16)}return n}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o=o+2){let s=e.slice(o,o+2);n[o/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(t,e=!1){return qt.toString(t,e)}static FromUtf16String(t,e=!1){return qt.fromString(t,e)}static Base64Padding(t){let e=4-t.length%4;if(e<4)for(let n=0;n<e;n++)t+="=";return t}static formatString(t){return t?.replace(/[\n\r\t ]/g,"")||""}};mo.DEFAULT_UTF8_ENCODING="utf8";function om(r,...t){let e=arguments[0];for(let n=1;n<arguments.length;n++){let o=arguments[n];for(let s in o)e[s]=o[s]}return e}function sm(...r){let t=r.map(o=>o.byteLength).reduce((o,s)=>o+s),e=new Uint8Array(t),n=0;return r.map(o=>new Uint8Array(o)).forEach(o=>{for(let s of o)e[n++]=s}),e.buffer}function im(r,t){if(!(r&&t)||r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)if(e[o]!==n[o])return!1;return!0}Tr.BufferSourceConverter=be;Tr.Convert=mo;Tr.assign=om;Tr.combine=sm;Tr.isEqual=im});var lg={};Ct(lg,{webRTC:()=>cg,webRTCDirect:()=>ag});var ti=Symbol.for("@libp2p/peer-id");var Kn=Symbol.for("@libp2p/transport");var Lc;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Lc||(Lc={}));var $n=class extends Error{static name="UnexpectedPeerError";constructor(t="Unexpected Peer"){super(t),this.name="UnexpectedPeerError"}};var tt=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},gr=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var Wn=class extends Error{static name="ConnectionFailedError";constructor(t="Connection failed"){super(t),this.name="ConnectionFailedError"}};var qn=class extends Error{static name="StreamResetError";constructor(t="The stream has been reset"){super(t),this.name="StreamResetError"}},je=class extends Error{static name="StreamStateError";constructor(t="The stream is in an invalid state"){super(t),this.name="StreamStateError"}};var zn=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var Gn=class extends Error{static name="InvalidMessageError";constructor(t="Invalid message"){super(t),this.name="InvalidMessageError"}};var jr=class extends Error{static name="TimeoutError";constructor(t="Timed out"){super(t),this.name="TimeoutError"}};var Ze=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var jn=(r,...t)=>{try{[...t]}catch{}};var Zn=class extends EventTarget{#t=new Map;constructor(){super(),jn(1/0,this)}listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:s})=>s!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e={}){return this.dispatchEvent(new CustomEvent(t,e))}};var yr=Symbol.for("@libp2p/service-capabilities"),_c=Symbol.for("@libp2p/service-dependencies");var si={};Ct(si,{base58btc:()=>nt,base58flickr:()=>Oh});var Vg=new Uint8Array(0);function Rc(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function fe(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 Uc(r){return new TextEncoder().encode(r)}function Dc(r){return new TextDecoder().decode(r)}function _h(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(e[i]!==255)throw new TypeError(s+" is ambiguous");e[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var g=0,h=0,y=0,b=x.length;y!==b&&x[y]===0;)y++,g++;for(var p=(b-y)*u+1>>>0,B=new Uint8Array(p);y!==b;){for(var L=x[y],N=0,S=p-1;(L!==0||N<h)&&S!==-1;S--,N++)L+=256*B[S]>>>0,B[S]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");h=N,y++}for(var k=p-h;k!==p&&B[k]===0;)k++;for(var I=c.repeat(g);k<p;++k)I+=r.charAt(B[k]);return I}function d(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var g=0;if(x[g]!==" "){for(var h=0,y=0;x[g]===c;)h++,g++;for(var b=(x.length-g)*l+1>>>0,p=new Uint8Array(b);x[g];){var B=e[x.charCodeAt(g)];if(B===255)return;for(var L=0,N=b-1;(B!==0||L<y)&&N!==-1;N--,L++)B+=a*p[N]>>>0,p[N]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");y=L,g++}if(x[g]!==" "){for(var S=b-y;S!==b&&p[S]===0;)S++;for(var k=new Uint8Array(h+(b-S)),I=h;S!==b;)k[I++]=p[S++];return k}}}function m(x){var g=d(x);if(g)return g;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:d,decode:m}}var Rh=_h,Uh=Rh,Oc=Uh;var ei=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},ri=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let o=e.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Hc(this,t)}},ni=class{decoders;constructor(t){this.decoders=t}or(t){return Hc(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Hc(r,t){return new ni({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var oi=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new ei(t,e,n),this.decoder=new ri(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function wr({name:r,prefix:t,encode:e,decode:n}){return new oi(r,t,e,n)}function Le({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Oc(e,r);return wr({prefix:t,name:r,encode:n,decode:s=>fe(o(s))})}function Dh(r,t,e,n){let o={};for(let u=0;u<t.length;++u)o[t[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*e/8|0),a=0,c=0,l=0;for(let u=0;u<s;++u){let f=o[r[u]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|f,a+=e,a>=8&&(a-=8,i[l++]=255&c>>a)}if(a>=e||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i}function Ph(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>e;)i-=e,s+=t[o&a>>i];if(i!==0&&(s+=t[o&a<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function dt({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return wr({prefix:t,name:r,encode(o){return Ph(o,n,e)},decode(o){return Dh(o,n,e,r)}})}var nt=Le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Oh=Le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ii={};Ct(ii,{base32:()=>he,base32hex:()=>Fh,base32hexpad:()=>$h,base32hexpadupper:()=>Wh,base32hexupper:()=>Kh,base32pad:()=>Mh,base32padupper:()=>Vh,base32upper:()=>Hh,base32z:()=>qh});var he=dt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Hh=dt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mh=dt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vh=dt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fh=dt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Kh=dt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$h=dt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Wh=dt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qh=dt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ai={};Ct(ai,{base36:()=>Zr,base36upper:()=>zh});var Zr=Le({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),zh=Le({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Gt={};Ct(Gt,{Digest:()=>Xe,create:()=>Ot,decode:()=>_e,equals:()=>li,hasCode:()=>fd});var Gh=Fc,Mc=128,jh=127,Zh=~jh,Xh=Math.pow(2,31);function Fc(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Xh;)t[e++]=r&255|Mc,r/=128;for(;r&Zh;)t[e++]=r&255|Mc,r>>>=7;return t[e]=r|0,Fc.bytes=e-n+1,t}var Yh=ci,Jh=128,Vc=127;function ci(r,n){var e=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw ci.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&Vc)<<o:(i&Vc)*Math.pow(2,o),o+=7}while(i>=Jh);return ci.bytes=s-n,e}var Qh=Math.pow(2,7),td=Math.pow(2,14),ed=Math.pow(2,21),rd=Math.pow(2,28),nd=Math.pow(2,35),od=Math.pow(2,42),sd=Math.pow(2,49),id=Math.pow(2,56),ad=Math.pow(2,63),cd=function(r){return r<Qh?1:r<td?2:r<ed?3:r<rd?4:r<nd?5:r<od?6:r<sd?7:r<id?8:r<ad?9:10},ld={encode:Gh,decode:Yh,encodingLength:cd},ud=ld,Xr=ud;function Yr(r,t=0){return[Xr.decode(r,t),Xr.decode.bytes]}function br(r,t,e=0){return Xr.encode(r,t,e),t}function xr(r){return Xr.encodingLength(r)}function Ot(r,t){let e=t.byteLength,n=xr(r),o=n+xr(e),s=new Uint8Array(o+e);return br(r,s,0),br(e,s,n),s.set(t,o),new Xe(r,e,t,s)}function _e(r){let t=fe(r),[e,n]=Yr(t),[o,s]=Yr(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Xe(e,o,i,t)}function li(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Rc(r.bytes,e.bytes)}}var Xe=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function fd(r,t){return r.code===t}function Kc(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return dd(e,ui(r),t??nt.encoder);default:return pd(e,ui(r),t??he.encoder)}}var $c=new WeakMap;function ui(r){let t=$c.get(r);if(t==null){let e=new Map;return $c.set(r,e),e}return t}var vt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,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:t,multihash:e}=this;if(t!==Jr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==md)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=Ot(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&li(t.multihash,n.multihash)}toString(t){return Kc(this,t)}toJSON(){return{"/":Kc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??Wc(n,o,s.bytes))}else if(e[gd]===!0){let{version:n,multihash:o,code:s}=e,i=_e(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Jr)throw new Error(`Version 0 CID must use dag-pb (code: ${Jr}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Wc(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Jr,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=fe(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new Xe(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[f,d]=Yr(t.subarray(e));return e+=d,f},o=n(),s=Jr;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,a=n(),c=n(),l=e+c,u=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(t,e){let[n,o]=hd(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ui(s).set(n,t),s}};function hd(r,t){switch(r[0]){case"Q":{let e=t??nt;return[nt.prefix,e.decode(`${nt.prefix}${r}`)]}case nt.prefix:{let e=t??nt;return[nt.prefix,e.decode(r)]}case he.prefix:{let e=t??he;return[he.prefix,e.decode(r)]}case Zr.prefix:{let e=t??Zr;return[Zr.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function dd(r,t,e){let{prefix:n}=e;if(n!==nt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function pd(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Jr=112,md=18;function Wc(r,t,e){let n=xr(r),o=n+xr(t),s=new Uint8Array(o+e.byteLength);return br(r,s,0),br(t,s,n),s.set(e,o),s}var gd=Symbol.for("@ipld/js-cid/CID");var fi={};Ct(fi,{identity:()=>de});var qc=0,yd="identity",zc=fe;function wd(r){return Ot(qc,zc(r))}var de={code:qc,name:yd,encode:zc,digest:wd};function Rt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Yn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function bd(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Er(r,...t){if(!bd(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Qr(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yn(r.outputLen),Yn(r.blockLen)}function vr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Gc(r,t){Er(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var Ye=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Jn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),jt=(r,t)=>r<<32-t|r>>>t;var ly=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function jc(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Re(r){return typeof r=="string"&&(r=jc(r)),Er(r),r}function hi(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Er(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var Ar=class{clone(){return this._cloneInto()}},uy={}.toString;function Qn(r){let t=n=>r().update(Re(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function tn(r=32){if(Ye&&typeof Ye.getRandomValues=="function")return Ye.getRandomValues(new Uint8Array(r));if(Ye&&typeof Ye.randomBytes=="function")return Ye.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function xd(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),a=Number(e&s),c=n?4:0,l=n?0:4;r.setUint32(t+c,i,n),r.setUint32(t+l,a,n)}var Zc=(r,t,e)=>r&t^~r&e,Xc=(r,t,e)=>r&t^r&e^t&e,Sr=class extends Ar{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Jn(this.buffer)}update(t){vr(this);let{view:e,buffer:n,blockLen:o}=this;t=Re(t);let s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=Jn(t);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){vr(this),Gc(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let f=i;f<o;f++)e[f]=0;xd(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=Jn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)a.setUint32(4*f,u[f],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var to=BigInt(4294967295),di=BigInt(32);function Yc(r,t=!1){return t?{h:Number(r&to),l:Number(r>>di&to)}:{h:Number(r>>di&to)|0,l:Number(r&to)|0}}function Ed(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=Yc(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var vd=(r,t)=>BigInt(r>>>0)<<di|BigInt(t>>>0),Ad=(r,t,e)=>r>>>e,Sd=(r,t,e)=>r<<32-e|t>>>e,Bd=(r,t,e)=>r>>>e|t<<32-e,Id=(r,t,e)=>r<<32-e|t>>>e,Cd=(r,t,e)=>r<<64-e|t>>>e-32,kd=(r,t,e)=>r>>>e-32|t<<64-e,Td=(r,t)=>t,Nd=(r,t)=>r,Ld=(r,t,e)=>r<<e|t>>>32-e,_d=(r,t,e)=>t<<e|r>>>32-e,Rd=(r,t,e)=>t<<e-32|r>>>64-e,Ud=(r,t,e)=>r<<e-32|t>>>64-e;function Dd(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Pd=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Od=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Hd=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Md=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Vd=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Fd=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var Kd={fromBig:Yc,split:Ed,toBig:vd,shrSH:Ad,shrSL:Sd,rotrSH:Bd,rotrSL:Id,rotrBH:Cd,rotrBL:kd,rotr32H:Td,rotr32L:Nd,rotlSH:Ld,rotlSL:_d,rotlBH:Rd,rotlBL:Ud,add:Dd,add3L:Pd,add3H:Od,add4L:Hd,add4H:Md,add5H:Fd,add5L:Vd},$=Kd;var[$d,Wd]=$.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Ue=new Uint32Array(80),De=new Uint32Array(80),pi=class extends Sr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:l,El:u,Fh:f,Fl:d,Gh:m,Gl:x,Hh:g,Hl:h}=this;return[t,e,n,o,s,i,a,c,l,u,f,d,m,x,g,h]}set(t,e,n,o,s,i,a,c,l,u,f,d,m,x,g,h){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=m|0,this.Gl=x|0,this.Hh=g|0,this.Hl=h|0}process(t,e){for(let p=0;p<16;p++,e+=4)Ue[p]=t.getUint32(e),De[p]=t.getUint32(e+=4);for(let p=16;p<80;p++){let B=Ue[p-15]|0,L=De[p-15]|0,N=$.rotrSH(B,L,1)^$.rotrSH(B,L,8)^$.shrSH(B,L,7),S=$.rotrSL(B,L,1)^$.rotrSL(B,L,8)^$.shrSL(B,L,7),k=Ue[p-2]|0,I=De[p-2]|0,M=$.rotrSH(k,I,19)^$.rotrBH(k,I,61)^$.shrSH(k,I,6),_=$.rotrSL(k,I,19)^$.rotrBL(k,I,61)^$.shrSL(k,I,6),O=$.add4L(S,_,De[p-7],De[p-16]),V=$.add4H(O,N,M,Ue[p-7],Ue[p-16]);Ue[p]=V|0,De[p]=O|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:l,Dl:u,Eh:f,El:d,Fh:m,Fl:x,Gh:g,Gl:h,Hh:y,Hl:b}=this;for(let p=0;p<80;p++){let B=$.rotrSH(f,d,14)^$.rotrSH(f,d,18)^$.rotrBH(f,d,41),L=$.rotrSL(f,d,14)^$.rotrSL(f,d,18)^$.rotrBL(f,d,41),N=f&m^~f&g,S=d&x^~d&h,k=$.add5L(b,L,S,Wd[p],De[p]),I=$.add5H(k,y,B,N,$d[p],Ue[p]),M=k|0,_=$.rotrSH(n,o,28)^$.rotrBH(n,o,34)^$.rotrBH(n,o,39),O=$.rotrSL(n,o,28)^$.rotrBL(n,o,34)^$.rotrBL(n,o,39),V=n&s^n&a^s&a,C=o&i^o&c^i&c;y=g|0,b=h|0,g=m|0,h=x|0,m=f|0,x=d|0,{h:f,l:d}=$.add(l|0,u|0,I|0,M|0),l=a|0,u=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let T=$.add3L(M,O,C);n=$.add3H(T,I,_,V),o=T|0}({h:n,l:o}=$.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=$.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=$.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=$.add(this.Dh|0,this.Dl|0,l|0,u|0),{h:f,l:d}=$.add(this.Eh|0,this.El|0,f|0,d|0),{h:m,l:x}=$.add(this.Fh|0,this.Fl|0,m|0,x|0),{h:g,l:h}=$.add(this.Gh|0,this.Gl|0,g|0,h|0),{h:y,l:b}=$.add(this.Hh|0,this.Hl|0,y|0,b|0),this.set(n,o,s,i,a,c,l,u,f,d,m,x,g,h,y,b)}roundClean(){Ue.fill(0),De.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Jc=Qn(()=>new pi);var ro={};Ct(ro,{aInRange:()=>At,abool:()=>Zt,abytes:()=>Br,bitGet:()=>Xd,bitLen:()=>bi,bitMask:()=>rn,bitSet:()=>Yd,bytesToHex:()=>me,bytesToNumberBE:()=>ge,bytesToNumberLE:()=>Xt,concatBytes:()=>we,createHmacDrbg:()=>xi,ensureBytes:()=>it,equalBytes:()=>jd,hexToBytes:()=>Qe,hexToNumber:()=>wi,inRange:()=>en,isBytes:()=>Pe,memoized:()=>tr,notImplemented:()=>Qd,numberToBytesBE:()=>Oe,numberToBytesLE:()=>ye,numberToHexUnpadded:()=>Je,numberToVarBytesBE:()=>Gd,utf8ToBytes:()=>Zd,validateObject:()=>Wt});var yi=BigInt(0),eo=BigInt(1),qd=BigInt(2);function Pe(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Br(r){if(!Pe(r))throw new Error("Uint8Array expected")}function Zt(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}var zd=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function me(r){Br(r);let t="";for(let e=0;e<r.length;e++)t+=zd[r[e]];return t}function Je(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function wi(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var pe={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Qc(r){if(r>=pe._0&&r<=pe._9)return r-pe._0;if(r>=pe._A&&r<=pe._F)return r-(pe._A-10);if(r>=pe._a&&r<=pe._f)return r-(pe._a-10)}function Qe(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=Qc(r.charCodeAt(s)),a=Qc(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function ge(r){return wi(me(r))}function Xt(r){return Br(r),wi(me(Uint8Array.from(r).reverse()))}function Oe(r,t){return Qe(r.toString(16).padStart(t*2,"0"))}function ye(r,t){return Oe(r,t).reverse()}function Gd(r){return Qe(Je(r))}function it(r,t,e){let n;if(typeof t=="string")try{n=Qe(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(Pe(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function we(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Br(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function jd(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function Zd(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var mi=r=>typeof r=="bigint"&&yi<=r;function en(r,t,e){return mi(r)&&mi(t)&&mi(e)&&t<=r&&r<e}function At(r,t,e,n){if(!en(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function bi(r){let t;for(t=0;r>yi;r>>=eo,t+=1);return t}function Xd(r,t){return r>>BigInt(t)&eo}function Yd(r,t,e){return r|(e?eo:yi)<<BigInt(t)}var rn=r=>(qd<<BigInt(r-1))-eo,gi=r=>new Uint8Array(r),tl=r=>Uint8Array.from(r);function xi(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=gi(r),o=gi(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...f)=>e(o,n,...f),c=(f=gi())=>{o=a(tl([0]),f),n=a(),f.length!==0&&(o=a(tl([1]),f),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0,d=[];for(;f<t;){n=a();let m=n.slice();d.push(m),f+=n.length}return we(...d)};return(f,d)=>{i(),c(f);let m;for(;!(m=d(l()));)c();return i(),m}}var Jd={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Pe(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Wt(r,t,e={}){let n=(o,s,i)=>{let a=Jd[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let c=r[o];if(!(i&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(o)}=${c} (${typeof c}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var Qd=()=>{throw new Error("not implemented")};function tr(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let s=r(e,...n);return t.set(e,s),s}}var gt=BigInt(0),ft=BigInt(1),er=BigInt(2),tp=BigInt(3),Ei=BigInt(4),el=BigInt(5),rl=BigInt(8),ep=BigInt(9),rp=BigInt(16);function Z(r,t){let e=r%t;return e>=gt?e:t+e}function vi(r,t,e){if(e<=gt||t<gt)throw new Error("Expected power/modulo > 0");if(e===ft)return gt;let n=ft;for(;t>gt;)t&ft&&(n=n*r%e),r=r*r%e,t>>=ft;return n}function at(r,t,e){let n=r;for(;t-- >gt;)n*=n,n%=e;return n}function no(r,t){if(r===gt||t<=gt)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Z(r,t),n=t,o=gt,s=ft,i=ft,a=gt;for(;e!==gt;){let l=n/e,u=n%e,f=o-i*l,d=s-a*l;n=e,e=u,o=i,s=a,i=f,a=d}if(n!==ft)throw new Error("invert: does not exist");return Z(o,t)}function np(r){let t=(r-ft)/er,e,n,o;for(e=r-ft,n=0;e%er===gt;e/=er,n++);for(o=er;o<r&&vi(o,t,r)!==r-ft;o++);if(n===1){let i=(r+ft)/Ei;return function(c,l){let u=c.pow(l,i);if(!c.eql(c.sqr(u),l))throw new Error("Cannot find square root");return u}}let s=(e+ft)/er;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let l=n,u=a.pow(a.mul(a.ONE,o),e),f=a.pow(c,s),d=a.pow(c,e);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let m=1;for(let g=a.sqr(d);m<l&&!a.eql(g,a.ONE);m++)g=a.sqr(g);let x=a.pow(u,ft<<BigInt(l-m-1));u=a.sqr(x),f=a.mul(f,x),d=a.mul(d,u),l=m}return f}}function op(r){if(r%Ei===tp){let t=(r+ft)/Ei;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%rl===el){let t=(r-el)/rl;return function(n,o){let s=n.mul(o,er),i=n.pow(s,t),a=n.mul(o,i),c=n.mul(n.mul(a,er),i),l=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(l),o))throw new Error("Cannot find square root");return l}}return r%rp,np(r)}var nl=(r,t)=>(Z(r,t)&ft)===ft,sp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ai(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=sp.reduce((n,o)=>(n[o]="function",n),t);return Wt(r,e)}function ip(r,t,e){if(e<gt)throw new Error("Expected power > 0");if(e===gt)return r.ONE;if(e===ft)return t;let n=r.ONE,o=t;for(;e>gt;)e&ft&&(n=r.mul(n,o)),o=r.sqr(o),e>>=ft;return n}function ap(r,t){let e=new Array(t.length),n=t.reduce((s,i,a)=>r.is0(i)?s:(e[a]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,a)=>r.is0(i)?s:(e[a]=r.mul(s,e[a]),r.mul(s,i)),o),e}function Si(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function He(r,t,e=!1,n={}){if(r<=gt)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=Si(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=op(r),a=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:rn(o),ZERO:gt,ONE:ft,create:c=>Z(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return gt<=c&&c<r},is0:c=>c===gt,isOdd:c=>(c&ft)===ft,neg:c=>Z(-c,r),eql:(c,l)=>c===l,sqr:c=>Z(c*c,r),add:(c,l)=>Z(c+l,r),sub:(c,l)=>Z(c-l,r),mul:(c,l)=>Z(c*l,r),pow:(c,l)=>ip(a,c,l),div:(c,l)=>Z(c*no(l,r),r),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>no(c,r),sqrt:n.sqrt||(c=>i(a,c)),invertBatch:c=>ap(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>e?ye(c,s):Oe(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return e?Xt(c):ge(c)}});return Object.freeze(a)}function ol(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Bi(r){let t=ol(r);return t+Math.ceil(t/2)}function sl(r,t,e=!1){let n=r.length,o=ol(t),s=Bi(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?ge(r):Xt(r),a=Z(i,t-ft)+ft;return e?ye(a,o):Oe(a,o)}var lp=BigInt(0),Ii=BigInt(1),Ci=new WeakMap,il=new WeakMap;function oo(r,t){let e=(s,i)=>{let a=i.negate();return s?a:i},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},o=s=>{n(s);let i=Math.ceil(t/s)+1,a=2**(s-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(s,i){let a=r.ZERO,c=s;for(;i>lp;)i&Ii&&(a=a.add(c)),c=c.double(),i>>=Ii;return a},precomputeWindow(s,i){let{windows:a,windowSize:c}=o(i),l=[],u=s,f=u;for(let d=0;d<a;d++){f=u,l.push(f);for(let m=1;m<c;m++)f=f.add(u),l.push(f);u=f.double()}return l},wNAF(s,i,a){let{windows:c,windowSize:l}=o(s),u=r.ZERO,f=r.BASE,d=BigInt(2**s-1),m=2**s,x=BigInt(s);for(let g=0;g<c;g++){let h=g*l,y=Number(a&d);a>>=x,y>l&&(y-=m,a+=Ii);let b=h,p=h+Math.abs(y)-1,B=g%2!==0,L=y<0;y===0?f=f.add(e(B,i[b])):u=u.add(e(L,i[p]))}return{p:u,f}},wNAFCached(s,i,a){let c=il.get(s)||1,l=Ci.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&Ci.set(s,a(l))),this.wNAF(c,l,i)},setWindowSize(s,i){n(i),il.set(s,i),Ci.delete(s)}}}function so(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((u,f)=>{if(!t.isValid(u))throw new Error(`wrong scalar at index ${f}`)}),e.forEach((u,f)=>{if(!(u instanceof r))throw new Error(`wrong point at index ${f}`)});let o=bi(BigInt(e.length)),s=o>12?o-3:o>4?o-2:o?2:1,i=(1<<s)-1,a=new Array(i+1).fill(r.ZERO),c=Math.floor((t.BITS-1)/s)*s,l=r.ZERO;for(let u=c;u>=0;u-=s){a.fill(r.ZERO);for(let d=0;d<n.length;d++){let m=n[d],x=Number(m>>BigInt(u)&BigInt(i));a[x]=a[x].add(e[d])}let f=r.ZERO;for(let d=a.length-1,m=r.ZERO;d>0;d--)m=m.add(a[d]),f=f.add(m);if(l=l.add(f),u!==0)for(let d=0;d<s;d++)l=l.double()}return l}function nn(r){return Ai(r.Fp),Wt(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Si(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Yt=BigInt(0),Ht=BigInt(1),io=BigInt(2),up=BigInt(8),fp={zip215:!0};function hp(r){let t=nn(r);return Wt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function al(r){let t=hp(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:a,h:c}=t,l=io<<BigInt(a*8)-Ht,u=e.create,f=He(t.n,t.nBitLength),d=t.uvRatio||((E,w)=>{try{return{isValid:!0,value:e.sqrt(E*e.inv(w))}}catch{return{isValid:!1,value:Yt}}}),m=t.adjustScalarBytes||(E=>E),x=t.domain||((E,w,A)=>{if(Zt("phflag",A),w.length||A)throw new Error("Contexts/pre-hash are not supported");return E});function g(E,w){At("coordinate "+E,w,Yt,l)}function h(E){if(!(E instanceof p))throw new Error("ExtendedPoint expected")}let y=tr((E,w)=>{let{ex:A,ey:v,ez:R}=E,U=E.is0();w==null&&(w=U?up:e.inv(R));let H=u(A*w),F=u(v*w),K=u(R*w);if(U)return{x:Yt,y:Ht};if(K!==Ht)throw new Error("invZ was invalid");return{x:H,y:F}}),b=tr(E=>{let{a:w,d:A}=t;if(E.is0())throw new Error("bad point: ZERO");let{ex:v,ey:R,ez:U,et:H}=E,F=u(v*v),K=u(R*R),W=u(U*U),j=u(W*W),ot=u(F*w),st=u(W*u(ot+K)),ut=u(j+u(A*u(F*K)));if(st!==ut)throw new Error("bad point: equation left != right (1)");let _t=u(v*R),mt=u(U*H);if(_t!==mt)throw new Error("bad point: equation left != right (2)");return!0});class p{constructor(w,A,v,R){this.ex=w,this.ey=A,this.ez=v,this.et=R,g("x",w),g("y",A),g("z",v),g("t",R),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(w){if(w instanceof p)throw new Error("extended point not allowed");let{x:A,y:v}=w||{};return g("x",A),g("y",v),new p(A,v,Ht,u(A*v))}static normalizeZ(w){let A=e.invertBatch(w.map(v=>v.ez));return w.map((v,R)=>v.toAffine(A[R])).map(p.fromAffine)}static msm(w,A){return so(p,f,w,A)}_setWindowSize(w){N.setWindowSize(this,w)}assertValidity(){b(this)}equals(w){h(w);let{ex:A,ey:v,ez:R}=this,{ex:U,ey:H,ez:F}=w,K=u(A*F),W=u(U*R),j=u(v*F),ot=u(H*R);return K===W&&j===ot}is0(){return this.equals(p.ZERO)}negate(){return new p(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:w}=t,{ex:A,ey:v,ez:R}=this,U=u(A*A),H=u(v*v),F=u(io*u(R*R)),K=u(w*U),W=A+v,j=u(u(W*W)-U-H),ot=K+H,st=ot-F,ut=K-H,_t=u(j*st),mt=u(ot*ut),Pt=u(j*ut),ue=u(st*ot);return new p(_t,mt,ue,Pt)}add(w){h(w);let{a:A,d:v}=t,{ex:R,ey:U,ez:H,et:F}=this,{ex:K,ey:W,ez:j,et:ot}=w;if(A===BigInt(-1)){let Ac=u((U-R)*(W+K)),Sc=u((U+R)*(W-K)),Qs=u(Sc-Ac);if(Qs===Yt)return this.double();let Bc=u(H*io*ot),Ic=u(F*io*j),Cc=Ic+Bc,kc=Sc+Ac,Tc=Ic-Bc,xh=u(Cc*Qs),Eh=u(kc*Tc),vh=u(Cc*Tc),Ah=u(Qs*kc);return new p(xh,Eh,Ah,vh)}let st=u(R*K),ut=u(U*W),_t=u(F*v*ot),mt=u(H*j),Pt=u((R+U)*(K+W)-st-ut),ue=mt-_t,zr=mt+_t,Gr=u(ut-A*st),gh=u(Pt*ue),yh=u(zr*Gr),wh=u(Pt*Gr),bh=u(ue*zr);return new p(gh,yh,bh,wh)}subtract(w){return this.add(w.negate())}wNAF(w){return N.wNAFCached(this,w,p.normalizeZ)}multiply(w){let A=w;At("scalar",A,Ht,n);let{p:v,f:R}=this.wNAF(A);return p.normalizeZ([v,R])[0]}multiplyUnsafe(w){let A=w;return At("scalar",A,Yt,n),A===Yt?L:this.equals(L)||A===Ht?this:this.equals(B)?this.wNAF(A).p:N.unsafeLadder(this,A)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return N.unsafeLadder(this,n).is0()}toAffine(w){return y(this,w)}clearCofactor(){let{h:w}=t;return w===Ht?this:this.multiplyUnsafe(w)}static fromHex(w,A=!1){let{d:v,a:R}=t,U=e.BYTES;w=it("pointHex",w,U),Zt("zip215",A);let H=w.slice(),F=w[U-1];H[U-1]=F&-129;let K=Xt(H),W=A?l:e.ORDER;At("pointHex.y",K,Yt,W);let j=u(K*K),ot=u(j-Ht),st=u(v*j-R),{isValid:ut,value:_t}=d(ot,st);if(!ut)throw new Error("Point.fromHex: invalid y coordinate");let mt=(_t&Ht)===Ht,Pt=(F&128)!==0;if(!A&&_t===Yt&&Pt)throw new Error("Point.fromHex: x=0 and x_0=1");return Pt!==mt&&(_t=u(-_t)),p.fromAffine({x:_t,y:K})}static fromPrivateKey(w){return I(w).point}toRawBytes(){let{x:w,y:A}=this.toAffine(),v=ye(A,e.BYTES);return v[v.length-1]|=w&Ht?128:0,v}toHex(){return me(this.toRawBytes())}}p.BASE=new p(t.Gx,t.Gy,Ht,u(t.Gx*t.Gy)),p.ZERO=new p(Yt,Ht,Ht,Yt);let{BASE:B,ZERO:L}=p,N=oo(p,a*8);function S(E){return Z(E,n)}function k(E){return S(Xt(E))}function I(E){let w=a;E=it("private key",E,w);let A=it("hashed private key",s(E),2*w),v=m(A.slice(0,w)),R=A.slice(w,2*w),U=k(v),H=B.multiply(U),F=H.toRawBytes();return{head:v,prefix:R,scalar:U,point:H,pointBytes:F}}function M(E){return I(E).pointBytes}function _(E=new Uint8Array,...w){let A=we(...w);return k(s(x(A,it("context",E),!!o)))}function O(E,w,A={}){E=it("message",E),o&&(E=o(E));let{prefix:v,scalar:R,pointBytes:U}=I(w),H=_(A.context,v,E),F=B.multiply(H).toRawBytes(),K=_(A.context,F,U,E),W=S(H+K*R);At("signature.s",W,Yt,n);let j=we(F,ye(W,e.BYTES));return it("result",j,a*2)}let V=fp;function C(E,w,A,v=V){let{context:R,zip215:U}=v,H=e.BYTES;E=it("signature",E,2*H),w=it("message",w),U!==void 0&&Zt("zip215",U),o&&(w=o(w));let F=Xt(E.slice(H,2*H)),K,W,j;try{K=p.fromHex(A,U),W=p.fromHex(E.slice(0,H),U),j=B.multiplyUnsafe(F)}catch{return!1}if(!U&&K.isSmallOrder())return!1;let ot=_(R,W.toRawBytes(),K.toRawBytes(),w);return W.add(K.multiplyUnsafe(ot)).subtract(j).clearCofactor().equals(p.ZERO)}return B._setWindowSize(8),{CURVE:t,getPublicKey:M,sign:O,verify:C,ExtendedPoint:p,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>i(e.BYTES),precompute(E=8,w=p.BASE){return w._setWindowSize(E),w.multiply(BigInt(3)),w}}}}var Ir=BigInt(0),ki=BigInt(1);function dp(r){return Wt(r,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r})}function cl(r){let t=dp(r),{P:e}=t,n=b=>Z(b,e),o=t.montgomeryBits,s=Math.ceil(o/8),i=t.nByteLength,a=t.adjustScalarBytes||(b=>b),c=t.powPminus2||(b=>vi(b,e-BigInt(2),e));function l(b,p,B){let L=n(b*(p-B));return p=n(p-L),B=n(B+L),[p,B]}let u=(t.a-BigInt(2))/BigInt(4);function f(b,p){At("u",b,Ir,e),At("scalar",p,Ir,e);let B=p,L=b,N=ki,S=Ir,k=b,I=ki,M=Ir,_;for(let V=BigInt(o-1);V>=Ir;V--){let C=B>>V&ki;M^=C,_=l(M,N,k),N=_[0],k=_[1],_=l(M,S,I),S=_[0],I=_[1],M=C;let T=N+S,E=n(T*T),w=N-S,A=n(w*w),v=E-A,R=k+I,U=k-I,H=n(U*T),F=n(R*w),K=H+F,W=H-F;k=n(K*K),I=n(L*n(W*W)),N=n(E*A),S=n(v*(E+n(u*v)))}_=l(M,N,k),N=_[0],k=_[1],_=l(M,S,I),S=_[0],I=_[1];let O=c(S);return n(N*O)}function d(b){return ye(n(b),s)}function m(b){let p=it("u coordinate",b,s);return i===32&&(p[31]&=127),Xt(p)}function x(b){let p=it("scalar",b),B=p.length;if(B!==s&&B!==i)throw new Error(`Expected ${s} or ${i} bytes, got ${B}`);return Xt(a(p))}function g(b,p){let B=m(p),L=x(b),N=f(B,L);if(N===Ir)throw new Error("Invalid private or public key received");return d(N)}let h=d(t.Gu);function y(b){return g(b,h)}return{scalarMult:g,scalarMultBase:y,getSharedSecret:(b,p)=>g(b,p),getPublicKey:b=>y(b),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:h}}var on=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ll=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Oy=BigInt(0),pp=BigInt(1),ul=BigInt(2),mp=BigInt(3),gp=BigInt(5),yp=BigInt(8);function fl(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=on,a=r*r%s*r%s,c=at(a,ul,s)*a%s,l=at(c,pp,s)*r%s,u=at(l,gp,s)*l%s,f=at(u,t,s)*u%s,d=at(f,e,s)*f%s,m=at(d,n,s)*d%s,x=at(m,o,s)*m%s,g=at(x,o,s)*m%s,h=at(g,t,s)*u%s;return{pow_p_5_8:at(h,ul,s)*r%s,b2:a}}function hl(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function wp(r,t){let e=on,n=Z(t*t*t,e),o=Z(n*n*t,e),s=fl(r*o).pow_p_5_8,i=Z(r*n*s,e),a=Z(t*i*i,e),c=i,l=Z(i*ll,e),u=a===r,f=a===Z(-r,e),d=a===Z(-r*ll,e);return u&&(i=c),(f||d)&&(i=l),nl(i,e)&&(i=Z(-i,e)),{isValid:u||f,value:i}}var bp=He(on,void 0,!0),xp={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:bp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:yp,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Jc,randomBytes:tn,adjustScalarBytes:hl,uvRatio:wp},dl=al(xp);var sn=cl({P:on,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:r=>{let t=on,{pow_p_5_8:e,b2:n}=fl(r);return Z(at(e,mp,t)*n,t)},adjustScalarBytes:hl,randomBytes:tn});var ao=32;function pl(r,t,e){return dl.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var co=class{type="Ed25519";raw;constructor(t){this.raw=Ti(t,ao)}toMultihash(){return de.digest(Cr(this))}toCID(){return vt.createV1(114,this.toMultihash())}toString(){return nt.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:Rt(this.raw,t.raw)}verify(t,e){return pl(this.raw,e,t)}};function Ni(r){return r=Ti(r,ao),new co(r)}function Ti(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new tt(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function yt(r=0){return new Uint8Array(r)}function wt(r=0){return new Uint8Array(r)}var vp=Math.pow(2,7),Ap=Math.pow(2,14),Sp=Math.pow(2,21),Li=Math.pow(2,28),_i=Math.pow(2,35),Ri=Math.pow(2,42),Ui=Math.pow(2,49),Y=128,kt=127;function ct(r){if(r<vp)return 1;if(r<Ap)return 2;if(r<Sp)return 3;if(r<Li)return 4;if(r<_i)return 5;if(r<Ri)return 6;if(r<Ui)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Di(r,t,e=0){switch(ct(r)){case 8:t[e++]=r&255|Y,r/=128;case 7:t[e++]=r&255|Y,r/=128;case 6:t[e++]=r&255|Y,r/=128;case 5:t[e++]=r&255|Y,r/=128;case 4:t[e++]=r&255|Y,r>>>=7;case 3:t[e++]=r&255|Y,r>>>=7;case 2:t[e++]=r&255|Y,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Bp(r,t,e=0){switch(ct(r)){case 8:t.set(e++,r&255|Y),r/=128;case 7:t.set(e++,r&255|Y),r/=128;case 6:t.set(e++,r&255|Y),r/=128;case 5:t.set(e++,r&255|Y),r/=128;case 4:t.set(e++,r&255|Y),r>>>=7;case 3:t.set(e++,r&255|Y),r>>>=7;case 2:t.set(e++,r&255|Y),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function Pi(r,t){let e=r[t],n=0;if(n+=e&kt,e<Y||(e=r[t+1],n+=(e&kt)<<7,e<Y)||(e=r[t+2],n+=(e&kt)<<14,e<Y)||(e=r[t+3],n+=(e&kt)<<21,e<Y)||(e=r[t+4],n+=(e&kt)*Li,e<Y)||(e=r[t+5],n+=(e&kt)*_i,e<Y)||(e=r[t+6],n+=(e&kt)*Ri,e<Y)||(e=r[t+7],n+=(e&kt)*Ui,e<Y))return n;throw new RangeError("Could not decode varint")}function Ip(r,t){let e=r.get(t),n=0;if(n+=e&kt,e<Y||(e=r.get(t+1),n+=(e&kt)<<7,e<Y)||(e=r.get(t+2),n+=(e&kt)<<14,e<Y)||(e=r.get(t+3),n+=(e&kt)<<21,e<Y)||(e=r.get(t+4),n+=(e&kt)*Li,e<Y)||(e=r.get(t+5),n+=(e&kt)*_i,e<Y)||(e=r.get(t+6),n+=(e&kt)*Ri,e<Y)||(e=r.get(t+7),n+=(e&kt)*Ui,e<Y))return n;throw new RangeError("Could not decode varint")}function oe(r,t,e=0){return t==null&&(t=wt(ct(r))),t instanceof Uint8Array?Di(r,t,e):Bp(r,t,e)}function Jt(r,t=0){return r instanceof Uint8Array?Pi(r,t):Ip(r,t)}var Oi=new Float32Array([-0]),Me=new Uint8Array(Oi.buffer);function gl(r,t,e){Oi[0]=r,t[e]=Me[0],t[e+1]=Me[1],t[e+2]=Me[2],t[e+3]=Me[3]}function yl(r,t){return Me[0]=r[t],Me[1]=r[t+1],Me[2]=r[t+2],Me[3]=r[t+3],Oi[0]}var Hi=new Float64Array([-0]),Tt=new Uint8Array(Hi.buffer);function wl(r,t,e){Hi[0]=r,t[e]=Tt[0],t[e+1]=Tt[1],t[e+2]=Tt[2],t[e+3]=Tt[3],t[e+4]=Tt[4],t[e+5]=Tt[5],t[e+6]=Tt[6],t[e+7]=Tt[7]}function bl(r,t){return Tt[0]=r[t],Tt[1]=r[t+1],Tt[2]=r[t+2],Tt[3]=r[t+3],Tt[4]=r[t+4],Tt[5]=r[t+5],Tt[6]=r[t+6],Tt[7]=r[t+7],Hi[0]}var Cp=BigInt(Number.MAX_SAFE_INTEGER),kp=BigInt(Number.MIN_SAFE_INTEGER),Kt=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return rr;if(t<Cp&&t>kp)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>xl&&(o=0n,++n>xl&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return rr;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):rr}},rr=new Kt(0,0);rr.toBigInt=function(){return 0n};rr.zzEncode=rr.zzDecode=function(){return this};rr.length=function(){return 1};var xl=4294967296n;function El(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function vl(r,t,e){if(e-t<1)return"";let o,s=[],i=0,a;for(;t<e;)a=r[t++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function Mi(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function Qt(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function lo(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var Vi=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Qt(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Qt(this,4);return lo(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Qt(this,4);return lo(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Qt(this,4);let t=yl(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw Qt(this,4);let t=bl(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw Qt(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return vl(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Qt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Qt(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new Kt(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Qt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Qt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Qt(this,8);let t=lo(this.buf,this.pos+=4),e=lo(this.buf,this.pos+=4);return new Kt(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Pi(this.buf,this.pos);return this.pos+=ct(t),t}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 Fi(r){return new Vi(r instanceof Uint8Array?r:r.subarray())}function te(r,t,e){let n=Fi(r);return t.decode(n,void 0,e)}var Ki={};Ct(Ki,{base10:()=>Tp});var Tp=Le({prefix:"9",name:"base10",alphabet:"0123456789"});var $i={};Ct($i,{base16:()=>Np,base16upper:()=>Lp});var Np=dt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Lp=dt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Wi={};Ct(Wi,{base2:()=>_p});var _p=dt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qi={};Ct(qi,{base256emoji:()=>Op});var Sl=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}"),Rp=Sl.reduce((r,t,e)=>(r[e]=t,r),[]),Up=Sl.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Dp(r){return r.reduce((t,e)=>(t+=Rp[e],t),"")}function Pp(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let o=Up[n];if(o==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(o)}return new Uint8Array(t)}var Op=wr({prefix:"\u{1F680}",name:"base256emoji",encode:Dp,decode:Pp});var Gi={};Ct(Gi,{base64:()=>Hp,base64pad:()=>Mp,base64url:()=>zi,base64urlpad:()=>Vp});var Hp=dt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Mp=dt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zi=dt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Vp=dt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ji={};Ct(ji,{base8:()=>Fp});var Fp=dt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Zi={};Ct(Zi,{identity:()=>Kp});var Kp=wr({prefix:"\0",name:"identity",encode:r=>Dc(r),decode:r=>Uc(r)});var bw=new TextEncoder,xw=new TextDecoder;var Ji={};Ct(Ji,{sha256:()=>cn,sha512:()=>qp});function Yi({name:r,code:t,encode:e}){return new Xi(r,t,e)}var Xi=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Ot(this.code,e):e.then(n=>Ot(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Il(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var cn=Yi({name:"sha2-256",code:18,encode:Il("SHA-256")}),qp=Yi({name:"sha2-512",code:19,encode:Il("SHA-512")});var nr={...Zi,...Wi,...ji,...Ki,...$i,...ii,...ai,...si,...Gi,...qi},_w={...Ji,...fi};function kl(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Cl=kl("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Qi=kl("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=wt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),zp={utf8:Cl,"utf-8":Cl,hex:nr.base16,latin1:Qi,ascii:Qi,binary:Qi,...nr},uo=zp;function et(r,t="utf8"){let e=uo[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function ta(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return wt(i);o+i>t&&(n=wt(t),o=0);let a=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),a}}var or=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function ea(){}var na=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Gp=ta();function jp(r){return globalThis.Buffer!=null?wt(r):Gp(r)}var un=class{len;head;tail;states;constructor(){this.len=0,this.head=new or(ea,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new or(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new oa((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(fo,10,Kt.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=Kt.fromBigInt(t);return this._push(fo,e.length(),e)}uint64Number(t){return this._push(Di,ct(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=Kt.fromBigInt(t).zzEncode();return this._push(fo,e.length(),e)}sint64Number(t){let e=Kt.fromNumber(t).zzEncode();return this._push(fo,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(ra,1,t?1:0)}fixed32(t){return this._push(ln,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=Kt.fromBigInt(t);return this._push(ln,4,e.lo)._push(ln,4,e.hi)}fixed64Number(t){let e=Kt.fromNumber(t);return this._push(ln,4,e.lo)._push(ln,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(gl,4,t)}double(t){return this._push(wl,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(ra,1,0):this.uint32(e)._push(Xp,e,t)}string(t){let e=El(t);return e!==0?this.uint32(e)._push(Mi,e,t):this._push(ra,1,0)}fork(){return this.states=new na(this),this.head=this.tail=new or(ea,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 or(ea,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=jp(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function ra(r,t,e){t[e]=r&255}function Zp(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var oa=class extends or{next;constructor(t,e){super(Zp,t,e),this.next=void 0}};function fo(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function ln(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function Xp(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(un.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Yp,t,r),this},un.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Jp,t,r),this});function Yp(r,t,e){t.set(r,e)}function Jp(r,t,e){r.length<40?Mi(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(et(r),e)}function sa(){return new un}function ee(r,t){let e=sa();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var kr;(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"})(kr||(kr={}));function ho(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function sr(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let a=t(s);i.int32(a)},n=function(s){let i=s.int32();return t(i)};return ho("enum",kr.VARINT,e,n)}function re(r,t){return ho("message",kr.LENGTH_DELIMITED,r,t)}var bt;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(bt||(bt={}));var ia;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(ia||(ia={}));(function(r){r.codec=()=>sr(ia)})(bt||(bt={}));var se;(function(r){let t;r.codec=()=>(t==null&&(t=re((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),bt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=bt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>ee(e,r.codec()),r.decode=(e,n)=>te(e,r.codec(),n)})(se||(se={}));var aa;(function(r){let t;r.codec=()=>(t==null&&(t=re((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),bt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=bt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>ee(e,r.codec()),r.decode=(e,n)=>te(e,r.codec(),n)})(aa||(aa={}));var xn={};Ct(xn,{MAX_RSA_KEY_SIZE:()=>os,generateRSAKeyPair:()=>Bu,jwkToJWKKeyPair:()=>Iu,jwkToPkcs1:()=>pm,jwkToPkix:()=>ga,jwkToRSAPrivateKey:()=>Su,pkcs1ToJwk:()=>Eu,pkcs1ToRSAPrivateKey:()=>Au,pkixToJwk:()=>vu,pkixToRSAPublicKey:()=>ya});var Qp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ve=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Fe=new Uint32Array(64),ca=class extends Sr{constructor(){super(64,32,8,!1),this.A=Ve[0]|0,this.B=Ve[1]|0,this.C=Ve[2]|0,this.D=Ve[3]|0,this.E=Ve[4]|0,this.F=Ve[5]|0,this.G=Ve[6]|0,this.H=Ve[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,e,n,o,s,i,a,c]}set(t,e,n,o,s,i,a,c){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(t,e){for(let f=0;f<16;f++,e+=4)Fe[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){let d=Fe[f-15],m=Fe[f-2],x=jt(d,7)^jt(d,18)^d>>>3,g=jt(m,17)^jt(m,19)^m>>>10;Fe[f]=g+Fe[f-7]+x+Fe[f-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:l,H:u}=this;for(let f=0;f<64;f++){let d=jt(a,6)^jt(a,11)^jt(a,25),m=u+d+Zc(a,c,l)+Qp[f]+Fe[f]|0,g=(jt(n,2)^jt(n,13)^jt(n,22))+Xc(n,o,s)|0;u=l,l=c,c=a,a=i+m|0,i=s,s=o,o=n,n=m+g|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(n,o,s,i,a,c,l,u)}roundClean(){Fe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ie=Qn(()=>new ca);var z=Nh(Nl());function ir(r,t){let e=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)e+=r[r.length-1-n]*Math.pow(2,t*n);return e}function Ke(r,t,e=-1){let n=e,o=r,s=0,i=Math.pow(2,t);for(let a=1;a<8;a++){if(r<i){let c;if(n<0)c=new ArrayBuffer(a),s=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),s=n}let l=new Uint8Array(c);for(let u=a-1;u>=0;u--){let f=Math.pow(2,u*t);l[s-u-1]=Math.floor(o/f),o-=l[s-u-1]*f}return c}i*=Math.pow(2,t)}return new ArrayBuffer(0)}function go(...r){let t=0,e=0;for(let s of r)t+=s.length;let n=new ArrayBuffer(t),o=new Uint8Array(n);for(let s of r)o.set(s,e),e+=s.length;return o}function ua(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let t=new ArrayBuffer(this.valueHex.byteLength),e=new Uint8Array(t);for(let a=0;a<this.valueHex.byteLength;a++)e[a]=0;e[0]=r[0]&128;let n=ir(e,8),o=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(o);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=r[a];return s[0]&=127,ir(s,8)-n}function Ll(r){let t=r<0?r*-1:r,e=128;for(let n=1;n<8;n++){if(t<=e){if(r<0){let i=e-t,a=Ke(i,8,n),c=new Uint8Array(a);return c[0]|=128,a}let o=Ke(t,8,n),s=new Uint8Array(o);if(s[0]&128){let i=o.slice(0),a=new Uint8Array(i);o=new ArrayBuffer(o.byteLength+1),s=new Uint8Array(o);for(let c=0;c<i.byteLength;c++)s[c+1]=a[c];s[0]=0}return o}e*=Math.pow(2,8)}return new ArrayBuffer(0)}function _l(r,t){if(r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}function Mt(r,t){let e=r.toString(10);if(t<e.length)return"";let n=t-e.length,o=new Array(n);for(let i=0;i<n;i++)o[i]="0";return o.join("").concat(e)}var db=Math.log(2);function yo(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function fa(r){let t=0,e=0;for(let o=0;o<r.length;o++){let s=r[o];t+=s.byteLength}let n=new Uint8Array(t);for(let o=0;o<r.length;o++){let s=r[o];n.set(new Uint8Array(s),e),e+=s.byteLength}return n.buffer}function Ae(r,t,e,n){return t instanceof Uint8Array?t.byteLength?e<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):t.byteLength-e-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 hn=class{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return fa(this.items)}},fn=[new Uint8Array([1])],Rl="0123456789";var Rr="",ne=new ArrayBuffer(0),ha=new Uint8Array(0),dn="EndOfContent",Dl="OCTET STRING",Pl="BIT STRING";function Se(r){var t;return t=class extends r{constructor(...n){var o;super(...n);let s=n[0]||{};this.isHexOnly=(o=s.isHexOnly)!==null&&o!==void 0?o:!1,this.valueHexView=s.valueHex?z.BufferSourceConverter.toUint8Array(s.valueHex):ha}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,o,s){let i=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Ae(this,i,o,s))return-1;let a=o+s;return this.valueHexView=i.subarray(o,a),this.valueHexView.length?(this.blockLength=s,a):(this.warnings.push("Zero buffer length"),o)}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",ne)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:z.Convert.ToHex(this.valueHexView)}}},t.NAME="hexBlock",t}var xe=class{constructor({blockLength:t=0,error:e=Rr,warnings:n=[],valueBeforeDecode:o=ha}={}){this.blockLength=t,this.error=e,this.warnings=n,this.valueBeforeDecodeView=z.BufferSourceConverter.toUint8Array(o)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:z.Convert.ToHex(this.valueBeforeDecodeView)}}};xe.NAME="baseBlock";var Nt=class extends xe{fromBER(t,e,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,e){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Nt.NAME="valueBlock";var wo=class extends Se(xe){constructor({idBlock:t={}}={}){var e,n,o,s;super(),t?(this.isHexOnly=(e=t.isHexOnly)!==null&&e!==void 0?e:!1,this.valueHexView=t.valueHex?z.BufferSourceConverter.toUint8Array(t.valueHex):ha,this.tagClass=(n=t.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(o=t.tagNumber)!==null&&o!==void 0?o:-1,this.isConstructed=(s=t.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let e=0;switch(this.tagClass){case 1:e|=0;break;case 2:e|=64;break;case 3:e|=128;break;case 4:e|=192;break;default:return this.error="Unknown tag class",ne}if(this.isConstructed&&(e|=32),this.tagNumber<31&&!this.isHexOnly){let o=new Uint8Array(1);if(!t){let s=this.tagNumber;s&=31,e|=s,o[0]=e}return o.buffer}if(!this.isHexOnly){let o=Ke(this.tagNumber,7),s=new Uint8Array(o),i=o.byteLength,a=new Uint8Array(i+1);if(a[0]=e|31,!t){for(let c=0;c<i-1;c++)a[c+1]=s[c]|128;a[i]=s[i-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=e|31,!t){let o=this.valueHexView;for(let s=0;s<o.length-1;s++)n[s+1]=o[s]|128;n[this.valueHexView.byteLength]=o[o.length-1]}return n.buffer}fromBER(t,e,n){let o=z.BufferSourceConverter.toUint8Array(t);if(!Ae(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[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=(s[0]&32)===32,this.isHexOnly=!1;let a=s[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,l=this.valueHexView=new Uint8Array(255),u=255;for(;s[c]&128;){if(l[c-1]=s[c]&127,c++,c>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(c===u){u+=255;let d=new Uint8Array(u);for(let m=0;m<l.length;m++)d[m]=l[m];l=this.valueHexView=new Uint8Array(u)}}this.blockLength=c+1,l[c-1]=s[c]&127;let f=new Uint8Array(c);for(let d=0;d<c;d++)f[d]=l[d];l=this.valueHexView=new Uint8Array(c),l.set(f),this.blockLength<=9?this.tagNumber=ir(l,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 e+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};wo.NAME="identificationBlock";var bo=class extends xe{constructor({lenBlock:t={}}={}){var e,n,o;super(),this.isIndefiniteForm=(e=t.isIndefiniteForm)!==null&&e!==void 0?e:!1,this.longFormUsed=(n=t.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(o=t.length)!==null&&o!==void 0?o:0}fromBER(t,e,n){let o=z.BufferSourceConverter.toUint8Array(t);if(!Ae(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,e+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,e+this.blockLength;let i=s[0]&127;if(i>8)return this.error="Too big integer",-1;if(i+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=e+1,c=o.subarray(a,a+i);return c[i-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=ir(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,e+this.blockLength}toBER(t=!1){let e,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=128),e;if(this.longFormUsed){let o=Ke(this.length,8);if(o.byteLength>127)return this.error="Too big length",ne;if(e=new ArrayBuffer(o.byteLength+1),t)return e;let s=new Uint8Array(o);n=new Uint8Array(e),n[0]=o.byteLength|128;for(let i=0;i<o.byteLength;i++)n[i+1]=s[i];return e}return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=this.length),e}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};bo.NAME="lengthBlock";var D={},St=class extends xe{constructor({name:t=Rr,optional:e=!1,primitiveSchema:n,...o}={},s){super(o),this.name=t,this.optional=e,n&&(this.primitiveSchema=n),this.idBlock=new wo(o),this.lenBlock=new bo(o),this.valueBlock=s?new s(o):new Nt(o)}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}toBER(t,e){let n=e||new hn;e||Ol(this);let o=this.idBlock.toBER(t);if(n.write(o),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(t);this.lenBlock.length=s.byteLength;let i=this.lenBlock.toBER(t);n.write(i),n.write(s)}return e?ne:n.final()}toJSON(){let t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return t==="ascii"?this.onAsciiEncoding():z.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${z.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(t){if(this===t)return!0;if(!(t instanceof this.constructor))return!1;let e=this.toBER(),n=t.toBER();return _l(e,n)}};St.NAME="BaseBlock";function Ol(r){if(r instanceof D.Constructed)for(let t of r.valueBlock.value)Ol(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var xo=class extends St{constructor({value:t=Rr,...e}={},n){super(e,n),t&&this.fromString(t)}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};xo.NAME="BaseStringBlock";var Eo=class extends Se(Nt){constructor({isHexOnly:t=!0,...e}={}){super(e),this.isHexOnly=t}};Eo.NAME="PrimitiveValueBlock";var Hl,vo=class extends St{constructor(t={}){super(t,Eo),this.idBlock.isConstructed=!1}};Hl=vo;D.Primitive=Hl;vo.NAME="PRIMITIVE";function cm(r,t){if(r instanceof t)return r;let e=new t;return e.idBlock=r.idBlock,e.lenBlock=r.lenBlock,e.warnings=r.warnings,e.valueBeforeDecodeView=r.valueBeforeDecodeView,e}function rs(r,t=0,e=r.length){let n=t,o=new St({},Nt),s=new xe;if(!Ae(s,r,t,e))return o.error=s.error,{offset:-1,result:o};if(!r.subarray(t,t+e).length)return o.error="Zero buffer length",{offset:-1,result:o};let a=o.idBlock.fromBER(r,t,e);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),a===-1)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=a,e-=o.idBlock.blockLength,a=o.lenBlock.fromBER(r,t,e),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),a===-1)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=a,e-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let c=St;switch(o.idBlock.tagClass){case 1:if(o.idBlock.tagNumber>=37&&o.idBlock.isHexOnly===!1)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};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 o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};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 l=o.idBlock.isConstructed?new D.Constructed:new D.Primitive;l.idBlock=o.idBlock,l.lenBlock=o.lenBlock,l.warnings=o.warnings,o=l}}break;case 2:case 3:case 4:default:c=o.idBlock.isConstructed?D.Constructed:D.Primitive}return o=cm(o,c),a=o.fromBER(r,t,o.lenBlock.isIndefiniteForm?e:o.lenBlock.length),o.valueBeforeDecodeView=r.subarray(n,n+o.blockLength),{offset:a,result:o}}function da(r){if(!r.byteLength){let t=new St({},Nt);return t.error="Input buffer has zero length",{offset:-1,result:t}}return rs(z.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function lm(r,t){return r?1:t}var ae=class extends Nt{constructor({value:t=[],isIndefiniteForm:e=!1,...n}={}){super(n),this.value=t,this.isIndefiniteForm=e}fromBER(t,e,n){let o=z.BufferSourceConverter.toUint8Array(t);if(!Ae(this,o,e,n))return-1;if(this.valueBeforeDecodeView=o.subarray(e,e+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),e;let s=e;for(;lm(this.isIndefiniteForm,n)>0;){let i=rs(o,s,n);if(i.offset===-1)return this.error=i.result.error,this.warnings.concat(i.result.warnings),-1;if(s=i.offset,this.blockLength+=i.result.blockLength,n-=i.result.blockLength,this.value.push(i.result),this.isIndefiniteForm&&i.result.constructor.NAME===dn)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===dn?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(t,e){let n=e||new hn;for(let o=0;o<this.value.length;o++)this.value[o].toBER(t,n);return e?ne:n.final()}toJSON(){let t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let e of this.value)t.value.push(e.toJSON());return t}};ae.NAME="ConstructedValueBlock";var Ml,$e=class extends St{constructor(t={}){super(t,ae),this.idBlock.isConstructed=!0}fromBER(t,e,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){let t=[];for(let n of this.valueBlock.value)t.push(n.toString("ascii").split(`
|
2
|
+
"use strict";var Libp2PWebrtc=(()=>{var Sh=Object.create;var Fn=Object.defineProperty;var Bh=Object.getOwnPropertyDescriptor;var Ih=Object.getOwnPropertyNames;var Ch=Object.getPrototypeOf,kh=Object.prototype.hasOwnProperty;var Th=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Ct=(r,t)=>{for(var e in t)Fn(r,e,{get:t[e],enumerable:!0})},Nc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ih(t))!kh.call(r,o)&&o!==e&&Fn(r,o,{get:()=>t[o],enumerable:!(n=Bh(t,o))||n.enumerable});return r};var Nh=(r,t,e)=>(e=r!=null?Sh(Ch(r)):{},Nc(t||!r||!r.__esModule?Fn(e,"default",{value:r,enumerable:!0}):e,r)),Lh=r=>Nc(Fn({},"__esModule",{value:!0}),r);var Nl=Th(Tr=>{"use strict";var tm="[object ArrayBuffer]",be=class r{static isArrayBuffer(t){return Object.prototype.toString.call(t)===tm}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){let n=r.toUint8Array(t),o=r.toUint8Array(e);if(n.length!==o.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==o[s])return!1;return!0}static concat(...t){let e;Array.isArray(t[0])&&!(t[1]instanceof Function)||Array.isArray(t[0])&&t[1]instanceof Function?e=t[0]:t[t.length-1]instanceof Function?e=t.slice(0,t.length-1):e=t;let n=0;for(let i of e)n+=i.byteLength;let o=new Uint8Array(n),s=0;for(let i of e){let a=this.toUint8Array(i);o.set(a,s),s+=a.length}return t[t.length-1]instanceof Function?this.toView(o,t[t.length-1]):o.buffer}},la="string",em=/^[0-9a-f\s]+$/i,rm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,nm=/^[a-zA-Z0-9-_]+$/,po=class{static fromString(t){let e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n.buffer}static toString(t){let e=be.toUint8Array(t),n="";for(let s=0;s<e.length;s++)n+=String.fromCharCode(e[s]);return decodeURIComponent(escape(n))}},qt=class{static toString(t,e=!1){let n=be.toArrayBuffer(t),o=new DataView(n),s="";for(let i=0;i<n.byteLength;i+=2){let a=o.getUint16(i,e);s+=String.fromCharCode(a)}return s}static fromString(t,e=!1){let n=new ArrayBuffer(t.length*2),o=new DataView(n);for(let s=0;s<t.length;s++)o.setUint16(s*2,t.charCodeAt(s),e);return n}},mo=class r{static isHex(t){return typeof t===la&&em.test(t)}static isBase64(t){return typeof t===la&&rm.test(t)}static isBase64Url(t){return typeof t===la&&nm.test(t)}static ToString(t,e="utf8"){let n=be.toUint8Array(t);switch(e.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 qt.toString(n,!0);case"utf16":case"utf16be":return qt.toString(n);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return qt.fromString(t,!0);case"utf16":case"utf16be":return qt.fromString(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){let e=be.toUint8Array(t);if(typeof btoa<"u"){let n=this.ToString(e,"binary");return btoa(n)}else return Buffer.from(e).toString("base64")}static FromBase64(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(e)):new Uint8Array(Buffer.from(e,"base64")).buffer}static FromBase64Url(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.FromBinary(t);case"utf8":return po.fromString(t);case"utf16":case"utf16be":return qt.fromString(t);case"utf16le":case"usc2":return qt.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToUtf8String(t,e=r.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.ToBinary(t);case"utf8":return po.toString(t);case"utf16":case"utf16be":return qt.toString(t);case"utf16le":case"usc2":return qt.toString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromBinary(t){let e=t.length,n=new Uint8Array(e);for(let o=0;o<e;o++)n[o]=t.charCodeAt(o);return n.buffer}static ToBinary(t){let e=be.toUint8Array(t),n="";for(let o=0;o<e.length;o++)n+=String.fromCharCode(e[o]);return n}static ToHex(t){let e=be.toUint8Array(t),n="",o=e.length;for(let s=0;s<o;s++){let i=e[s];i<16&&(n+="0"),n+=i.toString(16)}return n}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!r.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e=`0${e}`);let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o=o+2){let s=e.slice(o,o+2);n[o/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(t,e=!1){return qt.toString(t,e)}static FromUtf16String(t,e=!1){return qt.fromString(t,e)}static Base64Padding(t){let e=4-t.length%4;if(e<4)for(let n=0;n<e;n++)t+="=";return t}static formatString(t){return t?.replace(/[\n\r\t ]/g,"")||""}};mo.DEFAULT_UTF8_ENCODING="utf8";function om(r,...t){let e=arguments[0];for(let n=1;n<arguments.length;n++){let o=arguments[n];for(let s in o)e[s]=o[s]}return e}function sm(...r){let t=r.map(o=>o.byteLength).reduce((o,s)=>o+s),e=new Uint8Array(t),n=0;return r.map(o=>new Uint8Array(o)).forEach(o=>{for(let s of o)e[n++]=s}),e.buffer}function im(r,t){if(!(r&&t)||r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)if(e[o]!==n[o])return!1;return!0}Tr.BufferSourceConverter=be;Tr.Convert=mo;Tr.assign=om;Tr.combine=sm;Tr.isEqual=im});var lg={};Ct(lg,{webRTC:()=>cg,webRTCDirect:()=>ag});var ti=Symbol.for("@libp2p/peer-id");var Kn=Symbol.for("@libp2p/transport");var Lc;(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(Lc||(Lc={}));var $n=class extends Error{static name="UnexpectedPeerError";constructor(t="Unexpected Peer"){super(t),this.name="UnexpectedPeerError"}};var tt=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},gr=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var Wn=class extends Error{static name="ConnectionFailedError";constructor(t="Connection failed"){super(t),this.name="ConnectionFailedError"}};var qn=class extends Error{static name="StreamResetError";constructor(t="The stream has been reset"){super(t),this.name="StreamResetError"}},je=class extends Error{static name="StreamStateError";constructor(t="The stream is in an invalid state"){super(t),this.name="StreamStateError"}};var zn=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var Gn=class extends Error{static name="InvalidMessageError";constructor(t="Invalid message"){super(t),this.name="InvalidMessageError"}};var jr=class extends Error{static name="TimeoutError";constructor(t="Timed out"){super(t),this.name="TimeoutError"}};var Ze=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var jn=(r,...t)=>{try{[...t]}catch{}};var Zn=class extends EventTarget{#t=new Map;constructor(){super(),jn(1/0,this)}listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:s})=>s!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e={}){return this.dispatchEvent(new CustomEvent(t,e))}};var yr=Symbol.for("@libp2p/service-capabilities"),_c=Symbol.for("@libp2p/service-dependencies");var si={};Ct(si,{base58btc:()=>nt,base58flickr:()=>Oh});var Vg=new Uint8Array(0);function Rc(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function fe(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 Uc(r){return new TextEncoder().encode(r)}function Dc(r){return new TextDecoder().decode(r)}function _h(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(e[i]!==255)throw new TypeError(s+" is ambiguous");e[i]=o}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var g=0,h=0,y=0,b=x.length;y!==b&&x[y]===0;)y++,g++;for(var p=(b-y)*u+1>>>0,B=new Uint8Array(p);y!==b;){for(var L=x[y],N=0,S=p-1;(L!==0||N<h)&&S!==-1;S--,N++)L+=256*B[S]>>>0,B[S]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");h=N,y++}for(var k=p-h;k!==p&&B[k]===0;)k++;for(var I=c.repeat(g);k<p;++k)I+=r.charAt(B[k]);return I}function d(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var g=0;if(x[g]!==" "){for(var h=0,y=0;x[g]===c;)h++,g++;for(var b=(x.length-g)*l+1>>>0,p=new Uint8Array(b);x[g];){var B=e[x.charCodeAt(g)];if(B===255)return;for(var L=0,N=b-1;(B!==0||L<y)&&N!==-1;N--,L++)B+=a*p[N]>>>0,p[N]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");y=L,g++}if(x[g]!==" "){for(var S=b-y;S!==b&&p[S]===0;)S++;for(var k=new Uint8Array(h+(b-S)),I=h;S!==b;)k[I++]=p[S++];return k}}}function m(x){var g=d(x);if(g)return g;throw new Error(`Non-${t} character`)}return{encode:f,decodeUnsafe:d,decode:m}}var Rh=_h,Uh=Rh,Oc=Uh;var ei=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},ri=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let o=e.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Hc(this,t)}},ni=class{decoders;constructor(t){this.decoders=t}or(t){return Hc(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Hc(r,t){return new ni({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var oi=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new ei(t,e,n),this.decoder=new ri(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function wr({name:r,prefix:t,encode:e,decode:n}){return new oi(r,t,e,n)}function Le({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=Oc(e,r);return wr({prefix:t,name:r,encode:n,decode:s=>fe(o(s))})}function Dh(r,t,e,n){let o={};for(let u=0;u<t.length;++u)o[t[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*e/8|0),a=0,c=0,l=0;for(let u=0;u<s;++u){let f=o[r[u]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|f,a+=e,a>=8&&(a-=8,i[l++]=255&c>>a)}if(a>=e||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i}function Ph(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>e;)i-=e,s+=t[o&a>>i];if(i!==0&&(s+=t[o&a<<e-i]),n)for(;s.length*e&7;)s+="=";return s}function dt({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return wr({prefix:t,name:r,encode(o){return Ph(o,n,e)},decode(o){return Dh(o,n,e,r)}})}var nt=Le({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Oh=Le({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ii={};Ct(ii,{base32:()=>he,base32hex:()=>Fh,base32hexpad:()=>$h,base32hexpadupper:()=>Wh,base32hexupper:()=>Kh,base32pad:()=>Mh,base32padupper:()=>Vh,base32upper:()=>Hh,base32z:()=>qh});var he=dt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Hh=dt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Mh=dt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Vh=dt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fh=dt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Kh=dt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$h=dt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Wh=dt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qh=dt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ai={};Ct(ai,{base36:()=>Zr,base36upper:()=>zh});var Zr=Le({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),zh=Le({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Gt={};Ct(Gt,{Digest:()=>Xe,create:()=>Ot,decode:()=>_e,equals:()=>li,hasCode:()=>fd});var Gh=Fc,Mc=128,jh=127,Zh=~jh,Xh=Math.pow(2,31);function Fc(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Xh;)t[e++]=r&255|Mc,r/=128;for(;r&Zh;)t[e++]=r&255|Mc,r>>>=7;return t[e]=r|0,Fc.bytes=e-n+1,t}var Yh=ci,Jh=128,Vc=127;function ci(r,n){var e=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw ci.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&Vc)<<o:(i&Vc)*Math.pow(2,o),o+=7}while(i>=Jh);return ci.bytes=s-n,e}var Qh=Math.pow(2,7),td=Math.pow(2,14),ed=Math.pow(2,21),rd=Math.pow(2,28),nd=Math.pow(2,35),od=Math.pow(2,42),sd=Math.pow(2,49),id=Math.pow(2,56),ad=Math.pow(2,63),cd=function(r){return r<Qh?1:r<td?2:r<ed?3:r<rd?4:r<nd?5:r<od?6:r<sd?7:r<id?8:r<ad?9:10},ld={encode:Gh,decode:Yh,encodingLength:cd},ud=ld,Xr=ud;function Yr(r,t=0){return[Xr.decode(r,t),Xr.decode.bytes]}function br(r,t,e=0){return Xr.encode(r,t,e),t}function xr(r){return Xr.encodingLength(r)}function Ot(r,t){let e=t.byteLength,n=xr(r),o=n+xr(e),s=new Uint8Array(o+e);return br(r,s,0),br(e,s,n),s.set(t,o),new Xe(r,e,t,s)}function _e(r){let t=fe(r),[e,n]=Yr(t),[o,s]=Yr(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Xe(e,o,i,t)}function li(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&Rc(r.bytes,e.bytes)}}var Xe=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function fd(r,t){return r.code===t}function Kc(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return dd(e,ui(r),t??nt.encoder);default:return pd(e,ui(r),t??he.encoder)}}var $c=new WeakMap;function ui(r){let t=$c.get(r);if(t==null){let e=new Map;return $c.set(r,e),e}return t}var vt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,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:t,multihash:e}=this;if(t!==Jr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==md)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}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:t,digest:e}=this.multihash,n=Ot(t,e);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(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&li(t.multihash,n.multihash)}toString(t){return Kc(this,t)}toJSON(){return{"/":Kc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??Wc(n,o,s.bytes))}else if(e[gd]===!0){let{version:n,multihash:o,code:s}=e,i=_e(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Jr)throw new Error(`Version 0 CID must use dag-pb (code: ${Jr}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=Wc(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Jr,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=fe(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new Xe(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[f,d]=Yr(t.subarray(e));return e+=d,f},o=n(),s=Jr;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,a=n(),c=n(),l=e+c,u=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(t,e){let[n,o]=hd(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ui(s).set(n,t),s}};function hd(r,t){switch(r[0]){case"Q":{let e=t??nt;return[nt.prefix,e.decode(`${nt.prefix}${r}`)]}case nt.prefix:{let e=t??nt;return[nt.prefix,e.decode(r)]}case he.prefix:{let e=t??he;return[he.prefix,e.decode(r)]}case Zr.prefix:{let e=t??Zr;return[Zr.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function dd(r,t,e){let{prefix:n}=e;if(n!==nt.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function pd(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Jr=112,md=18;function Wc(r,t,e){let n=xr(r),o=n+xr(t),s=new Uint8Array(o+e.byteLength);return br(r,s,0),br(t,s,n),s.set(e,o),s}var gd=Symbol.for("@ipld/js-cid/CID");var fi={};Ct(fi,{identity:()=>de});var qc=0,yd="identity",zc=fe;function wd(r){return Ot(qc,zc(r))}var de={code:qc,name:yd,encode:zc,digest:wd};function Rt(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Yn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function bd(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Er(r,...t){if(!bd(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${r.length}`)}function Qr(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yn(r.outputLen),Yn(r.blockLen)}function vr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Gc(r,t){Er(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var Ye=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Jn=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),jt=(r,t)=>r<<32-t|r>>>t;var ly=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function jc(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Re(r){return typeof r=="string"&&(r=jc(r)),Er(r),r}function hi(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Er(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var Ar=class{clone(){return this._cloneInto()}},uy={}.toString;function Qn(r){let t=n=>r().update(Re(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function tn(r=32){if(Ye&&typeof Ye.getRandomValues=="function")return Ye.getRandomValues(new Uint8Array(r));if(Ye&&typeof Ye.randomBytes=="function")return Ye.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function xd(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),a=Number(e&s),c=n?4:0,l=n?0:4;r.setUint32(t+c,i,n),r.setUint32(t+l,a,n)}var Zc=(r,t,e)=>r&t^~r&e,Xc=(r,t,e)=>r&t^r&e^t&e,Sr=class extends Ar{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Jn(this.buffer)}update(t){vr(this);let{view:e,buffer:n,blockLen:o}=this;t=Re(t);let s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=Jn(t);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){vr(this),Gc(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let f=i;f<o;f++)e[f]=0;xd(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=Jn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,u=this.get();if(l>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)a.setUint32(4*f,u[f],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return t.length=o,t.pos=a,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var to=BigInt(4294967295),di=BigInt(32);function Yc(r,t=!1){return t?{h:Number(r&to),l:Number(r>>di&to)}:{h:Number(r>>di&to)|0,l:Number(r&to)|0}}function Ed(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=Yc(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var vd=(r,t)=>BigInt(r>>>0)<<di|BigInt(t>>>0),Ad=(r,t,e)=>r>>>e,Sd=(r,t,e)=>r<<32-e|t>>>e,Bd=(r,t,e)=>r>>>e|t<<32-e,Id=(r,t,e)=>r<<32-e|t>>>e,Cd=(r,t,e)=>r<<64-e|t>>>e-32,kd=(r,t,e)=>r>>>e-32|t<<64-e,Td=(r,t)=>t,Nd=(r,t)=>r,Ld=(r,t,e)=>r<<e|t>>>32-e,_d=(r,t,e)=>t<<e|r>>>32-e,Rd=(r,t,e)=>t<<e-32|r>>>64-e,Ud=(r,t,e)=>r<<e-32|t>>>64-e;function Dd(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var Pd=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Od=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Hd=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Md=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,Vd=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Fd=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var Kd={fromBig:Yc,split:Ed,toBig:vd,shrSH:Ad,shrSL:Sd,rotrSH:Bd,rotrSL:Id,rotrBH:Cd,rotrBL:kd,rotr32H:Td,rotr32L:Nd,rotlSH:Ld,rotlSL:_d,rotlBH:Rd,rotlBL:Ud,add:Dd,add3L:Pd,add3H:Od,add4L:Hd,add4H:Md,add5H:Fd,add5L:Vd},$=Kd;var[$d,Wd]=$.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Ue=new Uint32Array(80),De=new Uint32Array(80),pi=class extends Sr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:l,El:u,Fh:f,Fl:d,Gh:m,Gl:x,Hh:g,Hl:h}=this;return[t,e,n,o,s,i,a,c,l,u,f,d,m,x,g,h]}set(t,e,n,o,s,i,a,c,l,u,f,d,m,x,g,h){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=m|0,this.Gl=x|0,this.Hh=g|0,this.Hl=h|0}process(t,e){for(let p=0;p<16;p++,e+=4)Ue[p]=t.getUint32(e),De[p]=t.getUint32(e+=4);for(let p=16;p<80;p++){let B=Ue[p-15]|0,L=De[p-15]|0,N=$.rotrSH(B,L,1)^$.rotrSH(B,L,8)^$.shrSH(B,L,7),S=$.rotrSL(B,L,1)^$.rotrSL(B,L,8)^$.shrSL(B,L,7),k=Ue[p-2]|0,I=De[p-2]|0,M=$.rotrSH(k,I,19)^$.rotrBH(k,I,61)^$.shrSH(k,I,6),_=$.rotrSL(k,I,19)^$.rotrBL(k,I,61)^$.shrSL(k,I,6),O=$.add4L(S,_,De[p-7],De[p-16]),V=$.add4H(O,N,M,Ue[p-7],Ue[p-16]);Ue[p]=V|0,De[p]=O|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:l,Dl:u,Eh:f,El:d,Fh:m,Fl:x,Gh:g,Gl:h,Hh:y,Hl:b}=this;for(let p=0;p<80;p++){let B=$.rotrSH(f,d,14)^$.rotrSH(f,d,18)^$.rotrBH(f,d,41),L=$.rotrSL(f,d,14)^$.rotrSL(f,d,18)^$.rotrBL(f,d,41),N=f&m^~f&g,S=d&x^~d&h,k=$.add5L(b,L,S,Wd[p],De[p]),I=$.add5H(k,y,B,N,$d[p],Ue[p]),M=k|0,_=$.rotrSH(n,o,28)^$.rotrBH(n,o,34)^$.rotrBH(n,o,39),O=$.rotrSL(n,o,28)^$.rotrBL(n,o,34)^$.rotrBL(n,o,39),V=n&s^n&a^s&a,C=o&i^o&c^i&c;y=g|0,b=h|0,g=m|0,h=x|0,m=f|0,x=d|0,{h:f,l:d}=$.add(l|0,u|0,I|0,M|0),l=a|0,u=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let T=$.add3L(M,O,C);n=$.add3H(T,I,_,V),o=T|0}({h:n,l:o}=$.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=$.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=$.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=$.add(this.Dh|0,this.Dl|0,l|0,u|0),{h:f,l:d}=$.add(this.Eh|0,this.El|0,f|0,d|0),{h:m,l:x}=$.add(this.Fh|0,this.Fl|0,m|0,x|0),{h:g,l:h}=$.add(this.Gh|0,this.Gl|0,g|0,h|0),{h:y,l:b}=$.add(this.Hh|0,this.Hl|0,y|0,b|0),this.set(n,o,s,i,a,c,l,u,f,d,m,x,g,h,y,b)}roundClean(){Ue.fill(0),De.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Jc=Qn(()=>new pi);var ro={};Ct(ro,{aInRange:()=>At,abool:()=>Zt,abytes:()=>Br,bitGet:()=>Xd,bitLen:()=>bi,bitMask:()=>rn,bitSet:()=>Yd,bytesToHex:()=>me,bytesToNumberBE:()=>ge,bytesToNumberLE:()=>Xt,concatBytes:()=>we,createHmacDrbg:()=>xi,ensureBytes:()=>it,equalBytes:()=>jd,hexToBytes:()=>Qe,hexToNumber:()=>wi,inRange:()=>en,isBytes:()=>Pe,memoized:()=>tr,notImplemented:()=>Qd,numberToBytesBE:()=>Oe,numberToBytesLE:()=>ye,numberToHexUnpadded:()=>Je,numberToVarBytesBE:()=>Gd,utf8ToBytes:()=>Zd,validateObject:()=>Wt});var yi=BigInt(0),eo=BigInt(1),qd=BigInt(2);function Pe(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Br(r){if(!Pe(r))throw new Error("Uint8Array expected")}function Zt(r,t){if(typeof t!="boolean")throw new Error(`${r} must be valid boolean, got "${t}".`)}var zd=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function me(r){Br(r);let t="";for(let e=0;e<r.length;e++)t+=zd[r[e]];return t}function Je(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function wi(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var pe={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Qc(r){if(r>=pe._0&&r<=pe._9)return r-pe._0;if(r>=pe._A&&r<=pe._F)return r-(pe._A-10);if(r>=pe._a&&r<=pe._f)return r-(pe._a-10)}function Qe(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=Qc(r.charCodeAt(s)),a=Qc(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function ge(r){return wi(me(r))}function Xt(r){return Br(r),wi(me(Uint8Array.from(r).reverse()))}function Oe(r,t){return Qe(r.toString(16).padStart(t*2,"0"))}function ye(r,t){return Oe(r,t).reverse()}function Gd(r){return Qe(Je(r))}function it(r,t,e){let n;if(typeof t=="string")try{n=Qe(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(Pe(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function we(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Br(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function jd(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function Zd(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var mi=r=>typeof r=="bigint"&&yi<=r;function en(r,t,e){return mi(r)&&mi(t)&&mi(e)&&t<=r&&r<e}function At(r,t,e,n){if(!en(t,e,n))throw new Error(`expected valid ${r}: ${e} <= n < ${n}, got ${typeof t} ${t}`)}function bi(r){let t;for(t=0;r>yi;r>>=eo,t+=1);return t}function Xd(r,t){return r>>BigInt(t)&eo}function Yd(r,t,e){return r|(e?eo:yi)<<BigInt(t)}var rn=r=>(qd<<BigInt(r-1))-eo,gi=r=>new Uint8Array(r),tl=r=>Uint8Array.from(r);function xi(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=gi(r),o=gi(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...f)=>e(o,n,...f),c=(f=gi())=>{o=a(tl([0]),f),n=a(),f.length!==0&&(o=a(tl([1]),f),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0,d=[];for(;f<t;){n=a();let m=n.slice();d.push(m),f+=n.length}return we(...d)};return(f,d)=>{i(),c(f);let m;for(;!(m=d(l()));)c();return i(),m}}var Jd={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||Pe(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Wt(r,t,e={}){let n=(o,s,i)=>{let a=Jd[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let c=r[o];if(!(i&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(o)}=${c} (${typeof c}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var Qd=()=>{throw new Error("not implemented")};function tr(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let s=r(e,...n);return t.set(e,s),s}}var gt=BigInt(0),ft=BigInt(1),er=BigInt(2),tp=BigInt(3),Ei=BigInt(4),el=BigInt(5),rl=BigInt(8),ep=BigInt(9),rp=BigInt(16);function Z(r,t){let e=r%t;return e>=gt?e:t+e}function vi(r,t,e){if(e<=gt||t<gt)throw new Error("Expected power/modulo > 0");if(e===ft)return gt;let n=ft;for(;t>gt;)t&ft&&(n=n*r%e),r=r*r%e,t>>=ft;return n}function at(r,t,e){let n=r;for(;t-- >gt;)n*=n,n%=e;return n}function no(r,t){if(r===gt||t<=gt)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Z(r,t),n=t,o=gt,s=ft,i=ft,a=gt;for(;e!==gt;){let l=n/e,u=n%e,f=o-i*l,d=s-a*l;n=e,e=u,o=i,s=a,i=f,a=d}if(n!==ft)throw new Error("invert: does not exist");return Z(o,t)}function np(r){let t=(r-ft)/er,e,n,o;for(e=r-ft,n=0;e%er===gt;e/=er,n++);for(o=er;o<r&&vi(o,t,r)!==r-ft;o++);if(n===1){let i=(r+ft)/Ei;return function(c,l){let u=c.pow(l,i);if(!c.eql(c.sqr(u),l))throw new Error("Cannot find square root");return u}}let s=(e+ft)/er;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let l=n,u=a.pow(a.mul(a.ONE,o),e),f=a.pow(c,s),d=a.pow(c,e);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let m=1;for(let g=a.sqr(d);m<l&&!a.eql(g,a.ONE);m++)g=a.sqr(g);let x=a.pow(u,ft<<BigInt(l-m-1));u=a.sqr(x),f=a.mul(f,x),d=a.mul(d,u),l=m}return f}}function op(r){if(r%Ei===tp){let t=(r+ft)/Ei;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%rl===el){let t=(r-el)/rl;return function(n,o){let s=n.mul(o,er),i=n.pow(s,t),a=n.mul(o,i),c=n.mul(n.mul(a,er),i),l=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(l),o))throw new Error("Cannot find square root");return l}}return r%rp,np(r)}var nl=(r,t)=>(Z(r,t)&ft)===ft,sp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ai(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=sp.reduce((n,o)=>(n[o]="function",n),t);return Wt(r,e)}function ip(r,t,e){if(e<gt)throw new Error("Expected power > 0");if(e===gt)return r.ONE;if(e===ft)return t;let n=r.ONE,o=t;for(;e>gt;)e&ft&&(n=r.mul(n,o)),o=r.sqr(o),e>>=ft;return n}function ap(r,t){let e=new Array(t.length),n=t.reduce((s,i,a)=>r.is0(i)?s:(e[a]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,a)=>r.is0(i)?s:(e[a]=r.mul(s,e[a]),r.mul(s,i)),o),e}function Si(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function He(r,t,e=!1,n={}){if(r<=gt)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=Si(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let i=op(r),a=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:rn(o),ZERO:gt,ONE:ft,create:c=>Z(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return gt<=c&&c<r},is0:c=>c===gt,isOdd:c=>(c&ft)===ft,neg:c=>Z(-c,r),eql:(c,l)=>c===l,sqr:c=>Z(c*c,r),add:(c,l)=>Z(c+l,r),sub:(c,l)=>Z(c-l,r),mul:(c,l)=>Z(c*l,r),pow:(c,l)=>ip(a,c,l),div:(c,l)=>Z(c*no(l,r),r),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>no(c,r),sqrt:n.sqrt||(c=>i(a,c)),invertBatch:c=>ap(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>e?ye(c,s):Oe(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return e?Xt(c):ge(c)}});return Object.freeze(a)}function ol(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Bi(r){let t=ol(r);return t+Math.ceil(t/2)}function sl(r,t,e=!1){let n=r.length,o=ol(t),s=Bi(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let i=e?ge(r):Xt(r),a=Z(i,t-ft)+ft;return e?ye(a,o):Oe(a,o)}var lp=BigInt(0),Ii=BigInt(1),Ci=new WeakMap,il=new WeakMap;function oo(r,t){let e=(s,i)=>{let a=i.negate();return s?a:i},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>t)throw new Error(`Wrong window size=${s}, should be [1..${t}]`)},o=s=>{n(s);let i=Math.ceil(t/s)+1,a=2**(s-1);return{windows:i,windowSize:a}};return{constTimeNegate:e,unsafeLadder(s,i){let a=r.ZERO,c=s;for(;i>lp;)i&Ii&&(a=a.add(c)),c=c.double(),i>>=Ii;return a},precomputeWindow(s,i){let{windows:a,windowSize:c}=o(i),l=[],u=s,f=u;for(let d=0;d<a;d++){f=u,l.push(f);for(let m=1;m<c;m++)f=f.add(u),l.push(f);u=f.double()}return l},wNAF(s,i,a){let{windows:c,windowSize:l}=o(s),u=r.ZERO,f=r.BASE,d=BigInt(2**s-1),m=2**s,x=BigInt(s);for(let g=0;g<c;g++){let h=g*l,y=Number(a&d);a>>=x,y>l&&(y-=m,a+=Ii);let b=h,p=h+Math.abs(y)-1,B=g%2!==0,L=y<0;y===0?f=f.add(e(B,i[b])):u=u.add(e(L,i[p]))}return{p:u,f}},wNAFCached(s,i,a){let c=il.get(s)||1,l=Ci.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&Ci.set(s,a(l))),this.wNAF(c,l,i)},setWindowSize(s,i){n(i),il.set(s,i),Ci.delete(s)}}}function so(r,t,e,n){if(!Array.isArray(e)||!Array.isArray(n)||n.length!==e.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((u,f)=>{if(!t.isValid(u))throw new Error(`wrong scalar at index ${f}`)}),e.forEach((u,f)=>{if(!(u instanceof r))throw new Error(`wrong point at index ${f}`)});let o=bi(BigInt(e.length)),s=o>12?o-3:o>4?o-2:o?2:1,i=(1<<s)-1,a=new Array(i+1).fill(r.ZERO),c=Math.floor((t.BITS-1)/s)*s,l=r.ZERO;for(let u=c;u>=0;u-=s){a.fill(r.ZERO);for(let d=0;d<n.length;d++){let m=n[d],x=Number(m>>BigInt(u)&BigInt(i));a[x]=a[x].add(e[d])}let f=r.ZERO;for(let d=a.length-1,m=r.ZERO;d>0;d--)m=m.add(a[d]),f=f.add(m);if(l=l.add(f),u!==0)for(let d=0;d<s;d++)l=l.double()}return l}function nn(r){return Ai(r.Fp),Wt(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Si(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Yt=BigInt(0),Ht=BigInt(1),io=BigInt(2),up=BigInt(8),fp={zip215:!0};function hp(r){let t=nn(r);return Wt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function al(r){let t=hp(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:a,h:c}=t,l=io<<BigInt(a*8)-Ht,u=e.create,f=He(t.n,t.nBitLength),d=t.uvRatio||((E,w)=>{try{return{isValid:!0,value:e.sqrt(E*e.inv(w))}}catch{return{isValid:!1,value:Yt}}}),m=t.adjustScalarBytes||(E=>E),x=t.domain||((E,w,A)=>{if(Zt("phflag",A),w.length||A)throw new Error("Contexts/pre-hash are not supported");return E});function g(E,w){At("coordinate "+E,w,Yt,l)}function h(E){if(!(E instanceof p))throw new Error("ExtendedPoint expected")}let y=tr((E,w)=>{let{ex:A,ey:v,ez:R}=E,U=E.is0();w==null&&(w=U?up:e.inv(R));let H=u(A*w),F=u(v*w),K=u(R*w);if(U)return{x:Yt,y:Ht};if(K!==Ht)throw new Error("invZ was invalid");return{x:H,y:F}}),b=tr(E=>{let{a:w,d:A}=t;if(E.is0())throw new Error("bad point: ZERO");let{ex:v,ey:R,ez:U,et:H}=E,F=u(v*v),K=u(R*R),W=u(U*U),j=u(W*W),ot=u(F*w),st=u(W*u(ot+K)),ut=u(j+u(A*u(F*K)));if(st!==ut)throw new Error("bad point: equation left != right (1)");let _t=u(v*R),mt=u(U*H);if(_t!==mt)throw new Error("bad point: equation left != right (2)");return!0});class p{constructor(w,A,v,R){this.ex=w,this.ey=A,this.ez=v,this.et=R,g("x",w),g("y",A),g("z",v),g("t",R),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(w){if(w instanceof p)throw new Error("extended point not allowed");let{x:A,y:v}=w||{};return g("x",A),g("y",v),new p(A,v,Ht,u(A*v))}static normalizeZ(w){let A=e.invertBatch(w.map(v=>v.ez));return w.map((v,R)=>v.toAffine(A[R])).map(p.fromAffine)}static msm(w,A){return so(p,f,w,A)}_setWindowSize(w){N.setWindowSize(this,w)}assertValidity(){b(this)}equals(w){h(w);let{ex:A,ey:v,ez:R}=this,{ex:U,ey:H,ez:F}=w,K=u(A*F),W=u(U*R),j=u(v*F),ot=u(H*R);return K===W&&j===ot}is0(){return this.equals(p.ZERO)}negate(){return new p(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:w}=t,{ex:A,ey:v,ez:R}=this,U=u(A*A),H=u(v*v),F=u(io*u(R*R)),K=u(w*U),W=A+v,j=u(u(W*W)-U-H),ot=K+H,st=ot-F,ut=K-H,_t=u(j*st),mt=u(ot*ut),Pt=u(j*ut),ue=u(st*ot);return new p(_t,mt,ue,Pt)}add(w){h(w);let{a:A,d:v}=t,{ex:R,ey:U,ez:H,et:F}=this,{ex:K,ey:W,ez:j,et:ot}=w;if(A===BigInt(-1)){let Ac=u((U-R)*(W+K)),Sc=u((U+R)*(W-K)),Qs=u(Sc-Ac);if(Qs===Yt)return this.double();let Bc=u(H*io*ot),Ic=u(F*io*j),Cc=Ic+Bc,kc=Sc+Ac,Tc=Ic-Bc,xh=u(Cc*Qs),Eh=u(kc*Tc),vh=u(Cc*Tc),Ah=u(Qs*kc);return new p(xh,Eh,Ah,vh)}let st=u(R*K),ut=u(U*W),_t=u(F*v*ot),mt=u(H*j),Pt=u((R+U)*(K+W)-st-ut),ue=mt-_t,zr=mt+_t,Gr=u(ut-A*st),gh=u(Pt*ue),yh=u(zr*Gr),wh=u(Pt*Gr),bh=u(ue*zr);return new p(gh,yh,bh,wh)}subtract(w){return this.add(w.negate())}wNAF(w){return N.wNAFCached(this,w,p.normalizeZ)}multiply(w){let A=w;At("scalar",A,Ht,n);let{p:v,f:R}=this.wNAF(A);return p.normalizeZ([v,R])[0]}multiplyUnsafe(w){let A=w;return At("scalar",A,Yt,n),A===Yt?L:this.equals(L)||A===Ht?this:this.equals(B)?this.wNAF(A).p:N.unsafeLadder(this,A)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return N.unsafeLadder(this,n).is0()}toAffine(w){return y(this,w)}clearCofactor(){let{h:w}=t;return w===Ht?this:this.multiplyUnsafe(w)}static fromHex(w,A=!1){let{d:v,a:R}=t,U=e.BYTES;w=it("pointHex",w,U),Zt("zip215",A);let H=w.slice(),F=w[U-1];H[U-1]=F&-129;let K=Xt(H),W=A?l:e.ORDER;At("pointHex.y",K,Yt,W);let j=u(K*K),ot=u(j-Ht),st=u(v*j-R),{isValid:ut,value:_t}=d(ot,st);if(!ut)throw new Error("Point.fromHex: invalid y coordinate");let mt=(_t&Ht)===Ht,Pt=(F&128)!==0;if(!A&&_t===Yt&&Pt)throw new Error("Point.fromHex: x=0 and x_0=1");return Pt!==mt&&(_t=u(-_t)),p.fromAffine({x:_t,y:K})}static fromPrivateKey(w){return I(w).point}toRawBytes(){let{x:w,y:A}=this.toAffine(),v=ye(A,e.BYTES);return v[v.length-1]|=w&Ht?128:0,v}toHex(){return me(this.toRawBytes())}}p.BASE=new p(t.Gx,t.Gy,Ht,u(t.Gx*t.Gy)),p.ZERO=new p(Yt,Ht,Ht,Yt);let{BASE:B,ZERO:L}=p,N=oo(p,a*8);function S(E){return Z(E,n)}function k(E){return S(Xt(E))}function I(E){let w=a;E=it("private key",E,w);let A=it("hashed private key",s(E),2*w),v=m(A.slice(0,w)),R=A.slice(w,2*w),U=k(v),H=B.multiply(U),F=H.toRawBytes();return{head:v,prefix:R,scalar:U,point:H,pointBytes:F}}function M(E){return I(E).pointBytes}function _(E=new Uint8Array,...w){let A=we(...w);return k(s(x(A,it("context",E),!!o)))}function O(E,w,A={}){E=it("message",E),o&&(E=o(E));let{prefix:v,scalar:R,pointBytes:U}=I(w),H=_(A.context,v,E),F=B.multiply(H).toRawBytes(),K=_(A.context,F,U,E),W=S(H+K*R);At("signature.s",W,Yt,n);let j=we(F,ye(W,e.BYTES));return it("result",j,a*2)}let V=fp;function C(E,w,A,v=V){let{context:R,zip215:U}=v,H=e.BYTES;E=it("signature",E,2*H),w=it("message",w),U!==void 0&&Zt("zip215",U),o&&(w=o(w));let F=Xt(E.slice(H,2*H)),K,W,j;try{K=p.fromHex(A,U),W=p.fromHex(E.slice(0,H),U),j=B.multiplyUnsafe(F)}catch{return!1}if(!U&&K.isSmallOrder())return!1;let ot=_(R,W.toRawBytes(),K.toRawBytes(),w);return W.add(K.multiplyUnsafe(ot)).subtract(j).clearCofactor().equals(p.ZERO)}return B._setWindowSize(8),{CURVE:t,getPublicKey:M,sign:O,verify:C,ExtendedPoint:p,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>i(e.BYTES),precompute(E=8,w=p.BASE){return w._setWindowSize(E),w.multiply(BigInt(3)),w}}}}var Ir=BigInt(0),ki=BigInt(1);function dp(r){return Wt(r,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r})}function cl(r){let t=dp(r),{P:e}=t,n=b=>Z(b,e),o=t.montgomeryBits,s=Math.ceil(o/8),i=t.nByteLength,a=t.adjustScalarBytes||(b=>b),c=t.powPminus2||(b=>vi(b,e-BigInt(2),e));function l(b,p,B){let L=n(b*(p-B));return p=n(p-L),B=n(B+L),[p,B]}let u=(t.a-BigInt(2))/BigInt(4);function f(b,p){At("u",b,Ir,e),At("scalar",p,Ir,e);let B=p,L=b,N=ki,S=Ir,k=b,I=ki,M=Ir,_;for(let V=BigInt(o-1);V>=Ir;V--){let C=B>>V&ki;M^=C,_=l(M,N,k),N=_[0],k=_[1],_=l(M,S,I),S=_[0],I=_[1],M=C;let T=N+S,E=n(T*T),w=N-S,A=n(w*w),v=E-A,R=k+I,U=k-I,H=n(U*T),F=n(R*w),K=H+F,W=H-F;k=n(K*K),I=n(L*n(W*W)),N=n(E*A),S=n(v*(E+n(u*v)))}_=l(M,N,k),N=_[0],k=_[1],_=l(M,S,I),S=_[0],I=_[1];let O=c(S);return n(N*O)}function d(b){return ye(n(b),s)}function m(b){let p=it("u coordinate",b,s);return i===32&&(p[31]&=127),Xt(p)}function x(b){let p=it("scalar",b),B=p.length;if(B!==s&&B!==i)throw new Error(`Expected ${s} or ${i} bytes, got ${B}`);return Xt(a(p))}function g(b,p){let B=m(p),L=x(b),N=f(B,L);if(N===Ir)throw new Error("Invalid private or public key received");return d(N)}let h=d(t.Gu);function y(b){return g(b,h)}return{scalarMult:g,scalarMultBase:y,getSharedSecret:(b,p)=>g(b,p),getPublicKey:b=>y(b),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:h}}var on=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ll=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Oy=BigInt(0),pp=BigInt(1),ul=BigInt(2),mp=BigInt(3),gp=BigInt(5),yp=BigInt(8);function fl(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=on,a=r*r%s*r%s,c=at(a,ul,s)*a%s,l=at(c,pp,s)*r%s,u=at(l,gp,s)*l%s,f=at(u,t,s)*u%s,d=at(f,e,s)*f%s,m=at(d,n,s)*d%s,x=at(m,o,s)*m%s,g=at(x,o,s)*m%s,h=at(g,t,s)*u%s;return{pow_p_5_8:at(h,ul,s)*r%s,b2:a}}function hl(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function wp(r,t){let e=on,n=Z(t*t*t,e),o=Z(n*n*t,e),s=fl(r*o).pow_p_5_8,i=Z(r*n*s,e),a=Z(t*i*i,e),c=i,l=Z(i*ll,e),u=a===r,f=a===Z(-r,e),d=a===Z(-r*ll,e);return u&&(i=c),(f||d)&&(i=l),nl(i,e)&&(i=Z(-i,e)),{isValid:u||f,value:i}}var bp=He(on,void 0,!0),xp={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:bp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:yp,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Jc,randomBytes:tn,adjustScalarBytes:hl,uvRatio:wp},dl=al(xp);var sn=cl({P:on,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:r=>{let t=on,{pow_p_5_8:e,b2:n}=fl(r);return Z(at(e,mp,t)*n,t)},adjustScalarBytes:hl,randomBytes:tn});var ao=32;function pl(r,t,e){return dl.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var co=class{type="Ed25519";raw;constructor(t){this.raw=Ti(t,ao)}toMultihash(){return de.digest(Cr(this))}toCID(){return vt.createV1(114,this.toMultihash())}toString(){return nt.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:Rt(this.raw,t.raw)}verify(t,e){return pl(this.raw,e,t)}};function Ni(r){return r=Ti(r,ao),new co(r)}function Ti(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new tt(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function yt(r=0){return new Uint8Array(r)}function wt(r=0){return new Uint8Array(r)}var vp=Math.pow(2,7),Ap=Math.pow(2,14),Sp=Math.pow(2,21),Li=Math.pow(2,28),_i=Math.pow(2,35),Ri=Math.pow(2,42),Ui=Math.pow(2,49),Y=128,kt=127;function ct(r){if(r<vp)return 1;if(r<Ap)return 2;if(r<Sp)return 3;if(r<Li)return 4;if(r<_i)return 5;if(r<Ri)return 6;if(r<Ui)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Di(r,t,e=0){switch(ct(r)){case 8:t[e++]=r&255|Y,r/=128;case 7:t[e++]=r&255|Y,r/=128;case 6:t[e++]=r&255|Y,r/=128;case 5:t[e++]=r&255|Y,r/=128;case 4:t[e++]=r&255|Y,r>>>=7;case 3:t[e++]=r&255|Y,r>>>=7;case 2:t[e++]=r&255|Y,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Bp(r,t,e=0){switch(ct(r)){case 8:t.set(e++,r&255|Y),r/=128;case 7:t.set(e++,r&255|Y),r/=128;case 6:t.set(e++,r&255|Y),r/=128;case 5:t.set(e++,r&255|Y),r/=128;case 4:t.set(e++,r&255|Y),r>>>=7;case 3:t.set(e++,r&255|Y),r>>>=7;case 2:t.set(e++,r&255|Y),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function Pi(r,t){let e=r[t],n=0;if(n+=e&kt,e<Y||(e=r[t+1],n+=(e&kt)<<7,e<Y)||(e=r[t+2],n+=(e&kt)<<14,e<Y)||(e=r[t+3],n+=(e&kt)<<21,e<Y)||(e=r[t+4],n+=(e&kt)*Li,e<Y)||(e=r[t+5],n+=(e&kt)*_i,e<Y)||(e=r[t+6],n+=(e&kt)*Ri,e<Y)||(e=r[t+7],n+=(e&kt)*Ui,e<Y))return n;throw new RangeError("Could not decode varint")}function Ip(r,t){let e=r.get(t),n=0;if(n+=e&kt,e<Y||(e=r.get(t+1),n+=(e&kt)<<7,e<Y)||(e=r.get(t+2),n+=(e&kt)<<14,e<Y)||(e=r.get(t+3),n+=(e&kt)<<21,e<Y)||(e=r.get(t+4),n+=(e&kt)*Li,e<Y)||(e=r.get(t+5),n+=(e&kt)*_i,e<Y)||(e=r.get(t+6),n+=(e&kt)*Ri,e<Y)||(e=r.get(t+7),n+=(e&kt)*Ui,e<Y))return n;throw new RangeError("Could not decode varint")}function oe(r,t,e=0){return t==null&&(t=wt(ct(r))),t instanceof Uint8Array?Di(r,t,e):Bp(r,t,e)}function Jt(r,t=0){return r instanceof Uint8Array?Pi(r,t):Ip(r,t)}var Oi=new Float32Array([-0]),Me=new Uint8Array(Oi.buffer);function gl(r,t,e){Oi[0]=r,t[e]=Me[0],t[e+1]=Me[1],t[e+2]=Me[2],t[e+3]=Me[3]}function yl(r,t){return Me[0]=r[t],Me[1]=r[t+1],Me[2]=r[t+2],Me[3]=r[t+3],Oi[0]}var Hi=new Float64Array([-0]),Tt=new Uint8Array(Hi.buffer);function wl(r,t,e){Hi[0]=r,t[e]=Tt[0],t[e+1]=Tt[1],t[e+2]=Tt[2],t[e+3]=Tt[3],t[e+4]=Tt[4],t[e+5]=Tt[5],t[e+6]=Tt[6],t[e+7]=Tt[7]}function bl(r,t){return Tt[0]=r[t],Tt[1]=r[t+1],Tt[2]=r[t+2],Tt[3]=r[t+3],Tt[4]=r[t+4],Tt[5]=r[t+5],Tt[6]=r[t+6],Tt[7]=r[t+7],Hi[0]}var Cp=BigInt(Number.MAX_SAFE_INTEGER),kp=BigInt(Number.MIN_SAFE_INTEGER),Kt=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return rr;if(t<Cp&&t>kp)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>xl&&(o=0n,++n>xl&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return rr;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):rr}},rr=new Kt(0,0);rr.toBigInt=function(){return 0n};rr.zzEncode=rr.zzDecode=function(){return this};rr.length=function(){return 1};var xl=4294967296n;function El(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function vl(r,t,e){if(e-t<1)return"";let o,s=[],i=0,a;for(;t<e;)a=r[t++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(a&31)<<6|r[t++]&63:a>239&&a<365?(a=((a&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function Mi(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function Qt(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function lo(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var Vi=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Qt(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Qt(this,4);return lo(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Qt(this,4);return lo(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Qt(this,4);let t=yl(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw Qt(this,4);let t=bl(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw Qt(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return vl(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Qt(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Qt(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new Kt(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw Qt(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw Qt(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Qt(this,8);let t=lo(this.buf,this.pos+=4),e=lo(this.buf,this.pos+=4);return new Kt(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Pi(this.buf,this.pos);return this.pos+=ct(t),t}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 Fi(r){return new Vi(r instanceof Uint8Array?r:r.subarray())}function te(r,t,e){let n=Fi(r);return t.decode(n,void 0,e)}var Ki={};Ct(Ki,{base10:()=>Tp});var Tp=Le({prefix:"9",name:"base10",alphabet:"0123456789"});var $i={};Ct($i,{base16:()=>Np,base16upper:()=>Lp});var Np=dt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Lp=dt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Wi={};Ct(Wi,{base2:()=>_p});var _p=dt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var qi={};Ct(qi,{base256emoji:()=>Op});var Sl=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}"),Rp=Sl.reduce((r,t,e)=>(r[e]=t,r),[]),Up=Sl.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Dp(r){return r.reduce((t,e)=>(t+=Rp[e],t),"")}function Pp(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let o=Up[n];if(o==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(o)}return new Uint8Array(t)}var Op=wr({prefix:"\u{1F680}",name:"base256emoji",encode:Dp,decode:Pp});var Gi={};Ct(Gi,{base64:()=>Hp,base64pad:()=>Mp,base64url:()=>zi,base64urlpad:()=>Vp});var Hp=dt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Mp=dt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zi=dt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Vp=dt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ji={};Ct(ji,{base8:()=>Fp});var Fp=dt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Zi={};Ct(Zi,{identity:()=>Kp});var Kp=wr({prefix:"\0",name:"identity",encode:r=>Dc(r),decode:r=>Uc(r)});var bw=new TextEncoder,xw=new TextDecoder;var Ji={};Ct(Ji,{sha256:()=>cn,sha512:()=>qp});function Yi({name:r,code:t,encode:e}){return new Xi(r,t,e)}var Xi=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?Ot(this.code,e):e.then(n=>Ot(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Il(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var cn=Yi({name:"sha2-256",code:18,encode:Il("SHA-256")}),qp=Yi({name:"sha2-512",code:19,encode:Il("SHA-512")});var nr={...Zi,...Wi,...ji,...Ki,...$i,...ii,...ai,...si,...Gi,...qi},_w={...Ji,...fi};function kl(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Cl=kl("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Qi=kl("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=wt(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),zp={utf8:Cl,"utf-8":Cl,hex:nr.base16,latin1:Qi,ascii:Qi,binary:Qi,...nr},uo=zp;function et(r,t="utf8"){let e=uo[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function ta(r){let t=r??8192,e=t>>>1,n,o=t;return function(i){if(i<1||i>e)return wt(i);o+i>t&&(n=wt(t),o=0);let a=n.subarray(o,o+=i);return o&7&&(o=(o|7)+1),a}}var or=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function ea(){}var na=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Gp=ta();function jp(r){return globalThis.Buffer!=null?wt(r):Gp(r)}var un=class{len;head;tail;states;constructor(){this.len=0,this.head=new or(ea,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new or(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new oa((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(fo,10,Kt.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=Kt.fromBigInt(t);return this._push(fo,e.length(),e)}uint64Number(t){return this._push(Di,ct(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=Kt.fromBigInt(t).zzEncode();return this._push(fo,e.length(),e)}sint64Number(t){let e=Kt.fromNumber(t).zzEncode();return this._push(fo,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(ra,1,t?1:0)}fixed32(t){return this._push(ln,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=Kt.fromBigInt(t);return this._push(ln,4,e.lo)._push(ln,4,e.hi)}fixed64Number(t){let e=Kt.fromNumber(t);return this._push(ln,4,e.lo)._push(ln,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(gl,4,t)}double(t){return this._push(wl,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(ra,1,0):this.uint32(e)._push(Xp,e,t)}string(t){let e=El(t);return e!==0?this.uint32(e)._push(Mi,e,t):this._push(ra,1,0)}fork(){return this.states=new na(this),this.head=this.tail=new or(ea,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 or(ea,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=jp(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function ra(r,t,e){t[e]=r&255}function Zp(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var oa=class extends or{next;constructor(t,e){super(Zp,t,e),this.next=void 0}};function fo(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function ln(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function Xp(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(un.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Yp,t,r),this},un.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Jp,t,r),this});function Yp(r,t,e){t.set(r,e)}function Jp(r,t,e){r.length<40?Mi(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(et(r),e)}function sa(){return new un}function ee(r,t){let e=sa();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var kr;(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"})(kr||(kr={}));function ho(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function sr(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,i){let a=t(s);i.int32(a)},n=function(s){let i=s.int32();return t(i)};return ho("enum",kr.VARINT,e,n)}function re(r,t){return ho("message",kr.LENGTH_DELIMITED,r,t)}var bt;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(bt||(bt={}));var ia;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(ia||(ia={}));(function(r){r.codec=()=>sr(ia)})(bt||(bt={}));var se;(function(r){let t;r.codec=()=>(t==null&&(t=re((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),bt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=bt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>ee(e,r.codec()),r.decode=(e,n)=>te(e,r.codec(),n)})(se||(se={}));var aa;(function(r){let t;r.codec=()=>(t==null&&(t=re((e,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),e.Type!=null&&(n.uint32(8),bt.codec().encode(e.Type,n)),e.Data!=null&&(n.uint32(18),n.bytes(e.Data)),o.lengthDelimited!==!1&&n.ldelim()},(e,n,o={})=>{let s={},i=n==null?e.len:e.pos+n;for(;e.pos<i;){let a=e.uint32();switch(a>>>3){case 1:{s.Type=bt.codec().decode(e);break}case 2:{s.Data=e.bytes();break}default:{e.skipType(a&7);break}}}return s})),t),r.encode=e=>ee(e,r.codec()),r.decode=(e,n)=>te(e,r.codec(),n)})(aa||(aa={}));var xn={};Ct(xn,{MAX_RSA_KEY_SIZE:()=>os,generateRSAKeyPair:()=>Bu,jwkToJWKKeyPair:()=>Iu,jwkToPkcs1:()=>pm,jwkToPkix:()=>ga,jwkToRSAPrivateKey:()=>Su,pkcs1ToJwk:()=>Eu,pkcs1ToRSAPrivateKey:()=>Au,pkixToJwk:()=>vu,pkixToRSAPublicKey:()=>ya});var Qp=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ve=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Fe=new Uint32Array(64),ca=class extends Sr{constructor(){super(64,32,8,!1),this.A=Ve[0]|0,this.B=Ve[1]|0,this.C=Ve[2]|0,this.D=Ve[3]|0,this.E=Ve[4]|0,this.F=Ve[5]|0,this.G=Ve[6]|0,this.H=Ve[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,e,n,o,s,i,a,c]}set(t,e,n,o,s,i,a,c){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(t,e){for(let f=0;f<16;f++,e+=4)Fe[f]=t.getUint32(e,!1);for(let f=16;f<64;f++){let d=Fe[f-15],m=Fe[f-2],x=jt(d,7)^jt(d,18)^d>>>3,g=jt(m,17)^jt(m,19)^m>>>10;Fe[f]=g+Fe[f-7]+x+Fe[f-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:l,H:u}=this;for(let f=0;f<64;f++){let d=jt(a,6)^jt(a,11)^jt(a,25),m=u+d+Zc(a,c,l)+Qp[f]+Fe[f]|0,g=(jt(n,2)^jt(n,13)^jt(n,22))+Xc(n,o,s)|0;u=l,l=c,c=a,a=i+m|0,i=s,s=o,o=n,n=m+g|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,u=u+this.H|0,this.set(n,o,s,i,a,c,l,u)}roundClean(){Fe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ie=Qn(()=>new ca);var z=Nh(Nl());function ir(r,t){let e=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)e+=r[r.length-1-n]*Math.pow(2,t*n);return e}function Ke(r,t,e=-1){let n=e,o=r,s=0,i=Math.pow(2,t);for(let a=1;a<8;a++){if(r<i){let c;if(n<0)c=new ArrayBuffer(a),s=a;else{if(n<a)return new ArrayBuffer(0);c=new ArrayBuffer(n),s=n}let l=new Uint8Array(c);for(let u=a-1;u>=0;u--){let f=Math.pow(2,u*t);l[s-u-1]=Math.floor(o/f),o-=l[s-u-1]*f}return c}i*=Math.pow(2,t)}return new ArrayBuffer(0)}function go(...r){let t=0,e=0;for(let s of r)t+=s.length;let n=new ArrayBuffer(t),o=new Uint8Array(n);for(let s of r)o.set(s,e),e+=s.length;return o}function ua(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let a=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(a||c)&&this.warnings.push("Needlessly long format")}let t=new ArrayBuffer(this.valueHex.byteLength),e=new Uint8Array(t);for(let a=0;a<this.valueHex.byteLength;a++)e[a]=0;e[0]=r[0]&128;let n=ir(e,8),o=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(o);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=r[a];return s[0]&=127,ir(s,8)-n}function Ll(r){let t=r<0?r*-1:r,e=128;for(let n=1;n<8;n++){if(t<=e){if(r<0){let i=e-t,a=Ke(i,8,n),c=new Uint8Array(a);return c[0]|=128,a}let o=Ke(t,8,n),s=new Uint8Array(o);if(s[0]&128){let i=o.slice(0),a=new Uint8Array(i);o=new ArrayBuffer(o.byteLength+1),s=new Uint8Array(o);for(let c=0;c<i.byteLength;c++)s[c+1]=a[c];s[0]=0}return o}e*=Math.pow(2,8)}return new ArrayBuffer(0)}function _l(r,t){if(r.byteLength!==t.byteLength)return!1;let e=new Uint8Array(r),n=new Uint8Array(t);for(let o=0;o<e.length;o++)if(e[o]!==n[o])return!1;return!0}function Mt(r,t){let e=r.toString(10);if(t<e.length)return"";let n=t-e.length,o=new Array(n);for(let i=0;i<n;i++)o[i]="0";return o.join("").concat(e)}var db=Math.log(2);function yo(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function fa(r){let t=0,e=0;for(let o=0;o<r.length;o++){let s=r[o];t+=s.byteLength}let n=new Uint8Array(t);for(let o=0;o<r.length;o++){let s=r[o];n.set(new Uint8Array(s),e),e+=s.byteLength}return n.buffer}function Ae(r,t,e,n){return t instanceof Uint8Array?t.byteLength?e<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):t.byteLength-e-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 hn=class{constructor(){this.items=[]}write(t){this.items.push(t)}final(){return fa(this.items)}},fn=[new Uint8Array([1])],Rl="0123456789";var Rr="",ne=new ArrayBuffer(0),ha=new Uint8Array(0),dn="EndOfContent",Dl="OCTET STRING",Pl="BIT STRING";function Se(r){var t;return t=class extends r{constructor(...n){var o;super(...n);let s=n[0]||{};this.isHexOnly=(o=s.isHexOnly)!==null&&o!==void 0?o:!1,this.valueHexView=s.valueHex?z.BufferSourceConverter.toUint8Array(s.valueHex):ha}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,o,s){let i=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Ae(this,i,o,s))return-1;let a=o+s;return this.valueHexView=i.subarray(o,a),this.valueHexView.length?(this.blockLength=s,a):(this.warnings.push("Zero buffer length"),o)}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",ne)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:z.Convert.ToHex(this.valueHexView)}}},t.NAME="hexBlock",t}var xe=class{constructor({blockLength:t=0,error:e=Rr,warnings:n=[],valueBeforeDecode:o=ha}={}){this.blockLength=t,this.error=e,this.warnings=n,this.valueBeforeDecodeView=z.BufferSourceConverter.toUint8Array(o)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(t){this.valueBeforeDecodeView=new Uint8Array(t)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:z.Convert.ToHex(this.valueBeforeDecodeView)}}};xe.NAME="baseBlock";var Nt=class extends xe{fromBER(t,e,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(t,e){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Nt.NAME="valueBlock";var wo=class extends Se(xe){constructor({idBlock:t={}}={}){var e,n,o,s;super(),t?(this.isHexOnly=(e=t.isHexOnly)!==null&&e!==void 0?e:!1,this.valueHexView=t.valueHex?z.BufferSourceConverter.toUint8Array(t.valueHex):ha,this.tagClass=(n=t.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(o=t.tagNumber)!==null&&o!==void 0?o:-1,this.isConstructed=(s=t.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(t=!1){let e=0;switch(this.tagClass){case 1:e|=0;break;case 2:e|=64;break;case 3:e|=128;break;case 4:e|=192;break;default:return this.error="Unknown tag class",ne}if(this.isConstructed&&(e|=32),this.tagNumber<31&&!this.isHexOnly){let o=new Uint8Array(1);if(!t){let s=this.tagNumber;s&=31,e|=s,o[0]=e}return o.buffer}if(!this.isHexOnly){let o=Ke(this.tagNumber,7),s=new Uint8Array(o),i=o.byteLength,a=new Uint8Array(i+1);if(a[0]=e|31,!t){for(let c=0;c<i-1;c++)a[c+1]=s[c]|128;a[i]=s[i-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=e|31,!t){let o=this.valueHexView;for(let s=0;s<o.length-1;s++)n[s+1]=o[s]|128;n[this.valueHexView.byteLength]=o[o.length-1]}return n.buffer}fromBER(t,e,n){let o=z.BufferSourceConverter.toUint8Array(t);if(!Ae(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[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=(s[0]&32)===32,this.isHexOnly=!1;let a=s[0]&31;if(a!==31)this.tagNumber=a,this.blockLength=1;else{let c=1,l=this.valueHexView=new Uint8Array(255),u=255;for(;s[c]&128;){if(l[c-1]=s[c]&127,c++,c>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(c===u){u+=255;let d=new Uint8Array(u);for(let m=0;m<l.length;m++)d[m]=l[m];l=this.valueHexView=new Uint8Array(u)}}this.blockLength=c+1,l[c-1]=s[c]&127;let f=new Uint8Array(c);for(let d=0;d<c;d++)f[d]=l[d];l=this.valueHexView=new Uint8Array(c),l.set(f),this.blockLength<=9?this.tagNumber=ir(l,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 e+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};wo.NAME="identificationBlock";var bo=class extends xe{constructor({lenBlock:t={}}={}){var e,n,o;super(),this.isIndefiniteForm=(e=t.isIndefiniteForm)!==null&&e!==void 0?e:!1,this.longFormUsed=(n=t.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(o=t.length)!==null&&o!==void 0?o:0}fromBER(t,e,n){let o=z.BufferSourceConverter.toUint8Array(t);if(!Ae(this,o,e,n))return-1;let s=o.subarray(e,e+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,e+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,e+this.blockLength;let i=s[0]&127;if(i>8)return this.error="Too big integer",-1;if(i+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=e+1,c=o.subarray(a,a+i);return c[i-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=ir(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=i+1,e+this.blockLength}toBER(t=!1){let e,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=128),e;if(this.longFormUsed){let o=Ke(this.length,8);if(o.byteLength>127)return this.error="Too big length",ne;if(e=new ArrayBuffer(o.byteLength+1),t)return e;let s=new Uint8Array(o);n=new Uint8Array(e),n[0]=o.byteLength|128;for(let i=0;i<o.byteLength;i++)n[i+1]=s[i];return e}return e=new ArrayBuffer(1),t===!1&&(n=new Uint8Array(e),n[0]=this.length),e}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};bo.NAME="lengthBlock";var D={},St=class extends xe{constructor({name:t=Rr,optional:e=!1,primitiveSchema:n,...o}={},s){super(o),this.name=t,this.optional=e,n&&(this.primitiveSchema=n),this.idBlock=new wo(o),this.lenBlock=new bo(o),this.valueBlock=s?new s(o):new Nt(o)}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}toBER(t,e){let n=e||new hn;e||Ol(this);let o=this.idBlock.toBER(t);if(n.write(o),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(t,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(t);this.lenBlock.length=s.byteLength;let i=this.lenBlock.toBER(t);n.write(i),n.write(s)}return e?ne:n.final()}toJSON(){let t={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(t.primitiveSchema=this.primitiveSchema.toJSON()),t}toString(t="ascii"){return t==="ascii"?this.onAsciiEncoding():z.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${z.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(t){if(this===t)return!0;if(!(t instanceof this.constructor))return!1;let e=this.toBER(),n=t.toBER();return _l(e,n)}};St.NAME="BaseBlock";function Ol(r){if(r instanceof D.Constructed)for(let t of r.valueBlock.value)Ol(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var xo=class extends St{constructor({value:t=Rr,...e}={},n){super(e,n),t&&this.fromString(t)}getValue(){return this.valueBlock.value}setValue(t){this.valueBlock.value=t}fromBER(t,e,n){let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};xo.NAME="BaseStringBlock";var Eo=class extends Se(Nt){constructor({isHexOnly:t=!0,...e}={}){super(e),this.isHexOnly=t}};Eo.NAME="PrimitiveValueBlock";var Hl,vo=class extends St{constructor(t={}){super(t,Eo),this.idBlock.isConstructed=!1}};Hl=vo;D.Primitive=Hl;vo.NAME="PRIMITIVE";function cm(r,t){if(r instanceof t)return r;let e=new t;return e.idBlock=r.idBlock,e.lenBlock=r.lenBlock,e.warnings=r.warnings,e.valueBeforeDecodeView=r.valueBeforeDecodeView,e}function rs(r,t=0,e=r.length){let n=t,o=new St({},Nt),s=new xe;if(!Ae(s,r,t,e))return o.error=s.error,{offset:-1,result:o};if(!r.subarray(t,t+e).length)return o.error="Zero buffer length",{offset:-1,result:o};let a=o.idBlock.fromBER(r,t,e);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),a===-1)return o.error=o.idBlock.error,{offset:-1,result:o};if(t=a,e-=o.idBlock.blockLength,a=o.lenBlock.fromBER(r,t,e),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),a===-1)return o.error=o.lenBlock.error,{offset:-1,result:o};if(t=a,e-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let c=St;switch(o.idBlock.tagClass){case 1:if(o.idBlock.tagNumber>=37&&o.idBlock.isHexOnly===!1)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};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 o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};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 l=o.idBlock.isConstructed?new D.Constructed:new D.Primitive;l.idBlock=o.idBlock,l.lenBlock=o.lenBlock,l.warnings=o.warnings,o=l}}break;case 2:case 3:case 4:default:c=o.idBlock.isConstructed?D.Constructed:D.Primitive}return o=cm(o,c),a=o.fromBER(r,t,o.lenBlock.isIndefiniteForm?e:o.lenBlock.length),o.valueBeforeDecodeView=r.subarray(n,n+o.blockLength),{offset:a,result:o}}function da(r){if(!r.byteLength){let t=new St({},Nt);return t.error="Input buffer has zero length",{offset:-1,result:t}}return rs(z.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function lm(r,t){return r?1:t}var ae=class extends Nt{constructor({value:t=[],isIndefiniteForm:e=!1,...n}={}){super(n),this.value=t,this.isIndefiniteForm=e}fromBER(t,e,n){let o=z.BufferSourceConverter.toUint8Array(t);if(!Ae(this,o,e,n))return-1;if(this.valueBeforeDecodeView=o.subarray(e,e+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),e;let s=e;for(;lm(this.isIndefiniteForm,n)>0;){let i=rs(o,s,n);if(i.offset===-1)return this.error=i.result.error,this.warnings.concat(i.result.warnings),-1;if(s=i.offset,this.blockLength+=i.result.blockLength,n-=i.result.blockLength,this.value.push(i.result),this.isIndefiniteForm&&i.result.constructor.NAME===dn)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===dn?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(t,e){let n=e||new hn;for(let o=0;o<this.value.length;o++)this.value[o].toBER(t,n);return e?ne:n.final()}toJSON(){let t={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let e of this.value)t.value.push(e.toJSON());return t}};ae.NAME="ConstructedValueBlock";var Ml,$e=class extends St{constructor(t={}){super(t,ae),this.idBlock.isConstructed=!0}fromBER(t,e,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let o=this.valueBlock.fromBER(t,e,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){let t=[];for(let n of this.valueBlock.value)t.push(n.toString("ascii").split(`
|
3
3
|
`).map(o=>` ${o}`).join(`
|
4
4
|
`));let e=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return t.length?`${e} :
|
5
5
|
${t.join(`
|
@@ -29,7 +29,7 @@ pvtsutils/build/index.js:
|
|
29
29
|
(*!
|
30
30
|
* MIT License
|
31
31
|
*
|
32
|
-
* Copyright (c) 2017-
|
32
|
+
* Copyright (c) 2017-2024 Peculiar Ventures, LLC
|
33
33
|
*
|
34
34
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
35
35
|
* of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/webrtc",
|
3
|
-
"version": "5.0.19-
|
3
|
+
"version": "5.0.19-4a85eb033",
|
4
4
|
"description": "A libp2p transport using WebRTC connections",
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/transport-webrtc#readme",
|
@@ -51,10 +51,10 @@
|
|
51
51
|
},
|
52
52
|
"dependencies": {
|
53
53
|
"@chainsafe/libp2p-noise": "^16.0.0",
|
54
|
-
"@libp2p/interface": "2.2.1-
|
55
|
-
"@libp2p/interface-internal": "2.1.1-
|
56
|
-
"@libp2p/peer-id": "5.0.8-
|
57
|
-
"@libp2p/utils": "6.2.1-
|
54
|
+
"@libp2p/interface": "2.2.1-4a85eb033",
|
55
|
+
"@libp2p/interface-internal": "2.1.1-4a85eb033",
|
56
|
+
"@libp2p/peer-id": "5.0.8-4a85eb033",
|
57
|
+
"@libp2p/utils": "6.2.1-4a85eb033",
|
58
58
|
"@multiformats/multiaddr": "^12.2.3",
|
59
59
|
"@multiformats/multiaddr-matcher": "^1.2.1",
|
60
60
|
"detect-browser": "^5.3.0",
|
@@ -76,9 +76,9 @@
|
|
76
76
|
"uint8arrays": "^5.1.0"
|
77
77
|
},
|
78
78
|
"devDependencies": {
|
79
|
-
"@libp2p/crypto": "5.0.7-
|
80
|
-
"@libp2p/interface-compliance-tests": "6.1.11-
|
81
|
-
"@libp2p/logger": "5.1.4-
|
79
|
+
"@libp2p/crypto": "5.0.7-4a85eb033",
|
80
|
+
"@libp2p/interface-compliance-tests": "6.1.11-4a85eb033",
|
81
|
+
"@libp2p/logger": "5.1.4-4a85eb033",
|
82
82
|
"@types/sinon": "^17.0.3",
|
83
83
|
"aegir": "^44.0.1",
|
84
84
|
"delay": "^6.0.0",
|