@libp2p/kad-dht 14.1.3-0862522fe → 14.1.3-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.
Files changed (2) hide show
  1. package/dist/index.min.js +2 -2
  2. package/package.json +11 -11
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PKadDht = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PKadDht=(()=>{var B4=Object.create;var Gn=Object.defineProperty;var k4=Object.getOwnPropertyDescriptor;var T4=Object.getOwnPropertyNames;var R4=Object.getPrototypeOf,P4=Object.prototype.hasOwnProperty;var ws=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Te=(r,e)=>{for(var t in e)Gn(r,t,{get:e[t],enumerable:!0})},F2=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T4(e))!P4.call(r,i)&&i!==t&&Gn(r,i,{get:()=>e[i],enumerable:!(n=k4(e,i))||n.enumerable});return r};var bs=(r,e,t)=>(t=r!=null?B4(R4(r)):{},F2(e||!r||!r.__esModule?Gn(t,"default",{value:r,enumerable:!0}):t,r)),L4=r=>F2(Gn({},"__esModule",{value:!0}),r);var Q2=ws((Kc,vs)=>{"use strict";var C4=Object.prototype.hasOwnProperty,Re="~";function on(){}Object.create&&(on.prototype=Object.create(null),new on().__proto__||(Re=!1));function U4(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function W2(r,e,t,n,i){if(typeof t!="function")throw new TypeError("The listener must be a function");var s=new U4(t,n||r,i),o=Re?Re+e:e;return r._events[o]?r._events[o].fn?r._events[o]=[r._events[o],s]:r._events[o].push(s):(r._events[o]=s,r._eventsCount++),r}function Qn(r,e){--r._eventsCount===0?r._events=new on:delete r._events[e]}function Ee(){this._events=new on,this._eventsCount=0}Ee.prototype.eventNames=function(){var e=[],t,n;if(this._eventsCount===0)return e;for(n in t=this._events)C4.call(t,n)&&e.push(Re?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Ee.prototype.listeners=function(e){var t=Re?Re+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};Ee.prototype.listenerCount=function(e){var t=Re?Re+e:e,n=this._events[t];return n?n.fn?1:n.length:0};Ee.prototype.emit=function(e,t,n,i,s,o){var a=Re?Re+e:e;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,u,f;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,s),!0;case 6:return c.fn.call(c.context,t,n,i,s,o),!0}for(f=1,u=new Array(l-1);f<l;f++)u[f-1]=arguments[f];c.fn.apply(c.context,u)}else{var h=c.length,p;for(f=0;f<h;f++)switch(c[f].once&&this.removeListener(e,c[f].fn,void 0,!0),l){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,t);break;case 3:c[f].fn.call(c[f].context,t,n);break;case 4:c[f].fn.call(c[f].context,t,n,i);break;default:if(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[f].fn.apply(c[f].context,u)}}return!0};Ee.prototype.on=function(e,t,n){return W2(this,e,t,n,!1)};Ee.prototype.once=function(e,t,n){return W2(this,e,t,n,!0)};Ee.prototype.removeListener=function(e,t,n,i){var s=Re?Re+e:e;if(!this._events[s])return this;if(!t)return Qn(this,s),this;var o=this._events[s];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&Qn(this,s);else{for(var a=0,c=[],l=o.length;a<l;a++)(o[a].fn!==t||i&&!o[a].once||n&&o[a].context!==n)&&c.push(o[a]);c.length?this._events[s]=c.length===1?c[0]:c:Qn(this,s)}return this};Ee.prototype.removeAllListeners=function(e){var t;return e?(t=Re?Re+e:e,this._events[t]&&Qn(this,t)):(this._events=new on,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Re;Ee.EventEmitter=Ee;typeof vs<"u"&&(vs.exports=Ee)});var E3=ws($r=>{"use strict";var y8="[object ArrayBuffer]",Et=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===y8}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),i=r.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let i=new Uint8Array(n),s=0;for(let o of t){let a=this.toUint8Array(o);i.set(a,s),s+=a.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}},Wo="string",w8=/^[0-9a-f]+$/i,b8=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,x8=/^[a-zA-Z0-9-_]+$/,E1=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){let t=Et.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return decodeURIComponent(escape(n))}},Ge=class{static toString(e,t=!1){let n=Et.toArrayBuffer(e),i=new DataView(n),s="";for(let o=0;o<n.byteLength;o+=2){let a=i.getUint16(o,t);s+=String.fromCharCode(a)}return s}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),t);return n}},A1=class r{static isHex(e){return typeof e===Wo&&w8.test(e)}static isBase64(e){return typeof e===Wo&&b8.test(e)}static isBase64Url(e){return typeof e===Wo&&x8.test(e)}static ToString(e,t="utf8"){let n=Et.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Ge.toString(n,!0);case"utf16":case"utf16be":return Ge.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Ge.fromString(e,!0);case"utf16":case"utf16be":return Ge.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=Et.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return E1.fromString(e);case"utf16":case"utf16be":return Ge.fromString(e);case"utf16le":case"usc2":return Ge.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return E1.toString(e);case"utf16":case"utf16be":return Ge.toString(e);case"utf16le":case"usc2":return Ge.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let t=Et.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){let t=Et.toUint8Array(e),n="",i=t.length;for(let s=0;s<i;s++){let o=t[s];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){let s=t.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,t=!1){return Ge.toString(e,t)}static FromUtf16String(e,t=!1){return Ge.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};A1.DEFAULT_UTF8_ENCODING="utf8";function v8(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let s in i)t[s]=i[s]}return t}function E8(...r){let e=r.map(i=>i.byteLength).reduce((i,s)=>i+s),t=new Uint8Array(e),n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(let s of i)t[n++]=s}),t.buffer}function A8(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}$r.BufferSourceConverter=Et;$r.Convert=A1;$r.assign=v8;$r.combine=E8;$r.isEqual=A8});var Da=ws(Mn=>{(function(){var r,e,t,n,i,s,o,a;a=function(c){var l,u,f,h;return l=(c&255<<24)>>>24,u=(c&255<<16)>>>16,f=(c&65280)>>>8,h=c&255,[l,u,f,h].join(".")},o=function(c){var l,u,f,h,p,y;for(l=[],f=h=0;h<=3&&c.length!==0;f=++h){if(f>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}y=e(c),p=y[0],u=y[1],c=c.substring(u),l.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(l.length){case 1:if(l[0]>4294967295)throw new Error("Invalid IP");return l[0]>>>0;case 2:if(l[0]>255||l[1]>16777215)throw new Error("Invalid IP");return(l[0]<<24|l[1])>>>0;case 3:if(l[0]>255||l[1]>255||l[2]>65535)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2])>>>0;case 4:if(l[0]>255||l[1]>255||l[2]>255||l[3]>255)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0;default:throw new Error("Invalid IP")}},t=function(c){return c.charCodeAt(0)},n=t("0"),s=t("a"),i=t("A"),e=function(c){var l,u,f,h,p;for(h=0,l=10,u="9",f=0,c.length>1&&c[f]==="0"&&(c[f+1]==="x"||c[f+1]==="X"?(f+=2,l=16):"0"<=c[f+1]&&c[f+1]<="9"&&(f++,l=8,u="7")),p=f;f<c.length;){if("0"<=c[f]&&c[f]<=u)h=h*l+(t(c[f])-n)>>>0;else if(l===16)if("a"<=c[f]&&c[f]<="f")h=h*l+(10+t(c[f])-s)>>>0;else if("A"<=c[f]&&c[f]<="F")h=h*l+(10+t(c[f])-i)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");f++}if(f===p)throw new Error("empty octet");return[h,f]},r=function(){function c(l,u){var f,h,p,y;if(typeof l!="string")throw new Error("Missing `net' parameter");if(u||(y=l.split("/",2),l=y[0],u=y[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=o(u)}catch(w){throw f=w,new Error("Invalid mask: "+u)}for(h=p=32;p>=0;h=--p)if(this.maskLong===4294967295<<32-h>>>0){this.bitmask=h;break}}else if(u||u===0)this.bitmask=parseInt(u,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(o(l)&this.maskLong)>>>0}catch(w){throw f=w,new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(l){return typeof l=="string"&&(l.indexOf("/")>0||l.split(".").length!==4)&&(l=new c(l)),l instanceof c?this.contains(l.base)&&this.contains(l.broadcast||l.last):(o(l)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(l){return l==null&&(l=1),new c(a(this.netLong+this.size*l),this.mask)},c.prototype.forEach=function(l){var u,f,h;for(h=o(this.first),f=o(this.last),u=0;h<=f;)l(a(h),h,u),u++,h++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),Mn.ip2long=o,Mn.long2ip=a,Mn.Netmask=r}).call(Mn)});var ac={};Te(ac,{EventTypes:()=>Kn,MessageType:()=>O,Record:()=>fe,kadDHT:()=>oc,passthroughMapper:()=>Fa,removePrivateAddressesMapper:()=>Ii,removePublicAddressesMapper:()=>Va});var H2=Symbol.for("@libp2p/content-routing");var q2=Symbol.for("@libp2p/peer-discovery");var xs=Symbol.for("@libp2p/peer-id");var K2=Symbol.for("@libp2p/peer-routing");var $2="keep-alive";var ft=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var $=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ht=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var je=class extends Error{static name="NotFoundError";constructor(e="Not found"){super(e),this.name="NotFoundError"}};var jn=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var Ne=class extends Error{static name="InvalidMessageError";constructor(e="Invalid message"){super(e),this.name="InvalidMessageError"}};var tr=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var te=(r,...e)=>{try{[...e]}catch{}};var _e=class extends EventTarget{#e=new Map;constructor(){super(),te(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let i=this.#e.get(e);i==null&&(i=[],this.#e.set(e,i)),i.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let i=this.#e.get(e);i!=null&&(i=i.filter(({callback:s})=>s!==t),this.#e.set(e,i))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:i})=>!i),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};function z2(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function nn(...r){let e=[];for(let t of r)z2(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function Wn(...r){let e=[];for(let t of r)z2(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var G2=Symbol.for("@libp2p/service-capabilities"),j2=Symbol.for("@libp2p/service-dependencies");function N4(r){return r[Symbol.asyncIterator]!=null}function _4(r){if(N4(r))return(async()=>{for await(let e of r);})();for(let e of r);}var sn=_4;var Es=bs(Q2(),1);var an=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},As=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Z2=r=>globalThis.DOMException===void 0?new As(r):new DOMException(r),Y2=r=>{let e=r.reason===void 0?Z2("This operation was aborted."):r.reason;return e instanceof Error?e:Z2(e)};function rr(r,e){let{milliseconds:t,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=e,o,c=new Promise((l,u)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:h}=e;h.aborted&&u(Y2(h));let p=()=>{u(Y2(h))};h.addEventListener("abort",p,{once:!0}),r.finally(()=>{h.removeEventListener("abort",p)})}if(t===Number.POSITIVE_INFINITY){r.then(l,u);return}let f=new an;o=s.setTimeout.call(void 0,()=>{if(n){try{l(n())}catch(h){u(h)}return}typeof r.cancel=="function"&&r.cancel(),i===!1?l():i instanceof Error?u(i):(f.message=i??`Promise timed out after ${t} milliseconds`,u(f))},t),(async()=>{try{l(await r)}catch(h){u(h)}})()}).finally(()=>{c.clear()});return c.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},c}function Ss(r,e,t){let n=0,i=r.length;for(;i>0;){let s=Math.trunc(i/2),o=n+s;t(r[o],e)<=0?(n=++o,i-=s+1):i=s}return n}var cn=class{#e=[];enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority){this.#e.push(n);return}let i=Ss(this.#e,n,(s,o)=>o.priority-s.priority);this.#e.splice(i,0,n)}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var vr=class extends Es.default{#e;#r;#s=0;#a;#c;#p=0;#n;#l;#t;#m;#i=0;#u;#o;#g;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:cn,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#r=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#a=e.intervalCap,this.#c=e.interval,this.#t=new e.queueClass,this.#m=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#o=e.autoStart===!1}get#b(){return this.#r||this.#s<this.#a}get#x(){return this.#i<this.#u}#v(){this.#i--,this.#f(),this.emit("next")}#E(){this.#w(),this.#y(),this.#l=void 0}get#A(){let e=Date.now();if(this.#n===void 0){let t=this.#p-e;if(t<0)this.#s=this.#e?this.#i:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#E()},t)),!0}return!1}#f(){if(this.#t.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#i===0&&this.emit("idle"),!1;if(!this.#o){let e=!this.#A;if(this.#b&&this.#x){let t=this.#t.dequeue();return t?(this.emit("active"),t(),e&&this.#y(),!0):!1}}return!1}#y(){this.#r||this.#n!==void 0||(this.#n=setInterval(()=>{this.#w()},this.#c),this.#p=Date.now()+this.#c)}#w(){this.#s===0&&this.#i===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#s=this.#e?this.#i:0,this.#h()}#h(){for(;this.#f(););}get concurrency(){return this.#u}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#h()}async#S(e){return new Promise((t,n)=>{e.addEventListener("abort",()=>{n(e.reason)},{once:!0})})}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#g,...t},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#i++,this.#s++;try{t.signal?.throwIfAborted();let s=e({signal:t.signal});t.timeout&&(s=rr(Promise.resolve(s),{milliseconds:t.timeout})),t.signal&&(s=Promise.race([s,this.#S(t.signal)]));let o=await s;n(o),this.emit("completed",o)}catch(s){if(s instanceof an&&!t.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#v()}},t),this.emit("add"),this.#f()})}async addAll(e,t){return Promise.all(e.map(async n=>this.add(n,t)))}start(){return this.#o?(this.#o=!1,this.#h(),this):this}pause(){this.#o=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#d("empty")}async onSizeLessThan(e){this.#t.size<e||await this.#d("next",()=>this.#t.size<e)}async onIdle(){this.#i===0&&this.#t.size===0||await this.#d("idle")}async#d(e,t){return new Promise(n=>{let i=()=>{t&&!t()||(this.off(e,i),n())};this.on(e,i)})}get size(){return this.#t.size}sizeBy(e){return this.#t.filter(e).length}get pending(){return this.#i}get isPaused(){return this.#o}};var Nt={},Er=r=>{r.addEventListener("message",e=>{Er.dispatchEvent("message",r,e)}),r.port!=null&&r.port.addEventListener("message",e=>{Er.dispatchEvent("message",r,e)})};Er.addEventListener=(r,e)=>{Nt[r]==null&&(Nt[r]=[]),Nt[r].push(e)};Er.removeEventListener=(r,e)=>{Nt[r]!=null&&(Nt[r]=Nt[r].filter(t=>t===e))};Er.dispatchEvent=function(r,e,t){Nt[r]!=null&&Nt[r].forEach(n=>n(e,t))};var Is=Er;var Bs="lock:worker:request-read",ks="lock:worker:release-read",Ts="lock:master:grant-read",Rs="lock:worker:request-write",Ps="lock:worker:release-write",Ls="lock:master:grant-write";var X2=(r=21)=>Math.random().toString().substring(2);var J2=(r,e,t,n,i)=>(s,o)=>{if(o.data.type!==t)return;let a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};r.dispatchEvent(new MessageEvent(e,{data:{name:a.name,handler:async()=>{s.postMessage({type:i,name:a.name,identifier:a.identifier}),await new Promise(c=>{let l=u=>{if(u?.data==null)return;let f={type:u.data.type,name:u.data.name,identifier:u.data.identifier};f.type===n&&f.identifier===a.identifier&&(s.removeEventListener("message",l),c())};s.addEventListener("message",l)})}}}))},e0=(r,e,t,n)=>async()=>{let i=X2();return globalThis.postMessage({type:e,identifier:i,name:r}),new Promise(s=>{let o=a=>{if(a?.data==null)return;let c={type:a.data.type,identifier:a.data.identifier};c.type===t&&c.identifier===i&&(globalThis.removeEventListener("message",o),s(()=>{globalThis.postMessage({type:n,identifier:i,name:r})}))};globalThis.addEventListener("message",o)})},D4={singleProcess:!1},t0=r=>{if(r=Object.assign({},D4,r),!!globalThis.document||r.singleProcess){let t=new EventTarget;return Is.addEventListener("message",J2(t,"requestReadLock",Bs,ks,Ts)),Is.addEventListener("message",J2(t,"requestWriteLock",Rs,Ps,Ls)),t}return{isWorker:!0,readLock:t=>e0(t,Bs,Ts,ks),writeLock:t=>e0(t,Rs,Ls,Ps)}};var nr={},_t;async function Ns(r,e){let t,n=new Promise(i=>{t=i});return r.add(async()=>rr((async()=>{await new Promise(i=>{t(()=>{i()})})})(),{milliseconds:e.timeout})),n}var O4=(r,e)=>{if(_t.isWorker===!0)return{readLock:_t.readLock(r,e),writeLock:_t.writeLock(r,e)};let t=new vr({concurrency:1}),n;return{async readLock(){if(n!=null)return Ns(n,e);n=new vr({concurrency:e.concurrency,autoStart:!1});let i=n,s=Ns(n,e);return t.add(async()=>{i.start(),await i.onIdle().then(()=>{n===i&&(n=null)})}),s},async writeLock(){return n=null,Ns(t,e)}}},M4={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function _s(r){let e=Object.assign({},M4,r);return _t==null&&(_t=t0(e),_t.isWorker!==!0&&(_t.addEventListener("requestReadLock",t=>{nr[t.data.name]!=null&&nr[t.data.name].readLock().then(async n=>t.data.handler().finally(()=>{n()}))}),_t.addEventListener("requestWriteLock",async t=>{nr[t.data.name]!=null&&nr[t.data.name].writeLock().then(async n=>t.data.handler().finally(()=>{n()}))}))),nr[e.name]==null&&(nr[e.name]=O4(e.name,e)),nr[e.name]}function se(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var Ar=1e3,Cs=60*Ar,Zn=60*Cs,r0=36*Zn,n0="/ipfs/kad/1.0.0",i0=48*Zn;var s0=24*Zn,o0=10,a0=16384,c0=Zn,hl=10*Ar;var Yn=20,Sr=3,l0=5*Cs,u0=Ar,f0=5*Ar,h0=5*Cs,d0=30*Ar,p0=180*Ar,Us=`${$2}-kad-dht`;function Ce(r=0){return new Uint8Array(r)}function ge(r=0){return new Uint8Array(r)}var V4=Math.pow(2,7),F4=Math.pow(2,14),H4=Math.pow(2,21),Ds=Math.pow(2,28),Os=Math.pow(2,35),Ms=Math.pow(2,42),Vs=Math.pow(2,49),z=128,Ae=127;function oe(r){if(r<V4)return 1;if(r<F4)return 2;if(r<H4)return 3;if(r<Ds)return 4;if(r<Os)return 5;if(r<Ms)return 6;if(r<Vs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Fs(r,e,t=0){switch(oe(r)){case 8:e[t++]=r&255|z,r/=128;case 7:e[t++]=r&255|z,r/=128;case 6:e[t++]=r&255|z,r/=128;case 5:e[t++]=r&255|z,r/=128;case 4:e[t++]=r&255|z,r>>>=7;case 3:e[t++]=r&255|z,r>>>=7;case 2:e[t++]=r&255|z,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function q4(r,e,t=0){switch(oe(r)){case 8:e.set(t++,r&255|z),r/=128;case 7:e.set(t++,r&255|z),r/=128;case 6:e.set(t++,r&255|z),r/=128;case 5:e.set(t++,r&255|z),r/=128;case 4:e.set(t++,r&255|z),r>>>=7;case 3:e.set(t++,r&255|z),r>>>=7;case 2:e.set(t++,r&255|z),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function Hs(r,e){let t=r[e],n=0;if(n+=t&Ae,t<z||(t=r[e+1],n+=(t&Ae)<<7,t<z)||(t=r[e+2],n+=(t&Ae)<<14,t<z)||(t=r[e+3],n+=(t&Ae)<<21,t<z)||(t=r[e+4],n+=(t&Ae)*Ds,t<z)||(t=r[e+5],n+=(t&Ae)*Os,t<z)||(t=r[e+6],n+=(t&Ae)*Ms,t<z)||(t=r[e+7],n+=(t&Ae)*Vs,t<z))return n;throw new RangeError("Could not decode varint")}function K4(r,e){let t=r.get(e),n=0;if(n+=t&Ae,t<z||(t=r.get(e+1),n+=(t&Ae)<<7,t<z)||(t=r.get(e+2),n+=(t&Ae)<<14,t<z)||(t=r.get(e+3),n+=(t&Ae)<<21,t<z)||(t=r.get(e+4),n+=(t&Ae)*Ds,t<z)||(t=r.get(e+5),n+=(t&Ae)*Os,t<z)||(t=r.get(e+6),n+=(t&Ae)*Ms,t<z)||(t=r.get(e+7),n+=(t&Ae)*Vs,t<z))return n;throw new RangeError("Could not decode varint")}function ze(r,e,t=0){return e==null&&(e=ge(oe(r))),e instanceof Uint8Array?Fs(r,e,t):q4(r,e,t)}function Ve(r,e=0){return r instanceof Uint8Array?Hs(r,e):K4(r,e)}var qs=new Float32Array([-0]),Ct=new Uint8Array(qs.buffer);function m0(r,e,t){qs[0]=r,e[t]=Ct[0],e[t+1]=Ct[1],e[t+2]=Ct[2],e[t+3]=Ct[3]}function g0(r,e){return Ct[0]=r[e],Ct[1]=r[e+1],Ct[2]=r[e+2],Ct[3]=r[e+3],qs[0]}var Ks=new Float64Array([-0]),Se=new Uint8Array(Ks.buffer);function y0(r,e,t){Ks[0]=r,e[t]=Se[0],e[t+1]=Se[1],e[t+2]=Se[2],e[t+3]=Se[3],e[t+4]=Se[4],e[t+5]=Se[5],e[t+6]=Se[6],e[t+7]=Se[7]}function w0(r,e){return Se[0]=r[e],Se[1]=r[e+1],Se[2]=r[e+2],Se[3]=r[e+3],Se[4]=r[e+4],Se[5]=r[e+5],Se[6]=r[e+6],Se[7]=r[e+7],Ks[0]}var $4=BigInt(Number.MAX_SAFE_INTEGER),z4=BigInt(Number.MIN_SAFE_INTEGER),Fe=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return sr;if(e<$4&&e>z4)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,i=e-(n<<32n);return t&&(n=~n|0n,i=~i|0n,++i>b0&&(i=0n,++n>b0&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(e){if(e===0)return sr;let t=e<0;t&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):sr}},sr=new Fe(0,0);sr.toBigInt=function(){return 0n};sr.zzEncode=sr.zzDecode=function(){return this};sr.length=function(){return 1};var b0=4294967296n;function x0(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function v0(r,e,t){if(t-e<1)return"";let i,s=[],o=0,a;for(;e<t;)a=r[e++],a<128?s[o++]=a:a>191&&a<224?s[o++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,s[o++]=55296+(a>>10),s[o++]=56320+(a&1023)):s[o++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i!=null?(o>0&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))}function $s(r,e,t){let n=t,i,s;for(let o=0;o<r.length;++o)i=r.charCodeAt(o),i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&((s=r.charCodeAt(o+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++o,e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128);return t-n}function We(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Xn(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var zs=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,We(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw We(this,4);return Xn(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw We(this,4);return Xn(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw We(this,4);let e=g0(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw We(this,4);let e=w0(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw We(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return v0(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw We(this,e);this.pos+=e}else do if(this.pos>=this.len)throw We(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Fe(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw We(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw We(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw We(this,8);let e=Xn(this.buf,this.pos+=4),t=Xn(this.buf,this.pos+=4);return new Fe(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=Hs(this.buf,this.pos);return this.pos+=oe(e),e}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 Gs(r){return new zs(r instanceof Uint8Array?r:r.subarray())}function tt(r,e,t){let n=Gs(r);return e.decode(n,void 0,t)}var Ys={};Te(Ys,{base10:()=>Y4});var Sl=new Uint8Array(0);function A0(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function dt(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 S0(r){return new TextEncoder().encode(r)}function I0(r){return new TextDecoder().decode(r)}function G4(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=i}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var w=0,d=0,x=0,E=y.length;x!==E&&y[x]===0;)x++,w++;for(var m=(E-x)*u+1>>>0,A=new Uint8Array(m);x!==E;){for(var R=y[x],T=0,B=m-1;(R!==0||T<d)&&B!==-1;B--,T++)R+=256*A[B]>>>0,A[B]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");d=T,x++}for(var k=m-d;k!==m&&A[k]===0;)k++;for(var N=c.repeat(w);k<m;++k)N+=r.charAt(A[k]);return N}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var w=0;if(y[w]!==" "){for(var d=0,x=0;y[w]===c;)d++,w++;for(var E=(y.length-w)*l+1>>>0,m=new Uint8Array(E);y[w];){var A=t[y.charCodeAt(w)];if(A===255)return;for(var R=0,T=E-1;(A!==0||R<x)&&T!==-1;T--,R++)A+=a*m[T]>>>0,m[T]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=R,w++}if(y[w]!==" "){for(var B=E-x;B!==E&&m[B]===0;)B++;for(var k=new Uint8Array(d+(E-B)),N=d;B!==E;)k[N++]=m[B++];return k}}}function p(y){var w=h(y);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:h,decode:p}}var j4=G4,W4=j4,k0=W4;var js=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ws=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let i=t.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return T0(this,e)}},Qs=class{decoders;constructor(e){this.decoders=e}or(e){return T0(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function T0(r,e){return new Qs({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Zs=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new js(e,t,n),this.decoder=new Ws(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Ir({name:r,prefix:e,encode:t,decode:n}){return new Zs(r,e,t,n)}function Ut({name:r,prefix:e,alphabet:t}){let{encode:n,decode:i}=k0(t,r);return Ir({prefix:e,name:r,encode:n,decode:s=>dt(i(s))})}function Q4(r,e,t,n){let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let o=new Uint8Array(s*t/8|0),a=0,c=0,l=0;for(let u=0;u<s;++u){let f=i[r[u]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|f,a+=t,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}function Z4(r,e,t){let n=e[e.length-1]==="=",i=(1<<t)-1,s="",o=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],o+=8;o>t;)o-=t,s+=e[i&a>>o];if(o!==0&&(s+=e[i&a<<t-o]),n)for(;s.length*t&7;)s+="=";return s}function ne({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Ir({prefix:e,name:r,encode(i){return Z4(i,n,t)},decode(i){return Q4(i,n,t,r)}})}var Y4=Ut({prefix:"9",name:"base10",alphabet:"0123456789"});var Xs={};Te(Xs,{base16:()=>X4,base16upper:()=>J4});var X4=ne({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),J4=ne({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Js={};Te(Js,{base2:()=>e5});var e5=ne({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var eo={};Te(eo,{base256emoji:()=>s5});var R0=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}"),t5=R0.reduce((r,e,t)=>(r[t]=e,r),[]),r5=R0.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function n5(r){return r.reduce((e,t)=>(e+=t5[t],e),"")}function i5(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let i=r5[n];if(i==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var s5=Ir({prefix:"\u{1F680}",name:"base256emoji",encode:n5,decode:i5});var to={};Te(to,{base32:()=>pt,base32hex:()=>l5,base32hexpad:()=>f5,base32hexpadupper:()=>h5,base32hexupper:()=>u5,base32pad:()=>a5,base32padupper:()=>c5,base32upper:()=>o5,base32z:()=>d5});var pt=ne({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),o5=ne({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),a5=ne({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),c5=ne({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),l5=ne({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u5=ne({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),f5=ne({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),h5=ne({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),d5=ne({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ro={};Te(ro,{base36:()=>ln,base36upper:()=>p5});var ln=Ut({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),p5=Ut({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var no={};Te(no,{base58btc:()=>Y,base58flickr:()=>m5});var Y=Ut({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),m5=Ut({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var io={};Te(io,{base64:()=>g5,base64pad:()=>y5,base64url:()=>w5,base64urlpad:()=>b5});var g5=ne({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),y5=ne({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w5=ne({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b5=ne({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var so={};Te(so,{base8:()=>x5});var x5=ne({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var oo={};Te(oo,{identity:()=>v5});var v5=Ir({prefix:"\0",name:"identity",encode:r=>I0(r),decode:r=>S0(r)});var Fl=new TextEncoder,Hl=new TextDecoder;var P0=85;var co={};Te(co,{identity:()=>mt});var A5=C0,N0=128,S5=127,I5=~S5,B5=Math.pow(2,31);function C0(r,e,t){e=e||[],t=t||0;for(var n=t;r>=B5;)e[t++]=r&255|N0,r/=128;for(;r&I5;)e[t++]=r&255|N0,r>>>=7;return e[t]=r|0,C0.bytes=t-n+1,e}var k5=ao,T5=128,_0=127;function ao(r,n){var t=0,n=n||0,i=0,s=n,o,a=r.length;do{if(s>=a)throw ao.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=i<28?(o&_0)<<i:(o&_0)*Math.pow(2,i),i+=7}while(o>=T5);return ao.bytes=s-n,t}var R5=Math.pow(2,7),P5=Math.pow(2,14),L5=Math.pow(2,21),N5=Math.pow(2,28),_5=Math.pow(2,35),C5=Math.pow(2,42),U5=Math.pow(2,49),D5=Math.pow(2,56),O5=Math.pow(2,63),M5=function(r){return r<R5?1:r<P5?2:r<L5?3:r<N5?4:r<_5?5:r<C5?6:r<U5?7:r<D5?8:r<O5?9:10},V5={encode:A5,decode:k5,encodingLength:M5},F5=V5,un=F5;function fn(r,e=0){return[un.decode(r,e),un.decode.bytes]}function Br(r,e,t=0){return un.encode(r,e,t),e}function kr(r){return un.encodingLength(r)}function Qe(r,e){let t=e.byteLength,n=kr(r),i=n+kr(t),s=new Uint8Array(i+t);return Br(r,s,0),Br(t,s,n),s.set(e,i),new Tr(r,t,e,s)}function ae(r){let e=dt(r),[t,n]=fn(e),[i,s]=fn(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Tr(t,i,o,e)}function U0(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&A0(r.bytes,t.bytes)}}var Tr=class{code;size;digest;bytes;constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};var D0=0,H5="identity",O0=dt;function q5(r){return Qe(D0,O0(r))}var mt={code:D0,name:H5,encode:O0,digest:q5};var fo={};Te(fo,{sha256:()=>gt,sha512:()=>K5});function uo({name:r,code:e,encode:t}){return new lo(r,e,t)}var lo=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Qe(this.code,t):t.then(n=>Qe(this.code,n))}else throw Error("Unknown type, must be binary type")}};function V0(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var gt=uo({name:"sha2-256",code:18,encode:V0("SHA-256")}),K5=uo({name:"sha2-512",code:19,encode:V0("SHA-512")});function F0(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return z5(t,ho(r),e??Y.encoder);default:return G5(t,ho(r),e??pt.encoder)}}var H0=new WeakMap;function ho(r){let e=H0.get(r);if(e==null){let t=new Map;return H0.set(r,t),t}return e}var re=class r{code;version;multihash;bytes;"/";constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==hn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==j5)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Qe(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&U0(e.multihash,n.multihash)}toString(e){return F0(this,e)}toJSON(){return{"/":F0(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:i,multihash:s,bytes:o}=t;return new r(n,i,s,o??q0(n,i,s.bytes))}else if(t[W5]===!0){let{version:n,multihash:i,code:s}=t,o=ae(i);return r.create(n,s,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==hn)throw new Error(`Version 0 CID must use dag-pb (code: ${hn}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let i=q0(e,t,n.bytes);return new r(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,hn,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,i=dt(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=i.subarray(t.multihashSize-t.digestSize),o=new Tr(t.multihashCode,t.digestSize,s,i);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,h]=fn(e.subarray(t));return t+=h,f},i=n(),s=hn;if(i===18?(i=0,t=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=t,a=n(),c=n(),l=t+c,u=l-o;return{version:i,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(e,t){let[n,i]=$5(e,t),s=r.decode(i);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ho(s).set(n,e),s}};function $5(r,e){switch(r[0]){case"Q":{let t=e??Y;return[Y.prefix,t.decode(`${Y.prefix}${r}`)]}case Y.prefix:{let t=e??Y;return[Y.prefix,t.decode(r)]}case pt.prefix:{let t=e??pt;return[pt.prefix,t.decode(r)]}case ln.prefix:{let t=e??ln;return[ln.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function z5(r,e,t){let{prefix:n}=t;if(n!==Y.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return i}function G5(r,e,t){let{prefix:n}=t,i=e.get(n);if(i==null){let s=t.encode(r);return e.set(n,s),s}else return i}var hn=112,j5=18;function q0(r,e,t){let n=kr(r),i=n+kr(e),s=new Uint8Array(i+t.byteLength);return Br(r,s,0),Br(e,s,n),s.set(t,i),s}var W5=Symbol.for("@ipld/js-cid/CID");var dn={...oo,...Js,...so,...Ys,...Xs,...to,...ro,...no,...io,...eo},l9={...fo,...co};function $0(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var K0=$0("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),po=$0("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ge(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Q5={utf8:K0,"utf-8":K0,hex:dn.base16,latin1:po,ascii:po,binary:po,...dn},e1=Q5;function Q(r,e="utf8"){let t=e1[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function mo(r){let e=r??8192,t=e>>>1,n,i=e;return function(o){if(o<1||o>t)return ge(o);i+o>e&&(n=ge(e),i=0);let a=n.subarray(i,i+=o);return i&7&&(i=(i|7)+1),a}}var or=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function go(){}var wo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Z5=mo();function Y5(r){return globalThis.Buffer!=null?ge(r):Z5(r)}var mn=class{len;head;tail;states;constructor(){this.len=0,this.head=new or(go,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new or(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new bo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(t1,10,Fe.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=Fe.fromBigInt(e);return this._push(t1,t.length(),t)}uint64Number(e){return this._push(Fs,oe(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=Fe.fromBigInt(e).zzEncode();return this._push(t1,t.length(),t)}sint64Number(e){let t=Fe.fromNumber(e).zzEncode();return this._push(t1,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(yo,1,e?1:0)}fixed32(e){return this._push(pn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=Fe.fromBigInt(e);return this._push(pn,4,t.lo)._push(pn,4,t.hi)}fixed64Number(e){let t=Fe.fromNumber(e);return this._push(pn,4,t.lo)._push(pn,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(m0,4,e)}double(e){return this._push(y0,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(yo,1,0):this.uint32(t)._push(J5,t,e)}string(e){let t=x0(e);return t!==0?this.uint32(t)._push($s,t,e):this._push(yo,1,0)}fork(){return this.states=new wo(this),this.head=this.tail=new or(go,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(go,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=Y5(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function yo(r,e,t){e[t]=r&255}function X5(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var bo=class extends or{next;constructor(e,t){super(X5,e,t),this.next=void 0}};function t1(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function pn(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function J5(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(mn.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(e6,e,r),this},mn.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(t6,e,r),this});function e6(r,e,t){e.set(r,t)}function t6(r,e,t){r.length<40?$s(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(Q(r),t)}function xo(){return new mn}function rt(r,e){let t=xo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Rr;(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"})(Rr||(Rr={}));function r1(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function Pr(r){function e(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let t=function(s,o){let a=e(s);o.int32(a)},n=function(s){let o=s.int32();return e(o)};return r1("enum",Rr.VARINT,t,n)}function nt(r,e){return r1("message",Rr.LENGTH_DELIMITED,r,e)}var Lr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var gn;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.key!=null&&t.key.byteLength>0&&(n.uint32(10),n.bytes(t.key)),t.value!=null&&t.value.byteLength>0&&(n.uint32(18),n.bytes(t.value)),t.timeReceived!=null&&t.timeReceived!==""&&(n.uint32(42),n.string(t.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={key:Ce(0),value:Ce(0),timeReceived:""},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.key=t.bytes();break}case 2:{s.value=t.bytes();break}case 5:{s.timeReceived=t.string();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(gn||(gn={}));function z0(r){let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0"),i=String(r.getUTCHours()).padStart(2,"0"),s=String(r.getUTCMinutes()).padStart(2,"0"),o=String(r.getUTCSeconds()).padStart(2,"0"),a=r.getUTCMilliseconds(),c=String(a*1e3*1e3).padStart(9,"0");return`${e}-${t}-${n}T${i}:${s}:${o}.${c}Z`}function G0(r){let e=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),t=String(r).trim().match(e);if(t==null)throw new Error("Invalid format");let n=parseInt(t[1],10),i=parseInt(t[2],10)-1,s=parseInt(t[3],10),o=parseInt(t[4],10),a=parseInt(t[5],10),c=parseInt(t[6],10),l=parseInt(t[7].slice(0,-6),10);return new Date(Date.UTC(n,i,s,o,a,c,l))}var fe=class r{key;value;timeReceived;constructor(e,t,n){if(!(e instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(t instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=e,this.value=t,this.timeReceived=n}serialize(){return gn.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:z0(this.timeReceived)}}static deserialize(e){let t=gn.decode(e);return new r(t.key,t.value,new Date(t.timeReceived))}static fromDeserialized(e){let t=G0(e.timeReceived);if(e.key==null)throw new Error("key missing from deserialized object");if(e.value==null)throw new Error("value missing from deserialized object");return new r(e.key,e.value,t)}};function n6(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var j0=n6;function i6(r){return r[Symbol.asyncIterator]!=null}function s6(r,e){let t=0;if(i6(r))return async function*(){for await(let c of r)yield e(c,t++)}();let n=j0(r),{value:i,done:s}=n.next();if(s===!0)return function*(){}();let o=e(i,t++);if(typeof o.then=="function")return async function*(){yield await o;for await(let c of n)yield e(c,t++)}();let a=e;return function*(){yield o;for(let c of n)yield a(c,t++)}()}var Dt=s6;var n1=globalThis.CustomEvent??Event;async function*ar(r,e={}){let t=e.concurrency??1/0;t<1&&(t=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,s=[],o=se(),a=se(),c=!1,l,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let y of r){if(s.length===t&&(o=se(),await o.promise),u)break;let w={done:!1};s.push(w),y().then(d=>{w.done=!0,w.ok=!0,w.value=d,i.dispatchEvent(new n1("task-complete"))},d=>{w.done=!0,w.err=d,i.dispatchEvent(new n1("task-complete"))})}c=!0,i.dispatchEvent(new n1("task-complete"))}catch(y){l=y,i.dispatchEvent(new n1("task-complete"))}});function f(){return n?s[0]?.done:!!s.find(y=>y.done)}function*h(){for(;s.length>0&&s[0].done;){let y=s[0];if(s.shift(),y.ok)yield y.value;else throw u=!0,o.resolve(),y.err;o.resolve()}}function*p(){for(;f();)for(let y=0;y<s.length;y++)if(s[y].done){let w=s[y];if(s.splice(y,1),y--,w.ok)yield w.value;else throw u=!0,o.resolve(),w.err;o.resolve()}}for(;;){if(f()||(a=se(),await a.promise),l!=null)throw l;if(n?yield*h():yield*p(),c&&s.length===0)break}}var i1=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Nr=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new i1(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new i1(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var vo=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function _r(r={}){return o6(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function o6(r,e){e=e??{};let t=e.onEnd,n=new Nr,i,s,o,a=se(),c=async()=>{try{return n.isEmpty()?o?{done:!0}:await new Promise((d,x)=>{s=E=>{s=null,n.push(E);try{d(r(n))}catch(m){x(m)}return i}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=se()})}},l=d=>s!=null?s(d):(n.push(d),i),u=d=>(n=new Nr,s!=null?s({error:d}):(n.push({error:d}),i)),f=d=>{if(o)return i;if(e?.objectMode!==!0&&d?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:d})},h=d=>o?i:(o=!0,d!=null?u(d):l({done:!0})),p=()=>(n=new Nr,h(),{done:!0}),y=d=>(h(d),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:c,return:p,throw:y,push:f,end:h,get readableLength(){return n.size},onEmpty:async d=>{let x=d?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let E,m;x!=null&&(E=new Promise((A,R)=>{m=()=>{R(new vo)},x.addEventListener("abort",m)}));try{await Promise.race([a.promise,E])}finally{m!=null&&x!=null&&x?.removeEventListener("abort",m)}}},t==null)return i;let w=i;return i={[Symbol.asyncIterator](){return this},next(){return w.next()},throw(d){return w.throw(d),t!=null&&(t(d),t=void 0),{done:!0}},return(){return w.return(),t!=null&&(t(),t=void 0),{done:!0}},push:f,end(d){return w.end(d),t!=null&&(t(d),t=void 0),i},get readableLength(){return w.readableLength},onEmpty:d=>w.onEmpty(d)},i}function a6(r){return r[Symbol.asyncIterator]!=null}function c6(...r){let e=[];for(let t of r)a6(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=_r({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let i of n)t.push(i)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var s1=c6;function Ot(r,...e){if(r==null)throw new Error("Empty pipeline");if(Eo(r)){let n=r;r=()=>n.source}else if(Q0(r)||W0(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&Eo(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let n=1;n<t.length-1;n++)Eo(t[n])&&(t[n]=u6(t[n]));return l6(...t)}var l6=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},W0=r=>r?.[Symbol.asyncIterator]!=null,Q0=r=>r?.[Symbol.iterator]!=null,Eo=r=>r==null?!1:r.sink!=null&&r.source!=null,u6=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=_r({objectMode:!0});t.then(()=>{n.end()},o=>{n.end(o)});let i,s=r.source;if(W0(s))i=async function*(){yield*s,n.end()};else if(Q0(s))i=function*(){yield*s,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return s1(n,i())}return r.source};function X(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Mt=class extends Error{constructor(e="Query error"){super(e),this.name="QueryError"}},o1=class extends Error{constructor(e="Query aborted"){super(e),this.name="QueryAbortedError"}},a1=class extends Error{constructor(e="Invalid record"){super(e),this.name="InvalidRecordError"}},c1=class extends Error{constructor(e="No selector function configured for prefix"){super(e),this.name="MissingSelectorError"}};var Z0;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.key!=null&&(n.uint32(10),n.bytes(t.key)),t.value!=null&&(n.uint32(18),n.bytes(t.value)),t.author!=null&&(n.uint32(26),n.bytes(t.author)),t.signature!=null&&(n.uint32(34),n.bytes(t.signature)),t.timeReceived!=null&&(n.uint32(42),n.string(t.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.key=t.bytes();break}case 2:{s.value=t.bytes();break}case 3:{s.author=t.bytes();break}case 4:{s.signature=t.bytes();break}case 5:{s.timeReceived=t.string();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(Z0||(Z0={}));var O;(function(r){r.PUT_VALUE="PUT_VALUE",r.GET_VALUE="GET_VALUE",r.ADD_PROVIDER="ADD_PROVIDER",r.GET_PROVIDERS="GET_PROVIDERS",r.FIND_NODE="FIND_NODE",r.PING="PING"})(O||(O={}));var l1;(function(r){r[r.PUT_VALUE=0]="PUT_VALUE",r[r.GET_VALUE=1]="GET_VALUE",r[r.ADD_PROVIDER=2]="ADD_PROVIDER",r[r.GET_PROVIDERS=3]="GET_PROVIDERS",r[r.FIND_NODE=4]="FIND_NODE",r[r.PING=5]="PING"})(l1||(l1={}));(function(r){r.codec=()=>Pr(l1)})(O||(O={}));var Ur;(function(r){r.NOT_CONNECTED="NOT_CONNECTED",r.CONNECTED="CONNECTED",r.CAN_CONNECT="CAN_CONNECT",r.CANNOT_CONNECT="CANNOT_CONNECT"})(Ur||(Ur={}));var Ao;(function(r){r[r.NOT_CONNECTED=0]="NOT_CONNECTED",r[r.CONNECTED=1]="CONNECTED",r[r.CAN_CONNECT=2]="CAN_CONNECT",r[r.CANNOT_CONNECT=3]="CANNOT_CONNECT"})(Ao||(Ao={}));(function(r){r.codec=()=>Pr(Ao)})(Ur||(Ur={}));var Cr;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),t.id!=null&&t.id.byteLength>0&&(n.uint32(10),n.bytes(t.id)),t.multiaddrs!=null)for(let s of t.multiaddrs)n.uint32(18),n.bytes(s);t.connection!=null&&(n.uint32(24),Ur.codec().encode(t.connection,n)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={id:Ce(0),multiaddrs:[]},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.id=t.bytes();break}case 2:{if(i.limits?.multiaddrs!=null&&s.multiaddrs.length===i.limits.multiaddrs)throw new Lr('Decode error - map field "multiaddrs" had too many elements');s.multiaddrs.push(t.bytes());break}case 3:{s.connection=Ur.codec().decode(t);break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(Cr||(Cr={}));var yt;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),t.type!=null&&l1[t.type]!==0&&(n.uint32(8),O.codec().encode(t.type,n)),t.clusterLevel!=null&&(n.uint32(80),n.int32(t.clusterLevel)),t.key!=null&&(n.uint32(18),n.bytes(t.key)),t.record!=null&&(n.uint32(26),n.bytes(t.record)),t.closer!=null)for(let s of t.closer)n.uint32(66),Cr.codec().encode(s,n);if(t.providers!=null)for(let s of t.providers)n.uint32(74),Cr.codec().encode(s,n);i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={type:O.PUT_VALUE,closer:[],providers:[]},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.type=O.codec().decode(t);break}case 10:{s.clusterLevel=t.int32();break}case 2:{s.key=t.bytes();break}case 3:{s.record=t.bytes();break}case 8:{if(i.limits?.closer!=null&&s.closer.length===i.limits.closer)throw new Lr('Decode error - map field "closer" had too many elements');s.closer.push(Cr.codec().decode(t,t.uint32(),{limits:i.limits?.closer$}));break}case 9:{if(i.limits?.providers!=null&&s.providers.length===i.limits.providers)throw new Lr('Decode error - map field "providers" had too many elements');s.providers.push(Cr.codec().decode(t,t.uint32(),{limits:i.limits?.providers$}));break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(yt||(yt={}));function So(r,e={}){let t={...r,name:"SEND_QUERY",type:0,messageName:r.type,messageType:r.type};return e.onProgress?.(new CustomEvent("kad-dht:query:send-query",{detail:t})),t}function yn(r,e={}){let t={...r,name:"PEER_RESPONSE",type:1,messageName:r.messageType,closer:r.closer??[],providers:r.providers??[]};return e.onProgress?.(new CustomEvent("kad-dht:query:peer-response",{detail:t})),t}function u1(r,e={}){let t={...r,name:"FINAL_PEER",type:2};return e.onProgress?.(new CustomEvent("kad-dht:query:final-peer",{detail:t})),t}function qe(r,e={}){let t={...r,name:"QUERY_ERROR",type:3};return e.onProgress?.(new CustomEvent("kad-dht:query:query-error",{detail:t})),t}function Io(r,e={}){let t={...r,name:"PROVIDER",type:4};return e.onProgress?.(new CustomEvent("kad-dht:query:provider",{detail:t})),t}function wn(r,e={}){let t={...r,name:"VALUE",type:5};return e.onProgress?.(new CustomEvent("kad-dht:query:value",{detail:t})),t}function Bo(r,e={}){let t={...r,name:"DIAL_PEER",type:7};return e.onProgress?.(new CustomEvent("kad-dht:query:dial-peer",{detail:t})),t}function D(r,e="utf8"){let t=e1[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}function Y0(r,e,t){if(t.length===0)throw new $("No records given");let i=D(e).split("/");if(i.length<3)throw new $("Record key does not have a selector function");let s=r[i[1].toString()];if(s==null)throw new c1(`No selector function configured for key type "${i[1]}"`);return t.length===1?0:s(e,t)}function f6(r,e){return 0}var X0={pk:f6};function J0(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function h6(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Dr(r,...e){if(!h6(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function e3(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");J0(r.outputLen),J0(r.blockLen)}function Or(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function t3(r,e){Dr(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var cr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var f1=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Ze=(r,e)=>r<<32-e|r>>>e;var xu=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function r3(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function bn(r){return typeof r=="string"&&(r=r3(r)),Dr(r),r}function ko(...r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];Dr(i),e+=i.length}let t=new Uint8Array(e);for(let n=0,i=0;n<r.length;n++){let s=r[n];t.set(s,i),i+=s.length}return t}var Mr=class{clone(){return this._cloneInto()}},vu={}.toString;function h1(r){let e=n=>r().update(bn(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Vr(r=32){if(cr&&typeof cr.getRandomValues=="function")return cr.getRandomValues(new Uint8Array(r));if(cr&&typeof cr.randomBytes=="function")return cr.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function d6(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(t>>i&s),a=Number(t&s),c=n?4:0,l=n?0:4;r.setUint32(e+c,o,n),r.setUint32(e+l,a,n)}var n3=(r,e,t)=>r&e^~r&t,i3=(r,e,t)=>r&e^r&t^e&t,Fr=class extends Mr{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=f1(this.buffer)}update(e){Or(this);let{view:t,buffer:n,blockLen:i}=this;e=bn(e);let s=e.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let c=f1(e);for(;i<=s-o;o+=i)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Or(this),t3(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let f=o;f<i;f++)t[f]=0;d6(n,i-8,BigInt(this.length*8),s),this.process(n,0);let a=f1(e),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:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(n),e}};var d1=BigInt(4294967295),To=BigInt(32);function s3(r,e=!1){return e?{h:Number(r&d1),l:Number(r>>To&d1)}:{h:Number(r>>To&d1)|0,l:Number(r&d1)|0}}function p6(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){let{h:s,l:o}=s3(r[i],e);[t[i],n[i]]=[s,o]}return[t,n]}var m6=(r,e)=>BigInt(r>>>0)<<To|BigInt(e>>>0),g6=(r,e,t)=>r>>>t,y6=(r,e,t)=>r<<32-t|e>>>t,w6=(r,e,t)=>r>>>t|e<<32-t,b6=(r,e,t)=>r<<32-t|e>>>t,x6=(r,e,t)=>r<<64-t|e>>>t-32,v6=(r,e,t)=>r>>>t-32|e<<64-t,E6=(r,e)=>e,A6=(r,e)=>r,S6=(r,e,t)=>r<<t|e>>>32-t,I6=(r,e,t)=>e<<t|r>>>32-t,B6=(r,e,t)=>e<<t-32|r>>>64-t,k6=(r,e,t)=>r<<t-32|e>>>64-t;function T6(r,e,t,n){let i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:i|0}}var R6=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),P6=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,L6=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),N6=(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,_6=(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0),C6=(r,e,t,n,i,s)=>e+t+n+i+s+(r/2**32|0)|0;var U6={fromBig:s3,split:p6,toBig:m6,shrSH:g6,shrSL:y6,rotrSH:w6,rotrSL:b6,rotrBH:x6,rotrBL:v6,rotr32H:E6,rotr32L:A6,rotlSH:S6,rotlSL:I6,rotlBH:B6,rotlBL:k6,add:T6,add3L:R6,add3H:P6,add4L:L6,add4H:N6,add5H:C6,add5L:_6},U=U6;var[D6,O6]=U.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))),Vt=new Uint32Array(80),Ft=new Uint32Array(80),Ro=class extends Fr{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:e,Al:t,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:f,Fl:h,Gh:p,Gl:y,Hh:w,Hl:d}=this;return[e,t,n,i,s,o,a,c,l,u,f,h,p,y,w,d]}set(e,t,n,i,s,o,a,c,l,u,f,h,p,y,w,d){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=f|0,this.Fl=h|0,this.Gh=p|0,this.Gl=y|0,this.Hh=w|0,this.Hl=d|0}process(e,t){for(let m=0;m<16;m++,t+=4)Vt[m]=e.getUint32(t),Ft[m]=e.getUint32(t+=4);for(let m=16;m<80;m++){let A=Vt[m-15]|0,R=Ft[m-15]|0,T=U.rotrSH(A,R,1)^U.rotrSH(A,R,8)^U.shrSH(A,R,7),B=U.rotrSL(A,R,1)^U.rotrSL(A,R,8)^U.shrSL(A,R,7),k=Vt[m-2]|0,N=Ft[m-2]|0,ce=U.rotrSH(k,N,19)^U.rotrBH(k,N,61)^U.shrSH(k,N,6),K=U.rotrSL(k,N,19)^U.rotrBL(k,N,61)^U.shrSL(k,N,6),M=U.add4L(B,K,Ft[m-7],Ft[m-16]),le=U.add4H(M,T,ce,Vt[m-7],Vt[m-16]);Vt[m]=le|0,Ft[m]=M|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:f,El:h,Fh:p,Fl:y,Gh:w,Gl:d,Hh:x,Hl:E}=this;for(let m=0;m<80;m++){let A=U.rotrSH(f,h,14)^U.rotrSH(f,h,18)^U.rotrBH(f,h,41),R=U.rotrSL(f,h,14)^U.rotrSL(f,h,18)^U.rotrBL(f,h,41),T=f&p^~f&w,B=h&y^~h&d,k=U.add5L(E,R,B,O6[m],Ft[m]),N=U.add5H(k,x,A,T,D6[m],Vt[m]),ce=k|0,K=U.rotrSH(n,i,28)^U.rotrBH(n,i,34)^U.rotrBH(n,i,39),M=U.rotrSL(n,i,28)^U.rotrBL(n,i,34)^U.rotrBL(n,i,39),le=n&s^n&a^s&a,S=i&o^i&c^o&c;x=w|0,E=d|0,w=p|0,d=y|0,p=f|0,y=h|0,{h:f,l:h}=U.add(l|0,u|0,N|0,ce|0),l=a|0,u=c|0,a=s|0,c=o|0,s=n|0,o=i|0;let P=U.add3L(ce,M,S);n=U.add3H(P,N,K,le),i=P|0}({h:n,l:i}=U.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=U.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=U.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=U.add(this.Dh|0,this.Dl|0,l|0,u|0),{h:f,l:h}=U.add(this.Eh|0,this.El|0,f|0,h|0),{h:p,l:y}=U.add(this.Fh|0,this.Fl|0,p|0,y|0),{h:w,l:d}=U.add(this.Gh|0,this.Gl|0,w|0,d|0),{h:x,l:E}=U.add(this.Hh|0,this.Hl|0,x|0,E|0),this.set(n,i,s,o,a,c,l,u,f,h,p,y,w,d,x,E)}roundClean(){Vt.fill(0),Ft.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 o3=h1(()=>new Ro);var m1={};Te(m1,{aInRange:()=>Ue,abool:()=>Ye,abytes:()=>Hr,bitGet:()=>K6,bitLen:()=>Co,bitMask:()=>vn,bitSet:()=>$6,bytesToHex:()=>bt,bytesToNumberBE:()=>xt,bytesToNumberLE:()=>qt,concatBytes:()=>vt,createHmacDrbg:()=>Uo,ensureBytes:()=>ie,equalBytes:()=>H6,hexToBytes:()=>ur,hexToNumber:()=>_o,inRange:()=>xn,isBytes:()=>Ht,memoized:()=>hr,notImplemented:()=>G6,numberToBytesBE:()=>Kt,numberToBytesLE:()=>fr,numberToHexUnpadded:()=>lr,numberToVarBytesBE:()=>F6,utf8ToBytes:()=>q6,validateObject:()=>it});var No=BigInt(0),p1=BigInt(1),M6=BigInt(2);function Ht(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Hr(r){if(!Ht(r))throw new Error("Uint8Array expected")}function Ye(r,e){if(typeof e!="boolean")throw new Error(`${r} must be valid boolean, got "${e}".`)}var V6=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function bt(r){Hr(r);let e="";for(let t=0;t<r.length;t++)e+=V6[r[t]];return e}function lr(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function _o(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var wt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function a3(r){if(r>=wt._0&&r<=wt._9)return r-wt._0;if(r>=wt._A&&r<=wt._F)return r-(wt._A-10);if(r>=wt._a&&r<=wt._f)return r-(wt._a-10)}function ur(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){let o=a3(r.charCodeAt(s)),a=a3(r.charCodeAt(s+1));if(o===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[i]=o*16+a}return n}function xt(r){return _o(bt(r))}function qt(r){return Hr(r),_o(bt(Uint8Array.from(r).reverse()))}function Kt(r,e){return ur(r.toString(16).padStart(e*2,"0"))}function fr(r,e){return Kt(r,e).reverse()}function F6(r){return ur(lr(r))}function ie(r,e,t){let n;if(typeof e=="string")try{n=ur(e)}catch(s){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${s}`)}else if(Ht(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let i=n.length;if(typeof t=="number"&&i!==t)throw new Error(`${r} expected ${t} bytes, got ${i}`);return n}function vt(...r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];Hr(i),e+=i.length}let t=new Uint8Array(e);for(let n=0,i=0;n<r.length;n++){let s=r[n];t.set(s,i),i+=s.length}return t}function H6(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function q6(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var Po=r=>typeof r=="bigint"&&No<=r;function xn(r,e,t){return Po(r)&&Po(e)&&Po(t)&&e<=r&&r<t}function Ue(r,e,t,n){if(!xn(e,t,n))throw new Error(`expected valid ${r}: ${t} <= n < ${n}, got ${typeof e} ${e}`)}function Co(r){let e;for(e=0;r>No;r>>=p1,e+=1);return e}function K6(r,e){return r>>BigInt(e)&p1}function $6(r,e,t){return r|(t?p1:No)<<BigInt(e)}var vn=r=>(M6<<BigInt(r-1))-p1,Lo=r=>new Uint8Array(r),c3=r=>Uint8Array.from(r);function Uo(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Lo(r),i=Lo(r),s=0,o=()=>{n.fill(1),i.fill(0),s=0},a=(...f)=>t(i,n,...f),c=(f=Lo())=>{i=a(c3([0]),f),n=a(),f.length!==0&&(i=a(c3([1]),f),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0,h=[];for(;f<e;){n=a();let p=n.slice();h.push(p),f+=n.length}return vt(...h)};return(f,h)=>{o(),c(f);let p;for(;!(p=h(l()));)c();return o(),p}}var z6={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"||Ht(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function it(r,e,t={}){let n=(i,s,o)=>{let a=z6[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let c=r[i];if(!(o&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(let[i,s]of Object.entries(e))n(i,s,!1);for(let[i,s]of Object.entries(t))n(i,s,!0);return r}var G6=()=>{throw new Error("not implemented")};function hr(r){let e=new WeakMap;return(t,...n)=>{let i=e.get(t);if(i!==void 0)return i;let s=r(t,...n);return e.set(t,s),s}}var he=BigInt(0),J=BigInt(1),dr=BigInt(2),j6=BigInt(3),Do=BigInt(4),l3=BigInt(5),u3=BigInt(8),W6=BigInt(9),Q6=BigInt(16);function W(r,e){let t=r%e;return t>=he?t:e+t}function Z6(r,e,t){if(t<=he||e<he)throw new Error("Expected power/modulo > 0");if(t===J)return he;let n=J;for(;e>he;)e&J&&(n=n*r%t),r=r*r%t,e>>=J;return n}function ee(r,e,t){let n=r;for(;e-- >he;)n*=n,n%=t;return n}function g1(r,e){if(r===he||e<=he)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=W(r,e),n=e,i=he,s=J,o=J,a=he;for(;t!==he;){let l=n/t,u=n%t,f=i-o*l,h=s-a*l;n=t,t=u,i=o,s=a,o=f,a=h}if(n!==J)throw new Error("invert: does not exist");return W(i,e)}function Y6(r){let e=(r-J)/dr,t,n,i;for(t=r-J,n=0;t%dr===he;t/=dr,n++);for(i=dr;i<r&&Z6(i,e,r)!==r-J;i++);if(n===1){let o=(r+J)/Do;return function(c,l){let u=c.pow(l,o);if(!c.eql(c.sqr(u),l))throw new Error("Cannot find square root");return u}}let s=(t+J)/dr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let l=n,u=a.pow(a.mul(a.ONE,i),t),f=a.pow(c,s),h=a.pow(c,t);for(;!a.eql(h,a.ONE);){if(a.eql(h,a.ZERO))return a.ZERO;let p=1;for(let w=a.sqr(h);p<l&&!a.eql(w,a.ONE);p++)w=a.sqr(w);let y=a.pow(u,J<<BigInt(l-p-1));u=a.sqr(y),f=a.mul(f,y),h=a.mul(h,u),l=p}return f}}function X6(r){if(r%Do===j6){let e=(r+J)/Do;return function(n,i){let s=n.pow(i,e);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(r%u3===l3){let e=(r-l3)/u3;return function(n,i){let s=n.mul(i,dr),o=n.pow(s,e),a=n.mul(i,o),c=n.mul(n.mul(a,dr),o),l=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(l),i))throw new Error("Cannot find square root");return l}}return r%Q6,Y6(r)}var f3=(r,e)=>(W(r,e)&J)===J,J6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Oo(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=J6.reduce((n,i)=>(n[i]="function",n),e);return it(r,t)}function e8(r,e,t){if(t<he)throw new Error("Expected power > 0");if(t===he)return r.ONE;if(t===J)return e;let n=r.ONE,i=e;for(;t>he;)t&J&&(n=r.mul(n,i)),i=r.sqr(i),t>>=J;return n}function t8(r,e){let t=new Array(e.length),n=e.reduce((s,o,a)=>r.is0(o)?s:(t[a]=s,r.mul(s,o)),r.ONE),i=r.inv(n);return e.reduceRight((s,o,a)=>r.is0(o)?s:(t[a]=r.mul(s,t[a]),r.mul(s,o)),i),t}function Mo(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function $t(r,e,t=!1,n={}){if(r<=he)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:s}=Mo(r,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=X6(r),a=Object.freeze({ORDER:r,BITS:i,BYTES:s,MASK:vn(i),ZERO:he,ONE:J,create:c=>W(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return he<=c&&c<r},is0:c=>c===he,isOdd:c=>(c&J)===J,neg:c=>W(-c,r),eql:(c,l)=>c===l,sqr:c=>W(c*c,r),add:(c,l)=>W(c+l,r),sub:(c,l)=>W(c-l,r),mul:(c,l)=>W(c*l,r),pow:(c,l)=>e8(a,c,l),div:(c,l)=>W(c*g1(l,r),r),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>g1(c,r),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>t8(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>t?fr(c,s):Kt(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return t?qt(c):xt(c)}});return Object.freeze(a)}function h3(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Vo(r){let e=h3(r);return e+Math.ceil(e/2)}function d3(r,e,t=!1){let n=r.length,i=h3(e),s=Vo(e);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let o=t?xt(r):qt(r),a=W(o,e-J)+J;return t?fr(a,i):Kt(a,i)}var n8=BigInt(0),Fo=BigInt(1),Ho=new WeakMap,p3=new WeakMap;function y1(r,e){let t=(s,o)=>{let a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);let o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:t,unsafeLadder(s,o){let a=r.ZERO,c=s;for(;o>n8;)o&Fo&&(a=a.add(c)),c=c.double(),o>>=Fo;return a},precomputeWindow(s,o){let{windows:a,windowSize:c}=i(o),l=[],u=s,f=u;for(let h=0;h<a;h++){f=u,l.push(f);for(let p=1;p<c;p++)f=f.add(u),l.push(f);u=f.double()}return l},wNAF(s,o,a){let{windows:c,windowSize:l}=i(s),u=r.ZERO,f=r.BASE,h=BigInt(2**s-1),p=2**s,y=BigInt(s);for(let w=0;w<c;w++){let d=w*l,x=Number(a&h);a>>=y,x>l&&(x-=p,a+=Fo);let E=d,m=d+Math.abs(x)-1,A=w%2!==0,R=x<0;x===0?f=f.add(t(A,o[E])):u=u.add(t(R,o[m]))}return{p:u,f}},wNAFCached(s,o,a){let c=p3.get(s)||1,l=Ho.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&Ho.set(s,a(l))),this.wNAF(c,l,o)},setWindowSize(s,o){n(o),p3.set(s,o),Ho.delete(s)}}}function w1(r,e,t,n){if(!Array.isArray(t)||!Array.isArray(n)||n.length!==t.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((u,f)=>{if(!e.isValid(u))throw new Error(`wrong scalar at index ${f}`)}),t.forEach((u,f)=>{if(!(u instanceof r))throw new Error(`wrong point at index ${f}`)});let i=Co(BigInt(t.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<<s)-1,a=new Array(o+1).fill(r.ZERO),c=Math.floor((e.BITS-1)/s)*s,l=r.ZERO;for(let u=c;u>=0;u-=s){a.fill(r.ZERO);for(let h=0;h<n.length;h++){let p=n[h],y=Number(p>>BigInt(u)&BigInt(o));a[y]=a[y].add(t[h])}let f=r.ZERO;for(let h=a.length-1,p=r.ZERO;h>0;h--)p=p.add(a[h]),f=f.add(p);if(l=l.add(f),u!==0)for(let h=0;h<s;h++)l=l.double()}return l}function En(r){return Oo(r.Fp),it(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Mo(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Xe=BigInt(0),De=BigInt(1),b1=BigInt(2),i8=BigInt(8),s8={zip215:!0};function o8(r){let e=En(r);return it(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function m3(r){let e=o8(r),{Fp:t,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=e,l=b1<<BigInt(a*8)-De,u=t.create,f=$t(e.n,e.nBitLength),h=e.uvRatio||((b,g)=>{try{return{isValid:!0,value:t.sqrt(b*t.inv(g))}}catch{return{isValid:!1,value:Xe}}}),p=e.adjustScalarBytes||(b=>b),y=e.domain||((b,g,v)=>{if(Ye("phflag",v),g.length||v)throw new Error("Contexts/pre-hash are not supported");return b});function w(b,g){Ue("coordinate "+b,g,Xe,l)}function d(b){if(!(b instanceof m))throw new Error("ExtendedPoint expected")}let x=hr((b,g)=>{let{ex:v,ey:L,ez:_}=b,C=b.is0();g==null&&(g=C?i8:t.inv(_));let V=u(v*g),q=u(L*g),F=u(_*g);if(C)return{x:Xe,y:De};if(F!==De)throw new Error("invZ was invalid");return{x:V,y:q}}),E=hr(b=>{let{a:g,d:v}=e;if(b.is0())throw new Error("bad point: ZERO");let{ex:L,ey:_,ez:C,et:V}=b,q=u(L*L),F=u(_*_),j=u(C*C),Z=u(j*j),pe=u(q*g),me=u(j*u(pe+F)),we=u(Z+u(v*u(q*F)));if(me!==we)throw new Error("bad point: equation left != right (1)");let ke=u(L*_),ue=u(C*V);if(ke!==ue)throw new Error("bad point: equation left != right (2)");return!0});class m{constructor(g,v,L,_){this.ex=g,this.ey=v,this.ez=L,this.et=_,w("x",g),w("y",v),w("z",L),w("t",_),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(g){if(g instanceof m)throw new Error("extended point not allowed");let{x:v,y:L}=g||{};return w("x",v),w("y",L),new m(v,L,De,u(v*L))}static normalizeZ(g){let v=t.invertBatch(g.map(L=>L.ez));return g.map((L,_)=>L.toAffine(v[_])).map(m.fromAffine)}static msm(g,v){return w1(m,f,g,v)}_setWindowSize(g){T.setWindowSize(this,g)}assertValidity(){E(this)}equals(g){d(g);let{ex:v,ey:L,ez:_}=this,{ex:C,ey:V,ez:q}=g,F=u(v*q),j=u(C*_),Z=u(L*q),pe=u(V*_);return F===j&&Z===pe}is0(){return this.equals(m.ZERO)}negate(){return new m(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:g}=e,{ex:v,ey:L,ez:_}=this,C=u(v*v),V=u(L*L),q=u(b1*u(_*_)),F=u(g*C),j=v+L,Z=u(u(j*j)-C-V),pe=F+V,me=pe-q,we=F-V,ke=u(Z*me),ue=u(pe*we),Le=u(Z*we),ut=u(me*pe);return new m(ke,ue,ut,Le)}add(g){d(g);let{a:v,d:L}=e,{ex:_,ey:C,ez:V,et:q}=this,{ex:F,ey:j,ez:Z,et:pe}=g;if(v===BigInt(-1)){let _2=u((C-_)*(j+F)),C2=u((C+_)*(j-F)),ys=u(C2-_2);if(ys===Xe)return this.double();let U2=u(V*b1*pe),D2=u(q*b1*Z),O2=D2+U2,M2=C2+_2,V2=D2-U2,E4=u(O2*ys),A4=u(M2*V2),S4=u(O2*V2),I4=u(ys*M2);return new m(E4,A4,I4,S4)}let me=u(_*F),we=u(C*j),ke=u(q*L*pe),ue=u(V*Z),Le=u((_+C)*(F+j)-me-we),ut=ue-ke,tn=ue+ke,rn=u(we-v*me),w4=u(Le*ut),b4=u(tn*rn),x4=u(Le*rn),v4=u(ut*tn);return new m(w4,b4,v4,x4)}subtract(g){return this.add(g.negate())}wNAF(g){return T.wNAFCached(this,g,m.normalizeZ)}multiply(g){let v=g;Ue("scalar",v,De,n);let{p:L,f:_}=this.wNAF(v);return m.normalizeZ([L,_])[0]}multiplyUnsafe(g){let v=g;return Ue("scalar",v,Xe,n),v===Xe?R:this.equals(R)||v===De?this:this.equals(A)?this.wNAF(v).p:T.unsafeLadder(this,v)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return T.unsafeLadder(this,n).is0()}toAffine(g){return x(this,g)}clearCofactor(){let{h:g}=e;return g===De?this:this.multiplyUnsafe(g)}static fromHex(g,v=!1){let{d:L,a:_}=e,C=t.BYTES;g=ie("pointHex",g,C),Ye("zip215",v);let V=g.slice(),q=g[C-1];V[C-1]=q&-129;let F=qt(V),j=v?l:t.ORDER;Ue("pointHex.y",F,Xe,j);let Z=u(F*F),pe=u(Z-De),me=u(L*Z-_),{isValid:we,value:ke}=h(pe,me);if(!we)throw new Error("Point.fromHex: invalid y coordinate");let ue=(ke&De)===De,Le=(q&128)!==0;if(!v&&ke===Xe&&Le)throw new Error("Point.fromHex: x=0 and x_0=1");return Le!==ue&&(ke=u(-ke)),m.fromAffine({x:ke,y:F})}static fromPrivateKey(g){return N(g).point}toRawBytes(){let{x:g,y:v}=this.toAffine(),L=fr(v,t.BYTES);return L[L.length-1]|=g&De?128:0,L}toHex(){return bt(this.toRawBytes())}}m.BASE=new m(e.Gx,e.Gy,De,u(e.Gx*e.Gy)),m.ZERO=new m(Xe,De,De,Xe);let{BASE:A,ZERO:R}=m,T=y1(m,a*8);function B(b){return W(b,n)}function k(b){return B(qt(b))}function N(b){let g=a;b=ie("private key",b,g);let v=ie("hashed private key",s(b),2*g),L=p(v.slice(0,g)),_=v.slice(g,2*g),C=k(L),V=A.multiply(C),q=V.toRawBytes();return{head:L,prefix:_,scalar:C,point:V,pointBytes:q}}function ce(b){return N(b).pointBytes}function K(b=new Uint8Array,...g){let v=vt(...g);return k(s(y(v,ie("context",b),!!i)))}function M(b,g,v={}){b=ie("message",b),i&&(b=i(b));let{prefix:L,scalar:_,pointBytes:C}=N(g),V=K(v.context,L,b),q=A.multiply(V).toRawBytes(),F=K(v.context,q,C,b),j=B(V+F*_);Ue("signature.s",j,Xe,n);let Z=vt(q,fr(j,t.BYTES));return ie("result",Z,a*2)}let le=s8;function S(b,g,v,L=le){let{context:_,zip215:C}=L,V=t.BYTES;b=ie("signature",b,2*V),g=ie("message",g),C!==void 0&&Ye("zip215",C),i&&(g=i(g));let q=qt(b.slice(V,2*V)),F,j,Z;try{F=m.fromHex(v,C),j=m.fromHex(b.slice(0,V),C),Z=A.multiplyUnsafe(q)}catch{return!1}if(!C&&F.isSmallOrder())return!1;let pe=K(_,j.toRawBytes(),F.toRawBytes(),g);return j.add(F.multiplyUnsafe(pe)).subtract(Z).clearCofactor().equals(m.ZERO)}return A._setWindowSize(8),{CURVE:e,getPublicKey:ce,sign:M,verify:S,ExtendedPoint:m,utils:{getExtendedPublicKey:N,randomPrivateKey:()=>o(t.BYTES),precompute(b=8,g=m.BASE){return g._setWindowSize(b),g.multiply(BigInt(3)),g}}}}var qo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),g3=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),$u=BigInt(0),a8=BigInt(1),y3=BigInt(2),zu=BigInt(3),c8=BigInt(5),l8=BigInt(8);function u8(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),i=BigInt(80),s=qo,a=r*r%s*r%s,c=ee(a,y3,s)*a%s,l=ee(c,a8,s)*r%s,u=ee(l,c8,s)*l%s,f=ee(u,e,s)*u%s,h=ee(f,t,s)*f%s,p=ee(h,n,s)*h%s,y=ee(p,i,s)*p%s,w=ee(y,i,s)*p%s,d=ee(w,e,s)*u%s;return{pow_p_5_8:ee(d,y3,s)*r%s,b2:a}}function f8(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function h8(r,e){let t=qo,n=W(e*e*e,t),i=W(n*n*e,t),s=u8(r*i).pow_p_5_8,o=W(r*n*s,t),a=W(e*o*o,t),c=o,l=W(o*g3,t),u=a===r,f=a===W(-r,t),h=a===W(-r*g3,t);return u&&(o=c),(f||h)&&(o=l),f3(o,t)&&(o=W(-o,t)),{isValid:u||f,value:o}}var d8=$t(qo,void 0,!0),p8={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:d8,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:l8,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:o3,randomBytes:Vr,adjustScalarBytes:f8,uvRatio:h8},w3=m3(p8);var x1=32;function b3(r,e,t){return w3.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}var v1=class{type="Ed25519";raw;constructor(e){this.raw=Ko(e,x1)}toMultihash(){return mt.digest(qr(this))}toCID(){return re.createV1(114,this.toMultihash())}toString(){return Y.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:X(this.raw,e.raw)}verify(e,t){return b3(this.raw,t,e)}};function $o(r){return r=Ko(r,x1),new v1(r)}function Ko(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new $(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}var de;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(de||(de={}));var zo;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(zo||(zo={}));(function(r){r.codec=()=>Pr(zo)})(de||(de={}));var st;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),de.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=de.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(st||(st={}));var Go;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),de.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=de.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(Go||(Go={}));var Nn={};Te(Nn,{MAX_RSA_KEY_SIZE:()=>di,generateRSAKeyPair:()=>ya,jwkToJWKKeyPair:()=>wa,jwkToPkcs1:()=>L8,jwkToPkix:()=>t2,jwkToRSAPrivateKey:()=>ga,pkcs1ToJwk:()=>da,pkcs1ToRSAPrivateKey:()=>ma,pkixToJwk:()=>pa,pkixToRSAPublicKey:()=>r2});var g8=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]),zt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Gt=new Uint32Array(64),jo=class extends Fr{constructor(){super(64,32,8,!1),this.A=zt[0]|0,this.B=zt[1]|0,this.C=zt[2]|0,this.D=zt[3]|0,this.E=zt[4]|0,this.F=zt[5]|0,this.G=zt[6]|0,this.H=zt[7]|0}get(){let{A:e,B:t,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,t,n,i,s,o,a,c]}set(e,t,n,i,s,o,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let f=0;f<16;f++,t+=4)Gt[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let h=Gt[f-15],p=Gt[f-2],y=Ze(h,7)^Ze(h,18)^h>>>3,w=Ze(p,17)^Ze(p,19)^p>>>10;Gt[f]=w+Gt[f-7]+y+Gt[f-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:l,H:u}=this;for(let f=0;f<64;f++){let h=Ze(a,6)^Ze(a,11)^Ze(a,25),p=u+h+n3(a,c,l)+g8[f]+Gt[f]|0,w=(Ze(n,2)^Ze(n,13)^Ze(n,22))+i3(n,i,s)|0;u=l,l=c,c=a,a=o+p|0,o=s,s=i,i=n,n=p+w|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+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,i,s,o,a,c,l,u)}roundClean(){Gt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Kr=h1(()=>new jo);var H=bs(E3());function pr(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function jt(r,e,t=-1){let n=t,i=r,s=0,o=Math.pow(2,e);for(let a=1;a<8;a++){if(r<o){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*e);l[s-u-1]=Math.floor(i/f),i-=l[s-u-1]*f}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function S1(...r){let e=0,t=0;for(let s of r)e+=s.length;let n=new ArrayBuffer(e),i=new Uint8Array(n);for(let s of r)i.set(s,t),t+=s.length;return i}function Qo(){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 e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)t[a]=0;t[0]=r[0]&128;let n=pr(t,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=r[a];return s[0]&=127,pr(s,8)-n}function A3(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,a=jt(o,8,n),c=new Uint8Array(a);return c[0]|=128,a}let i=jt(e,8,n),s=new Uint8Array(i);if(s[0]&128){let o=i.slice(0),a=new Uint8Array(o);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let c=0;c<o.byteLength;c++)s[c+1]=a[c];s[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function S3(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}function Oe(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,i=new Array(n);for(let o=0;o<n;o++)i[o]="0";return i.join("").concat(t)}var mf=Math.log(2);function I1(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Zo(r){let e=0,t=0;for(let i=0;i<r.length;i++){let s=r[i];e+=s.byteLength}let n=new Uint8Array(e);for(let i=0;i<r.length;i++){let s=r[i];n.set(new Uint8Array(s),t),t+=s.byteLength}return n.buffer}function Bt(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var Sn=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Zo(this.items)}},An=[new Uint8Array([1])],I3="0123456789";var Wr="",Je=new ArrayBuffer(0),Yo=new Uint8Array(0),In="EndOfContent",k3="OCTET STRING",T3="BIT STRING";function kt(r){var e;return e=class extends r{constructor(...n){var i;super(...n);let s=n[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?H.BufferSourceConverter.toUint8Array(s.valueHex):Yo}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,s){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Bt(this,o,i,s))return-1;let a=i+s;return this.valueHexView=o.subarray(i,a),this.valueHexView.length?(this.blockLength=s,a):(this.warnings.push("Zero buffer length"),i)}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",Je)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:H.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var At=class{constructor({blockLength:e=0,error:t=Wr,warnings:n=[],valueBeforeDecode:i=Yo}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=H.BufferSourceConverter.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:H.Convert.ToHex(this.valueBeforeDecodeView)}}};At.NAME="baseBlock";var Ie=class extends At{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Ie.NAME="valueBlock";var B1=class extends kt(At){constructor({idBlock:e={}}={}){var t,n,i,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?H.BufferSourceConverter.toUint8Array(e.valueHex):Yo,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Je}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,i[0]=t}return i.buffer}if(!this.isHexOnly){let i=jt(this.tagNumber,7),s=new Uint8Array(i),o=i.byteLength,a=new Uint8Array(o+1);if(a[0]=t|31,!e){for(let c=0;c<o-1;c++)a[c+1]=s[c]|128;a[o]=s[o-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){let i=H.BufferSourceConverter.toUint8Array(e);if(!Bt(this,i,t,n))return-1;let s=i.subarray(t,t+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 h=new Uint8Array(u);for(let p=0;p<l.length;p++)h[p]=l[p];l=this.valueHexView=new Uint8Array(u)}}this.blockLength=c+1,l[c-1]=s[c]&127;let f=new Uint8Array(c);for(let h=0;h<c;h++)f[h]=l[h];l=this.valueHexView=new Uint8Array(c),l.set(f),this.blockLength<=9?this.tagNumber=pr(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 t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};B1.NAME="identificationBlock";var k1=class extends At{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){let i=H.BufferSourceConverter.toUint8Array(e);if(!Bt(this,i,t,n))return-1;let s=i.subarray(t,t+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,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;let o=s[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=t+1,c=i.subarray(a,a+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=pr(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let i=jt(this.length,8);if(i.byteLength>127)return this.error="Too big length",Je;if(t=new ArrayBuffer(i.byteLength+1),e)return t;let s=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let o=0;o<i.byteLength;o++)n[o+1]=s[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};k1.NAME="lengthBlock";var I={},be=class extends At{constructor({name:e=Wr,optional:t=!1,primitiveSchema:n,...i}={},s){super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new B1(i),this.lenBlock=new k1(i),this.valueBlock=s?new s(i):new Ie(i)}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}toBER(e,t){let n=t||new Sn;t||R3(this);let i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(s)}return t?Je:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():H.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${H.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return S3(t,n)}};be.NAME="BaseBlock";function R3(r){if(r instanceof I.Constructed)for(let e of r.valueBlock.value)R3(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var T1=class extends be{constructor({value:e=Wr,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};T1.NAME="BaseStringBlock";var R1=class extends kt(Ie){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};R1.NAME="PrimitiveValueBlock";var P3,P1=class extends be{constructor(e={}){super(e,R1),this.idBlock.isConstructed=!1}};P3=P1;I.Primitive=P3;P1.NAME="PRIMITIVE";function I8(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function ui(r,e=0,t=r.length){let n=e,i=new be({},Ie),s=new At;if(!Bt(s,r,e,t))return i.error=s.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let a=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),a===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=a,t-=i.idBlock.blockLength,a=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),a===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=a,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let c=be;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};c=I.EndOfContent;break;case 1:c=I.Boolean;break;case 2:c=I.Integer;break;case 3:c=I.BitString;break;case 4:c=I.OctetString;break;case 5:c=I.Null;break;case 6:c=I.ObjectIdentifier;break;case 10:c=I.Enumerated;break;case 12:c=I.Utf8String;break;case 13:c=I.RelativeObjectIdentifier;break;case 14:c=I.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:c=I.Sequence;break;case 17:c=I.Set;break;case 18:c=I.NumericString;break;case 19:c=I.PrintableString;break;case 20:c=I.TeletexString;break;case 21:c=I.VideotexString;break;case 22:c=I.IA5String;break;case 23:c=I.UTCTime;break;case 24:c=I.GeneralizedTime;break;case 25:c=I.GraphicString;break;case 26:c=I.VisibleString;break;case 27:c=I.GeneralString;break;case 28:c=I.UniversalString;break;case 29:c=I.CharacterString;break;case 30:c=I.BmpString;break;case 31:c=I.DATE;break;case 32:c=I.TimeOfDay;break;case 33:c=I.DateTime;break;case 34:c=I.Duration;break;default:{let l=i.idBlock.isConstructed?new I.Constructed:new I.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:c=i.idBlock.isConstructed?I.Constructed:I.Primitive}return i=I8(i,c),a=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:a,result:i}}function Xo(r){if(!r.byteLength){let e=new be({},Ie);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ui(H.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function B8(r,e){return r?1:e}var ot=class extends Ie{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let i=H.BufferSourceConverter.toUint8Array(e);if(!Bt(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;B8(this.isIndefiniteForm,n)>0;){let o=ui(i,s,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(s=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===In)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===In?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){let n=t||new Sn;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?Je:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};ot.NAME="ConstructedValueBlock";var L3,Wt=class extends be{constructor(e={}){super(e,ot),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
2
+ "use strict";var Libp2PKadDht=(()=>{var B4=Object.create;var Gn=Object.defineProperty;var k4=Object.getOwnPropertyDescriptor;var T4=Object.getOwnPropertyNames;var R4=Object.getPrototypeOf,P4=Object.prototype.hasOwnProperty;var ws=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Te=(r,e)=>{for(var t in e)Gn(r,t,{get:e[t],enumerable:!0})},F2=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of T4(e))!P4.call(r,i)&&i!==t&&Gn(r,i,{get:()=>e[i],enumerable:!(n=k4(e,i))||n.enumerable});return r};var bs=(r,e,t)=>(t=r!=null?B4(R4(r)):{},F2(e||!r||!r.__esModule?Gn(t,"default",{value:r,enumerable:!0}):t,r)),L4=r=>F2(Gn({},"__esModule",{value:!0}),r);var Q2=ws((Kc,vs)=>{"use strict";var C4=Object.prototype.hasOwnProperty,Re="~";function on(){}Object.create&&(on.prototype=Object.create(null),new on().__proto__||(Re=!1));function U4(r,e,t){this.fn=r,this.context=e,this.once=t||!1}function W2(r,e,t,n,i){if(typeof t!="function")throw new TypeError("The listener must be a function");var s=new U4(t,n||r,i),o=Re?Re+e:e;return r._events[o]?r._events[o].fn?r._events[o]=[r._events[o],s]:r._events[o].push(s):(r._events[o]=s,r._eventsCount++),r}function Qn(r,e){--r._eventsCount===0?r._events=new on:delete r._events[e]}function Ee(){this._events=new on,this._eventsCount=0}Ee.prototype.eventNames=function(){var e=[],t,n;if(this._eventsCount===0)return e;for(n in t=this._events)C4.call(t,n)&&e.push(Re?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};Ee.prototype.listeners=function(e){var t=Re?Re+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};Ee.prototype.listenerCount=function(e){var t=Re?Re+e:e,n=this._events[t];return n?n.fn?1:n.length:0};Ee.prototype.emit=function(e,t,n,i,s,o){var a=Re?Re+e:e;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,u,f;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,s),!0;case 6:return c.fn.call(c.context,t,n,i,s,o),!0}for(f=1,u=new Array(l-1);f<l;f++)u[f-1]=arguments[f];c.fn.apply(c.context,u)}else{var h=c.length,p;for(f=0;f<h;f++)switch(c[f].once&&this.removeListener(e,c[f].fn,void 0,!0),l){case 1:c[f].fn.call(c[f].context);break;case 2:c[f].fn.call(c[f].context,t);break;case 3:c[f].fn.call(c[f].context,t,n);break;case 4:c[f].fn.call(c[f].context,t,n,i);break;default:if(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[f].fn.apply(c[f].context,u)}}return!0};Ee.prototype.on=function(e,t,n){return W2(this,e,t,n,!1)};Ee.prototype.once=function(e,t,n){return W2(this,e,t,n,!0)};Ee.prototype.removeListener=function(e,t,n,i){var s=Re?Re+e:e;if(!this._events[s])return this;if(!t)return Qn(this,s),this;var o=this._events[s];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&Qn(this,s);else{for(var a=0,c=[],l=o.length;a<l;a++)(o[a].fn!==t||i&&!o[a].once||n&&o[a].context!==n)&&c.push(o[a]);c.length?this._events[s]=c.length===1?c[0]:c:Qn(this,s)}return this};Ee.prototype.removeAllListeners=function(e){var t;return e?(t=Re?Re+e:e,this._events[t]&&Qn(this,t)):(this._events=new on,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Re;Ee.EventEmitter=Ee;typeof vs<"u"&&(vs.exports=Ee)});var E3=ws($r=>{"use strict";var y8="[object ArrayBuffer]",Et=class r{static isArrayBuffer(e){return Object.prototype.toString.call(e)===y8}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=r.toUint8Array(e),i=r.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[s])return!1;return!0}static concat(...e){let t;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?t=e[0]:e[e.length-1]instanceof Function?t=e.slice(0,e.length-1):t=e;let n=0;for(let o of t)n+=o.byteLength;let i=new Uint8Array(n),s=0;for(let o of t){let a=this.toUint8Array(o);i.set(a,s),s+=a.length}return e[e.length-1]instanceof Function?this.toView(i,e[e.length-1]):i.buffer}},Wo="string",w8=/^[0-9a-f\s]+$/i,b8=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,x8=/^[a-zA-Z0-9-_]+$/,E1=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){let t=Et.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return decodeURIComponent(escape(n))}},Ge=class{static toString(e,t=!1){let n=Et.toArrayBuffer(e),i=new DataView(n),s="";for(let o=0;o<n.byteLength;o+=2){let a=i.getUint16(o,t);s+=String.fromCharCode(a)}return s}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),t);return n}},A1=class r{static isHex(e){return typeof e===Wo&&w8.test(e)}static isBase64(e){return typeof e===Wo&&b8.test(e)}static isBase64Url(e){return typeof e===Wo&&x8.test(e)}static ToString(e,t="utf8"){let n=Et.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return Ge.toString(n,!0);case"utf16":case"utf16be":return Ge.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Ge.fromString(e,!0);case"utf16":case"utf16be":return Ge.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=Et.toUint8Array(e);if(typeof btoa<"u"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob<"u"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return E1.fromString(e);case"utf16":case"utf16be":return Ge.fromString(e);case"utf16le":case"usc2":return Ge.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=r.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return E1.toString(e);case"utf16":case"utf16be":return Ge.toString(e);case"utf16le":case"usc2":return Ge.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let t=Et.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){let t=Et.toUint8Array(e),n="",i=t.length;for(let s=0;s<i;s++){let o=t[s];o<16&&(n+="0"),n+=o.toString(16)}return n}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!r.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){let s=t.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,t=!1){return Ge.toString(e,t)}static FromUtf16String(e,t=!1){return Ge.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return e?.replace(/[\n\r\t ]/g,"")||""}};A1.DEFAULT_UTF8_ENCODING="utf8";function v8(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let s in i)t[s]=i[s]}return t}function E8(...r){let e=r.map(i=>i.byteLength).reduce((i,s)=>i+s),t=new Uint8Array(e),n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(let s of i)t[n++]=s}),t.buffer}function A8(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}$r.BufferSourceConverter=Et;$r.Convert=A1;$r.assign=v8;$r.combine=E8;$r.isEqual=A8});var Da=ws(Mn=>{(function(){var r,e,t,n,i,s,o,a;a=function(c){var l,u,f,h;return l=(c&255<<24)>>>24,u=(c&255<<16)>>>16,f=(c&65280)>>>8,h=c&255,[l,u,f,h].join(".")},o=function(c){var l,u,f,h,p,y;for(l=[],f=h=0;h<=3&&c.length!==0;f=++h){if(f>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}y=e(c),p=y[0],u=y[1],c=c.substring(u),l.push(p)}if(c.length!==0)throw new Error("Invalid IP");switch(l.length){case 1:if(l[0]>4294967295)throw new Error("Invalid IP");return l[0]>>>0;case 2:if(l[0]>255||l[1]>16777215)throw new Error("Invalid IP");return(l[0]<<24|l[1])>>>0;case 3:if(l[0]>255||l[1]>255||l[2]>65535)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2])>>>0;case 4:if(l[0]>255||l[1]>255||l[2]>255||l[3]>255)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0;default:throw new Error("Invalid IP")}},t=function(c){return c.charCodeAt(0)},n=t("0"),s=t("a"),i=t("A"),e=function(c){var l,u,f,h,p;for(h=0,l=10,u="9",f=0,c.length>1&&c[f]==="0"&&(c[f+1]==="x"||c[f+1]==="X"?(f+=2,l=16):"0"<=c[f+1]&&c[f+1]<="9"&&(f++,l=8,u="7")),p=f;f<c.length;){if("0"<=c[f]&&c[f]<=u)h=h*l+(t(c[f])-n)>>>0;else if(l===16)if("a"<=c[f]&&c[f]<="f")h=h*l+(10+t(c[f])-s)>>>0;else if("A"<=c[f]&&c[f]<="F")h=h*l+(10+t(c[f])-i)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");f++}if(f===p)throw new Error("empty octet");return[h,f]},r=function(){function c(l,u){var f,h,p,y;if(typeof l!="string")throw new Error("Missing `net' parameter");if(u||(y=l.split("/",2),l=y[0],u=y[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=o(u)}catch(w){throw f=w,new Error("Invalid mask: "+u)}for(h=p=32;p>=0;h=--p)if(this.maskLong===4294967295<<32-h>>>0){this.bitmask=h;break}}else if(u||u===0)this.bitmask=parseInt(u,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(o(l)&this.maskLong)>>>0}catch(w){throw f=w,new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(l){return typeof l=="string"&&(l.indexOf("/")>0||l.split(".").length!==4)&&(l=new c(l)),l instanceof c?this.contains(l.base)&&this.contains(l.broadcast||l.last):(o(l)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(l){return l==null&&(l=1),new c(a(this.netLong+this.size*l),this.mask)},c.prototype.forEach=function(l){var u,f,h;for(h=o(this.first),f=o(this.last),u=0;h<=f;)l(a(h),h,u),u++,h++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),Mn.ip2long=o,Mn.long2ip=a,Mn.Netmask=r}).call(Mn)});var ac={};Te(ac,{EventTypes:()=>Kn,MessageType:()=>O,Record:()=>fe,kadDHT:()=>oc,passthroughMapper:()=>Fa,removePrivateAddressesMapper:()=>Ii,removePublicAddressesMapper:()=>Va});var H2=Symbol.for("@libp2p/content-routing");var q2=Symbol.for("@libp2p/peer-discovery");var xs=Symbol.for("@libp2p/peer-id");var K2=Symbol.for("@libp2p/peer-routing");var $2="keep-alive";var ft=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var $=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ht=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var je=class extends Error{static name="NotFoundError";constructor(e="Not found"){super(e),this.name="NotFoundError"}};var jn=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var Ne=class extends Error{static name="InvalidMessageError";constructor(e="Invalid message"){super(e),this.name="InvalidMessageError"}};var tr=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var te=(r,...e)=>{try{[...e]}catch{}};var _e=class extends EventTarget{#e=new Map;constructor(){super(),te(1/0,this)}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let i=this.#e.get(e);i==null&&(i=[],this.#e.set(e,i)),i.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let i=this.#e.get(e);i!=null&&(i=i.filter(({callback:s})=>s!==t),this.#e.set(e,i))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:i})=>!i),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}};function z2(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function nn(...r){let e=[];for(let t of r)z2(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStart!=null&&await t.beforeStart()})),await Promise.all(e.map(async t=>{await t.start()})),await Promise.all(e.map(async t=>{t.afterStart!=null&&await t.afterStart()}))}async function Wn(...r){let e=[];for(let t of r)z2(t)&&e.push(t);await Promise.all(e.map(async t=>{t.beforeStop!=null&&await t.beforeStop()})),await Promise.all(e.map(async t=>{await t.stop()})),await Promise.all(e.map(async t=>{t.afterStop!=null&&await t.afterStop()}))}var G2=Symbol.for("@libp2p/service-capabilities"),j2=Symbol.for("@libp2p/service-dependencies");function N4(r){return r[Symbol.asyncIterator]!=null}function _4(r){if(N4(r))return(async()=>{for await(let e of r);})();for(let e of r);}var sn=_4;var Es=bs(Q2(),1);var an=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},As=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Z2=r=>globalThis.DOMException===void 0?new As(r):new DOMException(r),Y2=r=>{let e=r.reason===void 0?Z2("This operation was aborted."):r.reason;return e instanceof Error?e:Z2(e)};function rr(r,e){let{milliseconds:t,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=e,o,c=new Promise((l,u)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:h}=e;h.aborted&&u(Y2(h));let p=()=>{u(Y2(h))};h.addEventListener("abort",p,{once:!0}),r.finally(()=>{h.removeEventListener("abort",p)})}if(t===Number.POSITIVE_INFINITY){r.then(l,u);return}let f=new an;o=s.setTimeout.call(void 0,()=>{if(n){try{l(n())}catch(h){u(h)}return}typeof r.cancel=="function"&&r.cancel(),i===!1?l():i instanceof Error?u(i):(f.message=i??`Promise timed out after ${t} milliseconds`,u(f))},t),(async()=>{try{l(await r)}catch(h){u(h)}})()}).finally(()=>{c.clear()});return c.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},c}function Ss(r,e,t){let n=0,i=r.length;for(;i>0;){let s=Math.trunc(i/2),o=n+s;t(r[o],e)<=0?(n=++o,i-=s+1):i=s}return n}var cn=class{#e=[];enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&this.#e[this.size-1].priority>=t.priority){this.#e.push(n);return}let i=Ss(this.#e,n,(s,o)=>o.priority-s.priority);this.#e.splice(i,0,n)}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var vr=class extends Es.default{#e;#r;#s=0;#a;#c;#p=0;#n;#l;#t;#m;#i=0;#u;#o;#g;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:cn,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#r=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#a=e.intervalCap,this.#c=e.interval,this.#t=new e.queueClass,this.#m=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#o=e.autoStart===!1}get#b(){return this.#r||this.#s<this.#a}get#x(){return this.#i<this.#u}#v(){this.#i--,this.#f(),this.emit("next")}#E(){this.#w(),this.#y(),this.#l=void 0}get#A(){let e=Date.now();if(this.#n===void 0){let t=this.#p-e;if(t<0)this.#s=this.#e?this.#i:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#E()},t)),!0}return!1}#f(){if(this.#t.size===0)return this.#n&&clearInterval(this.#n),this.#n=void 0,this.emit("empty"),this.#i===0&&this.emit("idle"),!1;if(!this.#o){let e=!this.#A;if(this.#b&&this.#x){let t=this.#t.dequeue();return t?(this.emit("active"),t(),e&&this.#y(),!0):!1}}return!1}#y(){this.#r||this.#n!==void 0||(this.#n=setInterval(()=>{this.#w()},this.#c),this.#p=Date.now()+this.#c)}#w(){this.#s===0&&this.#i===0&&this.#n&&(clearInterval(this.#n),this.#n=void 0),this.#s=this.#e?this.#i:0,this.#h()}#h(){for(;this.#f(););}get concurrency(){return this.#u}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#u=e,this.#h()}async#S(e){return new Promise((t,n)=>{e.addEventListener("abort",()=>{n(e.reason)},{once:!0})})}async add(e,t={}){return t={timeout:this.timeout,throwOnTimeout:this.#g,...t},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#i++,this.#s++;try{t.signal?.throwIfAborted();let s=e({signal:t.signal});t.timeout&&(s=rr(Promise.resolve(s),{milliseconds:t.timeout})),t.signal&&(s=Promise.race([s,this.#S(t.signal)]));let o=await s;n(o),this.emit("completed",o)}catch(s){if(s instanceof an&&!t.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#v()}},t),this.emit("add"),this.#f()})}async addAll(e,t){return Promise.all(e.map(async n=>this.add(n,t)))}start(){return this.#o?(this.#o=!1,this.#h(),this):this}pause(){this.#o=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#d("empty")}async onSizeLessThan(e){this.#t.size<e||await this.#d("next",()=>this.#t.size<e)}async onIdle(){this.#i===0&&this.#t.size===0||await this.#d("idle")}async#d(e,t){return new Promise(n=>{let i=()=>{t&&!t()||(this.off(e,i),n())};this.on(e,i)})}get size(){return this.#t.size}sizeBy(e){return this.#t.filter(e).length}get pending(){return this.#i}get isPaused(){return this.#o}};var Nt={},Er=r=>{r.addEventListener("message",e=>{Er.dispatchEvent("message",r,e)}),r.port!=null&&r.port.addEventListener("message",e=>{Er.dispatchEvent("message",r,e)})};Er.addEventListener=(r,e)=>{Nt[r]==null&&(Nt[r]=[]),Nt[r].push(e)};Er.removeEventListener=(r,e)=>{Nt[r]!=null&&(Nt[r]=Nt[r].filter(t=>t===e))};Er.dispatchEvent=function(r,e,t){Nt[r]!=null&&Nt[r].forEach(n=>n(e,t))};var Is=Er;var Bs="lock:worker:request-read",ks="lock:worker:release-read",Ts="lock:master:grant-read",Rs="lock:worker:request-write",Ps="lock:worker:release-write",Ls="lock:master:grant-write";var X2=(r=21)=>Math.random().toString().substring(2);var J2=(r,e,t,n,i)=>(s,o)=>{if(o.data.type!==t)return;let a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};r.dispatchEvent(new MessageEvent(e,{data:{name:a.name,handler:async()=>{s.postMessage({type:i,name:a.name,identifier:a.identifier}),await new Promise(c=>{let l=u=>{if(u?.data==null)return;let f={type:u.data.type,name:u.data.name,identifier:u.data.identifier};f.type===n&&f.identifier===a.identifier&&(s.removeEventListener("message",l),c())};s.addEventListener("message",l)})}}}))},e0=(r,e,t,n)=>async()=>{let i=X2();return globalThis.postMessage({type:e,identifier:i,name:r}),new Promise(s=>{let o=a=>{if(a?.data==null)return;let c={type:a.data.type,identifier:a.data.identifier};c.type===t&&c.identifier===i&&(globalThis.removeEventListener("message",o),s(()=>{globalThis.postMessage({type:n,identifier:i,name:r})}))};globalThis.addEventListener("message",o)})},D4={singleProcess:!1},t0=r=>{if(r=Object.assign({},D4,r),!!globalThis.document||r.singleProcess){let t=new EventTarget;return Is.addEventListener("message",J2(t,"requestReadLock",Bs,ks,Ts)),Is.addEventListener("message",J2(t,"requestWriteLock",Rs,Ps,Ls)),t}return{isWorker:!0,readLock:t=>e0(t,Bs,Ts,ks),writeLock:t=>e0(t,Rs,Ls,Ps)}};var nr={},_t;async function Ns(r,e){let t,n=new Promise(i=>{t=i});return r.add(async()=>rr((async()=>{await new Promise(i=>{t(()=>{i()})})})(),{milliseconds:e.timeout})),n}var O4=(r,e)=>{if(_t.isWorker===!0)return{readLock:_t.readLock(r,e),writeLock:_t.writeLock(r,e)};let t=new vr({concurrency:1}),n;return{async readLock(){if(n!=null)return Ns(n,e);n=new vr({concurrency:e.concurrency,autoStart:!1});let i=n,s=Ns(n,e);return t.add(async()=>{i.start(),await i.onIdle().then(()=>{n===i&&(n=null)})}),s},async writeLock(){return n=null,Ns(t,e)}}},M4={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function _s(r){let e=Object.assign({},M4,r);return _t==null&&(_t=t0(e),_t.isWorker!==!0&&(_t.addEventListener("requestReadLock",t=>{nr[t.data.name]!=null&&nr[t.data.name].readLock().then(async n=>t.data.handler().finally(()=>{n()}))}),_t.addEventListener("requestWriteLock",async t=>{nr[t.data.name]!=null&&nr[t.data.name].writeLock().then(async n=>t.data.handler().finally(()=>{n()}))}))),nr[e.name]==null&&(nr[e.name]=O4(e.name,e)),nr[e.name]}function se(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var Ar=1e3,Cs=60*Ar,Zn=60*Cs,r0=36*Zn,n0="/ipfs/kad/1.0.0",i0=48*Zn;var s0=24*Zn,o0=10,a0=16384,c0=Zn,hl=10*Ar;var Yn=20,Sr=3,l0=5*Cs,u0=Ar,f0=5*Ar,h0=5*Cs,d0=30*Ar,p0=180*Ar,Us=`${$2}-kad-dht`;function Ce(r=0){return new Uint8Array(r)}function ge(r=0){return new Uint8Array(r)}var V4=Math.pow(2,7),F4=Math.pow(2,14),H4=Math.pow(2,21),Ds=Math.pow(2,28),Os=Math.pow(2,35),Ms=Math.pow(2,42),Vs=Math.pow(2,49),z=128,Ae=127;function oe(r){if(r<V4)return 1;if(r<F4)return 2;if(r<H4)return 3;if(r<Ds)return 4;if(r<Os)return 5;if(r<Ms)return 6;if(r<Vs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Fs(r,e,t=0){switch(oe(r)){case 8:e[t++]=r&255|z,r/=128;case 7:e[t++]=r&255|z,r/=128;case 6:e[t++]=r&255|z,r/=128;case 5:e[t++]=r&255|z,r/=128;case 4:e[t++]=r&255|z,r>>>=7;case 3:e[t++]=r&255|z,r>>>=7;case 2:e[t++]=r&255|z,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function q4(r,e,t=0){switch(oe(r)){case 8:e.set(t++,r&255|z),r/=128;case 7:e.set(t++,r&255|z),r/=128;case 6:e.set(t++,r&255|z),r/=128;case 5:e.set(t++,r&255|z),r/=128;case 4:e.set(t++,r&255|z),r>>>=7;case 3:e.set(t++,r&255|z),r>>>=7;case 2:e.set(t++,r&255|z),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function Hs(r,e){let t=r[e],n=0;if(n+=t&Ae,t<z||(t=r[e+1],n+=(t&Ae)<<7,t<z)||(t=r[e+2],n+=(t&Ae)<<14,t<z)||(t=r[e+3],n+=(t&Ae)<<21,t<z)||(t=r[e+4],n+=(t&Ae)*Ds,t<z)||(t=r[e+5],n+=(t&Ae)*Os,t<z)||(t=r[e+6],n+=(t&Ae)*Ms,t<z)||(t=r[e+7],n+=(t&Ae)*Vs,t<z))return n;throw new RangeError("Could not decode varint")}function K4(r,e){let t=r.get(e),n=0;if(n+=t&Ae,t<z||(t=r.get(e+1),n+=(t&Ae)<<7,t<z)||(t=r.get(e+2),n+=(t&Ae)<<14,t<z)||(t=r.get(e+3),n+=(t&Ae)<<21,t<z)||(t=r.get(e+4),n+=(t&Ae)*Ds,t<z)||(t=r.get(e+5),n+=(t&Ae)*Os,t<z)||(t=r.get(e+6),n+=(t&Ae)*Ms,t<z)||(t=r.get(e+7),n+=(t&Ae)*Vs,t<z))return n;throw new RangeError("Could not decode varint")}function ze(r,e,t=0){return e==null&&(e=ge(oe(r))),e instanceof Uint8Array?Fs(r,e,t):q4(r,e,t)}function Ve(r,e=0){return r instanceof Uint8Array?Hs(r,e):K4(r,e)}var qs=new Float32Array([-0]),Ct=new Uint8Array(qs.buffer);function m0(r,e,t){qs[0]=r,e[t]=Ct[0],e[t+1]=Ct[1],e[t+2]=Ct[2],e[t+3]=Ct[3]}function g0(r,e){return Ct[0]=r[e],Ct[1]=r[e+1],Ct[2]=r[e+2],Ct[3]=r[e+3],qs[0]}var Ks=new Float64Array([-0]),Se=new Uint8Array(Ks.buffer);function y0(r,e,t){Ks[0]=r,e[t]=Se[0],e[t+1]=Se[1],e[t+2]=Se[2],e[t+3]=Se[3],e[t+4]=Se[4],e[t+5]=Se[5],e[t+6]=Se[6],e[t+7]=Se[7]}function w0(r,e){return Se[0]=r[e],Se[1]=r[e+1],Se[2]=r[e+2],Se[3]=r[e+3],Se[4]=r[e+4],Se[5]=r[e+5],Se[6]=r[e+6],Se[7]=r[e+7],Ks[0]}var $4=BigInt(Number.MAX_SAFE_INTEGER),z4=BigInt(Number.MIN_SAFE_INTEGER),Fe=class r{lo;hi;constructor(e,t){this.lo=e|0,this.hi=t|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let t=~this.lo+1>>>0,n=~this.hi>>>0;return t===0&&(n=n+1>>>0),-(BigInt(t)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return sr;if(e<$4&&e>z4)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,i=e-(n<<32n);return t&&(n=~n|0n,i=~i|0n,++i>b0&&(i=0n,++n>b0&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(e){if(e===0)return sr;let t=e<0;t&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}static from(e){return typeof e=="number"?r.fromNumber(e):typeof e=="bigint"?r.fromBigInt(e):typeof e=="string"?r.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new r(e.low>>>0,e.high>>>0):sr}},sr=new Fe(0,0);sr.toBigInt=function(){return 0n};sr.zzEncode=sr.zzDecode=function(){return this};sr.length=function(){return 1};var b0=4294967296n;function x0(r){let e=0,t=0;for(let n=0;n<r.length;++n)t=r.charCodeAt(n),t<128?e+=1:t<2048?e+=2:(t&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function v0(r,e,t){if(t-e<1)return"";let i,s=[],o=0,a;for(;e<t;)a=r[e++],a<128?s[o++]=a:a>191&&a<224?s[o++]=(a&31)<<6|r[e++]&63:a>239&&a<365?(a=((a&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,s[o++]=55296+(a>>10),s[o++]=56320+(a&1023)):s[o++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,o>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i!=null?(o>0&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))}function $s(r,e,t){let n=t,i,s;for(let o=0;o<r.length;++o)i=r.charCodeAt(o),i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&((s=r.charCodeAt(o+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++o,e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128);return t-n}function We(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function Xn(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var zs=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,We(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw We(this,4);return Xn(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw We(this,4);return Xn(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw We(this,4);let e=g0(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw We(this,4);let e=w0(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw We(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return v0(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw We(this,e);this.pos+=e}else do if(this.pos>=this.len)throw We(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Fe(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw We(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw We(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw We(this,8);let e=Xn(this.buf,this.pos+=4),t=Xn(this.buf,this.pos+=4);return new Fe(e,t)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=Hs(this.buf,this.pos);return this.pos+=oe(e),e}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 Gs(r){return new zs(r instanceof Uint8Array?r:r.subarray())}function tt(r,e,t){let n=Gs(r);return e.decode(n,void 0,t)}var Ys={};Te(Ys,{base10:()=>Y4});var Sl=new Uint8Array(0);function A0(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}function dt(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 S0(r){return new TextEncoder().encode(r)}function I0(r){return new TextDecoder().decode(r)}function G4(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=i}var a=r.length,c=r.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var w=0,d=0,x=0,E=y.length;x!==E&&y[x]===0;)x++,w++;for(var m=(E-x)*u+1>>>0,A=new Uint8Array(m);x!==E;){for(var R=y[x],T=0,B=m-1;(R!==0||T<d)&&B!==-1;B--,T++)R+=256*A[B]>>>0,A[B]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");d=T,x++}for(var k=m-d;k!==m&&A[k]===0;)k++;for(var N=c.repeat(w);k<m;++k)N+=r.charAt(A[k]);return N}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var w=0;if(y[w]!==" "){for(var d=0,x=0;y[w]===c;)d++,w++;for(var E=(y.length-w)*l+1>>>0,m=new Uint8Array(E);y[w];){var A=t[y.charCodeAt(w)];if(A===255)return;for(var R=0,T=E-1;(A!==0||R<x)&&T!==-1;T--,R++)A+=a*m[T]>>>0,m[T]=A%256>>>0,A=A/256>>>0;if(A!==0)throw new Error("Non-zero carry");x=R,w++}if(y[w]!==" "){for(var B=E-x;B!==E&&m[B]===0;)B++;for(var k=new Uint8Array(d+(E-B)),N=d;B!==E;)k[N++]=m[B++];return k}}}function p(y){var w=h(y);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:h,decode:p}}var j4=G4,W4=j4,k0=W4;var js=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Ws=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let i=t.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return T0(this,e)}},Qs=class{decoders;constructor(e){this.decoders=e}or(e){return T0(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function T0(r,e){return new Qs({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Zs=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new js(e,t,n),this.decoder=new Ws(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Ir({name:r,prefix:e,encode:t,decode:n}){return new Zs(r,e,t,n)}function Ut({name:r,prefix:e,alphabet:t}){let{encode:n,decode:i}=k0(t,r);return Ir({prefix:e,name:r,encode:n,decode:s=>dt(i(s))})}function Q4(r,e,t,n){let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let o=new Uint8Array(s*t/8|0),a=0,c=0,l=0;for(let u=0;u<s;++u){let f=i[r[u]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|f,a+=t,a>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}function Z4(r,e,t){let n=e[e.length-1]==="=",i=(1<<t)-1,s="",o=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],o+=8;o>t;)o-=t,s+=e[i&a>>o];if(o!==0&&(s+=e[i&a<<t-o]),n)for(;s.length*t&7;)s+="=";return s}function ne({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Ir({prefix:e,name:r,encode(i){return Z4(i,n,t)},decode(i){return Q4(i,n,t,r)}})}var Y4=Ut({prefix:"9",name:"base10",alphabet:"0123456789"});var Xs={};Te(Xs,{base16:()=>X4,base16upper:()=>J4});var X4=ne({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),J4=ne({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Js={};Te(Js,{base2:()=>e5});var e5=ne({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var eo={};Te(eo,{base256emoji:()=>s5});var R0=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}"),t5=R0.reduce((r,e,t)=>(r[t]=e,r),[]),r5=R0.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);function n5(r){return r.reduce((e,t)=>(e+=t5[t],e),"")}function i5(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let i=r5[n];if(i==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}var s5=Ir({prefix:"\u{1F680}",name:"base256emoji",encode:n5,decode:i5});var to={};Te(to,{base32:()=>pt,base32hex:()=>l5,base32hexpad:()=>f5,base32hexpadupper:()=>h5,base32hexupper:()=>u5,base32pad:()=>a5,base32padupper:()=>c5,base32upper:()=>o5,base32z:()=>d5});var pt=ne({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),o5=ne({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),a5=ne({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),c5=ne({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),l5=ne({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u5=ne({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),f5=ne({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),h5=ne({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),d5=ne({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ro={};Te(ro,{base36:()=>ln,base36upper:()=>p5});var ln=Ut({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),p5=Ut({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var no={};Te(no,{base58btc:()=>Y,base58flickr:()=>m5});var Y=Ut({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),m5=Ut({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var io={};Te(io,{base64:()=>g5,base64pad:()=>y5,base64url:()=>w5,base64urlpad:()=>b5});var g5=ne({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),y5=ne({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),w5=ne({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b5=ne({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var so={};Te(so,{base8:()=>x5});var x5=ne({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var oo={};Te(oo,{identity:()=>v5});var v5=Ir({prefix:"\0",name:"identity",encode:r=>I0(r),decode:r=>S0(r)});var Fl=new TextEncoder,Hl=new TextDecoder;var P0=85;var co={};Te(co,{identity:()=>mt});var A5=C0,N0=128,S5=127,I5=~S5,B5=Math.pow(2,31);function C0(r,e,t){e=e||[],t=t||0;for(var n=t;r>=B5;)e[t++]=r&255|N0,r/=128;for(;r&I5;)e[t++]=r&255|N0,r>>>=7;return e[t]=r|0,C0.bytes=t-n+1,e}var k5=ao,T5=128,_0=127;function ao(r,n){var t=0,n=n||0,i=0,s=n,o,a=r.length;do{if(s>=a)throw ao.bytes=0,new RangeError("Could not decode varint");o=r[s++],t+=i<28?(o&_0)<<i:(o&_0)*Math.pow(2,i),i+=7}while(o>=T5);return ao.bytes=s-n,t}var R5=Math.pow(2,7),P5=Math.pow(2,14),L5=Math.pow(2,21),N5=Math.pow(2,28),_5=Math.pow(2,35),C5=Math.pow(2,42),U5=Math.pow(2,49),D5=Math.pow(2,56),O5=Math.pow(2,63),M5=function(r){return r<R5?1:r<P5?2:r<L5?3:r<N5?4:r<_5?5:r<C5?6:r<U5?7:r<D5?8:r<O5?9:10},V5={encode:A5,decode:k5,encodingLength:M5},F5=V5,un=F5;function fn(r,e=0){return[un.decode(r,e),un.decode.bytes]}function Br(r,e,t=0){return un.encode(r,e,t),e}function kr(r){return un.encodingLength(r)}function Qe(r,e){let t=e.byteLength,n=kr(r),i=n+kr(t),s=new Uint8Array(i+t);return Br(r,s,0),Br(t,s,n),s.set(e,i),new Tr(r,t,e,s)}function ae(r){let e=dt(r),[t,n]=fn(e),[i,s]=fn(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Tr(t,i,o,e)}function U0(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&A0(r.bytes,t.bytes)}}var Tr=class{code;size;digest;bytes;constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};var D0=0,H5="identity",O0=dt;function q5(r){return Qe(D0,O0(r))}var mt={code:D0,name:H5,encode:O0,digest:q5};var fo={};Te(fo,{sha256:()=>gt,sha512:()=>K5});function uo({name:r,code:e,encode:t}){return new lo(r,e,t)}var lo=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Qe(this.code,t):t.then(n=>Qe(this.code,n))}else throw Error("Unknown type, must be binary type")}};function V0(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var gt=uo({name:"sha2-256",code:18,encode:V0("SHA-256")}),K5=uo({name:"sha2-512",code:19,encode:V0("SHA-512")});function F0(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return z5(t,ho(r),e??Y.encoder);default:return G5(t,ho(r),e??pt.encoder)}}var H0=new WeakMap;function ho(r){let e=H0.get(r);if(e==null){let t=new Map;return H0.set(r,t),t}return e}var re=class r{code;version;multihash;bytes;"/";constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==hn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==j5)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=Qe(e,t);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return r.equals(this,e)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&U0(e.multihash,n.multihash)}toString(e){return F0(this,e)}toJSON(){return{"/":F0(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:i,multihash:s,bytes:o}=t;return new r(n,i,s,o??q0(n,i,s.bytes))}else if(t[W5]===!0){let{version:n,multihash:i,code:s}=t,o=ae(i);return r.create(n,s,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==hn)throw new Error(`Version 0 CID must use dag-pb (code: ${hn}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let i=q0(e,t,n.bytes);return new r(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,hn,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,i=dt(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=i.subarray(t.multihashSize-t.digestSize),o=new Tr(t.multihashCode,t.digestSize,s,i);return[t.version===0?r.createV0(o):r.createV1(t.codec,o),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,h]=fn(e.subarray(t));return t+=h,f},i=n(),s=hn;if(i===18?(i=0,t=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=t,a=n(),c=n(),l=t+c,u=l-o;return{version:i,codec:s,multihashCode:a,digestSize:c,multihashSize:u,size:l}}static parse(e,t){let[n,i]=$5(e,t),s=r.decode(i);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ho(s).set(n,e),s}};function $5(r,e){switch(r[0]){case"Q":{let t=e??Y;return[Y.prefix,t.decode(`${Y.prefix}${r}`)]}case Y.prefix:{let t=e??Y;return[Y.prefix,t.decode(r)]}case pt.prefix:{let t=e??pt;return[pt.prefix,t.decode(r)]}case ln.prefix:{let t=e??ln;return[ln.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function z5(r,e,t){let{prefix:n}=t;if(n!==Y.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return i}function G5(r,e,t){let{prefix:n}=t,i=e.get(n);if(i==null){let s=t.encode(r);return e.set(n,s),s}else return i}var hn=112,j5=18;function q0(r,e,t){let n=kr(r),i=n+kr(e),s=new Uint8Array(i+t.byteLength);return Br(r,s,0),Br(e,s,n),s.set(t,i),s}var W5=Symbol.for("@ipld/js-cid/CID");var dn={...oo,...Js,...so,...Ys,...Xs,...to,...ro,...no,...io,...eo},l9={...fo,...co};function $0(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var K0=$0("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),po=$0("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=ge(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Q5={utf8:K0,"utf-8":K0,hex:dn.base16,latin1:po,ascii:po,binary:po,...dn},e1=Q5;function Q(r,e="utf8"){let t=e1[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function mo(r){let e=r??8192,t=e>>>1,n,i=e;return function(o){if(o<1||o>t)return ge(o);i+o>e&&(n=ge(e),i=0);let a=n.subarray(i,i+=o);return i&7&&(i=(i|7)+1),a}}var or=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function go(){}var wo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Z5=mo();function Y5(r){return globalThis.Buffer!=null?ge(r):Z5(r)}var mn=class{len;head;tail;states;constructor(){this.len=0,this.head=new or(go,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new or(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new bo((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(t1,10,Fe.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=Fe.fromBigInt(e);return this._push(t1,t.length(),t)}uint64Number(e){return this._push(Fs,oe(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let t=Fe.fromBigInt(e).zzEncode();return this._push(t1,t.length(),t)}sint64Number(e){let t=Fe.fromNumber(e).zzEncode();return this._push(t1,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(yo,1,e?1:0)}fixed32(e){return this._push(pn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=Fe.fromBigInt(e);return this._push(pn,4,t.lo)._push(pn,4,t.hi)}fixed64Number(e){let t=Fe.fromNumber(e);return this._push(pn,4,t.lo)._push(pn,4,t.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(m0,4,e)}double(e){return this._push(y0,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(yo,1,0):this.uint32(t)._push(J5,t,e)}string(e){let t=x0(e);return t!==0?this.uint32(t)._push($s,t,e):this._push(yo,1,0)}fork(){return this.states=new wo(this),this.head=this.tail=new or(go,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(go,0,0),this.len=0),this}ldelim(){let e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=t,this.len+=n),this}finish(){let e=this.head.next,t=Y5(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function yo(r,e,t){e[t]=r&255}function X5(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var bo=class extends or{next;constructor(e,t){super(X5,e,t),this.next=void 0}};function t1(r,e,t){for(;r.hi!==0;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}function pn(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function J5(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(mn.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(e6,e,r),this},mn.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(t6,e,r),this});function e6(r,e,t){e.set(r,t)}function t6(r,e,t){r.length<40?$s(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(Q(r),t)}function xo(){return new mn}function rt(r,e){let t=xo();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Rr;(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"})(Rr||(Rr={}));function r1(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function Pr(r){function e(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let t=function(s,o){let a=e(s);o.int32(a)},n=function(s){let o=s.int32();return e(o)};return r1("enum",Rr.VARINT,t,n)}function nt(r,e){return r1("message",Rr.LENGTH_DELIMITED,r,e)}var Lr=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var gn;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.key!=null&&t.key.byteLength>0&&(n.uint32(10),n.bytes(t.key)),t.value!=null&&t.value.byteLength>0&&(n.uint32(18),n.bytes(t.value)),t.timeReceived!=null&&t.timeReceived!==""&&(n.uint32(42),n.string(t.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={key:Ce(0),value:Ce(0),timeReceived:""},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.key=t.bytes();break}case 2:{s.value=t.bytes();break}case 5:{s.timeReceived=t.string();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(gn||(gn={}));function z0(r){let e=r.getUTCFullYear(),t=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0"),i=String(r.getUTCHours()).padStart(2,"0"),s=String(r.getUTCMinutes()).padStart(2,"0"),o=String(r.getUTCSeconds()).padStart(2,"0"),a=r.getUTCMilliseconds(),c=String(a*1e3*1e3).padStart(9,"0");return`${e}-${t}-${n}T${i}:${s}:${o}.${c}Z`}function G0(r){let e=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),t=String(r).trim().match(e);if(t==null)throw new Error("Invalid format");let n=parseInt(t[1],10),i=parseInt(t[2],10)-1,s=parseInt(t[3],10),o=parseInt(t[4],10),a=parseInt(t[5],10),c=parseInt(t[6],10),l=parseInt(t[7].slice(0,-6),10);return new Date(Date.UTC(n,i,s,o,a,c,l))}var fe=class r{key;value;timeReceived;constructor(e,t,n){if(!(e instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(t instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=e,this.value=t,this.timeReceived=n}serialize(){return gn.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:z0(this.timeReceived)}}static deserialize(e){let t=gn.decode(e);return new r(t.key,t.value,new Date(t.timeReceived))}static fromDeserialized(e){let t=G0(e.timeReceived);if(e.key==null)throw new Error("key missing from deserialized object");if(e.value==null)throw new Error("value missing from deserialized object");return new r(e.key,e.value,t)}};function n6(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var j0=n6;function i6(r){return r[Symbol.asyncIterator]!=null}function s6(r,e){let t=0;if(i6(r))return async function*(){for await(let c of r)yield e(c,t++)}();let n=j0(r),{value:i,done:s}=n.next();if(s===!0)return function*(){}();let o=e(i,t++);if(typeof o.then=="function")return async function*(){yield await o;for await(let c of n)yield e(c,t++)}();let a=e;return function*(){yield o;for(let c of n)yield a(c,t++)}()}var Dt=s6;var n1=globalThis.CustomEvent??Event;async function*ar(r,e={}){let t=e.concurrency??1/0;t<1&&(t=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,s=[],o=se(),a=se(),c=!1,l,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let y of r){if(s.length===t&&(o=se(),await o.promise),u)break;let w={done:!1};s.push(w),y().then(d=>{w.done=!0,w.ok=!0,w.value=d,i.dispatchEvent(new n1("task-complete"))},d=>{w.done=!0,w.err=d,i.dispatchEvent(new n1("task-complete"))})}c=!0,i.dispatchEvent(new n1("task-complete"))}catch(y){l=y,i.dispatchEvent(new n1("task-complete"))}});function f(){return n?s[0]?.done:!!s.find(y=>y.done)}function*h(){for(;s.length>0&&s[0].done;){let y=s[0];if(s.shift(),y.ok)yield y.value;else throw u=!0,o.resolve(),y.err;o.resolve()}}function*p(){for(;f();)for(let y=0;y<s.length;y++)if(s[y].done){let w=s[y];if(s.splice(y,1),y--,w.ok)yield w.value;else throw u=!0,o.resolve(),w.err;o.resolve()}}for(;;){if(f()||(a=se(),await a.promise),l!=null)throw l;if(n?yield*h():yield*p(),c&&s.length===0)break}}var i1=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Nr=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new i1(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let t=this.head;this.head=t.next=new i1(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var vo=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function _r(r={}){return o6(t=>{let n=t.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},r)}function o6(r,e){e=e??{};let t=e.onEnd,n=new Nr,i,s,o,a=se(),c=async()=>{try{return n.isEmpty()?o?{done:!0}:await new Promise((d,x)=>{s=E=>{s=null,n.push(E);try{d(r(n))}catch(m){x(m)}return i}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=se()})}},l=d=>s!=null?s(d):(n.push(d),i),u=d=>(n=new Nr,s!=null?s({error:d}):(n.push({error:d}),i)),f=d=>{if(o)return i;if(e?.objectMode!==!0&&d?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:d})},h=d=>o?i:(o=!0,d!=null?u(d):l({done:!0})),p=()=>(n=new Nr,h(),{done:!0}),y=d=>(h(d),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:c,return:p,throw:y,push:f,end:h,get readableLength(){return n.size},onEmpty:async d=>{let x=d?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let E,m;x!=null&&(E=new Promise((A,R)=>{m=()=>{R(new vo)},x.addEventListener("abort",m)}));try{await Promise.race([a.promise,E])}finally{m!=null&&x!=null&&x?.removeEventListener("abort",m)}}},t==null)return i;let w=i;return i={[Symbol.asyncIterator](){return this},next(){return w.next()},throw(d){return w.throw(d),t!=null&&(t(d),t=void 0),{done:!0}},return(){return w.return(),t!=null&&(t(),t=void 0),{done:!0}},push:f,end(d){return w.end(d),t!=null&&(t(d),t=void 0),i},get readableLength(){return w.readableLength},onEmpty:d=>w.onEmpty(d)},i}function a6(r){return r[Symbol.asyncIterator]!=null}function c6(...r){let e=[];for(let t of r)a6(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=_r({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let i of n)t.push(i)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var s1=c6;function Ot(r,...e){if(r==null)throw new Error("Empty pipeline");if(Eo(r)){let n=r;r=()=>n.source}else if(Q0(r)||W0(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&Eo(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let n=1;n<t.length-1;n++)Eo(t[n])&&(t[n]=u6(t[n]));return l6(...t)}var l6=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},W0=r=>r?.[Symbol.asyncIterator]!=null,Q0=r=>r?.[Symbol.iterator]!=null,Eo=r=>r==null?!1:r.sink!=null&&r.source!=null,u6=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=_r({objectMode:!0});t.then(()=>{n.end()},o=>{n.end(o)});let i,s=r.source;if(W0(s))i=async function*(){yield*s,n.end()};else if(Q0(s))i=function*(){yield*s,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return s1(n,i())}return r.source};function X(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}var Mt=class extends Error{constructor(e="Query error"){super(e),this.name="QueryError"}},o1=class extends Error{constructor(e="Query aborted"){super(e),this.name="QueryAbortedError"}},a1=class extends Error{constructor(e="Invalid record"){super(e),this.name="InvalidRecordError"}},c1=class extends Error{constructor(e="No selector function configured for prefix"){super(e),this.name="MissingSelectorError"}};var Z0;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.key!=null&&(n.uint32(10),n.bytes(t.key)),t.value!=null&&(n.uint32(18),n.bytes(t.value)),t.author!=null&&(n.uint32(26),n.bytes(t.author)),t.signature!=null&&(n.uint32(34),n.bytes(t.signature)),t.timeReceived!=null&&(n.uint32(42),n.string(t.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.key=t.bytes();break}case 2:{s.value=t.bytes();break}case 3:{s.author=t.bytes();break}case 4:{s.signature=t.bytes();break}case 5:{s.timeReceived=t.string();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(Z0||(Z0={}));var O;(function(r){r.PUT_VALUE="PUT_VALUE",r.GET_VALUE="GET_VALUE",r.ADD_PROVIDER="ADD_PROVIDER",r.GET_PROVIDERS="GET_PROVIDERS",r.FIND_NODE="FIND_NODE",r.PING="PING"})(O||(O={}));var l1;(function(r){r[r.PUT_VALUE=0]="PUT_VALUE",r[r.GET_VALUE=1]="GET_VALUE",r[r.ADD_PROVIDER=2]="ADD_PROVIDER",r[r.GET_PROVIDERS=3]="GET_PROVIDERS",r[r.FIND_NODE=4]="FIND_NODE",r[r.PING=5]="PING"})(l1||(l1={}));(function(r){r.codec=()=>Pr(l1)})(O||(O={}));var Ur;(function(r){r.NOT_CONNECTED="NOT_CONNECTED",r.CONNECTED="CONNECTED",r.CAN_CONNECT="CAN_CONNECT",r.CANNOT_CONNECT="CANNOT_CONNECT"})(Ur||(Ur={}));var Ao;(function(r){r[r.NOT_CONNECTED=0]="NOT_CONNECTED",r[r.CONNECTED=1]="CONNECTED",r[r.CAN_CONNECT=2]="CAN_CONNECT",r[r.CANNOT_CONNECT=3]="CANNOT_CONNECT"})(Ao||(Ao={}));(function(r){r.codec=()=>Pr(Ao)})(Ur||(Ur={}));var Cr;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),t.id!=null&&t.id.byteLength>0&&(n.uint32(10),n.bytes(t.id)),t.multiaddrs!=null)for(let s of t.multiaddrs)n.uint32(18),n.bytes(s);t.connection!=null&&(n.uint32(24),Ur.codec().encode(t.connection,n)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={id:Ce(0),multiaddrs:[]},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.id=t.bytes();break}case 2:{if(i.limits?.multiaddrs!=null&&s.multiaddrs.length===i.limits.multiaddrs)throw new Lr('Decode error - map field "multiaddrs" had too many elements');s.multiaddrs.push(t.bytes());break}case 3:{s.connection=Ur.codec().decode(t);break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(Cr||(Cr={}));var yt;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{if(i.lengthDelimited!==!1&&n.fork(),t.type!=null&&l1[t.type]!==0&&(n.uint32(8),O.codec().encode(t.type,n)),t.clusterLevel!=null&&(n.uint32(80),n.int32(t.clusterLevel)),t.key!=null&&(n.uint32(18),n.bytes(t.key)),t.record!=null&&(n.uint32(26),n.bytes(t.record)),t.closer!=null)for(let s of t.closer)n.uint32(66),Cr.codec().encode(s,n);if(t.providers!=null)for(let s of t.providers)n.uint32(74),Cr.codec().encode(s,n);i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={type:O.PUT_VALUE,closer:[],providers:[]},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.type=O.codec().decode(t);break}case 10:{s.clusterLevel=t.int32();break}case 2:{s.key=t.bytes();break}case 3:{s.record=t.bytes();break}case 8:{if(i.limits?.closer!=null&&s.closer.length===i.limits.closer)throw new Lr('Decode error - map field "closer" had too many elements');s.closer.push(Cr.codec().decode(t,t.uint32(),{limits:i.limits?.closer$}));break}case 9:{if(i.limits?.providers!=null&&s.providers.length===i.limits.providers)throw new Lr('Decode error - map field "providers" had too many elements');s.providers.push(Cr.codec().decode(t,t.uint32(),{limits:i.limits?.providers$}));break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(yt||(yt={}));function So(r,e={}){let t={...r,name:"SEND_QUERY",type:0,messageName:r.type,messageType:r.type};return e.onProgress?.(new CustomEvent("kad-dht:query:send-query",{detail:t})),t}function yn(r,e={}){let t={...r,name:"PEER_RESPONSE",type:1,messageName:r.messageType,closer:r.closer??[],providers:r.providers??[]};return e.onProgress?.(new CustomEvent("kad-dht:query:peer-response",{detail:t})),t}function u1(r,e={}){let t={...r,name:"FINAL_PEER",type:2};return e.onProgress?.(new CustomEvent("kad-dht:query:final-peer",{detail:t})),t}function qe(r,e={}){let t={...r,name:"QUERY_ERROR",type:3};return e.onProgress?.(new CustomEvent("kad-dht:query:query-error",{detail:t})),t}function Io(r,e={}){let t={...r,name:"PROVIDER",type:4};return e.onProgress?.(new CustomEvent("kad-dht:query:provider",{detail:t})),t}function wn(r,e={}){let t={...r,name:"VALUE",type:5};return e.onProgress?.(new CustomEvent("kad-dht:query:value",{detail:t})),t}function Bo(r,e={}){let t={...r,name:"DIAL_PEER",type:7};return e.onProgress?.(new CustomEvent("kad-dht:query:dial-peer",{detail:t})),t}function D(r,e="utf8"){let t=e1[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}function Y0(r,e,t){if(t.length===0)throw new $("No records given");let i=D(e).split("/");if(i.length<3)throw new $("Record key does not have a selector function");let s=r[i[1].toString()];if(s==null)throw new c1(`No selector function configured for key type "${i[1]}"`);return t.length===1?0:s(e,t)}function f6(r,e){return 0}var X0={pk:f6};function J0(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`positive integer expected, not ${r}`)}function h6(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Dr(r,...e){if(!h6(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function e3(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");J0(r.outputLen),J0(r.blockLen)}function Or(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function t3(r,e){Dr(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var cr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var f1=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Ze=(r,e)=>r<<32-e|r>>>e;var xu=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function r3(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function bn(r){return typeof r=="string"&&(r=r3(r)),Dr(r),r}function ko(...r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];Dr(i),e+=i.length}let t=new Uint8Array(e);for(let n=0,i=0;n<r.length;n++){let s=r[n];t.set(s,i),i+=s.length}return t}var Mr=class{clone(){return this._cloneInto()}},vu={}.toString;function h1(r){let e=n=>r().update(bn(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Vr(r=32){if(cr&&typeof cr.getRandomValues=="function")return cr.getRandomValues(new Uint8Array(r));if(cr&&typeof cr.randomBytes=="function")return cr.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function d6(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(t>>i&s),a=Number(t&s),c=n?4:0,l=n?0:4;r.setUint32(e+c,o,n),r.setUint32(e+l,a,n)}var n3=(r,e,t)=>r&e^~r&t,i3=(r,e,t)=>r&e^r&t^e&t,Fr=class extends Mr{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=f1(this.buffer)}update(e){Or(this);let{view:t,buffer:n,blockLen:i}=this;e=bn(e);let s=e.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let c=f1(e);for(;i<=s-o;o+=i)this.process(c,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Or(this),t3(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let f=o;f<i;f++)t[f]=0;d6(n,i-8,BigInt(this.length*8),s),this.process(n,0);let a=f1(e),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:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:i,finished:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(n),e}};var d1=BigInt(4294967295),To=BigInt(32);function s3(r,e=!1){return e?{h:Number(r&d1),l:Number(r>>To&d1)}:{h:Number(r>>To&d1)|0,l:Number(r&d1)|0}}function p6(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){let{h:s,l:o}=s3(r[i],e);[t[i],n[i]]=[s,o]}return[t,n]}var m6=(r,e)=>BigInt(r>>>0)<<To|BigInt(e>>>0),g6=(r,e,t)=>r>>>t,y6=(r,e,t)=>r<<32-t|e>>>t,w6=(r,e,t)=>r>>>t|e<<32-t,b6=(r,e,t)=>r<<32-t|e>>>t,x6=(r,e,t)=>r<<64-t|e>>>t-32,v6=(r,e,t)=>r>>>t-32|e<<64-t,E6=(r,e)=>e,A6=(r,e)=>r,S6=(r,e,t)=>r<<t|e>>>32-t,I6=(r,e,t)=>e<<t|r>>>32-t,B6=(r,e,t)=>e<<t-32|r>>>64-t,k6=(r,e,t)=>r<<t-32|e>>>64-t;function T6(r,e,t,n){let i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:i|0}}var R6=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),P6=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,L6=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),N6=(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,_6=(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0),C6=(r,e,t,n,i,s)=>e+t+n+i+s+(r/2**32|0)|0;var U6={fromBig:s3,split:p6,toBig:m6,shrSH:g6,shrSL:y6,rotrSH:w6,rotrSL:b6,rotrBH:x6,rotrBL:v6,rotr32H:E6,rotr32L:A6,rotlSH:S6,rotlSL:I6,rotlBH:B6,rotlBL:k6,add:T6,add3L:R6,add3H:P6,add4L:L6,add4H:N6,add5H:C6,add5L:_6},U=U6;var[D6,O6]=U.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))),Vt=new Uint32Array(80),Ft=new Uint32Array(80),Ro=class extends Fr{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:e,Al:t,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:l,El:u,Fh:f,Fl:h,Gh:p,Gl:y,Hh:w,Hl:d}=this;return[e,t,n,i,s,o,a,c,l,u,f,h,p,y,w,d]}set(e,t,n,i,s,o,a,c,l,u,f,h,p,y,w,d){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=u|0,this.Fh=f|0,this.Fl=h|0,this.Gh=p|0,this.Gl=y|0,this.Hh=w|0,this.Hl=d|0}process(e,t){for(let m=0;m<16;m++,t+=4)Vt[m]=e.getUint32(t),Ft[m]=e.getUint32(t+=4);for(let m=16;m<80;m++){let A=Vt[m-15]|0,R=Ft[m-15]|0,T=U.rotrSH(A,R,1)^U.rotrSH(A,R,8)^U.shrSH(A,R,7),B=U.rotrSL(A,R,1)^U.rotrSL(A,R,8)^U.shrSL(A,R,7),k=Vt[m-2]|0,N=Ft[m-2]|0,ce=U.rotrSH(k,N,19)^U.rotrBH(k,N,61)^U.shrSH(k,N,6),K=U.rotrSL(k,N,19)^U.rotrBL(k,N,61)^U.shrSL(k,N,6),M=U.add4L(B,K,Ft[m-7],Ft[m-16]),le=U.add4H(M,T,ce,Vt[m-7],Vt[m-16]);Vt[m]=le|0,Ft[m]=M|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:l,Dl:u,Eh:f,El:h,Fh:p,Fl:y,Gh:w,Gl:d,Hh:x,Hl:E}=this;for(let m=0;m<80;m++){let A=U.rotrSH(f,h,14)^U.rotrSH(f,h,18)^U.rotrBH(f,h,41),R=U.rotrSL(f,h,14)^U.rotrSL(f,h,18)^U.rotrBL(f,h,41),T=f&p^~f&w,B=h&y^~h&d,k=U.add5L(E,R,B,O6[m],Ft[m]),N=U.add5H(k,x,A,T,D6[m],Vt[m]),ce=k|0,K=U.rotrSH(n,i,28)^U.rotrBH(n,i,34)^U.rotrBH(n,i,39),M=U.rotrSL(n,i,28)^U.rotrBL(n,i,34)^U.rotrBL(n,i,39),le=n&s^n&a^s&a,S=i&o^i&c^o&c;x=w|0,E=d|0,w=p|0,d=y|0,p=f|0,y=h|0,{h:f,l:h}=U.add(l|0,u|0,N|0,ce|0),l=a|0,u=c|0,a=s|0,c=o|0,s=n|0,o=i|0;let P=U.add3L(ce,M,S);n=U.add3H(P,N,K,le),i=P|0}({h:n,l:i}=U.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=U.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=U.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:u}=U.add(this.Dh|0,this.Dl|0,l|0,u|0),{h:f,l:h}=U.add(this.Eh|0,this.El|0,f|0,h|0),{h:p,l:y}=U.add(this.Fh|0,this.Fl|0,p|0,y|0),{h:w,l:d}=U.add(this.Gh|0,this.Gl|0,w|0,d|0),{h:x,l:E}=U.add(this.Hh|0,this.Hl|0,x|0,E|0),this.set(n,i,s,o,a,c,l,u,f,h,p,y,w,d,x,E)}roundClean(){Vt.fill(0),Ft.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 o3=h1(()=>new Ro);var m1={};Te(m1,{aInRange:()=>Ue,abool:()=>Ye,abytes:()=>Hr,bitGet:()=>K6,bitLen:()=>Co,bitMask:()=>vn,bitSet:()=>$6,bytesToHex:()=>bt,bytesToNumberBE:()=>xt,bytesToNumberLE:()=>qt,concatBytes:()=>vt,createHmacDrbg:()=>Uo,ensureBytes:()=>ie,equalBytes:()=>H6,hexToBytes:()=>ur,hexToNumber:()=>_o,inRange:()=>xn,isBytes:()=>Ht,memoized:()=>hr,notImplemented:()=>G6,numberToBytesBE:()=>Kt,numberToBytesLE:()=>fr,numberToHexUnpadded:()=>lr,numberToVarBytesBE:()=>F6,utf8ToBytes:()=>q6,validateObject:()=>it});var No=BigInt(0),p1=BigInt(1),M6=BigInt(2);function Ht(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function Hr(r){if(!Ht(r))throw new Error("Uint8Array expected")}function Ye(r,e){if(typeof e!="boolean")throw new Error(`${r} must be valid boolean, got "${e}".`)}var V6=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function bt(r){Hr(r);let e="";for(let t=0;t<r.length;t++)e+=V6[r[t]];return e}function lr(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function _o(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var wt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function a3(r){if(r>=wt._0&&r<=wt._9)return r-wt._0;if(r>=wt._A&&r<=wt._F)return r-(wt._A-10);if(r>=wt._a&&r<=wt._f)return r-(wt._a-10)}function ur(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){let o=a3(r.charCodeAt(s)),a=a3(r.charCodeAt(s+1));if(o===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[i]=o*16+a}return n}function xt(r){return _o(bt(r))}function qt(r){return Hr(r),_o(bt(Uint8Array.from(r).reverse()))}function Kt(r,e){return ur(r.toString(16).padStart(e*2,"0"))}function fr(r,e){return Kt(r,e).reverse()}function F6(r){return ur(lr(r))}function ie(r,e,t){let n;if(typeof e=="string")try{n=ur(e)}catch(s){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${s}`)}else if(Ht(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let i=n.length;if(typeof t=="number"&&i!==t)throw new Error(`${r} expected ${t} bytes, got ${i}`);return n}function vt(...r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];Hr(i),e+=i.length}let t=new Uint8Array(e);for(let n=0,i=0;n<r.length;n++){let s=r[n];t.set(s,i),i+=s.length}return t}function H6(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function q6(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var Po=r=>typeof r=="bigint"&&No<=r;function xn(r,e,t){return Po(r)&&Po(e)&&Po(t)&&e<=r&&r<t}function Ue(r,e,t,n){if(!xn(e,t,n))throw new Error(`expected valid ${r}: ${t} <= n < ${n}, got ${typeof e} ${e}`)}function Co(r){let e;for(e=0;r>No;r>>=p1,e+=1);return e}function K6(r,e){return r>>BigInt(e)&p1}function $6(r,e,t){return r|(t?p1:No)<<BigInt(e)}var vn=r=>(M6<<BigInt(r-1))-p1,Lo=r=>new Uint8Array(r),c3=r=>Uint8Array.from(r);function Uo(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Lo(r),i=Lo(r),s=0,o=()=>{n.fill(1),i.fill(0),s=0},a=(...f)=>t(i,n,...f),c=(f=Lo())=>{i=a(c3([0]),f),n=a(),f.length!==0&&(i=a(c3([1]),f),n=a())},l=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0,h=[];for(;f<e;){n=a();let p=n.slice();h.push(p),f+=n.length}return vt(...h)};return(f,h)=>{o(),c(f);let p;for(;!(p=h(l()));)c();return o(),p}}var z6={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"||Ht(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function it(r,e,t={}){let n=(i,s,o)=>{let a=z6[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let c=r[i];if(!(o&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(let[i,s]of Object.entries(e))n(i,s,!1);for(let[i,s]of Object.entries(t))n(i,s,!0);return r}var G6=()=>{throw new Error("not implemented")};function hr(r){let e=new WeakMap;return(t,...n)=>{let i=e.get(t);if(i!==void 0)return i;let s=r(t,...n);return e.set(t,s),s}}var he=BigInt(0),J=BigInt(1),dr=BigInt(2),j6=BigInt(3),Do=BigInt(4),l3=BigInt(5),u3=BigInt(8),W6=BigInt(9),Q6=BigInt(16);function W(r,e){let t=r%e;return t>=he?t:e+t}function Z6(r,e,t){if(t<=he||e<he)throw new Error("Expected power/modulo > 0");if(t===J)return he;let n=J;for(;e>he;)e&J&&(n=n*r%t),r=r*r%t,e>>=J;return n}function ee(r,e,t){let n=r;for(;e-- >he;)n*=n,n%=t;return n}function g1(r,e){if(r===he||e<=he)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=W(r,e),n=e,i=he,s=J,o=J,a=he;for(;t!==he;){let l=n/t,u=n%t,f=i-o*l,h=s-a*l;n=t,t=u,i=o,s=a,o=f,a=h}if(n!==J)throw new Error("invert: does not exist");return W(i,e)}function Y6(r){let e=(r-J)/dr,t,n,i;for(t=r-J,n=0;t%dr===he;t/=dr,n++);for(i=dr;i<r&&Z6(i,e,r)!==r-J;i++);if(n===1){let o=(r+J)/Do;return function(c,l){let u=c.pow(l,o);if(!c.eql(c.sqr(u),l))throw new Error("Cannot find square root");return u}}let s=(t+J)/dr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let l=n,u=a.pow(a.mul(a.ONE,i),t),f=a.pow(c,s),h=a.pow(c,t);for(;!a.eql(h,a.ONE);){if(a.eql(h,a.ZERO))return a.ZERO;let p=1;for(let w=a.sqr(h);p<l&&!a.eql(w,a.ONE);p++)w=a.sqr(w);let y=a.pow(u,J<<BigInt(l-p-1));u=a.sqr(y),f=a.mul(f,y),h=a.mul(h,u),l=p}return f}}function X6(r){if(r%Do===j6){let e=(r+J)/Do;return function(n,i){let s=n.pow(i,e);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(r%u3===l3){let e=(r-l3)/u3;return function(n,i){let s=n.mul(i,dr),o=n.pow(s,e),a=n.mul(i,o),c=n.mul(n.mul(a,dr),o),l=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(l),i))throw new Error("Cannot find square root");return l}}return r%Q6,Y6(r)}var f3=(r,e)=>(W(r,e)&J)===J,J6=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Oo(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=J6.reduce((n,i)=>(n[i]="function",n),e);return it(r,t)}function e8(r,e,t){if(t<he)throw new Error("Expected power > 0");if(t===he)return r.ONE;if(t===J)return e;let n=r.ONE,i=e;for(;t>he;)t&J&&(n=r.mul(n,i)),i=r.sqr(i),t>>=J;return n}function t8(r,e){let t=new Array(e.length),n=e.reduce((s,o,a)=>r.is0(o)?s:(t[a]=s,r.mul(s,o)),r.ONE),i=r.inv(n);return e.reduceRight((s,o,a)=>r.is0(o)?s:(t[a]=r.mul(s,t[a]),r.mul(s,o)),i),t}function Mo(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function $t(r,e,t=!1,n={}){if(r<=he)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:s}=Mo(r,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=X6(r),a=Object.freeze({ORDER:r,BITS:i,BYTES:s,MASK:vn(i),ZERO:he,ONE:J,create:c=>W(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return he<=c&&c<r},is0:c=>c===he,isOdd:c=>(c&J)===J,neg:c=>W(-c,r),eql:(c,l)=>c===l,sqr:c=>W(c*c,r),add:(c,l)=>W(c+l,r),sub:(c,l)=>W(c-l,r),mul:(c,l)=>W(c*l,r),pow:(c,l)=>e8(a,c,l),div:(c,l)=>W(c*g1(l,r),r),sqrN:c=>c*c,addN:(c,l)=>c+l,subN:(c,l)=>c-l,mulN:(c,l)=>c*l,inv:c=>g1(c,r),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>t8(a,c),cmov:(c,l,u)=>u?l:c,toBytes:c=>t?fr(c,s):Kt(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return t?qt(c):xt(c)}});return Object.freeze(a)}function h3(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Vo(r){let e=h3(r);return e+Math.ceil(e/2)}function d3(r,e,t=!1){let n=r.length,i=h3(e),s=Vo(e);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let o=t?xt(r):qt(r),a=W(o,e-J)+J;return t?fr(a,i):Kt(a,i)}var n8=BigInt(0),Fo=BigInt(1),Ho=new WeakMap,p3=new WeakMap;function y1(r,e){let t=(s,o)=>{let a=o.negate();return s?a:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);let o=Math.ceil(e/s)+1,a=2**(s-1);return{windows:o,windowSize:a}};return{constTimeNegate:t,unsafeLadder(s,o){let a=r.ZERO,c=s;for(;o>n8;)o&Fo&&(a=a.add(c)),c=c.double(),o>>=Fo;return a},precomputeWindow(s,o){let{windows:a,windowSize:c}=i(o),l=[],u=s,f=u;for(let h=0;h<a;h++){f=u,l.push(f);for(let p=1;p<c;p++)f=f.add(u),l.push(f);u=f.double()}return l},wNAF(s,o,a){let{windows:c,windowSize:l}=i(s),u=r.ZERO,f=r.BASE,h=BigInt(2**s-1),p=2**s,y=BigInt(s);for(let w=0;w<c;w++){let d=w*l,x=Number(a&h);a>>=y,x>l&&(x-=p,a+=Fo);let E=d,m=d+Math.abs(x)-1,A=w%2!==0,R=x<0;x===0?f=f.add(t(A,o[E])):u=u.add(t(R,o[m]))}return{p:u,f}},wNAFCached(s,o,a){let c=p3.get(s)||1,l=Ho.get(s);return l||(l=this.precomputeWindow(s,c),c!==1&&Ho.set(s,a(l))),this.wNAF(c,l,o)},setWindowSize(s,o){n(o),p3.set(s,o),Ho.delete(s)}}}function w1(r,e,t,n){if(!Array.isArray(t)||!Array.isArray(n)||n.length!==t.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((u,f)=>{if(!e.isValid(u))throw new Error(`wrong scalar at index ${f}`)}),t.forEach((u,f)=>{if(!(u instanceof r))throw new Error(`wrong point at index ${f}`)});let i=Co(BigInt(t.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<<s)-1,a=new Array(o+1).fill(r.ZERO),c=Math.floor((e.BITS-1)/s)*s,l=r.ZERO;for(let u=c;u>=0;u-=s){a.fill(r.ZERO);for(let h=0;h<n.length;h++){let p=n[h],y=Number(p>>BigInt(u)&BigInt(o));a[y]=a[y].add(t[h])}let f=r.ZERO;for(let h=a.length-1,p=r.ZERO;h>0;h--)p=p.add(a[h]),f=f.add(p);if(l=l.add(f),u!==0)for(let h=0;h<s;h++)l=l.double()}return l}function En(r){return Oo(r.Fp),it(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Mo(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Xe=BigInt(0),De=BigInt(1),b1=BigInt(2),i8=BigInt(8),s8={zip215:!0};function o8(r){let e=En(r);return it(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function m3(r){let e=o8(r),{Fp:t,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=e,l=b1<<BigInt(a*8)-De,u=t.create,f=$t(e.n,e.nBitLength),h=e.uvRatio||((b,g)=>{try{return{isValid:!0,value:t.sqrt(b*t.inv(g))}}catch{return{isValid:!1,value:Xe}}}),p=e.adjustScalarBytes||(b=>b),y=e.domain||((b,g,v)=>{if(Ye("phflag",v),g.length||v)throw new Error("Contexts/pre-hash are not supported");return b});function w(b,g){Ue("coordinate "+b,g,Xe,l)}function d(b){if(!(b instanceof m))throw new Error("ExtendedPoint expected")}let x=hr((b,g)=>{let{ex:v,ey:L,ez:_}=b,C=b.is0();g==null&&(g=C?i8:t.inv(_));let V=u(v*g),q=u(L*g),F=u(_*g);if(C)return{x:Xe,y:De};if(F!==De)throw new Error("invZ was invalid");return{x:V,y:q}}),E=hr(b=>{let{a:g,d:v}=e;if(b.is0())throw new Error("bad point: ZERO");let{ex:L,ey:_,ez:C,et:V}=b,q=u(L*L),F=u(_*_),j=u(C*C),Z=u(j*j),pe=u(q*g),me=u(j*u(pe+F)),we=u(Z+u(v*u(q*F)));if(me!==we)throw new Error("bad point: equation left != right (1)");let ke=u(L*_),ue=u(C*V);if(ke!==ue)throw new Error("bad point: equation left != right (2)");return!0});class m{constructor(g,v,L,_){this.ex=g,this.ey=v,this.ez=L,this.et=_,w("x",g),w("y",v),w("z",L),w("t",_),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(g){if(g instanceof m)throw new Error("extended point not allowed");let{x:v,y:L}=g||{};return w("x",v),w("y",L),new m(v,L,De,u(v*L))}static normalizeZ(g){let v=t.invertBatch(g.map(L=>L.ez));return g.map((L,_)=>L.toAffine(v[_])).map(m.fromAffine)}static msm(g,v){return w1(m,f,g,v)}_setWindowSize(g){T.setWindowSize(this,g)}assertValidity(){E(this)}equals(g){d(g);let{ex:v,ey:L,ez:_}=this,{ex:C,ey:V,ez:q}=g,F=u(v*q),j=u(C*_),Z=u(L*q),pe=u(V*_);return F===j&&Z===pe}is0(){return this.equals(m.ZERO)}negate(){return new m(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:g}=e,{ex:v,ey:L,ez:_}=this,C=u(v*v),V=u(L*L),q=u(b1*u(_*_)),F=u(g*C),j=v+L,Z=u(u(j*j)-C-V),pe=F+V,me=pe-q,we=F-V,ke=u(Z*me),ue=u(pe*we),Le=u(Z*we),ut=u(me*pe);return new m(ke,ue,ut,Le)}add(g){d(g);let{a:v,d:L}=e,{ex:_,ey:C,ez:V,et:q}=this,{ex:F,ey:j,ez:Z,et:pe}=g;if(v===BigInt(-1)){let _2=u((C-_)*(j+F)),C2=u((C+_)*(j-F)),ys=u(C2-_2);if(ys===Xe)return this.double();let U2=u(V*b1*pe),D2=u(q*b1*Z),O2=D2+U2,M2=C2+_2,V2=D2-U2,E4=u(O2*ys),A4=u(M2*V2),S4=u(O2*V2),I4=u(ys*M2);return new m(E4,A4,I4,S4)}let me=u(_*F),we=u(C*j),ke=u(q*L*pe),ue=u(V*Z),Le=u((_+C)*(F+j)-me-we),ut=ue-ke,tn=ue+ke,rn=u(we-v*me),w4=u(Le*ut),b4=u(tn*rn),x4=u(Le*rn),v4=u(ut*tn);return new m(w4,b4,v4,x4)}subtract(g){return this.add(g.negate())}wNAF(g){return T.wNAFCached(this,g,m.normalizeZ)}multiply(g){let v=g;Ue("scalar",v,De,n);let{p:L,f:_}=this.wNAF(v);return m.normalizeZ([L,_])[0]}multiplyUnsafe(g){let v=g;return Ue("scalar",v,Xe,n),v===Xe?R:this.equals(R)||v===De?this:this.equals(A)?this.wNAF(v).p:T.unsafeLadder(this,v)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return T.unsafeLadder(this,n).is0()}toAffine(g){return x(this,g)}clearCofactor(){let{h:g}=e;return g===De?this:this.multiplyUnsafe(g)}static fromHex(g,v=!1){let{d:L,a:_}=e,C=t.BYTES;g=ie("pointHex",g,C),Ye("zip215",v);let V=g.slice(),q=g[C-1];V[C-1]=q&-129;let F=qt(V),j=v?l:t.ORDER;Ue("pointHex.y",F,Xe,j);let Z=u(F*F),pe=u(Z-De),me=u(L*Z-_),{isValid:we,value:ke}=h(pe,me);if(!we)throw new Error("Point.fromHex: invalid y coordinate");let ue=(ke&De)===De,Le=(q&128)!==0;if(!v&&ke===Xe&&Le)throw new Error("Point.fromHex: x=0 and x_0=1");return Le!==ue&&(ke=u(-ke)),m.fromAffine({x:ke,y:F})}static fromPrivateKey(g){return N(g).point}toRawBytes(){let{x:g,y:v}=this.toAffine(),L=fr(v,t.BYTES);return L[L.length-1]|=g&De?128:0,L}toHex(){return bt(this.toRawBytes())}}m.BASE=new m(e.Gx,e.Gy,De,u(e.Gx*e.Gy)),m.ZERO=new m(Xe,De,De,Xe);let{BASE:A,ZERO:R}=m,T=y1(m,a*8);function B(b){return W(b,n)}function k(b){return B(qt(b))}function N(b){let g=a;b=ie("private key",b,g);let v=ie("hashed private key",s(b),2*g),L=p(v.slice(0,g)),_=v.slice(g,2*g),C=k(L),V=A.multiply(C),q=V.toRawBytes();return{head:L,prefix:_,scalar:C,point:V,pointBytes:q}}function ce(b){return N(b).pointBytes}function K(b=new Uint8Array,...g){let v=vt(...g);return k(s(y(v,ie("context",b),!!i)))}function M(b,g,v={}){b=ie("message",b),i&&(b=i(b));let{prefix:L,scalar:_,pointBytes:C}=N(g),V=K(v.context,L,b),q=A.multiply(V).toRawBytes(),F=K(v.context,q,C,b),j=B(V+F*_);Ue("signature.s",j,Xe,n);let Z=vt(q,fr(j,t.BYTES));return ie("result",Z,a*2)}let le=s8;function S(b,g,v,L=le){let{context:_,zip215:C}=L,V=t.BYTES;b=ie("signature",b,2*V),g=ie("message",g),C!==void 0&&Ye("zip215",C),i&&(g=i(g));let q=qt(b.slice(V,2*V)),F,j,Z;try{F=m.fromHex(v,C),j=m.fromHex(b.slice(0,V),C),Z=A.multiplyUnsafe(q)}catch{return!1}if(!C&&F.isSmallOrder())return!1;let pe=K(_,j.toRawBytes(),F.toRawBytes(),g);return j.add(F.multiplyUnsafe(pe)).subtract(Z).clearCofactor().equals(m.ZERO)}return A._setWindowSize(8),{CURVE:e,getPublicKey:ce,sign:M,verify:S,ExtendedPoint:m,utils:{getExtendedPublicKey:N,randomPrivateKey:()=>o(t.BYTES),precompute(b=8,g=m.BASE){return g._setWindowSize(b),g.multiply(BigInt(3)),g}}}}var qo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),g3=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),$u=BigInt(0),a8=BigInt(1),y3=BigInt(2),zu=BigInt(3),c8=BigInt(5),l8=BigInt(8);function u8(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),i=BigInt(80),s=qo,a=r*r%s*r%s,c=ee(a,y3,s)*a%s,l=ee(c,a8,s)*r%s,u=ee(l,c8,s)*l%s,f=ee(u,e,s)*u%s,h=ee(f,t,s)*f%s,p=ee(h,n,s)*h%s,y=ee(p,i,s)*p%s,w=ee(y,i,s)*p%s,d=ee(w,e,s)*u%s;return{pow_p_5_8:ee(d,y3,s)*r%s,b2:a}}function f8(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function h8(r,e){let t=qo,n=W(e*e*e,t),i=W(n*n*e,t),s=u8(r*i).pow_p_5_8,o=W(r*n*s,t),a=W(e*o*o,t),c=o,l=W(o*g3,t),u=a===r,f=a===W(-r,t),h=a===W(-r*g3,t);return u&&(o=c),(f||h)&&(o=l),f3(o,t)&&(o=W(-o,t)),{isValid:u||f,value:o}}var d8=$t(qo,void 0,!0),p8={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:d8,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:l8,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:o3,randomBytes:Vr,adjustScalarBytes:f8,uvRatio:h8},w3=m3(p8);var x1=32;function b3(r,e,t){return w3.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}var v1=class{type="Ed25519";raw;constructor(e){this.raw=Ko(e,x1)}toMultihash(){return mt.digest(qr(this))}toCID(){return re.createV1(114,this.toMultihash())}toString(){return Y.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:X(this.raw,e.raw)}verify(e,t){return b3(this.raw,t,e)}};function $o(r){return r=Ko(r,x1),new v1(r)}function Ko(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new $(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}var de;(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1"})(de||(de={}));var zo;(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1"})(zo||(zo={}));(function(r){r.codec=()=>Pr(zo)})(de||(de={}));var st;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),de.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=de.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(st||(st={}));var Go;(function(r){let e;r.codec=()=>(e==null&&(e=nt((t,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),t.Type!=null&&(n.uint32(8),de.codec().encode(t.Type,n)),t.Data!=null&&(n.uint32(18),n.bytes(t.Data)),i.lengthDelimited!==!1&&n.ldelim()},(t,n,i={})=>{let s={},o=n==null?t.len:t.pos+n;for(;t.pos<o;){let a=t.uint32();switch(a>>>3){case 1:{s.Type=de.codec().decode(t);break}case 2:{s.Data=t.bytes();break}default:{t.skipType(a&7);break}}}return s})),e),r.encode=t=>rt(t,r.codec()),r.decode=(t,n)=>tt(t,r.codec(),n)})(Go||(Go={}));var Nn={};Te(Nn,{MAX_RSA_KEY_SIZE:()=>di,generateRSAKeyPair:()=>ya,jwkToJWKKeyPair:()=>wa,jwkToPkcs1:()=>L8,jwkToPkix:()=>t2,jwkToRSAPrivateKey:()=>ga,pkcs1ToJwk:()=>da,pkcs1ToRSAPrivateKey:()=>ma,pkixToJwk:()=>pa,pkixToRSAPublicKey:()=>r2});var g8=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]),zt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Gt=new Uint32Array(64),jo=class extends Fr{constructor(){super(64,32,8,!1),this.A=zt[0]|0,this.B=zt[1]|0,this.C=zt[2]|0,this.D=zt[3]|0,this.E=zt[4]|0,this.F=zt[5]|0,this.G=zt[6]|0,this.H=zt[7]|0}get(){let{A:e,B:t,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[e,t,n,i,s,o,a,c]}set(e,t,n,i,s,o,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let f=0;f<16;f++,t+=4)Gt[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let h=Gt[f-15],p=Gt[f-2],y=Ze(h,7)^Ze(h,18)^h>>>3,w=Ze(p,17)^Ze(p,19)^p>>>10;Gt[f]=w+Gt[f-7]+y+Gt[f-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:l,H:u}=this;for(let f=0;f<64;f++){let h=Ze(a,6)^Ze(a,11)^Ze(a,25),p=u+h+n3(a,c,l)+g8[f]+Gt[f]|0,w=(Ze(n,2)^Ze(n,13)^Ze(n,22))+i3(n,i,s)|0;u=l,l=c,c=a,a=o+p|0,o=s,s=i,i=n,n=p+w|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+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,i,s,o,a,c,l,u)}roundClean(){Gt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Kr=h1(()=>new jo);var H=bs(E3());function pr(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}function jt(r,e,t=-1){let n=t,i=r,s=0,o=Math.pow(2,e);for(let a=1;a<8;a++){if(r<o){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*e);l[s-u-1]=Math.floor(i/f),i-=l[s-u-1]*f}return c}o*=Math.pow(2,e)}return new ArrayBuffer(0)}function S1(...r){let e=0,t=0;for(let s of r)e+=s.length;let n=new ArrayBuffer(e),i=new Uint8Array(n);for(let s of r)i.set(s,t),t+=s.length;return i}function Qo(){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 e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let a=0;a<this.valueHex.byteLength;a++)t[a]=0;t[0]=r[0]&128;let n=pr(t,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let a=0;a<this.valueHex.byteLength;a++)s[a]=r[a];return s[0]&=127,pr(s,8)-n}function A3(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let o=t-e,a=jt(o,8,n),c=new Uint8Array(a);return c[0]|=128,a}let i=jt(e,8,n),s=new Uint8Array(i);if(s[0]&128){let o=i.slice(0),a=new Uint8Array(o);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let c=0;c<o.byteLength;c++)s[c+1]=a[c];s[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function S3(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}function Oe(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,i=new Array(n);for(let o=0;o<n;o++)i[o]="0";return i.join("").concat(t)}var mf=Math.log(2);function I1(){if(typeof BigInt>"u")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function Zo(r){let e=0,t=0;for(let i=0;i<r.length;i++){let s=r[i];e+=s.byteLength}let n=new Uint8Array(e);for(let i=0;i<r.length;i++){let s=r[i];n.set(new Uint8Array(s),t),t+=s.byteLength}return n.buffer}function Bt(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}var Sn=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return Zo(this.items)}},An=[new Uint8Array([1])],I3="0123456789";var Wr="",Je=new ArrayBuffer(0),Yo=new Uint8Array(0),In="EndOfContent",k3="OCTET STRING",T3="BIT STRING";function kt(r){var e;return e=class extends r{constructor(...n){var i;super(...n);let s=n[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?H.BufferSourceConverter.toUint8Array(s.valueHex):Yo}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,s){let o=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Bt(this,o,i,s))return-1;let a=i+s;return this.valueHexView=o.subarray(i,a),this.valueHexView.length?(this.blockLength=s,a):(this.warnings.push("Zero buffer length"),i)}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",Je)}toJSON(){return{...super.toJSON(),isHexOnly:this.isHexOnly,valueHex:H.Convert.ToHex(this.valueHexView)}}},e.NAME="hexBlock",e}var At=class{constructor({blockLength:e=0,error:t=Wr,warnings:n=[],valueBeforeDecode:i=Yo}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=H.BufferSourceConverter.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:H.Convert.ToHex(this.valueBeforeDecodeView)}}};At.NAME="baseBlock";var Ie=class extends At{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};Ie.NAME="valueBlock";var B1=class extends kt(At){constructor({idBlock:e={}}={}){var t,n,i,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?H.BufferSourceConverter.toUint8Array(e.valueHex):Yo,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Je}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,i[0]=t}return i.buffer}if(!this.isHexOnly){let i=jt(this.tagNumber,7),s=new Uint8Array(i),o=i.byteLength,a=new Uint8Array(o+1);if(a[0]=t|31,!e){for(let c=0;c<o-1;c++)a[c+1]=s[c]|128;a[o]=s[o-1]}return a.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){let i=H.BufferSourceConverter.toUint8Array(e);if(!Bt(this,i,t,n))return-1;let s=i.subarray(t,t+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 h=new Uint8Array(u);for(let p=0;p<l.length;p++)h[p]=l[p];l=this.valueHexView=new Uint8Array(u)}}this.blockLength=c+1,l[c-1]=s[c]&127;let f=new Uint8Array(c);for(let h=0;h<c;h++)f[h]=l[h];l=this.valueHexView=new Uint8Array(c),l.set(f),this.blockLength<=9?this.tagNumber=pr(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 t+this.blockLength}toJSON(){return{...super.toJSON(),tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed}}};B1.NAME="identificationBlock";var k1=class extends At{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){let i=H.BufferSourceConverter.toUint8Array(e);if(!Bt(this,i,t,n))return-1;let s=i.subarray(t,t+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,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;let o=s[0]&127;if(o>8)return this.error="Too big integer",-1;if(o+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let a=t+1,c=i.subarray(a,a+o);return c[o-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=pr(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=o+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let i=jt(this.length,8);if(i.byteLength>127)return this.error="Too big length",Je;if(t=new ArrayBuffer(i.byteLength+1),e)return t;let s=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let o=0;o<i.byteLength;o++)n[o+1]=s[o];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return{...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length}}};k1.NAME="lengthBlock";var I={},be=class extends At{constructor({name:e=Wr,optional:t=!1,primitiveSchema:n,...i}={},s){super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new B1(i),this.lenBlock=new k1(i),this.valueBlock=s?new s(i):new Ie(i)}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}toBER(e,t){let n=t||new Sn;t||R3(this);let i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;let o=this.lenBlock.toBER(e);n.write(o),n.write(s)}return t?Je:n.final()}toJSON(){let e={...super.toJSON(),idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional};return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():H.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${H.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return S3(t,n)}};be.NAME="BaseBlock";function R3(r){if(r instanceof I.Constructed)for(let e of r.valueBlock.value)R3(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}var T1=class extends be{constructor({value:e=Wr,...t}={},n){super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};T1.NAME="BaseStringBlock";var R1=class extends kt(Ie){constructor({isHexOnly:e=!0,...t}={}){super(t),this.isHexOnly=e}};R1.NAME="PrimitiveValueBlock";var P3,P1=class extends be{constructor(e={}){super(e,R1),this.idBlock.isConstructed=!1}};P3=P1;I.Primitive=P3;P1.NAME="PRIMITIVE";function I8(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function ui(r,e=0,t=r.length){let n=e,i=new be({},Ie),s=new At;if(!Bt(s,r,e,t))return i.error=s.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let a=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),a===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=a,t-=i.idBlock.blockLength,a=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),a===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=a,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let c=be;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};c=I.EndOfContent;break;case 1:c=I.Boolean;break;case 2:c=I.Integer;break;case 3:c=I.BitString;break;case 4:c=I.OctetString;break;case 5:c=I.Null;break;case 6:c=I.ObjectIdentifier;break;case 10:c=I.Enumerated;break;case 12:c=I.Utf8String;break;case 13:c=I.RelativeObjectIdentifier;break;case 14:c=I.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:c=I.Sequence;break;case 17:c=I.Set;break;case 18:c=I.NumericString;break;case 19:c=I.PrintableString;break;case 20:c=I.TeletexString;break;case 21:c=I.VideotexString;break;case 22:c=I.IA5String;break;case 23:c=I.UTCTime;break;case 24:c=I.GeneralizedTime;break;case 25:c=I.GraphicString;break;case 26:c=I.VisibleString;break;case 27:c=I.GeneralString;break;case 28:c=I.UniversalString;break;case 29:c=I.CharacterString;break;case 30:c=I.BmpString;break;case 31:c=I.DATE;break;case 32:c=I.TimeOfDay;break;case 33:c=I.DateTime;break;case 34:c=I.Duration;break;default:{let l=i.idBlock.isConstructed?new I.Constructed:new I.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:c=i.idBlock.isConstructed?I.Constructed:I.Primitive}return i=I8(i,c),a=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:a,result:i}}function Xo(r){if(!r.byteLength){let e=new be({},Ie);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ui(H.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}function B8(r,e){return r?1:e}var ot=class extends Ie{constructor({value:e=[],isIndefiniteForm:t=!1,...n}={}){super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let i=H.BufferSourceConverter.toUint8Array(e);if(!Bt(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;B8(this.isIndefiniteForm,n)>0;){let o=ui(i,s,n);if(o.offset===-1)return this.error=o.result.error,this.warnings.concat(o.result.warnings),-1;if(s=o.offset,this.blockLength+=o.result.blockLength,n-=o.result.blockLength,this.value.push(o.result),this.isIndefiniteForm&&o.result.constructor.NAME===In)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===In?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){let n=t||new Sn;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?Je:n.final()}toJSON(){let e={...super.toJSON(),isIndefiniteForm:this.isIndefiniteForm,value:[]};for(let t of this.value)e.value.push(t.toJSON());return e}};ot.NAME="ConstructedValueBlock";var L3,Wt=class extends be{constructor(e={}){super(e,ot),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(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),i)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
3
3
  `).map(i=>` ${i}`).join(`
4
4
  `));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
5
5
  ${e.join(`
@@ -10,7 +10,7 @@ pvtsutils/build/index.js:
10
10
  (*!
11
11
  * MIT License
12
12
  *
13
- * Copyright (c) 2017-2022 Peculiar Ventures, LLC
13
+ * Copyright (c) 2017-2024 Peculiar Ventures, LLC
14
14
  *
15
15
  * Permission is hereby granted, free of charge, to any person obtaining a copy
16
16
  * 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/kad-dht",
3
- "version": "14.1.3-0862522fe",
3
+ "version": "14.1.3-4a85eb033",
4
4
  "description": "JavaScript implementation of the Kad-DHT for libp2p",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/kad-dht#readme",
@@ -57,13 +57,13 @@
57
57
  "doc-check": "aegir doc-check"
58
58
  },
59
59
  "dependencies": {
60
- "@libp2p/crypto": "5.0.7-0862522fe",
61
- "@libp2p/interface": "2.2.1-0862522fe",
62
- "@libp2p/interface-internal": "2.1.1-0862522fe",
63
- "@libp2p/peer-collections": "6.0.12-0862522fe",
64
- "@libp2p/peer-id": "5.0.8-0862522fe",
65
- "@libp2p/record": "4.0.4-0862522fe",
66
- "@libp2p/utils": "6.2.1-0862522fe",
60
+ "@libp2p/crypto": "5.0.7-4a85eb033",
61
+ "@libp2p/interface": "2.2.1-4a85eb033",
62
+ "@libp2p/interface-internal": "2.1.1-4a85eb033",
63
+ "@libp2p/peer-collections": "6.0.12-4a85eb033",
64
+ "@libp2p/peer-id": "5.0.8-4a85eb033",
65
+ "@libp2p/record": "4.0.4-4a85eb033",
66
+ "@libp2p/utils": "6.2.1-4a85eb033",
67
67
  "@multiformats/multiaddr": "^12.2.3",
68
68
  "any-signal": "^4.1.1",
69
69
  "interface-datastore": "^8.3.0",
@@ -89,9 +89,9 @@
89
89
  "uint8arrays": "^5.1.0"
90
90
  },
91
91
  "devDependencies": {
92
- "@libp2p/interface-compliance-tests": "6.1.11-0862522fe",
93
- "@libp2p/logger": "5.1.4-0862522fe",
94
- "@libp2p/peer-store": "11.0.12-0862522fe",
92
+ "@libp2p/interface-compliance-tests": "6.1.11-4a85eb033",
93
+ "@libp2p/logger": "5.1.4-4a85eb033",
94
+ "@libp2p/peer-store": "11.0.12-4a85eb033",
95
95
  "@types/lodash.random": "^3.2.9",
96
96
  "@types/lodash.range": "^3.2.9",
97
97
  "@types/sinon": "^17.0.3",