@serfab/quereus-plugin-sereus 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +380 -380
- package/dist/plugin-browser.js +1 -1
- package/dist/plugin-browser.js.map +1 -1
- package/package.json +1 -1
- package/src/cluster-size.ts +621 -621
- package/src/index.ts +16 -16
- package/src/parse-config.ts +189 -189
- package/src/plugin-browser.ts +32 -32
- package/src/plugin.ts +35 -35
package/dist/plugin-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @serfab/quereus-plugin-sereus 1.
|
|
1
|
+
/* @serfab/quereus-plugin-sereus 1.11.0 — browser bundle */
|
|
2
2
|
var _re=Object.create;var A2=Object.defineProperty;var Mre=Object.getOwnPropertyDescriptor;var Lre=Object.getOwnPropertyNames;var Pre=Object.getPrototypeOf,Dre=Object.prototype.hasOwnProperty;var _=(r,e)=>()=>(r&&(e=r(r=0)),e);var vr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ue=(r,e)=>{for(var t in e)A2(r,t,{get:e[t],enumerable:!0})},Bre=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Lre(e))!Dre.call(r,o)&&o!==t&&A2(r,o,{get:()=>e[o],enumerable:!(n=Mre(e,o))||n.enumerable});return r};var gc=(r,e,t)=>(t=r!=null?_re(Pre(r)):{},Bre(e||!r||!r.__esModule?A2(t,"default",{value:r,enumerable:!0}):t,r));var UF=vr((j_e,FF)=>{var Gf=1e3,Wf=Gf*60,Yf=Wf*60,Sd=Yf*24,Hie=Sd*7,Kie=Sd*365.25;FF.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return zie(r);if(t==="number"&&isFinite(r))return e.long?qie(r):Vie(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function zie(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Kie;case"weeks":case"week":case"w":return t*Hie;case"days":case"day":case"d":return t*Sd;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Yf;case"minutes":case"minute":case"mins":case"min":case"m":return t*Wf;case"seconds":case"second":case"secs":case"sec":case"s":return t*Gf;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Vie(r){var e=Math.abs(r);return e>=Sd?Math.round(r/Sd)+"d":e>=Yf?Math.round(r/Yf)+"h":e>=Wf?Math.round(r/Wf)+"m":e>=Gf?Math.round(r/Gf)+"s":r+"ms"}function qie(r){var e=Math.abs(r);return e>=Sd?Mx(r,e,Sd,"day"):e>=Yf?Mx(r,e,Yf,"hour"):e>=Wf?Mx(r,e,Wf,"minute"):e>=Gf?Mx(r,e,Gf,"second"):r+" ms"}function Mx(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var HF=vr((G_e,$F)=>{function jie(r){t.debug=t,t.default=t,t.coerce=c,t.disable=i,t.enable=o,t.enabled=a,t.humanize=UF(),t.destroy=l,Object.keys(r).forEach(d=>{t[d]=r[d]}),t.names=[],t.skips=[],t.formatters={};function e(d){let u=0;for(let f=0;f<d.length;f++)u=(u<<5)-u+d.charCodeAt(f),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(d){let u,f=null,h,m;function y(...g){if(!y.enabled)return;let p=y,w=Number(new Date),b=w-(u||w);p.diff=b,p.prev=u,p.curr=w,u=w,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(k,M)=>{if(k==="%%")return"%";x++;let I=t.formatters[M];if(typeof I=="function"){let E=g[x];k=I.call(p,E),g.splice(x,1),x--}return k}),t.formatArgs.call(p,g),(p.log||t.log).apply(p,g)}return y.namespace=d,y.useColors=t.useColors(),y.color=t.selectColor(d),y.extend=n,y.destroy=t.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(h!==t.namespaces&&(h=t.namespaces,m=t.enabled(d)),m),set:g=>{f=g}}),typeof t.init=="function"&&t.init(y),y}function n(d,u){let f=t(this.namespace+(typeof u>"u"?":":u)+d);return f.log=this.log,f}function o(d){t.save(d),t.namespaces=d,t.names=[],t.skips=[];let u=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let f of u)f[0]==="-"?t.skips.push(f.slice(1)):t.names.push(f)}function s(d,u){let f=0,h=0,m=-1,y=0;for(;f<d.length;)if(h<u.length&&(u[h]===d[f]||u[h]==="*"))u[h]==="*"?(m=h,y=f,h++):(f++,h++);else if(m!==-1)h=m+1,y++,f=y;else return!1;for(;h<u.length&&u[h]==="*";)h++;return h===u.length}function i(){let d=[...t.names,...t.skips.map(u=>"-"+u)].join(",");return t.enable(""),d}function a(d){for(let u of t.skips)if(s(d,u))return!1;for(let u of t.names)if(s(d,u))return!0;return!1}function c(d){return d instanceof Error?d.stack||d.message:d}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}$F.exports=jie});var KF=vr((Vn,Lx)=>{Vn.formatArgs=Wie;Vn.save=Yie;Vn.load=Xie;Vn.useColors=Gie;Vn.storage=Zie();Vn.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Vn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Gie(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Wie(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Lx.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}Vn.log=console.debug||console.log||(()=>{});function Yie(r){try{r?Vn.storage.setItem("debug",r):Vn.storage.removeItem("debug")}catch{}}function Xie(){let r;try{r=Vn.storage.getItem("debug")||Vn.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Zie(){try{return localStorage}catch{}}Lx.exports=HF()(Vn);var{formatters:Qie}=Lx.exports;Qie.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});function kr(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var lh=_(()=>{});var yv,dh,_9=_(()=>{yv=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||(e-1&e)!==0)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}},dh=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new yv(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 yv(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()}}});function _s(r={}){return dle(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 dle(r,e){e=e??{};let t=e.onEnd,n=new dh,o,s,i,a=kr(),c=async()=>{try{return n.isEmpty()?i?{done:!0}:await new Promise((g,p)=>{s=w=>{s=null,n.push(w);try{g(r(n))}catch(b){p(b)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=kr()})}},l=g=>s!=null?s(g):(n.push(g),o),d=g=>(n=new dh,s!=null?s({error:g}):(n.push({error:g}),o)),u=g=>{if(i)return o;if(e?.objectMode!==!0&&g?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return l({done:!1,value:g})},f=g=>i?o:(i=!0,g!=null?d(g):l({done:!0})),h=()=>(n=new dh,f(),{done:!0}),m=g=>(f(g),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:c,return:h,throw:m,push:u,end:f,get readableLength(){return n.size},onEmpty:async g=>{let p=g?.signal;if(p?.throwIfAborted(),n.isEmpty())return;let w,b;p!=null&&(w=new Promise((x,T)=>{b=()=>{T(new P_)},p.addEventListener("abort",b)}));try{await Promise.race([a.promise,w])}finally{b!=null&&p!=null&&p?.removeEventListener("abort",b)}}},t==null)return o;let y=o;return o={[Symbol.asyncIterator](){return this},next(){return y.next()},throw(g){return y.throw(g),t!=null&&(t(g),t=void 0),{done:!0}},return(){return y.return(),t!=null&&(t(),t=void 0),{done:!0}},push:u,end(g){return y.end(g),t!=null&&(t(g),t=void 0),o},get readableLength(){return y.readableLength},onEmpty:g=>y.onEmpty(g)},o}var P_,Bd=_(()=>{lh();_9();P_=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}}});async function M9(r,e,t){if(e==null)return r;if(e.aborted)return r.catch(()=>{}),Promise.reject(new bv(t?.errorMessage,t?.errorCode,t?.errorName));let n,o=new bv(t?.errorMessage,t?.errorCode,t?.errorName);try{return await Promise.race([r,new Promise((s,i)=>{n=()=>{i(o)},e.addEventListener("abort",n)})])}finally{n!=null&&e.removeEventListener("abort",n)}}var bv,L9=_(()=>{bv=class extends Error{type;code;constructor(e,t,n){super(e??"The operation was aborted"),this.type="aborted",this.name=n??"AbortError",this.code=t??"ABORT_ERR"}}});function P9(){return new D_}var D_,D9=_(()=>{lh();L9();D_=class{readNext;haveNext;ended;nextResult;error;constructor(){this.ended=!1,this.readNext=kr(),this.haveNext=kr()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=kr(),e}async throw(e){return this.ended=!0,this.error=e,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return this.ended=!0,this.nextResult=e,this.haveNext.resolve(),e}async push(e,t){await this._push(e,t)}async end(e,t){e!=null?await this.throw(e):await this._push(void 0,t)}async _push(e,t){if(e!=null&&this.ended)throw this.error??new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=kr(),await M9(this.readNext.promise,t?.signal,t)}}});function ule(r){return r[Symbol.asyncIterator]!=null}async function fle(r,e,t){try{await Promise.all(r.map(async n=>{for await(let o of n)await e.push(o,{signal:t}),t.throwIfAborted()})),await e.end(void 0,{signal:t})}catch(n){await e.end(n,{signal:t}).catch(()=>{})}}async function*hle(r){let e=new AbortController,t=P9();fle(r,t,e.signal).catch(()=>{});try{yield*t}finally{e.abort()}}function*ple(r){for(let e of r)yield*e}function mle(...r){let e=[];for(let t of r)ule(t)||e.push(t);return e.length===r.length?ple(e):hle(r)}var Od,wv=_(()=>{D9();Od=mle});function qn(r,...e){if(r==null)throw new Error("Empty pipeline");if(B_(r)){let n=r;r=()=>n.source}else if(O9(r)||B9(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&B_(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++)B_(t[n])&&(t[n]=yle(t[n]));return gle(...t)}var gle,B9,O9,B_,yle,qc=_(()=>{Bd();wv();gle=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},B9=r=>r?.[Symbol.asyncIterator]!=null,O9=r=>r?.[Symbol.iterator]!=null,B_=r=>r==null?!1:r.sink!=null&&r.source!=null,yle=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=_s({objectMode:!0});t.then(()=>{n.end()},i=>{n.end(i)});let o,s=r.source;if(B9(s))o=async function*(){yield*s,n.end()};else if(O9(s))o=function*(){yield*s,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Od(n,o())}return r.source}});function ae(r=0){return new Uint8Array(r)}function Pe(r=0){return new Uint8Array(r)}var pt=_(()=>{});function cr(r){if(r<ble)return 1;if(r<wle)return 2;if(r<xle)return 3;if(r<O_)return 4;if(r<N_)return 5;if(r<F_)return 6;if(r<U_)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function uh(r,e,t=0){switch(cr(r)){case 8:e[t++]=r&255|ot,r/=128;case 7:e[t++]=r&255|ot,r/=128;case 6:e[t++]=r&255|ot,r/=128;case 5:e[t++]=r&255|ot,r/=128;case 4:e[t++]=r&255|ot,r>>>=7;case 3:e[t++]=r&255|ot,r>>>=7;case 2:e[t++]=r&255|ot,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function vle(r,e,t=0){switch(cr(r)){case 8:e.set(t++,r&255|ot),r/=128;case 7:e.set(t++,r&255|ot),r/=128;case 6:e.set(t++,r&255|ot),r/=128;case 5:e.set(t++,r&255|ot),r/=128;case 4:e.set(t++,r&255|ot),r>>>=7;case 3:e.set(t++,r&255|ot),r>>>=7;case 2:e.set(t++,r&255|ot),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function $_(r,e){let t=r[e],n=0;if(n+=t&dn,t<ot||(t=r[e+1],n+=(t&dn)<<7,t<ot)||(t=r[e+2],n+=(t&dn)<<14,t<ot)||(t=r[e+3],n+=(t&dn)<<21,t<ot)||(t=r[e+4],n+=(t&dn)*O_,t<ot)||(t=r[e+5],n+=(t&dn)*N_,t<ot)||(t=r[e+6],n+=(t&dn)*F_,t<ot)||(t=r[e+7],n+=(t&dn)*U_,t<ot))return n;throw new RangeError("Could not decode varint")}function Ele(r,e){let t=r.get(e),n=0;if(n+=t&dn,t<ot||(t=r.get(e+1),n+=(t&dn)<<7,t<ot)||(t=r.get(e+2),n+=(t&dn)<<14,t<ot)||(t=r.get(e+3),n+=(t&dn)<<21,t<ot)||(t=r.get(e+4),n+=(t&dn)*O_,t<ot)||(t=r.get(e+5),n+=(t&dn)*N_,t<ot)||(t=r.get(e+6),n+=(t&dn)*F_,t<ot)||(t=r.get(e+7),n+=(t&dn)*U_,t<ot))return n;throw new RangeError("Could not decode varint")}function jc(r,e,t=0){return e==null&&(e=Pe(cr(r))),e instanceof Uint8Array?uh(r,e,t):vle(r,e,t)}function ha(r,e=0){return r instanceof Uint8Array?$_(r,e):Ele(r,e)}var ble,wle,xle,O_,N_,F_,U_,ot,dn,pa=_(()=>{pt();ble=Math.pow(2,7),wle=Math.pow(2,14),xle=Math.pow(2,21),O_=Math.pow(2,28),N_=Math.pow(2,35),F_=Math.pow(2,42),U_=Math.pow(2,49),ot=128,dn=127});function Sle(r){return r?.buffer instanceof ArrayBuffer}function H_(r){if(Sle(r))return r;let e=r.slice();return new Uint8Array(e.buffer,0,e.byteLength)}var K_=_(()=>{});function Ot(r,e){e==null&&(e=r.reduce((o,s)=>o+s.length,0));let t=Pe(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return H_(t)}var Ms=_(()=>{pt();K_()});function Le(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 Rr=_(()=>{});function N9(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function xv(r){return!!r?.[F9]}var F9,Ne,Wo=_(()=>{pt();Ms();Rr();F9=Symbol.for("@achingbrain/uint8arraylist");Ne=class r{bufs;length;[F9]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(xv(n)){t+=n.byteLength;for(let o of n.bufs)this.bufs.push(o)}else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(xv(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=N9(this.bufs,e);return t.buf[t.index]}set(e,t){let n=N9(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(xv(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return Ot(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:Ot(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),s=new r;return s.length=o,s.bufs=n,s}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:[...this.bufs],length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],a=o,c=a+i.byteLength;if(o=c,e>=c)continue;let l=e>=a&&e<c,d=t>a&&t<=c;if(l&&d){if(e===a&&t===c){n.push(i);break}let u=e-a;n.push(i.subarray(u,u+(t-e)));break}if(l){if(e===0){n.push(i);continue}n.push(i.subarray(e-a));continue}if(d){if(t===c){n.push(i);break}n.push(i.subarray(0,t-a));break}n.push(i)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!xv(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let u=0;u<s;u++)i[u]=-1;for(let u=0;u<o;u++)i[n[u]]=u;let a=i,c=this.byteLength-n.byteLength,l=n.byteLength-1,d;for(let u=t;u<=c;u+=d){d=0;for(let f=l;f>=0;f--){let h=this.get(u+f);if(n[f]!==h){d=Math.max(1,f-a[h]);break}}if(d===0)return u}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=Pe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=ae(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=ae(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=ae(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=Pe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=ae(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=ae(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=ae(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=ae(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=ae(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Le(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,s)=>o+s.byteLength,0)),n.length=t,n}}});var z_=_(()=>{});var vv,hh,Ev,ay,V_=_(()=>{vv=class extends Error{name="InvalidMessageLengthError";code="ERR_INVALID_MSG_LENGTH"},hh=class extends Error{name="InvalidDataLengthError";code="ERR_MSG_DATA_TOO_LONG"},Ev=class extends Error{name="InvalidDataLengthLengthError";code="ERR_MSG_LENGTH_TOO_LONG"},ay=class extends Error{name="UnexpectedEOFError";code="ERR_UNEXPECTED_EOF"}});function Sv(r){return r[Symbol.asyncIterator]!=null}var q_=_(()=>{});function U9(r,e){if(r.byteLength>e)throw new hh("Message length too long")}function un(r,e){e=e??{};let t=e.lengthEncoder??Iv,n=e?.maxDataLength??4194304;function*o(s){U9(s,n);let i=t(s.byteLength);i instanceof Uint8Array?yield i:yield*i,s instanceof Uint8Array?yield s:yield*s}return Sv(r)?(async function*(){for await(let s of r)yield*o(s)})():(function*(){for(let s of r)yield*o(s)})()}var Iv,$9=_(()=>{pa();Wo();pt();z_();V_();q_();Iv=r=>{let e=cr(r),t=Pe(e);return jc(r,t),Iv.bytes=e,t};Iv.bytes=0;un.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??Iv,n=e?.maxDataLength??4194304;return U9(r,n),new Ne(t(r.byteLength),r)}});function kn(r,e){let t=new Ne,n=Nd.LENGTH,o=-1,s=e?.lengthDecoder??j_,i=e?.maxLengthLength??8,a=e?.maxDataLength??4194304;function*c(){for(;t.byteLength>0;){if(n===Nd.LENGTH)try{if(o=s(t),o<0)throw new vv("Invalid message length");if(o>a)throw new hh("Message length too long");let l=s.bytes;t.consume(l),e?.onLength!=null&&e.onLength(o),n=Nd.DATA}catch(l){if(l instanceof RangeError){if(t.byteLength>i)throw new Ev("Message length length too long");break}throw l}if(n===Nd.DATA){if(t.byteLength<o)break;let l=t.sublist(0,o);t.consume(o),e?.onData!=null&&e.onData(l),yield l,n=Nd.LENGTH}}}return Sv(r)?(async function*(){for await(let l of r)t.append(l),yield*c();if(t.byteLength>0)throw new ay("Unexpected end of input")})():(function*(){for(let l of r)t.append(l),yield*c();if(t.byteLength>0)throw new ay("Unexpected end of input")})()}var Nd,j_,H9=_(()=>{pa();Wo();z_();V_();q_();(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(Nd||(Nd={}));j_=r=>{let e=ha(r);return j_.bytes=cr(e),e};j_.bytes=0;kn.fromReader=(r,e)=>{let t=1,n=(async function*(){for(;;)try{let{done:s,value:i}=await r.next(t);if(s===!0)return;i!=null&&(yield i)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{t=1}})();return kn(n,{...e??{},onLength:s=>{t=s}})}});var ma=_(()=>{$9();H9()});function V9(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 Yo(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return Fd(r);if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return Fd(new Uint8Array(r.buffer,r.byteOffset,r.byteLength));throw new Error("Unknown type, must be binary type")}function q9(r){let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}function j9(r){let e=r.length;if(e<=z9)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.subarray(n,n+=z9));return t}function Ile(r){return r?.buffer instanceof ArrayBuffer}function Fd(r){return Ile(r)?r:r.slice()}var D8e,z9,Gc=_(()=>{D8e=new Uint8Array(0);z9=4096});function Ale(r,e,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),o=0;o<n.length;o++)n[o]=255;for(var s=0;s<r.length;s++){var i=r.charAt(s),a=i.charCodeAt(0);if(n[a]!==255)throw new TypeError(i+" is ambiguous");if(n[a]=s,t){var c=i.toLowerCase().charCodeAt(0),l=i.toUpperCase().charCodeAt(0);c!==a&&(n[c]=s),l!==a&&(n[l]=s)}}var d=r.length,u=r.charAt(0),f=Math.log(d)/Math.log(256),h=Math.log(256)/Math.log(d);function m(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var w=0,b=0,x=0,T=p.length;x!==T&&p[x]===0;)x++,w++;for(var k=(T-x)*h+1>>>0,M=new Uint8Array(k);x!==T;){for(var I=p[x],E=0,L=k-1;(I!==0||E<b)&&L!==-1;L--,E++)I+=256*M[L]>>>0,M[L]=I%d>>>0,I=I/d>>>0;if(I!==0)throw new Error("Non-zero carry");b=E,x++}for(var R=k-b;R!==k&&M[R]===0;)R++;for(var P=u.repeat(w);R<k;++R)P+=r.charAt(M[R]);return P}function y(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var w=0;if(p[w]!==" "){for(var b=0,x=0;p[w]===u;)b++,w++;for(var T=(p.length-w)*f+1>>>0,k=new Uint8Array(T);p[w];){var M=n[p.charCodeAt(w)];if(M===255)return;for(var I=0,E=T-1;(M!==0||I<x)&&E!==-1;E--,I++)M+=d*k[E]>>>0,k[E]=M%256>>>0,M=M/256>>>0;if(M!==0)throw new Error("Non-zero carry");x=I,w++}if(p[w]!==" "){for(var L=T-x;L!==T&&k[L]===0;)L++;for(var R=new Uint8Array(b+(T-L)),P=b;L!==T;)R[P++]=k[L++];return R}}}function g(p){var w=y(p);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:m,decodeUnsafe:y,decode:g}}var Tle,kle,W9,Y9=_(()=>{Tle=Ale,kle=Tle,W9=kle});function X9(r,e){return new Z_({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}function ph({name:r,prefix:e,encode:t,decode:n}){return new Q_(r,e,t,n)}function Wc({name:r,prefix:e,alphabet:t,caseInsensitive:n=!1}){let{encode:o,decode:s}=W9(t,r,n);return ph({prefix:e,name:r,encode:o,decode:i=>Yo(s(i))})}function Rle(r,e,t,n){let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),i=0,a=0,c=0;for(let l=0;l<o;++l){let d=e[r[l]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<t|d,i+=t,i>=8&&(i-=8,s[c++]=255&a>>i)}if(i>=t||(255&a<<8-i)!==0)throw new SyntaxError("Unexpected end of data");return s}function _le(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,s="",i=0,a=0;for(let c=0;c<r.length;++c)for(a=a<<8|r[c],i+=8;i>t;)i-=t,s+=e[o&a>>i];if(i!==0&&(s+=e[o&a<<t-i]),n)for(;(s.length*t&7)!==0;)s+="=";return s}function Mle(r,e){let t={};for(let n=0;n<r.length;++n)if(t[r[n]]=n,e){let o=r[n].toLowerCase(),s=r[n].toUpperCase();o!==r[n]&&(t[o]=n),s!==r[n]&&(t[s]=n)}return t}function Gt({name:r,prefix:e,bitsPerChar:t,alphabet:n,caseInsensitive:o=!1}){let s=Mle(n,o);return ph({prefix:e,name:r,encode(i){return _le(i,n,t)},decode(i){return Rle(i,s,t,r)}})}var Y_,X_,Z_,Q_,Ls=_(()=>{Gc();Y9();Y_=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")}},X_=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let o=t.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,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 X9(this,e)}},Z_=class{decoders;constructor(e){this.decoders=e}or(e){return X9(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`)}};Q_=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,o){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=o,this.encoder=new Y_(e,t,n),this.decoder=new X_(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}});var J_={};ue(J_,{base32:()=>jn,base32hex:()=>Ble,base32hexpad:()=>Nle,base32hexpadupper:()=>Fle,base32hexupper:()=>Ole,base32pad:()=>Ple,base32padupper:()=>Dle,base32upper:()=>Lle,base32z:()=>Ule});var jn,Lle,Ple,Dle,Ble,Ole,Nle,Fle,Ule,Ud=_(()=>{Ls();jn=Gt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5,caseInsensitive:!0}),Lle=Gt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5,caseInsensitive:!0}),Ple=Gt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5,caseInsensitive:!0}),Dle=Gt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5,caseInsensitive:!0}),Ble=Gt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5,caseInsensitive:!0}),Ole=Gt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5,caseInsensitive:!0}),Nle=Gt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5,caseInsensitive:!0}),Fle=Gt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5,caseInsensitive:!0}),Ule=Gt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var eM={};ue(eM,{base58btc:()=>st,base58flickr:()=>$le});var st,$le,bo=_(()=>{Ls();st=Wc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),$le=Wc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var rM={};ue(rM,{base64:()=>cy,base64pad:()=>Hle,base64url:()=>tM,base64urlpad:()=>Kle});var cy,Hle,tM,Kle,ly=_(()=>{Ls();cy=Gt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Hle=Gt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),tM=Gt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Kle=Gt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Q9=vr((K8e,Z9)=>{var mh=1e3,gh=mh*60,yh=gh*60,$d=yh*24,zle=$d*7,Vle=$d*365.25;Z9.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return qle(r);if(t==="number"&&isFinite(r))return e.long?Gle(r):jle(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function qle(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*Vle;case"weeks":case"week":case"w":return t*zle;case"days":case"day":case"d":return t*$d;case"hours":case"hour":case"hrs":case"hr":case"h":return t*yh;case"minutes":case"minute":case"mins":case"min":case"m":return t*gh;case"seconds":case"second":case"secs":case"sec":case"s":return t*mh;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function jle(r){var e=Math.abs(r);return e>=$d?Math.round(r/$d)+"d":e>=yh?Math.round(r/yh)+"h":e>=gh?Math.round(r/gh)+"m":e>=mh?Math.round(r/mh)+"s":r+"ms"}function Gle(r){var e=Math.abs(r);return e>=$d?Av(r,e,$d,"day"):e>=yh?Av(r,e,yh,"hour"):e>=gh?Av(r,e,gh,"minute"):e>=mh?Av(r,e,mh,"second"):r+" ms"}function Av(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var e7=vr((z8e,J9)=>{function Wle(r){t.debug=t,t.default=t,t.coerce=c,t.disable=i,t.enable=o,t.enabled=a,t.humanize=Q9(),t.destroy=l,Object.keys(r).forEach(d=>{t[d]=r[d]}),t.names=[],t.skips=[],t.formatters={};function e(d){let u=0;for(let f=0;f<d.length;f++)u=(u<<5)-u+d.charCodeAt(f),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(d){let u,f=null,h,m;function y(...g){if(!y.enabled)return;let p=y,w=Number(new Date),b=w-(u||w);p.diff=b,p.prev=u,p.curr=w,u=w,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");let x=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,(k,M)=>{if(k==="%%")return"%";x++;let I=t.formatters[M];if(typeof I=="function"){let E=g[x];k=I.call(p,E),g.splice(x,1),x--}return k}),t.formatArgs.call(p,g),(p.log||t.log).apply(p,g)}return y.namespace=d,y.useColors=t.useColors(),y.color=t.selectColor(d),y.extend=n,y.destroy=t.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(h!==t.namespaces&&(h=t.namespaces,m=t.enabled(d)),m),set:g=>{f=g}}),typeof t.init=="function"&&t.init(y),y}function n(d,u){let f=t(this.namespace+(typeof u>"u"?":":u)+d);return f.log=this.log,f}function o(d){t.save(d),t.namespaces=d,t.names=[],t.skips=[];let u=(typeof d=="string"?d:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let f of u)f[0]==="-"?t.skips.push(f.slice(1)):t.names.push(f)}function s(d,u){let f=0,h=0,m=-1,y=0;for(;f<d.length;)if(h<u.length&&(u[h]===d[f]||u[h]==="*"))u[h]==="*"?(m=h,y=f,h++):(f++,h++);else if(m!==-1)h=m+1,y++,f=y;else return!1;for(;h<u.length&&u[h]==="*";)h++;return h===u.length}function i(){let d=[...t.names,...t.skips.map(u=>"-"+u)].join(",");return t.enable(""),d}function a(d){for(let u of t.skips)if(s(d,u))return!1;for(let u of t.names)if(s(d,u))return!0;return!1}function c(d){return d instanceof Error?d.stack||d.message:d}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}J9.exports=Wle});var t7=vr((Gn,Tv)=>{Gn.formatArgs=Xle;Gn.save=Zle;Gn.load=Qle;Gn.useColors=Yle;Gn.storage=Jle();Gn.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Gn.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Yle(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Xle(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Tv.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}Gn.log=console.debug||console.log||(()=>{});function Zle(r){try{r?Gn.storage.setItem("debug",r):Gn.storage.removeItem("debug")}catch{}}function Qle(){let r;try{r=Gn.storage.getItem("debug")||Gn.storage.getItem("DEBUG")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Jle(){try{return localStorage}catch{}}Tv.exports=e7()(Gn);var{formatters:ede}=Tv.exports;ede.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var a7,c7=_(()=>{a7=Symbol.for("@libp2p/connection")});var l7=_(()=>{});var d7=_(()=>{});var u7=_(()=>{});var uM,f7=_(()=>{uM=Symbol.for("@libp2p/content-routing")});var Qo,Lv,Pv,re,Yc,dy,Hd,ya,Dv,Xc,Kd,zd,xh,Zc,Bv,Ov,Nv,lr,Fv,vh,ba,Eh,uy,Uv,Sh,wa,h7=_(()=>{Qo=class extends Error{static name="AbortError";constructor(e="The operation was aborted"){super(e),this.name="AbortError"}},Lv=class extends Error{static name="UnexpectedPeerError";constructor(e="Unexpected Peer"){super(e),this.name="UnexpectedPeerError"}},Pv=class extends Error{static name="InvalidCryptoExchangeError";constructor(e="Invalid crypto exchange"){super(e),this.name="InvalidCryptoExchangeError"}},re=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},Yc=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}},dy=class extends Error{static name="InvalidPrivateKeyError";constructor(e="Invalid private key"){super(e),this.name="InvalidPrivateKeyError"}},Hd=class extends Error{static name="ConnectionClosedError";constructor(e="The connection is closed"){super(e),this.name="ConnectionClosedError"}},ya=class extends Error{static name="MuxerClosedError";constructor(e="The muxer is closed"){super(e),this.name="MuxerClosedError"}},Dv=class extends Error{static name="StreamResetError";constructor(e="The stream has been reset"){super(e),this.name="StreamResetError"}},Xc=class extends Error{static name="StreamStateError";constructor(e="The stream is in an invalid state"){super(e),this.name="StreamStateError"}},Kd=class extends Error{static name="StreamBufferError";constructor(e="The stream buffer was full"){super(e),this.name="StreamBufferError"}},zd=class extends Error{static name="NotFoundError";constructor(e="Not found"){super(e),this.name="NotFoundError"}},xh=class extends Error{static name="InvalidPeerIdError";constructor(e="Invalid PeerID"){super(e),this.name="InvalidPeerIdError"}},Zc=class extends Error{static name="InvalidMultiaddrError";constructor(e="Invalid multiaddr"){super(e),this.name="InvalidMultiaddrError"}},Bv=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},Ov=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}},Nv=class extends Error{static name="UnsupportedProtocolError";constructor(e="Unsupported protocol error"){super(e),this.name="UnsupportedProtocolError"}},lr=class extends Error{static name="InvalidMessageError";constructor(e="Invalid message"){super(e),this.name="InvalidMessageError"}},Fv=class extends Error{static name="ProtocolError";constructor(e="Protocol error"){super(e),this.name="ProtocolError"}},vh=class extends Error{static name="TimeoutError";constructor(e="Timed out"){super(e),this.name="TimeoutError"}},ba=class extends Error{static name="NotStartedError";constructor(e="Not started"){super(e),this.name="NotStartedError"}},Eh=class extends Error{static name="DialError";constructor(e="Dial error"){super(e),this.name="DialError"}},uy=class extends Error{static name="LimitedConnectionError";constructor(e="Limited connection"){super(e),this.name="LimitedConnectionError"}},Uv=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(e="Too many inbound protocol streams"){super(e),this.name="TooManyInboundProtocolStreamsError"}},Sh=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(e="Too many outbound protocol streams"){super(e),this.name="TooManyOutboundProtocolStreamsError"}},wa=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}}});var $v,Qc,Hv,Kv,p7=_(()=>{$v=class extends Event{data;constructor(e,t){super("message",t),this.data=e}},Qc=class extends Event{error;local;constructor(e,t,n){super("close",n),this.error=t,this.local=e}},Hv=class extends Qc{constructor(e,t){super(!0,e,t)}},Kv=class extends Qc{constructor(e,t){super(!1,e,t)}}});var m7=_(()=>{});var g7=_(()=>{});var y7=_(()=>{});var b7=_(()=>{});var xa,w7=_(()=>{xa=Symbol.for("@libp2p/peer-discovery")});function Jc(r){return!!r?.[zv]}var zv,x7=_(()=>{zv=Symbol.for("@libp2p/peer-id")});var v7=_(()=>{});var fM,E7=_(()=>{fM=Symbol.for("@libp2p/peer-routing")});var fy,S7=_(()=>{fy="keep-alive"});var C7=_(()=>{});function Vv(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function I7(...r){let e=[];for(let t of r)Vv(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 A7(...r){let e=[];for(let t of r)Vv(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 T7=_(()=>{});var k7=_(()=>{});var R7=_(()=>{});var _7=_(()=>{});var M7=_(()=>{});var hy,L7=_(()=>{(function(r){r[r.FATAL_ALL=0]="FATAL_ALL",r[r.NO_FATAL=1]="NO_FATAL"})(hy||(hy={}))});var At,Ds=_(()=>{At=class extends EventTarget{#e=new Map;constructor(){super()}listenerCount(e){let t=this.#e.get(e);return t==null?0:t.length}addEventListener(e,t,n){super.addEventListener(e,t,n);let o=this.#e.get(e);o==null&&(o=[],this.#e.set(e,o)),o.push({callback:t,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(e,t,n){super.removeEventListener(e.toString(),t??null,n);let o=this.#e.get(e);o!=null&&(o=o.filter(({callback:s})=>s!==t),this.#e.set(e,o))}dispatchEvent(e){let t=super.dispatchEvent(e),n=this.#e.get(e.type);return n==null||(n=n.filter(({once:o})=>!o),this.#e.set(e.type,n)),t}safeDispatchEvent(e,t={}){return this.dispatchEvent(new CustomEvent(e,t))}}});var pr,Vd,ge=_(()=>{c7();l7();d7();u7();f7();h7();p7();m7();g7();y7();b7();w7();x7();v7();E7();S7();C7();T7();k7();R7();_7();M7();L7();Ds();pr=Symbol.for("@libp2p/service-capabilities"),Vd=Symbol.for("@libp2p/service-dependencies")});var hM={};ue(hM,{base36:()=>py,base36upper:()=>mde});var py,mde,pM=_(()=>{Ls();py=Wc({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz",caseInsensitive:!0}),mde=Wc({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",caseInsensitive:!0})});function B7(r,e,t){e=e||[],t=t||0;for(var n=t;r>=wde;)e[t++]=r&255|P7,r/=128;for(;r&bde;)e[t++]=r&255|P7,r>>>=7;return e[t]=r|0,B7.bytes=t-n+1,e}function mM(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw mM.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&D7)<<o:(i&D7)*Math.pow(2,o),o+=7}while(i>=vde);return mM.bytes=s-n,t}var gde,P7,yde,bde,wde,xde,vde,D7,Ede,Sde,Cde,Ide,Ade,Tde,kde,Rde,_de,Mde,Lde,Pde,my,O7=_(()=>{gde=B7,P7=128,yde=127,bde=~yde,wde=Math.pow(2,31);xde=mM,vde=128,D7=127;Ede=Math.pow(2,7),Sde=Math.pow(2,14),Cde=Math.pow(2,21),Ide=Math.pow(2,28),Ade=Math.pow(2,35),Tde=Math.pow(2,42),kde=Math.pow(2,49),Rde=Math.pow(2,56),_de=Math.pow(2,63),Mde=function(r){return r<Ede?1:r<Sde?2:r<Cde?3:r<Ide?4:r<Ade?5:r<Tde?6:r<kde?7:r<Rde?8:r<_de?9:10},Lde={encode:gde,decode:xde,encodingLength:Mde},Pde=Lde,my=Pde});function gy(r,e=0){let t=my.decode(r,e),n=my.decode.bytes;if(n>9)throw new RangeError("Invalid varint: too long");if(n>1&&r[e+n-1]===0)throw new RangeError("Invalid varint: not minimally encoded");return[t,n]}function Ch(r,e,t=0){return my.encode(r,e,t),e}function Ih(r){return my.encodingLength(r)}var jv=_(()=>{O7()});function bi(r,e){let t=e.byteLength,n=Ih(r),o=n+Ih(t),s=new Uint8Array(o+t);return Ch(r,s,0),Ch(t,s,n),s.set(e,o),new Ah(r,t,e,s)}function wo(r){let e=Yo(r),[t,n]=gy(e),[o,s]=gy(e.subarray(n)),i=e.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Ah(t,o,i,e)}function N7(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&V9(r.bytes,t.bytes)}}var Ah,Bs=_(()=>{Gc();jv();Ah=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=Fd(n),this.bytes=Fd(o)}}});var gM=_(()=>{});function F7(r,e){let{bytes:t,version:n}=r;return n===0?Bde(t,yM(r),e??st.encoder):Ode(t,yM(r),e??jn.encoder)}function yM(r){let e=U7.get(r);if(e==null){let t=new Map;return U7.set(r,t),t}return e}function Dde(r,e){switch(r[0]){case"Q":{let t=e??st;return[st.prefix,t.decode(`${st.prefix}${r}`)]}case st.prefix:{let t=e??st;return[st.prefix,t.decode(r)]}case jn.prefix:{let t=e??jn;return[jn.prefix,t.decode(r)]}case py.prefix:{let t=e??py;return[py.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 Bde(r,e,t){let{prefix:n}=t;if(n!==st.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return o}function Ode(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let s=t.encode(r);return e.set(n,s),s}else return o}function $7(r,e,t){let n=Ih(r),o=n+Ih(e),s=new Uint8Array(o+t.byteLength);return Ch(r,s,0),Ch(e,s,n),s.set(t,o),s}var U7,Wt,yy,Nde,Fde,xi=_(()=>{Ud();pM();bo();Gc();Bs();jv();gM();U7=new WeakMap;Wt=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=Fd(o),this["/"]=this.bytes}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!==yy)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Nde)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=bi(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&&N7(e.multihash,n.multihash)}toString(e){return F7(this,e)}toJSON(){return{"/":F7(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:s,bytes:i}=t;return new r(n,o,s,i??$7(n,o,s.bytes))}else if(t[Fde]===!0){let{version:n,multihash:o,code:s}=t,i=wo(o);return r.create(n,s,i)}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!==yy)throw new Error(`Version 0 CID must use dag-pb (code: ${yy}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=$7(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,yy,e)}static createV1(e,t){return r.create(1,e,t)}static decode(e){let[t,n]=r.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=r.inspectBytes(e),n=t.size-t.multihashSize,o=Yo(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=o.subarray(t.multihashSize-t.digestSize),i=new Ah(t.multihashCode,t.digestSize,s,o);return[t.version===0?r.createV0(i):r.createV1(t.codec,i),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[u,f]=gy(e.subarray(t));return t+=f,u},o=n(),s=yy;if(o===18?(o=0,t=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=t,a=n(),c=n(),l=t+c,d=l-i;return{version:o,codec:s,multihashCode:a,digestSize:c,multihashSize:d,size:l}}static parse(e,t){let[n,o]=Dde(e,t),s=r.decode(o);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yM(s).set(n,e),s}};yy=112,Nde=18;Fde=Symbol.for("@ipld/js-cid/CID")});var bM={};ue(bM,{identity:()=>Os});function $de(r,e){if(e?.truncate!=null&&e.truncate!==r.byteLength){if(e.truncate<0||e.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e.truncate)}return bi(H7,K7(r))}var H7,Ude,K7,Os,qd=_(()=>{Gc();Bs();H7=0,Ude="identity",K7=Yo;Os={code:H7,name:Ude,encode:K7,digest:$de}});function Hde(r){return r.buffer instanceof ArrayBuffer}function Wr(r){return Hde(r)?r:r.slice()}var Th=_(()=>{});async function j7(r="P-256"){let e=await crypto.subtle.generateKey({name:"ECDSA",namedCurve:r},!0,["sign","verify"]);return{publicKey:await crypto.subtle.exportKey("jwk",e.publicKey),privateKey:await crypto.subtle.exportKey("jwk",e.privateKey)}}async function G7(r,e,t){let n=await crypto.subtle.importKey("jwk",r,{name:"ECDSA",namedCurve:r.crv??"P-256"},!1,["sign"]);t?.signal?.throwIfAborted();let o=await crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,Wr(e.subarray()));return t?.signal?.throwIfAborted(),new Uint8Array(o,0,o.byteLength)}async function W7(r,e,t,n){let o=await crypto.subtle.importKey("jwk",r,{name:"ECDSA",namedCurve:r.crv??"P-256"},!1,["verify"]);n?.signal?.throwIfAborted();let s=await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},o,Wr(e),Wr(t.subarray()));return n?.signal?.throwIfAborted(),s}var z7,V7,q7,Gv=_(()=>{Th();z7="1.2.840.10045.3.1.7",V7="1.3.132.0.34",q7="1.3.132.0.35"});var wM={};ue(wM,{base10:()=>Kde});var Kde,Y7=_(()=>{Ls();Kde=Wc({prefix:"9",name:"base10",alphabet:"0123456789"})});var xM={};ue(xM,{base16:()=>zde,base16upper:()=>Vde});var zde,Vde,X7=_(()=>{Ls();zde=Gt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4,caseInsensitive:!0}),Vde=Gt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4,caseInsensitive:!0})});var vM={};ue(vM,{base2:()=>qde});var qde,Z7=_(()=>{Ls();qde=Gt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var EM={};ue(EM,{base256emoji:()=>Xde});function Wde(r){return r.reduce((e,t)=>(e+=jde[t],e),"")}function Yde(r){let e=[];for(let t of r){let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);let o=Gde[n];if(o==null)throw new Error(`Non-base256emoji character: ${t}`);e.push(o)}return new Uint8Array(e)}var Q7,jde,Gde,Xde,J7=_(()=>{Ls();Q7=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}"),jde=Q7.reduce((r,e,t)=>(r[t]=e,r),[]),Gde=Q7.reduce((r,e,t)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return r[n]=t,r},[]);Xde=ph({prefix:"\u{1F680}",name:"base256emoji",encode:Wde,decode:Yde})});var SM={};ue(SM,{base8:()=>Zde});var Zde,e$=_(()=>{Ls();Zde=Gt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var CM={};ue(CM,{identity:()=>Qde});var Qde,t$=_(()=>{Gc();Ls();Qde=ph({prefix:"\0",name:"identity",encode:r=>j9(Yo(r)),decode:r=>Yo(q9(r))})});var d5e,u5e,r$=_(()=>{d5e=new TextEncoder,u5e=new TextDecoder});var n$=_(()=>{Gc()});function AM({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new IM(r,e,t,n,o)}function o$(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return bi(e,r)}var tue,IM,TM=_(()=>{Bs();tue=20;IM=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??tue,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?o$(n,this.code,t?.truncate):n.then(o=>o$(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}}});var kM={};ue(kM,{sha256:()=>vi,sha512:()=>rue});function i$(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var vi,rue,kh=_(()=>{TM();vi=AM({name:"sha2-256",code:18,encode:i$("SHA-256")}),rue=AM({name:"sha2-512",code:19,encode:i$("SHA-512")})});var a$=_(()=>{});var c$=_(()=>{});var l$=_(()=>{});var d$=_(()=>{});var u$=_(()=>{a$();c$();l$();gM();d$()});var RM=_(()=>{Gc();xi();Bs();TM();jv();u$()});var by,S5e,_M=_(()=>{Y7();X7();Z7();J7();Ud();pM();bo();ly();e$();t$();r$();n$();qd();kh();RM();by={...CM,...vM,...SM,...wM,...xM,...J_,...hM,...eM,...rM,...EM},S5e={...kM,...bM}});function h$(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var f$,MM,nue,Wv,LM=_(()=>{_M();pt();f$=h$("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),MM=h$("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=Pe(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),nue={utf8:f$,"utf-8":f$,hex:by.base16,latin1:MM,ascii:MM,binary:MM,...by},Wv=nue});function q(r,e="utf8"){let t=Wv[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}var We=_(()=>{LM()});function ee(r,e="utf8"){let t=Wv[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var Nt=_(()=>{LM()});function Ns(r,e={offset:0}){let t=r[e.offset]&oue;if(e.offset++,p$[t]!=null)return p$[t](r,e);throw new Error("No decoder for tag "+t)}function xy(r,e){let t=0;if((r[e.offset]&PM)===PM){let n=r[e.offset]&sue,o="0x";e.offset++;for(let s=0;s<n;s++,e.offset++){if(e.offset>=r.byteLength)throw new Error("invalid DER element length");o+=r[e.offset].toString(16).padStart(2,"0")}t=parseInt(o,16)}else t=r[e.offset],e.offset++;if(!Number.isInteger(t)||t<0||t>r.byteLength-e.offset)throw new Error("invalid DER element length");return t}function wy(r,e){xy(r,e);let t=[];for(;!(e.offset>=r.byteLength);){let n=Ns(r,e);if(n===null)break;t.push(n)}return t}function iue(r,e){let t=xy(r,e),n=e.offset,o=e.offset+t,s=[];for(let i=n;i<o;i++)i===n&&r[i]===0||s.push(r[i]);return e.offset+=t,Uint8Array.from(s)}function aue(r,e){let t=xy(r,e),n=e.offset+t,o=r[e.offset];e.offset++;let s=0,i=0;o<40?(s=0,i=o):o<80?(s=1,i=o-40):(s=2,i=o-80);let a=`${s}.${i}`,c=[];for(;e.offset<n;){let l=r[e.offset];if(e.offset++,c.push(l&127),l<128){c.reverse();let d=0;for(let u=0;u<c.length;u++)d+=c[u]<<u*7;a+=`.${d}`,c=[]}}return a}function cue(r,e){return e.offset++,null}function lue(r,e){let t=xy(r,e),n=r[e.offset];e.offset++;let o=r.subarray(e.offset,e.offset+t-1);if(e.offset+=t,n!==0)throw new Error("Unused bits in bit string is unimplemented");return o}function due(r,e){let t=xy(r,e),n=r.subarray(e.offset,e.offset+t);return e.offset+=t,n}function uue(r){let e=r.toString(16);e.length%2===1&&(e="0"+e);let t=new Ne;for(let n=0;n<e.length;n+=2)t.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return t}function Yv(r){if(r.byteLength<128)return Uint8Array.from([r.byteLength]);let e=uue(r.byteLength);return new Ne(Uint8Array.from([e.byteLength|PM]),e)}function Rn(r){let e=new Ne,t=128;return(r.subarray()[0]&t)===t&&e.append(Uint8Array.from([0])),e.append(r),new Ne(Uint8Array.from([2]),Yv(e),e)}function vy(r){let e=Uint8Array.from([0]),t=new Ne(e,r);return new Ne(Uint8Array.from([3]),Yv(t),t)}function m$(r){return new Ne(Uint8Array.from([4]),Yv(r),r)}function Fs(r,e=48){let t=new Ne;for(let n of r)t.append(n);return new Ne(Uint8Array.from([e]),Yv(t),t)}var oue,PM,sue,p$,Xv=_(()=>{Wo();oue=parseInt("11111",2),PM=parseInt("10000000",2),sue=parseInt("01111111",2),p$={0:wy,1:wy,2:iue,3:lue,4:due,5:cue,6:aue,16:wy,22:wy,48:wy}});function NM(r){let e=Ns(r);return FM(e)}function FM(r){let e=r[1][1][0],t=1,n,o;if(e.byteLength===DM*2+1)return n=ee(e.subarray(t,t+DM),"base64url"),o=ee(e.subarray(t+DM),"base64url"),new jd({...mue,key_ops:["verify"],x:n,y:o});if(e.byteLength===BM*2+1)return n=ee(e.subarray(t,t+BM),"base64url"),o=ee(e.subarray(t+BM),"base64url"),new jd({...gue,key_ops:["verify"],x:n,y:o});if(e.byteLength===OM*2+1)return n=ee(e.subarray(t,t+OM),"base64url"),o=ee(e.subarray(t+OM),"base64url"),new jd({...yue,key_ops:["verify"],x:n,y:o});throw new re(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function g$(r){return Fs([Rn(Uint8Array.from([1])),m$(q(r.d??"","base64url")),Fs([b$(r.crv)],160),Fs([vy(new Ne(Uint8Array.from([4]),q(r.x??"","base64url"),q(r.y??"","base64url")))],161)]).subarray()}function y$(r){return Fs([Rn(Uint8Array.from([1])),Fs([b$(r.crv)],160),Fs([vy(new Ne(Uint8Array.from([4]),q(r.x??"","base64url"),q(r.y??"","base64url")))],161)]).subarray()}function b$(r){if(r==="P-256")return fue;if(r==="P-384")return hue;if(r==="P-521")return pue;throw new re(`Invalid curve ${r}`)}async function w$(r="P-256"){let e=await j7(r);return new Zv(e.privateKey)}var fue,hue,pue,mue,gue,yue,DM,BM,OM,UM=_(()=>{ge();Wo();We();Nt();Xv();x$();Gv();fue=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),hue=Uint8Array.from([6,5,43,129,4,0,34]),pue=Uint8Array.from([6,5,43,129,4,0,35]),mue={ext:!0,kty:"EC",crv:"P-256"},gue={ext:!0,kty:"EC",crv:"P-384"},yue={ext:!0,kty:"EC",crv:"P-521"},DM=32,BM=48,OM=66});var jd,Zv,x$=_(()=>{bo();xi();qd();Rr();dr();Gv();UM();jd=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=y$(this.jwk)),this._raw}toMultihash(){return Os.digest(_r(this))}toCID(){return Wt.createV1(114,this.toMultihash())}toString(){return st.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}async verify(e,t,n){return W7(this.jwk,t,e,n)}},Zv=class{type="ECDSA";jwk;publicKey;_raw;constructor(e){this.jwk=e,this.publicKey=new jd({crv:e.crv,ext:e.ext,key_ops:["verify"],kty:"EC",x:e.x,y:e.y})}get raw(){return this._raw==null&&(this._raw=g$(this.jwk)),this._raw}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}async sign(e,t){return G7(this.jwk,e,t)}}});function Gd(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Jo(r,e=""){if(!Number.isSafeInteger(r)||r<0){let t=e&&`"${e}" `;throw new Error(`${t}expected integer >= 0, got ${r}`)}}function Re(r,e,t=""){let n=Gd(r),o=r?.length,s=e!==void 0;if(!n||s&&o!==e){let i=t&&`"${t}" `,a=s?` of length ${e}`:"",c=n?`length=${o}`:`type=${typeof r}`;throw new Error(i+"expected Uint8Array"+a+", got "+c)}return r}function Wd(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash must wrapped by utils.createHasher");Jo(r.outputLen),Jo(r.blockLen)}function Rh(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 E$(r,e){Re(r,void 0,"digestInto() output");let t=e.outputLen;if(r.length<t)throw new Error('"digestInto() output" expected to be of length >='+t)}function Us(...r){for(let e=0;e<r.length;e++)r[e].fill(0)}function Qv(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function $s(r,e){return r<<32-e|r>>>e}function Ea(r){if(Re(r),S$)return r.toHex();let e="";for(let t=0;t<r.length;t++)e+=bue[r[t]];return e}function v$(r){if(r>=va._0&&r<=va._9)return r-va._0;if(r>=va.A&&r<=va.F)return r-(va.A-10);if(r>=va.a&&r<=va.f)return r-(va.a-10)}function Sa(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(S$)return Uint8Array.fromHex(r);let e=r.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let o=0,s=0;o<t;o++,s+=2){let i=v$(r.charCodeAt(s)),a=v$(r.charCodeAt(s+1));if(i===void 0||a===void 0){let c=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function Wn(...r){let e=0;for(let n=0;n<r.length;n++){let o=r[n];Re(o),e+=o.length}let t=new Uint8Array(e);for(let n=0,o=0;n<r.length;n++){let s=r[n];t.set(s,o),o+=s.length}return t}function $M(r,e={}){let t=(o,s)=>r(s).update(o).digest(),n=r(void 0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=o=>r(o),Object.assign(t,e),Object.freeze(t)}function el(r=32){let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");return e.getRandomValues(new Uint8Array(r))}var S$,bue,va,HM,tl=_(()=>{S$=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",bue=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));va={_0:48,_9:57,A:65,F:70,a:97,f:102};HM=r=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,r])})});function C$(r,e,t){return r&e^~r&t}function I$(r,e,t){return r&e^r&t^e&t}var Ey,Ca,Yr,A$=_(()=>{tl();Ey=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,o){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(e),this.view=Qv(this.buffer)}update(e){Rh(this),Re(e);let{view:t,buffer:n,blockLen:o}=this,s=e.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=Qv(e);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Rh(this),E$(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;t[i++]=128,Us(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(n,0),i=0);for(let u=i;u<o;u++)t[u]=0;n.setBigUint64(o-8,BigInt(this.length*8),s),this.process(n,0);let a=Qv(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,d[u],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=s,e.length=o,e.pos=a,o%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},Ca=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function wue(r,e=!1){return e?{h:Number(r&Jv),l:Number(r>>T$&Jv)}:{h:Number(r>>T$&Jv)|0,l:Number(r&Jv)|0}}function k$(r,e=!1){let t=r.length,n=new Uint32Array(t),o=new Uint32Array(t);for(let s=0;s<t;s++){let{h:i,l:a}=wue(r[s],e);[n[s],o[s]]=[i,a]}return[n,o]}function Ei(r,e,t,n){let o=(e>>>0)+(n>>>0);return{h:r+t+(o/2**32|0)|0,l:o|0}}var Jv,T$,KM,zM,Yd,Xd,Sy,Cy,R$,_$,M$,L$,P$,D$,B$=_(()=>{Jv=BigInt(4294967295),T$=BigInt(32);KM=(r,e,t)=>r>>>t,zM=(r,e,t)=>r<<32-t|e>>>t,Yd=(r,e,t)=>r>>>t|e<<32-t,Xd=(r,e,t)=>r<<32-t|e>>>t,Sy=(r,e,t)=>r<<64-t|e>>>t-32,Cy=(r,e,t)=>r>>>t-32|e<<64-t;R$=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),_$=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,M$=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),L$=(r,e,t,n,o)=>e+t+n+o+(r/2**32|0)|0,P$=(r,e,t,n,o)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(o>>>0),D$=(r,e,t,n,o,s)=>e+t+n+o+s+(r/2**32|0)|0});var vue,rl,VM,qM,O$,Eue,Sue,nl,ol,jM,GM,Si,N$,Iy=_(()=>{A$();B$();tl();vue=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),rl=new Uint32Array(64),VM=class extends Ey{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[e,t,n,o,s,i,a,c]}set(e,t,n,o,s,i,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)rl[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){let f=rl[u-15],h=rl[u-2],m=$s(f,7)^$s(f,18)^f>>>3,y=$s(h,17)^$s(h,19)^h>>>10;rl[u]=y+rl[u-7]+m+rl[u-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:l,H:d}=this;for(let u=0;u<64;u++){let f=$s(a,6)^$s(a,11)^$s(a,25),h=d+f+C$(a,c,l)+vue[u]+rl[u]|0,y=($s(n,2)^$s(n,13)^$s(n,22))+I$(n,o,s)|0;d=l,l=c,c=a,a=i+h|0,i=s,s=o,o=n,n=h+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(n,o,s,i,a,c,l,d)}roundClean(){Us(rl)}destroy(){this.set(0,0,0,0,0,0,0,0),Us(this.buffer)}},qM=class extends VM{A=Ca[0]|0;B=Ca[1]|0;C=Ca[2]|0;D=Ca[3]|0;E=Ca[4]|0;F=Ca[5]|0;G=Ca[6]|0;H=Ca[7]|0;constructor(){super(32)}},O$=k$(["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))),Eue=O$[0],Sue=O$[1],nl=new Uint32Array(80),ol=new Uint32Array(80),jM=class extends Ey{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:t,Bh:n,Bl:o,Ch:s,Cl:i,Dh:a,Dl:c,Eh:l,El:d,Fh:u,Fl:f,Gh:h,Gl:m,Hh:y,Hl:g}=this;return[e,t,n,o,s,i,a,c,l,d,u,f,h,m,y,g]}set(e,t,n,o,s,i,a,c,l,d,u,f,h,m,y,g){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=f|0,this.Gh=h|0,this.Gl=m|0,this.Hh=y|0,this.Hl=g|0}process(e,t){for(let b=0;b<16;b++,t+=4)nl[b]=e.getUint32(t),ol[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){let x=nl[b-15]|0,T=ol[b-15]|0,k=Yd(x,T,1)^Yd(x,T,8)^KM(x,T,7),M=Xd(x,T,1)^Xd(x,T,8)^zM(x,T,7),I=nl[b-2]|0,E=ol[b-2]|0,L=Yd(I,E,19)^Sy(I,E,61)^KM(I,E,6),R=Xd(I,E,19)^Cy(I,E,61)^zM(I,E,6),P=M$(M,R,ol[b-7],ol[b-16]),S=L$(P,k,L,nl[b-7],nl[b-16]);nl[b]=S|0,ol[b]=P|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:a,Cl:c,Dh:l,Dl:d,Eh:u,El:f,Fh:h,Fl:m,Gh:y,Gl:g,Hh:p,Hl:w}=this;for(let b=0;b<80;b++){let x=Yd(u,f,14)^Yd(u,f,18)^Sy(u,f,41),T=Xd(u,f,14)^Xd(u,f,18)^Cy(u,f,41),k=u&h^~u&y,M=f&m^~f&g,I=P$(w,T,M,Sue[b],ol[b]),E=D$(I,p,x,k,Eue[b],nl[b]),L=I|0,R=Yd(n,o,28)^Sy(n,o,34)^Sy(n,o,39),P=Xd(n,o,28)^Cy(n,o,34)^Cy(n,o,39),S=n&s^n&a^s&a,C=o&i^o&c^i&c;p=y|0,w=g|0,y=h|0,g=m|0,h=u|0,m=f|0,{h:u,l:f}=Ei(l|0,d|0,E|0,L|0),l=a|0,d=c|0,a=s|0,c=i|0,s=n|0,i=o|0;let v=R$(L,P,C);n=_$(v,E,R,S),o=v|0}({h:n,l:o}=Ei(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=Ei(this.Bh|0,this.Bl|0,s|0,i|0),{h:a,l:c}=Ei(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:d}=Ei(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:f}=Ei(this.Eh|0,this.El|0,u|0,f|0),{h,l:m}=Ei(this.Fh|0,this.Fl|0,h|0,m|0),{h:y,l:g}=Ei(this.Gh|0,this.Gl|0,y|0,g|0),{h:p,l:w}=Ei(this.Hh|0,this.Hl|0,p|0,w|0),this.set(n,o,s,i,a,c,l,d,u,f,h,m,y,g,p,w)}roundClean(){Us(nl,ol)}destroy(){Us(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},GM=class extends jM{Ah=Yr[0]|0;Al=Yr[1]|0;Bh=Yr[2]|0;Bl=Yr[3]|0;Ch=Yr[4]|0;Cl=Yr[5]|0;Dh=Yr[6]|0;Dl=Yr[7]|0;Eh=Yr[8]|0;El=Yr[9]|0;Fh=Yr[10]|0;Fl=Yr[11]|0;Gh=Yr[12]|0;Gl=Yr[13]|0;Hh=Yr[14]|0;Hl=Yr[15]|0;constructor(){super(64)}},Si=$M(()=>new qM,HM(1)),N$=$M(()=>new GM,HM(3))});function Ia(r,e=""){if(typeof r!="boolean"){let t=e&&`"${e}" `;throw new Error(t+"expected boolean, got type="+typeof r)}return r}function F$(r){if(typeof r=="bigint"){if(!eE(r))throw new Error("positive bigint expected, got "+r)}else Jo(r);return r}function Ay(r){let e=F$(r).toString(16);return e.length&1?"0"+e:e}function U$(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?YM:BigInt("0x"+r)}function _h(r){return U$(Ea(r))}function Ci(r){return U$(Ea(Zd(Re(r)).reverse()))}function tE(r,e){Jo(e),r=F$(r);let t=Sa(r.toString(16).padStart(e*2,"0"));if(t.length!==e)throw new Error("number too large");return t}function Ty(r,e){return tE(r,e).reverse()}function Zd(r){return Uint8Array.from(r)}function Cue(r,e,t){return eE(r)&&eE(e)&&eE(t)&&e<=r&&r<t}function sl(r,e,t,n){if(!Cue(e,t,n))throw new Error("expected valid "+r+": "+t+" <= n < "+n+", got "+e)}function XM(r){let e;for(e=0;r>YM;r>>=WM,e+=1);return e}function $$(r,e,t){if(Jo(r,"hashLen"),Jo(e,"qByteLen"),typeof t!="function")throw new Error("hmacFn must be a function");let n=g=>new Uint8Array(g),o=Uint8Array.of(),s=Uint8Array.of(0),i=Uint8Array.of(1),a=1e3,c=n(r),l=n(r),d=0,u=()=>{c.fill(1),l.fill(0),d=0},f=(...g)=>t(l,Wn(c,...g)),h=(g=o)=>{l=f(s,g),c=f(),g.length!==0&&(l=f(i,g),c=f())},m=()=>{if(d++>=a)throw new Error("drbg: tried max amount of iterations");let g=0,p=[];for(;g<e;){c=f();let w=c.slice();p.push(w),g+=c.length}return Wn(...p)};return(g,p)=>{u(),h(g);let w;for(;!(w=p(m()));)h();return u(),w}}function Ii(r,e={},t={}){if(!r||typeof r!="object")throw new Error("expected valid options object");function n(s,i,a){let c=r[s];if(a&&c===void 0)return;let l=typeof c;if(l!==i||c===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${l}`)}let o=(s,i)=>Object.entries(s).forEach(([a,c])=>n(a,c,i));o(e,!1),o(t,!0)}function Mh(r){let e=new WeakMap;return(t,...n)=>{let o=e.get(t);if(o!==void 0)return o;let s=r(t,...n);return e.set(t,s),s}}var YM,WM,eE,ky,Lh=_(()=>{tl();tl();YM=BigInt(0),WM=BigInt(1);eE=r=>typeof r=="bigint"&&YM<=r;ky=r=>(WM<<BigInt(r))-WM});function Mt(r,e){let t=r%e;return t>=_n?t:e+t}function Tt(r,e,t){let n=r;for(;e-- >_n;)n*=n,n%=t;return n}function H$(r,e){if(r===_n)throw new Error("invert: expected non-zero number");if(e<=_n)throw new Error("invert: expected positive modulus, got "+e);let t=Mt(r,e),n=e,o=_n,s=Mr,i=Mr,a=_n;for(;t!==_n;){let l=n/t,d=n%t,u=o-i*l,f=s-a*l;n=t,t=d,o=i,s=a,i=u,a=f}if(n!==Mr)throw new Error("invert: does not exist");return Mt(o,e)}function QM(r,e,t){if(!r.eql(r.sqr(e),t))throw new Error("Cannot find square root")}function W$(r,e){let t=(r.ORDER+Mr)/V$,n=r.pow(e,t);return QM(r,n,e),n}function Tue(r,e){let t=(r.ORDER-q$)/j$,n=r.mul(e,Qd),o=r.pow(n,t),s=r.mul(e,o),i=r.mul(r.mul(s,Qd),o),a=r.mul(s,r.sub(i,r.ONE));return QM(r,a,e),a}function kue(r){let e=Ph(r),t=Y$(r),n=t(e,e.neg(e.ONE)),o=t(e,n),s=t(e,e.neg(n)),i=(r+Iue)/G$;return(a,c)=>{let l=a.pow(c,i),d=a.mul(l,n),u=a.mul(l,o),f=a.mul(l,s),h=a.eql(a.sqr(d),c),m=a.eql(a.sqr(u),c);l=a.cmov(l,d,h),d=a.cmov(f,u,m);let y=a.eql(a.sqr(d),c),g=a.cmov(l,d,y);return QM(a,g,c),g}}function Y$(r){if(r<z$)throw new Error("sqrt is not defined for small field");let e=r-Mr,t=0;for(;e%Qd===_n;)e/=Qd,t++;let n=Qd,o=Ph(r);for(;K$(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return W$;let s=o.pow(n,e),i=(e+Mr)/Qd;return function(c,l){if(c.is0(l))return l;if(K$(c,l)!==1)throw new Error("Cannot find square root");let d=t,u=c.mul(c.ONE,s),f=c.pow(l,e),h=c.pow(l,i);for(;!c.eql(f,c.ONE);){if(c.is0(f))return c.ZERO;let m=1,y=c.sqr(f);for(;!c.eql(y,c.ONE);)if(m++,y=c.sqr(y),m===d)throw new Error("Cannot find square root");let g=Mr<<BigInt(d-m-1),p=c.pow(u,g);d=m,u=c.sqr(p),f=c.mul(f,u),h=c.mul(h,p)}return h}}function Rue(r){return r%V$===z$?W$:r%j$===q$?Tue:r%G$===Aue?kue(r):Y$(r)}function JM(r){let e={ORDER:"bigint",BYTES:"number",BITS:"number"},t=_ue.reduce((n,o)=>(n[o]="function",n),e);return Ii(r,t),r}function Mue(r,e,t){if(t<_n)throw new Error("invalid exponent, negatives unsupported");if(t===_n)return r.ONE;if(t===Mr)return e;let n=r.ONE,o=e;for(;t>_n;)t&Mr&&(n=r.mul(n,o)),o=r.sqr(o),t>>=Mr;return n}function Ry(r,e,t=!1){let n=new Array(e.length).fill(t?r.ZERO:void 0),o=e.reduce((i,a,c)=>r.is0(a)?i:(n[c]=i,r.mul(i,a)),r.ONE),s=r.inv(o);return e.reduceRight((i,a,c)=>r.is0(a)?i:(n[c]=r.mul(i,n[c]),r.mul(i,a)),s),n}function K$(r,e){let t=(r.ORDER-Mr)/Qd,n=r.pow(e,t),o=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),i=r.eql(n,r.neg(r.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function Lue(r,e){e!==void 0&&Jo(e);let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Ph(r,e={}){return new ZM(r,e)}function Z$(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 e6(r){let e=Z$(r);return e+Math.ceil(e/2)}function t6(r,e,t=!1){Re(r);let n=r.length,o=Z$(e),s=e6(e);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=t?Ci(r):_h(r),a=Mt(i,e-Mr)+Mr;return t?Ty(a,o):tE(a,o)}var _n,Mr,Qd,z$,V$,q$,Iue,j$,Aue,G$,X$,_ue,ZM,Dh=_(()=>{Lh();_n=BigInt(0),Mr=BigInt(1),Qd=BigInt(2),z$=BigInt(3),V$=BigInt(4),q$=BigInt(5),Iue=BigInt(7),j$=BigInt(8),Aue=BigInt(9),G$=BigInt(16);X$=(r,e)=>(Mt(r,e)&Mr)===Mr,_ue=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];ZM=class{ORDER;BITS;BYTES;isLE;ZERO=_n;ONE=Mr;_lengths;_sqrt;_mod;constructor(e,t={}){if(e<=_n)throw new Error("invalid field: expected ORDER > 0, got "+e);let n;this.isLE=!1,t!=null&&typeof t=="object"&&(typeof t.BITS=="number"&&(n=t.BITS),typeof t.sqrt=="function"&&(this.sqrt=t.sqrt),typeof t.isLE=="boolean"&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=t.allowedLengths?.slice()),typeof t.modFromBytes=="boolean"&&(this._mod=t.modFromBytes));let{nBitLength:o,nByteLength:s}=Lue(e,n);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=o,this.BYTES=s,this._sqrt=void 0,Object.preventExtensions(this)}create(e){return Mt(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof e);return _n<=e&&e<this.ORDER}is0(e){return e===_n}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&Mr)===Mr}neg(e){return Mt(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return Mt(e*e,this.ORDER)}add(e,t){return Mt(e+t,this.ORDER)}sub(e,t){return Mt(e-t,this.ORDER)}mul(e,t){return Mt(e*t,this.ORDER)}pow(e,t){return Mue(this,e,t)}div(e,t){return Mt(e*H$(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return H$(e,this.ORDER)}sqrt(e){return this._sqrt||(this._sqrt=Rue(this.ORDER)),this._sqrt(this,e)}toBytes(e){return this.isLE?Ty(e,this.BYTES):tE(e,this.BYTES)}fromBytes(e,t=!1){Re(e);let{_lengths:n,BYTES:o,isLE:s,ORDER:i,_mod:a}=this;if(n){if(!n.includes(e.length)||e.length>o)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let l=new Uint8Array(o);l.set(e,s?0:l.length-e.length),e=l}if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);let c=s?Ci(e):_h(e);if(a&&(c=Mt(c,i)),!t&&!this.isValid(c))throw new Error("invalid field element: outside of range 0..ORDER");return c}invertBatch(e){return Ry(this,e)}cmov(e,t,n){return n?t:e}}});function _y(r,e){let t=e.negate();return r?t:e}function eu(r,e){let t=Ry(r.Fp,e.map(n=>n.Z));return e.map((n,o)=>r.fromAffine(n.toAffine(t[o])))}function tH(r,e){if(!Number.isSafeInteger(r)||r<=0||r>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+r)}function r6(r,e){tH(r,e);let t=Math.ceil(e/r)+1,n=2**(r-1),o=2**r,s=ky(r),i=BigInt(r);return{windows:t,windowSize:n,mask:s,maxNumber:o,shiftBy:i}}function Q$(r,e,t){let{windowSize:n,mask:o,maxNumber:s,shiftBy:i}=t,a=Number(r&o),c=r>>i;a>n&&(a-=s,c+=Jd);let l=e*n,d=l+Math.abs(a)-1,u=a===0,f=a<0,h=e%2!==0;return{nextN:c,offset:d,isZero:u,isNeg:f,isNegF:h,offsetF:l}}function o6(r){return rH.get(r)||1}function J$(r){if(r!==Bh)throw new Error("invalid wNAF")}function nH(r,e,t,n){let o=e,s=r.ZERO,i=r.ZERO;for(;t>Bh||n>Bh;)t&Jd&&(s=s.add(o)),n&Jd&&(i=i.add(o)),o=o.double(),t>>=Jd,n>>=Jd;return{p1:s,p2:i}}function eH(r,e,t){if(e){if(e.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return JM(e),e}else return Ph(r,{isLE:t})}function rE(r,e,t={},n){if(n===void 0&&(n=r==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${r} CURVE object`);for(let c of["p","n","h"]){let l=e[c];if(!(typeof l=="bigint"&&l>Bh))throw new Error(`CURVE.${c} must be positive bigint`)}let o=eH(e.p,t.Fp,n),s=eH(e.n,t.Fn,n),a=["Gx","Gy","a",r==="weierstrass"?"b":"d"];for(let c of a)if(!o.isValid(e[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:o,Fn:s}}function Nh(r,e){return function(n){let o=r(n);return{secretKey:o,publicKey:e(o)}}}var Bh,Jd,n6,rH,Oh,nE=_(()=>{Lh();Dh();Bh=BigInt(0),Jd=BigInt(1);n6=new WeakMap,rH=new WeakMap;Oh=class{BASE;ZERO;Fn;bits;constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,n=this.ZERO){let o=e;for(;t>Bh;)t&Jd&&(n=n.add(o)),o=o.double(),t>>=Jd;return n}precomputeWindow(e,t){let{windows:n,windowSize:o}=r6(t,this.bits),s=[],i=e,a=i;for(let c=0;c<n;c++){a=i,s.push(a);for(let l=1;l<o;l++)a=a.add(i),s.push(a);i=a.double()}return s}wNAF(e,t,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let o=this.ZERO,s=this.BASE,i=r6(e,this.bits);for(let a=0;a<i.windows;a++){let{nextN:c,offset:l,isZero:d,isNeg:u,isNegF:f,offsetF:h}=Q$(n,a,i);n=c,d?s=s.add(_y(f,t[h])):o=o.add(_y(u,t[l]))}return J$(n),{p:o,f:s}}wNAFUnsafe(e,t,n,o=this.ZERO){let s=r6(e,this.bits);for(let i=0;i<s.windows&&n!==Bh;i++){let{nextN:a,offset:c,isZero:l,isNeg:d}=Q$(n,i,s);if(n=a,!l){let u=t[c];o=o.add(d?u.negate():u)}}return J$(n),o}getPrecomputes(e,t,n){let o=n6.get(t);return o||(o=this.precomputeWindow(t,e),e!==1&&(typeof n=="function"&&(o=n(o)),n6.set(t,o))),o}cached(e,t,n){let o=o6(e);return this.wNAF(o,this.getPrecomputes(o,e,n),t)}unsafe(e,t,n,o){let s=o6(e);return s===1?this._unsafeLadder(e,t,o):this.wNAFUnsafe(s,this.getPrecomputes(s,e,n),t,o)}createCache(e,t){tH(t,this.bits),rH.set(e,t),n6.delete(e)}hasCache(e){return o6(e)!==1}}});function Due(r,e,t,n){let o=r.sqr(t),s=r.sqr(n),i=r.add(r.mul(e.a,o),s),a=r.add(r.ONE,r.mul(e.d,r.mul(o,s)));return r.eql(i,a)}function oH(r,e={}){let t=rE("edwards",r,e,e.FpFnLE),{Fp:n,Fn:o}=t,s=t.CURVE,{h:i}=s;Ii(e,{},{uvRatio:"function"});let a=s6<<BigInt(o.BYTES*8)-Lr,c=g=>n.create(g),l=e.uvRatio||((g,p)=>{try{return{isValid:!0,value:n.sqrt(n.div(g,p))}}catch{return{isValid:!1,value:il}}});if(!Due(n,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function d(g,p,w=!1){let b=w?Lr:il;return sl("coordinate "+g,p,b,a),p}function u(g){if(!(g instanceof m))throw new Error("EdwardsPoint expected")}let f=Mh((g,p)=>{let{X:w,Y:b,Z:x}=g,T=g.is0();p==null&&(p=T?Pue:n.inv(x));let k=c(w*p),M=c(b*p),I=n.mul(x,p);if(T)return{x:il,y:Lr};if(I!==Lr)throw new Error("invZ was invalid");return{x:k,y:M}}),h=Mh(g=>{let{a:p,d:w}=s;if(g.is0())throw new Error("bad point: ZERO");let{X:b,Y:x,Z:T,T:k}=g,M=c(b*b),I=c(x*x),E=c(T*T),L=c(E*E),R=c(M*p),P=c(E*c(R+I)),S=c(L+c(w*c(M*I)));if(P!==S)throw new Error("bad point: equation left != right (1)");let C=c(b*x),v=c(T*k);if(C!==v)throw new Error("bad point: equation left != right (2)");return!0});class m{static BASE=new m(s.Gx,s.Gy,Lr,c(s.Gx*s.Gy));static ZERO=new m(il,Lr,Lr,il);static Fp=n;static Fn=o;X;Y;Z;T;constructor(p,w,b,x){this.X=d("x",p),this.Y=d("y",w),this.Z=d("z",b,!0),this.T=d("t",x),Object.freeze(this)}static CURVE(){return s}static fromAffine(p){if(p instanceof m)throw new Error("extended point not allowed");let{x:w,y:b}=p||{};return d("x",w),d("y",b),new m(w,b,Lr,c(w*b))}static fromBytes(p,w=!1){let b=n.BYTES,{a:x,d:T}=s;p=Zd(Re(p,b,"point")),Ia(w,"zip215");let k=Zd(p),M=p[b-1];k[b-1]=M&-129;let I=Ci(k),E=w?a:n.ORDER;sl("point.y",I,il,E);let L=c(I*I),R=c(L-Lr),P=c(T*L-x),{isValid:S,value:C}=l(R,P);if(!S)throw new Error("bad point: invalid y coordinate");let v=(C&Lr)===Lr,A=(M&128)!==0;if(!w&&C===il&&A)throw new Error("bad point: x=0 and x_0=1");return A!==v&&(C=c(-C)),m.fromAffine({x:C,y:I})}static fromHex(p,w=!1){return m.fromBytes(Sa(p),w)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(p=8,w=!0){return y.createCache(this,p),w||this.multiply(s6),this}assertValidity(){h(this)}equals(p){u(p);let{X:w,Y:b,Z:x}=this,{X:T,Y:k,Z:M}=p,I=c(w*M),E=c(T*x),L=c(b*M),R=c(k*x);return I===E&&L===R}is0(){return this.equals(m.ZERO)}negate(){return new m(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:p}=s,{X:w,Y:b,Z:x}=this,T=c(w*w),k=c(b*b),M=c(s6*c(x*x)),I=c(p*T),E=w+b,L=c(c(E*E)-T-k),R=I+k,P=R-M,S=I-k,C=c(L*P),v=c(R*S),A=c(L*S),B=c(P*R);return new m(C,v,B,A)}add(p){u(p);let{a:w,d:b}=s,{X:x,Y:T,Z:k,T:M}=this,{X:I,Y:E,Z:L,T:R}=p,P=c(x*I),S=c(T*E),C=c(M*b*R),v=c(k*L),A=c((x+T)*(I+E)-P-S),B=v-C,N=v+C,D=c(S-w*P),F=c(A*B),U=c(N*D),H=c(A*D),X=c(B*N);return new m(F,U,X,H)}subtract(p){return this.add(p.negate())}multiply(p){if(!o.isValidNot0(p))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:w,f:b}=y.cached(this,p,x=>eu(m,x));return eu(m,[w,b])[0]}multiplyUnsafe(p,w=m.ZERO){if(!o.isValid(p))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return p===il?m.ZERO:this.is0()||p===Lr?this:y.unsafe(this,p,b=>eu(m,b),w)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}isTorsionFree(){return y.unsafe(this,s.n).is0()}toAffine(p){return f(this,p)}clearCofactor(){return i===Lr?this:this.multiplyUnsafe(i)}toBytes(){let{x:p,y:w}=this.toAffine(),b=n.toBytes(w);return b[b.length-1]|=p&Lr?128:0,b}toHex(){return Ea(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let y=new Oh(m,o.BITS);return m.BASE.precompute(8),m}function sH(r,e,t={}){if(typeof e!="function")throw new Error('"hash" function param is required');Ii(t,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=t,{BASE:o,Fp:s,Fn:i}=r,a=t.randomBytes||el,c=t.adjustScalarBytes||(I=>I),l=t.domain||((I,E,L)=>{if(Ia(L,"phflag"),E.length||L)throw new Error("Contexts/pre-hash are not supported");return I});function d(I){return i.create(Ci(I))}function u(I){let E=b.secretKey;Re(I,b.secretKey,"secretKey");let L=Re(e(I),2*E,"hashedSecretKey"),R=c(L.slice(0,E)),P=L.slice(E,2*E),S=d(R);return{head:R,prefix:P,scalar:S}}function f(I){let{head:E,prefix:L,scalar:R}=u(I),P=o.multiply(R),S=P.toBytes();return{head:E,prefix:L,scalar:R,point:P,pointBytes:S}}function h(I){return f(I).pointBytes}function m(I=Uint8Array.of(),...E){let L=Wn(...E);return d(e(l(L,Re(I,void 0,"context"),!!n)))}function y(I,E,L={}){I=Re(I,void 0,"message"),n&&(I=n(I));let{prefix:R,scalar:P,pointBytes:S}=f(E),C=m(L.context,R,I),v=o.multiply(C).toBytes(),A=m(L.context,v,S,I),B=i.create(C+A*P);if(!i.isValid(B))throw new Error("sign failed: invalid s");let N=Wn(v,i.toBytes(B));return Re(N,b.signature,"result")}let g={zip215:!0};function p(I,E,L,R=g){let{context:P,zip215:S}=R,C=b.signature;I=Re(I,C,"signature"),E=Re(E,void 0,"message"),L=Re(L,b.publicKey,"publicKey"),S!==void 0&&Ia(S,"zip215"),n&&(E=n(E));let v=C/2,A=I.subarray(0,v),B=Ci(I.subarray(v,C)),N,D,F;try{N=r.fromBytes(L,S),D=r.fromBytes(A,S),F=o.multiplyUnsafe(B)}catch{return!1}if(!S&&N.isSmallOrder())return!1;let U=m(P,D.toBytes(),N.toBytes(),E);return D.add(N.multiplyUnsafe(U)).subtract(F).clearCofactor().is0()}let w=s.BYTES,b={secretKey:w,publicKey:w,signature:2*w,seed:w};function x(I=a(b.seed)){return Re(I,b.seed,"seed")}function T(I){return Gd(I)&&I.length===i.BYTES}function k(I,E){try{return!!r.fromBytes(I,E)}catch{return!1}}let M={getExtendedPublicKey:f,randomSecretKey:x,isValidSecretKey:T,isValidPublicKey:k,toMontgomery(I){let{y:E}=r.fromBytes(I),L=b.publicKey,R=L===32;if(!R&&L!==57)throw new Error("only defined for 25519 and 448");let P=R?s.div(Lr+E,Lr-E):s.div(E-Lr,E+Lr);return s.toBytes(P)},toMontgomerySecret(I){let E=b.secretKey;Re(I,E);let L=e(I.subarray(0,E));return c(L).subarray(0,E)}};return Object.freeze({keygen:Nh(x,h),getPublicKey:h,sign:y,verify:p,utils:M,Point:r,lengths:b})}var il,Lr,s6,Pue,iH=_(()=>{Lh();nE();il=BigInt(0),Lr=BigInt(1),s6=BigInt(2),Pue=BigInt(8)});function Bue(r){return Ii(r,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...r})}function aH(r){let e=Bue(r),{P:t,type:n,adjustScalarBytes:o,powPminus2:s,randomBytes:i}=e,a=n==="x25519";if(!a&&n!=="x448")throw new Error("invalid type");let c=i||el,l=a?255:448,d=a?32:56,u=BigInt(a?9:5),f=BigInt(a?121665:39081),h=a?oE**BigInt(254):oE**BigInt(447),m=a?BigInt(8)*oE**BigInt(251)-Fh:BigInt(4)*oE**BigInt(445)-Fh,y=h+m+Fh,g=C=>Mt(C,t),p=w(u);function w(C){return Ty(g(C),d)}function b(C){let v=Zd(Re(C,d,"uCoordinate"));return a&&(v[31]&=127),g(Ci(v))}function x(C){return Ci(o(Zd(Re(C,d,"scalar"))))}function T(C,v){let A=L(b(v),x(C));if(A===My)throw new Error("invalid private or public key received");return w(A)}function k(C){return T(C,p)}let M=k,I=T;function E(C,v,A){let B=g(C*(v-A));return v=g(v-B),A=g(A+B),{x_2:v,x_3:A}}function L(C,v){sl("u",C,My,t),sl("scalar",v,h,y);let A=v,B=C,N=Fh,D=My,F=C,U=Fh,H=My;for(let Z=BigInt(l-1);Z>=My;Z--){let O=A>>Z&Fh;H^=O,{x_2:N,x_3:F}=E(H,N,F),{x_2:D,x_3:U}=E(H,D,U),H=O;let z=N+D,j=g(z*z),fe=N-D,W=g(fe*fe),ie=j-W,$e=F+U,Qt=F-U,sr=g(Qt*z),de=g($e*fe),Ie=sr+de,He=sr-de;F=g(Ie*Ie),U=g(B*g(He*He)),N=g(j*W),D=g(ie*(j+g(f*ie)))}({x_2:N,x_3:F}=E(H,N,F)),{x_2:D,x_3:U}=E(H,D,U);let X=s(D);return g(N*X)}let R={secretKey:d,publicKey:d,seed:d},P=(C=c(d))=>(Re(C,R.seed,"seed"),C),S={randomSecretKey:P};return Object.freeze({keygen:Nh(P,M),getSharedSecret:I,getPublicKey:M,scalarMult:T,scalarMultBase:k,utils:S,GuBytes:p.slice(),lengths:R})}var My,Fh,oE,cH=_(()=>{Lh();nE();Dh();My=BigInt(0),Fh=BigInt(1),oE=BigInt(2)});function uH(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),o=BigInt(80),s=sE,a=r*r%s*r%s,c=Tt(a,lH,s)*a%s,l=Tt(c,Oue,s)*r%s,d=Tt(l,Fue,s)*l%s,u=Tt(d,e,s)*d%s,f=Tt(u,t,s)*u%s,h=Tt(f,n,s)*f%s,m=Tt(h,o,s)*h%s,y=Tt(m,o,s)*h%s,g=Tt(y,e,s)*d%s;return{pow_p_5_8:Tt(g,lH,s)*r%s,b2:a}}function fH(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Hue(r,e){let t=sE,n=Mt(e*e*e,t),o=Mt(n*n*e,t),s=uH(r*o).pow_p_5_8,i=Mt(r*n*s,t),a=Mt(e*i*i,t),c=i,l=Mt(i*dH,t),d=a===r,u=a===Mt(-r,t),f=a===Mt(-r*dH,t);return d&&(i=c),(u||f)&&(i=l),X$(i,t)&&(i=Mt(-i,t)),{isValid:d||u,value:i}}function zue(r){return sH(Kue,N$,Object.assign({adjustScalarBytes:fH},r))}var Oue,lH,Nue,Fue,Uue,sE,$ue,dH,Kue,Aa,Ly,iE=_(()=>{Iy();iH();Dh();cH();Oue=BigInt(1),lH=BigInt(2),Nue=BigInt(3),Fue=BigInt(5),Uue=BigInt(8),sE=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),$ue={p:sE,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Uue,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};dH=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");Kue=oH($ue,{uvRatio:Hue});Aa=zue({}),Ly=(()=>{let r=sE;return aH({P:r,type:"x25519",powPminus2:e=>{let{pow_p_5_8:t,b2:n}=uH(e);return Mt(Tt(t,Nue,r)*n,r)},adjustScalarBytes:fH})})()});var Py,Dy,aE,i6=_(()=>{Py=class extends Error{constructor(e="An error occurred while signing a message"){super(e),this.name="SigningError"}},Dy=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},aE=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}}});var Yn,a6=_(()=>{i6();Yn={get(r=globalThis){let e=r.crypto;if(e?.subtle==null)throw new aE("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api");return e}}});function pH(){let r=Aa.utils.randomSecretKey(),e=Aa.getPublicKey(r);return{privateKey:bH(r,e),publicKey:e}}function mH(r){if(r.length!==cE)throw new TypeError('"seed" must be 32 bytes in length.');if(!(r instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let e=r,t=Aa.getPublicKey(e);return{privateKey:bH(e,t),publicKey:t}}async function Vue(r,e){let t;r.length===Hh?t=r.subarray(0,32):t=r;let n={crv:"Ed25519",kty:"OKP",x:ee(r.subarray(32),"base64url"),d:ee(t,"base64url"),ext:!0,key_ops:["sign"]},o=await Yn.get().subtle.importKey("jwk",n,{name:"Ed25519"},!0,["sign"]),s=await Yn.get().subtle.sign({name:"Ed25519"},o,Wr(e instanceof Uint8Array?e:e.subarray()));return new Uint8Array(s,0,s.byteLength)}function que(r,e){let t=r.subarray(0,cE);return Aa.sign(e instanceof Uint8Array?e:e.subarray(),t)}async function gH(r,e){return Uh==null&&(Uh=await hH),Uh?Vue(r,e):que(r,e)}async function jue(r,e,t){if(r.buffer instanceof ArrayBuffer){let n=await Yn.get().subtle.importKey("raw",r.buffer,{name:"Ed25519"},!1,["verify"]);return await Yn.get().subtle.verify({name:"Ed25519"},n,Wr(e),Wr(t instanceof Uint8Array?t:t.subarray()))}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function Gue(r,e,t){return Aa.verify(e,t instanceof Uint8Array?t:t.subarray(),r)}async function yH(r,e,t){return Uh==null&&(Uh=await hH),Uh?jue(r,e,t):Gue(r,e,t)}function bH(r,e){let t=new Uint8Array(Hh);for(let n=0;n<cE;n++)t[n]=r[n],t[cE+n]=e[n];return t}var $h,Hh,cE,Uh,hH,lE=_(()=>{iE();Nt();Th();a6();$h=32,Hh=64,cE=32,hH=(async()=>{try{return await Yn.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})()});function Kh(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}var c6=_(()=>{Ms();We()});var By,Oy,xH=_(()=>{bo();xi();qd();Rr();c6();dr();lE();l6();By=class{type="Ed25519";raw;constructor(e){this.raw=dE(e,$h)}toMultihash(){return Os.digest(_r(this))}toCID(){return Wt.createV1(114,this.toMultihash())}toString(){return st.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}verify(e,t,n){n?.signal?.throwIfAborted();let o=yH(this.raw,t,e);return Kh(o)?o.then(s=>(n?.signal?.throwIfAborted(),s)):o}},Oy=class{type="Ed25519";raw;publicKey;constructor(e,t){this.raw=dE(e,Hh),this.publicKey=new By(t)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}sign(e,t){t?.signal?.throwIfAborted();let n=gH(this.raw,e);return Kh(n)?n.then(o=>(t?.signal?.throwIfAborted(),o)):(t?.signal?.throwIfAborted(),n)}}});function uE(r){return r=dE(r,$h),new By(r)}async function vH(){let{privateKey:r,publicKey:e}=pH();return new Oy(r,e)}async function EH(r){let{privateKey:e,publicKey:t}=mH(r);return new Oy(e,t)}function dE(r,e){if(r=Uint8Array.from(r??[]),r.length!==e)throw new re(`Key must be a Uint8Array of length ${e}, got ${r.length}`);return r}var l6=_(()=>{ge();xH();lE()});function SH(r,e,t){d6[0]=r,e[t]=al[0],e[t+1]=al[1],e[t+2]=al[2],e[t+3]=al[3]}function CH(r,e){return al[0]=r[e],al[1]=r[e+1],al[2]=r[e+2],al[3]=r[e+3],d6[0]}function IH(r,e,t){u6[0]=r,e[t]=fn[0],e[t+1]=fn[1],e[t+2]=fn[2],e[t+3]=fn[3],e[t+4]=fn[4],e[t+5]=fn[5],e[t+6]=fn[6],e[t+7]=fn[7]}function AH(r,e){return fn[0]=r[e],fn[1]=r[e+1],fn[2]=r[e+2],fn[3]=r[e+3],fn[4]=r[e+4],fn[5]=r[e+5],fn[6]=r[e+6],fn[7]=r[e+7],u6[0]}var d6,al,u6,fn,f6=_(()=>{d6=new Float32Array([-0]),al=new Uint8Array(d6.buffer);u6=new Float64Array([-0]),fn=new Uint8Array(u6.buffer)});var Wue,Yue,xo,tu,TH,h6=_(()=>{Wue=BigInt(Number.MAX_SAFE_INTEGER),Yue=BigInt(Number.MIN_SAFE_INTEGER),xo=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 tu;if(e<Wue&&e>Yue)return this.fromNumber(Number(e));let t=e<0n;t&&(e=-e);let n=e>>32n,o=e-(n<<32n);return t&&(n=~n|0n,o=~o|0n,++o>TH&&(o=0n,++n>TH&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(e){if(e===0)return tu;let t=e<0;t&&(e=-e);let n=e>>>0,o=(e-n)/4294967296>>>0;return t&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}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):tu}},tu=new xo(0,0);tu.toBigInt=function(){return 0n};tu.zzEncode=tu.zzDecode=function(){return this};tu.length=function(){return 1};TH=4294967296n});function kH(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 RH(r,e,t){if(t-e<1)return"";let o,s=[],i=0,a;for(;e<t;)a=r[e++],a<128?s[i++]=a:a>191&&a<224?s[i++]=(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[i++]=55296+(a>>10),s[i++]=56320+(a&1023)):s[i++]=(a&15)<<12|(r[e++]&63)<<6|r[e++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function p6(r,e,t){let n=t,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,e[t++]=o>>18|240,e[t++]=o>>12&63|128,e[t++]=o>>6&63|128,e[t++]=o&63|128):(e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128);return t-n}var m6=_(()=>{});function Hs(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function fE(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}function Ny(r){return new g6(r instanceof Uint8Array?r:r.subarray())}var g6,hE=_(()=>{pa();Th();f6();h6();m6();g6=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=Wr(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,Hs(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 Hs(this,4);return fE(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Hs(this,4);return fE(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Hs(this,4);let e=CH(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Hs(this,4);let e=AH(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 Hs(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return RH(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Hs(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Hs(this);while((this.buf[this.pos++]&128)!==0);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 xo(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 Hs(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 Hs(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 Hs(this,8);let e=fE(this.buf,this.pos+=4),t=fE(this.buf,this.pos+=4);return new xo(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=$_(this.buf,this.pos);return this.pos+=cr(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 Ye(r,e,t){let n=Ny(r);return e.decode(n,void 0,t)}var MH=_(()=>{hE()});function y6(r){let e=r??8192,t=e>>>1,n,o=e;return function(i){if(i<1||i>t)return Pe(i);o+i>e&&(n=Pe(e),o=0);let a=n.subarray(o,o+=i);return(o&7)!==0&&(o=(o|7)+1),a}}var LH=_(()=>{pt()});function b6(){}function Zue(r){return globalThis.Buffer!=null?Pe(r):Xue(r)}function w6(r,e,t){e[t]=r&255}function Que(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function pE(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 Fy(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 Jue(r,e,t){e.set(r,t)}function efe(r,e,t){e.set(r,t)}function tfe(r,e,t){r.length<40?p6(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(q(r),t)}function E6(){return new Uy}var ru,x6,Xue,Uy,v6,S6=_(()=>{pa();pt();We();f6();h6();LH();m6();ru=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};x6=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Xue=y6();Uy=class{len;head;tail;states;constructor(){this.len=0,this.head=new ru(b6,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new ru(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new v6((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(pE,10,xo.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=xo.fromBigInt(e);return this._push(pE,t.length(),t)}uint64Number(e){return this._push(uh,cr(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=xo.fromBigInt(e).zzEncode();return this._push(pE,t.length(),t)}sint64Number(e){let t=xo.fromNumber(e).zzEncode();return this._push(pE,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(w6,1,e?1:0)}fixed32(e){return this._push(Fy,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=xo.fromBigInt(e);return this._push(Fy,4,t.lo)._push(Fy,4,t.hi)}fixed64Number(e){let t=xo.fromNumber(e);return this._push(Fy,4,t.lo)._push(Fy,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(SH,4,e)}double(e){return this._push(IH,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(w6,1,0):this.uint32(t)._push(Jue,t,e)}string(e){let t=kH(e);return t!==0?this.uint32(t)._push(p6,t,e):this._push(w6,1,0)}fork(){return this.states=new x6(this),this.head=this.tail=new ru(b6,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 ru(b6,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=Zue(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};v6=class extends ru{next;constructor(e,t){super(Que,e,t),this.next=void 0}};globalThis.Buffer!=null&&(Uy.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(efe,e,r),this},Uy.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(tfe,e,r),this})});function Xe(r,e){let t=E6();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var PH=_(()=>{S6()});function*Ze(r,e,t){let n=Ny(r);yield*e.stream(n,void 0,".",t)}var DH=_(()=>{hE()});function gE(r,e,t,n,o){return{name:r,type:e,encode:t,decode:n,stream:o}}var mE,C6=_(()=>{mE={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5}});function es(r){function e(s){if(r[s.toString()]==null)throw new Error("Invalid enum value");return r[s]}let t=function(i,a){let c=e(i);a.int32(c)},n=function(i){let a=i.int32();return e(a)},o=function*(i,a){};return gE("enum",mE.VARINT,t,n,o)}var BH=_(()=>{C6()});function Qe(r,e,t){return gE("message",mE.LENGTH_DELIMITED,r,e,t)}var OH=_(()=>{C6()});var mt,$y,Ta=_(()=>{MH();PH();DH();BH();OH();hE();S6();mt=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"},$y=class extends Error{code="ERR_MAX_SIZE";name="MaxSizeError"}});var Ft,I6,Ai,A6,T6=_(()=>{Ta();(function(r){r.RSA="RSA",r.Ed25519="Ed25519",r.secp256k1="secp256k1",r.ECDSA="ECDSA"})(Ft||(Ft={}));(function(r){r[r.RSA=0]="RSA",r[r.Ed25519=1]="Ed25519",r[r.secp256k1=2]="secp256k1",r[r.ECDSA=3]="ECDSA"})(I6||(I6={}));(function(r){r.codec=()=>es(I6)})(Ft||(Ft={}));(function(r){let e;r.codec=()=>(e==null&&(e=Qe((s,i,a={})=>{a.lengthDelimited!==!1&&i.fork(),s.Type!=null&&(i.uint32(8),Ft.codec().encode(s.Type,i)),s.Data!=null&&(i.uint32(18),i.bytes(s.Data)),a.lengthDelimited!==!1&&i.ldelim()},(s,i,a={})=>{let c={},l=i==null?s.len:s.pos+i;for(;s.pos<l;){let d=s.uint32();switch(d>>>3){case 1:{c.Type=Ft.codec().decode(s);break}case 2:{c.Data=s.bytes();break}default:{s.skipType(d&7);break}}}return c},function*(s,i,a,c={}){let l=i==null?s.len:s.pos+i;for(;s.pos<l;){let d=s.uint32();switch(d>>>3){case 1:{yield{field:`${a}.Type`,value:Ft.codec().decode(s)};break}case 2:{yield{field:`${a}.Data`,value:s.bytes()};break}default:{s.skipType(d&7);break}}}})),e);function t(s){return Xe(s,r.codec())}r.encode=t;function n(s,i){return Ye(s,r.codec(),i)}r.decode=n;function o(s,i){return Ze(s,r.codec(),i)}r.stream=o})(Ai||(Ai={}));(function(r){let e;r.codec=()=>(e==null&&(e=Qe((s,i,a={})=>{a.lengthDelimited!==!1&&i.fork(),s.Type!=null&&(i.uint32(8),Ft.codec().encode(s.Type,i)),s.Data!=null&&(i.uint32(18),i.bytes(s.Data)),a.lengthDelimited!==!1&&i.ldelim()},(s,i,a={})=>{let c={},l=i==null?s.len:s.pos+i;for(;s.pos<l;){let d=s.uint32();switch(d>>>3){case 1:{c.Type=Ft.codec().decode(s);break}case 2:{c.Data=s.bytes();break}default:{s.skipType(d&7);break}}}return c},function*(s,i,a,c={}){let l=i==null?s.len:s.pos+i;for(;s.pos<l;){let d=s.uint32();switch(d>>>3){case 1:{yield{field:`${a}.Type`,value:Ft.codec().decode(s)};break}case 2:{yield{field:`${a}.Data`,value:s.bytes()};break}default:{s.skipType(d&7);break}}}})),e);function t(s){return Xe(s,r.codec())}r.encode=t;function n(s,i){return Ye(s,r.codec(),i)}r.decode=n;function o(s,i){return Ze(s,r.codec(),i)}r.stream=o})(A6||(A6={}))});function yE(r){if(isNaN(r)||r<=0)throw new re("random bytes length must be a Number bigger than 0");return crypto.getRandomValues(new Uint8Array(r))}var FH=_(()=>{ge()});var zh,Hy,UH=_(()=>{bo();xi();Rr();bE();zh=class{type="RSA";jwk;_raw;_multihash;constructor(e,t){this.jwk=e,this._multihash=t}get raw(){return this._raw==null&&(this._raw=Ky.jwkToPkix(this.jwk)),this._raw}toMultihash(){return this._multihash}toCID(){return Wt.createV1(114,this._multihash)}toString(){return st.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}verify(e,t,n){return HH(this.jwk,t,e,n)}},Hy=class{type="RSA";jwk;_raw;publicKey;constructor(e,t){this.jwk=e,this.publicKey=t}get raw(){return this._raw==null&&(this._raw=Ky.jwkToPkcs1(this.jwk)),this._raw}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}sign(e,t){return $H(this.jwk,e,t)}}});var Ky={};ue(Ky,{MAX_RSA_KEY_SIZE:()=>k6,generateRSAKeyPair:()=>O6,jwkToJWKKeyPair:()=>zH,jwkToPkcs1:()=>sfe,jwkToPkix:()=>L6,jwkToRSAPrivateKey:()=>B6,pkcs1MessageToJwk:()=>_6,pkcs1MessageToRSAPrivateKey:()=>P6,pkcs1ToJwk:()=>ofe,pkcs1ToRSAPrivateKey:()=>KH,pkixMessageToJwk:()=>M6,pkixMessageToRSAPublicKey:()=>wE,pkixToJwk:()=>ife,pkixToRSAPublicKey:()=>D6});function ofe(r){let e=Ns(r);return _6(e)}function _6(r){return{n:ee(r[1],"base64url"),e:ee(r[2],"base64url"),d:ee(r[3],"base64url"),p:ee(r[4],"base64url"),q:ee(r[5],"base64url"),dp:ee(r[6],"base64url"),dq:ee(r[7],"base64url"),qi:ee(r[8],"base64url"),kty:"RSA"}}function sfe(r){if(r.n==null||r.e==null||r.d==null||r.p==null||r.q==null||r.dp==null||r.dq==null||r.qi==null)throw new re("JWK was missing components");return Fs([Rn(Uint8Array.from([0])),Rn(q(r.n,"base64url")),Rn(q(r.e,"base64url")),Rn(q(r.d,"base64url")),Rn(q(r.p,"base64url")),Rn(q(r.q,"base64url")),Rn(q(r.dp,"base64url")),Rn(q(r.dq,"base64url")),Rn(q(r.qi,"base64url"))]).subarray()}function ife(r){let e=Ns(r,{offset:0});return M6(e)}function M6(r){let e=Ns(r[1],{offset:0});return{kty:"RSA",n:ee(e[0],"base64url"),e:ee(e[1],"base64url")}}function L6(r){if(r.n==null||r.e==null)throw new re("JWK was missing components");return Fs([nfe,vy(Fs([Rn(q(r.n,"base64url")),Rn(q(r.e,"base64url"))]))]).subarray()}function KH(r){let e=Ns(r);return P6(e)}function P6(r){let e=_6(r);return B6(e)}function D6(r,e){if(r.byteLength>=rfe)throw new Yc("Key size is too large");let t=Ns(r,{offset:0});return wE(t,r,e)}function wE(r,e,t){let n=M6(r);if(t==null){let o=Si(Ai.encode({Type:Ft.RSA,Data:e}));t=bi(R6,o)}return new zh(n,t)}function B6(r){if(qH(r)>k6)throw new re("Key size is too large");let e=zH(r),t=Si(Ai.encode({Type:Ft.RSA,Data:L6(e.publicKey)})),n=bi(R6,t);return new Hy(e.privateKey,new zh(e.publicKey,n))}async function O6(r){if(r>k6)throw new re("Key size is too large");let e=await VH(r),t=Si(Ai.encode({Type:Ft.RSA,Data:L6(e.publicKey)})),n=bi(R6,t);return new Hy(e.privateKey,new zh(e.publicKey,n))}function zH(r){if(r==null)throw new re("Missing key parameter");return{privateKey:r,publicKey:{kty:r.kty,n:r.n,e:r.e}}}var k6,R6,rfe,nfe,N6=_(()=>{ge();Iy();Bs();We();Nt();T6();Xv();bE();UH();k6=8192,R6=18,rfe=1062,nfe=Uint8Array.from([48,13,6,9,42,134,72,134,247,13,1,1,1,5,0])});async function VH(r,e){let t=await Yn.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]);e?.signal?.throwIfAborted();let n=await afe(t,e);return{privateKey:n[0],publicKey:n[1]}}async function $H(r,e,t){let n=await Yn.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]);t?.signal?.throwIfAborted();let o=await Yn.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},n,Wr(e instanceof Uint8Array?e:e.subarray()));return t?.signal?.throwIfAborted(),new Uint8Array(o,0,o.byteLength)}async function HH(r,e,t,n){let o=await Yn.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);n?.signal?.throwIfAborted();let s=await Yn.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},o,Wr(e),Wr(t instanceof Uint8Array?t:t.subarray()));return n?.signal?.throwIfAborted(),s}async function afe(r,e){if(r.privateKey==null||r.publicKey==null)throw new re("Private and public key are required");let t=await Promise.all([Yn.get().subtle.exportKey("jwk",r.privateKey),Yn.get().subtle.exportKey("jwk",r.publicKey)]);return e?.signal?.throwIfAborted(),t}function qH(r){if(r.kty!=="RSA")throw new re("invalid key type");if(r.n==null)throw new re("invalid key modulus");return q(r.n,"base64url").length*8}var jH,bE=_(()=>{ge();We();Th();a6();N6();jH="1.2.840.113549.1.1.1"});var xE,Vh,F6=_(()=>{tl();xE=class{oHash;iHash;blockLen;outputLen;finished=!1;destroyed=!1;constructor(e,t){if(Wd(e),Re(t,void 0,"key"),this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(t.length>n?e.create().update(t).digest():t);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),Us(o)}update(e){return Rh(this),this.iHash.update(e),this}digestInto(e){Rh(this),Re(e,this.outputLen,"output"),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a}=this;return e=e,e.finished=o,e.destroyed=s,e.blockLen=i,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Vh=(r,e,t)=>new xE(r,e).update(t).digest();Vh.create=(r,e)=>new xE(r,e)});function cfe(r,e,t){let[[n,o],[s,i]]=e,a=GH(i*r,t),c=GH(-o*r,t),l=r-a*n-c*s,d=-a*o-c*i,u=l<ka,f=d<ka;u&&(l=-l),f&&(d=-d);let h=ky(Math.ceil(XM(t)/2))+qh;if(l<ka||l>=h||d<ka||d>=h)throw new Error("splitScalar (endomorphism): failed, k="+r);return{k1neg:u,k1:l,k2neg:f,k2:d}}function $6(r){if(!["compact","recovered","der"].includes(r))throw new Error('Signature format must be "compact", "recovered", or "der"');return r}function U6(r,e){let t={};for(let n of Object.keys(e))t[n]=r[n]===void 0?e[n]:r[n];return Ia(t.lowS,"lowS"),Ia(t.prehash,"prehash"),t.format!==void 0&&$6(t.format),t}function YH(r,e={}){let t=rE("weierstrass",r,e),{Fp:n,Fn:o}=t,s=t.CURVE,{h:i,n:a}=s;Ii(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:c}=e;if(c&&(!n.is0(s.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let l=ZH(n,o);function d(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(P,S,C){let{x:v,y:A}=S.toAffine(),B=n.toBytes(v);if(Ia(C,"isCompressed"),C){d();let N=!n.isOdd(A);return Wn(XH(N),B)}else return Wn(Uint8Array.of(4),B,n.toBytes(A))}function f(P){Re(P,void 0,"Point");let{publicKey:S,publicKeyUncompressed:C}=l,v=P.length,A=P[0],B=P.subarray(1);if(v===S&&(A===2||A===3)){let N=n.fromBytes(B);if(!n.isValid(N))throw new Error("bad point: is not on curve, wrong x");let D=y(N),F;try{F=n.sqrt(D)}catch(X){let Z=X instanceof Error?": "+X.message:"";throw new Error("bad point: is not on curve, sqrt error"+Z)}d();let U=n.isOdd(F);return(A&1)===1!==U&&(F=n.neg(F)),{x:N,y:F}}else if(v===C&&A===4){let N=n.BYTES,D=n.fromBytes(B.subarray(0,N)),F=n.fromBytes(B.subarray(N,N*2));if(!g(D,F))throw new Error("bad point: is not on curve");return{x:D,y:F}}else throw new Error(`bad point: got length ${v}, expected compressed=${S} or uncompressed=${C}`)}let h=e.toBytes||u,m=e.fromBytes||f;function y(P){let S=n.sqr(P),C=n.mul(S,P);return n.add(n.add(C,n.mul(P,s.a)),s.b)}function g(P,S){let C=n.sqr(S),v=y(P);return n.eql(C,v)}if(!g(s.Gx,s.Gy))throw new Error("bad curve params: generator point");let p=n.mul(n.pow(s.a,vE),lfe),w=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(p,w)))throw new Error("bad curve params: a or b");function b(P,S,C=!1){if(!n.isValid(S)||C&&n.is0(S))throw new Error(`bad point coordinate ${P}`);return S}function x(P){if(!(P instanceof E))throw new Error("Weierstrass Point expected")}function T(P){if(!c||!c.basises)throw new Error("no endo");return cfe(P,c.basises,o.ORDER)}let k=Mh((P,S)=>{let{X:C,Y:v,Z:A}=P;if(n.eql(A,n.ONE))return{x:C,y:v};let B=P.is0();S==null&&(S=B?n.ONE:n.inv(A));let N=n.mul(C,S),D=n.mul(v,S),F=n.mul(A,S);if(B)return{x:n.ZERO,y:n.ZERO};if(!n.eql(F,n.ONE))throw new Error("invZ was invalid");return{x:N,y:D}}),M=Mh(P=>{if(P.is0()){if(e.allowInfinityPoint&&!n.is0(P.Y))return;throw new Error("bad point: ZERO")}let{x:S,y:C}=P.toAffine();if(!n.isValid(S)||!n.isValid(C))throw new Error("bad point: x or y not field elements");if(!g(S,C))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function I(P,S,C,v,A){return C=new E(n.mul(C.X,P),C.Y,C.Z),S=_y(v,S),C=_y(A,C),S.add(C)}class E{static BASE=new E(s.Gx,s.Gy,n.ONE);static ZERO=new E(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=o;X;Y;Z;constructor(S,C,v){this.X=b("x",S),this.Y=b("y",C,!0),this.Z=b("z",v),Object.freeze(this)}static CURVE(){return s}static fromAffine(S){let{x:C,y:v}=S||{};if(!S||!n.isValid(C)||!n.isValid(v))throw new Error("invalid affine point");if(S instanceof E)throw new Error("projective point not allowed");return n.is0(C)&&n.is0(v)?E.ZERO:new E(C,v,n.ONE)}static fromBytes(S){let C=E.fromAffine(m(Re(S,void 0,"point")));return C.assertValidity(),C}static fromHex(S){return E.fromBytes(Sa(S))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(S=8,C=!0){return R.createCache(this,S),C||this.multiply(vE),this}assertValidity(){M(this)}hasEvenY(){let{y:S}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(S)}equals(S){x(S);let{X:C,Y:v,Z:A}=this,{X:B,Y:N,Z:D}=S,F=n.eql(n.mul(C,D),n.mul(B,A)),U=n.eql(n.mul(v,D),n.mul(N,A));return F&&U}negate(){return new E(this.X,n.neg(this.Y),this.Z)}double(){let{a:S,b:C}=s,v=n.mul(C,vE),{X:A,Y:B,Z:N}=this,D=n.ZERO,F=n.ZERO,U=n.ZERO,H=n.mul(A,A),X=n.mul(B,B),Z=n.mul(N,N),O=n.mul(A,B);return O=n.add(O,O),U=n.mul(A,N),U=n.add(U,U),D=n.mul(S,U),F=n.mul(v,Z),F=n.add(D,F),D=n.sub(X,F),F=n.add(X,F),F=n.mul(D,F),D=n.mul(O,D),U=n.mul(v,U),Z=n.mul(S,Z),O=n.sub(H,Z),O=n.mul(S,O),O=n.add(O,U),U=n.add(H,H),H=n.add(U,H),H=n.add(H,Z),H=n.mul(H,O),F=n.add(F,H),Z=n.mul(B,N),Z=n.add(Z,Z),H=n.mul(Z,O),D=n.sub(D,H),U=n.mul(Z,X),U=n.add(U,U),U=n.add(U,U),new E(D,F,U)}add(S){x(S);let{X:C,Y:v,Z:A}=this,{X:B,Y:N,Z:D}=S,F=n.ZERO,U=n.ZERO,H=n.ZERO,X=s.a,Z=n.mul(s.b,vE),O=n.mul(C,B),z=n.mul(v,N),j=n.mul(A,D),fe=n.add(C,v),W=n.add(B,N);fe=n.mul(fe,W),W=n.add(O,z),fe=n.sub(fe,W),W=n.add(C,A);let ie=n.add(B,D);return W=n.mul(W,ie),ie=n.add(O,j),W=n.sub(W,ie),ie=n.add(v,A),F=n.add(N,D),ie=n.mul(ie,F),F=n.add(z,j),ie=n.sub(ie,F),H=n.mul(X,W),F=n.mul(Z,j),H=n.add(F,H),F=n.sub(z,H),H=n.add(z,H),U=n.mul(F,H),z=n.add(O,O),z=n.add(z,O),j=n.mul(X,j),W=n.mul(Z,W),z=n.add(z,j),j=n.sub(O,j),j=n.mul(X,j),W=n.add(W,j),O=n.mul(z,W),U=n.add(U,O),O=n.mul(ie,W),F=n.mul(fe,F),F=n.sub(F,O),O=n.mul(fe,z),H=n.mul(ie,H),H=n.add(H,O),new E(F,U,H)}subtract(S){return this.add(S.negate())}is0(){return this.equals(E.ZERO)}multiply(S){let{endo:C}=e;if(!o.isValidNot0(S))throw new Error("invalid scalar: out of range");let v,A,B=N=>R.cached(this,N,D=>eu(E,D));if(C){let{k1neg:N,k1:D,k2neg:F,k2:U}=T(S),{p:H,f:X}=B(D),{p:Z,f:O}=B(U);A=X.add(O),v=I(C.beta,H,Z,N,F)}else{let{p:N,f:D}=B(S);v=N,A=D}return eu(E,[v,A])[0]}multiplyUnsafe(S){let{endo:C}=e,v=this;if(!o.isValid(S))throw new Error("invalid scalar: out of range");if(S===ka||v.is0())return E.ZERO;if(S===qh)return v;if(R.hasCache(this))return this.multiply(S);if(C){let{k1neg:A,k1:B,k2neg:N,k2:D}=T(S),{p1:F,p2:U}=nH(E,v,B,D);return I(C.beta,F,U,A,N)}else return R.unsafe(v,S)}toAffine(S){return k(this,S)}isTorsionFree(){let{isTorsionFree:S}=e;return i===qh?!0:S?S(E,this):R.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:S}=e;return i===qh?this:S?S(E,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(S=!0){return Ia(S,"isCompressed"),this.assertValidity(),h(E,this,S)}toHex(S=!0){return Ea(this.toBytes(S))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let L=o.BITS,R=new Oh(E,e.endo?Math.ceil(L/2):L);return E.BASE.precompute(8),E}function XH(r){return Uint8Array.of(r?2:3)}function ZH(r,e){return{secretKey:e.BYTES,publicKey:1+r.BYTES,publicKeyUncompressed:1+2*r.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function dfe(r,e={}){let{Fn:t}=r,n=e.randomBytes||el,o=Object.assign(ZH(r.Fp,t),{seed:e6(t.ORDER)});function s(h){try{let m=t.fromBytes(h);return t.isValidNot0(m)}catch{return!1}}function i(h,m){let{publicKey:y,publicKeyUncompressed:g}=o;try{let p=h.length;return m===!0&&p!==y||m===!1&&p!==g?!1:!!r.fromBytes(h)}catch{return!1}}function a(h=n(o.seed)){return t6(Re(h,o.seed,"seed"),t.ORDER)}function c(h,m=!0){return r.BASE.multiply(t.fromBytes(h)).toBytes(m)}function l(h){let{secretKey:m,publicKey:y,publicKeyUncompressed:g}=o;if(!Gd(h)||"_lengths"in t&&t._lengths||m===y)return;let p=Re(h,void 0,"key").length;return p===y||p===g}function d(h,m,y=!0){if(l(h)===!0)throw new Error("first arg must be private key");if(l(m)===!1)throw new Error("second arg must be public key");let g=t.fromBytes(h);return r.fromBytes(m).multiply(g).toBytes(y)}let u={isValidSecretKey:s,isValidPublicKey:i,randomSecretKey:a},f=Nh(a,c);return Object.freeze({getPublicKey:c,getSharedSecret:d,keygen:f,Point:r,utils:u,lengths:o})}function QH(r,e,t={}){Wd(e),Ii(t,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),t=Object.assign({},t);let n=t.randomBytes||el,o=t.hmac||((C,v)=>Vh(e,C,v)),{Fp:s,Fn:i}=r,{ORDER:a,BITS:c}=i,{keygen:l,getPublicKey:d,getSharedSecret:u,utils:f,lengths:h}=dfe(r,t),m={prehash:!0,lowS:typeof t.lowS=="boolean"?t.lowS:!0,format:"compact",extraEntropy:!1},y=a*WH<s.ORDER;function g(C){let v=a>>qh;return C>v}function p(C,v){if(!i.isValidNot0(v))throw new Error(`invalid signature ${C}: out of range 1..Point.Fn.ORDER`);return v}function w(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function b(C,v){$6(v);let A=h.signature,B=v==="compact"?A:v==="recovered"?A+1:void 0;return Re(C,B)}class x{r;s;recovery;constructor(v,A,B){if(this.r=p("r",v),this.s=p("s",A),B!=null){if(w(),![0,1,2,3].includes(B))throw new Error("invalid recovery id");this.recovery=B}Object.freeze(this)}static fromBytes(v,A=m.format){b(v,A);let B;if(A==="der"){let{r:U,s:H}=cl.toSig(Re(v));return new x(U,H)}A==="recovered"&&(B=v[0],A="compact",v=v.subarray(1));let N=h.signature/2,D=v.subarray(0,N),F=v.subarray(N,N*2);return new x(i.fromBytes(D),i.fromBytes(F),B)}static fromHex(v,A){return this.fromBytes(Sa(v),A)}assertRecovery(){let{recovery:v}=this;if(v==null)throw new Error("invalid recovery id: must be present");return v}addRecoveryBit(v){return new x(this.r,this.s,v)}recoverPublicKey(v){let{r:A,s:B}=this,N=this.assertRecovery(),D=N===2||N===3?A+a:A;if(!s.isValid(D))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let F=s.toBytes(D),U=r.fromBytes(Wn(XH((N&1)===0),F)),H=i.inv(D),X=k(Re(v,void 0,"msgHash")),Z=i.create(-X*H),O=i.create(B*H),z=r.BASE.multiplyUnsafe(Z).add(U.multiplyUnsafe(O));if(z.is0())throw new Error("invalid recovery: point at infinify");return z.assertValidity(),z}hasHighS(){return g(this.s)}toBytes(v=m.format){if($6(v),v==="der")return Sa(cl.hexFromSig(this));let{r:A,s:B}=this,N=i.toBytes(A),D=i.toBytes(B);return v==="recovered"?(w(),Wn(Uint8Array.of(this.assertRecovery()),N,D)):Wn(N,D)}toHex(v){return Ea(this.toBytes(v))}}let T=t.bits2int||function(v){if(v.length>8192)throw new Error("input is too large");let A=_h(v),B=v.length*8-c;return B>0?A>>BigInt(B):A},k=t.bits2int_modN||function(v){return i.create(T(v))},M=ky(c);function I(C){return sl("num < 2^"+c,C,ka,M),i.toBytes(C)}function E(C,v){return Re(C,void 0,"message"),v?Re(e(C),void 0,"prehashed message"):C}function L(C,v,A){let{lowS:B,prehash:N,extraEntropy:D}=U6(A,m);C=E(C,N);let F=k(C),U=i.fromBytes(v);if(!i.isValidNot0(U))throw new Error("invalid private key");let H=[I(U),I(F)];if(D!=null&&D!==!1){let z=D===!0?n(h.secretKey):D;H.push(Re(z,void 0,"extraEntropy"))}let X=Wn(...H),Z=F;function O(z){let j=T(z);if(!i.isValidNot0(j))return;let fe=i.inv(j),W=r.BASE.multiply(j).toAffine(),ie=i.create(W.x);if(ie===ka)return;let $e=i.create(fe*i.create(Z+ie*U));if($e===ka)return;let Qt=(W.x===ie?0:2)|Number(W.y&qh),sr=$e;return B&&g($e)&&(sr=i.neg($e),Qt^=1),new x(ie,sr,y?void 0:Qt)}return{seed:X,k2sig:O}}function R(C,v,A={}){let{seed:B,k2sig:N}=L(C,v,A);return $$(e.outputLen,i.BYTES,o)(B,N).toBytes(A.format)}function P(C,v,A,B={}){let{lowS:N,prehash:D,format:F}=U6(B,m);if(A=Re(A,void 0,"publicKey"),v=E(v,D),!Gd(C)){let U=C instanceof x?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+U)}b(C,F);try{let U=x.fromBytes(C,F),H=r.fromBytes(A);if(N&&U.hasHighS())return!1;let{r:X,s:Z}=U,O=k(v),z=i.inv(Z),j=i.create(O*z),fe=i.create(X*z),W=r.BASE.multiplyUnsafe(j).add(H.multiplyUnsafe(fe));return W.is0()?!1:i.create(W.x)===X}catch{return!1}}function S(C,v,A={}){let{prehash:B}=U6(A,m);return v=E(v,B),x.fromBytes(C,"recovered").recoverPublicKey(v).toBytes()}return Object.freeze({keygen:l,getPublicKey:d,getSharedSecret:u,utils:f,lengths:h,Point:r,sign:R,verify:P,recoverPublicKey:S,Signature:x,hash:e})}var GH,H6,cl,ka,qh,WH,vE,lfe,JH=_(()=>{F6();tl();Lh();nE();Dh();GH=(r,e)=>(r+(r>=0?e:-e)/WH)/e;H6=class extends Error{constructor(e=""){super(e)}},cl={Err:H6,_tlv:{encode:(r,e)=>{let{Err:t}=cl;if(r<0||r>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");let n=e.length/2,o=Ay(n);if(o.length/2&128)throw new t("tlv.encode: long form length too big");let s=n>127?Ay(o.length/2|128):"";return Ay(r)+s+o+e},decode(r,e){let{Err:t}=cl,n=0;if(r<0||r>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[n++]!==r)throw new t("tlv.decode: wrong tlv");let o=e[n++],s=!!(o&128),i=0;if(!s)i=o;else{let c=o&127;if(!c)throw new t("tlv.decode(long): indefinite length not supported");if(c>4)throw new t("tlv.decode(long): byte length is too big");let l=e.subarray(n,n+c);if(l.length!==c)throw new t("tlv.decode: length bytes not complete");if(l[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(let d of l)i=i<<8|d;if(n+=c,i<128)throw new t("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+i);if(a.length!==i)throw new t("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+i)}}},_int:{encode(r){let{Err:e}=cl;if(r<ka)throw new e("integer: negative integers are not allowed");let t=Ay(r);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(r){let{Err:e}=cl;if(r[0]&128)throw new e("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return _h(r)}},toSig(r){let{Err:e,_int:t,_tlv:n}=cl,o=Re(r,void 0,"signature"),{v:s,l:i}=n.decode(48,o);if(i.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,s),{v:l,l:d}=n.decode(2,c);if(d.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(a),s:t.decode(l)}},hexFromSig(r){let{_tlv:e,_int:t}=cl,n=e.encode(2,t.encode(r.r)),o=e.encode(2,t.encode(r.s)),s=n+o;return e.encode(48,s)}},ka=BigInt(0),qh=BigInt(1),WH=BigInt(2),vE=BigInt(3),lfe=BigInt(4)});function ffe(r){let e=z6.p,t=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),c=BigInt(88),l=r*r*r%e,d=l*l*r%e,u=Tt(d,t,e)*d%e,f=Tt(u,t,e)*d%e,h=Tt(f,eK,e)*l%e,m=Tt(h,o,e)*h%e,y=Tt(m,s,e)*m%e,g=Tt(y,a,e)*y%e,p=Tt(g,c,e)*g%e,w=Tt(p,a,e)*y%e,b=Tt(w,t,e)*d%e,x=Tt(b,i,e)*m%e,T=Tt(x,n,e)*l%e,k=Tt(T,eK,e);if(!K6.eql(K6.sqr(k),r))throw new Error("Cannot find square root");return k}var z6,ufe,eK,K6,hfe,Ks,V6=_(()=>{Iy();Dh();JH();z6={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},ufe={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},eK=BigInt(2);K6=Ph(z6.p,{sqrt:ffe}),hfe=YH(z6,{Fp:K6,endo:ufe}),Ks=QH(hfe,Si)});function rK(r,e,t){let n=vi.digest(e instanceof Uint8Array?e:e.subarray());if(Kh(n))return n.then(({digest:o})=>(t?.signal?.throwIfAborted(),Ks.sign(o,r,{prehash:!1,format:"der"}))).catch(o=>{throw o.name==="AbortError"?o:new Py(String(o))});try{return Ks.sign(n.digest,r,{prehash:!1,format:"der"})}catch(o){throw new Py(String(o))}}function nK(r,e,t,n){let o=vi.digest(t instanceof Uint8Array?t:t.subarray());if(Kh(o))return o.then(({digest:s})=>(n?.signal?.throwIfAborted(),Ks.verify(e,s,r,{prehash:!1,format:"der"}))).catch(s=>{throw s.name==="AbortError"?s:new Dy(String(s))});try{return n?.signal?.throwIfAborted(),Ks.verify(e,o.digest,r,{prehash:!1,format:"der"})}catch(s){throw new Dy(String(s))}}var tK,q6=_(()=>{V6();kh();i6();c6();tK=33});var zy,EE,oK=_(()=>{bo();xi();qd();Rr();dr();q6();j6();zy=class{type="secp256k1";raw;_key;constructor(e){this._key=aK(e),this.raw=sK(this._key)}toMultihash(){return Os.digest(_r(this))}toCID(){return Wt.createV1(114,this.toMultihash())}toString(){return st.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}verify(e,t,n){return nK(this._key,t,e,n)}},EE=class{type="secp256k1";raw;publicKey;constructor(e,t){this.raw=iK(e),this.publicKey=new zy(t??cK(e))}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Le(this.raw,e.raw)}sign(e,t){return rK(this.raw,e,t)}}});function SE(r){return new zy(r)}async function lK(){let r=pfe();return new EE(r)}function sK(r){return Ks.Point.fromBytes(r).toBytes()}function iK(r){try{return Ks.getPublicKey(r,!0),r}catch(e){throw new dy(String(e))}}function aK(r){try{return Ks.Point.fromBytes(r),r}catch(e){throw new Yc(String(e))}}function cK(r){try{return Ks.getPublicKey(r,!0)}catch(e){throw new dy(String(e))}}function pfe(){return Ks.utils.randomSecretKey()}var j6=_(()=>{ge();V6();oK()});async function jh(r,e){if(r==="Ed25519")return vH();if(r==="secp256k1")return lK();if(r==="RSA")return O6(mfe(e));if(r==="ECDSA")return w$(gfe(e));throw new wa}async function dK(r,e){if(r!=="Ed25519")throw new wa("Seed key derivation only supported for Ed25519 keys");return EH(e)}function Mn(r,e){let{Type:t,Data:n}=Ai.decode(r),o=n??new Uint8Array;switch(t){case Ft.RSA:return D6(o,e);case Ft.Ed25519:return uE(o);case Ft.secp256k1:return SE(o);case Ft.ECDSA:return NM(o);default:throw new wa}}function nu(r){if(r.byteLength===$h)return uE(r);if(r.byteLength===tK)return SE(r);let e=Ns(r),t=e[1]?.[0];if(t===z7||t===V7||t===q7)return FM(e);if(e[0]?.[0]===jH)return wE(e,r);throw new re("Could not extract public key from raw bytes")}function uK(r){let{Type:e,Data:t}=Ai.decode(r.digest),n=t??new Uint8Array;switch(e){case Ft.Ed25519:return uE(n);case Ft.secp256k1:return SE(n);case Ft.ECDSA:return NM(n);default:throw new wa}}function _r(r){return Ai.encode({Type:Ft[r.type],Data:r.raw})}function mfe(r){return r==null?2048:parseInt(r,10)}function gfe(r){if(r==="P-256"||r==null)return"P-256";if(r==="P-384")return"P-384";if(r==="P-521")return"P-521";throw new re("Unsupported curve, should be P-256, P-384 or P-521")}var dr=_(()=>{ge();Gv();UM();lE();l6();T6();Xv();bE();N6();q6();j6()});var fK,yfe,Vy,qy,jy,Gy,bfe,Wy,hK=_(()=>{ge();bo();xi();qd();Rr();We();Nt();fK=Symbol.for("nodejs.util.inspect.custom"),yfe=114,Vy=class{type;multihash;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[zv]=!0;toString(){return this.string==null&&(this.string=st.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return Wt.createV1(yfe,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Le(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return Le(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[fK](){return`PeerId(${this.toString()})`}},qy=class extends Vy{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},jy=class extends Vy{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},Gy=class extends Vy{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},bfe=2336,Wy=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=Os.digest(q(this.url))}[fK](){return`PeerId(${this.url})`}[zv]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return Wt.createV1(bfe,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=ee(e)),e.toString()===this.toString())}}});var mK={};ue(mK,{peerIdFromCID:()=>Ti,peerIdFromMultihash:()=>Vs,peerIdFromPrivateKey:()=>ll,peerIdFromPublicKey:()=>zs,peerIdFromString:()=>Q});function Q(r,e){let t;if(r.charAt(0)==="1"||r.charAt(0)==="Q")t=wo(st.decode(`z${r}`));else{if(r.startsWith("k51qzi5uqu5")||r.startsWith("kzwfwjn5ji4")||r.startsWith("k2k4r8")||r.startsWith("bafz"))return Ti(Wt.parse(r));if(e==null)throw new re('Please pass a multibase decoder for strings that do not start with "1" or "Q"');t=wo(e.decode(r))}return Vs(t)}function zs(r){if(r.type==="Ed25519")return new jy({multihash:r.toCID().multihash,publicKey:r});if(r.type==="secp256k1")return new Gy({multihash:r.toCID().multihash,publicKey:r});if(r.type==="RSA")return new qy({multihash:r.toCID().multihash,publicKey:r});throw new wa}function ll(r){return zs(r.publicKey)}function Vs(r){if(vfe(r))return new qy({multihash:r});if(xfe(r))try{let e=uK(r);if(e.type==="Ed25519")return new jy({multihash:r,publicKey:e});if(e.type==="secp256k1")return new Gy({multihash:r,publicKey:e})}catch{let t=ee(r.digest);return new Wy(new URL(t))}throw new Ov("Supplied PeerID Multihash is invalid")}function Ti(r){if(r?.multihash==null||r.version==null||r.version===1&&r.code!==wfe&&r.code!==pK)throw new Bv("Supplied PeerID CID is invalid");if(r.code===pK){let e=ee(r.multihash.digest);return new Wy(new URL(e))}return Vs(r.multihash)}function xfe(r){return r.code===Os.code}function vfe(r){return r.code===vi.code}var wfe,pK,Ee=_(()=>{dr();ge();bo();xi();Bs();qd();kh();Nt();hK();wfe=114,pK=2336});var xK=_(()=>{});var vK=_(()=>{pt();K_()});var EK=_(()=>{});var dl=_(()=>{Rr();Th();xK();vK();pt();EK();Ms();We();Nt()});var Xr,Ra,CE,IE,Gh=_(()=>{Xr=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},Ra=class extends Error{static name="ValidationError";name="ValidationError"},CE=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},IE=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"}});var AE,SK=_(()=>{AE=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let t=this.index,n=e();return n===void 0&&(this.index=t),n}parseWith(e){let t=e();if(this.index===this.input.length)return t}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let t=this.readChar();if(t===e)return t})}readSeparator(e,t,n){return this.readAtomically(()=>{if(!(t>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,t,n,o){return this.readAtomically(()=>{let s=0,i=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",l=2**(8*o)-1;for(;;){let d=this.readAtomically(()=>{let u=this.readChar();if(u===void 0)return;let f=Number.parseInt(u,e);if(!Number.isNaN(f))return f});if(d===void 0)break;if(s*=e,s+=d,s>l||(i+=1,t!==void 0&&i>t))return}if(i!==0)return!n&&c&&i>1?void 0:s})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let t=0;t<e.length;t++){let n=this.readSeparator(".",t,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[t]=n}return e})}readIPv6Addr(){let e=t=>{for(let n=0;n<t.length/2;n++){let o=n*2;if(n<t.length-3){let i=this.readSeparator(":",n,()=>this.readIPv4Addr());if(i!==void 0)return t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2],t[o+3]=i[3],[o+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[o,!1];t[o]=s>>8,t[o+1]=s&255}return[t.length,!1]};return this.readAtomically(()=>{let t=new Uint8Array(16),[n,o]=e(t);if(n===16)return t;if(o||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let s=new Uint8Array(14),i=16-(n+2),[a]=e(s.subarray(0,i));return t.set(s.subarray(0,a),16-a),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}});function TE(r){if(!(r.length>Efe))return Wh.new(r).parseWith(()=>Wh.readIPv4Addr())}function kE(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>CK))return Wh.new(r).parseWith(()=>Wh.readIPv6Addr())}function Yh(r,e=!1){if(r.includes("%")&&(r=r.split("%")[0]),r.length>CK)return;let t=Wh.new(r).parseWith(()=>Wh.readIPAddr());if(t)return e&&t.length===4?Uint8Array.from([0,0,0,0,0,0,0,0,0,0,255,255,t[0],t[1],t[2],t[3]]):t}var CK,Efe,Wh,Yy=_(()=>{SK();CK=45,Efe=15,Wh=new AE});function ts(r){return!!TE(r)}function Xh(r){return!!kE(r)}var ul=_(()=>{Yy()});var G6=_(()=>{});function Y6(r){return e=>ee(e,r)}function X6(r){return e=>q(e,r)}function Zh(r){return new DataView(r.buffer).getUint16(r.byteOffset).toString()}function ou(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof r=="string"?parseInt(r):r),new Uint8Array(e)}function IK(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let t=q(e[0],"base32"),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ou(n);return Ot([t,o],t.length+o.length)}function AK(r){let e=r.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let t=jn.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let o=ou(n);return Ot([t,o],t.length+o.length)}function Z6(r){let e=r.subarray(0,r.length-2),t=r.subarray(r.length-2),n=ee(e,"base32"),o=Zh(t);return`${n}:${o}`}function _K(r){try{let e=new URL(`http://[${r}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new Xr(`Invalid IPv6 address "${r}"`)}}function MK(r){return Sfe.decode(r)}function LK(r){return e=>r.encoder.encode(e)}var Q6,TK,kK,RK,W6,Sfe,PK=_(()=>{ul();Ud();_M();Ms();We();Nt();Gh();Q6=function(r){r=r.toString().trim();let e=new Uint8Array(4);return r.split(/\./g).forEach((t,n)=>{let o=parseInt(t,10);if(isNaN(o)||o<0||o>255)throw new Xr("Invalid byte value in IP address");e[n]=o}),e},TK=function(r){let e=0;r=r.toString().trim();let t=r.split(":",8),n;for(n=0;n<t.length;n++){let s=ts(t[n]),i;s&&(i=Q6(t[n]),t[n]=ee(i.subarray(0,2),"base16")),i!=null&&++n<8&&t.splice(n,0,ee(i.subarray(2,4),"base16"))}if(t[0]==="")for(;t.length<8;)t.unshift("0");else if(t[t.length-1]==="")for(;t.length<8;)t.push("0");else if(t.length<8){for(n=0;n<t.length&&t[n]!=="";n++);let s=[n,1];for(n=9-t.length;n>0;n--)s.push("0");t.splice.apply(t,s)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){t[n]===""&&(t[n]="0");let s=parseInt(t[n],16);if(isNaN(s)||s<0||s>65535)throw new Xr("Invalid byte value in IP address");o[e++]=s>>8&255,o[e++]=s&255}return o},kK=function(r){if(r.byteLength!==4)throw new Xr("IPv4 address was incorrect length");let e=[];for(let t=0;t<r.byteLength;t++)e.push(r[t]);return e.join(".")},RK=function(r){if(r.byteLength!==16)throw new Xr("IPv6 address was incorrect length");let e=[];for(let n=0;n<r.byteLength;n+=2){let o=r[n],s=r[n+1],i=`${o.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`;e.push(i)}let t=e.join(":");try{let n=new URL(`http://[${t}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new Xr(`Invalid IPv6 address "${t}"`)}};W6=Object.values(by).map(r=>r.decoder),Sfe=(function(){let r=W6[0].or(W6[1]);return W6.slice(2).forEach(e=>r=r.or(e)),r})()});function Cfe(r){if(parseInt(r).toString()!==r)throw new Ra("Value must be an integer")}function Ife(r){if(r<0)throw new Ra("Value must be a positive integer, or zero")}function Afe(r){return e=>{if(e>r)throw new Ra(`Value must be smaller than or equal to ${r}`)}}function Tfe(...r){return e=>{for(let t of r)t(e)}}var Xy,DK=_(()=>{Gh();Xy=Tfe(Cfe,Ife,Afe(65535))});var Pr,J6,Pa,Hfe,PE=_(()=>{ul();RM();ly();G6();Gh();PK();DK();Pr=-1,J6=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let t;if(typeof e=="string"?t=this.protocolsByName.get(e):t=this.protocolsByCode.get(e),t==null)throw new IE(`Protocol ${e} was unknown`);return t}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(t=>{this.protocolsByName.set(t,e)})}removeProtocol(e){let t=this.protocolsByCode.get(e);t!=null&&(this.protocolsByCode.delete(t.code),this.protocolsByName.delete(t.name),t.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},Pa=new J6,Hfe=[{code:4,name:"ip4",size:32,valueToBytes:Q6,bytesToValue:kK,validate:r=>{if(!ts(r))throw new Ra(`Invalid IPv4 address "${r}"`)}},{code:6,name:"tcp",size:16,valueToBytes:ou,bytesToValue:Zh,validate:Xy},{code:273,name:"udp",size:16,valueToBytes:ou,bytesToValue:Zh,validate:Xy},{code:33,name:"dccp",size:16,valueToBytes:ou,bytesToValue:Zh,validate:Xy},{code:41,name:"ip6",size:128,valueToBytes:TK,bytesToValue:RK,stringToValue:_K,validate:r=>{if(!Xh(r))throw new Ra(`Invalid IPv6 address "${r}"`)}},{code:42,name:"ip6zone",size:Pr},{code:43,name:"ipcidr",size:8,bytesToValue:Y6("base10"),valueToBytes:X6("base10")},{code:53,name:"dns",size:Pr},{code:54,name:"dns4",size:Pr},{code:55,name:"dns6",size:Pr},{code:56,name:"dnsaddr",size:Pr},{code:132,name:"sctp",size:16,valueToBytes:ou,bytesToValue:Zh,validate:Xy},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:Pr,stringToValue:r=>decodeURIComponent(r),valueToString:r=>encodeURIComponent(r)},{code:421,name:"p2p",aliases:["ipfs"],size:Pr,bytesToValue:Y6("base58btc"),valueToBytes:r=>r.startsWith("Q")||r.startsWith("1")?X6("base58btc")(r):Wt.parse(r).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:Z6,valueToBytes:IK},{code:445,name:"onion3",size:296,bytesToValue:Z6,valueToBytes:AK},{code:446,name:"garlic64",size:Pr},{code:447,name:"garlic32",size:Pr},{code:448,name:"tls"},{code:449,name:"sni",size:Pr},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:Pr,bytesToValue:LK(tM),valueToBytes:MK},{code:480,name:"http"},{code:481,name:"http-path",size:Pr,stringToValue:r=>`/${decodeURIComponent(r)}`,valueToString:r=>encodeURIComponent(r.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:Pr}];Hfe.forEach(r=>{Pa.addProtocol(r)})});function BK(r){let e=[],t=0;for(;t<r.length;){let n=ha(r,t),o=Pa.getProtocol(n),s=cr(n),i=Kfe(o,r,t+s),a=0;i>0&&o.size===Pr&&(a=cr(i));let c=s+a+i,l={code:n,name:o.name,bytes:Wr(r.subarray(t,t+c))};if(i>0){let d=t+s+a,u=r.subarray(d,d+i);l.value=o.bytesToValue?.(u)??ee(u)}e.push(l),t+=c}return e}function OK(r){let e=0,t=[];for(let n of r){if(n.bytes==null){let o=Pa.getProtocol(n.code),s=cr(n.code),i,a=0,c=0;n.value!=null&&(i=o.valueToBytes?.(n.value)??q(n.value),a=i.byteLength,o.size===Pr&&(c=cr(a)));let l=new Uint8Array(s+c+a),d=0;uh(n.code,l,d),d+=s,i!=null&&(o.size===Pr&&(uh(a,l,d),d+=c),l.set(i,d)),n.bytes=l}t.push(n.bytes),e+=n.bytes.byteLength}return Ot(t,e)}function NK(r){if(r.charAt(0)!=="/")throw new Xr('String multiaddr must start with "/"');let e=[],t="protocol",n="",o="";for(let s=1;s<r.length;s++){let i=r.charAt(s);i!=="/"&&(t==="protocol"?o+=r.charAt(s):n+=r.charAt(s));let a=s===r.length-1;if(i==="/"||a){let c=Pa.getProtocol(o);if(t==="protocol"){if(c.size==null||c.size===0){e.push({code:c.code,name:c.name}),n="",o="",t="protocol";continue}else if(a)throw new Xr(`Component ${o} was missing value`);t="value"}else if(t==="value"){let l={code:c.code,name:c.name};if(c.size!=null&&c.size!==0){if(n==="")throw new Xr(`Component ${o} was missing value`);l.value=c.stringToValue?.(n)??n}e.push(l),n="",o="",t="protocol"}}}if(o!==""&&n!=="")throw new Xr("Incomplete multiaddr");return e}function FK(r){return`/${r.flatMap(e=>{if(e.value==null)return e.name;let t=Pa.getProtocol(e.code);if(t==null)throw new Xr(`Unknown protocol code ${e.code}`);return[e.name,t.valueToString?.(e.value)??e.value]}).join("/")}`}function Kfe(r,e,t){return r.size==null||r.size===0?0:r.size>0?r.size/8:ha(e,t)}var UK=_(()=>{pa();dl();Ms();We();Nt();Gh();PE()});function Vfe(r){if(r==null&&(r="/"),hl(r))return r.getComponents();if(r instanceof Uint8Array)return BK(r);if(typeof r=="string")return r=r.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),r===""&&(r="/"),NK(r);if(Array.isArray(r))return r;throw new Xr("Must be a string, Uint8Array, Component[], or another Multiaddr")}function qfe(r){r.getComponents().forEach(e=>{let t=Pa.getProtocol(e.code);e.value!=null&&t.validate?.(e.value)})}var zfe,fL,DE,$K=_(()=>{Rr();UK();Gh();nt();PE();zfe=Symbol.for("nodejs.util.inspect.custom"),fL=Symbol.for("@multiformats/multiaddr");DE=class r{[fL]=!0;#e;#t;#r;constructor(e="/",t={}){this.#e=Vfe(e),t.validate!==!1&&qfe(this)}get bytes(){return this.#r==null&&(this.#r=OK(this.#e)),this.#r}toString(){return this.#t==null&&(this.#t=FK(this.#e)),this.#t}toJSON(){return this.toString()}getComponents(){return[...this.#e.map(e=>({...e}))]}encapsulate(e){let t=new r(e);return new r([...this.#e,...t.getComponents()],{validate:!1})}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new CE(`Address ${this.toString()} does not contain subaddress: ${t}`);return new r(n.slice(0,o),{validate:!1})}decapsulateCode(e){let t;for(let n=this.#e.length-1;n>-1;n--)if(this.#e[n].code===e){t=n;break}return new r(this.#e.slice(0,t),{validate:!1})}equals(e){return Le(this.bytes,e.bytes)}[zfe](){return`Multiaddr(${this.toString()})`}}});function hl(r){return!!r?.[fL]}function ye(r){return new DE(r)}var nt=_(()=>{$K();PE();G6()});var Ri,ub,Mz=_(()=>{Ri=class{entries;constructor(e){this.entries=e}},ub=class{partitions;nodes;constructor(e,t){this.partitions=e,this.nodes=t}}});var Na,up,HL=_(()=>{Na=class r{node;index;constructor(e,t){this.node=e,this.index=t}clone(){return new r(this.node,this.index)}},up=class r{branches;leafNode;leafIndex;on;version;constructor(e,t,n,o,s){this.branches=e,this.leafNode=t,this.leafIndex=n,this.on=o,this.version=s}isEqual(e){return this.leafNode===e.leafNode&&this.leafIndex===e.leafIndex&&this.on===e.on&&this.version===e.version}clone(){return new r(this.branches.map(e=>e.clone()),this.leafNode,this.leafIndex,this.on,this.version)}}});var ss,iS,aS,Lz=_(()=>{Mz();HL();ss=64,iS=class{keyFromEntry;compare;_root;_version=0;constructor(e=n=>n,t=(n,o)=>n<o?-1:n>o?1:0){this.keyFromEntry=e,this.compare=t,this._root=new Ri([])}first(){return this.getFirst(this._root)}last(){return this.getLast(this._root)}find(e){return this.getPath(this._root,e)}get(e){return this.at(this.find(e))}at(e){return this.validatePath(e),e.on?e.leafNode.entries[e.leafIndex]:void 0}*range(e){let t=e.first?this.findFirst(e):e.isAscending?this.first():this.last(),n=e.last?this.findLast(e):e.isAscending?this.last():this.first(),o=n.on?this.keyFromEntry(n.leafNode.entries[n.leafIndex]):void 0,s=e.isAscending?this.internalAscending(t):this.internalDescending(t),i=e.isAscending?1:-1;for(let a of s){if(!a.on||!n.on||this.compareKeys(this.keyFromEntry(a.leafNode.entries[a.leafIndex]),o)*i>0)break;yield a}}isValid(e){return e.version===this._version}insert(e){Object.freeze(e);let t=this.internalInsert(e);return t.on&&(t.version=++this._version),t}updateAt(e,t){this.validatePath(e),e.on&&Object.freeze(t);let n=this.internalUpdate(e,t);return n[0].on&&(n[0].version=++this._version),n}upsert(e){let t=this.find(this.keyFromEntry(e));return Object.freeze(e),t.on?t.leafNode.entries[t.leafIndex]=e:this.internalInsertAt(t,e),t.version=++this._version,t}merge(e,t){let n=this.keyFromEntry(e),o=this.find(n);return o.on?this.updateAt(o,t(o.leafNode.entries[o.leafIndex])):(this.internalInsertAt(o,Object.freeze(e)),o.on=!0,o.version=++this._version,[o,!1])}deleteAt(e){this.validatePath(e);let t=this.internalDelete(e);return t&&++this._version,t}ascending(e){return this.validatePath(e),this.internalAscending(e.clone())}descending(e){return this.validatePath(e),this.internalDescending(e.clone())}getCount(e){let t=0,n=e?e.path.clone():this.first();if(e?.ascending??!0)for(;n.on;)t+=n.leafNode.entries.length-n.leafIndex,n.leafIndex=n.leafNode.entries.length-1,this.internalNext(n);else for(;n.on;)t+=n.leafIndex+1,n.leafIndex=0,this.internalPrior(n);return t}next(e){let t=e.clone();return this.moveNext(t),t}moveNext(e){this.validatePath(e),this.internalNext(e)}prior(e){let t=e.clone();return this.movePrior(t),t}movePrior(e){this.validatePath(e),this.internalPrior(e)}compareKeys(e,t){let n=this.compare(e,t);if(n!==0&&n===this.compare(t,e))throw new Error("Inconsistent comparison function for given values");return n}*internalAscending(e){for(this.validatePath(e);e.on;)yield e,this.moveNext(e)}*internalDescending(e){for(this.validatePath(e);e.on;)yield e,this.movePrior(e)}findFirst(e){let t=this.find(e.first.key);return(!t.on||e.first&&!e.first.inclusive)&&(e.isAscending?this.internalNext(t):this.internalPrior(t)),t}findLast(e){let t=this.find(e.last.key);return(!t.on||e.last&&!e.last.inclusive)&&(e.isAscending?this.internalPrior(t):this.internalNext(t)),t}getPath(e,t){if(e instanceof Ri){let n=e,[o,s]=this.indexOfEntry(n.entries,t);return new up([],n,s,o,this._version)}else{let n=e,o=this.indexOfKey(n.partitions,t),s=this.getPath(n.nodes[o],t);return s.branches.unshift(new Na(n,o)),s}}indexOfEntry(e,t){let n=0,o=e.length-1,s=0,i=-1;for(;n<=o;){if(s=n+o>>>1,i=this.compareKeys(t,this.keyFromEntry(e[s])),i===0)return[!0,s];i<0?o=s-1:n=s+1}return[!1,n]}indexOfKey(e,t){let n=0,o=e.length-1,s=0,i=-1;for(;n<=o;){if(s=n+o>>>1,i=this.compareKeys(t,e[s]),i===0)return s+1;i<0?o=s-1:n=s+1}return n}internalNext(e){if(e.on)if(e.leafIndex>=e.leafNode.entries.length-1){let t=0,n=!1,o=e.branches.length-1;for(;t<=o&&!n;){let s=e.branches[o-t];s.index===s.node.partitions.length?++t:n=!0}if(!n)e.leafIndex=e.leafNode.entries.length,e.on=!1;else{e.branches.splice(-t,t);let s=e.branches.at(-1);++s.index,this.moveToFirst(s.node.nodes[s.index],e)}}else++e.leafIndex,e.on=!0;else if(e.on=e.branches.every(t=>t.index>=0&&t.index<t.node.nodes.length)&&e.leafIndex>=0&&e.leafIndex<e.leafNode.entries.length,e.on)return}internalPrior(e){if(this.validatePath(e),e.leafIndex<=0){let t=0,n=!1,o=e.branches.length-1;for(;t<=o&&!n;)e.branches[o-t].index===0?++t:n=!0;if(!n)e.leafIndex=0,e.on=!1;else{e.branches.splice(-t,t);let s=e.branches.at(-1);--s.index,this.moveToLast(s.node.nodes[s.index],e)}}else--e.leafIndex,e.on=!0}internalUpdate(e,t){if(e.on){let n=this.keyFromEntry(e.leafNode.entries[e.leafIndex]),o=this.keyFromEntry(t);if(this.compareKeys(n,o)!==0){let s=this.internalInsert(t);return s.on&&(this.internalDelete(this.find(n)),s=this.find(o)),[s,!1]}else e.leafNode.entries[e.leafIndex]=t}return[e,!0]}internalDelete(e){if(e.on){if(e.leafNode.entries.splice(e.leafIndex,1),e.branches.length>0){if(e.leafIndex===0&&e.leafNode.entries.length>0){let n=e.branches.at(-1);this.updatePartition(n.index,e,e.branches.length-1,this.keyFromEntry(e.leafNode.entries[e.leafIndex]))}let t=this.rebalanceLeaf(e);t&&(this._root=t)}return e.on=!1,!0}else return!1}internalInsert(e){let t=this.find(this.keyFromEntry(e));return t.on?(t.on=!1,t):(this.internalInsertAt(t,e),t.on=!0,t)}internalInsertAt(e,t){let n=this.leafInsert(e,t),o=e.branches.length-1;for(;n&&o>=0;)n=this.branchInsert(e,o,n),--o;if(n){let s=new ub([n.key],[this._root,n.right]);this._root=s,e.branches.unshift(new Na(s,n.indexDelta))}}moveToFirst(e,t){if(e instanceof Ri){let n=e;t.leafNode=n,t.leafIndex=0,t.on=n.entries.length>0}else t.branches.push(new Na(e,0)),this.moveToFirst(e.nodes[0],t)}moveToLast(e,t){if(e instanceof Ri){let n=e,o=n.entries.length;t.leafNode=n,t.on=o>0,t.leafIndex=o>0?o-1:0}else{let n=e,o=new Na(n,n.partitions.length);t.branches.push(o),this.moveToLast(n.nodes[o.index],t)}}getFirst(e){if(e instanceof Ri){let t=e;return new up([],t,0,t.entries.length>0,this._version)}else{let t=e,n=this.getFirst(t.nodes[0]);return n.branches.unshift(new Na(t,0)),n}}getLast(e){if(e instanceof Ri){let t=e,n=t.entries.length;return new up([],t,n>0?n-1:0,n>0,this._version)}else{let t=e,n=t.nodes.length-1,o=this.getLast(t.nodes[n]);return o.branches.unshift(new Na(t,n)),o}}leafInsert(e,t){let{leafNode:n,leafIndex:o}=e;if(n.entries.length<ss){n.entries.splice(o,0,t);return}let s=n.entries.length+1>>>1,i=n.entries.splice(s),a=new Ri(i),c=o<s?0:1;return c?(e.leafNode=a,e.leafIndex-=n.entries.length,a.entries.splice(e.leafIndex,0,t)):n.entries.splice(o,0,t),new aS(this.keyFromEntry(i[0]),a,c)}branchInsert(e,t,n){let o=e.branches[t],{index:s,node:i}=o;if(o.index+=n.indexDelta,i.partitions.splice(s,0,n.key),i.nodes.splice(s+1,0,n.right),i.nodes.length<=ss)return;let a=i.nodes.length>>>1,c=i.partitions.splice(a),l=i.partitions.pop(),d=i.nodes.splice(a),u=new ub(c,d),f=o.index<a?0:1;return f&&(o.index-=a,o.node=u),new aS(l,u,f)}rebalanceLeaf(e){if(e.leafNode.entries.length>=ss>>>1)return;let t=e.leafNode,n=e.branches.at(-1),o=e.branches.length-1,s=n.index,i=n.node,a=i.nodes[s+1];if(a&&a.entries.length>ss>>>1){let l=a.entries.shift();t.entries.push(l),this.updatePartition(s+1,e,o,this.keyFromEntry(a.entries[0]));return}let c=i.nodes[s-1];if(c&&c.entries.length>ss>>>1){let l=c.entries.pop();t.entries.unshift(l),this.updatePartition(s,e,o,this.keyFromEntry(l)),e.leafIndex+=1;return}if(a&&a.entries.length+t.entries.length<=ss)return t.entries.push(...a.entries),i.partitions.splice(s,1),i.nodes.splice(s+1,1),s===0&&this.updatePartition(s,e,o,this.keyFromEntry(t.entries[0])),this.rebalanceBranch(e,o);if(c&&c.entries.length+t.entries.length<=ss)return e.leafNode=c,e.leafIndex+=c.entries.length,c.entries.push(...t.entries),i.partitions.splice(s-1,1),i.nodes.splice(s,1),this.rebalanceBranch(e,o)}rebalanceBranch(e,t){let n=e.branches[t],o=n.node;if(t===0&&o.partitions.length===0)return e.branches[t+1]?.node??e.leafNode;if(t===0||o.nodes.length>=ss>>>1)return;let s=e.branches.at(t-1),i=s.index,a=s.node,c=a.nodes[i+1];if(c&&c.nodes.length>ss>>>1){o.partitions.push(a.partitions[i]);let d=c.nodes.shift();o.nodes.push(d);let u=c.partitions.shift();this.updatePartition(i+1,e,t-1,u);return}let l=a.nodes[i-1];if(l&&l.nodes.length>ss>>>1){o.partitions.unshift(a.partitions[i-1]);let d=l.nodes.pop();o.nodes.unshift(d);let u=l.partitions.pop();n.index+=1,this.updatePartition(i,e,t-1,u);return}if(c&&c.nodes.length+o.nodes.length<=ss){let d=a.partitions.splice(i,1)[0];return o.partitions.push(d),o.partitions.push(...c.partitions),o.nodes.push(...c.nodes),a.nodes.splice(i+1,1),i===0&&a.partitions.length>0&&this.updatePartition(i,e,t-1,a.partitions[0]),this.rebalanceBranch(e,t-1)}if(l&&l.nodes.length+o.nodes.length<=ss){n.node=l,n.index+=l.nodes.length;let d=a.partitions.splice(i-1,1)[0];return l.partitions.push(d),l.partitions.push(...o.partitions),l.nodes.push(...o.nodes),a.nodes.splice(i,1),this.rebalanceBranch(e,t-1)}}updatePartition(e,t,n,o){let s=t.branches[n];e>0?s.node.partitions[e-1]=o:n!==0&&this.updatePartition(t.branches[n-1].index,t,n-1,o)}validatePath(e){if(!this.isValid(e))throw new Error("Path is invalid due to mutation of the tree")}},aS=class{key;right;indexDelta;constructor(e,t,n){this.key=e,this.right=t,this.indexDelta=n}}});var Pz=_(()=>{});var Dz=_(()=>{Lz();Pz();HL()});var LKe,Bz=_(()=>{LKe=new Uint8Array(0)});function Fz(r,e,t){e=e||[],t=t||0;for(var n=t;r>=_he;)e[t++]=r&255|Oz,r/=128;for(;r&Rhe;)e[t++]=r&255|Oz,r>>>=7;return e[t]=r|0,Fz.bytes=t-n+1,e}function KL(r,n){var t=0,n=n||0,o=0,s=n,i,a=r.length;do{if(s>=a)throw KL.bytes=0,new RangeError("Could not decode varint");i=r[s++],t+=o<28?(i&Nz)<<o:(i&Nz)*Math.pow(2,o),o+=7}while(i>=Lhe);return KL.bytes=s-n,t}var The,Oz,khe,Rhe,_he,Mhe,Lhe,Nz,Phe,Dhe,Bhe,Ohe,Nhe,Fhe,Uhe,$he,Hhe,Khe,zhe,Vhe,zL,Uz=_(()=>{The=Fz,Oz=128,khe=127,Rhe=~khe,_he=Math.pow(2,31);Mhe=KL,Lhe=128,Nz=127;Phe=Math.pow(2,7),Dhe=Math.pow(2,14),Bhe=Math.pow(2,21),Ohe=Math.pow(2,28),Nhe=Math.pow(2,35),Fhe=Math.pow(2,42),Uhe=Math.pow(2,49),$he=Math.pow(2,56),Hhe=Math.pow(2,63),Khe=function(r){return r<Phe?1:r<Dhe?2:r<Bhe?3:r<Ohe?4:r<Nhe?5:r<Fhe?6:r<Uhe?7:r<$he?8:r<Hhe?9:10},zhe={encode:The,decode:Mhe,encodingLength:Khe},Vhe=zhe,zL=Vhe});function VL(r,e,t=0){return zL.encode(r,e,t),e}function qL(r){return zL.encodingLength(r)}var $z=_(()=>{Uz()});function Hz(r,e){let t=e.byteLength,n=qL(r),o=n+qL(t),s=new Uint8Array(o+t);return VL(r,s,0),VL(t,s,n),s.set(e,o),new jL(r,t,e,s)}var jL,Kz=_(()=>{Bz();$z();jL=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}}});function WL({name:r,code:e,encode:t,minDigestLength:n,maxDigestLength:o}){return new GL(r,e,t,n,o)}function zz(r,e,t){if(t!=null&&t!==r.byteLength){if(t>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t)}return Hz(e,r)}var Ghe,GL,Vz=_(()=>{Kz();Ghe=20;GL=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,o,s){this.name=e,this.code=t,this.encode=n,this.minDigestLength=o??Ghe,this.maxDigestLength=s}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?zz(n,this.code,t?.truncate):n.then(o=>zz(o,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}}});function qz(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var YL,KKe,jz=_(()=>{Vz();YL=WL({name:"sha2-256",code:18,encode:qz("SHA-256")}),KKe=WL({name:"sha2-512",code:19,encode:qz("SHA-512")})});async function fr(r){let e=r.toMultihash().bytes;return await YL.encode(e)}async function $t(r){return await YL.encode(r)}function hp(r){let e="";for(let t=0;t<r.length;t++)e+=Whe[r[t]];return e}function pp(r){return ee(r,"base64url")}function cS(r){let e=q(r,"base64url");if(e.length!==fp)throw new Error(`base64urlToCoord: expected ${fp} bytes, got ${e.length}`);return e}var fp,Whe,GKe,fb=_(()=>{jz();Nt();We();fp=32;Whe=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));GKe=new RegExp(`^[0-9a-fA-F]{${fp*2}}$`)});function Yhe(r){return{envelope:ee(r.envelope,"base64url"),confirmedAt:r.confirmedAt}}function XL(r){if(typeof r.envelope!="string")throw new Error("address record envelope is not a string");if(typeof r.confirmedAt!="number"||!Number.isFinite(r.confirmedAt))throw new Error(`address record confirmedAt is not a finite number: ${JSON.stringify(r.confirmedAt)}`);return{envelope:q(r.envelope,"base64url"),confirmedAt:r.confirmedAt}}function Xhe(r){if(r.length!==fp)throw new Error(`DigitreeStore: ring coordinate must be ${fp} bytes, got ${r.length}`)}function hb(r){let e=Gz.get(r.coord);if(e!==void 0&&e.id===r.id)return e.key;let t=`${hp(r.coord)}|${r.id}`;return Gz.set(r.coord,{id:r.id,key:t}),t}var Gz,gl,lS=_(()=>{Dz();We();Nt();fb();Gz=new WeakMap;gl=class{byKey;byId;membershipCounts=new Map;stateCounts=new Map;constructor(){this.byKey=new iS(e=>hb(e)),this.byId=new Map}bumpCount(e,t,n){let o=(e.get(t)??0)+n;o<=0?e.delete(t):e.set(t,o)}tally(e,t){this.bumpCount(this.membershipCounts,e.membership,t),this.bumpCount(this.stateCounts,e.state,t)}countByMembership(e){return this.membershipCounts.get(e)??0}countByState(e){return this.stateCounts.get(e)??0}put(e){Xhe(e.coord);let t=hb(e),n=this.byId.get(e.id);if(n!==void 0){let o=hb(n);if(o!==t){let s=this.byKey.find(o);s.on&&this.byKey.deleteAt(s)}}return this.byKey.upsert(e),this.byId.set(e.id,e),n&&this.tally(n,-1),this.tally(e,1),e}upsert(e,t){let n=Date.now(),o=this.getById(e);return o?this.put({...o,coord:t,lastAccess:n}):this.put({id:e,coord:t,relevance:0,lastAccess:n,state:"disconnected",membership:"unknown",negotiateFailures:0,lastNegotiateFailureAt:0,contactFailures:0,lastContactFailureAt:0,accessCount:0,successCount:0,failureCount:0,avgLatencyMs:null})}update(e,t){let n=this.getById(e);n&&this.put({...n,...t})}getById(e){return this.byId.get(e)}remove(e){let t=this.byId.get(e);if(!t)return;let n=this.byKey.find(hb(t));n.on&&(this.tally(this.byKey.at(n),-1),this.byKey.deleteAt(n)),this.byId.delete(e)}list(){let e=[];for(let t of this.byKey.ascending(this.byKey.first()))e.push(this.byKey.at(t));return e}size(){return this.byId.size}setState(e,t){this.update(e,{state:t})}setMembership(e,t){this.update(e,{membership:t})}ceilPath(e){let t=`${e}|\0`,n=this.byKey.find(t);return n.on||(n=this.byKey.next(n)),n}floorPath(e){let t=`${e}|\uFFFF`,n=this.byKey.find(t);return n.on||(n=this.byKey.prior(n)),n}*walkRing(e,t,n,o){let s=t==="next"?l=>this.byKey.next(l):l=>this.byKey.prior(l),i=t==="next"?()=>this.byKey.first():()=>this.byKey.last(),a=e,c=0;for(;c<n;){if(!a.on&&(a=i(),!a.on))return;let l=this.byKey.at(a);c++,(!o||o(l))&&(yield l),a=s(a)}}collectRing(e,t,n,o){let s=new Set;if(n<=0)return[];let i=o?this.size():Number.POSITIVE_INFINITY;for(let a of this.walkRing(e,t,i,o))if(s.has(a.id)||(s.add(a.id),s.size>=n))break;return Array.from(s)}successorOfCoord(e,t){let n=this.ceilPath(hp(e));for(let o of this.walkRing(n,"next",this.size(),t))return o}predecessorOfCoord(e,t){let n=this.floorPath(hp(e));for(let o of this.walkRing(n,"prior",this.size(),t))return o}neighborsRight(e,t,n){return this.collectRing(this.ceilPath(hp(e)),"next",t,n)}neighborsLeft(e,t,n){return this.collectRing(this.floorPath(hp(e)),"prior",t,n)}walkFrom(e,t,n){let o=[],s=e,i=this.size();if(t<=0||i===0)return{entries:o,next:s};let a=e?this.byKey.next(this.byKey.find(e.key)):this.byKey.first();for(let c of this.walkRing(a,"next",i,n))if(o.push(c),s={key:hb(c)},o.length>=t)break;return{entries:o,next:s}}exportEntries(){return this.list().map(e=>({id:e.id,coord:pp(e.coord),relevance:e.relevance,lastAccess:e.lastAccess,state:e.state,membership:e.membership,negotiateFailures:e.negotiateFailures,contactFailures:e.contactFailures,accessCount:e.accessCount,successCount:e.successCount,failureCount:e.failureCount,avgLatencyMs:e.avgLatencyMs,...e.metadata?{metadata:e.metadata}:{},...e.addressRecord?{addressRecord:Yhe(e.addressRecord)}:{}}))}importEntries(e){let t=e.map(o=>({s:o,coord:cS(o.coord),addressRecord:o.addressRecord?XL(o.addressRecord):void 0})),n=new Set;for(let{s:o,coord:s,addressRecord:i}of t){let a={id:o.id,coord:s,relevance:o.relevance,lastAccess:o.lastAccess,state:"disconnected",membership:o.membership??"unknown",negotiateFailures:0,lastNegotiateFailureAt:0,contactFailures:0,lastContactFailureAt:0,accessCount:o.accessCount,successCount:o.successCount,failureCount:o.failureCount,avgLatencyMs:o.avgLatencyMs??null,...o.metadata?{metadata:o.metadata}:{},...i?{addressRecord:i}:{}};this.put(a),n.add(a.id)}return n.size}}});function cu(r){if(r<Zhe)return 1;if(r<Qhe)return 2;if(r<Jhe)return 3;if(r<ZL)return 4;if(r<QL)return 5;if(r<JL)return 6;if(r<eP)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function epe(r,e,t=0){switch(cu(r)){case 8:e[t++]=r&255|it,r/=128;case 7:e[t++]=r&255|it,r/=128;case 6:e[t++]=r&255|it,r/=128;case 5:e[t++]=r&255|it,r/=128;case 4:e[t++]=r&255|it,r>>>=7;case 3:e[t++]=r&255|it,r>>>=7;case 2:e[t++]=r&255|it,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function tpe(r,e,t=0){switch(cu(r)){case 8:e.set(t++,r&255|it),r/=128;case 7:e.set(t++,r&255|it),r/=128;case 6:e.set(t++,r&255|it),r/=128;case 5:e.set(t++,r&255|it),r/=128;case 4:e.set(t++,r&255|it),r>>>=7;case 3:e.set(t++,r&255|it),r>>>=7;case 2:e.set(t++,r&255|it),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function rpe(r,e){let t=r[e],n=0;if(n+=t&hn,t<it||(t=r[e+1],n+=(t&hn)<<7,t<it)||(t=r[e+2],n+=(t&hn)<<14,t<it)||(t=r[e+3],n+=(t&hn)<<21,t<it)||(t=r[e+4],n+=(t&hn)*ZL,t<it)||(t=r[e+5],n+=(t&hn)*QL,t<it)||(t=r[e+6],n+=(t&hn)*JL,t<it)||(t=r[e+7],n+=(t&hn)*eP,t<it))return n;throw new RangeError("Could not decode varint")}function npe(r,e){let t=r.get(e),n=0;if(n+=t&hn,t<it||(t=r.get(e+1),n+=(t&hn)<<7,t<it)||(t=r.get(e+2),n+=(t&hn)<<14,t<it)||(t=r.get(e+3),n+=(t&hn)<<21,t<it)||(t=r.get(e+4),n+=(t&hn)*ZL,t<it)||(t=r.get(e+5),n+=(t&hn)*QL,t<it)||(t=r.get(e+6),n+=(t&hn)*JL,t<it)||(t=r.get(e+7),n+=(t&hn)*eP,t<it))return n;throw new RangeError("Could not decode varint")}function Wz(r,e,t=0){return e==null&&(e=Pe(cu(r))),e instanceof Uint8Array?epe(r,e,t):tpe(r,e,t)}function dS(r,e=0){return r instanceof Uint8Array?rpe(r,e):npe(r,e)}var Zhe,Qhe,Jhe,ZL,QL,JL,eP,it,hn,uS=_(()=>{pt();Zhe=Math.pow(2,7),Qhe=Math.pow(2,14),Jhe=Math.pow(2,21),ZL=Math.pow(2,28),QL=Math.pow(2,35),JL=Math.pow(2,42),eP=Math.pow(2,49),it=128,hn=127});function Xz(r,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let t=0;for(let n of r){let o=t+n.byteLength;if(e<o)return{buf:n,index:e-t};t=o}throw new RangeError("index is out of bounds")}function fS(r){return!!r?.[Zz]}var Zz,mp,tP=_(()=>{pt();Ms();Rr();Zz=Symbol.for("@achingbrain/uint8arraylist");mp=class r{bufs;length;[Zz]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let t=0;for(let n of e)if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.push(n);else if(fS(n))t+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}prepend(...e){this.prependAll(e)}prependAll(e){let t=0;for(let n of e.reverse())if(n instanceof Uint8Array)t+=n.byteLength,this.bufs.unshift(n);else if(fS(n))t+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=t}get(e){let t=Xz(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Xz(this.bufs,e);n.buf[n.index]=t}write(e,t=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(t+n,e[n]);else if(fS(e))for(let n=0;n<e.length;n++)this.set(t+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,t){let{bufs:n,length:o}=this._subList(e,t);return Ot(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:Ot(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),s=new r;return s.length=o,s.bufs=[...n],s}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let s=0;s<this.bufs.length;s++){let i=this.bufs[s],a=o,c=a+i.byteLength;if(o=c,e>=c)continue;let l=e>=a&&e<c,d=t>a&&t<=c;if(l&&d){if(e===a&&t===c){n.push(i);break}let u=e-a;n.push(i.subarray(u,u+(t-e)));break}if(l){if(e===0){n.push(i);continue}n.push(i.subarray(e-a));continue}if(d){if(t===c){n.push(i);break}n.push(i.subarray(0,t-a));break}n.push(i)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!fS(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let s=256,i=new Int32Array(s);for(let u=0;u<s;u++)i[u]=-1;for(let u=0;u<o;u++)i[n[u]]=u;let a=i,c=this.byteLength-n.byteLength,l=n.byteLength-1,d;for(let u=t;u<=c;u+=d){d=0;for(let f=l;f>=0;f--){let h=this.get(u+f);if(n[f]!==h){d=Math.max(1,f-a[h]);break}}if(d===0)return u}return-1}getInt8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getInt8(0)}setInt8(e,t){let n=Pe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,t),this.write(n,e)}getInt16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,t)}setInt16(e,t,n){let o=ae(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt16(0,t,n),this.write(o,e)}getInt32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,t)}setInt32(e,t,n){let o=ae(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setInt32(0,t,n),this.write(o,e)}getBigInt64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,t)}setBigInt64(e,t,n){let o=ae(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigInt64(0,t,n),this.write(o,e)}getUint8(e){let t=this.subarray(e,e+1);return new DataView(t.buffer,t.byteOffset,t.byteLength).getUint8(0)}setUint8(e,t){let n=Pe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,t),this.write(n,e)}getUint16(e,t){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,t)}setUint16(e,t,n){let o=ae(2);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint16(0,t,n),this.write(o,e)}getUint32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,t)}setUint32(e,t,n){let o=ae(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setUint32(0,t,n),this.write(o,e)}getBigUint64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,t)}setBigUint64(e,t,n){let o=ae(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setBigUint64(0,t,n),this.write(o,e)}getFloat32(e,t){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,t)}setFloat32(e,t,n){let o=ae(4);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat32(0,t,n),this.write(o,e)}getFloat64(e,t){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,t)}setFloat64(e,t,n){let o=ae(8);new DataView(o.buffer,o.byteOffset,o.byteLength).setFloat64(0,t,n),this.write(o,e)}equals(e){if(e==null||!(e instanceof r)||e.bufs.length!==this.bufs.length)return!1;for(let t=0;t<this.bufs.length;t++)if(!Le(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,s)=>o+s.byteLength,0)),n.length=t,n}}});var rP=_(()=>{});var hS,gp,pS,pb,nP=_(()=>{hS=class extends Error{name="InvalidMessageLengthError";code="ERR_INVALID_MSG_LENGTH"},gp=class extends Error{name="InvalidDataLengthError";code="ERR_MSG_DATA_TOO_LONG"},pS=class extends Error{name="InvalidDataLengthLengthError";code="ERR_MSG_LENGTH_TOO_LONG"},pb=class extends Error{name="UnexpectedEOFError";code="ERR_UNEXPECTED_EOF"}});function mS(r){return r[Symbol.asyncIterator]!=null}var oP=_(()=>{});function Qz(r,e){if(r.byteLength>e)throw new gp("Message length too long")}function bS(r,e){e=e??{};let t=e.lengthEncoder??yS,n=e?.maxDataLength??4194304;function*o(s){Qz(s,n);let i=t(s.byteLength);i instanceof Uint8Array?yield i:yield*i,s instanceof Uint8Array?yield s:yield*s}return mS(r)?(async function*(){for await(let s of r)yield*o(s)})():(function*(){for(let s of r)yield*o(s)})()}var yS,Jz=_(()=>{uS();tP();pt();rP();nP();oP();yS=r=>{let e=cu(r),t=Pe(e);return Wz(r,t),yS.bytes=e,t};yS.bytes=0;bS.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??yS,n=e?.maxDataLength??4194304;return Qz(r,n),new mp(t(r.byteLength),r)}});function mb(r,e){let t=new mp,n=lu.LENGTH,o=-1,s=e?.lengthDecoder??sP,i=e?.maxLengthLength??8,a=e?.maxDataLength??4194304;function*c(){for(;t.byteLength>0;){if(n===lu.LENGTH)try{if(o=s(t),o<0)throw new hS("Invalid message length");if(o>a)throw new gp("Message length too long");let l=s.bytes;t.consume(l),e?.onLength!=null&&e.onLength(o),n=lu.DATA}catch(l){if(l instanceof RangeError){if(t.byteLength>i)throw new pS("Message length length too long");break}throw l}if(n===lu.DATA){if(t.byteLength<o)break;let l=t.sublist(0,o);t.consume(o),e?.onData!=null&&e.onData(l),yield l,n=lu.LENGTH}}}return mS(r)?(async function*(){for await(let l of r)t.append(l),yield*c();if(t.byteLength>0)throw new pb("Unexpected end of input")})():(function*(){for(let l of r)t.append(l),yield*c();if(t.byteLength>0)throw new pb("Unexpected end of input")})()}var lu,sP,eV=_(()=>{uS();tP();rP();nP();oP();(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(lu||(lu={}));sP=r=>{let e=dS(r);return sP.bytes=cu(e),e};sP.bytes=0;mb.fromReader=(r,e)=>{let t=1,n=(async function*(){for(;;)try{let{done:s,value:i}=await r.next(t);if(s===!0)return;i!=null&&(yield i)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{t=1}})();return mb(n,{...e??{},onLength:s=>{t=s}})}});var tV=_(()=>{Jz();eV()});function ipe(r,e){let t=iP[e],n=rV[e];for(let o=0;o<r.length;o++)n^=BigInt(r[o]),n=BigInt.asUintN(e,n*t);return n}function ape(r,e,t){if(t.length===0)throw new Error("The `utf8Buffer` option must have a length greater than zero");let n=iP[e],o=rV[e],s=r;for(;s.length>0;){let i=nV.encodeInto(s,t);s=s.slice(i.read);for(let a=0;a<i.written;a++)o^=BigInt(t[a]),o=BigInt.asUintN(e,o*n)}return o}function aP(r,{size:e=32,utf8Buffer:t}={}){if(!iP[e])throw new Error("The `size` option must be one of 32, 64, 128, 256, 512, or 1024");if(typeof r=="string"){if(t)return ape(r,e,t);r=nV.encode(r)}return ipe(r,e)}var iP,rV,nV,oV=_(()=>{iP={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},rV={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},nV=new globalThis.TextEncoder});function cpe(r){let e=r.toString(16);return e.length%2===1&&(e=`0${e}`),q(e,"base16")}var gb,cP=_(()=>{oV();We();gb={hash:r=>Number(aP(r,{size:32})),hashV:(r,e)=>cpe(gb.hash(r,e))}});var lP,qs,dP=_(()=>{pt();Rr();lP=64,qs=class{fp;h;seed;constructor(e,t,n,o=2){if(o>lP)throw new TypeError("Invalid Fingerprint Size");let s=t.hashV(e,n),i=ae(o);for(let a=0;a<i.length;a++)i[a]=s[a];i.length===0&&(i[0]=7),this.fp=i,this.h=t,this.seed=n}hash(){return this.h.hash(this.fp,this.seed)}equals(e){return e?.fp instanceof Uint8Array?Le(this.fp,e.fp):!1}}});function du(r,e){return Math.floor(Math.random()*(e-r))+r}var wS=_(()=>{});var uu,sV=_(()=>{dP();wS();uu=class{contents;constructor(e){this.contents=new Array(e).fill(null)}has(e){if(!(e instanceof qs))throw new TypeError("Invalid Fingerprint");return this.contents.some(t=>e.equals(t))}add(e){if(!(e instanceof qs))throw new TypeError("Invalid Fingerprint");for(let t=0;t<this.contents.length;t++)if(this.contents[t]==null)return this.contents[t]=e,!0;return!0}swap(e){if(!(e instanceof qs))throw new TypeError("Invalid Fingerprint");let t=du(0,this.contents.length-1),n=this.contents[t];return this.contents[t]=e,n}remove(e){if(!(e instanceof qs))throw new TypeError("Invalid Fingerprint");let t=this.contents.findIndex(n=>e.equals(n));return t>-1?(this.contents[t]=null,!0):!1}}});function upe(r=.001){return r>.002?2:r>1e-5?4:8}function iV(r,e=.001){let t=upe(e),n=dpe[t],o=Math.round(r/n),s=Math.min(Math.ceil(Math.log2(1/e)+Math.log2(2*t)),lP);return{filterSize:o,bucketSize:t,fingerprintSize:s}}var lpe,yb,dpe,aV=_(()=>{We();sV();dP();cP();wS();lpe=500,yb=class{bucketSize;filterSize;fingerprintSize;buckets;count;hash;seed;constructor(e){this.filterSize=e.filterSize,this.bucketSize=e.bucketSize??4,this.fingerprintSize=e.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=e.hash??gb,this.seed=e.seed??du(0,Math.pow(2,10))}add(e){typeof e=="string"&&(e=q(e));let t=new qs(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,o=(n^t.hash())%this.filterSize;if(this.buckets[n]==null&&(this.buckets[n]=new uu(this.bucketSize)),this.buckets[o]==null&&(this.buckets[o]=new uu(this.bucketSize)),this.buckets[n].add(t)||this.buckets[o].add(t))return this.count++,!0;let s=[n,o],i=s[du(0,s.length-1)];this.buckets[i]==null&&(this.buckets[i]=new uu(this.bucketSize));for(let a=0;a<lpe;a++){let c=this.buckets[i].swap(t);if(c!=null&&(i=(i^c.hash())%this.filterSize,this.buckets[i]==null&&(this.buckets[i]=new uu(this.bucketSize)),this.buckets[i].add(c)))return this.count++,!0}return!1}has(e){typeof e=="string"&&(e=q(e));let t=new qs(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,o=this.buckets[n]?.has(t)??!1;if(o)return o;let s=(n^t.hash())%this.filterSize;return this.buckets[s]?.has(t)??!1}remove(e){typeof e=="string"&&(e=q(e));let t=new qs(e,this.hash,this.seed,this.fingerprintSize),n=this.hash.hash(e,this.seed)%this.filterSize,o=this.buckets[n]?.remove(t)??!1;if(o)return this.count--,o;let s=(n^t.hash())%this.filterSize,i=this.buckets[s]?.remove(t)??!1;return i&&this.count--,i}get reliable(){return Math.floor(100*(this.count/this.filterSize))<=90}},dpe={1:.5,2:.84,4:.95,8:.98}});function fu(r,e=.001,t){return new xS({...iV(r,e),...t??{}})}var xS,cV=_(()=>{We();aV();cP();wS();xS=class{filterSize;bucketSize;fingerprintSize;scale;filterSeries;hash;seed;constructor(e){this.bucketSize=e.bucketSize??4,this.filterSize=e.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=e.fingerprintSize??2,this.scale=e.scale??2,this.hash=e.hash??gb,this.seed=e.seed??du(0,Math.pow(2,10)),this.filterSeries=[new yb({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(e){if(typeof e=="string"&&(e=q(e)),this.has(e))return!0;let t=this.filterSeries.find(n=>n.reliable);if(t==null){let n=this.filterSize*Math.pow(this.scale,this.filterSeries.length);t=new yb({filterSize:n,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(t)}return t.add(e)}has(e){typeof e=="string"&&(e=q(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].has(e))return!0;return!1}remove(e){typeof e=="string"&&(e=q(e));for(let t=0;t<this.filterSeries.length;t++)if(this.filterSeries[t].remove(e))return!0;return!1}get count(){return this.filterSeries.reduce((e,t)=>e+t.count,0)}}});var lV=_(()=>{cV()});function uP(r){let e=r.getComponents(),t={},n=0;return e[n]?.name==="ip6zone"&&(t.zone=`${e[n].value}`,n++),e[n]?.name==="ip4"||e[n]?.name==="ip6"||e[n]?.name==="dns"||e[n]?.name==="dns4"||e[n]?.name==="dns6"?(t.type=e[n].name,t.host=e[n].value,n++):e[n]?.name==="dnsaddr"&&(t.type=e[n].name,t.host=`_dnsaddr.${e[n].value}`,n++),(e[n]?.name==="tcp"||e[n]?.name==="udp")&&(t.protocol=e[n].name==="tcp"?"tcp":"udp",t.port=parseInt(`${e[n].value}`),n++),e[n]?.name==="ipcidr"&&(t.type==="ip4"?t.cidr=parseInt(`${e[n].value}`):t.type==="ip6"&&(t.cidr=`${e[n].value}`),n++),t.type==null||t.host==null?null:(e[n]?.name==="tls"&&e[n+1]?.name==="sni"&&(t.sni=e[n+1].value,n+=2),t)}function Me(r){let e=uP(r);if(e==null)throw new re(`Multiaddr ${r} was not an IPv4, IPv6, DNS, DNS4, DNS6 or DNSADDR address`);return e}var hu=_(()=>{ge()});function dV(r,e,t){let n=0;for(let o of r)if(!(n<e)){if(n>t)break;if(o!==255)return!1;n++}return!0}function uV(r,e,t,n){let o=0;for(let s of r)if(!(o<t)){if(o>n)break;if(s!==e[o])return!1;o++}return!0}function fP(r){switch(r.length){case pu:return r.join(".");case mu:{let e=[];for(let t=0;t<r.length;t++)t%2===0&&e.push(r[t].toString(16).padStart(2,"0")+r[t+1].toString(16).padStart(2,"0"));return e.join(":")}default:throw new Error("Invalid ip length")}}function fV(r){let e=0;for(let[t,n]of r.entries()){if(n===255){e+=8;continue}for(;(n&128)!=0;)e++,n=n<<1;if((n&128)!=0)return-1;for(let o=t+1;o<r.length;o++)if(r[o]!=0)return-1;break}return e}function hV(r){let e="0x";for(let t of r)e+=(t>>4).toString(16)+(t&15).toString(16);return e}var vS=_(()=>{bb()});function wb(r,e){e.length===mu&&r.length===pu&&dV(e,0,11)&&(e=e.slice(12)),e.length===pu&&r.length===mu&&uV(r,fpe,0,11)&&(r=r.slice(12));let t=r.length;if(t!=e.length)throw new Error("Failed to mask ip");let n=new Uint8Array(t);for(let o=0;o<t;o++)n[o]=r[o]&e[o];return n}function pV(r,e){if(typeof e=="string"&&(e=Yh(e)),e==null)throw new Error("Invalid ip");if(e.length!==r.network.length)return!1;for(let t=0;t<e.length;t++)if((r.network[t]&r.mask[t])!==(e[t]&r.mask[t]))return!1;return!0}var pu,mu,Zze,fpe,bb=_(()=>{Yy();vS();pu=4,mu=16,Zze=parseInt("0xFFFF",16),fpe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255])});function hP(r){let[e,t]=r.split("/");if(!e||!t)throw new Error("Failed to parse given CIDR: "+r);let n=pu,o=TE(e);if(o==null&&(n=mu,o=kE(e),o==null))throw new Error("Failed to parse given CIDR: "+r);let s=parseInt(t,10);if(Number.isNaN(s)||String(s).length!==t.length||s<0||s>n*8)throw new Error("Failed to parse given CIDR: "+r);let i=pP(s,8*n);return{network:wb(o,i),mask:i}}function pP(r,e){if(e!==8*pu&&e!==8*mu)throw new Error("Invalid CIDR mask");if(r<0||r>e)throw new Error("Invalid CIDR mask");let t=e/8,n=new Uint8Array(t);for(let o=0;o<t;o++){if(r>=8){n[o]=255,r-=8;continue}n[o]=255-(255>>r),r=0}return n}var mP=_(()=>{Yy();bb()});var gu,gP=_(()=>{Yy();mP();bb();vS();gu=class{constructor(e,t){if(t==null)({network:this.network,mask:this.mask}=hP(e));else{let n=Yh(e);if(n==null)throw new Error("Failed to parse network");t=String(t);let o=parseInt(t,10);if(Number.isNaN(o)||String(o).length!==t.length||o<0||o>n.length*8){let s=Yh(t);if(s==null)throw new Error("Failed to parse mask");this.mask=s}else this.mask=pP(o,8*n.length);this.network=wb(n,this.mask)}}contains(e){return pV({network:this.network,mask:this.mask},e)}toString(){let e=fV(this.mask),t=e!==-1?String(e):hV(this.mask);return fP(this.network)+"/"+t}}});function yP(r,e){return new gu(r).contains(e)}var ES=_(()=>{gP();vS();bb();gP();mP()});function SS(r){try{let e=Me(r);return e.type==="ip6"?yP("2000::/3",e.host):!1}catch{return!1}}var mV=_(()=>{ES();hu()});function gV(r){try{let e=Me(r);switch(e.type){case"ip4":return e.host.startsWith("169.254.");case"ip6":return e.host.toLowerCase().startsWith("fe80");default:return!1}}catch{return!1}}var yV=_(()=>{hu()});function bV(r){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(r)||/^::1$/.test(r)}var wV=_(()=>{});function xb(r){try{let e=Me(r);switch(e.type){case"ip4":case"ip6":return bV(e.host);default:return!1}}catch{return!1}}var bP=_(()=>{wV();hu()});function Zr(r){return uP(r)!==null}var xV=_(()=>{hu()});var vV=vr(vb=>{(function(){var r,e,t,n,o,s,i,a;a=function(c){var l,d,u,f;return l=(c&255<<24)>>>24,d=(c&255<<16)>>>16,u=(c&65280)>>>8,f=c&255,[l,d,u,f].join(".")},i=function(c){var l,d,u,f,h,m;for(l=[],u=f=0;f<=3&&c.length!==0;u=++f){if(u>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}m=e(c),h=m[0],d=m[1],c=c.substring(d),l.push(h)}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"),o=t("A"),e=function(c){var l,d,u,f,h;for(f=0,l=10,d="9",u=0,c.length>1&&c[u]==="0"&&(c[u+1]==="x"||c[u+1]==="X"?(u+=2,l=16):"0"<=c[u+1]&&c[u+1]<="9"&&(u++,l=8,d="7")),h=u;u<c.length;){if("0"<=c[u]&&c[u]<=d)f=f*l+(t(c[u])-n)>>>0;else if(l===16)if("a"<=c[u]&&c[u]<="f")f=f*l+(10+t(c[u])-s)>>>0;else if("A"<=c[u]&&c[u]<="F")f=f*l+(10+t(c[u])-o)>>>0;else break;else break;if(f>4294967295)throw new Error("too large");u++}if(u===h)throw new Error("empty octet");return[f,u]},r=(function(){function c(l,d){var u,f,h,m;if(typeof l!="string")throw new Error("Missing `net' parameter");if(d||(m=l.split("/",2),l=m[0],d=m[1]),d||(d=32),typeof d=="string"&&d.indexOf(".")>-1){try{this.maskLong=i(d)}catch(y){throw u=y,new Error("Invalid mask: "+d)}for(f=h=32;h>=0;f=--h)if(this.maskLong===4294967295<<32-f>>>0){this.bitmask=f;break}}else if(d||d===0)this.bitmask=parseInt(d,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(i(l)&this.maskLong)>>>0}catch(y){throw u=y,new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+d);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):(i(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 d,u,f;for(f=i(this.first),u=i(this.last),d=0;f<=u;)l(a(f),f,d),d++,f++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c})(),vb.ip2long=i,vb.long2ip=a,vb.Netmask=r}).call(vb)});function wP(r){for(let e of ppe)if(e.contains(r))return!0;return!1}function mpe(r){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(r)}function gpe(r){let e=r.split(":");if(e.length<2)return!1;let t=e[e.length-1].padStart(4,"0"),n=e[e.length-2].padStart(4,"0"),o=`${parseInt(n.substring(0,2),16)}.${parseInt(n.substring(2),16)}.${parseInt(t.substring(0,2),16)}.${parseInt(t.substring(2),16)}`;return wP(o)}function ype(r){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)}function bpe(r){let e=r.split(":"),t=e[e.length-1];return wP(t)}function wpe(r){return/^::$/.test(r)||/^::1$/.test(r)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(r)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(r)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(r)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(r)||/^ff([0-9a-fA-F]{2,2}):/i.test(r)}function yp(r){if(ts(r))return wP(r);if(mpe(r))return gpe(r);if(ype(r))return bpe(r);if(Xh(r))return wpe(r)}var EV,hpe,ppe,xP=_(()=>{ul();EV=gc(vV(),1),hpe=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],ppe=hpe.map(r=>new EV.Netmask(r))});function pn(r){try{let e=Me(r);switch(e.type){case"ip4":case"ip6":return yp(e.host)??!1;default:return e.host==="localhost"}}catch{return!1}}var vP=_(()=>{xP();hu()});function yt(...r){function e(o){if(o==null)return!1;let s=o.getComponents();for(let i of r){let a=i.match(s);if(a===!1)return!1;s=a}return s}function t(o){return e(o)!==!1}function n(o){let s=e(o);return s===!1?!1:s.length===0}return{matchers:r,matches:t,exactMatch:n}}var gt,we,SV,Fe,mn,ze,EP=_(()=>{gt=r=>({match:e=>{let t=e[0];return t==null||t.code!==r||t.value!=null?!1:e.slice(1)}}),we=(r,e)=>({match:t=>{let n=t[0];return n?.code!==r||n.value==null||e!=null&&n.value!==e?!1:t.slice(1)}}),SV=r=>({match:e=>r.match(e)===!1?e:!1}),Fe=r=>({match:e=>{let t=r.match(e);return t===!1?e:t}}),mn=(...r)=>({match:e=>{let t;for(let n of r){let o=n.match(e);o!==!1&&(t==null||o.length<t.length)&&(t=o)}return t??!1}}),ze=(...r)=>({match:e=>{for(let t of r){let n=t.match(e);if(n===!1)return!1;e=n}return e}})});var xpe,CV,IS,AS,TS,CP,BVe,OVe,NVe,IV,AV,TV,IP,bp,kV,AP,TP,RV,kP,Eb,yu,FVe,RP,kS,vpe,UVe,_V,SP,MV,bu,LV,Sb,PV,_P,DV,MP,CS,RS,Epe,Dn,Spe,LP,Cpe,$Ve,Ipe,HVe,Ape,KVe,Tpe,zVe,Xn=_(()=>{nt();EP();xpe=we(421),CV=yt(xpe),IS=we(54),AS=we(55),TS=we(56),CP=we(53),BVe=yt(IS,Fe(we(421))),OVe=yt(AS,Fe(we(421))),NVe=yt(TS,Fe(we(421))),IV=yt(mn(CP,TS,IS,AS),Fe(we(421))),AV=ze(we(4),Fe(we(43))),TV=ze(Fe(we(42)),we(41),Fe(we(43))),IP=mn(AV,TV),bp=mn(IP,CP,IS,AS,TS),kV=yt(mn(IP,ze(mn(CP,TS,IS,AS),Fe(we(421))))),AP=yt(AV),TP=yt(TV),RV=yt(IP),kP=ze(bp,we(6)),Eb=ze(bp,we(273)),yu=yt(ze(kP,Fe(we(421)))),FVe=yt(Eb),RP=ze(Eb,gt(460),Fe(we(421))),kS=ze(Eb,gt(461),Fe(we(421))),vpe=mn(RP,kS),UVe=yt(RP),_V=yt(kS),SP=mn(bp,kP,Eb,RP,kS),MV=mn(ze(SP,gt(477),Fe(we(421)))),bu=yt(MV),LV=mn(ze(SP,gt(478),Fe(we(421))),ze(SP,gt(448),Fe(we(449)),gt(477),Fe(we(421)))),Sb=yt(LV),PV=ze(Eb,gt(280),Fe(we(466)),Fe(we(466)),Fe(we(421))),_P=yt(PV),DV=ze(kS,gt(465),Fe(we(466)),Fe(we(466)),Fe(we(421))),MP=yt(DV),CS=mn(MV,LV,ze(kP,Fe(we(421))),ze(vpe,Fe(we(421))),ze(bp,Fe(we(421))),PV,DV,we(421)),RS=yt(CS),Epe=ze(Fe(CS),gt(290),SV(gt(281)),Fe(we(421))),Dn=yt(Epe),Spe=mn(ze(CS,gt(290),gt(281),Fe(we(421))),ze(CS,gt(281),Fe(we(421))),ze(gt(281),Fe(we(421)))),LP=yt(Spe),Cpe=ze(bp,mn(ze(we(6,"80")),ze(we(6),gt(480)),gt(480)),Fe(we(481)),Fe(we(421))),$Ve=yt(Cpe),Ipe=ze(bp,mn(ze(we(6,"443")),ze(we(6,"443"),gt(480)),ze(we(6),gt(443)),ze(we(6),gt(448),gt(480)),ze(gt(448),gt(480)),gt(448),gt(443)),Fe(we(481)),Fe(we(421))),HVe=yt(Ipe),Ape=mn(ze(we(777),Fe(we(421)))),KVe=yt(Ape),Tpe=mn(ze(we(400),Fe(we(421)))),zVe=yt(Tpe)});function BV(r,e){let t=yu.exactMatch(r),n=yu.exactMatch(e);if(t&&!n)return-1;if(!t&&n)return 1;let o=Sb.exactMatch(r),s=Sb.exactMatch(e);if(o&&!s)return-1;if(!o&&s)return 1;let i=bu.exactMatch(r),a=bu.exactMatch(e);if(i&&!a)return-1;if(!i&&a)return 1;let c=LP.exactMatch(r),l=LP.exactMatch(e);if(c&&!l)return-1;if(!c&&l)return 1;let d=_P.exactMatch(r),u=_P.exactMatch(e);if(d&&!u)return-1;if(!d&&u)return 1;let f=MP.exactMatch(r),h=MP.exactMatch(e);return f&&!h?-1:!f&&h?1:0}function OV(r,e){let t=xb(r),n=xb(e);return t&&!n?1:!t&&n?-1:0}function NV(r,e){let t=pn(r),n=pn(e);return t&&!n?1:!t&&n?-1:0}function FV(r,e){let t=Dn.exactMatch(r),n=Dn.exactMatch(e);return t&&!n?1:!t&&n?-1:0}var UV=_(()=>{Xn();bP();vP()});var $V=_(()=>{hu();mV();yV();bP();xV();vP();UV()});function Cb(r,e){let{milliseconds:t,fallback:n,message:o,customTimers:s={setTimeout,clearTimeout},signal:i}=e,a,c,d=new Promise((u,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(i?.aborted){f(HV(i));return}if(i&&(c=()=>{f(HV(i))},i.addEventListener("abort",c,{once:!0})),r.then(u,f),t===Number.POSITIVE_INFINITY)return;let h=new PP;a=s.setTimeout.call(void 0,()=>{if(n){try{u(n())}catch(m){f(m)}return}typeof r.cancel=="function"&&r.cancel(),o===!1?u():o instanceof Error?f(o):(h.message=o??`Promise timed out after ${t} milliseconds`,f(h))},t)}).finally(()=>{d.clear(),c&&i&&i.removeEventListener("abort",c)});return d.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},d}var PP,HV,DP=_(()=>{PP=class r extends Error{name="TimeoutError";constructor(e,t){super(e,t),Error.captureStackTrace?.(this,r)}},HV=r=>r.reason??new DOMException("This operation was aborted.","AbortError")});function Rpe(r,e,t){let n,o=new Promise((s,i)=>{if(t={rejectionEvents:["error"],multiArgs:!1,rejectionMultiArgs:!1,resolveImmediately:!1,...t},!(t.count>=0&&(t.count===Number.POSITIVE_INFINITY||Number.isInteger(t.count))))throw new TypeError("The `count` option should be at least 0 or more");t.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:d}=kpe(r),u=async(...h)=>{let m=t.multiArgs?h:h[0];if(t.filter)try{if(!await t.filter(m))return}catch(y){n(),i(y);return}c.push(m),t.count===c.length&&(n(),s(c))},f=(...h)=>{n(),i(t.rejectionMultiArgs?h:h[0])};n=()=>{for(let h of a)d(h,u);for(let h of t.rejectionEvents)a.includes(h)||d(h,f)};for(let h of a)l(h,u);for(let h of t.rejectionEvents)a.includes(h)||l(h,f);t.signal&&t.signal.addEventListener("abort",()=>{f(t.signal.reason)},{once:!0}),t.resolveImmediately&&s(c)});if(o.cancel=n,typeof t.timeout=="number"){let s=Cb(o,{milliseconds:t.timeout});return s.cancel=()=>{n(),s.clear()},s}return o}function Qr(r,e,t){typeof t=="function"&&(t={filter:t}),t={...t,count:1,resolveImmediately:!1};let n=Rpe(r,e,t),o=n.then(s=>s[0]);return o.cancel=n.cancel,o}var kpe,wu=_(()=>{DP();kpe=r=>{let e=r.addEventListener||r.on||r.addListener,t=r.removeEventListener||r.off||r.removeListener;if(!e||!t)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(r),removeListener:t.bind(r)}}});function Fa(r,e){let t,n=function(){let o=function(){t=void 0,r()};clearTimeout(t),t=setTimeout(o,e)};return n.start=()=>{},n.stop=()=>{clearTimeout(t)},n}var _S=_(()=>{});var MS,LS,xu,PS,DS,vu=_(()=>{MS=class extends Error{remainingPoints;msBeforeNext;consumedPoints;isFirstInDuration;constructor(e="Rate limit exceeded",t){super(e),this.name="RateLimitError",this.remainingPoints=t.remainingPoints,this.msBeforeNext=t.msBeforeNext,this.consumedPoints=t.consumedPoints,this.isFirstInDuration=t.isFirstInDuration}},LS=class extends Error{static name="QueueFullError";constructor(e="The queue was full"){super(e),this.name="QueueFullError"}},xu=class extends Error{static name="UnexpectedEOFError";name="UnexpectedEOFError"},PS=class extends Error{static name="MaxEarlyStreamsError";name="MaxEarlyStreamsError"},DS=class extends Error{static name="StreamClosedError";name="StreamClosedError"}});function _pe(r){return r.reason}async function hr(r,e,t){if(e==null)return r;let n=t?.translateError??_pe;if(e.aborted)return r.catch(()=>{}),Promise.reject(n(e));let o;try{return await Promise.race([r,new Promise((s,i)=>{o=()=>{i(n(e))},e.addEventListener("abort",o)})])}finally{o!=null&&e.removeEventListener("abort",o)}}var js=_(()=>{});var BS,KV=_(()=>{ge();lh();BS=class{deferred;signal;onProgress;constructor(e){this.signal=e?.signal,this.onProgress=e?.onProgress,this.deferred=kr(),this.onAbort=this.onAbort.bind(this),this.signal?.addEventListener("abort",this.onAbort)}onAbort(){this.deferred.reject(this.signal?.reason??new Qo)}cleanup(){this.signal?.removeEventListener("abort",this.onAbort)}}});function Mpe(){return`${parseInt(String(Math.random()*1e9),10).toString()}${Date.now()}`}var zV,OS,VV=_(()=>{ge();js();KV();zV=new WeakMap,OS=class{id;fn;options;recipients;status;timeline;controller;dispatchingProgress;constructor(e,t){this.id=Mpe(),this.status="queued",this.fn=e,this.options=t,this.recipients=[],this.timeline={created:Date.now()},this.controller=new AbortController,this.controller.signal,this.dispatchingProgress=!1,this.onAbort=this.onAbort.bind(this)}abort(e){this.controller.abort(e)}onAbort(){this.recipients.reduce((t,n)=>t&&n.signal?.aborted===!0,!0)&&(this.controller.abort(new Qo),this.cleanup())}async join(e){let t=new BS(e);return this.recipients.push(t),e?.signal?.addEventListener("abort",this.onAbort),t.deferred.promise}async run(){this.status="running",this.timeline.started=Date.now();try{this.controller.signal.throwIfAborted();let e=await hr(this.fn({...this.options??{},signal:this.controller.signal,onProgress:t=>{if(this.recipients.length!==0&&!this.dispatchingProgress){if(typeof t=="object"&&t!==null){let n=zV.get(t);if(n==null&&(n=new WeakSet,zV.set(t,n)),n.has(this))return;n.add(this)}this.dispatchingProgress=!0;try{this.recipients.forEach(n=>{n.onProgress?.(t)})}finally{this.dispatchingProgress=!1}}}}),this.controller.signal);this.recipients.forEach(t=>{t.deferred.resolve(e)}),this.status="complete"}catch(e){this.recipients.forEach(t=>{t.deferred.reject(e)}),this.status="errored"}finally{this.timeline.finished=Date.now(),this.cleanup()}}cleanup(){this.recipients.forEach(e=>{e.deferred.reject(e.signal?.reason??new Qo),e.cleanup(),e.signal?.removeEventListener("abort",this.onAbort)}),this.recipients.splice(0,this.recipients.length)}}});var wp,NS=_(()=>{ge();Bd();Ds();wu();_S();vu();VV();wp=class extends At{concurrency;maxSize;queue;pending;sort;paused;constructor(e={}){super(),this.concurrency=e.concurrency??Number.POSITIVE_INFINITY,this.maxSize=e.maxSize??Number.POSITIVE_INFINITY,this.pending=0,this.paused=!1,e.metricName!=null&&e.metrics?.registerMetricGroup(e.metricName,{calculate:()=>({size:this.queue.length,running:this.pending,queued:this.queue.length-this.pending})}),this.sort=e.sort,this.queue=[],this.emitEmpty=Fa(this.emitEmpty.bind(this),1),this.emitIdle=Fa(this.emitIdle.bind(this),1)}emitEmpty(){this.size===0&&this.safeDispatchEvent("empty")}emitIdle(){this.running===0&&this.safeDispatchEvent("idle")}pause(){this.paused=!0}resume(){this.paused&&(this.paused=!1,this.tryToStartAnother())}tryToStartAnother(){if(this.paused)return!1;if(this.size===0)return this.emitEmpty(),this.running===0&&this.emitIdle(),!1;if(this.pending<this.concurrency){let e;for(let t of this.queue)if(t.status==="queued"){e=t;break}return e==null?!1:(this.safeDispatchEvent("active"),this.pending++,e.run().finally(()=>{for(let t=0;t<this.queue.length;t++)if(this.queue[t]===e){this.queue.splice(t,1);break}this.pending--,this.tryToStartAnother(),this.safeDispatchEvent("next")}),!0)}return!1}enqueue(e){this.queue.push(e),this.sort!=null&&this.queue.sort(this.sort)}async add(e,t){if(t?.signal?.throwIfAborted(),this.size===this.maxSize)throw new LS;let n=new OS(e,t);this.enqueue(n),this.safeDispatchEvent("add");let o=n.join(t).then(s=>(this.safeDispatchEvent("completed",{detail:s}),this.safeDispatchEvent("success",{detail:{job:n,result:s}}),s)).catch(s=>{if(n.status==="queued"){for(let i=0;i<this.queue.length;i++)if(this.queue[i]===n){this.queue.splice(i,1);break}}throw this.safeDispatchEvent("failure",{detail:{job:n,error:s}}),s});return this.tryToStartAnother(),o}clear(){this.queue.splice(0,this.queue.length)}abort(){this.queue.forEach(e=>{e.abort(new Qo)}),this.clear()}async onEmpty(e){this.size!==0&&await Qr(this,"empty",e)}async onSizeLessThan(e,t){this.size<e||await Qr(this,"next",{...t,filter:()=>this.size<e})}async onIdle(e){this.pending===0&&this.size===0||await Qr(this,"idle",e)}get size(){return this.queue.length}get queued(){return this.queue.length-this.pending}get running(){return this.pending}async*toGenerator(e){e?.signal?.throwIfAborted();let t=_s({objectMode:!0}),n=c=>{c!=null?this.abort():this.clear(),t.end(c)},o=c=>{c.detail!=null&&t.push(c.detail)},s=c=>{n(c.detail.error)},i=()=>{n()},a=()=>{n(new Qo("Queue aborted"))};this.addEventListener("completed",o),this.addEventListener("failure",s),this.addEventListener("idle",i),e?.signal?.addEventListener("abort",a);try{yield*t}finally{this.removeEventListener("completed",o),this.removeEventListener("failure",s),this.removeEventListener("idle",i),e?.signal?.removeEventListener("abort",a),n()}}}});var Lpe,xp,BP=_(()=>{ge();Bd();js();Wo();vu();Lpe=Math.pow(2,20)*4,xp=class extends At{status;timeline;inactivityTimeout;maxReadBufferLength;maxWriteBufferLength;log;direction;maxMessageSize;readStatus;writeStatus;remoteReadStatus;remoteWriteStatus;writableNeedsDrain;readBuffer;writeBuffer;sendingData;#e=!1;onDrainPromise;constructor(e){super(),this.status="open",this.log=e.log,this.direction=e.direction??"outbound",this.inactivityTimeout=e.inactivityTimeout??12e4,this.maxReadBufferLength=e.maxReadBufferLength??Lpe,this.maxWriteBufferLength=e.maxWriteBufferLength,this.maxMessageSize=e.maxMessageSize,this.readBuffer=new Ne,this.writeBuffer=new Ne,this.readStatus="readable",this.remoteReadStatus="readable",this.writeStatus="writable",this.remoteWriteStatus="writable",this.sendingData=!1,this.writableNeedsDrain=!1,this.timeline={open:Date.now()},this.processSendQueue=this.processSendQueue.bind(this);let t=()=>{this.writableNeedsDrain&&(this.log.trace("drain event received, continue sending data"),this.writableNeedsDrain=!1,queueMicrotask(()=>{try{this.processSendQueue()}catch(o){this.log.error("processSendQueue threw - %e",o)}})),this.onDrainPromise?.resolve()};this.addEventListener("drain",t);let n=o=>{this.onDrainPromise?.reject(o.error??new DS)};this.addEventListener("close",n)}get readBufferLength(){return this.readBuffer.byteLength}get readableEnded(){return this.#e}get writeBufferLength(){return this.writeBuffer.byteLength}async onDrain(e){return this.writableNeedsDrain!==!0?Promise.resolve():(this.onDrainPromise==null&&(this.onDrainPromise=Promise.withResolvers()),hr(this.onDrainPromise.promise,e?.signal))}async*[Symbol.asyncIterator](){if(this.readStatus!=="readable"&&this.readStatus!=="paused")return;let e=_s(),t=s=>{e.push(s.data)};this.addEventListener("message",t);let n=s=>{e.end(s.error)};this.addEventListener("close",n);let o=()=>{e.end()};this.addEventListener("remoteCloseWrite",o);try{yield*e}finally{this.removeEventListener("message",t),this.removeEventListener("close",n),this.removeEventListener("remoteCloseWrite",o)}}isReadable(){return this.status==="open"}send(e){if(this.writeStatus==="closed"||this.writeStatus==="closing")throw new Xc(`Cannot write to a stream that is ${this.writeStatus}`);return this.log.trace("append %d bytes to write buffer",e.byteLength),this.writeBuffer.append(e),this.processSendQueue()}abort(e){if(!(this.status==="aborted"||this.status==="reset"||this.status==="closed")){this.log.error("abort with error - %e",e),this.status="aborted",this.readBuffer.byteLength>0&&this.readBuffer.consume(this.readBuffer.byteLength),this.writeBuffer.byteLength>0&&(this.writeBuffer.consume(this.writeBuffer.byteLength),this.safeDispatchEvent("idle")),this.writeStatus="closed",this.remoteWriteStatus="closed",this.readStatus="closed",this.remoteReadStatus="closed",this.timeline.close=Date.now(),this.maybeDispatchEnd();try{this.sendReset(e)}catch(t){this.log.error("failed to send reset to remote - %e",t)}this.dispatchEvent(new Hv(e))}}pause(){if(this.readStatus==="closed"||this.readStatus==="closing")throw new Xc("Cannot pause a stream that is closing/closed");this.readStatus!=="paused"&&(this.readStatus="paused",this.sendPause())}resume(){if(this.readStatus==="closed"||this.readStatus==="closing")throw new Xc("Cannot resume a stream that is closing/closed");this.readStatus!=="readable"&&(this.readStatus="readable",this.dispatchReadBuffer(),this.sendResume())}push(e){if(this.readStatus==="closed"||this.readStatus==="closing")throw new Xc(`Cannot push data onto a stream that is ${this.readStatus}`);if(e.byteLength!==0){if(this.readBuffer.append(e),this.readStatus==="paused"||this.listenerCount("message")===0){this.checkReadBufferLength();return}setTimeout(()=>{this.dispatchReadBuffer()},0)}}unshift(e){if(this.readStatus==="closed"||this.readStatus==="closing")throw new Xc(`Cannot push data onto a stream that is ${this.readStatus}`);if(e.byteLength!==0){if(this.readBuffer.prepend(e),this.readStatus==="paused"||this.listenerCount("message")===0){this.checkReadBufferLength();return}setTimeout(()=>{this.dispatchReadBuffer()},0)}}onData(e){if(e.byteLength!==0){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("ignoring data - read status %s",this.readStatus);return}this.readBuffer.append(e),this.dispatchReadBuffer()}}addEventListener(...e){super.addEventListener.apply(this,e),e[0]==="message"&&this.readBuffer.byteLength>0&&queueMicrotask(()=>{this.dispatchReadBuffer()})}onRemoteReset(){this.log("remote reset"),this.status="reset",this.writeStatus="closed",this.remoteWriteStatus="closed",this.remoteReadStatus="closed",this.timeline.close=Date.now(),this.readBuffer.byteLength===0&&(this.readStatus="closed",this.maybeDispatchEnd()),this.dispatchEvent(new Kv(new Dv))}onTransportClosed(e){this.log("transport closed"),this.readStatus==="readable"&&this.readBuffer.byteLength===0&&(this.log("close readable end after transport closed and read buffer is empty"),this.readStatus="closed"),this.remoteReadStatus!=="closed"&&(this.remoteReadStatus="closed"),this.remoteWriteStatus!=="closed"&&(this.remoteWriteStatus="closed"),this.writeStatus!=="closed"&&(this.writeStatus="closed"),e!=null?this.abort(e):(this.status==="open"||this.status==="closing")&&(this.timeline.close=Date.now(),this.status="closed",this.maybeDispatchEnd(),this.dispatchEvent(new Qc))}onRemoteCloseWrite(){this.remoteWriteStatus!=="closed"&&(this.log.trace("on remote close write"),this.remoteWriteStatus="closed",this.safeDispatchEvent("remoteCloseWrite"),this.maybeDispatchEnd(),this.writeStatus==="closed"&&this.onTransportClosed())}onRemoteCloseRead(){this.log.trace("on remote close read"),this.remoteReadStatus="closed",this.writeBuffer.byteLength>0&&(this.writeBuffer.consume(this.writeBuffer.byteLength),this.safeDispatchEvent("idle"))}processSendQueue(){if(this.writableNeedsDrain)return this.log.trace("not processing send queue as drain is required"),this.checkWriteBufferLength(),!1;if(this.writeBuffer.byteLength===0)return this.log.trace("not processing send queue as no bytes to send"),!0;if(this.sendingData)return this.log.trace("not processing send queue as already sending data"),!0;if(this.writeStatus!=="writable"&&this.writeStatus!=="closing")return this.log.trace("not processing send queue as stream is %s",this.writeStatus),!1;this.sendingData=!0,this.log.trace("processing send queue with %d queued bytes",this.writeBuffer.byteLength);try{let e=!0,t=this.writeBuffer.byteLength,n=0;for(;this.writeBuffer.byteLength>0;){let o=Math.min(this.maxMessageSize??this.writeBuffer.byteLength,this.writeBuffer.byteLength);if(o===0){e=!1;break}let s=this.writeBuffer.sublist(0,o),i=new Ne(s);this.writeBuffer.consume(s.byteLength);let a;try{a=this.sendData(s)}catch(c){throw this.writeBuffer.prepend(i),this.abort(c),c}if(e=a.canSendMore,n+=a.sentBytes,a.sentBytes!==i.byteLength&&(i.consume(a.sentBytes),this.writeBuffer.prepend(i)),!e)break}return e||(this.log.trace("sent %d/%d bytes, pausing sending because underlying stream is full, %d bytes left in the write buffer",n,t,this.writeBuffer.byteLength),this.writableNeedsDrain=!0,this.checkWriteBufferLength()),this.writeBuffer.byteLength===0&&this.safeDispatchEvent("idle"),e}finally{this.sendingData=!1}}maybeDispatchEnd(){this.#e||this.readBuffer.byteLength>0||this.remoteWriteStatus!=="closed"&&this.readStatus!=="closed"||(this.#e=!0,this.safeDispatchEvent("end"))}dispatchReadBuffer(){try{if(this.listenerCount("message")===0){this.log.trace("not dispatching pause buffer as there are no listeners for the message event");return}if(this.readBuffer.byteLength===0){this.log.trace("not dispatching pause buffer as there is no data to dispatch");return}if(this.readStatus==="paused"){this.log.trace("not dispatching pause buffer we are paused");return}if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("dropping %d bytes because the readable end is %s",this.readBuffer.byteLength,this.readStatus),this.readBuffer.consume(this.readBuffer.byteLength);return}let e=this.readBuffer.sublist();this.readBuffer.consume(e.byteLength),this.dispatchEvent(new $v(e))}finally{this.readBuffer.byteLength===0&&this.remoteWriteStatus==="closed"&&(this.log("close readable end after dispatching read buffer and remote writable end is closed"),this.readStatus="closed",this.maybeDispatchEnd()),this.checkReadBufferLength()}}checkReadBufferLength(){this.readBuffer.byteLength>this.maxReadBufferLength&&this.abort(new Kd(`Read buffer length of ${this.readBuffer.byteLength} exceeded limit of ${this.maxReadBufferLength}, read status is ${this.readStatus}`))}checkWriteBufferLength(){this.maxWriteBufferLength!=null&&this.writeBuffer.byteLength>this.maxWriteBufferLength&&this.abort(new Kd(`Write buffer length of ${this.writeBuffer.byteLength} exceeded limit of ${this.maxWriteBufferLength}, write status is ${this.writeStatus}`))}onMuxerNeedsDrain(){this.writableNeedsDrain=!0}onMuxerDrain(){this.safeDispatchEvent("drain")}}});var qV=_(()=>{});function jV(r){return r==null?!1:typeof r.then=="function"&&typeof r.catch=="function"&&typeof r.finally=="function"}var OP=_(()=>{});var FS,GV=_(()=>{ge();js();vu();OP();FS=class extends At{streams;protocol;status;log;maConn;streamOptions;earlyStreams;maxEarlyStreams;metrics;constructor(e,t){super(),this.maConn=e,this.protocol=t.protocol,this.streams=[],this.earlyStreams=[],this.status="open",this.log=e.log.newScope(t.name),this.streamOptions=t.streamOptions,this.maxEarlyStreams=t.maxEarlyStreams??10,this.metrics=t.metrics;let n=i=>{try{this.onData(i.data)}catch(a){this.abort(a),this.maConn.abort(a)}};this.maConn.addEventListener("message",n);let o=()=>{this.log("underlying stream drained, signal %d streams to continue writing",this.streams.length),this.streams.forEach(i=>{i.onMuxerDrain()})};this.maConn.addEventListener("drain",o);let s=()=>{this.log("underlying stream closed with status %s and %d streams",this.status,this.streams.length),this.onTransportClosed()};this.maConn.addEventListener("close",s)}send(e){let t=this.maConn.send(e);return t===!1&&(this.log("underlying stream saturated, signal %d streams to pause writing",this.streams.length),this.streams.forEach(n=>{n.onMuxerNeedsDrain()})),t}async close(e){this.status==="closed"||this.status==="closing"||(this.status="closing",await hr(Promise.all([...this.streams].map(async t=>{await t.close(e)})),e?.signal),this.status="closed")}abort(e){this.status!=="closed"&&(this.status="closing",[...this.streams].forEach(t=>{t.abort(e)}),this.status="closed")}onTransportClosed(e){this.status="closing";try{[...this.streams].forEach(t=>{t.onTransportClosed(e)})}catch(t){this.abort(t)}this.status="closed"}async createStream(e){if(this.status!=="open")throw new ya;let t=this.onCreateStream({...this.streamOptions,...e});return jV(t)&&(t=await t),this.streams.push(t),this.cleanUpStream(t),t}onRemoteStream(e){if(this.streams.push(e),this.cleanUpStream(e),this.listenerCount("stream")===0){this.earlyStreams.push(e),this.earlyStreams.length>this.maxEarlyStreams&&this.abort(new PS(`Too many early streams were opened - ${this.earlyStreams.length}/${this.maxEarlyStreams}`));return}this.safeDispatchEvent("stream",{detail:e})}cleanUpStream(e){let t=n=>{let o=this.streams.findIndex(s=>s===e);o!==-1&&this.streams.splice(o,1),n.error!=null?n.local?this.metrics?.increment({[`${e.direction}_stream_reset`]:!0}):this.metrics?.increment({[`${e.direction}_stream_abort`]:!0}):this.metrics?.increment({[`${e.direction}_stream_end`]:!0})};e.addEventListener("close",t),this.metrics?.increment({[`${e.direction}_stream`]:!0})}addEventListener(...e){super.addEventListener.apply(this,e),e[0]==="stream"&&this.earlyStreams.length>0&&queueMicrotask(()=>{this.earlyStreams.forEach(t=>{this.safeDispatchEvent("stream",{detail:t})}),this.earlyStreams=[]})}}});var US,WV=_(()=>{wu();BP();US=class extends xp{id;protocol;constructor(e){super(e),this.id=e.id,this.protocol=e.protocol??""}async close(e){this.writeStatus==="closing"||this.writeStatus==="closed"||(this.writeStatus="closing",(this.sendingData||this.writeBuffer.byteLength>0)&&(this.log("waiting for write queue to become idle before closing writable end of stream, %d unsent bytes",this.writeBuffer.byteLength),await Qr(this,"idle",{...e,rejectionEvents:["close"]})),this.writableNeedsDrain&&(this.log("waiting for write queue to drain before closing writable end of stream, %d unsent bytes, sending %s",this.writeBuffer.byteLength,this.sendingData),await Qr(this,"drain",{...e,rejectionEvents:["close"]}),this.log("write queue drained, closing writable end of stream, %d unsent bytes, sending %s",this.writeBuffer.byteLength,this.sendingData)),await this.sendCloseWrite(e),this.writeStatus="closed",this.log("closed writable end gracefully"),this.remoteWriteStatus==="closed"&&this.onTransportClosed())}async closeRead(e){this.readStatus==="closing"||this.readStatus==="closed"||(this.readBuffer.byteLength>0&&this.readBuffer.consume(this.readBuffer.byteLength),this.readStatus="closing",await this.sendCloseRead(e),this.readStatus="closed",this.maybeDispatchEnd(),this.log("closed readable end gracefully"))}}});function gn(r){let e=new globalThis.AbortController;function t(){e.abort();for(let s of r)s?.removeEventListener!=null&&s.removeEventListener("abort",t)}for(let s of r){if(s?.aborted===!0){t();break}s?.addEventListener!=null&&s.addEventListener("abort",t)}function n(){for(let s of r)s?.removeEventListener!=null&&s.removeEventListener("abort",t)}let o=e.signal;return o.clear=n,o}var yl=_(()=>{});var vp,NP=_(()=>{vp=class{movingAverage;variance;deviation;forecast;timeSpan;previousTime;constructor(e){this.timeSpan=e,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(e,t){return 1-Math.exp(-(e-t)/this.timeSpan)}push(e,t=Date.now()){if(this.previousTime!=null){let n=this.alpha(t,this.previousTime),o=e-this.movingAverage,s=n*o;this.movingAverage=n*e+(1-n)*this.movingAverage,this.variance=(1-n)*(this.variance+o*s),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+n*o}else this.movingAverage=e;this.previousTime=t}}});var Ppe,Dpe,Bpe,Ope,Npe,$S,YV=_(()=>{yl();NP();Ppe=1.2,Dpe=2,Bpe=5e3,Ope=6e4,Npe=5e3,$S=class{success;failure;next;metric;timeoutMultiplier;failureMultiplier;minTimeout;maxTimeout;constructor(e={}){let t=e.interval??Npe;this.success=new vp(t),this.failure=new vp(t),this.next=new vp(t),this.failureMultiplier=e.failureMultiplier??Dpe,this.timeoutMultiplier=e.timeoutMultiplier??Ppe,this.minTimeout=e.minTimeout??Bpe,this.maxTimeout=e.maxTimeout??Ope,e.metricName!=null&&(this.metric=e.metrics?.registerMetricGroup(e.metricName))}getTimeoutSignal(e={}){let t=Math.round(this.next.movingAverage*(e.timeoutFactor??this.timeoutMultiplier));t<this.minTimeout&&(t=this.minTimeout),t>this.maxTimeout&&(t=this.maxTimeout);let n=AbortSignal.timeout(t),o=gn([e.signal,n]);return o.start=Date.now(),o.timeout=t,o}cleanUp(e){e.clear();let t=Date.now()-e.start;e.aborted?(this.failure.push(t),this.next.push(t*this.failureMultiplier),this.metric?.update({failureMovingAverage:this.failure.movingAverage,failureDeviation:this.failure.deviation,failureForecast:this.failure.forecast,failureVariance:this.failure.variance,failure:t})):(this.success.push(t),this.next.push(t),this.metric?.update({successMovingAverage:this.success.movingAverage,successDeviation:this.success.deviation,successForecast:this.success.forecast,successVariance:this.success.variance,success:t}))}}});var XV=_(()=>{});var ZV=_(()=>{ul();ES()});var QV=_(()=>{ul();nt()});var JV=_(()=>{});var eq=_(()=>{});function Upe(r){return typeof r?.closeRead=="function"}function $pe(r){return typeof r?.close=="function"}function FP(r){return Upe(r)?r.remoteWriteStatus!=="writable"&&r.readBufferLength===0:$pe(r)?r.status!=="open":!1}function Hpe(r){return r?.addEventListener!=null&&r?.removeEventListener!=null&&r?.send!=null&&r?.push!=null&&r?.log!=null}function Ab(r,e){let t=e?.maxBufferSize??Fpe,n=new Ne,o,s=!1,i;if(!Hpe(r))throw new re("Argument should be a Stream or a Multiaddr");let a=u=>{if(i==null){if(n.append(u.data),n.byteLength>t){let f=n.byteLength;n.consume(f);let h=new Kd(`Read buffer overflow - ${f} > ${t}`);i=h,o?.reject(h),queueMicrotask(()=>{r.abort(h)});return}o?.resolve()}};r.addEventListener("message",a);let c=u=>{u.error!=null?o?.reject(u.error):o?.resolve()};r.addEventListener("close",c);let l=()=>{o?.resolve()};r.addEventListener("remoteCloseWrite",l);let d={readBuffer:n,async read(u){if(s===!0)throw new HS("Stream was unwrapped");if(i!=null)throw i;if(FP(r)){if(n.byteLength===0&&u?.bytes==null)return null;if(u?.bytes!=null&&n.byteLength<u.bytes)throw r.log.error("closed after reading %d/%d bytes",n.byteLength,u.bytes),new xu(`Unexpected EOF - stream closed after reading ${n.byteLength}/${u.bytes} bytes`)}let f=u?.bytes??1;for(o=Promise.withResolvers();;){if(n.byteLength>=f){o.resolve();break}if(await hr(o.promise,u?.signal),FP(r)){if(n.byteLength===0&&u?.bytes==null)return null;break}o=Promise.withResolvers()}let h=u?.bytes??n.byteLength;if(n.byteLength<h){if(FP(r))throw r.log.error("closed while reading %d/%d bytes",n.byteLength,h),new xu(`Unexpected EOF - stream closed while reading ${n.byteLength}/${h} bytes`);return d.read(u)}let m=n.sublist(0,h);return n.consume(h),m},async write(u,f){if(s===!0)throw new HS("Stream was unwrapped");r.send(u)||await Qr(r,"drain",{signal:f?.signal,rejectionEvents:["close"]})},unwrap(){return s||(s=!0,r.removeEventListener("message",a),r.removeEventListener("close",c),r.removeEventListener("remoteCloseWrite",l),n.byteLength>0&&(r.log("stream unwrapped with %d unread bytes",n.byteLength),r.unshift(n))),r}};return d}function bl(r,e={}){let t=Ab(r,e);e.maxDataLength!=null&&e.maxLengthLength==null&&(e.maxLengthLength=cr(e.maxDataLength));let n=e?.lengthDecoder??ha,o=e?.lengthEncoder??jc;return{async read(i){let a=-1,c=new Ne;for(;;){let d=await t.read({...i,bytes:1});if(d==null)break;c.append(d);try{a=n(c)}catch(u){if(u instanceof RangeError)continue;throw u}if(a<0)throw new Ib("Invalid message length");if(e?.maxLengthLength!=null&&c.byteLength>e.maxLengthLength)throw new $P(`Message length length too long - ${c.byteLength} > ${e.maxLengthLength}`);if(a>-1)break}if(e?.maxDataLength!=null&&a>e.maxDataLength)throw new UP(`Message length too long - ${a} > ${e.maxDataLength}`);let l=await t.read({...i,bytes:a});if(l==null)throw r.log.error("tried to read %d bytes but the stream closed",a),new xu(`Unexpected EOF - tried to read ${a} bytes but the stream closed`);if(l.byteLength!==a)throw r.log.error("read %d/%d bytes before the stream closed",l.byteLength,a),new xu(`Unexpected EOF - read ${l.byteLength}/${a} bytes before the stream closed`);return l},async write(i,a){await t.write(new Ne(o(i.byteLength),i),a)},async writeV(i,a){let c=new Ne(...i.flatMap(l=>[o(l.byteLength),l]));await t.write(c,a)},unwrap(){return t.unwrap()}}}function Bn(r,e){let t=bl(r,e),n={read:async(o,s)=>{let i=await t.read(s);return o.decode(i,s)},write:async(o,s,i)=>{await t.write(s.encode(o),i)},writeV:async(o,s,i)=>{await t.writeV(o.map(a=>s.encode(a)),i)},pb:o=>({read:async s=>n.read(o,s),write:async(s,i)=>n.write(s,o,i),writeV:async(s,i)=>n.writeV(s,o,i),unwrap:()=>n}),unwrap:()=>t.unwrap()};return n}function Kpe(r){return r?.addEventListener!=null}function zpe(r){let e=_s(),t,n=i=>{e.push(i.data)},o=()=>{e.end(),r.removeEventListener("message",n),r.removeEventListener("close",s),r.removeEventListener("remoteCloseWrite",o)},s=i=>{e.end(i.error),i.error!=null&&t?.reject(i.error),r.removeEventListener("message",n),r.removeEventListener("close",s),r.removeEventListener("remoteCloseWrite",o)};return r.addEventListener("message",n),r.addEventListener("close",s,{once:!0}),r.addEventListener("remoteCloseWrite",o,{once:!0}),{source:e,async sink(i){async function*a(){yield*i}let c=a();for(;;){t=Promise.withResolvers();let{done:l,value:d}=await Promise.race([c.next(),t.promise]);if(r.writeStatus==="closing"||r.writeStatus==="closed"||(d!=null&&(r.send(d)||await Promise.race([Qr(r,"drain",{rejectionEvents:["close"]})])),l===!0))break}await r.close()}}}function tq(...r){let e=r.map(t=>Kpe(t)?zpe(t):t);return qn(...e)}var Fpe,HS,Ib,UP,$P,HP=_(()=>{ge();qc();Bd();wu();js();pa();Wo();vu();Fpe=4194304,HS=class extends Error{static name="UnwrappedError";name="UnwrappedError"},Ib=class extends Error{name="InvalidMessageLengthError";code="ERR_INVALID_MSG_LENGTH"},UP=class extends Error{name="InvalidDataLengthError";code="ERR_MSG_DATA_TOO_LONG"},$P=class extends Error{name="InvalidDataLengthLengthError";code="ERR_MSG_LENGTH_TOO_LONG"}});var Vpe,qpe,KS,rq=_(()=>{ge();pa();Wo();HP();Vpe=1024*1024*4,qpe=1024*1024*4,KS=class{buffer;maxBufferSize;lengthDecoder;maxDataLength;encodingLength;constructor(e={}){this.buffer=new Ne,this.maxBufferSize=e.maxBufferSize??Vpe,this.maxDataLength=e.maxDataLength??qpe,this.lengthDecoder=e.lengthDecoder??ha,this.encodingLength=e.encodingLength??cr}*decode(e){if(this.buffer.append(e),this.buffer.byteLength>this.maxBufferSize)throw new re(`Buffer length limit exceeded - ${this.buffer.byteLength}/${this.maxBufferSize}`);for(;;){let t;try{t=this.lengthDecoder(this.buffer)}catch(s){if(s instanceof RangeError)break;throw s}if(t<0||t>this.maxDataLength)throw new Ib("Invalid message length");let n=this.encodingLength(t),o=n+t;if(this.buffer.byteLength>=o){let s=this.buffer.sublist(n,o);this.buffer.consume(o),s.byteLength>0&&(yield s)}else break}}}});var nq=_(()=>{});function oq(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(e==="string"||e==="number"||e==="bigint"||e==="symbol")return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(r instanceof Uint8Array)return"Uint8Array";if(r.constructor===Object)return"Object";let t=Gpe(r);return t||"Object"}function Gpe(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(jpe.includes(e))return e}var jpe,sq=_(()=>{jpe=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array","Tagged"]});var K,se,Eo=_(()=>{K=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};K.uint=new K(0,"uint",!0);K.negint=new K(1,"negint",!0);K.bytes=new K(2,"bytes",!0);K.string=new K(3,"string",!0);K.array=new K(4,"array",!1);K.map=new K(5,"map",!1);K.tag=new K(6,"tag",!1);K.float=new K(7,"float",!0);K.false=new K(7,"false",!0);K.true=new K(7,"true",!0);K.null=new K(7,"null",!0);K.undefined=new K(7,"undefined",!0);K.break=new K(7,"break",!0);se=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}});function zS(r){return Tb&&globalThis.Buffer.isBuffer(r)}function VS(r){return r instanceof Uint8Array?zS(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}function Ep(r,e){if(zS(r)&&zS(e))return r.compare(e);for(let t=0;t<r.length;t++)if(r[t]!==e[t])return r[t]<e[t]?-1:1;return 0}function iq(r){let e=[],t=0;for(let n=0;n<r.length;n++){let o=r.charCodeAt(n);o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&n+1<r.length&&(r.charCodeAt(n+1)&64512)===56320?(o=65536+((o&1023)<<10)+(r.charCodeAt(++n)&1023),e[t++]=o>>18|240,e[t++]=o>>12&63|128,e[t++]=o>>6&63|128,e[t++]=o&63|128):(o>=55296&&o<=57343&&(o=65533),e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128)}return e}var Tb,Wpe,Ype,Xpe,KP,_i,aq,cq,zP,Eu=_(()=>{Tb=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Wpe=new TextEncoder;Ype=24,Xpe=200,KP=Tb?r=>r.length>=Ype?globalThis.Buffer.from(r):iq(r):r=>r.length>=Xpe?Wpe.encode(r):iq(r),_i=r=>Uint8Array.from(r),aq=Tb?(r,e,t)=>zS(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),cq=Tb?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),VS(globalThis.Buffer.concat(r,e))):(r,e)=>{let t=new Uint8Array(e),n=0;for(let o of r)n+o.length>t.length&&(o=o.subarray(0,t.length-n)),t.set(o,n),n+=o.length;return t},zP=Tb?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r)});var Zpe,kb,qS,lq=_(()=>{Eu();Zpe=256,kb=class{constructor(e=Zpe){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}pushByte(e){let t=this.chunks[this.chunks.length-1];this.cursor>this.maxCursor&&(t=zP(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t));let n=t.length-(this.maxCursor-this.cursor)-1;t[n]=e,this.cursor++}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let o=t.length-(this.maxCursor-this.cursor)-1;t.set(e,o)}else{if(t){let o=t.length-(this.maxCursor-this.cursor)-1;o<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,o),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=zP(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=aq(n,0,this.cursor)}else t=cq(this.chunks,this.cursor);return e&&this.reset(),t}},qS=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}pushByte(e){if(this.cursor>=this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest[this.cursor++]=e}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}}});function Ua(r,e,t){if(r.length-e<t)throw new Error(`${Je} not enough data for type`)}var Je,VP,Rb,Gs=_(()=>{Je="CBOR decode error:",VP="CBOR encode error:",Rb=[];Rb[23]=1;Rb[24]=2;Rb[25]=3;Rb[26]=5;Rb[27]=9});function So(r,e,t){Ua(r,e,1);let n=r[e];if(t.strict===!0&&n<Dr[0])throw new Error(`${Je} integer encoded in more bytes than necessary (strict decode)`);return n}function Co(r,e,t){Ua(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<Dr[1])throw new Error(`${Je} integer encoded in more bytes than necessary (strict decode)`);return n}function Io(r,e,t){Ua(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<Dr[2])throw new Error(`${Je} integer encoded in more bytes than necessary (strict decode)`);return n}function Ao(r,e,t){Ua(r,e,8);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3],o=r[e+4]*16777216+(r[e+5]<<16)+(r[e+6]<<8)+r[e+7],s=(BigInt(n)<<BigInt(32))+BigInt(o);if(t.strict===!0&&s<Dr[3])throw new Error(`${Je} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(t.allowBigInt===!0)return s;throw new Error(`${Je} integers outside of the safe integer range are not supported`)}function dq(r,e,t,n){return new se(K.uint,So(r,e+1,n),2)}function uq(r,e,t,n){return new se(K.uint,Co(r,e+1,n),3)}function fq(r,e,t,n){return new se(K.uint,Io(r,e+1,n),5)}function hq(r,e,t,n){return new se(K.uint,Ao(r,e+1,n),9)}function Mi(r,e){return Br(r,0,e.value)}function Br(r,e,t){if(t<Dr[0]){let n=Number(t);r.pushByte(e|n)}else if(t<Dr[1]){let n=Number(t);r.push([e|24,n])}else if(t<Dr[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<Dr[3]){let n=Number(t);r.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(t);if(n<Dr[4]){let o=[e|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),i=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=s&255,s=s>>8,o[7]=s&255,s=s>>8,o[6]=s&255,s=s>>8,o[5]=s&255,o[4]=i&255,i=i>>8,o[3]=i&255,i=i>>8,o[2]=i&255,i=i>>8,o[1]=i&255,r.push(o)}else throw new Error(`${Je} encountered BigInt larger than allowable range`)}}var Dr,$a=_(()=>{Eo();Gs();Dr=[24,256,65536,4294967296,BigInt("18446744073709551616")];Mi.encodedSize=function(e){return Br.encodedSize(e.value)};Br.encodedSize=function(e){return e<Dr[0]?1:e<Dr[1]?2:e<Dr[2]?3:e<Dr[3]?5:9};Mi.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0}});function pq(r,e,t,n){return new se(K.negint,-1-So(r,e+1,n),2)}function mq(r,e,t,n){return new se(K.negint,-1-Co(r,e+1,n),3)}function gq(r,e,t,n){return new se(K.negint,-1-Io(r,e+1,n),5)}function bq(r,e,t,n){let o=Ao(r,e+1,n);if(typeof o!="bigint"){let s=-1-o;if(s>=Number.MIN_SAFE_INTEGER)return new se(K.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${Je} integers outside of the safe integer range are not supported`);return new se(K.negint,qP-BigInt(o),9)}function jS(r,e){let t=e.value,n=typeof t=="bigint"?t*qP-yq:t*-1-1;Br(r,e.type.majorEncoded,n)}var qP,yq,jP=_(()=>{Eo();$a();Gs();qP=BigInt(-1),yq=BigInt(1);jS.encodedSize=function(e){let t=e.value,n=typeof t=="bigint"?t*qP-yq:t*-1-1;return n<Dr[0]?1:n<Dr[1]?2:n<Dr[2]?3:n<Dr[3]?5:9};jS.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0}});function _b(r,e,t,n){Ua(r,e,t+n);let o=r.slice(e+t,e+t+n);return new se(K.bytes,o,t+n)}function wq(r,e,t,n){return _b(r,e,1,t)}function xq(r,e,t,n){return _b(r,e,2,So(r,e+1,n))}function vq(r,e,t,n){return _b(r,e,3,Co(r,e+1,n))}function Eq(r,e,t,n){return _b(r,e,5,Io(r,e+1,n))}function Sq(r,e,t,n){let o=Ao(r,e+1,n);if(typeof o=="bigint")throw new Error(`${Je} 64-bit integer bytes lengths not supported`);return _b(r,e,9,o)}function GS(r){return r.encodedBytes===void 0&&(r.encodedBytes=K.equals(r.type,K.string)?KP(r.value):r.value),r.encodedBytes}function Sp(r,e){let t=GS(e);Br(r,e.type.majorEncoded,t.length),r.push(t)}function Jpe(r,e){return r.length<e.length?-1:r.length>e.length?1:Ep(r,e)}var WS=_(()=>{Eo();Gs();$a();Eu();Sp.encodedSize=function(e){let t=GS(e);return Br.encodedSize(t.length)+t.length};Sp.compareTokens=function(e,t){return Jpe(GS(e),GS(t))}});function rme(r,e,t){if(t-e<tme){let o="";for(let s=e;s<t;s++){let i=r[s];if(i&128)return Cq.decode(r.subarray(e,t));o+=String.fromCharCode(i)}return o}return Cq.decode(r.subarray(e,t))}function Mb(r,e,t,n,o){let s=t+n;Ua(r,e,s);let i=new se(K.string,rme(r,e+t,e+s),s);return o.retainStringBytes===!0&&(i.byteValue=r.slice(e+t,e+s)),i}function Iq(r,e,t,n){return Mb(r,e,1,t,n)}function Aq(r,e,t,n){return Mb(r,e,2,So(r,e+1,n),n)}function Tq(r,e,t,n){return Mb(r,e,3,Co(r,e+1,n),n)}function kq(r,e,t,n){return Mb(r,e,5,Io(r,e+1,n),n)}function Rq(r,e,t,n){let o=Ao(r,e+1,n);if(typeof o=="bigint")throw new Error(`${Je} 64-bit integer string lengths not supported`);return Mb(r,e,9,o,n)}var Cq,tme,_q,GP=_(()=>{Eo();Gs();$a();WS();Cq=new TextDecoder,tme=32;_q=Sp});function Cp(r,e,t,n){return new se(K.array,n,t)}function Mq(r,e,t,n){return Cp(r,e,1,t)}function Lq(r,e,t,n){return Cp(r,e,2,So(r,e+1,n))}function Pq(r,e,t,n){return Cp(r,e,3,Co(r,e+1,n))}function Dq(r,e,t,n){return Cp(r,e,5,Io(r,e+1,n))}function Bq(r,e,t,n){let o=Ao(r,e+1,n);if(typeof o=="bigint")throw new Error(`${Je} 64-bit integer array lengths not supported`);return Cp(r,e,9,o)}function Oq(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${Je} indefinite length items not allowed`);return Cp(r,e,1,1/0)}function YS(r,e){Br(r,K.array.majorEncoded,e.value)}var WP=_(()=>{Eo();$a();Gs();YS.compareTokens=Mi.compareTokens;YS.encodedSize=function(e){return Br.encodedSize(e.value)}});function Ip(r,e,t,n){return new se(K.map,n,t)}function Nq(r,e,t,n){return Ip(r,e,1,t)}function Fq(r,e,t,n){return Ip(r,e,2,So(r,e+1,n))}function Uq(r,e,t,n){return Ip(r,e,3,Co(r,e+1,n))}function $q(r,e,t,n){return Ip(r,e,5,Io(r,e+1,n))}function Hq(r,e,t,n){let o=Ao(r,e+1,n);if(typeof o=="bigint")throw new Error(`${Je} 64-bit integer map lengths not supported`);return Ip(r,e,9,o)}function Kq(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${Je} indefinite length items not allowed`);return Ip(r,e,1,1/0)}function XS(r,e){Br(r,K.map.majorEncoded,e.value)}var YP=_(()=>{Eo();$a();Gs();XS.compareTokens=Mi.compareTokens;XS.encodedSize=function(e){return Br.encodedSize(e.value)}});function zq(r,e,t,n){return new se(K.tag,t,1)}function Vq(r,e,t,n){return new se(K.tag,So(r,e+1,n),2)}function qq(r,e,t,n){return new se(K.tag,Co(r,e+1,n),3)}function jq(r,e,t,n){return new se(K.tag,Io(r,e+1,n),5)}function Gq(r,e,t,n){return new se(K.tag,Ao(r,e+1,n),9)}function ZS(r,e){Br(r,K.tag.majorEncoded,e.value)}var XP=_(()=>{Eo();$a();ZS.compareTokens=Mi.compareTokens;ZS.encodedSize=function(e){return Br.encodedSize(e.value)}});function Yq(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${Je} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new se(K.null,null,1):new se(K.undefined,void 0,1)}function Xq(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${Je} indefinite length items not allowed`);return new se(K.break,void 0,1)}function ZP(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${Je} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${Je} Infinity values are not supported`)}return new se(K.float,r,e)}function Zq(r,e,t,n){return ZP(n1(r,e+1),3,n)}function Qq(r,e,t,n){return ZP(o1(r,e+1),5,n)}function Jq(r,e,t,n){return ZP(rj(r,e+1),9,n)}function r1(r,e,t){let n=e.value;if(n===!1)r.pushByte(K.float.majorEncoded|QS);else if(n===!0)r.pushByte(K.float.majorEncoded|JS);else if(n===null)r.pushByte(K.float.majorEncoded|e1);else if(n===void 0)r.pushByte(K.float.majorEncoded|t1);else{let o,s=!1;(!t||t.float64!==!0)&&(QP(n),o=n1(mr,1),n===o||Number.isNaN(n)?(mr[0]=249,r.push(mr.slice(0,3)),s=!0):(JP(n),o=o1(mr,1),n===o&&(mr[0]=250,r.push(mr.slice(0,5)),s=!0))),s||(tj(n),o=rj(mr,1),mr[0]=251,r.push(mr.slice(0,9)))}}function QP(r){if(r===1/0)is.setUint16(0,31744,!1);else if(r===-1/0)is.setUint16(0,64512,!1);else if(Number.isNaN(r))is.setUint16(0,32256,!1);else{is.setFloat32(0,r);let e=is.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)is.setUint16(0,31744,!1);else if(t===0)is.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let o=t-127;o<-24?is.setUint16(0,0):o<-14?is.setUint16(0,(e&2147483648)>>16|1<<24+o,!1):is.setUint16(0,(e&2147483648)>>16|o+15<<10|n>>13,!1)}}}function n1(r,e){if(r.length-e<2)throw new Error(`${Je} not enough data for float16`);let t=(r[e]<<8)+r[e+1];if(t===31744)return 1/0;if(t===64512)return-1/0;if(t===32256)return NaN;let n=t>>10&31,o=t&1023,s;return n===0?s=o*2**-24:n!==31?s=(o+1024)*2**(n-25):s=o===0?1/0:NaN,t&32768?-s:s}function JP(r){is.setFloat32(0,r,!1)}function o1(r,e){if(r.length-e<4)throw new Error(`${Je} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}function tj(r){is.setFloat64(0,r,!1)}function rj(r,e){if(r.length-e<8)throw new Error(`${Je} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}function ame(r,e){let t=r.value;if(t===!1)return Uint8Array.of(K.float.majorEncoded|QS);if(t===!0)return Uint8Array.of(K.float.majorEncoded|JS);if(t===null)return Uint8Array.of(K.float.majorEncoded|e1);if(t===void 0)return Uint8Array.of(K.float.majorEncoded|t1);if(!e){if(QP(t),t===n1(mr,1)||Number.isNaN(t))return mr[0]=249,mr.slice(0,3);if(JP(t),t===o1(mr,1))return mr[0]=250,mr.slice(0,5)}return tj(t),mr[0]=251,mr.slice(0,9)}function Wq(r,e){let t=r,n=e?.float64===!0,o=n?t._keyBytesFloat64:t._keyBytes;if(o!==void 0)return o;let s=ame(r,n);return n?t._keyBytesFloat64=s:t._keyBytes=s,s}var QS,JS,e1,t1,ej,is,mr,eD=_(()=>{Eo();Gs();Eu();QS=20,JS=21,e1=22,t1=23;r1.encodedSize=function(e,t){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!t||t.float64!==!0){QP(n);let o=n1(mr,1);if(n===o||Number.isNaN(n))return 3;if(JP(n),o=o1(mr,1),n===o)return 5}return 9};ej=new ArrayBuffer(9),is=new DataView(ej,1),mr=new Uint8Array(ej,0);r1.compareTokens=function(e,t,n){let o=Wq(e,n),s=Wq(t,n);return o.length!==s.length?o.length<s.length?-1:1:Ep(o,s)}});function et(r,e,t){throw new Error(`${Je} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}function s1(r){return()=>{throw new Error(`${Je} ${r}`)}}function nj(r){switch(r.type){case K.false:return _i([244]);case K.true:return _i([245]);case K.null:return _i([246]);case K.bytes:return r.value.length?void 0:_i([64]);case K.string:return r.value===""?_i([96]):void 0;case K.array:return r.value===0?_i([128]):void 0;case K.map:return r.value===0?_i([160]):void 0;case K.uint:return r.value<24?_i([Number(r.value)]):void 0;case K.negint:if(r.value>=-24)return _i([31-Number(r.value)])}}var ne,Li,tD=_(()=>{Eo();$a();jP();WS();GP();WP();YP();XP();eD();Gs();Eu();ne=[];for(let r=0;r<=23;r++)ne[r]=et;ne[24]=dq;ne[25]=uq;ne[26]=fq;ne[27]=hq;ne[28]=et;ne[29]=et;ne[30]=et;ne[31]=et;for(let r=32;r<=55;r++)ne[r]=et;ne[56]=pq;ne[57]=mq;ne[58]=gq;ne[59]=bq;ne[60]=et;ne[61]=et;ne[62]=et;ne[63]=et;for(let r=64;r<=87;r++)ne[r]=wq;ne[88]=xq;ne[89]=vq;ne[90]=Eq;ne[91]=Sq;ne[92]=et;ne[93]=et;ne[94]=et;ne[95]=s1("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)ne[r]=Iq;ne[120]=Aq;ne[121]=Tq;ne[122]=kq;ne[123]=Rq;ne[124]=et;ne[125]=et;ne[126]=et;ne[127]=s1("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)ne[r]=Mq;ne[152]=Lq;ne[153]=Pq;ne[154]=Dq;ne[155]=Bq;ne[156]=et;ne[157]=et;ne[158]=et;ne[159]=Oq;for(let r=160;r<=183;r++)ne[r]=Nq;ne[184]=Fq;ne[185]=Uq;ne[186]=$q;ne[187]=Hq;ne[188]=et;ne[189]=et;ne[190]=et;ne[191]=Kq;for(let r=192;r<=215;r++)ne[r]=zq;ne[216]=Vq;ne[217]=qq;ne[218]=jq;ne[219]=Gq;ne[220]=et;ne[221]=et;ne[222]=et;ne[223]=et;for(let r=224;r<=243;r++)ne[r]=s1("simple values are not supported");ne[244]=et;ne[245]=et;ne[246]=et;ne[247]=Yq;ne[248]=s1("simple values are not supported");ne[249]=Zq;ne[250]=Qq;ne[251]=Jq;ne[252]=et;ne[253]=et;ne[254]=et;ne[255]=Xq;Li=[];for(let r=0;r<24;r++)Li[r]=new se(K.uint,r,1);for(let r=-1;r>=-24;r--)Li[31-r]=new se(K.negint,r,1);Li[64]=new se(K.bytes,new Uint8Array(0),1);Li[96]=new se(K.string,"",1);Li[128]=new se(K.array,0,1);Li[160]=new se(K.map,0,1);Li[244]=new se(K.false,!1,1);Li[245]=new se(K.true,!0,1);Li[246]=new se(K.null,null,1)});function lme(){let r=[];return r[K.uint.major]=Mi,r[K.negint.major]=jS,r[K.bytes.major]=Sp,r[K.string.major]=_q,r[K.array.major]=YS,r[K.map.major]=XS,r[K.tag.major]=ZS,r[K.float.major]=r1,r}function Ap(r,e={},t){let n=oq(r),o=e&&e.typeEncoders&&e.typeEncoders[n]||xl[n];if(typeof o=="function"){let i=o(r,n,e,t);if(i!=null)return i}let s=xl[n];if(!s)throw new Error(`${VP} unsupported type: ${n}`);return s(r,n,e,t)}function fme(r,e){let t=e.mapSorter;t&&r.sort((n,o)=>t(n,o,e))}function hme(r,e){if(r[0]instanceof se&&e[0]instanceof se){let t=r[0],n=e[0];return t._keyBytes||(t._keyBytes=oj(t.value)),n._keyBytes||(n._keyBytes=oj(n.value)),Ep(t._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function oj(r){return pme(r,dme,sj)}function ij(r,e,t,n){if(Array.isArray(e))for(let o of e)ij(r,o,t,n);else t[e.type.major](r,e,n)}function pme(r,e,t,n){let o=n instanceof Uint8Array,s=o?new qS(n):ume,i=Ap(r,t);if(!Array.isArray(i)&&t.quickEncodeToken){let a=t.quickEncodeToken(i);if(a)return o?(s.push(a),s.toBytes()):a;let c=e[i.type.major];if(c.encodedSize){let l=c.encodedSize(i,t);if(o||(s=new kb(l)),c(s,i,t),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${i} was wrong`);return o?s.toBytes():VS(s.chunks[0])}}return s.reset(),ij(s,i,e,t),s.toBytes(!0)}var sj,dme,ume,i1,wl,xl,nGe,oGe,sGe,iGe,aGe,cGe,lGe,dGe,uGe,fGe,hGe,pGe,aj=_(()=>{sq();Eo();lq();Gs();tD();Eu();$a();jP();WS();GP();WP();YP();XP();eD();sj=Object.freeze({mapSorter:hme,quickEncodeToken:nj});dme=lme(),ume=new kb,i1=class r{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${VP} object contains circular references`);return new r(t,e)}},wl={null:new se(K.null,null),undefined:new se(K.undefined,void 0),true:new se(K.true,!0),false:new se(K.false,!1),emptyArray:new se(K.array,0),emptyMap:new se(K.map,0)},xl={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new se(K.float,r):r>=0?new se(K.uint,r):new se(K.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new se(K.uint,r):new se(K.negint,r)},Uint8Array(r,e,t,n){return new se(K.bytes,r)},string(r,e,t,n){return new se(K.string,r)},boolean(r,e,t,n){return r?wl.true:wl.false},null(r,e,t,n){return wl.null},undefined(r,e,t,n){return wl.undefined},ArrayBuffer(r,e,t,n){return new se(K.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new se(K.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[wl.emptyArray,new se(K.break)]:wl.emptyArray;n=i1.createCheck(n,r);let o=[],s=0;for(let i of r)o[s++]=Ap(i,t,n);return t.addBreakTokens?[new se(K.array,r.length),o,new se(K.break)]:[new se(K.array,r.length),o]},Object(r,e,t,n){let o=e!=="Object",s=o?r.keys():Object.keys(r),i=o?r.size:s.length,a;if(i){a=new Array(i),n=i1.createCheck(n,r);let c=!o&&t.ignoreUndefinedProperties,l=0;for(let d of s){let u=o?r.get(d):r[d];c&&u===void 0||(a[l++]=[Ap(d,t,n),Ap(u,t,n)])}l<i&&(a.length=l)}return a?.length?(fme(a,t),t.addBreakTokens?[new se(K.map,a.length),a,new se(K.break)]:[new se(K.map,a.length),a]):t.addBreakTokens===!0?[wl.emptyMap,new se(K.break)]:wl.emptyMap},Tagged(r,e,t,n){return[new se(K.tag,r.tag),Ap(r.value,t,n)]}};xl.Map=xl.Object;xl.Buffer=xl.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))xl[`${r}Array`]=xl.DataView;nGe=K.uint.majorEncoded,oGe=K.negint.majorEncoded,sGe=K.bytes.majorEncoded,iGe=K.string.majorEncoded,aGe=K.array.majorEncoded,cGe=K.map.majorEncoded,lGe=K.float.majorEncoded|QS,dGe=K.float.majorEncoded|JS,uGe=K.float.majorEncoded|e1,fGe=K.float.majorEncoded|t1,hGe=BigInt(-1),pGe=BigInt(1)});var cj=_(()=>{Gs();Eo();tD();Eu()});var a1,lj=_(()=>{a1=class r{constructor(e,t){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new TypeError("Tagged: tag must be a non-negative integer");this.tag=e,this.value=t}static decoder(e){return t=>new r(e,t())}static preserve(...e){let t={};for(let n of e)t[n]=r.decoder(n);return t}};Object.defineProperty(a1.prototype,Symbol.toStringTag,{value:"Tagged"})});var dj=_(()=>{aj();cj();lj();Eo()});var uj=_(()=>{dj();ma();Bd();Wo()});function bme(r,e){if(typeof r=="string")return wme(r);if(typeof r=="number")return Eme(r,e);throw Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(r)}`)}function wme(r){if(typeof r!="string"||r.length===0||r.length>100)throw Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(r)}`);let e=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(r);if(!e?.groups)return NaN;let{value:t,unit:n="ms"}=e.groups,o=parseFloat(t),s=n.toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return o*315576e5;case"months":case"month":case"mo":return o*26298e5;case"weeks":case"week":case"w":return o*6048e5;case"days":case"day":case"d":return o*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return o*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return o*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return o*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:throw Error(`Unknown unit "${s}" provided to ms.parse(). value=${JSON.stringify(r)}`)}}function xme(r){let e=Math.abs(r);return e>=315576e5?`${Math.round(r/315576e5)}y`:e>=26298e5?`${Math.round(r/26298e5)}mo`:e>=6048e5?`${Math.round(r/6048e5)}w`:e>=864e5?`${Math.round(r/864e5)}d`:e>=36e5?`${Math.round(r/36e5)}h`:e>=6e4?`${Math.round(r/6e4)}m`:e>=1e3?`${Math.round(r/1e3)}s`:`${r}ms`}function vme(r){let e=Math.abs(r);return e>=315576e5?Cu(r,e,315576e5,"year"):e>=26298e5?Cu(r,e,26298e5,"month"):e>=6048e5?Cu(r,e,6048e5,"week"):e>=864e5?Cu(r,e,864e5,"day"):e>=36e5?Cu(r,e,36e5,"hour"):e>=6e4?Cu(r,e,6e4,"minute"):e>=1e3?Cu(r,e,1e3,"second"):`${r} ms`}function Eme(r,e){if(typeof r!="number"||!Number.isFinite(r))throw Error("Value provided to ms.format() must be of type number.");return e?.long?vme(r):xme(r)}function Cu(r,e,t,n){let o=e>=t*1.5;return`${Math.round(r/t)} ${n}${o?"s":""}`}var c1,rD=_(()=>{c1=bme});function nD(r){t.debug=t,t.default=t,t.coerce=c,t.disable=s,t.enable=o,t.enabled=i,t.humanize=c1,t.destroy=l,Object.keys(r).forEach(d=>{t[d]=r[d]}),t.names=[],t.skips=[],t.formatters={};function e(d){let u=0;for(let f=0;f<d.length;f++)u=(u<<5)-u+d.charCodeAt(f),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(d,u){let f,h=null,m,y;function g(...p){if(!g.enabled)return;let w=g,b=Number(new Date),x=b-(f||b);w.diff=x,w.prev=f,w.curr=b,f=b,p[0]=t.coerce(p[0]),typeof p[0]!="string"&&p.unshift("%O");let T=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(M,I)=>{if(M==="%%")return"%";T++;let E=t.formatters[I];if(typeof E=="function"){let L=p[T];M=E.call(w,L),p.splice(T,1),T--}return M}),t.formatArgs.call(w,p),u?.onLog!=null&&u.onLog(...p),(w.log||t.log).apply(w,p)}return g.namespace=d,g.useColors=t.useColors(),g.color=t.selectColor(d),g.extend=n,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(m!==t.namespaces&&(m=t.namespaces,y=t.enabled(d)),y),set:p=>{h=p}}),typeof t.init=="function"&&t.init(g),g}function n(d,u){let f=t(this.namespace+(typeof u>"u"?":":u)+d);return f.log=this.log,f}function o(d){t.save(d),t.namespaces=d,t.names=[],t.skips=[];let u,f=(typeof d=="string"?d:"").split(/[\s,]+/),h=f.length;for(u=0;u<h;u++)f[u]&&(d=f[u].replace(/\*/g,".*?"),d[0]==="-"?t.skips.push(new RegExp("^"+d.substr(1)+"$")):t.names.push(new RegExp("^"+d+"$")))}function s(){let d=[...t.names.map(a),...t.skips.map(a).map(u=>"-"+u)].join(",");return t.enable(""),d}function i(d){if(d[d.length-1]==="*")return!0;let u,f;for(u=0,f=t.skips.length;u<f;u++)if(t.skips[u].test(d))return!1;for(u=0,f=t.names.length;u<f;u++)if(t.names[u].test(d))return!0;return!1}function a(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function c(d){return d instanceof Error?d.stack??d.message:d}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.setupFormatters(t.formatters),t.enable(t.load()),t}var fj=_(()=>{rD()});function Cme(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/(edge|trident)\/(\d+)/)!=null?!1:typeof document<"u"&&document.documentElement?.style?.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/firefox\/(\d+)/)!=null&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent?.toLowerCase().match(/applewebkit\/(\d+)/)}function Ime(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+c1(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(t++,o==="%c"&&(n=t))}),r.splice(n,0,e)}function Tme(r){try{r?l1?.setItem("debug",r):l1?.removeItem("debug")}catch{}}function kme(){let r;try{r=l1?.getItem("debug")}catch{}return!r&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(r=globalThis.process.env.DEBUG),r}function Rme(){try{return localStorage}catch{}}function _me(r){r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var l1,Sme,Ame,hj,pj=_(()=>{rD();fj();l1=Rme(),Sme=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];Ame=console.debug??console.log??(()=>{});hj=nD({formatArgs:Ime,save:Tme,load:kme,useColors:Cme,setupFormatters:_me,colors:Sme,storage:l1,log:Ame})});var Zn,mj=_(()=>{pj();Zn=hj});function gj(r,e=""){let t=yj(r.message),n=yj(r.stack);return t!=null&&n!=null?n.includes(t)?`${n.split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
${e}`)}`:`${t}
|