@libp2p/devtools-metrics 0.2.3 → 0.2.4-1dfb74e79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/package.json +8 -8
- package/dist/typedoc-urls.json +0 -50
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PDevtoolsMetrics = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PDevtoolsMetrics=(()=>{var Zs=Object.create;var Rt=Object.defineProperty;var Ys=Object.getOwnPropertyDescriptor;var ec=Object.getOwnPropertyNames;var tc=Object.getPrototypeOf,rc=Object.prototype.hasOwnProperty;var Pt=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),H=(r,e)=>{for(var t in e)Rt(r,t,{get:e[t],enumerable:!0})},Jn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ec(e))!rc.call(r,o)&&o!==t&&Rt(r,o,{get:()=>e[o],enumerable:!(n=Ys(e,o))||n.enumerable});return r};var Qn=(r,e,t)=>(t=r!=null?Zs(tc(r)):{},Jn(e||!r||!r.__esModule?Rt(t,"default",{value:r,enumerable:!0}):t,r)),nc=r=>Jn(Rt({},"__esModule",{value:!0}),r);var no=Pt((jl,ro)=>{var Oe=1e3,$e=Oe*60,Ve=$e*60,Ie=Ve*24,oc=Ie*7,ic=Ie*365.25;ro.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return sc(r);if(t==="number"&&isFinite(r))return e.long?ac(r):cc(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function sc(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*ic;case"weeks":case"week":case"w":return t*oc;case"days":case"day":case"d":return t*Ie;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Ve;case"minutes":case"minute":case"mins":case"min":case"m":return t*$e;case"seconds":case"second":case"secs":case"sec":case"s":return t*Oe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function cc(r){var e=Math.abs(r);return e>=Ie?Math.round(r/Ie)+"d":e>=Ve?Math.round(r/Ve)+"h":e>=$e?Math.round(r/$e)+"m":e>=Oe?Math.round(r/Oe)+"s":r+"ms"}function ac(r){var e=Math.abs(r);return e>=Ie?zt(r,e,Ie,"day"):e>=Ve?zt(r,e,Ve,"hour"):e>=$e?zt(r,e,$e,"minute"):e>=Oe?zt(r,e,Oe,"second"):r+" ms"}function zt(r,e,t,n){var o=e>=t*1.5;return Math.round(r/t)+" "+n+(o?"s":"")}});var io=Pt((ql,oo)=>{function uc(r){t.debug=t,t.default=t,t.coerce=u,t.disable=i,t.enable=o,t.enabled=s,t.humanize=no(),t.destroy=h,Object.keys(r).forEach(l=>{t[l]=r[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let f=0;for(let g=0;g<l.length;g++)f=(f<<5)-f+l.charCodeAt(g),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(l){let f,g=null,b,y;function x(...m){if(!x.enabled)return;let A=x,T=Number(new Date),N=T-(f||T);A.diff=N,A.prev=f,A.curr=T,f=T,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let F=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(Y,q)=>{if(Y==="%%")return"%";F++;let ee=t.formatters[q];if(typeof ee=="function"){let Pe=m[F];Y=ee.call(A,Pe),m.splice(F,1),F--}return Y}),t.formatArgs.call(A,m),(A.log||t.log).apply(A,m)}return x.namespace=l,x.useColors=t.useColors(),x.color=t.selectColor(l),x.extend=n,x.destroy=t.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(b!==t.namespaces&&(b=t.namespaces,y=t.enabled(l)),y),set:m=>{g=m}}),typeof t.init=="function"&&t.init(x),x}function n(l,f){let g=t(this.namespace+(typeof f>"u"?":":f)+l);return g.log=this.log,g}function o(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let f,g=(typeof l=="string"?l:"").split(/[\s,]+/),b=g.length;for(f=0;f<b;f++)g[f]&&(l=g[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.slice(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function i(){let l=[...t.names.map(c),...t.skips.map(c).map(f=>"-"+f)].join(",");return t.enable(""),l}function s(l){if(l[l.length-1]==="*")return!0;let f,g;for(f=0,g=t.skips.length;f<g;f++)if(t.skips[f].test(l))return!1;for(f=0,g=t.names.length;f<g;f++)if(t.names[f].test(l))return!0;return!1}function c(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function u(l){return l instanceof Error?l.stack||l.message:l}function h(){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}oo.exports=uc});var so=Pt((X,Gt)=>{X.formatArgs=fc;X.save=dc;X.load=hc;X.useColors=lc;X.storage=pc();X.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`."))}})();X.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 lc(){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 fc(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Gt.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)}X.log=console.debug||console.log||(()=>{});function dc(r){try{r?X.storage.setItem("debug",r):X.storage.removeItem("debug")}catch{}}function hc(){let r;try{r=X.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function pc(){try{return localStorage}catch{}}Gt.exports=io()(X);var{formatters:mc}=Gt.exports;mc.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Uo=Pt(($f,Io)=>{"use strict";function ko(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function Wc(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return ko(r,t)}catch{t.message=r.message,t.stack=r.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(r)),ko(new o,t)}}Io.exports=Wc});var ml={};H(ml,{LIBP2P_DEVTOOLS_METRICS_KEY:()=>Qs,SOURCE_CONTENT_SCRIPT:()=>hl,SOURCE_DEVTOOLS:()=>Ks,SOURCE_METRICS:()=>Js,SOURCE_SERVICE_WORKER:()=>dl,devToolsMetrics:()=>pl,valueCodecs:()=>Xn});var Ot=Symbol.for("@libp2p/peer-id");function Zn(r){return r!=null&&!!r[Ot]}var $t=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};function Yn(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function eo(...r){let e=[];for(let t of r)Yn(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 to(...r){let e=[];for(let t of r)Yn(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 Vt=Symbol.for("@libp2p/service-capabilities"),bl=Symbol.for("@libp2p/service-dependencies");var $=Qn(so(),1);var Mr={};H(Mr,{base32:()=>ce,base32hex:()=>Ac,base32hexpad:()=>kc,base32hexpadupper:()=>Ic,base32hexupper:()=>Cc,base32pad:()=>vc,base32padupper:()=>Sc,base32upper:()=>Ec,base32z:()=>Uc});var Hl=new Uint8Array(0);function co(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 me(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function ao(r){return new TextEncoder().encode(r)}function uo(r){return new TextDecoder().decode(r)}function gc(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var c=r.length,u=r.charAt(0),h=Math.log(c)/Math.log(256),l=Math.log(256)/Math.log(c);function f(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var x=0,m=0,A=0,T=y.length;A!==T&&y[A]===0;)A++,x++;for(var N=(T-A)*l+1>>>0,F=new Uint8Array(N);A!==T;){for(var j=y[A],Y=0,q=N-1;(j!==0||Y<m)&&q!==-1;q--,Y++)j+=256*F[q]>>>0,F[q]=j%c>>>0,j=j/c>>>0;if(j!==0)throw new Error("Non-zero carry");m=Y,A++}for(var ee=N-m;ee!==N&&F[ee]===0;)ee++;for(var Pe=u.repeat(x);ee<N;++ee)Pe+=r.charAt(F[ee]);return Pe}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var x=0;if(y[x]!==" "){for(var m=0,A=0;y[x]===u;)m++,x++;for(var T=(y.length-x)*h+1>>>0,N=new Uint8Array(T);y[x];){var F=t[y.charCodeAt(x)];if(F===255)return;for(var j=0,Y=T-1;(F!==0||j<A)&&Y!==-1;Y--,j++)F+=c*N[Y]>>>0,N[Y]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");A=j,x++}if(y[x]!==" "){for(var q=T-A;q!==T&&N[q]===0;)q++;for(var ee=new Uint8Array(m+(T-q)),Pe=m;q!==T;)ee[Pe++]=N[q++];return ee}}}function b(y){var x=g(y);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:g,decode:b}}var yc=gc,wc=yc,fo=wc;var Nr=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")}},Lr=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ho(this,e)}},Fr=class{decoders;constructor(e){this.decoders=e}or(e){return ho(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ho(r,e){return new Fr({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var _r=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 Nr(e,t,n),this.decoder=new Lr(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ze({name:r,prefix:e,encode:t,decode:n}){return new _r(r,e,t,n)}function xe({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=fo(t,r);return ze({prefix:e,name:r,encode:n,decode:i=>me(o(i))})}function xc(r,e,t,n){let o={};for(let l=0;l<e.length;++l)o[e[l]]=l;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),c=0,u=0,h=0;for(let l=0;l<i;++l){let f=o[r[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<t|f,c+=t,c>=8&&(c-=8,s[h++]=255&u>>c)}if(c>=t||255&u<<8-c)throw new SyntaxError("Unexpected end of data");return s}function bc(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,c=0;for(let u=0;u<r.length;++u)for(c=c<<8|r[u],s+=8;s>t;)s-=t,i+=e[o&c>>s];if(s!==0&&(i+=e[o&c<<t-s]),n)for(;i.length*t&7;)i+="=";return i}function U({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return ze({prefix:e,name:r,encode(o){return bc(o,n,t)},decode(o){return xc(o,n,t,r)}})}var ce=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ec=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vc=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Sc=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ac=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Cc=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kc=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ic=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Uc=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Dr={};H(Dr,{base58btc:()=>L,base58flickr:()=>Tc});var L=xe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Tc=xe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Br={};H(Br,{base64:()=>he,base64pad:()=>Nc,base64url:()=>Lc,base64urlpad:()=>Fc});var he=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Nc=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Lc=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Fc=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});$.default.formatters.b=r=>r==null?"undefined":L.baseEncode(r);$.default.formatters.t=r=>r==null?"undefined":ce.baseEncode(r);$.default.formatters.m=r=>r==null?"undefined":he.baseEncode(r);$.default.formatters.p=r=>r==null?"undefined":r.toString();$.default.formatters.c=r=>r==null?"undefined":r.toString();$.default.formatters.k=r=>r==null?"undefined":r.toString();$.default.formatters.a=r=>r==null?"undefined":r.toString();function _c(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function po(r){let e=_c(`${r}:trace`);return $.default.enabled(`${r}:trace`)&&$.default.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=(0,$.default)(`${r}:trace`)),Object.assign((0,$.default)(r),{error:(0,$.default)(`${r}:error`),trace:e})}function mo(){$.default.disable()}function go(r){$.default.enable(r)}function Mc(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var yo=Mc;function Dc(r){return r[Symbol.asyncIterator]!=null}function wo(r){return r?.then!=null}function Bc(r,e){let t=0;if(Dc(r))return async function*(){for await(let u of r){let h=e(u,t++);wo(h)&&await h,yield u}}();let n=yo(r),{value:o,done:i}=n.next();if(i===!0)return function*(){}();if(typeof e(o,t++)?.then=="function")return async function*(){yield o;for await(let u of n){let h=e(u,t++);wo(h)&&await h,yield u}}();let c=e;return function*(){yield o;for(let u of n)c(u,t++),yield u}()}var Rr=Bc;var Rc=po("libp2p:simple-metrics"),lt=class{value=0;update(e){this.value=e}increment(e=1){this.value+=e}decrement(e=1){this.value-=e}reset(){this.value=0}timer(){let e=Date.now();return()=>{this.value=Date.now()-e}}},ft=class{values={};update(e){Object.entries(e).forEach(([t,n])=>{this.values[t]=n})}increment(e){Object.entries(e).forEach(([t,n])=>{this.values[t]=this.values[t]??0;let o=typeof n=="number"?n:1;this.values[t]+=Number(o)})}decrement(e){Object.entries(e).forEach(([t,n])=>{this.values[t]=this.values[t]??0;let o=typeof n=="number"?n:1;this.values[t]-=Number(o)})}reset(){this.values={}}timer(e){let t=Date.now();return()=>{this.values[e]=Date.now()-t}}},Pr=class{metrics=new Map;transferStats;started;interval;intervalMs;onMetrics;constructor(e,t){this.started=!1,this._emitMetrics=this._emitMetrics.bind(this),this.intervalMs=t.intervalMs??1e3,this.onMetrics=t.onMetrics,this.transferStats=new Map}[Symbol.toStringTag]="@libp2p/metrics-simple";[Vt]=["@libp2p/metrics"];isStarted(){return this.started}start(){this.started=!0,this.interval=setInterval(this._emitMetrics,this.intervalMs)}stop(){this.started=!1,clearInterval(this.interval)}_emitMetrics(){Promise.resolve().then(async()=>{let e={};for(let[t,n]of this.metrics.entries())n instanceof lt?e[t]=n.value:n instanceof ft?e[t]=n.values:e[t]=await n();this.onMetrics(structuredClone(e))}).catch(e=>{Rc.error("could not invoke onMetrics callback",e)})}_incrementValue(e,t){let n=this.transferStats.get(e)??0;this.transferStats.set(e,n+t)}_track(e,t){let n=this,o=e.sink;e.sink=async function(c){await o(Rr(c,u=>{n._incrementValue(`${t} sent`,u.byteLength)}))};let i=e.source;e.source=Rr(i,s=>{n._incrementValue(`${t} received`,s.byteLength)})}trackMultiaddrConnection(e){this._track(e,"global")}trackProtocolStream(e,t){e.protocol!=null&&this._track(e,e.protocol)}registerMetric(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new lt;return this.metrics.set(e,n),n}registerMetricGroup(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new ft;return this.metrics.set(e,n),n}registerCounter(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new lt;return this.metrics.set(e,n),n}registerCounterGroup(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new ft;return this.metrics.set(e,n),n}};function xo(r){return e=>new Pr(e,r)}function ae(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var jt=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Ge=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new jt(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 jt(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Or=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function be(r={}){return Pc(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 Pc(r,e){e=e??{};let t=e.onEnd,n=new Ge,o,i,s,c=ae(),u=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((m,A)=>{i=T=>{i=null,n.push(T);try{m(r(n))}catch(N){A(N)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{c.resolve(),c=ae()})}},h=m=>i!=null?i(m):(n.push(m),o),l=m=>(n=new Ge,i!=null?i({error:m}):(n.push({error:m}),o)),f=m=>{if(s)return o;if(e?.objectMode!==!0&&m?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return h({done:!1,value:m})},g=m=>s?o:(s=!0,m!=null?l(m):h({done:!0})),b=()=>(n=new Ge,g(),{done:!0}),y=m=>(g(m),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:u,return:b,throw:y,push:f,end:g,get readableLength(){return n.size},onEmpty:async m=>{let A=m?.signal;if(A?.throwIfAborted(),n.isEmpty())return;let T,N;A!=null&&(T=new Promise((F,j)=>{N=()=>{j(new Or)},A.addEventListener("abort",N)}));try{await Promise.race([c.promise,T])}finally{N!=null&&A!=null&&A?.removeEventListener("abort",N)}}},t==null)return o;let x=o;return o={[Symbol.asyncIterator](){return this},next(){return x.next()},throw(m){return x.throw(m),t!=null&&(t(m),t=void 0),{done:!0}},return(){return x.return(),t!=null&&(t(),t=void 0),{done:!0}},push:f,end(m){return x.end(m),t!=null&&(t(m),t=void 0),o},get readableLength(){return x.readableLength},onEmpty:m=>x.onEmpty(m)},o}function Oc(r){return r[Symbol.asyncIterator]!=null}function $c(...r){let e=[];for(let t of r)Oc(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=be({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let o of n)t.push(o)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var bo=$c;function Eo(r,...e){if(r==null)throw new Error("Empty pipeline");if($r(r)){let n=r;r=()=>n.source}else if(So(r)||vo(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&$r(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++)$r(t[n])&&(t[n]=zc(t[n]));return Vc(...t)}var Vc=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},vo=r=>r?.[Symbol.asyncIterator]!=null,So=r=>r?.[Symbol.iterator]!=null,$r=r=>r==null?!1:r.sink!=null&&r.source!=null,zc=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=be({objectMode:!0});t.then(()=>{n.end()},s=>{n.end(s)});let o,i=r.source;if(vo(i))o=async function*(){yield*i,n.end()};else if(So(i))o=function*(){yield*i,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return bo(n,o())}return r.source};function qt(r){let e=new globalThis.AbortController;function t(){e.abort();for(let i of r)i?.removeEventListener!=null&&i.removeEventListener("abort",t)}for(let i of r){if(i?.aborted===!0){t();break}i?.addEventListener!=null&&i.addEventListener("abort",t)}function n(){for(let i of r)i?.removeEventListener!=null&&i.removeEventListener("abort",t)}let o=e.signal;return o.clear=n,o}function ue(r=0){return new Uint8Array(r)}function R(r=0){return new Uint8Array(r)}var Gc=Math.pow(2,7),jc=Math.pow(2,14),qc=Math.pow(2,21),Vr=Math.pow(2,28),zr=Math.pow(2,35),Gr=Math.pow(2,42),jr=Math.pow(2,49),S=128,P=127;function _(r){if(r<Gc)return 1;if(r<jc)return 2;if(r<qc)return 3;if(r<Vr)return 4;if(r<zr)return 5;if(r<Gr)return 6;if(r<jr)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function qr(r,e,t=0){switch(_(r)){case 8:e[t++]=r&255|S,r/=128;case 7:e[t++]=r&255|S,r/=128;case 6:e[t++]=r&255|S,r/=128;case 5:e[t++]=r&255|S,r/=128;case 4:e[t++]=r&255|S,r>>>=7;case 3:e[t++]=r&255|S,r>>>=7;case 2:e[t++]=r&255|S,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Hc(r,e,t=0){switch(_(r)){case 8:e.set(t++,r&255|S),r/=128;case 7:e.set(t++,r&255|S),r/=128;case 6:e.set(t++,r&255|S),r/=128;case 5:e.set(t++,r&255|S),r/=128;case 4:e.set(t++,r&255|S),r>>>=7;case 3:e.set(t++,r&255|S),r>>>=7;case 2:e.set(t++,r&255|S),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function Hr(r,e){let t=r[e],n=0;if(n+=t&P,t<S||(t=r[e+1],n+=(t&P)<<7,t<S)||(t=r[e+2],n+=(t&P)<<14,t<S)||(t=r[e+3],n+=(t&P)<<21,t<S)||(t=r[e+4],n+=(t&P)*Vr,t<S)||(t=r[e+5],n+=(t&P)*zr,t<S)||(t=r[e+6],n+=(t&P)*Gr,t<S)||(t=r[e+7],n+=(t&P)*jr,t<S))return n;throw new RangeError("Could not decode varint")}function Xc(r,e){let t=r.get(e),n=0;if(n+=t&P,t<S||(t=r.get(e+1),n+=(t&P)<<7,t<S)||(t=r.get(e+2),n+=(t&P)<<14,t<S)||(t=r.get(e+3),n+=(t&P)<<21,t<S)||(t=r.get(e+4),n+=(t&P)*Vr,t<S)||(t=r.get(e+5),n+=(t&P)*zr,t<S)||(t=r.get(e+6),n+=(t&P)*Gr,t<S)||(t=r.get(e+7),n+=(t&P)*jr,t<S))return n;throw new RangeError("Could not decode varint")}function Ee(r,e,t=0){return e==null&&(e=R(_(r))),e instanceof Uint8Array?qr(r,e,t):Hc(r,e,t)}function ge(r,e=0){return r instanceof Uint8Array?Hr(r,e):Xc(r,e)}function te(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=R(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}function Ue(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 Co=Symbol.for("@achingbrain/uint8arraylist");function Ao(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 Xt(r){return!!r?.[Co]}var je=class r{bufs;length;[Co]=!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(Xt(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(Xt(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=Ao(this.bufs,e);return t.buf[t.index]}set(e,t){let n=Ao(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(Xt(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 te(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:te(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),i=new r;return i.length=o,i.bufs=[...n],i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let s=this.bufs[i],c=o,u=c+s.byteLength;if(o=u,e>=u)continue;let h=e>=c&&e<u,l=t>c&&t<=u;if(h&&l){if(e===c&&t===u){n.push(s);break}let f=e-c;n.push(s.subarray(f,f+(t-e)));break}if(h){if(e===0){n.push(s);continue}n.push(s.subarray(e-c));continue}if(l){if(t===u){n.push(s);break}n.push(s.subarray(0,t-c));break}n.push(s)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!Xt(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,s=new Int32Array(i);for(let f=0;f<i;f++)s[f]=-1;for(let f=0;f<o;f++)s[n[f]]=f;let c=s,u=this.byteLength-n.byteLength,h=n.byteLength-1,l;for(let f=t;f<=u;f+=l){l=0;for(let g=h;g>=0;g--){let b=this.get(f+g);if(n[g]!==b){l=Math.max(1,g-c[b]);break}}if(l===0)return f}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=R(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=ue(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=ue(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=ue(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=R(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=ue(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=ue(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=ue(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=ue(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=ue(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(!Ue(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,i)=>o+i.byteLength,0)),n.length=t,n}};function Wt(r){return r[Symbol.asyncIterator]!=null}var Kt=r=>{let e=_(r),t=R(e);return Ee(r,t),Kt.bytes=e,t};Kt.bytes=0;function Jt(r,e){e=e??{};let t=e.lengthEncoder??Kt;function*n(o){let i=t(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return Wt(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}Jt.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??Kt;return new je(t(r.byteLength),r)};var qe=Qn(Uo(),1);var Kc=8,Jc=1024*1024*4,Te;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(Te||(Te={}));var Xr=r=>{let e=ge(r);return Xr.bytes=_(e),e};Xr.bytes=0;function dt(r,e){let t=new je,n=Te.LENGTH,o=-1,i=e?.lengthDecoder??Xr,s=e?.maxLengthLength??Kc,c=e?.maxDataLength??Jc;function*u(){for(;t.byteLength>0;){if(n===Te.LENGTH)try{if(o=i(t),o<0)throw(0,qe.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(o>c)throw(0,qe.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let h=i.bytes;t.consume(h),e?.onLength!=null&&e.onLength(o),n=Te.DATA}catch(h){if(h instanceof RangeError){if(t.byteLength>s)throw(0,qe.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw h}if(n===Te.DATA){if(t.byteLength<o)break;let h=t.sublist(0,o);t.consume(o),e?.onData!=null&&e.onData(h),yield h,n=Te.LENGTH}}}return Wt(r)?async function*(){for await(let h of r)t.append(h),yield*u();if(t.byteLength>0)throw(0,qe.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let h of r)t.append(h),yield*u();if(t.byteLength>0)throw(0,qe.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}dt.fromReader=(r,e)=>{let t=1,n=async function*(){for(;;)try{let{done:i,value:s}=await r.next(t);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{t=1}}();return dt(n,{...e??{},onLength:i=>{t=i}})};var To="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var He=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r));for(;r--;)e+=To[t[r]&63];return e};var Qt=class extends Error{constructor(e="Method not found"){super(e),this.name="MethodNotFoundError"}},Zt=class extends Error{constructor(e="Invocation target was not a function"){super(e),this.name="InvalidMethodError"}},ht=class extends Error{constructor(e="Unsupported value type"){super(e),this.name="UnsupportedValueTypeError"}},Yt=class extends Error{constructor(e="Cannot reuse RPC target name"){super(e),this.name="DuplicateTargetNameError"}},pt=class extends Error{constructor(e="Duplicate scope"){super(e),this.name="DuplicateScopeError"}},er=class extends Error{constructor(e="Invalid return type"){super(e),this.name="InvalidReturnTypeError"}},mt=class extends Error{constructor(e="Invocation target was not a function"){super(e),this.name="InvalidInvocationTypeError"}},Xe=class extends Error{constructor(e="Parent invocation scope not found"){super(e),this.name="MissingParentScopeError"}},tr=class extends Error{constructor(e="Invocation not found"){super(e),this.name="MissingInvocationError"}},rr=class extends Error{constructor(e="Callback not found"){super(e),this.name="MissingCallbackError"}};var Wr=new Float32Array([-0]),ve=new Uint8Array(Wr.buffer);function No(r,e,t){Wr[0]=r,e[t]=ve[0],e[t+1]=ve[1],e[t+2]=ve[2],e[t+3]=ve[3]}function Lo(r,e){return ve[0]=r[e],ve[1]=r[e+1],ve[2]=r[e+2],ve[3]=r[e+3],Wr[0]}var Kr=new Float64Array([-0]),O=new Uint8Array(Kr.buffer);function Fo(r,e,t){Kr[0]=r,e[t]=O[0],e[t+1]=O[1],e[t+2]=O[2],e[t+3]=O[3],e[t+4]=O[4],e[t+5]=O[5],e[t+6]=O[6],e[t+7]=O[7]}function _o(r,e){return O[0]=r[e],O[1]=r[e+1],O[2]=r[e+2],O[3]=r[e+3],O[4]=r[e+4],O[5]=r[e+5],O[6]=r[e+6],O[7]=r[e+7],Kr[0]}var Qc=BigInt(Number.MAX_SAFE_INTEGER),Zc=BigInt(Number.MIN_SAFE_INTEGER),W=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 Ne;if(e<Qc&&e>Zc)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>Mo&&(o=0n,++n>Mo&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(e){if(e===0)return Ne;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):Ne}},Ne=new W(0,0);Ne.toBigInt=function(){return 0n};Ne.zzEncode=Ne.zzDecode=function(){return this};Ne.length=function(){return 1};var Mo=4294967296n;function Do(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 Bo(r,e,t){if(t-e<1)return"";let o,i=[],s=0,c;for(;e<t;)c=r[e++],c<128?i[s++]=c:c>191&&c<224?i[s++]=(c&31)<<6|r[e++]&63:c>239&&c<365?(c=((c&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[s++]=55296+(c>>10),i[s++]=56320+(c&1023)):i[s++]=(c&15)<<12|(r[e++]&63)<<6|r[e++]&63,s>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o!=null?(s>0&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function Jr(r,e,t){let n=t,o,i;for(let s=0;s<r.length;++s)o=r.charCodeAt(s),o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&((i=r.charCodeAt(s+1))&64512)===56320?(o=65536+((o&1023)<<10)+(i&1023),++s,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}function le(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function nr(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var Qr=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,le(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 le(this,4);return nr(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw le(this,4);return nr(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw le(this,4);let e=Lo(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw le(this,4);let e=_o(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 le(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return Bo(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw le(this,e);this.pos+=e}else do if(this.pos>=this.len)throw le(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new W(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 le(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 le(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 le(this,8);let e=nr(this.buf,this.pos+=4),t=nr(this.buf,this.pos+=4);return new W(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=Hr(this.buf,this.pos);return this.pos+=_(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 Zr(r){return new Qr(r instanceof Uint8Array?r:r.subarray())}function re(r,e,t){let n=Zr(r);return e.decode(n,void 0,t)}var Yr={};H(Yr,{base10:()=>Yc});var Yc=xe({prefix:"9",name:"base10",alphabet:"0123456789"});var en={};H(en,{base16:()=>ea,base16upper:()=>ta});var ea=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ta=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tn={};H(tn,{base2:()=>ra});var ra=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var rn={};H(rn,{base256emoji:()=>ca});var Po=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}"),na=Po.reduce((r,e,t)=>(r[t]=e,r),[]),oa=Po.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function ia(r){return r.reduce((e,t)=>(e+=na[t],e),"")}function sa(r){let e=[];for(let t of r){let n=oa[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var ca=ze({prefix:"\u{1F680}",name:"base256emoji",encode:ia,decode:sa});var nn={};H(nn,{base36:()=>aa,base36upper:()=>ua});var aa=xe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ua=xe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var on={};H(on,{base8:()=>la});var la=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var sn={};H(sn,{identity:()=>fa});var fa=ze({prefix:"\0",name:"identity",encode:r=>uo(r),decode:r=>ao(r)});var hd=new TextEncoder,pd=new TextDecoder;var an={};H(an,{identity:()=>wt});var pa=Vo,Oo=128,ma=127,ga=~ma,ya=Math.pow(2,31);function Vo(r,e,t){e=e||[],t=t||0;for(var n=t;r>=ya;)e[t++]=r&255|Oo,r/=128;for(;r&ga;)e[t++]=r&255|Oo,r>>>=7;return e[t]=r|0,Vo.bytes=t-n+1,e}var wa=cn,xa=128,$o=127;function cn(r,n){var t=0,n=n||0,o=0,i=n,s,c=r.length;do{if(i>=c)throw cn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&$o)<<o:(s&$o)*Math.pow(2,o),o+=7}while(s>=xa);return cn.bytes=i-n,t}var ba=Math.pow(2,7),Ea=Math.pow(2,14),va=Math.pow(2,21),Sa=Math.pow(2,28),Aa=Math.pow(2,35),Ca=Math.pow(2,42),ka=Math.pow(2,49),Ia=Math.pow(2,56),Ua=Math.pow(2,63),Ta=function(r){return r<ba?1:r<Ea?2:r<va?3:r<Sa?4:r<Aa?5:r<Ca?6:r<ka?7:r<Ia?8:r<Ua?9:10},Na={encode:pa,decode:wa,encodingLength:Ta},La=Na,gt=La;function yt(r,e=0){return[gt.decode(r,e),gt.decode.bytes]}function We(r,e,t=0){return gt.encode(r,e,t),e}function Ke(r){return gt.encodingLength(r)}function Se(r,e){let t=e.byteLength,n=Ke(r),o=n+Ke(t),i=new Uint8Array(o+t);return We(r,i,0),We(t,i,n),i.set(e,o),new Je(r,t,e,i)}function Le(r){let e=me(r),[t,n]=yt(e),[o,i]=yt(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new Je(t,o,s,e)}function zo(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&co(r.bytes,t.bytes)}}var Je=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var Go=0,Fa="identity",jo=me;function _a(r){return Se(Go,jo(r))}var wt={code:Go,name:Fa,encode:jo,digest:_a};var fn={};H(fn,{sha256:()=>ir,sha512:()=>Ma});function ln({name:r,code:e,encode:t}){return new un(r,e,t)}var un=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Se(this.code,t):t.then(n=>Se(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Ho(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var ir=ln({name:"sha2-256",code:18,encode:Ho("SHA-256")}),Ma=ln({name:"sha2-512",code:19,encode:Ho("SHA-512")});function Xo(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Ba(t,dn(r),e??L.encoder);default:return Ra(t,dn(r),e??ce.encoder)}}var Wo=new WeakMap;function dn(r){let e=Wo.get(r);if(e==null){let t=new Map;return Wo.set(r,t),t}return e}var z=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==xt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Pa)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=Se(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&&zo(e.multihash,n.multihash)}toString(e){return Xo(this,e)}toJSON(){return{"/":Xo(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:s}=t;return new r(n,o,i,s??Ko(n,o,i.bytes))}else if(t[Oa]===!0){let{version:n,multihash:o,code:i}=t,s=Le(o);return r.create(n,i,s)}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!==xt)throw new Error(`Version 0 CID must use dag-pb (code: ${xt}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=Ko(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,xt,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=me(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new Je(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,g]=yt(e.subarray(t));return t+=g,f},o=n(),i=xt;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,c=n(),u=n(),h=t+u,l=h-s;return{version:o,codec:i,multihashCode:c,digestSize:u,multihashSize:l,size:h}}static parse(e,t){let[n,o]=Da(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return dn(i).set(n,e),i}};function Da(r,e){switch(r[0]){case"Q":{let t=e??L;return[L.prefix,t.decode(`${L.prefix}${r}`)]}case L.prefix:{let t=e??L;return[L.prefix,t.decode(r)]}case ce.prefix:{let t=e??ce;return[ce.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function Ba(r,e,t){let{prefix:n}=t;if(n!==L.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o}function Ra(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o}var xt=112,Pa=18;function Ko(r,e,t){let n=Ke(r),o=n+Ke(e),i=new Uint8Array(o+t.byteLength);return We(r,i,0),We(e,i,n),i.set(t,o),i}var Oa=Symbol.for("@ipld/js-cid/CID");var Ae={...sn,...tn,...on,...Yr,...en,...Mr,...nn,...Dr,...Br,...rn},Dd={...fn,...an};function Qo(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Jo=Qo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),hn=Qo("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=R(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),$a={utf8:Jo,"utf-8":Jo,hex:Ae.base16,latin1:hn,ascii:hn,binary:hn,...Ae},sr=$a;function _e(r,e="utf8"){let t=sr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function pn(r){let e=r??8192,t=e>>>1,n,o=e;return function(s){if(s<1||s>t)return R(s);o+s>e&&(n=R(e),o=0);let c=n.subarray(o,o+=s);return o&7&&(o=(o|7)+1),c}}var Me=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function mn(){}var yn=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Va=pn();function za(r){return globalThis.Buffer!=null?R(r):Va(r)}var Et=class{len;head;tail;states;constructor(){this.len=0,this.head=new Me(mn,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new Me(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new wn((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(cr,10,W.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=W.fromBigInt(e);return this._push(cr,t.length(),t)}uint64Number(e){return this._push(qr,_(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=W.fromBigInt(e).zzEncode();return this._push(cr,t.length(),t)}sint64Number(e){let t=W.fromNumber(e).zzEncode();return this._push(cr,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(gn,1,e?1:0)}fixed32(e){return this._push(bt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=W.fromBigInt(e);return this._push(bt,4,t.lo)._push(bt,4,t.hi)}fixed64Number(e){let t=W.fromNumber(e);return this._push(bt,4,t.lo)._push(bt,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(No,4,e)}double(e){return this._push(Fo,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(gn,1,0):this.uint32(t)._push(ja,t,e)}string(e){let t=Do(e);return t!==0?this.uint32(t)._push(Jr,t,e):this._push(gn,1,0)}fork(){return this.states=new yn(this),this.head=this.tail=new Me(mn,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 Me(mn,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=za(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function gn(r,e,t){e[t]=r&255}function Ga(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var wn=class extends Me{next;constructor(e,t){super(Ga,e,t),this.next=void 0}};function cr(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 bt(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 ja(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(Et.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(qa,e,r),this},Et.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(Ha,e,r),this});function qa(r,e,t){e.set(r,t)}function Ha(r,e,t){r.length<40?Jr(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(_e(r),t)}function xn(){return new Et}function ne(r,e){let t=xn();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var Qe;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(Qe||(Qe={}));function ar(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function bn(r){function e(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let t=function(i,s){let c=e(i);s.int32(c)},n=function(i){let s=i.int32();return e(s)};return ar("enum",Qe.VARINT,t,n)}function oe(r,e){return ar("message",Qe.LENGTH_DELIMITED,r,e)}var ye=class extends Error{code;constructor(e,t,n){super(e,n),this.code=t}};var E;(function(r){r.invokeMethod="invokeMethod",r.methodResolved="methodResolved",r.methodRejected="methodRejected",r.invokeGeneratorMethod="invokeGeneratorMethod",r.abortMethodInvocation="abortMethodInvocation",r.invokeCallback="invokeCallback",r.callbackResolved="callbackResolved",r.callbackRejected="callbackRejected",r.abortCallbackInvocation="abortCallbackInvocation"})(E||(E={}));var ur;(function(r){r[r.invokeMethod=0]="invokeMethod",r[r.methodResolved=1]="methodResolved",r[r.methodRejected=2]="methodRejected",r[r.invokeGeneratorMethod=3]="invokeGeneratorMethod",r[r.abortMethodInvocation=4]="abortMethodInvocation",r[r.invokeCallback=5]="invokeCallback",r[r.callbackResolved=6]="callbackResolved",r[r.callbackRejected=7]="callbackRejected",r[r.abortCallbackInvocation=8]="abortCallbackInvocation"})(ur||(ur={}));(function(r){r.codec=()=>bn(ur)})(E||(E={}));var G;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.type!=null&&t.type!==0&&(n.uint32(8),n.uint32(t.type)),t.value!=null&&(n.uint32(18),n.bytes(t.value)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={type:0},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.type=t.uint32();break}case 2:{i.value=t.bytes();break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(G||(G={}));var V;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.type!=null&&ur[t.type]!==0&&(n.uint32(8),E.codec().encode(t.type,n)),t.message!=null&&t.message.byteLength>0&&(n.uint32(18),n.bytes(t.message)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={type:E.invokeMethod,message:ue(0)},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.type=E.codec().decode(t);break}case 2:{i.message=t.bytes();break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(V||(V={}));var De;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.path!=null&&t.path!==""&&(n.uint32(18),n.string(t.path)),t.args!=null)for(let i of t.args)n.uint32(26),G.codec().encode(i,n);o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",path:"",args:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{i.path=t.string();break}case 3:{if(o.limits?.args!=null&&i.args.length===o.limits.args)throw new ye('decode error - map field "args" had too many elements',"ERR_MAX_LENGTH");i.args.push(G.codec().decode(t,t.uint32(),{limits:o.limits?.args$}));break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(De||(De={}));var vt;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:""},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(vt||(vt={}));var Ze;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.value!=null&&(n.uint32(18),G.codec().encode(t.value,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:""},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{i.value=G.codec().decode(t,t.uint32(),{limits:o.limits?.value});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(Ze||(Ze={}));var St;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.error!=null&&(n.uint32(18),G.codec().encode(t.error,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:""},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{i.error=G.codec().decode(t,t.uint32(),{limits:o.limits?.error});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(St||(St={}));var Ye;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);if(t.callback!=null&&t.callback!==""&&(n.uint32(26),n.string(t.callback)),t.args!=null)for(let i of t.args)n.uint32(34),G.codec().encode(i,n);o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[],callback:"",args:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ye('decode error - map field "parents" had too many elements',"ERR_MAX_LENGTH");i.parents.push(t.string());break}case 3:{i.callback=t.string();break}case 4:{if(o.limits?.args!=null&&i.args.length===o.limits.args)throw new ye('decode error - map field "args" had too many elements',"ERR_MAX_LENGTH");i.args.push(G.codec().decode(t,t.uint32(),{limits:o.limits?.args$}));break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(Ye||(Ye={}));var et;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ye('decode error - map field "parents" had too many elements',"ERR_MAX_LENGTH");i.parents.push(t.string());break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(et||(et={}));var At;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);t.value!=null&&(n.uint32(26),G.codec().encode(t.value,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ye('decode error - map field "parents" had too many elements',"ERR_MAX_LENGTH");i.parents.push(t.string());break}case 3:{i.value=G.codec().decode(t,t.uint32(),{limits:o.limits?.value});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(At||(At={}));var Ct;(function(r){let e;r.codec=()=>(e==null&&(e=oe((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);t.error!=null&&(n.uint32(26),G.codec().encode(t.error,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ye('decode error - map field "parents" had too many elements',"ERR_MAX_LENGTH");i.parents.push(t.string());break}case 3:{i.error=G.codec().decode(t,t.uint32(),{limits:o.limits?.error});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>ne(t,r.codec()),r.decode=(t,n)=>re(t,r.codec(),n)})(Ct||(Ct={}));function Xa(r){return r.parents!=null}function Zo(r,e){if(Xa(r))return Wa(r.parents,e);let t=e.get(r.scope);if(t==null)throw new tr;return t}function Wa(r,e){let t;for(let n of r){if(t==null){if(t=e.get(n),t==null)throw new Xe;continue}if(t=t.children.get(n),t==null)throw new Xe}if(t==null)throw new Xe;return t}var Ka={type:1024,canEncode:r=>r===void 0,decode:()=>{}},Yo=Ka;var Ja={type:1025,canEncode:r=>r===null,decode:()=>null},ei=Ja;var Qa=["string","number","bigint","symbol"],Za=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function ti(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(Qa.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(Ya(r))return"Buffer";let t=eu(r);return t||"Object"}function Ya(r){return r&&r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer.call(null,r)}function eu(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(Za.includes(e))return e}var a=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}};a.uint=new a(0,"uint",!0);a.negint=new a(1,"negint",!0);a.bytes=new a(2,"bytes",!0);a.string=new a(3,"string",!0);a.array=new a(4,"array",!1);a.map=new a(5,"map",!1);a.tag=new a(6,"tag",!1);a.float=new a(7,"float",!0);a.false=new a(7,"false",!0);a.true=new a(7,"true",!0);a.null=new a(7,"null",!0);a.undefined=new a(7,"undefined",!0);a.break=new a(7,"break",!0);var p=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}`}};var tt=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",tu=new TextDecoder,ru=new TextEncoder;function lr(r){return tt&&globalThis.Buffer.isBuffer(r)}function En(r){return r instanceof Uint8Array?lr(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}var ii=tt?(r,e,t)=>t-e>64?globalThis.Buffer.from(r.subarray(e,t)).toString("utf8"):ni(r,e,t):(r,e,t)=>t-e>64?tu.decode(r.subarray(e,t)):ni(r,e,t),si=tt?r=>r.length>64?globalThis.Buffer.from(r):ri(r):r=>r.length>64?ru.encode(r):ri(r),pe=r=>Uint8Array.from(r),rt=tt?(r,e,t)=>lr(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),ci=tt?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),En(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},ai=tt?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r);function ui(r,e){if(lr(r)&&lr(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 ri(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):(e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128)}return e}function ni(r,e,t){let n=[];for(;e<t;){let o=r[e],i=null,s=o>239?4:o>223?3:o>191?2:1;if(e+s<=t){let c,u,h,l;switch(s){case 1:o<128&&(i=o);break;case 2:c=r[e+1],(c&192)===128&&(l=(o&31)<<6|c&63,l>127&&(i=l));break;case 3:c=r[e+1],u=r[e+2],(c&192)===128&&(u&192)===128&&(l=(o&15)<<12|(c&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(i=l));break;case 4:c=r[e+1],u=r[e+2],h=r[e+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(l=(o&15)<<18|(c&63)<<12|(u&63)<<6|h&63,l>65535&&l<1114112&&(i=l))}}i===null?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),e+=s}return nu(n)}var oi=4096;function nu(r){let e=r.length;if(e<=oi)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=oi));return t}var ou=256,kt=class{constructor(e=ou){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)}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=ai(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=rt(n,0,this.cursor)}else t=ci(this.chunks,this.cursor);return e&&this.reset(),t}};var w="CBOR decode error:",vn="CBOR encode error:",It=[];It[23]=1;It[24]=2;It[25]=3;It[26]=5;It[27]=9;function we(r,e,t){if(r.length-e<t)throw new Error(`${w} not enough data for type`)}var M=[24,256,65536,4294967296,BigInt("18446744073709551616")];function K(r,e,t){we(r,e,1);let n=r[e];if(t.strict===!0&&n<M[0])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);return n}function J(r,e,t){we(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<M[1])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);return n}function Q(r,e,t){we(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<M[2])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);return n}function Z(r,e,t){we(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],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(t.strict===!0&&i<M[3])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(t.allowBigInt===!0)return i;throw new Error(`${w} integers outside of the safe integer range are not supported`)}function li(r,e,t,n){return new p(a.uint,K(r,e+1,n),2)}function fi(r,e,t,n){return new p(a.uint,J(r,e+1,n),3)}function di(r,e,t,n){return new p(a.uint,Q(r,e+1,n),5)}function hi(r,e,t,n){return new p(a.uint,Z(r,e+1,n),9)}function ie(r,e){return D(r,0,e.value)}function D(r,e,t){if(t<M[0]){let n=Number(t);r.push([e|n])}else if(t<M[1]){let n=Number(t);r.push([e|24,n])}else if(t<M[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<M[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<M[4]){let o=[e|27,0,0,0,0,0,0,0],i=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=i&255,i=i>>8,o[7]=i&255,i=i>>8,o[6]=i&255,i=i>>8,o[5]=i&255,o[4]=s&255,s=s>>8,o[3]=s&255,s=s>>8,o[2]=s&255,s=s>>8,o[1]=s&255,r.push(o)}else throw new Error(`${w} encountered BigInt larger than allowable range`)}}ie.encodedSize=function(e){return D.encodedSize(e.value)};D.encodedSize=function(e){return e<M[0]?1:e<M[1]?2:e<M[2]?3:e<M[3]?5:9};ie.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function pi(r,e,t,n){return new p(a.negint,-1-K(r,e+1,n),2)}function mi(r,e,t,n){return new p(a.negint,-1-J(r,e+1,n),3)}function gi(r,e,t,n){return new p(a.negint,-1-Q(r,e+1,n),5)}var Sn=BigInt(-1),yi=BigInt(1);function wi(r,e,t,n){let o=Z(r,e+1,n);if(typeof o!="bigint"){let i=-1-o;if(i>=Number.MIN_SAFE_INTEGER)return new p(a.negint,i,9)}if(n.allowBigInt!==!0)throw new Error(`${w} integers outside of the safe integer range are not supported`);return new p(a.negint,Sn-BigInt(o),9)}function fr(r,e){let t=e.value,n=typeof t=="bigint"?t*Sn-yi:t*-1-1;D(r,e.type.majorEncoded,n)}fr.encodedSize=function(e){let t=e.value,n=typeof t=="bigint"?t*Sn-yi:t*-1-1;return n<M[0]?1:n<M[1]?2:n<M[2]?3:n<M[3]?5:9};fr.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Ut(r,e,t,n){we(r,e,t+n);let o=rt(r,e+t,e+t+n);return new p(a.bytes,o,t+n)}function xi(r,e,t,n){return Ut(r,e,1,t)}function bi(r,e,t,n){return Ut(r,e,2,K(r,e+1,n))}function Ei(r,e,t,n){return Ut(r,e,3,J(r,e+1,n))}function vi(r,e,t,n){return Ut(r,e,5,Q(r,e+1,n))}function Si(r,e,t,n){let o=Z(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer bytes lengths not supported`);return Ut(r,e,9,o)}function dr(r){return r.encodedBytes===void 0&&(r.encodedBytes=r.type===a.string?si(r.value):r.value),r.encodedBytes}function nt(r,e){let t=dr(e);D(r,e.type.majorEncoded,t.length),r.push(t)}nt.encodedSize=function(e){let t=dr(e);return D.encodedSize(t.length)+t.length};nt.compareTokens=function(e,t){return su(dr(e),dr(t))};function su(r,e){return r.length<e.length?-1:r.length>e.length?1:ui(r,e)}function Tt(r,e,t,n,o){let i=t+n;we(r,e,i);let s=new p(a.string,ii(r,e+t,e+i),i);return o.retainStringBytes===!0&&(s.byteValue=rt(r,e+t,e+i)),s}function Ai(r,e,t,n){return Tt(r,e,1,t,n)}function Ci(r,e,t,n){return Tt(r,e,2,K(r,e+1,n),n)}function ki(r,e,t,n){return Tt(r,e,3,J(r,e+1,n),n)}function Ii(r,e,t,n){return Tt(r,e,5,Q(r,e+1,n),n)}function Ui(r,e,t,n){let o=Z(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer string lengths not supported`);return Tt(r,e,9,o,n)}var Ti=nt;function ot(r,e,t,n){return new p(a.array,n,t)}function Ni(r,e,t,n){return ot(r,e,1,t)}function Li(r,e,t,n){return ot(r,e,2,K(r,e+1,n))}function Fi(r,e,t,n){return ot(r,e,3,J(r,e+1,n))}function _i(r,e,t,n){return ot(r,e,5,Q(r,e+1,n))}function Mi(r,e,t,n){let o=Z(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer array lengths not supported`);return ot(r,e,9,o)}function Di(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${w} indefinite length items not allowed`);return ot(r,e,1,1/0)}function hr(r,e){D(r,a.array.majorEncoded,e.value)}hr.compareTokens=ie.compareTokens;hr.encodedSize=function(e){return D.encodedSize(e.value)};function it(r,e,t,n){return new p(a.map,n,t)}function Bi(r,e,t,n){return it(r,e,1,t)}function Ri(r,e,t,n){return it(r,e,2,K(r,e+1,n))}function Pi(r,e,t,n){return it(r,e,3,J(r,e+1,n))}function Oi(r,e,t,n){return it(r,e,5,Q(r,e+1,n))}function $i(r,e,t,n){let o=Z(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer map lengths not supported`);return it(r,e,9,o)}function Vi(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${w} indefinite length items not allowed`);return it(r,e,1,1/0)}function pr(r,e){D(r,a.map.majorEncoded,e.value)}pr.compareTokens=ie.compareTokens;pr.encodedSize=function(e){return D.encodedSize(e.value)};function zi(r,e,t,n){return new p(a.tag,t,1)}function Gi(r,e,t,n){return new p(a.tag,K(r,e+1,n),2)}function ji(r,e,t,n){return new p(a.tag,J(r,e+1,n),3)}function qi(r,e,t,n){return new p(a.tag,Q(r,e+1,n),5)}function Hi(r,e,t,n){return new p(a.tag,Z(r,e+1,n),9)}function mr(r,e){D(r,a.tag.majorEncoded,e.value)}mr.compareTokens=ie.compareTokens;mr.encodedSize=function(e){return D.encodedSize(e.value)};var du=20,hu=21,pu=22,mu=23;function Xi(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${w} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new p(a.null,null,1):new p(a.undefined,void 0,1)}function Wi(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${w} indefinite length items not allowed`);return new p(a.break,void 0,1)}function An(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${w} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${w} Infinity values are not supported`)}return new p(a.float,r,e)}function Ki(r,e,t,n){return An(Cn(r,e+1),3,n)}function Ji(r,e,t,n){return An(kn(r,e+1),5,n)}function Qi(r,e,t,n){return An(ts(r,e+1),9,n)}function gr(r,e,t){let n=e.value;if(n===!1)r.push([a.float.majorEncoded|du]);else if(n===!0)r.push([a.float.majorEncoded|hu]);else if(n===null)r.push([a.float.majorEncoded|pu]);else if(n===void 0)r.push([a.float.majorEncoded|mu]);else{let o,i=!1;(!t||t.float64!==!0)&&(Yi(n),o=Cn(fe,1),n===o||Number.isNaN(n)?(fe[0]=249,r.push(fe.slice(0,3)),i=!0):(es(n),o=kn(fe,1),n===o&&(fe[0]=250,r.push(fe.slice(0,5)),i=!0))),i||(gu(n),o=ts(fe,1),fe[0]=251,r.push(fe.slice(0,9)))}}gr.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){Yi(n);let o=Cn(fe,1);if(n===o||Number.isNaN(n))return 3;if(es(n),o=kn(fe,1),n===o)return 5}return 9};var Zi=new ArrayBuffer(9),se=new DataView(Zi,1),fe=new Uint8Array(Zi,0);function Yi(r){if(r===1/0)se.setUint16(0,31744,!1);else if(r===-1/0)se.setUint16(0,64512,!1);else if(Number.isNaN(r))se.setUint16(0,32256,!1);else{se.setFloat32(0,r);let e=se.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)se.setUint16(0,31744,!1);else if(t===0)se.setUint16(0,(r&2147483648)>>16|n>>13,!1);else{let o=t-127;o<-24?se.setUint16(0,0):o<-14?se.setUint16(0,(e&2147483648)>>16|1<<24+o,!1):se.setUint16(0,(e&2147483648)>>16|o+15<<10|n>>13,!1)}}}function Cn(r,e){if(r.length-e<2)throw new Error(`${w} 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,i;return n===0?i=o*2**-24:n!==31?i=(o+1024)*2**(n-25):i=o===0?1/0:NaN,t&32768?-i:i}function es(r){se.setFloat32(0,r,!1)}function kn(r,e){if(r.length-e<4)throw new Error(`${w} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}function gu(r){se.setFloat64(0,r,!1)}function ts(r,e){if(r.length-e<8)throw new Error(`${w} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}gr.compareTokens=ie.compareTokens;function v(r,e,t){throw new Error(`${w} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}function yr(r){return()=>{throw new Error(`${w} ${r}`)}}var d=[];for(let r=0;r<=23;r++)d[r]=v;d[24]=li;d[25]=fi;d[26]=di;d[27]=hi;d[28]=v;d[29]=v;d[30]=v;d[31]=v;for(let r=32;r<=55;r++)d[r]=v;d[56]=pi;d[57]=mi;d[58]=gi;d[59]=wi;d[60]=v;d[61]=v;d[62]=v;d[63]=v;for(let r=64;r<=87;r++)d[r]=xi;d[88]=bi;d[89]=Ei;d[90]=vi;d[91]=Si;d[92]=v;d[93]=v;d[94]=v;d[95]=yr("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)d[r]=Ai;d[120]=Ci;d[121]=ki;d[122]=Ii;d[123]=Ui;d[124]=v;d[125]=v;d[126]=v;d[127]=yr("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)d[r]=Ni;d[152]=Li;d[153]=Fi;d[154]=_i;d[155]=Mi;d[156]=v;d[157]=v;d[158]=v;d[159]=Di;for(let r=160;r<=183;r++)d[r]=Bi;d[184]=Ri;d[185]=Pi;d[186]=Oi;d[187]=$i;d[188]=v;d[189]=v;d[190]=v;d[191]=Vi;for(let r=192;r<=215;r++)d[r]=zi;d[216]=Gi;d[217]=ji;d[218]=qi;d[219]=Hi;d[220]=v;d[221]=v;d[222]=v;d[223]=v;for(let r=224;r<=243;r++)d[r]=yr("simple values are not supported");d[244]=v;d[245]=v;d[246]=v;d[247]=Xi;d[248]=yr("simple values are not supported");d[249]=Ki;d[250]=Ji;d[251]=Qi;d[252]=v;d[253]=v;d[254]=v;d[255]=Wi;var de=[];for(let r=0;r<24;r++)de[r]=new p(a.uint,r,1);for(let r=-1;r>=-24;r--)de[31-r]=new p(a.negint,r,1);de[64]=new p(a.bytes,new Uint8Array(0),1);de[96]=new p(a.string,"",1);de[128]=new p(a.array,0,1);de[160]=new p(a.map,0,1);de[244]=new p(a.false,!1,1);de[245]=new p(a.true,!0,1);de[246]=new p(a.null,null,1);function rs(r){switch(r.type){case a.false:return pe([244]);case a.true:return pe([245]);case a.null:return pe([246]);case a.bytes:return r.value.length?void 0:pe([64]);case a.string:return r.value===""?pe([96]):void 0;case a.array:return r.value===0?pe([128]):void 0;case a.map:return r.value===0?pe([160]):void 0;case a.uint:return r.value<24?pe([Number(r.value)]):void 0;case a.negint:if(r.value>=-24)return pe([31-Number(r.value)])}}var wu={float64:!1,mapSorter:Eu,quickEncodeToken:rs};function xu(){let r=[];return r[a.uint.major]=ie,r[a.negint.major]=fr,r[a.bytes.major]=nt,r[a.string.major]=Ti,r[a.array.major]=hr,r[a.map.major]=pr,r[a.tag.major]=mr,r[a.float.major]=gr,r}var ns=xu(),In=new kt,xr=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(`${vn} object contains circular references`);return new r(t,e)}},Ce={null:new p(a.null,null),undefined:new p(a.undefined,void 0),true:new p(a.true,!0),false:new p(a.false,!1),emptyArray:new p(a.array,0),emptyMap:new p(a.map,0)},ke={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new p(a.float,r):r>=0?new p(a.uint,r):new p(a.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new p(a.uint,r):new p(a.negint,r)},Uint8Array(r,e,t,n){return new p(a.bytes,r)},string(r,e,t,n){return new p(a.string,r)},boolean(r,e,t,n){return r?Ce.true:Ce.false},null(r,e,t,n){return Ce.null},undefined(r,e,t,n){return Ce.undefined},ArrayBuffer(r,e,t,n){return new p(a.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new p(a.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[Ce.emptyArray,new p(a.break)]:Ce.emptyArray;n=xr.createCheck(n,r);let o=[],i=0;for(let s of r)o[i++]=wr(s,t,n);return t.addBreakTokens?[new p(a.array,r.length),o,new p(a.break)]:[new p(a.array,r.length),o]},Object(r,e,t,n){let o=e!=="Object",i=o?r.keys():Object.keys(r),s=o?r.size:i.length;if(!s)return t.addBreakTokens===!0?[Ce.emptyMap,new p(a.break)]:Ce.emptyMap;n=xr.createCheck(n,r);let c=[],u=0;for(let h of i)c[u++]=[wr(h,t,n),wr(o?r.get(h):r[h],t,n)];return bu(c,t),t.addBreakTokens?[new p(a.map,s),c,new p(a.break)]:[new p(a.map,s),c]}};ke.Map=ke.Object;ke.Buffer=ke.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))ke[`${r}Array`]=ke.DataView;function wr(r,e={},t){let n=ti(r),o=e&&e.typeEncoders&&e.typeEncoders[n]||ke[n];if(typeof o=="function"){let s=o(r,n,e,t);if(s!=null)return s}let i=ke[n];if(!i)throw new Error(`${vn} unsupported type: ${n}`);return i(r,n,e,t)}function bu(r,e){e.mapSorter&&r.sort(e.mapSorter)}function Eu(r,e){let t=Array.isArray(r[0])?r[0][0]:r[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(t.type!==n.type)return t.type.compare(n.type);let o=t.type.major,i=ns[o].compareTokens(t,n);return i===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}function os(r,e,t,n){if(Array.isArray(e))for(let o of e)os(r,o,t,n);else t[e.type.major](r,e,n)}function vu(r,e,t){let n=wr(r,t);if(!Array.isArray(n)&&t.quickEncodeToken){let o=t.quickEncodeToken(n);if(o)return o;let i=e[n.type.major];if(i.encodedSize){let s=i.encodedSize(n,t),c=new kt(s);if(i(c,n,t),c.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return En(c.chunks[0])}}return In.reset(),os(In,n,e,t),In.toBytes(!0)}function C(r,e){return e=Object.assign({},wu,e),vu(r,ns,e)}var Su={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},br=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=de[e];if(t===void 0){let n=d[e];if(!n)throw new Error(`${w} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let o=e&31;t=n(this.data,this._pos,o,this.options)}return this._pos+=t.encodedLength,t}},Nt=Symbol.for("DONE"),Er=Symbol.for("BREAK");function Au(r,e,t){let n=[];for(let o=0;o<r.value;o++){let i=st(e,t);if(i===Er){if(r.value===1/0)break;throw new Error(`${w} got unexpected break to lengthed array`)}if(i===Nt)throw new Error(`${w} found array but not enough entries (got ${o}, expected ${r.value})`);n[o]=i}return n}function Cu(r,e,t){let n=t.useMaps===!0,o=n?void 0:{},i=n?new Map:void 0;for(let s=0;s<r.value;s++){let c=st(e,t);if(c===Er){if(r.value===1/0)break;throw new Error(`${w} got unexpected break to lengthed map`)}if(c===Nt)throw new Error(`${w} found map but not enough entries (got ${s} [no key], expected ${r.value})`);if(n!==!0&&typeof c!="string")throw new Error(`${w} non-string keys not supported (got ${typeof c})`);if(t.rejectDuplicateMapKeys===!0&&(n&&i.has(c)||!n&&c in o))throw new Error(`${w} found repeat map key "${c}"`);let u=st(e,t);if(u===Nt)throw new Error(`${w} found map but not enough entries (got ${s} [no value], expected ${r.value})`);n?i.set(c,u):o[c]=u}return n?i:o}function st(r,e){if(r.done())return Nt;let t=r.next();if(t.type===a.break)return Er;if(t.type.terminal)return t.value;if(t.type===a.array)return Au(t,r,e);if(t.type===a.map)return Cu(t,r,e);if(t.type===a.tag){if(e.tags&&typeof e.tags[t.value]=="function"){let n=st(r,e);return e.tags[t.value](n)}throw new Error(`${w} tag not supported (${t.value})`)}throw new Error("unsupported")}function is(r,e){if(!(r instanceof Uint8Array))throw new Error(`${w} data to decode must be a Uint8Array`);e=Object.assign({},Su,e);let t=e.tokenizer||new br(r,e),n=st(t,e);if(n===Nt)throw new Error(`${w} did not find any content to decode`);if(n===Er)throw new Error(`${w} got unexpected break`);return[n,r.subarray(t.pos())]}function k(r,e){let[t,n]=is(r,e);if(n.length>0)throw new Error(`${w} too many terminals, data makes no sense`);return t}var ku={type:1026,canEncode:r=>r===!0||r===!1,encode:r=>C(r),decode:r=>k(r)},ss=ku;var Iu={type:1027,canEncode:r=>typeof r=="number"&&!isNaN(r),encode:r=>C(r),decode:r=>k(r)},cs=Iu;var Uu={type:1028,canEncode:r=>typeof r=="string",encode:r=>C(r),decode:r=>k(r)},as=Uu;var Tu={type:1029,canEncode:r=>Array.isArray(r),encode:(r,e,t,n)=>C(r.map(o=>e.toValue(o,t,n))),decode:(r,e,t,n)=>k(r).map(o=>e.fromValue(o,t,n))},us=Tu;var Nu={type:1030,canEncode:r=>typeof r=="function",encode:(r,e,t,n)=>{let o=He();return n?.callbacks.set(o,{context:t,fn:r}),C(o)},decode:(r,e,t,n)=>async(...o)=>new Promise((i,s)=>{let c=k(r),u=He(),h={scope:u,result:ae(),callbacks:new Map,children:new Map,parents:[...n.parents,n.scope],abortControllers:[],abortSignals:[]};n.children.set(u,h),o=o.map(f=>e.toValue(f,null,h));let l=qt(h.abortSignals);l.addEventListener("abort",()=>{t.push(V.encode({type:E.abortCallbackInvocation,message:et.encode({scope:u,parents:h.parents})}))}),t.push(V.encode({type:E.invokeCallback,message:Ye.encode({scope:u,parents:h.parents,callback:c,args:o})})),h.result.promise.then(f=>{i(f)},f=>{s(f)}).finally(()=>{n.children.delete(u),l.clear()})})},ls=Nu;var Lu={type:1031,canEncode:r=>r.toString()==="NaN"&&isNaN(r),decode:()=>NaN},fs=Lu;var Fu={type:1032,canEncode:r=>r instanceof Error,encode:r=>C({message:r.message,name:r.name,code:r.code,type:r.type,stack:r.stack}),decode:r=>{let e=k(r),t=new Error(e.message);return t.name=e.name,t.stack=e.stack,t.code=e.code,t.type=e.type,t}},ds=Fu;var _u={type:1033,canEncode:r=>Array.isArray(r),encode:(r,e,t,n)=>{throw new Error("Promises are not supported")},decode:(r,e,t,n)=>{throw new Error("Promises are not supported")}},hs=_u;var ps=["__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString","constructor"],Mu={type:2147483647,canEncode:r=>typeof r=="object",encode:(r,e,t,n)=>{let o={};for(let i in r)ps.includes(i)||Object.hasOwn(r,i)&&(o[i]=r[i]);for(let i of Object.getOwnPropertyNames(Object.getPrototypeOf(r)))ps.includes(i)||(o[i]=r[i]);return C([...Object.entries(o)].map(([i,s])=>[e.toValue(i,r,n),e.toValue(s,r,n)]))},decode:(r,e,t,n)=>{let o={};return k(r).forEach(([s,c])=>{o[e.fromValue(s,t,n)]=e.fromValue(c,t,n)}),o}},Lt=Mu;var Du={type:1034,canEncode:r=>typeof r.next=="function"&&typeof r.throw=="function"&&typeof r.return=="function",encode:(r,e,t,n)=>Lt.encode({next:r.next.bind(r),throw:r.throw.bind(r),return:r.return.bind(r)},e,t,n),decode:(r,e,t,n)=>{let o=Lt.decode(r,e,t,n);return o[Symbol.asyncIterator]=()=>o,o}},ms=Du;var Bu={type:1035,canEncode:r=>typeof r=="bigint",encode:r=>C(r),decode:r=>BigInt(k(r))},gs=Bu;var Ru={type:1036,canEncode:r=>r instanceof Map,encode:(r,e,t,n)=>C([...r.entries()].map(([o,i])=>[e.toValue(o,t,n),e.toValue(i,t,n)])),decode:(r,e,t,n)=>{let o=new Map;return k(r).forEach(([s,c])=>{let u=e.fromValue(s,t,n),h=e.fromValue(c,t,n);o.set(u,h)}),o}},ys=Ru;var Pu={type:1037,canEncode:r=>r instanceof Set,encode:(r,e,t,n)=>C([...r.values()].map(o=>e.toValue(o,t,n))),decode:(r,e,t,n)=>{let o=new Set;return k(r).forEach(s=>{o.add(e.fromValue(s,t,n))}),o}},ws=Pu;var Ou={type:1038,canEncode:r=>r instanceof Uint8Array,encode:r=>r,decode:r=>r},xs=Ou;var $u={type:1039,canEncode:r=>r instanceof AbortSignal,encode:(r,e,t,n)=>(n?.abortSignals.push(r),new Uint8Array(0)),decode:(r,e,t,n)=>{let o=new AbortController;return n.abortControllers.push(o),o.signal}},bs=$u;var Vu={type:1040,canEncode:r=>r instanceof Date,encode:r=>C(r.toString()),decode:r=>new Date(k(r))},Es=Vu;var zu={type:1041,canEncode:r=>r instanceof RegExp,encode:r=>C({source:r.source,flags:r.flags}),decode:r=>{let{source:e,flags:t}=k(r);return new RegExp(e,t)}},vs=zu;var Ss=[Yo,ei,ss,cs,as,us,ls,fs,ds,hs,ms,gs,ys,ws,xs,bs,Es,vs,Lt];var vr=class{transformersMap;transformersList;constructor(e){this.transformersList=[...Ss,...e?.valueCodecs??[]].sort((t,n)=>t.type<n.type?-1:t.type>n.type?1:0),this.transformersMap={},this.transformersList.forEach(t=>{if(this.transformersMap[t.type]!=null)throw new Error(`Duplicate transformer type ${t.type}`);this.transformersMap[t.type]=t})}toValue(e,t,n){for(let o=0;o<this.transformersList.length;o++){let i=this.transformersList[o];if(i.canEncode(e))return{type:i.type,value:i.encode?.(e,this,t,n)}}throw new ht(`Unsupported value type "${e}"`)}fromValue(e,t,n){let o=this.transformersMap[e.type];if(o==null)throw new ht(`Unsupported value type "${e.type}"`);return o.decode(e.value??new Uint8Array(0),this,t,n)}};function Gu(r){return r.isScope===!0}function ju(r){return r.type===E.invokeMethod||r.type===E.invokeGeneratorMethod||r.type===E.invokeCallback}var Un=class{source;output;targets;invocations;values;messageHandlers;constructor(e){this.output=be(),this.source=Jt(this.output),this.targets=new Map,this.invocations=new Map,this.values=new vr(e),this.sink=this.sink.bind(this),this.messageHandlers={[E.invokeMethod]:{decoder:De,handler:this.handleInvokeMethod.bind(this)},[E.invokeGeneratorMethod]:{decoder:De,handler:this.handleInvokeGeneratorMethod.bind(this)},[E.abortMethodInvocation]:{decoder:vt,handler:this.handleAbortMethod.bind(this),isScope:!0},[E.methodResolved]:{decoder:Ze,handler:this.handleMethodResolved.bind(this),isScope:!0},[E.methodRejected]:{decoder:St,handler:this.handleMethodRejected.bind(this),isScope:!0,isError:!0},[E.invokeCallback]:{decoder:Ye,handler:this.handleInvokeCallback.bind(this),isScope:!0},[E.abortCallbackInvocation]:{decoder:et,handler:this.handleAbortCallback.bind(this),isScope:!0},[E.callbackResolved]:{decoder:At,handler:this.handleCallbackResolved.bind(this),isScope:!0},[E.callbackRejected]:{decoder:Ct,handler:this.handleCallbackRejected.bind(this),isScope:!0,isError:!0}}}async sink(e){for await(let t of dt(e))try{let n=V.decode(t),o=this.messageHandlers[n.type];if(o==null)continue;let i=o.decoder.decode(n.message),s;if(Gu(o))try{s=Zo(i,this.invocations)}catch{continue}o.handler(i,s).catch(c=>{ju(n)&&this.sendError(i,c),this.invocations.delete(i.scope)}).finally(()=>{n.type===E.invokeMethod&&this.invocations.delete(i.scope)})}catch{continue}}sendError(e,t){e.parents!=null?this.output.push(V.encode({type:E.callbackRejected,message:Ct.encode({scope:e.scope,parents:e.parents,error:this.values.toValue(t)})})):this.output.push(V.encode({type:E.methodRejected,message:St.encode({scope:e.scope,error:this.values.toValue(t)})}))}createClient(e){return this.proxy(e)}createTarget(e,t){if(this.targets.has(e))throw new Yt(`Cannot reuse RPC target name "${e}"`);this.targets.set(e,t)}async handleInvokeMethod(e){if(this.invocations.has(e.scope))throw new pt;let t=new Map,n=new Map,o={scope:e.scope,result:ae(),callbacks:t,children:n,parents:[],abortControllers:[],abortSignals:[]};this.invocations.set(e.scope,o);let i=this.lookupInvocationTarget(e.path),s=await i.fn.apply(i.context,e.args.map(c=>this.values.fromValue(c,this.output,o)));this.output.push(V.encode({type:E.methodResolved,message:Ze.encode({scope:e.scope,value:this.values.toValue(s)})}))}async handleAbortMethod(e,t){t.abortControllers.forEach(n=>{n.abort()})}async handleInvokeGeneratorMethod(e){if(this.invocations.has(e.scope))throw new pt;let t=new Map,n=new Map,o={scope:e.scope,result:ae(),callbacks:t,children:n,parents:[],abortControllers:[],abortSignals:[]};this.invocations.set(e.scope,o);let i=this.lookupInvocationTarget(e.path),s=i.fn.apply(i.context,e.args.map(u=>this.values.fromValue(u,this.output,o)));if(typeof s.next!="function")throw new er(`${e.path} did not return an async generator`);let c={next:async()=>{let u=await s.next();return u.done===!0&&this.invocations.delete(e.scope),u},throw:async u=>{try{let h=await s.throw(u);return h.done===!0&&this.invocations.delete(e.scope),h}catch(h){throw this.invocations.delete(e.scope),h}},return:async u=>{let h=await s.return(u);return h.done===!0&&this.invocations.delete(e.scope),h},[Symbol.asyncIterator]:()=>c};this.output.push(V.encode({type:E.methodResolved,message:Ze.encode({scope:e.scope,value:this.values.toValue(c,null,o)})}))}lookupInvocationTarget(e){let t=e.split("."),n=this.targets.get(t[0]),o=n;for(let i=1;i<t.length;i++)o=n,n=n?.[t[i]];if(n==null)throw o!=null&&e.endsWith(".then")?new Zt(`"${e.substring(0,e.length-5)}" was not a function`):new Qt(`Could not find "${e}" on target`);if(typeof n!="function")throw new mt("Invocation target was not a function");return{context:o,fn:n}}async handleMethodResolved(e,t){let n;e.value!=null&&(n=this.values.fromValue(e.value,this.output,t)),t.result.resolve(n)}async handleMethodRejected(e,t){let n;e.error!=null&&(n=this.values.fromValue(e.error,this.output,t)),t.result.reject(n)}async handleInvokeCallback(e,t){let n=t.callbacks.get(e.callback);if(n==null)throw new rr;let o=await n.fn.apply(n.context,e.args.map(i=>this.values.fromValue(i,this.output,t)));this.output.push(V.encode({type:E.callbackResolved,message:At.encode({scope:e.scope,parents:e.parents,value:this.values.toValue(o)})}))}async handleAbortCallback(e,t){t.abortControllers.forEach(n=>{n.abort()})}async handleCallbackResolved(e,t){let n;e.value!=null&&(n=this.values.fromValue(e.value,this.output,t)),t.children.get(e.scope)?.result.resolve(n),t.children.delete(e.scope)}async handleCallbackRejected(e,t){let n;e.error!=null&&(n=this.values.fromValue(e.error,this.output,t)),t.children.get(e.scope)?.result.reject(n),t.children.delete(e.scope)}proxy(e){let t=()=>{},n=this;return new Proxy(t,{get(o,i,s){return n.proxy(`${e==null?"":`${e}.`}${i.toString()}`)},apply(o,i,s){let c,u;function h(){return u==null&&(u=new Promise((f,g)=>{let b=He(),y={scope:b,result:ae(),callbacks:new Map,children:new Map,parents:[],abortControllers:[],abortSignals:[]};n.invocations.set(b,y),n.output.push(V.encode({type:E.invokeMethod,message:De.encode({scope:b,path:e,args:s.map(m=>n.values.toValue(m,null,y))})}));let x=qt(y.abortSignals);x.addEventListener("abort",()=>{n.output.push(V.encode({type:E.abortMethodInvocation,message:vt.encode({scope:b})}))}),y.result.promise.then(m=>{f(m)},m=>{g(m)}).finally(()=>{n.invocations.delete(b),x.clear()})})),u}function l(){if(c==null){let f=He(),g={scope:f,result:ae(),callbacks:new Map,children:new Map,parents:[],abortControllers:[],abortSignals:[]};n.invocations.set(f,g),n.output.push(V.encode({type:E.invokeGeneratorMethod,message:De.encode({scope:f,path:e,args:s.map(y=>n.values.toValue(y,null,g))})}));let b;c={async next(){if(b!=null)throw b;let x=await(await g.result.promise).next();return x.done===!0&&n.invocations.delete(f),x},async throw(y){if(b!=null)throw b;try{let m=await(await g.result.promise).throw(y);return m.done===!0&&n.invocations.delete(f),m}catch(x){throw n.invocations.delete(f),b=y,x}},async return(y){if(b!=null)throw b;let m=await(await g.result.promise).return(y);return m.done===!0&&n.invocations.delete(f),m},[Symbol.asyncIterator]:()=>c}}return c}return new Proxy(t,{get(f,g,b){if(g==="then")return h().then.bind(u);if(g==="catch")return h().catch.bind(u);if(g==="finally")return h().finally.bind(u);if(g===Symbol.asyncIterator)return()=>l();if(g==="next")return l().next.bind(c);if(g==="return")return l().return.bind(c);if(g==="throw")return l().throw.bind(c);if(g===Symbol.toStringTag)return"[object Object]";if(g==="constructor")return()=>{};throw new mt(`Property ${g.toString()} was not used as a promise or async generator`)}})}})}};function As(r){return new Un(r)}var Cs={type:4096,canEncode:r=>r.code!=null&&r.version!=null&&r.multihash!=null&&r["/"]!=null,encode:r=>r.bytes,decode:r=>z.decode(r)};var Ft=class extends Event{type;detail;constructor(e,t){super(e),this.type=e,this.detail=t}};var ks={type:4099,canEncode:r=>r instanceof Ft,encode:(r,e,t,n)=>C({type:r.type,detail:e.toValue(r.detail,t,n)}),decode:(r,e,t,n)=>{let{type:o,detail:i}=k(r);return new Ft(o,e.fromValue(i,t,n))}};function B(r,e="utf8"){let t=sr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var Sr=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 i=0,s=0,c=this.peekChar();if(c===void 0)return;let u=c==="0",h=2**(8*o)-1;for(;;){let l=this.readAtomically(()=>{let f=this.readChar();if(f===void 0)return;let g=Number.parseInt(f,e);if(!Number.isNaN(g))return g});if(l===void 0)break;if(i*=e,i+=l,i>h||(s+=1,t!==void 0&&s>t))return}if(s!==0)return!n&&u&&s>1?void 0:i})}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 s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return t[o]=s[0],t[o+1]=s[1],t[o+2]=s[2],t[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];t[o]=i>>8,t[o+1]=i&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 i=new Uint8Array(14),s=16-(n+2),[c]=e(i.subarray(0,s));return t.set(i.subarray(0,c),16-c),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Is=45,qu=15,ct=new Sr;function Tn(r){if(!(r.length>qu))return ct.new(r).parseWith(()=>ct.readIPv4Addr())}function Nn(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>Is))return ct.new(r).parseWith(()=>ct.readIPv6Addr())}function Ar(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>Is))return ct.new(r).parseWith(()=>ct.readIPAddr())}var Hm=parseInt("0xFFFF",16),Xm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Ns(r){return!!Tn(r)}function Ls(r){return!!Nn(r)}function Cr(r){return!!Ar(r)}var Fs=Ns,Ju=Ls,Ln=function(r){let e=0;if(r=r.toString().trim(),Fs(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if(Ju(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=Fs(t[n]),s;i&&(s=Ln(t[n]),t[n]=B(s.slice(0,2),"base16")),s!=null&&++n<8&&t.splice(n,0,B(s.slice(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 i=[n,1];for(n=9-t.length;n>0;n--)i.push("0");t.splice.apply(t,i)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let i=parseInt(t[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},_s=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let i=0;i<t;i++)o.push(r[e+i]);return o.join(".")}if(t===16){let o=[];for(let i=0;i<t;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var at={},Fn={},Zu=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[481,-1,"http-path"],[777,-1,"memory"]];Zu.forEach(r=>{let e=Yu(...r);Fn[e.code]=e,at[e.name]=e});function Yu(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function I(r){if(typeof r=="number"){if(Fn[r]!=null)return Fn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(at[r]!=null)return at[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ng=I("ip4"),Lg=I("ip6"),Fg=I("ipcidr");function Bn(r,e){switch(I(r).code){case 4:case 41:return tl(e);case 42:return Dn(e);case 6:case 273:case 33:case 132:return Bs(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Dn(e);case 421:return il(e);case 444:return Ds(e);case 445:return Ds(e);case 466:return ol(e);case 481:return globalThis.encodeURIComponent(Dn(e));default:return B(e,"base16")}}function Rn(r,e){switch(I(r).code){case 4:return Ms(e);case 41:return Ms(e);case 42:return Mn(e);case 6:case 273:case 33:case 132:return Pn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Mn(e);case 421:return rl(e);case 444:return sl(e);case 445:return cl(e);case 466:return nl(e);case 481:return Mn(globalThis.decodeURIComponent(e));default:return _e(e,"base16")}}var _n=Object.values(Ae).map(r=>r.decoder),el=function(){let r=_n[0].or(_n[1]);return _n.slice(2).forEach(e=>r=r.or(e)),r}();function Ms(r){if(!Cr(r))throw new Error("invalid ip address");return Ln(r)}function tl(r){let e=_s(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!Cr(e))throw new Error("invalid ip address");return e}function Pn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function Bs(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function Mn(r){let e=_e(r),t=Uint8Array.from(Ee(e.length));return te([t,e],t.length+e.length)}function Dn(r){let e=ge(r);if(r=r.slice(_(e)),r.length!==e)throw new Error("inconsistent lengths");return B(r)}function rl(r){let e;r[0]==="Q"||r[0]==="1"?e=Le(L.decode(`z${r}`)).bytes:e=z.parse(r).multihash.bytes;let t=Uint8Array.from(Ee(e.length));return te([t,e],t.length+e.length)}function nl(r){let e=el.decode(r),t=Uint8Array.from(Ee(e.length));return te([t,e],t.length+e.length)}function ol(r){let e=ge(r),t=r.slice(_(e));if(t.length!==e)throw new Error("inconsistent lengths");return"u"+B(t,"base64url")}function il(r){let e=ge(r),t=r.slice(_(e));if(t.length!==e)throw new Error("inconsistent lengths");return B(t,"base58btc")}function sl(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=ce.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=Pn(n);return te([t,o],t.length+o.length)}function cl(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=ce.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=Pn(n);return te([t,o],t.length+o.length)}function Ds(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=B(e,"base32"),o=Bs(t);return`${n}:${o}`}function Rs(r){r=On(r);let e=[],t=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let s=o[i],c=I(s);if(c.size===0){e.push([c.code]),t.push([c.code]);continue}if(i++,i>=o.length)throw Os("invalid address: "+r);if(c.path===!0){n=On(o.slice(i).join("/")),e.push([c.code,Rn(c.code,n)]),t.push([c.code,n]);break}let u=Rn(c.code,o[i]);e.push([c.code,u]),t.push([c.code,Bn(c.code,u)])}return{string:Ps(t),bytes:Vn(e),tuples:e,stringTuples:t,path:n}}function $n(r){let e=[],t=[],n=null,o=0;for(;o<r.length;){let i=ge(r,o),s=_(i),c=I(i),u=al(c,r.slice(o+s));if(u===0){e.push([i]),t.push([i]),o+=s;continue}let h=r.slice(o+s,o+s+u);if(o+=u+s,o>r.length)throw Os("Invalid address Uint8Array: "+B(r,"base16"));e.push([i,h]);let l=Bn(i,h);if(t.push([i,l]),c.path===!0){n=l;break}}return{bytes:Uint8Array.from(r),string:Ps(t),tuples:e,stringTuples:t,path:n}}function Ps(r){let e=[];return r.map(t=>{let n=I(t[0]);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),On(e.join("/"))}function Vn(r){return te(r.map(e=>{let t=I(e[0]),n=Uint8Array.from(Ee(t.code));return e.length>1&&e[1]!=null&&(n=te([n,e[1]])),n}))}function al(r,e){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let t=ge(e instanceof Uint8Array?e:Uint8Array.from(e));return t+_(t)}}function On(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Os(r){return new Error("Error parsing address: "+r)}var ul=Symbol.for("nodejs.util.inspect.custom"),zn=Symbol.for("@multiformats/js-multiaddr/multiaddr"),ll=[I("dns").code,I("dns4").code,I("dns6").code,I("dnsaddr").code],kr=class r{bytes;#t;#e;#r;#n;[zn]=!0;constructor(e){e==null&&(e="");let t;if(e instanceof Uint8Array)t=$n(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);t=Rs(e)}else if(Ir(e))t=$n(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#t=t.string,this.#e=t.tuples,this.#r=t.stringTuples,this.#n=t.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",s=I("tcp"),c=I("udp"),u=I("ip4"),h=I("ip6"),l=I("dns6"),f=I("ip6zone");for(let[b,y]of this.stringTuples())b===f.code&&(i=`%${y??""}`),ll.includes(b)&&(t=s.name,o=443,n=`${y??""}${i}`,e=b===l.code?6:4),(b===s.code||b===c.code)&&(t=I(b).name,o=parseInt(y??"")),(b===u.code||b===h.code)&&(t=I(b).name,n=`${y??""}${i}`,e=b===h.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.#e.map(([e])=>Object.assign({},I(e)))}protoCodes(){return this.#e.map(([e])=>e)}protoNames(){return this.#e.map(([e])=>I(e).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new r(Vn(t.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,o])=>{n===at.p2p.code&&e.push([n,o]),n===at["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?B(L.decode(`z${n}`),"base58btc"):B(z.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Ue(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=$s.get(t.name);if(n==null)throw new $t(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>Re(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[ul](){return`Multiaddr(${this.#t})`}};var $s=new Map;function Ir(r){return!!r?.[zn]}function Re(r){return new kr(r)}var Vs={type:4097,canEncode:r=>Ir(r),encode:r=>r.bytes,decode:r=>Re(r)};var Gs=Symbol.for("nodejs.util.inspect.custom"),zs=Object.values(Ae).map(r=>r.decoder).reduce((r,e)=>r.or(e),Ae.identity.decoder),js=114,qs=36,Hs=37,_t=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Ot]=!0;toString(){return this.string==null&&(this.string=L.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return z.createV1(js,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Ue(this.multihash.bytes,e);if(typeof e=="string")return qn(e).equals(this);if(e?.multihash?.bytes!=null)return Ue(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Gs](){return`PeerId(${this.toString()})`}},Mt=class extends _t{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Dt=class extends _t{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Bt=class extends _t{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},Gn=2336,jn=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=wt.digest(_e(this.url))}[Gs](){return`PeerId(${this.url})`}[Ot]=!0;toString(){return this.toCID().toString()}toCID(){return z.createV1(Gn,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=B(e)),e.toString()===this.toString())}};function qn(r,e){if(e=e??zs,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Le(L.decode(`z${r}`));return r.startsWith("12D")?new Dt({multihash:t}):r.startsWith("16U")?new Bt({multihash:t}):new Mt({multihash:t})}return Hn(zs.decode(r))}function Hn(r){try{let e=Le(r);if(e.code===wt.code){if(e.digest.length===qs)return new Dt({multihash:e});if(e.digest.length===Hs)return new Bt({multihash:e})}if(e.code===ir.code)return new Mt({multihash:e})}catch{return fl(z.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function fl(r){if(r==null||r.multihash==null||r.version==null||r.version===1&&r.code!==js&&r.code!==Gn)throw new Error("Supplied PeerID CID is invalid");if(r.code===Gn){let t=B(r.multihash.digest);return new jn(new URL(t))}let e=r.multihash;if(e.code===ir.code)return new Mt({multihash:r.multihash});if(e.code===wt.code){if(e.digest.length===qs)return new Dt({multihash:r.multihash});if(e.digest.length===Hs)return new Bt({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Xs={type:4098,canEncode:r=>Zn(r),encode:r=>r.toBytes(),decode:r=>Hn(r)};var Xn=[Cs,Vs,Xs,ks];function ut(r,e){let t={};for(let[n,o]of r.entries())t[n]=e(o);return t}async function Ur(r,e){let t=[],n=r.connectionManager.getConnectionsMap(),o=[...n.values()].flatMap(i=>i).map(i=>i.remoteAddr.toString());for(let[i,s]of n.entries())try{let c=await r.peerStore.get(i);t.push({id:i,addresses:c.addresses.map(({isCertified:u,multiaddr:h})=>({multiaddr:h,isCertified:u,isConnected:o.includes(h.toString())})),protocols:[...c.protocols],tags:ut(c.tags,u=>u.value),metadata:ut(c.metadata,u=>he.encode(u))})}catch(c){e.error("could not load peer data from peer store",c),t.push({id:i,addresses:s.map(u=>({multiaddr:u.remoteAddr,isConnected:o.includes(u.remoteAddr.toString())})),protocols:[],tags:{},metadata:{}})}return t}async function Tr(r){let e=await r.peerStore.get(r.peerId);return{id:e.id,addresses:e.addresses,protocols:[...e.protocols],tags:ut(e.tags,t=>t.value),metadata:ut(e.metadata,t=>he.encode(t))}}function Ws(r){let e=r.logger.forComponent("libp2p:devtools-metrics:metrics-rpc");return{init:async()=>({self:await Tr(r),peers:await Ur(r,e),debug:localStorage.getItem("debug")??""}),setDebug:async t=>{t?.length!=null&&t?.length>0?(go(t),localStorage.setItem("debug",t)):(mo(),localStorage.removeItem("debug"))},openConnection:async(t,n)=>{let o;try{o=qn(t)}catch{o=Re(t)}await r.connectionManager.openConnection(o,n)},closeConnection:async(t,n)=>{await Promise.all(r.connectionManager.getConnections(t).map(async o=>{try{await o.close(n)}catch(i){o.abort(i)}}))},contentRouting:r.contentRouting,peerRouting:r.peerRouting}}function Wn(r,e=100){let t,n;return()=>{if(n==null&&(n=Date.now()),t!=null&&Date.now()-n>e){clearTimeout(t),n=void 0,r();return}clearTimeout(t),t=setTimeout(()=>{n=void 0,r()},e)}}var Ks="@libp2p/devtools-metrics:devtools",dl="@libp2p/devtools-metrics:worker",hl="@libp2p/devtools-metrics:content",Js="@libp2p/devtools-metrics:metrics",Qs="________libp2p_devtools_metrics";Object.defineProperty(globalThis,Qs,{value:!0,enumerable:!1,writable:!1});var Kn=class{log;components;simpleMetrics;intervalMs;rpcQueue;rpc;devTools;constructor(e,t){this.log=e.logger.forComponent("libp2p:devtools-metrics"),this.intervalMs=t?.intervalMs,this.components=e,this.rpcQueue=be(),this.rpc=As({valueCodecs:Xn}),this.devTools=this.rpc.createClient("devTools"),this.onPeersUpdate=Wn(this.onPeersUpdate.bind(this),1e3),this.onSelfUpdate=Wn(this.onSelfUpdate.bind(this),1e3),this.onIncomingMessage=this.onIncomingMessage.bind(this),this.simpleMetrics=xo({intervalMs:this.intervalMs,onMetrics:n=>{this.devTools.safeDispatchEvent("metrics",{detail:n}).catch(o=>{this.log.error("error sending metrics",o)})}})({})}[Symbol.toStringTag]="@libp2p/devtools-metrics";[Vt]=["@libp2p/metrics"];trackMultiaddrConnection(e){this.simpleMetrics.trackMultiaddrConnection(e)}trackProtocolStream(e,t){this.simpleMetrics.trackProtocolStream(e,t)}registerMetric(e,t){return this.simpleMetrics.registerMetric(e,t)}registerMetricGroup(e,t){return this.simpleMetrics.registerMetricGroup(e,t)}registerCounter(e,t){return this.simpleMetrics.registerCounter(e,t)}registerCounterGroup(e,t){return this.simpleMetrics.registerCounterGroup(e,t)}async start(){this.components.events.addEventListener("peer:connect",this.onPeersUpdate),this.components.events.addEventListener("peer:disconnect",this.onPeersUpdate),this.components.events.addEventListener("peer:identify",this.onPeersUpdate),this.components.events.addEventListener("peer:update",this.onPeersUpdate),this.components.events.addEventListener("self:peer:update",this.onSelfUpdate),window.addEventListener("message",this.onIncomingMessage),this.rpc.createTarget("metrics",Ws(this.components)),await eo(this.simpleMetrics),Promise.resolve().then(async()=>{await Eo(this.rpcQueue,this.rpc,async e=>{for await(let t of e)window.postMessage({source:Js,type:"libp2p-rpc",message:he.encode(t)})})}).catch(e=>{this.log.error("error while reading RPC messages",e)})}async stop(){window.removeEventListener("message",this.onIncomingMessage),this.components.events.removeEventListener("self:peer:update",this.onSelfUpdate),this.components.events.removeEventListener("peer:connect",this.onPeersUpdate),this.components.events.removeEventListener("peer:disconnect",this.onPeersUpdate),this.components.events.removeEventListener("peer:identify",this.onPeersUpdate),this.components.events.removeEventListener("peer:update",this.onPeersUpdate),await to(this.simpleMetrics)}onIncomingMessage(e){if(e.source!==window)return;let t=e.data;t?.source===Ks&&t.type==="libp2p-rpc"&&this.rpcQueue.push(he.decode(t.message))}onSelfUpdate(){Promise.resolve().then(async()=>{await this.devTools.safeDispatchEvent("self",{detail:await Tr(this.components)})}).catch(e=>{this.log.error("error sending peers message",e)})}onPeersUpdate(){Promise.resolve().then(async()=>{await this.devTools.safeDispatchEvent("peers",{detail:await Ur(this.components,this.log)})}).catch(e=>{this.log.error("error sending peers message",e)})}};function pl(r){return e=>new Kn(e,r)}return nc(ml);})();
|
|
2
|
+
"use strict";var Libp2PDevtoolsMetrics=(()=>{var Ir=Object.defineProperty;var zs=Object.getOwnPropertyDescriptor;var Gs=Object.getOwnPropertyNames;var js=Object.prototype.hasOwnProperty;var H=(r,e)=>{for(var t in e)Ir(r,t,{get:e[t],enumerable:!0})},qs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Gs(e))!js.call(r,o)&&o!==t&&Ir(r,o,{get:()=>e[o],enumerable:!(n=zs(e,o))||n.enumerable});return r};var Hs=r=>qs(Ir({},"__esModule",{value:!0}),r);var ol={};H(ol,{LIBP2P_DEVTOOLS_METRICS_KEY:()=>Vs,SOURCE_CONTENT_SCRIPT:()=>rl,SOURCE_DEVTOOLS:()=>$s,SOURCE_METRICS:()=>Os,SOURCE_SERVICE_WORKER:()=>tl,devToolsMetrics:()=>nl,valueCodecs:()=>Hn});var Ft=Symbol.for("@libp2p/peer-id");function Kn(r){return r!=null&&!!r[Ft]}var _t=class extends Error{code;props;constructor(e,t,n){super(e),this.code=t,this.name=n?.name??"CodeError",this.props=n??{}}};function Jn(r){return r!=null&&typeof r.start=="function"&&typeof r.stop=="function"}async function Qn(...r){let e=[];for(let t of r)Jn(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 Zn(...r){let e=[];for(let t of r)Jn(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 Dt=Symbol.for("@libp2p/service-capabilities"),ul=Symbol.for("@libp2p/service-dependencies");var Fr={};H(Fr,{base32:()=>se,base32hex:()=>tc,base32hexpad:()=>nc,base32hexpadupper:()=>oc,base32hexupper:()=>rc,base32pad:()=>Ys,base32padupper:()=>ec,base32upper:()=>Zs,base32z:()=>ic});var _l=new Uint8Array(0);function Yn(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 pe(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function eo(r){return new TextEncoder().encode(r)}function to(r){return new TextDecoder().decode(r)}function Ws(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var o=0;o<r.length;o++){var i=r.charAt(o),s=i.charCodeAt(0);if(t[s]!==255)throw new TypeError(i+" is ambiguous");t[s]=o}var c=r.length,u=r.charAt(0),h=Math.log(c)/Math.log(256),l=Math.log(256)/Math.log(c);function f(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var x=0,m=0,A=0,T=y.length;A!==T&&y[A]===0;)A++,x++;for(var L=(T-A)*l+1>>>0,F=new Uint8Array(L);A!==T;){for(var j=y[A],Z=0,q=L-1;(j!==0||Z<m)&&q!==-1;q--,Z++)j+=256*F[q]>>>0,F[q]=j%c>>>0,j=j/c>>>0;if(j!==0)throw new Error("Non-zero carry");m=Z,A++}for(var Y=L-m;Y!==L&&F[Y]===0;)Y++;for(var Be=u.repeat(x);Y<L;++Y)Be+=r.charAt(F[Y]);return Be}function g(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var x=0;if(y[x]!==" "){for(var m=0,A=0;y[x]===u;)m++,x++;for(var T=(y.length-x)*h+1>>>0,L=new Uint8Array(T);y[x];){var F=t[y.charCodeAt(x)];if(F===255)return;for(var j=0,Z=T-1;(F!==0||j<A)&&Z!==-1;Z--,j++)F+=c*L[Z]>>>0,L[Z]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");A=j,x++}if(y[x]!==" "){for(var q=T-A;q!==T&&L[q]===0;)q++;for(var Y=new Uint8Array(m+(T-q)),Be=m;q!==T;)Y[Be++]=L[q++];return Y}}}function b(y){var x=g(y);if(x)return x;throw new Error(`Non-${e} character`)}return{encode:f,decodeUnsafe:g,decode:b}}var Xs=Ws,Ks=Xs,no=Ks;var Ur=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")}},Tr=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return oo(this,e)}},Lr=class{decoders;constructor(e){this.decoders=e}or(e){return oo(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function oo(r,e){return new Lr({...r.decoders??{[r.prefix]:r},...e.decoders??{[e.prefix]:e}})}var Nr=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 Ur(e,t,n),this.decoder=new Tr(e,t,o)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Re({name:r,prefix:e,encode:t,decode:n}){return new Nr(r,e,t,n)}function we({name:r,prefix:e,alphabet:t}){let{encode:n,decode:o}=no(t,r);return Re({prefix:e,name:r,encode:n,decode:i=>pe(o(i))})}function Js(r,e,t,n){let o={};for(let l=0;l<e.length;++l)o[e[l]]=l;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),c=0,u=0,h=0;for(let l=0;l<i;++l){let f=o[r[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<t|f,c+=t,c>=8&&(c-=8,s[h++]=255&u>>c)}if(c>=t||255&u<<8-c)throw new SyntaxError("Unexpected end of data");return s}function Qs(r,e,t){let n=e[e.length-1]==="=",o=(1<<t)-1,i="",s=0,c=0;for(let u=0;u<r.length;++u)for(c=c<<8|r[u],s+=8;s>t;)s-=t,i+=e[o&c>>s];if(s!==0&&(i+=e[o&c<<t-s]),n)for(;i.length*t&7;)i+="=";return i}function U({name:r,prefix:e,bitsPerChar:t,alphabet:n}){return Re({prefix:e,name:r,encode(o){return Qs(o,n,t)},decode(o){return Js(o,n,t,r)}})}var se=U({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zs=U({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ys=U({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ec=U({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),tc=U({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rc=U({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),nc=U({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),oc=U({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ic=U({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var _r={};H(_r,{base58btc:()=>N,base58flickr:()=>sc});var N=we({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),sc=we({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Dr={};H(Dr,{base64:()=>de,base64pad:()=>cc,base64url:()=>ac,base64urlpad:()=>uc});var de=U({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),cc=U({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ac=U({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uc=U({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function lc(r,e){try{if(typeof r=="string"&&r.length>0)return fc(r);if(typeof r=="number"&&isFinite(r))return e?.long?hc(r):dc(r);throw new Error("Value is not a string or number.")}catch(t){let n=pc(t)?`${t.message}. value=${JSON.stringify(r)}`:"An unknown error has occured.";throw new Error(n)}}function fc(r){if(r=String(r),r.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");let 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)return NaN;let t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*315576e5;case"weeks":case"week":case"w":return t*6048e5;case"days":case"day":case"d":return t*864e5;case"hours":case"hour":case"hrs":case"hr":case"h":return t*36e5;case"minutes":case"minute":case"mins":case"min":case"m":return t*6e4;case"seconds":case"second":case"secs":case"sec":case"s":return t*1e3;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:throw new Error(`The unit ${n} was matched, but no matching case exists.`)}}var Bt=lc;function dc(r){let e=Math.abs(r);return 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 hc(r){let e=Math.abs(r);return e>=864e5?Mt(r,e,864e5,"day"):e>=36e5?Mt(r,e,36e5,"hour"):e>=6e4?Mt(r,e,6e4,"minute"):e>=1e3?Mt(r,e,1e3,"second"):`${r} ms`}function Mt(r,e,t,n){let o=e>=t*1.5;return`${Math.round(r/t)} ${n}${o?"s":""}`}function pc(r){return typeof r=="object"&&r!==null&&"message"in r}function Mr(r){t.debug=t,t.default=t,t.coerce=u,t.disable=i,t.enable=o,t.enabled=s,t.humanize=Bt,t.destroy=h,Object.keys(r).forEach(l=>{t[l]=r[l]}),t.names=[],t.skips=[],t.formatters={};function e(l){let f=0;for(let g=0;g<l.length;g++)f=(f<<5)-f+l.charCodeAt(g),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(l){let f,g=null,b,y;function x(...m){if(!x.enabled)return;let A=x,T=Number(new Date),L=T-(f||T);A.diff=L,A.prev=f,A.curr=T,f=T,m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");let F=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,(Z,q)=>{if(Z==="%%")return"%";F++;let Y=t.formatters[q];if(typeof Y=="function"){let Be=m[F];Z=Y.call(A,Be),m.splice(F,1),F--}return Z}),t.formatArgs.call(A,m),(A.log||t.log).apply(A,m)}return x.namespace=l,x.useColors=t.useColors(),x.color=t.selectColor(l),x.extend=n,x.destroy=t.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(b!==t.namespaces&&(b=t.namespaces,y=t.enabled(l)),y),set:m=>{g=m}}),typeof t.init=="function"&&t.init(x),x}function n(l,f){let g=t(this.namespace+(typeof f>"u"?":":f)+l);return g.log=this.log,g}function o(l){t.save(l),t.namespaces=l,t.names=[],t.skips=[];let f,g=(typeof l=="string"?l:"").split(/[\s,]+/),b=g.length;for(f=0;f<b;f++)g[f]&&(l=g[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.substr(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function i(){let l=[...t.names.map(c),...t.skips.map(c).map(f=>"-"+f)].join(",");return t.enable(""),l}function s(l){if(l[l.length-1]==="*")return!0;let f,g;for(f=0,g=t.skips.length;f<g;f++)if(t.skips[f].test(l))return!1;for(f=0,g=t.names.length;f<g;f++)if(t.names[f].test(l))return!0;return!1}function c(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function u(l){return l instanceof Error?l.stack??l.message:l}function h(){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 Rt=Ec(),mc=["#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 gc(){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 yc(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Bt(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)}var wc=console.debug??console.log??(()=>{});function xc(r){try{r?Rt?.setItem("debug",r):Rt?.removeItem("debug")}catch{}}function bc(){let r;try{r=Rt?.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Ec(){try{return localStorage}catch{}}function vc(r){r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}var io=Mr({formatArgs:yc,save:xc,load:bc,useColors:gc,setupFormatters:vc,colors:mc,storage:Rt,log:wc});var O=io;O.formatters.b=r=>r==null?"undefined":N.baseEncode(r);O.formatters.t=r=>r==null?"undefined":se.baseEncode(r);O.formatters.m=r=>r==null?"undefined":de.baseEncode(r);O.formatters.p=r=>r==null?"undefined":r.toString();O.formatters.c=r=>r==null?"undefined":r.toString();O.formatters.k=r=>r==null?"undefined":r.toString();O.formatters.a=r=>r==null?"undefined":r.toString();function Sc(r){let e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=r,e.destroy=()=>!0,e.extend=()=>e,e}function so(r){let e=Sc(`${r}:trace`);return O.enabled(`${r}:trace`)&&O.names.map(t=>t.toString()).find(t=>t.includes(":trace"))!=null&&(e=O(`${r}:trace`)),Object.assign(O(r),{error:O(`${r}:error`),trace:e})}function co(){O.disable()}function ao(r){O.enable(r)}function Ac(r){let[e,t]=r[Symbol.asyncIterator]!=null?[r[Symbol.asyncIterator](),Symbol.asyncIterator]:[r[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:o=>{n.push(o)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[t](){return this}}}var uo=Ac;function Cc(r){return r[Symbol.asyncIterator]!=null}function lo(r){return r?.then!=null}function kc(r,e){let t=0;if(Cc(r))return async function*(){for await(let u of r){let h=e(u,t++);lo(h)&&await h,yield u}}();let n=uo(r),{value:o,done:i}=n.next();if(i===!0)return function*(){}();if(typeof e(o,t++)?.then=="function")return async function*(){yield o;for await(let u of n){let h=e(u,t++);lo(h)&&await h,yield u}}();let c=e;return function*(){yield o;for(let u of n)c(u,t++),yield u}()}var Br=kc;var Ic=so("libp2p:simple-metrics"),ot=class{value=0;update(e){this.value=e}increment(e=1){this.value+=e}decrement(e=1){this.value-=e}reset(){this.value=0}timer(){let e=Date.now();return()=>{this.value=Date.now()-e}}},it=class{values={};update(e){Object.entries(e).forEach(([t,n])=>{this.values[t]=n})}increment(e){Object.entries(e).forEach(([t,n])=>{this.values[t]=this.values[t]??0;let o=typeof n=="number"?n:1;this.values[t]+=Number(o)})}decrement(e){Object.entries(e).forEach(([t,n])=>{this.values[t]=this.values[t]??0;let o=typeof n=="number"?n:1;this.values[t]-=Number(o)})}reset(){this.values={}}timer(e){let t=Date.now();return()=>{this.values[e]=Date.now()-t}}},Rr=class{metrics=new Map;transferStats;started;interval;intervalMs;onMetrics;constructor(e,t){this.started=!1,this._emitMetrics=this._emitMetrics.bind(this),this.intervalMs=t.intervalMs??1e3,this.onMetrics=t.onMetrics,this.transferStats=new Map}[Symbol.toStringTag]="@libp2p/metrics-simple";[Dt]=["@libp2p/metrics"];isStarted(){return this.started}start(){this.started=!0,this.interval=setInterval(this._emitMetrics,this.intervalMs)}stop(){this.started=!1,clearInterval(this.interval)}_emitMetrics(){Promise.resolve().then(async()=>{let e={};for(let[t,n]of this.metrics.entries())n instanceof ot?e[t]=n.value:n instanceof it?e[t]=n.values:e[t]=await n();this.onMetrics(structuredClone(e))}).catch(e=>{Ic.error("could not invoke onMetrics callback",e)})}_incrementValue(e,t){let n=this.transferStats.get(e)??0;this.transferStats.set(e,n+t)}_track(e,t){let n=this,o=e.sink;e.sink=async function(c){await o(Br(c,u=>{n._incrementValue(`${t} sent`,u.byteLength)}))};let i=e.source;e.source=Br(i,s=>{n._incrementValue(`${t} received`,s.byteLength)})}trackMultiaddrConnection(e){this._track(e,"global")}trackProtocolStream(e,t){e.protocol!=null&&this._track(e,e.protocol)}registerMetric(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new ot;return this.metrics.set(e,n),n}registerMetricGroup(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new it;return this.metrics.set(e,n),n}registerCounter(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new ot;return this.metrics.set(e,n),n}registerCounterGroup(e,t={}){if(e==null||e.trim()==="")throw new Error("Metric name is required");if(t?.calculate!=null){this.metrics.set(e,t.calculate);return}let n=new it;return this.metrics.set(e,n),n}};function fo(r){return e=>new Rr(e,r)}function ce(){let r={};return r.promise=new Promise((e,t)=>{r.resolve=e,r.reject=t}),r}var Pt=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}},Pe=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Pt(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 Pt(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let t=this.tail.next;this.tail.next=null,this.tail=t,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Pr=class extends Error{type;code;constructor(e,t){super(e??"The operation was aborted"),this.type="aborted",this.code=t??"ABORT_ERR"}};function xe(r={}){return Uc(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 Uc(r,e){e=e??{};let t=e.onEnd,n=new Pe,o,i,s,c=ce(),u=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((m,A)=>{i=T=>{i=null,n.push(T);try{m(r(n))}catch(L){A(L)}return o}}):r(n)}finally{n.isEmpty()&&queueMicrotask(()=>{c.resolve(),c=ce()})}},h=m=>i!=null?i(m):(n.push(m),o),l=m=>(n=new Pe,i!=null?i({error:m}):(n.push({error:m}),o)),f=m=>{if(s)return o;if(e?.objectMode!==!0&&m?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return h({done:!1,value:m})},g=m=>s?o:(s=!0,m!=null?l(m):h({done:!0})),b=()=>(n=new Pe,g(),{done:!0}),y=m=>(g(m),{done:!0});if(o={[Symbol.asyncIterator](){return this},next:u,return:b,throw:y,push:f,end:g,get readableLength(){return n.size},onEmpty:async m=>{let A=m?.signal;if(A?.throwIfAborted(),n.isEmpty())return;let T,L;A!=null&&(T=new Promise((F,j)=>{L=()=>{j(new Pr)},A.addEventListener("abort",L)}));try{await Promise.race([c.promise,T])}finally{L!=null&&A!=null&&A?.removeEventListener("abort",L)}}},t==null)return o;let x=o;return o={[Symbol.asyncIterator](){return this},next(){return x.next()},throw(m){return x.throw(m),t!=null&&(t(m),t=void 0),{done:!0}},return(){return x.return(),t!=null&&(t(),t=void 0),{done:!0}},push:f,end(m){return x.end(m),t!=null&&(t(m),t=void 0),o},get readableLength(){return x.readableLength},onEmpty:m=>x.onEmpty(m)},o}function Tc(r){return r[Symbol.asyncIterator]!=null}function Lc(...r){let e=[];for(let t of r)Tc(t)||e.push(t);return e.length===r.length?function*(){for(let t of e)yield*t}():async function*(){let t=xe({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(r.map(async n=>{for await(let o of n)t.push(o)})),t.end()}catch(n){t.end(n)}}),yield*t}()}var ho=Lc;function po(r,...e){if(r==null)throw new Error("Empty pipeline");if($r(r)){let n=r;r=()=>n.source}else if(go(r)||mo(r)){let n=r;r=()=>n}let t=[r,...e];if(t.length>1&&$r(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++)$r(t[n])&&(t[n]=Fc(t[n]));return Nc(...t)}var Nc=(...r)=>{let e;for(;r.length>0;)e=r.shift()(e);return e},mo=r=>r?.[Symbol.asyncIterator]!=null,go=r=>r?.[Symbol.iterator]!=null,$r=r=>r==null?!1:r.sink!=null&&r.source!=null,Fc=r=>e=>{let t=r.sink(e);if(t?.then!=null){let n=xe({objectMode:!0});t.then(()=>{n.end()},s=>{n.end(s)});let o,i=r.source;if(mo(i))o=async function*(){yield*i,n.end()};else if(go(i))o=function*(){yield*i,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return ho(n,o())}return r.source};function $t(r){let e=new globalThis.AbortController;function t(){e.abort();for(let i of r)i?.removeEventListener!=null&&i.removeEventListener("abort",t)}for(let i of r){if(i?.aborted===!0){t();break}i?.addEventListener!=null&&i.addEventListener("abort",t)}function n(){for(let i of r)i?.removeEventListener!=null&&i.removeEventListener("abort",t)}let o=e.signal;return o.clear=n,o}function ae(r=0){return new Uint8Array(r)}function R(r=0){return new Uint8Array(r)}var _c=Math.pow(2,7),Dc=Math.pow(2,14),Mc=Math.pow(2,21),Or=Math.pow(2,28),Vr=Math.pow(2,35),zr=Math.pow(2,42),Gr=Math.pow(2,49),S=128,P=127;function _(r){if(r<_c)return 1;if(r<Dc)return 2;if(r<Mc)return 3;if(r<Or)return 4;if(r<Vr)return 5;if(r<zr)return 6;if(r<Gr)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function jr(r,e,t=0){switch(_(r)){case 8:e[t++]=r&255|S,r/=128;case 7:e[t++]=r&255|S,r/=128;case 6:e[t++]=r&255|S,r/=128;case 5:e[t++]=r&255|S,r/=128;case 4:e[t++]=r&255|S,r>>>=7;case 3:e[t++]=r&255|S,r>>>=7;case 2:e[t++]=r&255|S,r>>>=7;case 1:{e[t++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return e}function Bc(r,e,t=0){switch(_(r)){case 8:e.set(t++,r&255|S),r/=128;case 7:e.set(t++,r&255|S),r/=128;case 6:e.set(t++,r&255|S),r/=128;case 5:e.set(t++,r&255|S),r/=128;case 4:e.set(t++,r&255|S),r>>>=7;case 3:e.set(t++,r&255|S),r>>>=7;case 2:e.set(t++,r&255|S),r>>>=7;case 1:{e.set(t++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return e}function qr(r,e){let t=r[e],n=0;if(n+=t&P,t<S||(t=r[e+1],n+=(t&P)<<7,t<S)||(t=r[e+2],n+=(t&P)<<14,t<S)||(t=r[e+3],n+=(t&P)<<21,t<S)||(t=r[e+4],n+=(t&P)*Or,t<S)||(t=r[e+5],n+=(t&P)*Vr,t<S)||(t=r[e+6],n+=(t&P)*zr,t<S)||(t=r[e+7],n+=(t&P)*Gr,t<S))return n;throw new RangeError("Could not decode varint")}function Rc(r,e){let t=r.get(e),n=0;if(n+=t&P,t<S||(t=r.get(e+1),n+=(t&P)<<7,t<S)||(t=r.get(e+2),n+=(t&P)<<14,t<S)||(t=r.get(e+3),n+=(t&P)<<21,t<S)||(t=r.get(e+4),n+=(t&P)*Or,t<S)||(t=r.get(e+5),n+=(t&P)*Vr,t<S)||(t=r.get(e+6),n+=(t&P)*zr,t<S)||(t=r.get(e+7),n+=(t&P)*Gr,t<S))return n;throw new RangeError("Could not decode varint")}function be(r,e,t=0){return e==null&&(e=R(_(r))),e instanceof Uint8Array?jr(r,e,t):Bc(r,e,t)}function me(r,e=0){return r instanceof Uint8Array?qr(r,e):Rc(r,e)}function ee(r,e){e==null&&(e=r.reduce((o,i)=>o+i.length,0));let t=R(e),n=0;for(let o of r)t.set(o,n),n+=o.length;return t}function ke(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 wo=Symbol.for("@achingbrain/uint8arraylist");function yo(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 Vt(r){return!!r?.[wo]}var $e=class r{bufs;length;[wo]=!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(Vt(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(Vt(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=yo(this.bufs,e);return t.buf[t.index]}set(e,t){let n=yo(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(Vt(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 ee(n,o)}subarray(e,t){let{bufs:n,length:o}=this._subList(e,t);return n.length===1?n[0]:ee(n,o)}sublist(e,t){let{bufs:n,length:o}=this._subList(e,t),i=new r;return i.length=o,i.bufs=[...n],i}_subList(e,t){if(e=e??0,t=t??this.length,e<0&&(e=this.length+e),t<0&&(t=this.length+t),e<0||t>this.length)throw new RangeError("index is out of bounds");if(e===t)return{bufs:[],length:0};if(e===0&&t===this.length)return{bufs:this.bufs,length:this.length};let n=[],o=0;for(let i=0;i<this.bufs.length;i++){let s=this.bufs[i],c=o,u=c+s.byteLength;if(o=u,e>=u)continue;let h=e>=c&&e<u,l=t>c&&t<=u;if(h&&l){if(e===c&&t===u){n.push(s);break}let f=e-c;n.push(s.subarray(f,f+(t-e)));break}if(h){if(e===0){n.push(s);continue}n.push(s.subarray(e-c));continue}if(l){if(t===u){n.push(s);break}n.push(s.subarray(0,t-c));break}n.push(s)}return{bufs:n,length:t-e}}indexOf(e,t=0){if(!Vt(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(t=Number(t??0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let o=n.byteLength;if(o===0)throw new TypeError("search must be at least 1 byte long");let i=256,s=new Int32Array(i);for(let f=0;f<i;f++)s[f]=-1;for(let f=0;f<o;f++)s[n[f]]=f;let c=s,u=this.byteLength-n.byteLength,h=n.byteLength-1,l;for(let f=t;f<=u;f+=l){l=0;for(let g=h;g>=0;g--){let b=this.get(f+g);if(n[g]!==b){l=Math.max(1,g-c[b]);break}}if(l===0)return f}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=R(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=R(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(!ke(this.bufs[t],e.bufs[t]))return!1;return!0}static fromUint8Arrays(e,t){let n=new r;return n.bufs=e,t==null&&(t=e.reduce((o,i)=>o+i.byteLength,0)),n.length=t,n}};function zt(r){return r[Symbol.asyncIterator]!=null}var Gt=r=>{let e=_(r),t=R(e);return be(r,t),Gt.bytes=e,t};Gt.bytes=0;function jt(r,e){e=e??{};let t=e.lengthEncoder??Gt;function*n(o){let i=t(o.byteLength);i instanceof Uint8Array?yield i:yield*i,o instanceof Uint8Array?yield o:yield*o}return zt(r)?async function*(){for await(let o of r)yield*n(o)}():function*(){for(let o of r)yield*n(o)}()}jt.single=(r,e)=>{e=e??{};let t=e.lengthEncoder??Gt;return new $e(t(r.byteLength),r)};var qt=class extends Error{name="InvalidMessageLengthError";code="ERR_INVALID_MSG_LENGTH"},Ht=class extends Error{name="InvalidDataLengthError";code="ERR_MSG_DATA_TOO_LONG"},Wt=class extends Error{name="InvalidDataLengthLengthError";code="ERR_MSG_LENGTH_TOO_LONG"},st=class extends Error{name="UnexpectedEOFError";code="ERR_UNEXPECTED_EOF"};var Pc=8,$c=1024*1024*4,Ie;(function(r){r[r.LENGTH=0]="LENGTH",r[r.DATA=1]="DATA"})(Ie||(Ie={}));var Hr=r=>{let e=me(r);return Hr.bytes=_(e),e};Hr.bytes=0;function ct(r,e){let t=new $e,n=Ie.LENGTH,o=-1,i=e?.lengthDecoder??Hr,s=e?.maxLengthLength??Pc,c=e?.maxDataLength??$c;function*u(){for(;t.byteLength>0;){if(n===Ie.LENGTH)try{if(o=i(t),o<0)throw new qt("Invalid message length");if(o>c)throw new Ht("Message length too long");let h=i.bytes;t.consume(h),e?.onLength!=null&&e.onLength(o),n=Ie.DATA}catch(h){if(h instanceof RangeError){if(t.byteLength>s)throw new Wt("Message length length too long");break}throw h}if(n===Ie.DATA){if(t.byteLength<o)break;let h=t.sublist(0,o);t.consume(o),e?.onData!=null&&e.onData(h),yield h,n=Ie.LENGTH}}}return zt(r)?async function*(){for await(let h of r)t.append(h),yield*u();if(t.byteLength>0)throw new st("Unexpected end of input")}():function*(){for(let h of r)t.append(h),yield*u();if(t.byteLength>0)throw new st("Unexpected end of input")}()}ct.fromReader=(r,e)=>{let t=1,n=async function*(){for(;;)try{let{done:i,value:s}=await r.next(t);if(i===!0)return;s!=null&&(yield s)}catch(i){if(i.code==="ERR_UNDER_READ")return{done:!0,value:null};throw i}finally{t=1}}();return ct(n,{...e??{},onLength:i=>{t=i}})};var xo="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Oe=(r=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(r));for(;r--;)e+=xo[t[r]&63];return e};var Xt=class extends Error{constructor(e="Method not found"){super(e),this.name="MethodNotFoundError"}},Kt=class extends Error{constructor(e="Invocation target was not a function"){super(e),this.name="InvalidMethodError"}},at=class extends Error{constructor(e="Unsupported value type"){super(e),this.name="UnsupportedValueTypeError"}},Jt=class extends Error{constructor(e="Cannot reuse RPC target name"){super(e),this.name="DuplicateTargetNameError"}},ut=class extends Error{constructor(e="Duplicate scope"){super(e),this.name="DuplicateScopeError"}},Qt=class extends Error{constructor(e="Invalid return type"){super(e),this.name="InvalidReturnTypeError"}},lt=class extends Error{constructor(e="Invocation target was not a function"){super(e),this.name="InvalidInvocationTypeError"}},Ve=class extends Error{constructor(e="Parent invocation scope not found"){super(e),this.name="MissingParentScopeError"}},Zt=class extends Error{constructor(e="Invocation not found"){super(e),this.name="MissingInvocationError"}},Yt=class extends Error{constructor(e="Callback not found"){super(e),this.name="MissingCallbackError"}};var Wr=new Float32Array([-0]),Ee=new Uint8Array(Wr.buffer);function bo(r,e,t){Wr[0]=r,e[t]=Ee[0],e[t+1]=Ee[1],e[t+2]=Ee[2],e[t+3]=Ee[3]}function Eo(r,e){return Ee[0]=r[e],Ee[1]=r[e+1],Ee[2]=r[e+2],Ee[3]=r[e+3],Wr[0]}var Xr=new Float64Array([-0]),$=new Uint8Array(Xr.buffer);function vo(r,e,t){Xr[0]=r,e[t]=$[0],e[t+1]=$[1],e[t+2]=$[2],e[t+3]=$[3],e[t+4]=$[4],e[t+5]=$[5],e[t+6]=$[6],e[t+7]=$[7]}function So(r,e){return $[0]=r[e],$[1]=r[e+1],$[2]=r[e+2],$[3]=r[e+3],$[4]=r[e+4],$[5]=r[e+5],$[6]=r[e+6],$[7]=r[e+7],Xr[0]}var Oc=BigInt(Number.MAX_SAFE_INTEGER),Vc=BigInt(Number.MIN_SAFE_INTEGER),W=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 Ue;if(e<Oc&&e>Vc)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>Ao&&(o=0n,++n>Ao&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(e){if(e===0)return Ue;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):Ue}},Ue=new W(0,0);Ue.toBigInt=function(){return 0n};Ue.zzEncode=Ue.zzDecode=function(){return this};Ue.length=function(){return 1};var Ao=4294967296n;function Co(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 ko(r,e,t){if(t-e<1)return"";let o,i=[],s=0,c;for(;e<t;)c=r[e++],c<128?i[s++]=c:c>191&&c<224?i[s++]=(c&31)<<6|r[e++]&63:c>239&&c<365?(c=((c&7)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,i[s++]=55296+(c>>10),i[s++]=56320+(c&1023)):i[s++]=(c&15)<<12|(r[e++]&63)<<6|r[e++]&63,s>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,i)),s=0);return o!=null?(s>0&&o.push(String.fromCharCode.apply(String,i.slice(0,s))),o.join("")):String.fromCharCode.apply(String,i.slice(0,s))}function Kr(r,e,t){let n=t,o,i;for(let s=0;s<r.length;++s)o=r.charCodeAt(s),o<128?e[t++]=o:o<2048?(e[t++]=o>>6|192,e[t++]=o&63|128):(o&64512)===55296&&((i=r.charCodeAt(s+1))&64512)===56320?(o=65536+((o&1023)<<10)+(i&1023),++s,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}function ue(r,e){return RangeError(`index out of range: ${r.pos} + ${e??1} > ${r.len}`)}function er(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}var Jr=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,ue(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 ue(this,4);return er(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ue(this,4);return er(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ue(this,4);let e=Eo(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ue(this,4);let e=So(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 ue(this,e);return this.pos+=e,t===n?new Uint8Array(0):this.buf.subarray(t,n)}string(){let e=this.bytes();return ko(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ue(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ue(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new W(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 ue(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 ue(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 ue(this,8);let e=er(this.buf,this.pos+=4),t=er(this.buf,this.pos+=4);return new W(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=qr(this.buf,this.pos);return this.pos+=_(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 Qr(r){return new Jr(r instanceof Uint8Array?r:r.subarray())}function te(r,e,t){let n=Qr(r);return e.decode(n,void 0,t)}var Zr={};H(Zr,{base10:()=>zc});var zc=we({prefix:"9",name:"base10",alphabet:"0123456789"});var Yr={};H(Yr,{base16:()=>Gc,base16upper:()=>jc});var Gc=U({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jc=U({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var en={};H(en,{base2:()=>qc});var qc=U({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var tn={};H(tn,{base256emoji:()=>Jc});var Uo=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}"),Hc=Uo.reduce((r,e,t)=>(r[t]=e,r),[]),Wc=Uo.reduce((r,e,t)=>(r[e.codePointAt(0)]=t,r),[]);function Xc(r){return r.reduce((e,t)=>(e+=Hc[t],e),"")}function Kc(r){let e=[];for(let t of r){let n=Wc[t.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(n)}return new Uint8Array(e)}var Jc=Re({prefix:"\u{1F680}",name:"base256emoji",encode:Xc,decode:Kc});var rn={};H(rn,{base36:()=>Qc,base36upper:()=>Zc});var Qc=we({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Zc=we({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nn={};H(nn,{base8:()=>Yc});var Yc=U({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var on={};H(on,{identity:()=>ea});var ea=Re({prefix:"\0",name:"identity",encode:r=>to(r),decode:r=>eo(r)});var ld=new TextEncoder,fd=new TextDecoder;var cn={};H(cn,{identity:()=>ht});var na=No,To=128,oa=127,ia=~oa,sa=Math.pow(2,31);function No(r,e,t){e=e||[],t=t||0;for(var n=t;r>=sa;)e[t++]=r&255|To,r/=128;for(;r&ia;)e[t++]=r&255|To,r>>>=7;return e[t]=r|0,No.bytes=t-n+1,e}var ca=sn,aa=128,Lo=127;function sn(r,n){var t=0,n=n||0,o=0,i=n,s,c=r.length;do{if(i>=c)throw sn.bytes=0,new RangeError("Could not decode varint");s=r[i++],t+=o<28?(s&Lo)<<o:(s&Lo)*Math.pow(2,o),o+=7}while(s>=aa);return sn.bytes=i-n,t}var ua=Math.pow(2,7),la=Math.pow(2,14),fa=Math.pow(2,21),da=Math.pow(2,28),ha=Math.pow(2,35),pa=Math.pow(2,42),ma=Math.pow(2,49),ga=Math.pow(2,56),ya=Math.pow(2,63),wa=function(r){return r<ua?1:r<la?2:r<fa?3:r<da?4:r<ha?5:r<pa?6:r<ma?7:r<ga?8:r<ya?9:10},xa={encode:na,decode:ca,encodingLength:wa},ba=xa,ft=ba;function dt(r,e=0){return[ft.decode(r,e),ft.decode.bytes]}function ze(r,e,t=0){return ft.encode(r,e,t),e}function Ge(r){return ft.encodingLength(r)}function ve(r,e){let t=e.byteLength,n=Ge(r),o=n+Ge(t),i=new Uint8Array(o+t);return ze(r,i,0),ze(t,i,n),i.set(e,o),new je(r,t,e,i)}function Te(r){let e=pe(r),[t,n]=dt(e),[o,i]=dt(e.subarray(n)),s=e.subarray(n+i);if(s.byteLength!==o)throw new Error("Incorrect length");return new je(t,o,s,e)}function Fo(r,e){if(r===e)return!0;{let t=e;return r.code===t.code&&r.size===t.size&&t.bytes instanceof Uint8Array&&Yn(r.bytes,t.bytes)}}var je=class{code;size;digest;bytes;constructor(e,t,n,o){this.code=e,this.size=t,this.digest=n,this.bytes=o}};var _o=0,Ea="identity",Do=pe;function va(r){return ve(_o,Do(r))}var ht={code:_o,name:Ea,encode:Do,digest:va};var ln={};H(ln,{sha256:()=>rr,sha512:()=>Sa});function un({name:r,code:e,encode:t}){return new an(r,e,t)}var an=class{name;code;encode;constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ve(this.code,t):t.then(n=>ve(this.code,n))}else throw Error("Unknown type, must be binary type")}};function Bo(r){return async e=>new Uint8Array(await crypto.subtle.digest(r,e))}var rr=un({name:"sha2-256",code:18,encode:Bo("SHA-256")}),Sa=un({name:"sha2-512",code:19,encode:Bo("SHA-512")});function Ro(r,e){let{bytes:t,version:n}=r;switch(n){case 0:return Ca(t,fn(r),e??N.encoder);default:return ka(t,fn(r),e??se.encoder)}}var Po=new WeakMap;function fn(r){let e=Po.get(r);if(e==null){let t=new Map;return Po.set(r,t),t}return e}var z=class r{code;version;multihash;bytes;"/";constructor(e,t,n,o){this.code=t,this.version=e,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==pt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==Ia)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=ve(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&&Fo(e.multihash,n.multihash)}toString(e){return Ro(this,e)}toJSON(){return{"/":Ro(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof r)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:n,code:o,multihash:i,bytes:s}=t;return new r(n,o,i,s??$o(n,o,i.bytes))}else if(t[Ua]===!0){let{version:n,multihash:o,code:i}=t,s=Te(o);return r.create(n,i,s)}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!==pt)throw new Error(`Version 0 CID must use dag-pb (code: ${pt}) block encoding`);return new r(e,t,n,n.bytes)}case 1:{let o=$o(e,t,n.bytes);return new r(e,t,n,o)}default:throw new Error("Invalid version")}}static createV0(e){return r.create(0,pt,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=pe(e.subarray(n,n+t.multihashSize));if(o.byteLength!==t.multihashSize)throw new Error("Incorrect length");let i=o.subarray(t.multihashSize-t.digestSize),s=new je(t.multihashCode,t.digestSize,i,o);return[t.version===0?r.createV0(s):r.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=()=>{let[f,g]=dt(e.subarray(t));return t+=g,f},o=n(),i=pt;if(o===18?(o=0,t=0):i=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let s=t,c=n(),u=n(),h=t+u,l=h-s;return{version:o,codec:i,multihashCode:c,digestSize:u,multihashSize:l,size:h}}static parse(e,t){let[n,o]=Aa(e,t),i=r.decode(o);if(i.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return fn(i).set(n,e),i}};function Aa(r,e){switch(r[0]){case"Q":{let t=e??N;return[N.prefix,t.decode(`${N.prefix}${r}`)]}case N.prefix:{let t=e??N;return[N.prefix,t.decode(r)]}case se.prefix:{let t=e??se;return[se.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}}function Ca(r,e,t){let{prefix:n}=t;if(n!==N.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let o=e.get(n);if(o==null){let i=t.encode(r).slice(1);return e.set(n,i),i}else return o}function ka(r,e,t){let{prefix:n}=t,o=e.get(n);if(o==null){let i=t.encode(r);return e.set(n,i),i}else return o}var pt=112,Ia=18;function $o(r,e,t){let n=Ge(r),o=n+Ge(e),i=new Uint8Array(o+t.byteLength);return ze(r,i,0),ze(e,i,n),i.set(t,o),i}var Ua=Symbol.for("@ipld/js-cid/CID");var Se={...on,...en,...nn,...Zr,...Yr,...Fr,...rn,..._r,...Dr,...tn},Fd={...ln,...cn};function Vo(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}var Oo=Vo("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),dn=Vo("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=R(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),Ta={utf8:Oo,"utf-8":Oo,hex:Se.base16,latin1:dn,ascii:dn,binary:dn,...Se},nr=Ta;function Ne(r,e="utf8"){let t=nr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}function hn(r){let e=r??8192,t=e>>>1,n,o=e;return function(s){if(s<1||s>t)return R(s);o+s>e&&(n=R(e),o=0);let c=n.subarray(o,o+=s);return o&7&&(o=(o|7)+1),c}}var Fe=class{fn;len;next;val;constructor(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}};function pn(){}var gn=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},La=hn();function Na(r){return globalThis.Buffer!=null?R(r):La(r)}var gt=class{len;head;tail;states;constructor(){this.len=0,this.head=new Fe(pn,0,0),this.tail=this.head,this.states=null}_push(e,t,n){return this.tail=this.tail.next=new Fe(e,t,n),this.len+=t,this}uint32(e){return this.len+=(this.tail=this.tail.next=new yn((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(or,10,W.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let t=W.fromBigInt(e);return this._push(or,t.length(),t)}uint64Number(e){return this._push(jr,_(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=W.fromBigInt(e).zzEncode();return this._push(or,t.length(),t)}sint64Number(e){let t=W.fromNumber(e).zzEncode();return this._push(or,t.length(),t)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(mn,1,e?1:0)}fixed32(e){return this._push(mt,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let t=W.fromBigInt(e);return this._push(mt,4,t.lo)._push(mt,4,t.hi)}fixed64Number(e){let t=W.fromNumber(e);return this._push(mt,4,t.lo)._push(mt,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(bo,4,e)}double(e){return this._push(vo,8,e)}bytes(e){let t=e.length>>>0;return t===0?this._push(mn,1,0):this.uint32(t)._push(_a,t,e)}string(e){let t=Co(e);return t!==0?this.uint32(t)._push(Kr,t,e):this._push(mn,1,0)}fork(){return this.states=new gn(this),this.head=this.tail=new Fe(pn,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 Fe(pn,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=Na(this.len),n=0;for(;e!=null;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t}};function mn(r,e,t){e[t]=r&255}function Fa(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}var yn=class extends Fe{next;constructor(e,t){super(Fa,e,t),this.next=void 0}};function or(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 mt(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 _a(r,e,t){e.set(r,t)}globalThis.Buffer!=null&&(gt.prototype.bytes=function(r){let e=r.length>>>0;return this.uint32(e),e>0&&this._push(Da,e,r),this},gt.prototype.string=function(r){let e=globalThis.Buffer.byteLength(r);return this.uint32(e),e>0&&this._push(Ma,e,r),this});function Da(r,e,t){e.set(r,t)}function Ma(r,e,t){r.length<40?Kr(r,e,t):e.utf8Write!=null?e.utf8Write(r,t):e.set(Ne(r),t)}function wn(){return new gt}function re(r,e){let t=wn();return e.encode(r,t,{lengthDelimited:!1}),t.finish()}var qe;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(qe||(qe={}));function ir(r,e,t,n){return{name:r,type:e,encode:t,decode:n}}function xn(r){function e(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let t=function(i,s){let c=e(i);s.int32(c)},n=function(i){let s=i.int32();return e(s)};return ir("enum",qe.VARINT,t,n)}function ne(r,e){return ir("message",qe.LENGTH_DELIMITED,r,e)}var ge=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"};var E;(function(r){r.invokeMethod="invokeMethod",r.methodResolved="methodResolved",r.methodRejected="methodRejected",r.invokeGeneratorMethod="invokeGeneratorMethod",r.abortMethodInvocation="abortMethodInvocation",r.invokeCallback="invokeCallback",r.callbackResolved="callbackResolved",r.callbackRejected="callbackRejected",r.abortCallbackInvocation="abortCallbackInvocation"})(E||(E={}));var sr;(function(r){r[r.invokeMethod=0]="invokeMethod",r[r.methodResolved=1]="methodResolved",r[r.methodRejected=2]="methodRejected",r[r.invokeGeneratorMethod=3]="invokeGeneratorMethod",r[r.abortMethodInvocation=4]="abortMethodInvocation",r[r.invokeCallback=5]="invokeCallback",r[r.callbackResolved=6]="callbackResolved",r[r.callbackRejected=7]="callbackRejected",r[r.abortCallbackInvocation=8]="abortCallbackInvocation"})(sr||(sr={}));(function(r){r.codec=()=>xn(sr)})(E||(E={}));var G;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.type!=null&&t.type!==0&&(n.uint32(8),n.uint32(t.type)),t.value!=null&&(n.uint32(18),n.bytes(t.value)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={type:0},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.type=t.uint32();break}case 2:{i.value=t.bytes();break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(G||(G={}));var V;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.type!=null&&sr[t.type]!==0&&(n.uint32(8),E.codec().encode(t.type,n)),t.message!=null&&t.message.byteLength>0&&(n.uint32(18),n.bytes(t.message)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={type:E.invokeMethod,message:ae(0)},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.type=E.codec().decode(t);break}case 2:{i.message=t.bytes();break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(V||(V={}));var _e;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.path!=null&&t.path!==""&&(n.uint32(18),n.string(t.path)),t.args!=null)for(let i of t.args)n.uint32(26),G.codec().encode(i,n);o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",path:"",args:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{i.path=t.string();break}case 3:{if(o.limits?.args!=null&&i.args.length===o.limits.args)throw new ge('Decode error - map field "args" had too many elements');i.args.push(G.codec().decode(t,t.uint32(),{limits:o.limits?.args$}));break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(_e||(_e={}));var yt;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:""},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(yt||(yt={}));var He;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.value!=null&&(n.uint32(18),G.codec().encode(t.value,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:""},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{i.value=G.codec().decode(t,t.uint32(),{limits:o.limits?.value});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(He||(He={}));var wt;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.error!=null&&(n.uint32(18),G.codec().encode(t.error,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:""},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{i.error=G.codec().decode(t,t.uint32(),{limits:o.limits?.error});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(wt||(wt={}));var We;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);if(t.callback!=null&&t.callback!==""&&(n.uint32(26),n.string(t.callback)),t.args!=null)for(let i of t.args)n.uint32(34),G.codec().encode(i,n);o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[],callback:"",args:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ge('Decode error - map field "parents" had too many elements');i.parents.push(t.string());break}case 3:{i.callback=t.string();break}case 4:{if(o.limits?.args!=null&&i.args.length===o.limits.args)throw new ge('Decode error - map field "args" had too many elements');i.args.push(G.codec().decode(t,t.uint32(),{limits:o.limits?.args$}));break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(We||(We={}));var Xe;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ge('Decode error - map field "parents" had too many elements');i.parents.push(t.string());break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(Xe||(Xe={}));var xt;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);t.value!=null&&(n.uint32(26),G.codec().encode(t.value,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ge('Decode error - map field "parents" had too many elements');i.parents.push(t.string());break}case 3:{i.value=G.codec().decode(t,t.uint32(),{limits:o.limits?.value});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(xt||(xt={}));var bt;(function(r){let e;r.codec=()=>(e==null&&(e=ne((t,n,o={})=>{if(o.lengthDelimited!==!1&&n.fork(),t.scope!=null&&t.scope!==""&&(n.uint32(10),n.string(t.scope)),t.parents!=null)for(let i of t.parents)n.uint32(18),n.string(i);t.error!=null&&(n.uint32(26),G.codec().encode(t.error,n)),o.lengthDelimited!==!1&&n.ldelim()},(t,n,o={})=>{let i={scope:"",parents:[]},s=n==null?t.len:t.pos+n;for(;t.pos<s;){let c=t.uint32();switch(c>>>3){case 1:{i.scope=t.string();break}case 2:{if(o.limits?.parents!=null&&i.parents.length===o.limits.parents)throw new ge('Decode error - map field "parents" had too many elements');i.parents.push(t.string());break}case 3:{i.error=G.codec().decode(t,t.uint32(),{limits:o.limits?.error});break}default:{t.skipType(c&7);break}}}return i})),e),r.encode=t=>re(t,r.codec()),r.decode=(t,n)=>te(t,r.codec(),n)})(bt||(bt={}));function Ba(r){return r.parents!=null}function zo(r,e){if(Ba(r))return Ra(r.parents,e);let t=e.get(r.scope);if(t==null)throw new Zt;return t}function Ra(r,e){let t;for(let n of r){if(t==null){if(t=e.get(n),t==null)throw new Ve;continue}if(t=t.children.get(n),t==null)throw new Ve}if(t==null)throw new Ve;return t}var Pa={type:1024,canEncode:r=>r===void 0,decode:()=>{}},Go=Pa;var $a={type:1025,canEncode:r=>r===null,decode:()=>null},jo=$a;var Oa=["string","number","bigint","symbol"],Va=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function qo(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(Oa.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(za(r))return"Buffer";let t=Ga(r);return t||"Object"}function za(r){return r&&r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer.call(null,r)}function Ga(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(Va.includes(e))return e}var a=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}};a.uint=new a(0,"uint",!0);a.negint=new a(1,"negint",!0);a.bytes=new a(2,"bytes",!0);a.string=new a(3,"string",!0);a.array=new a(4,"array",!1);a.map=new a(5,"map",!1);a.tag=new a(6,"tag",!1);a.float=new a(7,"float",!0);a.false=new a(7,"false",!0);a.true=new a(7,"true",!0);a.null=new a(7,"null",!0);a.undefined=new a(7,"undefined",!0);a.break=new a(7,"break",!0);var p=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}`}};var Ke=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",ja=new TextDecoder,qa=new TextEncoder;function cr(r){return Ke&&globalThis.Buffer.isBuffer(r)}function bn(r){return r instanceof Uint8Array?cr(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}var Ko=Ke?(r,e,t)=>t-e>64?globalThis.Buffer.from(r.subarray(e,t)).toString("utf8"):Wo(r,e,t):(r,e,t)=>t-e>64?ja.decode(r.subarray(e,t)):Wo(r,e,t),Jo=Ke?r=>r.length>64?globalThis.Buffer.from(r):Ho(r):r=>r.length>64?qa.encode(r):Ho(r),he=r=>Uint8Array.from(r),Je=Ke?(r,e,t)=>cr(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),Qo=Ke?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),bn(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},Zo=Ke?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r);function Yo(r,e){if(cr(r)&&cr(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 Ho(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):(e[t++]=o>>12|224,e[t++]=o>>6&63|128,e[t++]=o&63|128)}return e}function Wo(r,e,t){let n=[];for(;e<t;){let o=r[e],i=null,s=o>239?4:o>223?3:o>191?2:1;if(e+s<=t){let c,u,h,l;switch(s){case 1:o<128&&(i=o);break;case 2:c=r[e+1],(c&192)===128&&(l=(o&31)<<6|c&63,l>127&&(i=l));break;case 3:c=r[e+1],u=r[e+2],(c&192)===128&&(u&192)===128&&(l=(o&15)<<12|(c&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(i=l));break;case 4:c=r[e+1],u=r[e+2],h=r[e+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(l=(o&15)<<18|(c&63)<<12|(u&63)<<6|h&63,l>65535&&l<1114112&&(i=l))}}i===null?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|i&1023),n.push(i),e+=s}return Ha(n)}var Xo=4096;function Ha(r){let e=r.length;if(e<=Xo)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Xo));return t}var Wa=256,Et=class{constructor(e=Wa){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)}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=Zo(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=Je(n,0,this.cursor)}else t=Qo(this.chunks,this.cursor);return e&&this.reset(),t}};var w="CBOR decode error:",En="CBOR encode error:",vt=[];vt[23]=1;vt[24]=2;vt[25]=3;vt[26]=5;vt[27]=9;function ye(r,e,t){if(r.length-e<t)throw new Error(`${w} not enough data for type`)}var D=[24,256,65536,4294967296,BigInt("18446744073709551616")];function X(r,e,t){ye(r,e,1);let n=r[e];if(t.strict===!0&&n<D[0])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);return n}function K(r,e,t){ye(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<D[1])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);return n}function J(r,e,t){ye(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<D[2])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);return n}function Q(r,e,t){ye(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],i=(BigInt(n)<<BigInt(32))+BigInt(o);if(t.strict===!0&&i<D[3])throw new Error(`${w} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(t.allowBigInt===!0)return i;throw new Error(`${w} integers outside of the safe integer range are not supported`)}function ei(r,e,t,n){return new p(a.uint,X(r,e+1,n),2)}function ti(r,e,t,n){return new p(a.uint,K(r,e+1,n),3)}function ri(r,e,t,n){return new p(a.uint,J(r,e+1,n),5)}function ni(r,e,t,n){return new p(a.uint,Q(r,e+1,n),9)}function oe(r,e){return M(r,0,e.value)}function M(r,e,t){if(t<D[0]){let n=Number(t);r.push([e|n])}else if(t<D[1]){let n=Number(t);r.push([e|24,n])}else if(t<D[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<D[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<D[4]){let o=[e|27,0,0,0,0,0,0,0],i=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=i&255,i=i>>8,o[7]=i&255,i=i>>8,o[6]=i&255,i=i>>8,o[5]=i&255,o[4]=s&255,s=s>>8,o[3]=s&255,s=s>>8,o[2]=s&255,s=s>>8,o[1]=s&255,r.push(o)}else throw new Error(`${w} encountered BigInt larger than allowable range`)}}oe.encodedSize=function(e){return M.encodedSize(e.value)};M.encodedSize=function(e){return e<D[0]?1:e<D[1]?2:e<D[2]?3:e<D[3]?5:9};oe.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function oi(r,e,t,n){return new p(a.negint,-1-X(r,e+1,n),2)}function ii(r,e,t,n){return new p(a.negint,-1-K(r,e+1,n),3)}function si(r,e,t,n){return new p(a.negint,-1-J(r,e+1,n),5)}var vn=BigInt(-1),ci=BigInt(1);function ai(r,e,t,n){let o=Q(r,e+1,n);if(typeof o!="bigint"){let i=-1-o;if(i>=Number.MIN_SAFE_INTEGER)return new p(a.negint,i,9)}if(n.allowBigInt!==!0)throw new Error(`${w} integers outside of the safe integer range are not supported`);return new p(a.negint,vn-BigInt(o),9)}function ar(r,e){let t=e.value,n=typeof t=="bigint"?t*vn-ci:t*-1-1;M(r,e.type.majorEncoded,n)}ar.encodedSize=function(e){let t=e.value,n=typeof t=="bigint"?t*vn-ci:t*-1-1;return n<D[0]?1:n<D[1]?2:n<D[2]?3:n<D[3]?5:9};ar.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function St(r,e,t,n){ye(r,e,t+n);let o=Je(r,e+t,e+t+n);return new p(a.bytes,o,t+n)}function ui(r,e,t,n){return St(r,e,1,t)}function li(r,e,t,n){return St(r,e,2,X(r,e+1,n))}function fi(r,e,t,n){return St(r,e,3,K(r,e+1,n))}function di(r,e,t,n){return St(r,e,5,J(r,e+1,n))}function hi(r,e,t,n){let o=Q(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer bytes lengths not supported`);return St(r,e,9,o)}function ur(r){return r.encodedBytes===void 0&&(r.encodedBytes=r.type===a.string?Jo(r.value):r.value),r.encodedBytes}function Qe(r,e){let t=ur(e);M(r,e.type.majorEncoded,t.length),r.push(t)}Qe.encodedSize=function(e){let t=ur(e);return M.encodedSize(t.length)+t.length};Qe.compareTokens=function(e,t){return Ka(ur(e),ur(t))};function Ka(r,e){return r.length<e.length?-1:r.length>e.length?1:Yo(r,e)}function At(r,e,t,n,o){let i=t+n;ye(r,e,i);let s=new p(a.string,Ko(r,e+t,e+i),i);return o.retainStringBytes===!0&&(s.byteValue=Je(r,e+t,e+i)),s}function pi(r,e,t,n){return At(r,e,1,t,n)}function mi(r,e,t,n){return At(r,e,2,X(r,e+1,n),n)}function gi(r,e,t,n){return At(r,e,3,K(r,e+1,n),n)}function yi(r,e,t,n){return At(r,e,5,J(r,e+1,n),n)}function wi(r,e,t,n){let o=Q(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer string lengths not supported`);return At(r,e,9,o,n)}var xi=Qe;function Ze(r,e,t,n){return new p(a.array,n,t)}function bi(r,e,t,n){return Ze(r,e,1,t)}function Ei(r,e,t,n){return Ze(r,e,2,X(r,e+1,n))}function vi(r,e,t,n){return Ze(r,e,3,K(r,e+1,n))}function Si(r,e,t,n){return Ze(r,e,5,J(r,e+1,n))}function Ai(r,e,t,n){let o=Q(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer array lengths not supported`);return Ze(r,e,9,o)}function Ci(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${w} indefinite length items not allowed`);return Ze(r,e,1,1/0)}function lr(r,e){M(r,a.array.majorEncoded,e.value)}lr.compareTokens=oe.compareTokens;lr.encodedSize=function(e){return M.encodedSize(e.value)};function Ye(r,e,t,n){return new p(a.map,n,t)}function ki(r,e,t,n){return Ye(r,e,1,t)}function Ii(r,e,t,n){return Ye(r,e,2,X(r,e+1,n))}function Ui(r,e,t,n){return Ye(r,e,3,K(r,e+1,n))}function Ti(r,e,t,n){return Ye(r,e,5,J(r,e+1,n))}function Li(r,e,t,n){let o=Q(r,e+1,n);if(typeof o=="bigint")throw new Error(`${w} 64-bit integer map lengths not supported`);return Ye(r,e,9,o)}function Ni(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${w} indefinite length items not allowed`);return Ye(r,e,1,1/0)}function fr(r,e){M(r,a.map.majorEncoded,e.value)}fr.compareTokens=oe.compareTokens;fr.encodedSize=function(e){return M.encodedSize(e.value)};function Fi(r,e,t,n){return new p(a.tag,t,1)}function _i(r,e,t,n){return new p(a.tag,X(r,e+1,n),2)}function Di(r,e,t,n){return new p(a.tag,K(r,e+1,n),3)}function Mi(r,e,t,n){return new p(a.tag,J(r,e+1,n),5)}function Bi(r,e,t,n){return new p(a.tag,Q(r,e+1,n),9)}function dr(r,e){M(r,a.tag.majorEncoded,e.value)}dr.compareTokens=oe.compareTokens;dr.encodedSize=function(e){return M.encodedSize(e.value)};var tu=20,ru=21,nu=22,ou=23;function Ri(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${w} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new p(a.null,null,1):new p(a.undefined,void 0,1)}function Pi(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${w} indefinite length items not allowed`);return new p(a.break,void 0,1)}function Sn(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${w} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${w} Infinity values are not supported`)}return new p(a.float,r,e)}function $i(r,e,t,n){return Sn(An(r,e+1),3,n)}function Oi(r,e,t,n){return Sn(Cn(r,e+1),5,n)}function Vi(r,e,t,n){return Sn(qi(r,e+1),9,n)}function hr(r,e,t){let n=e.value;if(n===!1)r.push([a.float.majorEncoded|tu]);else if(n===!0)r.push([a.float.majorEncoded|ru]);else if(n===null)r.push([a.float.majorEncoded|nu]);else if(n===void 0)r.push([a.float.majorEncoded|ou]);else{let o,i=!1;(!t||t.float64!==!0)&&(Gi(n),o=An(le,1),n===o||Number.isNaN(n)?(le[0]=249,r.push(le.slice(0,3)),i=!0):(ji(n),o=Cn(le,1),n===o&&(le[0]=250,r.push(le.slice(0,5)),i=!0))),i||(iu(n),o=qi(le,1),le[0]=251,r.push(le.slice(0,9)))}}hr.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){Gi(n);let o=An(le,1);if(n===o||Number.isNaN(n))return 3;if(ji(n),o=Cn(le,1),n===o)return 5}return 9};var zi=new ArrayBuffer(9),ie=new DataView(zi,1),le=new Uint8Array(zi,0);function Gi(r){if(r===1/0)ie.setUint16(0,31744,!1);else if(r===-1/0)ie.setUint16(0,64512,!1);else if(Number.isNaN(r))ie.setUint16(0,32256,!1);else{ie.setFloat32(0,r);let e=ie.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)ie.setUint16(0,31744,!1);else if(t===0)ie.setUint16(0,(r&2147483648)>>16|n>>13,!1);else{let o=t-127;o<-24?ie.setUint16(0,0):o<-14?ie.setUint16(0,(e&2147483648)>>16|1<<24+o,!1):ie.setUint16(0,(e&2147483648)>>16|o+15<<10|n>>13,!1)}}}function An(r,e){if(r.length-e<2)throw new Error(`${w} 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,i;return n===0?i=o*2**-24:n!==31?i=(o+1024)*2**(n-25):i=o===0?1/0:NaN,t&32768?-i:i}function ji(r){ie.setFloat32(0,r,!1)}function Cn(r,e){if(r.length-e<4)throw new Error(`${w} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}function iu(r){ie.setFloat64(0,r,!1)}function qi(r,e){if(r.length-e<8)throw new Error(`${w} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}hr.compareTokens=oe.compareTokens;function v(r,e,t){throw new Error(`${w} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}function pr(r){return()=>{throw new Error(`${w} ${r}`)}}var d=[];for(let r=0;r<=23;r++)d[r]=v;d[24]=ei;d[25]=ti;d[26]=ri;d[27]=ni;d[28]=v;d[29]=v;d[30]=v;d[31]=v;for(let r=32;r<=55;r++)d[r]=v;d[56]=oi;d[57]=ii;d[58]=si;d[59]=ai;d[60]=v;d[61]=v;d[62]=v;d[63]=v;for(let r=64;r<=87;r++)d[r]=ui;d[88]=li;d[89]=fi;d[90]=di;d[91]=hi;d[92]=v;d[93]=v;d[94]=v;d[95]=pr("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)d[r]=pi;d[120]=mi;d[121]=gi;d[122]=yi;d[123]=wi;d[124]=v;d[125]=v;d[126]=v;d[127]=pr("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)d[r]=bi;d[152]=Ei;d[153]=vi;d[154]=Si;d[155]=Ai;d[156]=v;d[157]=v;d[158]=v;d[159]=Ci;for(let r=160;r<=183;r++)d[r]=ki;d[184]=Ii;d[185]=Ui;d[186]=Ti;d[187]=Li;d[188]=v;d[189]=v;d[190]=v;d[191]=Ni;for(let r=192;r<=215;r++)d[r]=Fi;d[216]=_i;d[217]=Di;d[218]=Mi;d[219]=Bi;d[220]=v;d[221]=v;d[222]=v;d[223]=v;for(let r=224;r<=243;r++)d[r]=pr("simple values are not supported");d[244]=v;d[245]=v;d[246]=v;d[247]=Ri;d[248]=pr("simple values are not supported");d[249]=$i;d[250]=Oi;d[251]=Vi;d[252]=v;d[253]=v;d[254]=v;d[255]=Pi;var fe=[];for(let r=0;r<24;r++)fe[r]=new p(a.uint,r,1);for(let r=-1;r>=-24;r--)fe[31-r]=new p(a.negint,r,1);fe[64]=new p(a.bytes,new Uint8Array(0),1);fe[96]=new p(a.string,"",1);fe[128]=new p(a.array,0,1);fe[160]=new p(a.map,0,1);fe[244]=new p(a.false,!1,1);fe[245]=new p(a.true,!0,1);fe[246]=new p(a.null,null,1);function Hi(r){switch(r.type){case a.false:return he([244]);case a.true:return he([245]);case a.null:return he([246]);case a.bytes:return r.value.length?void 0:he([64]);case a.string:return r.value===""?he([96]):void 0;case a.array:return r.value===0?he([128]):void 0;case a.map:return r.value===0?he([160]):void 0;case a.uint:return r.value<24?he([Number(r.value)]):void 0;case a.negint:if(r.value>=-24)return he([31-Number(r.value)])}}var cu={float64:!1,mapSorter:lu,quickEncodeToken:Hi};function au(){let r=[];return r[a.uint.major]=oe,r[a.negint.major]=ar,r[a.bytes.major]=Qe,r[a.string.major]=xi,r[a.array.major]=lr,r[a.map.major]=fr,r[a.tag.major]=dr,r[a.float.major]=hr,r}var Wi=au(),kn=new Et,gr=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(`${En} object contains circular references`);return new r(t,e)}},Ae={null:new p(a.null,null),undefined:new p(a.undefined,void 0),true:new p(a.true,!0),false:new p(a.false,!1),emptyArray:new p(a.array,0),emptyMap:new p(a.map,0)},Ce={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new p(a.float,r):r>=0?new p(a.uint,r):new p(a.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new p(a.uint,r):new p(a.negint,r)},Uint8Array(r,e,t,n){return new p(a.bytes,r)},string(r,e,t,n){return new p(a.string,r)},boolean(r,e,t,n){return r?Ae.true:Ae.false},null(r,e,t,n){return Ae.null},undefined(r,e,t,n){return Ae.undefined},ArrayBuffer(r,e,t,n){return new p(a.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new p(a.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[Ae.emptyArray,new p(a.break)]:Ae.emptyArray;n=gr.createCheck(n,r);let o=[],i=0;for(let s of r)o[i++]=mr(s,t,n);return t.addBreakTokens?[new p(a.array,r.length),o,new p(a.break)]:[new p(a.array,r.length),o]},Object(r,e,t,n){let o=e!=="Object",i=o?r.keys():Object.keys(r),s=o?r.size:i.length;if(!s)return t.addBreakTokens===!0?[Ae.emptyMap,new p(a.break)]:Ae.emptyMap;n=gr.createCheck(n,r);let c=[],u=0;for(let h of i)c[u++]=[mr(h,t,n),mr(o?r.get(h):r[h],t,n)];return uu(c,t),t.addBreakTokens?[new p(a.map,s),c,new p(a.break)]:[new p(a.map,s),c]}};Ce.Map=Ce.Object;Ce.Buffer=Ce.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Ce[`${r}Array`]=Ce.DataView;function mr(r,e={},t){let n=qo(r),o=e&&e.typeEncoders&&e.typeEncoders[n]||Ce[n];if(typeof o=="function"){let s=o(r,n,e,t);if(s!=null)return s}let i=Ce[n];if(!i)throw new Error(`${En} unsupported type: ${n}`);return i(r,n,e,t)}function uu(r,e){e.mapSorter&&r.sort(e.mapSorter)}function lu(r,e){let t=Array.isArray(r[0])?r[0][0]:r[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(t.type!==n.type)return t.type.compare(n.type);let o=t.type.major,i=Wi[o].compareTokens(t,n);return i===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),i}function Xi(r,e,t,n){if(Array.isArray(e))for(let o of e)Xi(r,o,t,n);else t[e.type.major](r,e,n)}function fu(r,e,t){let n=mr(r,t);if(!Array.isArray(n)&&t.quickEncodeToken){let o=t.quickEncodeToken(n);if(o)return o;let i=e[n.type.major];if(i.encodedSize){let s=i.encodedSize(n,t),c=new Et(s);if(i(c,n,t),c.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return bn(c.chunks[0])}}return kn.reset(),Xi(kn,n,e,t),kn.toBytes(!0)}function C(r,e){return e=Object.assign({},cu,e),fu(r,Wi,e)}var du={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},yr=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=fe[e];if(t===void 0){let n=d[e];if(!n)throw new Error(`${w} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let o=e&31;t=n(this.data,this._pos,o,this.options)}return this._pos+=t.encodedLength,t}},Ct=Symbol.for("DONE"),wr=Symbol.for("BREAK");function hu(r,e,t){let n=[];for(let o=0;o<r.value;o++){let i=et(e,t);if(i===wr){if(r.value===1/0)break;throw new Error(`${w} got unexpected break to lengthed array`)}if(i===Ct)throw new Error(`${w} found array but not enough entries (got ${o}, expected ${r.value})`);n[o]=i}return n}function pu(r,e,t){let n=t.useMaps===!0,o=n?void 0:{},i=n?new Map:void 0;for(let s=0;s<r.value;s++){let c=et(e,t);if(c===wr){if(r.value===1/0)break;throw new Error(`${w} got unexpected break to lengthed map`)}if(c===Ct)throw new Error(`${w} found map but not enough entries (got ${s} [no key], expected ${r.value})`);if(n!==!0&&typeof c!="string")throw new Error(`${w} non-string keys not supported (got ${typeof c})`);if(t.rejectDuplicateMapKeys===!0&&(n&&i.has(c)||!n&&c in o))throw new Error(`${w} found repeat map key "${c}"`);let u=et(e,t);if(u===Ct)throw new Error(`${w} found map but not enough entries (got ${s} [no value], expected ${r.value})`);n?i.set(c,u):o[c]=u}return n?i:o}function et(r,e){if(r.done())return Ct;let t=r.next();if(t.type===a.break)return wr;if(t.type.terminal)return t.value;if(t.type===a.array)return hu(t,r,e);if(t.type===a.map)return pu(t,r,e);if(t.type===a.tag){if(e.tags&&typeof e.tags[t.value]=="function"){let n=et(r,e);return e.tags[t.value](n)}throw new Error(`${w} tag not supported (${t.value})`)}throw new Error("unsupported")}function Ki(r,e){if(!(r instanceof Uint8Array))throw new Error(`${w} data to decode must be a Uint8Array`);e=Object.assign({},du,e);let t=e.tokenizer||new yr(r,e),n=et(t,e);if(n===Ct)throw new Error(`${w} did not find any content to decode`);if(n===wr)throw new Error(`${w} got unexpected break`);return[n,r.subarray(t.pos())]}function k(r,e){let[t,n]=Ki(r,e);if(n.length>0)throw new Error(`${w} too many terminals, data makes no sense`);return t}var mu={type:1026,canEncode:r=>r===!0||r===!1,encode:r=>C(r),decode:r=>k(r)},Ji=mu;var gu={type:1027,canEncode:r=>typeof r=="number"&&!isNaN(r),encode:r=>C(r),decode:r=>k(r)},Qi=gu;var yu={type:1028,canEncode:r=>typeof r=="string",encode:r=>C(r),decode:r=>k(r)},Zi=yu;var wu={type:1029,canEncode:r=>Array.isArray(r),encode:(r,e,t,n)=>C(r.map(o=>e.toValue(o,t,n))),decode:(r,e,t,n)=>k(r).map(o=>e.fromValue(o,t,n))},Yi=wu;var xu={type:1030,canEncode:r=>typeof r=="function",encode:(r,e,t,n)=>{let o=Oe();return n?.callbacks.set(o,{context:t,fn:r}),C(o)},decode:(r,e,t,n)=>async(...o)=>new Promise((i,s)=>{let c=k(r),u=Oe(),h={scope:u,result:ce(),callbacks:new Map,children:new Map,parents:[...n.parents,n.scope],abortControllers:[],abortSignals:[]};n.children.set(u,h),o=o.map(f=>e.toValue(f,null,h));let l=$t(h.abortSignals);l.addEventListener("abort",()=>{t.push(V.encode({type:E.abortCallbackInvocation,message:Xe.encode({scope:u,parents:h.parents})}))}),t.push(V.encode({type:E.invokeCallback,message:We.encode({scope:u,parents:h.parents,callback:c,args:o})})),h.result.promise.then(f=>{i(f)},f=>{s(f)}).finally(()=>{n.children.delete(u),l.clear()})})},es=xu;var bu={type:1031,canEncode:r=>r.toString()==="NaN"&&isNaN(r),decode:()=>NaN},ts=bu;var Eu={type:1032,canEncode:r=>r instanceof Error,encode:r=>C({message:r.message,name:r.name,code:r.code,type:r.type,stack:r.stack}),decode:r=>{let e=k(r),t=new Error(e.message);return t.name=e.name,t.stack=e.stack,t.code=e.code,t.type=e.type,t}},rs=Eu;var vu={type:1033,canEncode:r=>Array.isArray(r),encode:(r,e,t,n)=>{throw new Error("Promises are not supported")},decode:(r,e,t,n)=>{throw new Error("Promises are not supported")}},ns=vu;var os=["__defineGetter__","__defineSetter__","hasOwnProperty","__lookupGetter__","__lookupSetter__","isPrototypeOf","propertyIsEnumerable","toString","valueOf","__proto__","toLocaleString","constructor"],Su={type:2147483647,canEncode:r=>typeof r=="object",encode:(r,e,t,n)=>{let o={};for(let i in r)os.includes(i)||Object.hasOwn(r,i)&&(o[i]=r[i]);for(let i of Object.getOwnPropertyNames(Object.getPrototypeOf(r)))os.includes(i)||(o[i]=r[i]);return C([...Object.entries(o)].map(([i,s])=>[e.toValue(i,r,n),e.toValue(s,r,n)]))},decode:(r,e,t,n)=>{let o={};return k(r).forEach(([s,c])=>{o[e.fromValue(s,t,n)]=e.fromValue(c,t,n)}),o}},kt=Su;var Au={type:1034,canEncode:r=>typeof r.next=="function"&&typeof r.throw=="function"&&typeof r.return=="function",encode:(r,e,t,n)=>kt.encode({next:r.next.bind(r),throw:r.throw.bind(r),return:r.return.bind(r)},e,t,n),decode:(r,e,t,n)=>{let o=kt.decode(r,e,t,n);return o[Symbol.asyncIterator]=()=>o,o}},is=Au;var Cu={type:1035,canEncode:r=>typeof r=="bigint",encode:r=>C(r),decode:r=>BigInt(k(r))},ss=Cu;var ku={type:1036,canEncode:r=>r instanceof Map,encode:(r,e,t,n)=>C([...r.entries()].map(([o,i])=>[e.toValue(o,t,n),e.toValue(i,t,n)])),decode:(r,e,t,n)=>{let o=new Map;return k(r).forEach(([s,c])=>{let u=e.fromValue(s,t,n),h=e.fromValue(c,t,n);o.set(u,h)}),o}},cs=ku;var Iu={type:1037,canEncode:r=>r instanceof Set,encode:(r,e,t,n)=>C([...r.values()].map(o=>e.toValue(o,t,n))),decode:(r,e,t,n)=>{let o=new Set;return k(r).forEach(s=>{o.add(e.fromValue(s,t,n))}),o}},as=Iu;var Uu={type:1038,canEncode:r=>r instanceof Uint8Array,encode:r=>r,decode:r=>r},us=Uu;var Tu={type:1039,canEncode:r=>r instanceof AbortSignal,encode:(r,e,t,n)=>(n?.abortSignals.push(r),new Uint8Array(0)),decode:(r,e,t,n)=>{let o=new AbortController;return n.abortControllers.push(o),o.signal}},ls=Tu;var Lu={type:1040,canEncode:r=>r instanceof Date,encode:r=>C(r.toString()),decode:r=>new Date(k(r))},fs=Lu;var Nu={type:1041,canEncode:r=>r instanceof RegExp,encode:r=>C({source:r.source,flags:r.flags}),decode:r=>{let{source:e,flags:t}=k(r);return new RegExp(e,t)}},ds=Nu;var hs=[Go,jo,Ji,Qi,Zi,Yi,es,ts,rs,ns,is,ss,cs,as,us,ls,fs,ds,kt];var xr=class{transformersMap;transformersList;constructor(e){this.transformersList=[...hs,...e?.valueCodecs??[]].sort((t,n)=>t.type<n.type?-1:t.type>n.type?1:0),this.transformersMap={},this.transformersList.forEach(t=>{if(this.transformersMap[t.type]!=null)throw new Error(`Duplicate transformer type ${t.type}`);this.transformersMap[t.type]=t})}toValue(e,t,n){for(let o=0;o<this.transformersList.length;o++){let i=this.transformersList[o];if(i.canEncode(e))return{type:i.type,value:i.encode?.(e,this,t,n)}}throw new at(`Unsupported value type "${e}"`)}fromValue(e,t,n){let o=this.transformersMap[e.type];if(o==null)throw new at(`Unsupported value type "${e.type}"`);return o.decode(e.value??new Uint8Array(0),this,t,n)}};function Fu(r){return r.isScope===!0}function _u(r){return r.type===E.invokeMethod||r.type===E.invokeGeneratorMethod||r.type===E.invokeCallback}var In=class{source;output;targets;invocations;values;messageHandlers;constructor(e){this.output=xe(),this.source=jt(this.output),this.targets=new Map,this.invocations=new Map,this.values=new xr(e),this.sink=this.sink.bind(this),this.messageHandlers={[E.invokeMethod]:{decoder:_e,handler:this.handleInvokeMethod.bind(this)},[E.invokeGeneratorMethod]:{decoder:_e,handler:this.handleInvokeGeneratorMethod.bind(this)},[E.abortMethodInvocation]:{decoder:yt,handler:this.handleAbortMethod.bind(this),isScope:!0},[E.methodResolved]:{decoder:He,handler:this.handleMethodResolved.bind(this),isScope:!0},[E.methodRejected]:{decoder:wt,handler:this.handleMethodRejected.bind(this),isScope:!0,isError:!0},[E.invokeCallback]:{decoder:We,handler:this.handleInvokeCallback.bind(this),isScope:!0},[E.abortCallbackInvocation]:{decoder:Xe,handler:this.handleAbortCallback.bind(this),isScope:!0},[E.callbackResolved]:{decoder:xt,handler:this.handleCallbackResolved.bind(this),isScope:!0},[E.callbackRejected]:{decoder:bt,handler:this.handleCallbackRejected.bind(this),isScope:!0,isError:!0}}}async sink(e){for await(let t of ct(e))try{let n=V.decode(t),o=this.messageHandlers[n.type];if(o==null)continue;let i=o.decoder.decode(n.message),s;if(Fu(o))try{s=zo(i,this.invocations)}catch{continue}o.handler(i,s).catch(c=>{_u(n)&&this.sendError(i,c),this.invocations.delete(i.scope)}).finally(()=>{n.type===E.invokeMethod&&this.invocations.delete(i.scope)})}catch{continue}}sendError(e,t){e.parents!=null?this.output.push(V.encode({type:E.callbackRejected,message:bt.encode({scope:e.scope,parents:e.parents,error:this.values.toValue(t)})})):this.output.push(V.encode({type:E.methodRejected,message:wt.encode({scope:e.scope,error:this.values.toValue(t)})}))}createClient(e){return this.proxy(e)}createTarget(e,t){if(this.targets.has(e))throw new Jt(`Cannot reuse RPC target name "${e}"`);this.targets.set(e,t)}async handleInvokeMethod(e){if(this.invocations.has(e.scope))throw new ut;let t=new Map,n=new Map,o={scope:e.scope,result:ce(),callbacks:t,children:n,parents:[],abortControllers:[],abortSignals:[]};this.invocations.set(e.scope,o);let i=this.lookupInvocationTarget(e.path),s=await i.fn.apply(i.context,e.args.map(c=>this.values.fromValue(c,this.output,o)));this.output.push(V.encode({type:E.methodResolved,message:He.encode({scope:e.scope,value:this.values.toValue(s)})}))}async handleAbortMethod(e,t){t.abortControllers.forEach(n=>{n.abort()})}async handleInvokeGeneratorMethod(e){if(this.invocations.has(e.scope))throw new ut;let t=new Map,n=new Map,o={scope:e.scope,result:ce(),callbacks:t,children:n,parents:[],abortControllers:[],abortSignals:[]};this.invocations.set(e.scope,o);let i=this.lookupInvocationTarget(e.path),s=i.fn.apply(i.context,e.args.map(u=>this.values.fromValue(u,this.output,o)));if(typeof s.next!="function")throw new Qt(`${e.path} did not return an async generator`);let c={next:async()=>{let u=await s.next();return u.done===!0&&this.invocations.delete(e.scope),u},throw:async u=>{try{let h=await s.throw(u);return h.done===!0&&this.invocations.delete(e.scope),h}catch(h){throw this.invocations.delete(e.scope),h}},return:async u=>{let h=await s.return(u);return h.done===!0&&this.invocations.delete(e.scope),h},[Symbol.asyncIterator]:()=>c};this.output.push(V.encode({type:E.methodResolved,message:He.encode({scope:e.scope,value:this.values.toValue(c,null,o)})}))}lookupInvocationTarget(e){let t=e.split("."),n=this.targets.get(t[0]),o=n;for(let i=1;i<t.length;i++)o=n,n=n?.[t[i]];if(n==null)throw o!=null&&e.endsWith(".then")?new Kt(`"${e.substring(0,e.length-5)}" was not a function`):new Xt(`Could not find "${e}" on target`);if(typeof n!="function")throw new lt("Invocation target was not a function");return{context:o,fn:n}}async handleMethodResolved(e,t){let n;e.value!=null&&(n=this.values.fromValue(e.value,this.output,t)),t.result.resolve(n)}async handleMethodRejected(e,t){let n;e.error!=null&&(n=this.values.fromValue(e.error,this.output,t)),t.result.reject(n)}async handleInvokeCallback(e,t){let n=t.callbacks.get(e.callback);if(n==null)throw new Yt;let o=await n.fn.apply(n.context,e.args.map(i=>this.values.fromValue(i,this.output,t)));this.output.push(V.encode({type:E.callbackResolved,message:xt.encode({scope:e.scope,parents:e.parents,value:this.values.toValue(o)})}))}async handleAbortCallback(e,t){t.abortControllers.forEach(n=>{n.abort()})}async handleCallbackResolved(e,t){let n;e.value!=null&&(n=this.values.fromValue(e.value,this.output,t)),t.children.get(e.scope)?.result.resolve(n),t.children.delete(e.scope)}async handleCallbackRejected(e,t){let n;e.error!=null&&(n=this.values.fromValue(e.error,this.output,t)),t.children.get(e.scope)?.result.reject(n),t.children.delete(e.scope)}proxy(e){let t=()=>{},n=this;return new Proxy(t,{get(o,i,s){return n.proxy(`${e==null?"":`${e}.`}${i.toString()}`)},apply(o,i,s){let c,u;function h(){return u==null&&(u=new Promise((f,g)=>{let b=Oe(),y={scope:b,result:ce(),callbacks:new Map,children:new Map,parents:[],abortControllers:[],abortSignals:[]};n.invocations.set(b,y),n.output.push(V.encode({type:E.invokeMethod,message:_e.encode({scope:b,path:e,args:s.map(m=>n.values.toValue(m,null,y))})}));let x=$t(y.abortSignals);x.addEventListener("abort",()=>{n.output.push(V.encode({type:E.abortMethodInvocation,message:yt.encode({scope:b})}))}),y.result.promise.then(m=>{f(m)},m=>{g(m)}).finally(()=>{n.invocations.delete(b),x.clear()})})),u}function l(){if(c==null){let f=Oe(),g={scope:f,result:ce(),callbacks:new Map,children:new Map,parents:[],abortControllers:[],abortSignals:[]};n.invocations.set(f,g),n.output.push(V.encode({type:E.invokeGeneratorMethod,message:_e.encode({scope:f,path:e,args:s.map(y=>n.values.toValue(y,null,g))})}));let b;c={async next(){if(b!=null)throw b;let x=await(await g.result.promise).next();return x.done===!0&&n.invocations.delete(f),x},async throw(y){if(b!=null)throw b;try{let m=await(await g.result.promise).throw(y);return m.done===!0&&n.invocations.delete(f),m}catch(x){throw n.invocations.delete(f),b=y,x}},async return(y){if(b!=null)throw b;let m=await(await g.result.promise).return(y);return m.done===!0&&n.invocations.delete(f),m},[Symbol.asyncIterator]:()=>c}}return c}return new Proxy(t,{get(f,g,b){if(g==="then")return h().then.bind(u);if(g==="catch")return h().catch.bind(u);if(g==="finally")return h().finally.bind(u);if(g===Symbol.asyncIterator)return()=>l();if(g==="next")return l().next.bind(c);if(g==="return")return l().return.bind(c);if(g==="throw")return l().throw.bind(c);if(g===Symbol.toStringTag)return"[object Object]";if(g==="constructor")return()=>{};throw new lt(`Property ${g.toString()} was not used as a promise or async generator`)}})}})}};function ps(r){return new In(r)}var ms={type:4096,canEncode:r=>r.code!=null&&r.version!=null&&r.multihash!=null&&r["/"]!=null,encode:r=>r.bytes,decode:r=>z.decode(r)};var It=class extends Event{type;detail;constructor(e,t){super(e),this.type=e,this.detail=t}};var gs={type:4099,canEncode:r=>r instanceof It,encode:(r,e,t,n)=>C({type:r.type,detail:e.toValue(r.detail,t,n)}),decode:(r,e,t,n)=>{let{type:o,detail:i}=k(r);return new It(o,e.fromValue(i,t,n))}};function B(r,e="utf8"){let t=nr[e];if(t==null)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}var br=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 i=0,s=0,c=this.peekChar();if(c===void 0)return;let u=c==="0",h=2**(8*o)-1;for(;;){let l=this.readAtomically(()=>{let f=this.readChar();if(f===void 0)return;let g=Number.parseInt(f,e);if(!Number.isNaN(g))return g});if(l===void 0)break;if(i*=e,i+=l,i>h||(s+=1,t!==void 0&&s>t))return}if(s!==0)return!n&&u&&s>1?void 0:i})}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 s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return t[o]=s[0],t[o+1]=s[1],t[o+2]=s[2],t[o+3]=s[3],[o+4,!0]}let i=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(i===void 0)return[o,!1];t[o]=i>>8,t[o+1]=i&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 i=new Uint8Array(14),s=16-(n+2),[c]=e(i.subarray(0,s));return t.set(i.subarray(0,c),16-c),t})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var ys=45,Du=15,tt=new br;function Un(r){if(!(r.length>Du))return tt.new(r).parseWith(()=>tt.readIPv4Addr())}function Tn(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>ys))return tt.new(r).parseWith(()=>tt.readIPv6Addr())}function Er(r){if(r.includes("%")&&(r=r.split("%")[0]),!(r.length>ys))return tt.new(r).parseWith(()=>tt.readIPAddr())}var Gm=parseInt("0xFFFF",16),jm=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function bs(r){return!!Un(r)}function Es(r){return!!Tn(r)}function vr(r){return!!Er(r)}var vs=bs,$u=Es,Ln=function(r){let e=0;if(r=r.toString().trim(),vs(r)){let t=new Uint8Array(e+4);return r.split(/\./g).forEach(n=>{t[e++]=parseInt(n,10)&255}),t}if($u(r)){let t=r.split(":",8),n;for(n=0;n<t.length;n++){let i=vs(t[n]),s;i&&(s=Ln(t[n]),t[n]=B(s.slice(0,2),"base16")),s!=null&&++n<8&&t.splice(n,0,B(s.slice(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 i=[n,1];for(n=9-t.length;n>0;n--)i.push("0");t.splice.apply(t,i)}let o=new Uint8Array(e+16);for(n=0;n<t.length;n++){let i=parseInt(t[n],16);o[e++]=i>>8&255,o[e++]=i&255}return o}throw new Error("invalid ip address")},Ss=function(r,e=0,t){e=~~e,t=t??r.length-e;let n=new DataView(r.buffer);if(t===4){let o=[];for(let i=0;i<t;i++)o.push(r[e+i]);return o.join(".")}if(t===16){let o=[];for(let i=0;i<t;i+=2)o.push(n.getUint16(e+i).toString(16));return o.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var rt={},Nn={},Vu=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[481,-1,"http-path"],[777,-1,"memory"]];Vu.forEach(r=>{let e=zu(...r);Nn[e.code]=e,rt[e.name]=e});function zu(r,e,t,n,o){return{code:r,size:e,name:t,resolvable:!!n,path:!!o}}function I(r){if(typeof r=="number"){if(Nn[r]!=null)return Nn[r];throw new Error(`no protocol with code: ${r}`)}else if(typeof r=="string"){if(rt[r]!=null)return rt[r];throw new Error(`no protocol with name: ${r}`)}throw new Error(`invalid protocol id type: ${typeof r}`)}var Ig=I("ip4"),Ug=I("ip6"),Tg=I("ipcidr");function Mn(r,e){switch(I(r).code){case 4:case 41:return ju(e);case 42:return Dn(e);case 6:case 273:case 33:case 132:return ks(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Dn(e);case 421:return Xu(e);case 444:return Cs(e);case 445:return Cs(e);case 466:return Wu(e);case 481:return globalThis.encodeURIComponent(Dn(e));default:return B(e,"base16")}}function Bn(r,e){switch(I(r).code){case 4:return As(e);case 41:return As(e);case 42:return _n(e);case 6:case 273:case 33:case 132:return Rn(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return _n(e);case 421:return qu(e);case 444:return Ku(e);case 445:return Ju(e);case 466:return Hu(e);case 481:return _n(globalThis.decodeURIComponent(e));default:return Ne(e,"base16")}}var Fn=Object.values(Se).map(r=>r.decoder),Gu=function(){let r=Fn[0].or(Fn[1]);return Fn.slice(2).forEach(e=>r=r.or(e)),r}();function As(r){if(!vr(r))throw new Error("invalid ip address");return Ln(r)}function ju(r){let e=Ss(r,0,r.length);if(e==null)throw new Error("ipBuff is required");if(!vr(e))throw new Error("invalid ip address");return e}function Rn(r){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,r),new Uint8Array(e)}function ks(r){return new DataView(r.buffer).getUint16(r.byteOffset)}function _n(r){let e=Ne(r),t=Uint8Array.from(be(e.length));return ee([t,e],t.length+e.length)}function Dn(r){let e=me(r);if(r=r.slice(_(e)),r.length!==e)throw new Error("inconsistent lengths");return B(r)}function qu(r){let e;r[0]==="Q"||r[0]==="1"?e=Te(N.decode(`z${r}`)).bytes:e=z.parse(r).multihash.bytes;let t=Uint8Array.from(be(e.length));return ee([t,e],t.length+e.length)}function Hu(r){let e=Gu.decode(r),t=Uint8Array.from(be(e.length));return ee([t,e],t.length+e.length)}function Wu(r){let e=me(r),t=r.slice(_(e));if(t.length!==e)throw new Error("inconsistent lengths");return"u"+B(t,"base64url")}function Xu(r){let e=me(r),t=r.slice(_(e));if(t.length!==e)throw new Error("inconsistent lengths");return B(t,"base58btc")}function Ku(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=se.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=Rn(n);return ee([t,o],t.length+o.length)}function Ju(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=se.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=Rn(n);return ee([t,o],t.length+o.length)}function Cs(r){let e=r.slice(0,r.length-2),t=r.slice(r.length-2),n=B(e,"base32"),o=ks(t);return`${n}:${o}`}function Is(r){r=Pn(r);let e=[],t=[],n=null,o=r.split("/").slice(1);if(o.length===1&&o[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let i=0;i<o.length;i++){let s=o[i],c=I(s);if(c.size===0){e.push([c.code]),t.push([c.code]);continue}if(i++,i>=o.length)throw Ts("invalid address: "+r);if(c.path===!0){n=Pn(o.slice(i).join("/")),e.push([c.code,Bn(c.code,n)]),t.push([c.code,n]);break}let u=Bn(c.code,o[i]);e.push([c.code,u]),t.push([c.code,Mn(c.code,u)])}return{string:Us(t),bytes:On(e),tuples:e,stringTuples:t,path:n}}function $n(r){let e=[],t=[],n=null,o=0;for(;o<r.length;){let i=me(r,o),s=_(i),c=I(i),u=Qu(c,r.slice(o+s));if(u===0){e.push([i]),t.push([i]),o+=s;continue}let h=r.slice(o+s,o+s+u);if(o+=u+s,o>r.length)throw Ts("Invalid address Uint8Array: "+B(r,"base16"));e.push([i,h]);let l=Mn(i,h);if(t.push([i,l]),c.path===!0){n=l;break}}return{bytes:Uint8Array.from(r),string:Us(t),tuples:e,stringTuples:t,path:n}}function Us(r){let e=[];return r.map(t=>{let n=I(t[0]);return e.push(n.name),t.length>1&&t[1]!=null&&e.push(t[1]),null}),Pn(e.join("/"))}function On(r){return ee(r.map(e=>{let t=I(e[0]),n=Uint8Array.from(be(t.code));return e.length>1&&e[1]!=null&&(n=ee([n,e[1]])),n}))}function Qu(r,e){if(r.size>0)return r.size/8;if(r.size===0)return 0;{let t=me(e instanceof Uint8Array?e:Uint8Array.from(e));return t+_(t)}}function Pn(r){return"/"+r.trim().split("/").filter(e=>e).join("/")}function Ts(r){return new Error("Error parsing address: "+r)}var Zu=Symbol.for("nodejs.util.inspect.custom"),Vn=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Yu=[I("dns").code,I("dns4").code,I("dns6").code,I("dnsaddr").code],Sr=class r{bytes;#t;#e;#r;#n;[Vn]=!0;constructor(e){e==null&&(e="");let t;if(e instanceof Uint8Array)t=$n(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);t=Is(e)}else if(Ar(e))t=$n(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.bytes,this.#t=t.string,this.#e=t.tuples,this.#r=t.stringTuples,this.#n=t.path}toString(){return this.#t}toJSON(){return this.toString()}toOptions(){let e,t,n,o,i="",s=I("tcp"),c=I("udp"),u=I("ip4"),h=I("ip6"),l=I("dns6"),f=I("ip6zone");for(let[b,y]of this.stringTuples())b===f.code&&(i=`%${y??""}`),Yu.includes(b)&&(t=s.name,o=443,n=`${y??""}${i}`,e=b===l.code?6:4),(b===s.code||b===c.code)&&(t=I(b).name,o=parseInt(y??"")),(b===u.code||b===h.code)&&(t=I(b).name,n=`${y??""}${i}`,e=b===h.code?6:4);if(e==null||t==null||n==null||o==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:t,port:o}}protos(){return this.#e.map(([e])=>Object.assign({},I(e)))}protoCodes(){return this.#e.map(([e])=>e)}protoNames(){return this.#e.map(([e])=>I(e).name)}tuples(){return this.#e}stringTuples(){return this.#r}encapsulate(e){return e=new r(e),new r(this.toString()+e.toString())}decapsulate(e){let t=e.toString(),n=this.toString(),o=n.lastIndexOf(t);if(o<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new r(n.slice(0,o))}decapsulateCode(e){let t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new r(On(t.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,o])=>{n===rt.p2p.code&&e.push([n,o]),n===rt["p2p-circuit"].code&&(e=[])});let t=e.pop();if(t?.[1]!=null){let n=t[1];return n[0]==="Q"||n[0]==="1"?B(N.decode(`z${n}`),"base58btc"):B(z.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return ke(this.bytes,e.bytes)}async resolve(e){let t=this.protos().find(i=>i.resolvable);if(t==null)return[this];let n=Ls.get(t.name);if(n==null)throw new _t(`no available resolver for ${t.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(i=>Me(i))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let t=(e??this).protos();return!(t.length!==2||t[0].code!==4&&t[0].code!==41||t[1].code!==6&&t[1].code!==273)}[Zu](){return`Multiaddr(${this.#t})`}};var Ls=new Map;function Ar(r){return!!r?.[Vn]}function Me(r){return new Sr(r)}var Ns={type:4097,canEncode:r=>Ar(r),encode:r=>r.bytes,decode:r=>Me(r)};var _s=Symbol.for("nodejs.util.inspect.custom"),Fs=Object.values(Se).map(r=>r.decoder).reduce((r,e)=>r.or(e),Se.identity.decoder),Ds=114,Ms=36,Bs=37,Ut=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Ft]=!0;toString(){return this.string==null&&(this.string=N.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return z.createV1(Ds,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return ke(this.multihash.bytes,e);if(typeof e=="string")return jn(e).equals(this);if(e?.multihash?.bytes!=null)return ke(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[_s](){return`PeerId(${this.toString()})`}},Tt=class extends Ut{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Lt=class extends Ut{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Nt=class extends Ut{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}},zn=2336,Gn=class{type="url";multihash;privateKey;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=ht.digest(Ne(this.url))}[_s](){return`PeerId(${this.url})`}[Ft]=!0;toString(){return this.toCID().toString()}toCID(){return z.createV1(zn,this.multihash)}toBytes(){return this.toCID().bytes}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=B(e)),e.toString()===this.toString())}};function jn(r,e){if(e=e??Fs,r.charAt(0)==="1"||r.charAt(0)==="Q"){let t=Te(N.decode(`z${r}`));return r.startsWith("12D")?new Lt({multihash:t}):r.startsWith("16U")?new Nt({multihash:t}):new Tt({multihash:t})}return qn(Fs.decode(r))}function qn(r){try{let e=Te(r);if(e.code===ht.code){if(e.digest.length===Ms)return new Lt({multihash:e});if(e.digest.length===Bs)return new Nt({multihash:e})}if(e.code===rr.code)return new Tt({multihash:e})}catch{return el(z.decode(r))}throw new Error("Supplied PeerID CID is invalid")}function el(r){if(r?.multihash==null||r.version==null||r.version===1&&r.code!==Ds&&r.code!==zn)throw new Error("Supplied PeerID CID is invalid");if(r.code===zn){let t=B(r.multihash.digest);return new Gn(new URL(t))}let e=r.multihash;if(e.code===rr.code)return new Tt({multihash:r.multihash});if(e.code===ht.code){if(e.digest.length===Ms)return new Lt({multihash:r.multihash});if(e.digest.length===Bs)return new Nt({multihash:r.multihash})}throw new Error("Supplied PeerID CID is invalid")}var Rs={type:4098,canEncode:r=>Kn(r),encode:r=>r.toBytes(),decode:r=>qn(r)};var Hn=[ms,Ns,Rs,gs];function nt(r,e){let t={};for(let[n,o]of r.entries())t[n]=e(o);return t}async function Cr(r,e){let t=[],n=r.connectionManager.getConnectionsMap(),o=[...n.values()].flatMap(i=>i).map(i=>i.remoteAddr.toString());for(let[i,s]of n.entries())try{let c=await r.peerStore.get(i);t.push({id:i,addresses:c.addresses.map(({isCertified:u,multiaddr:h})=>({multiaddr:h,isCertified:u,isConnected:o.includes(h.toString())})),protocols:[...c.protocols],tags:nt(c.tags,u=>u.value),metadata:nt(c.metadata,u=>de.encode(u))})}catch(c){e.error("could not load peer data from peer store",c),t.push({id:i,addresses:s.map(u=>({multiaddr:u.remoteAddr,isConnected:o.includes(u.remoteAddr.toString())})),protocols:[],tags:{},metadata:{}})}return t}async function kr(r){let e=await r.peerStore.get(r.peerId);return{id:e.id,addresses:e.addresses,protocols:[...e.protocols],tags:nt(e.tags,t=>t.value),metadata:nt(e.metadata,t=>de.encode(t))}}function Ps(r){let e=r.logger.forComponent("libp2p:devtools-metrics:metrics-rpc");return{init:async()=>({self:await kr(r),peers:await Cr(r,e),debug:localStorage.getItem("debug")??""}),setDebug:async t=>{t?.length!=null&&t?.length>0?(ao(t),localStorage.setItem("debug",t)):(co(),localStorage.removeItem("debug"))},openConnection:async(t,n)=>{let o;try{o=jn(t)}catch{o=Me(t)}await r.connectionManager.openConnection(o,n)},closeConnection:async(t,n)=>{await Promise.all(r.connectionManager.getConnections(t).map(async o=>{try{await o.close(n)}catch(i){o.abort(i)}}))},contentRouting:r.contentRouting,peerRouting:r.peerRouting}}function Wn(r,e=100){let t,n;return()=>{if(n==null&&(n=Date.now()),t!=null&&Date.now()-n>e){clearTimeout(t),n=void 0,r();return}clearTimeout(t),t=setTimeout(()=>{n=void 0,r()},e)}}var $s="@libp2p/devtools-metrics:devtools",tl="@libp2p/devtools-metrics:worker",rl="@libp2p/devtools-metrics:content",Os="@libp2p/devtools-metrics:metrics",Vs="________libp2p_devtools_metrics";Object.defineProperty(globalThis,Vs,{value:!0,enumerable:!1,writable:!1});var Xn=class{log;components;simpleMetrics;intervalMs;rpcQueue;rpc;devTools;constructor(e,t){this.log=e.logger.forComponent("libp2p:devtools-metrics"),this.intervalMs=t?.intervalMs,this.components=e,this.rpcQueue=xe(),this.rpc=ps({valueCodecs:Hn}),this.devTools=this.rpc.createClient("devTools"),this.onPeersUpdate=Wn(this.onPeersUpdate.bind(this),1e3),this.onSelfUpdate=Wn(this.onSelfUpdate.bind(this),1e3),this.onIncomingMessage=this.onIncomingMessage.bind(this),this.simpleMetrics=fo({intervalMs:this.intervalMs,onMetrics:n=>{this.devTools.safeDispatchEvent("metrics",{detail:n}).catch(o=>{this.log.error("error sending metrics",o)})}})({})}[Symbol.toStringTag]="@libp2p/devtools-metrics";[Dt]=["@libp2p/metrics"];trackMultiaddrConnection(e){this.simpleMetrics.trackMultiaddrConnection(e)}trackProtocolStream(e,t){this.simpleMetrics.trackProtocolStream(e,t)}registerMetric(e,t){return this.simpleMetrics.registerMetric(e,t)}registerMetricGroup(e,t){return this.simpleMetrics.registerMetricGroup(e,t)}registerCounter(e,t){return this.simpleMetrics.registerCounter(e,t)}registerCounterGroup(e,t){return this.simpleMetrics.registerCounterGroup(e,t)}async start(){this.components.events.addEventListener("peer:connect",this.onPeersUpdate),this.components.events.addEventListener("peer:disconnect",this.onPeersUpdate),this.components.events.addEventListener("peer:identify",this.onPeersUpdate),this.components.events.addEventListener("peer:update",this.onPeersUpdate),this.components.events.addEventListener("self:peer:update",this.onSelfUpdate),window.addEventListener("message",this.onIncomingMessage),this.rpc.createTarget("metrics",Ps(this.components)),await Qn(this.simpleMetrics),Promise.resolve().then(async()=>{await po(this.rpcQueue,this.rpc,async e=>{for await(let t of e)window.postMessage({source:Os,type:"libp2p-rpc",message:de.encode(t)})})}).catch(e=>{this.log.error("error while reading RPC messages",e)})}async stop(){window.removeEventListener("message",this.onIncomingMessage),this.components.events.removeEventListener("self:peer:update",this.onSelfUpdate),this.components.events.removeEventListener("peer:connect",this.onPeersUpdate),this.components.events.removeEventListener("peer:disconnect",this.onPeersUpdate),this.components.events.removeEventListener("peer:identify",this.onPeersUpdate),this.components.events.removeEventListener("peer:update",this.onPeersUpdate),await Zn(this.simpleMetrics)}onIncomingMessage(e){if(e.source!==window)return;let t=e.data;t?.source===$s&&t.type==="libp2p-rpc"&&this.rpcQueue.push(de.decode(t.message))}onSelfUpdate(){Promise.resolve().then(async()=>{await this.devTools.safeDispatchEvent("self",{detail:await kr(this.components)})}).catch(e=>{this.log.error("error sending peers message",e)})}onPeersUpdate(){Promise.resolve().then(async()=>{await this.devTools.safeDispatchEvent("peers",{detail:await Cr(this.components,this.log)})}).catch(e=>{this.log.error("error sending peers message",e)})}};function nl(r){return e=>new Xn(e,r)}return Hs(ol);})();
|
|
3
3
|
return Libp2PDevtoolsMetrics}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/devtools-metrics",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-1dfb74e79",
|
|
4
4
|
"description": "Collect libp2p metrics and send them to browser DevTools",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"test:chrome": "aegir test -t browser --cov"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@libp2p/interface": "
|
|
71
|
-
"@libp2p/interface-internal": "
|
|
72
|
-
"@libp2p/logger": "
|
|
73
|
-
"@libp2p/peer-id": "
|
|
74
|
-
"@libp2p/simple-metrics": "
|
|
70
|
+
"@libp2p/interface": "1.6.3-1dfb74e79",
|
|
71
|
+
"@libp2p/interface-internal": "1.3.3-1dfb74e79",
|
|
72
|
+
"@libp2p/logger": "4.0.19-1dfb74e79",
|
|
73
|
+
"@libp2p/peer-id": "4.2.3-1dfb74e79",
|
|
74
|
+
"@libp2p/simple-metrics": "1.1.4-1dfb74e79",
|
|
75
75
|
"@multiformats/multiaddr": "^12.3.0",
|
|
76
76
|
"cborg": "^4.2.2",
|
|
77
77
|
"it-pipe": "^3.0.1",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"progress-events": "^1.0.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@libp2p/peer-id-factory": "
|
|
85
|
-
"aegir": "^
|
|
84
|
+
"@libp2p/peer-id-factory": "4.2.3-1dfb74e79",
|
|
85
|
+
"aegir": "^44.0.1",
|
|
86
86
|
"sinon-ts": "^2.0.0"
|
|
87
87
|
},
|
|
88
88
|
"sideEffects": false
|
package/dist/typedoc-urls.json
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Address": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.Address.html",
|
|
3
|
-
".:Address": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.Address.html",
|
|
4
|
-
"CopyToClipboardMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.CopyToClipboardMessage.html",
|
|
5
|
-
".:CopyToClipboardMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.CopyToClipboardMessage.html",
|
|
6
|
-
"DevToolsEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsEvents.html",
|
|
7
|
-
"./rpc:DevToolsEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsEvents.html",
|
|
8
|
-
"DevToolsMetricsComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsMetricsComponents.html",
|
|
9
|
-
".:DevToolsMetricsComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsMetricsComponents.html",
|
|
10
|
-
"DevToolsMetricsInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsMetricsInit.html",
|
|
11
|
-
".:DevToolsMetricsInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsMetricsInit.html",
|
|
12
|
-
"DevToolsRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsRPC.html",
|
|
13
|
-
"./rpc:DevToolsRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.DevToolsRPC.html",
|
|
14
|
-
"MetricsRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.MetricsRPC.html",
|
|
15
|
-
"./rpc:MetricsRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.MetricsRPC.html",
|
|
16
|
-
"NodeAddress": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.NodeAddress.html",
|
|
17
|
-
"./rpc:NodeAddress": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.NodeAddress.html",
|
|
18
|
-
"NodeStatus": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.NodeStatus.html",
|
|
19
|
-
"./rpc:NodeStatus": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.NodeStatus.html",
|
|
20
|
-
"PageLoadedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.PageLoadedMessage.html",
|
|
21
|
-
".:PageLoadedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.PageLoadedMessage.html",
|
|
22
|
-
"Peer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.Peer.html",
|
|
23
|
-
"./rpc:Peer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.Peer.html",
|
|
24
|
-
"PeerAddress": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.PeerAddress.html",
|
|
25
|
-
"./rpc:PeerAddress": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.PeerAddress.html",
|
|
26
|
-
"PermissionsErrorMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.PermissionsErrorMessage.html",
|
|
27
|
-
".:PermissionsErrorMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.PermissionsErrorMessage.html",
|
|
28
|
-
"RPCMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.RPCMessage.html",
|
|
29
|
-
".:RPCMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_devtools_metrics.RPCMessage.html",
|
|
30
|
-
"ApplicationMessage": "https://libp2p.github.io/js-libp2p/types/_libp2p_devtools_metrics.ApplicationMessage.html",
|
|
31
|
-
".:ApplicationMessage": "https://libp2p.github.io/js-libp2p/types/_libp2p_devtools_metrics.ApplicationMessage.html",
|
|
32
|
-
"DevToolsMessage": "https://libp2p.github.io/js-libp2p/types/_libp2p_devtools_metrics.DevToolsMessage.html",
|
|
33
|
-
".:DevToolsMessage": "https://libp2p.github.io/js-libp2p/types/_libp2p_devtools_metrics.DevToolsMessage.html",
|
|
34
|
-
"WorkerMessage": "https://libp2p.github.io/js-libp2p/types/_libp2p_devtools_metrics.WorkerMessage.html",
|
|
35
|
-
".:WorkerMessage": "https://libp2p.github.io/js-libp2p/types/_libp2p_devtools_metrics.WorkerMessage.html",
|
|
36
|
-
"LIBP2P_DEVTOOLS_METRICS_KEY": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.LIBP2P_DEVTOOLS_METRICS_KEY.html",
|
|
37
|
-
".:LIBP2P_DEVTOOLS_METRICS_KEY": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.LIBP2P_DEVTOOLS_METRICS_KEY.html",
|
|
38
|
-
"SOURCE_CONTENT_SCRIPT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_CONTENT_SCRIPT.html",
|
|
39
|
-
".:SOURCE_CONTENT_SCRIPT": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_CONTENT_SCRIPT.html",
|
|
40
|
-
"SOURCE_DEVTOOLS": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_DEVTOOLS.html",
|
|
41
|
-
".:SOURCE_DEVTOOLS": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_DEVTOOLS.html",
|
|
42
|
-
"SOURCE_METRICS": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_METRICS.html",
|
|
43
|
-
".:SOURCE_METRICS": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_METRICS.html",
|
|
44
|
-
"SOURCE_SERVICE_WORKER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_SERVICE_WORKER.html",
|
|
45
|
-
".:SOURCE_SERVICE_WORKER": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.SOURCE_SERVICE_WORKER.html",
|
|
46
|
-
"valueCodecs": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.valueCodecs.html",
|
|
47
|
-
"./rpc:valueCodecs": "https://libp2p.github.io/js-libp2p/variables/_libp2p_devtools_metrics.valueCodecs.html",
|
|
48
|
-
"devToolsMetrics": "https://libp2p.github.io/js-libp2p/functions/_libp2p_devtools_metrics.devToolsMetrics.html",
|
|
49
|
-
".:devToolsMetrics": "https://libp2p.github.io/js-libp2p/functions/_libp2p_devtools_metrics.devToolsMetrics.html"
|
|
50
|
-
}
|