kubo-rpc-client-esm-cjs
Version:
A client library for the Kubo RPC API
2 lines • 175 kB
JavaScript
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.KuboRpcClient = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var KuboRpcClient=(()=>{var Sd=Object.create;var fr=Object.defineProperty;var Ed=Object.getOwnPropertyDescriptor;var Td=Object.getOwnPropertyNames;var Pd=Object.getPrototypeOf,Ad=Object.prototype.hasOwnProperty;var is=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),j=(e,t)=>{for(var r in t)fr(e,r,{get:t[r],enumerable:!0})},as=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Td(t))!Ad.call(e,o)&&o!==r&&fr(e,o,{get:()=>t[o],enumerable:!(n=Ed(t,o))||n.enumerable});return e};var B=(e,t,r)=>(r=e!=null?Sd(Pd(e)):{},as(t||!e||!e.__esModule?fr(r,"default",{value:e,enumerable:!0}):r,e)),vd=e=>as(fr({},"__esModule",{value:!0}),e);var pa=E((P0,da)=>{da.exports=po;var la=128,pm=127,hm=~pm,mm=Math.pow(2,31);function po(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw po.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=mm;)t[r++]=e&255|la,e/=128;for(;e&hm;)t[r++]=e&255|la,e>>>=7;return t[r]=e|0,po.bytes=r-n+1,t}});var ya=E((A0,ma)=>{ma.exports=ho;var ym=128,ha=127;function ho(e,n){var r=0,n=n||0,o=0,s=n,i,a=e.length;do{if(s>=a||o>49)throw ho.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&ha)<<o:(i&ha)*Math.pow(2,o),o+=7}while(i>=ym);return ho.bytes=s-n,r}});var wa=E((v0,ga)=>{var gm=Math.pow(2,7),wm=Math.pow(2,14),bm=Math.pow(2,21),xm=Math.pow(2,28),Sm=Math.pow(2,35),Em=Math.pow(2,42),Tm=Math.pow(2,49),Pm=Math.pow(2,56),Am=Math.pow(2,63);ga.exports=function(e){return e<gm?1:e<wm?2:e<bm?3:e<xm?4:e<Sm?5:e<Em?6:e<Tm?7:e<Pm?8:e<Am?9:10}});var Nr=E((C0,ba)=>{ba.exports={encode:pa(),decode:ya(),encodingLength:wa()}});var Q=E((W0,ka)=>{"use strict";function Ca(e,t){for(let r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function Mm(e,t,r){if(!e||typeof e=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof t=="object"&&(r=t,t=""),t&&(r.code=t);try{return Ca(e,r)}catch{r.message=e.message,r.stack=e.stack;let o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(e)),Ca(new o,r)}}ka.exports=Mm});var Da=E((t1,Na)=>{function Gm(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}Na.exports=Gm});var Po=E((r1,Ra)=>{"use strict";var Wm=Da(),Fr=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,Xt=Wm(),Jm=Fr&&!Xt,Km=Xt&&!Fr,Xm=Xt&&Fr,Qm=typeof is=="function"&&typeof process<"u"&&typeof process.release<"u"&&process.release.name==="node"&&!Xt,Zm=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Ym=typeof process<"u"&&typeof process.env<"u"&&!1,ey=typeof navigator<"u"&&navigator.product==="ReactNative";Ra.exports={isTest:Ym,isElectron:Xt,isElectronMain:Km,isElectronRenderer:Xm,isNode:Qm,isBrowser:Jm,isWebWorker:Zm,isEnvWithDom:Fr,isReactNative:ey}});var $a=E((s1,Fa)=>{var St=1e3,Et=St*60,Tt=Et*60,Ye=Tt*24,ry=Ye*7,ny=Ye*365.25;Fa.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return oy(e);if(r==="number"&&isFinite(e))return t.long?iy(e):sy(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function oy(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*ny;case"weeks":case"week":case"w":return r*ry;case"days":case"day":case"d":return r*Ye;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Tt;case"minutes":case"minute":case"mins":case"min":case"m":return r*Et;case"seconds":case"second":case"secs":case"sec":case"s":return r*St;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function sy(e){var t=Math.abs(e);return t>=Ye?Math.round(e/Ye)+"d":t>=Tt?Math.round(e/Tt)+"h":t>=Et?Math.round(e/Et)+"m":t>=St?Math.round(e/St)+"s":e+"ms"}function iy(e){var t=Math.abs(e);return t>=Ye?$r(e,t,Ye,"day"):t>=Tt?$r(e,t,Tt,"hour"):t>=Et?$r(e,t,Et,"minute"):t>=St?$r(e,t,St,"second"):e+" ms"}function $r(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var ja=E((i1,za)=>{function ay(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=o,r.enabled=i,r.humanize=$a(),r.destroy=d,Object.keys(e).forEach(p=>{r[p]=e[p]}),r.names=[],r.skips=[],r.formatters={};function t(p){let y=0;for(let x=0;x<p.length;x++)y=(y<<5)-y+p.charCodeAt(x),y|=0;return r.colors[Math.abs(y)%r.colors.length]}r.selectColor=t;function r(p){let y,x=null,_,P;function k(...U){if(!k.enabled)return;let z=k,K=Number(new Date),ie=K-(y||K);z.diff=ie,z.prev=y,z.curr=K,y=K,U[0]=r.coerce(U[0]),typeof U[0]!="string"&&U.unshift("%O");let V=0;U[0]=U[0].replace(/%([a-zA-Z%])/g,(ae,Y)=>{if(ae==="%%")return"%";V++;let ce=r.formatters[Y];if(typeof ce=="function"){let nt=U[V];ae=ce.call(z,nt),U.splice(V,1),V--}return ae}),r.formatArgs.call(z,U),(z.log||r.log).apply(z,U)}return k.namespace=p,k.useColors=r.useColors(),k.color=r.selectColor(p),k.extend=n,k.destroy=r.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>x!==null?x:(_!==r.namespaces&&(_=r.namespaces,P=r.enabled(p)),P),set:U=>{x=U}}),typeof r.init=="function"&&r.init(k),k}function n(p,y){let x=r(this.namespace+(typeof y>"u"?":":y)+p);return x.log=this.log,x}function o(p){r.save(p),r.namespaces=p,r.names=[],r.skips=[];let y,x=(typeof p=="string"?p:"").split(/[\s,]+/),_=x.length;for(y=0;y<_;y++)x[y]&&(p=x[y].replace(/\*/g,".*?"),p[0]==="-"?r.skips.push(new RegExp("^"+p.slice(1)+"$")):r.names.push(new RegExp("^"+p+"$")))}function s(){let p=[...r.names.map(a),...r.skips.map(a).map(y=>"-"+y)].join(",");return r.enable(""),p}function i(p){if(p[p.length-1]==="*")return!0;let y,x;for(y=0,x=r.skips.length;y<x;y++)if(r.skips[y].test(p))return!1;for(y=0,x=r.names.length;y<x;y++)if(r.names[y].test(p))return!0;return!1}function a(p){return p.toString().substring(2,p.toString().length-2).replace(/\.\*\?$/,"*")}function c(p){return p instanceof Error?p.stack||p.message:p}function d(){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 r.enable(r.load()),r}za.exports=ay});var Ma=E((se,zr)=>{se.formatArgs=uy;se.save=fy;se.load=ly;se.useColors=cy;se.storage=dy();se.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})();se.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 cy(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1: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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function uy(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+zr.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}se.log=console.debug||console.log||(()=>{});function fy(e){try{e?se.storage.setItem("debug",e):se.storage.removeItem("debug")}catch{}}function ly(){let e;try{e=se.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function dy(){try{return localStorage}catch{}}zr.exports=ja()(se);var{formatters:py}=zr.exports;py.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var ko=E(Mr=>{"use strict";var Ao=class extends Error{constructor(t="Request timed out"){super(t),this.name="TimeoutError"}};Mr.TimeoutError=Ao;var vo=class extends Error{constructor(t="The operation was aborted."){super(t),this.name="AbortError"}};Mr.AbortError=vo;var Co=class extends Error{constructor(t){super(t.statusText),this.name="HTTPError",this.response=t}};Mr.HTTPError=Co});var Qt=E(()=>{});var qa=E((h1,Bo)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?Bo.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:Bo.exports={default:Qt().default,Headers:Qt().Headers,Request:Qt().Request,Response:Qt().Response}});var Va=E((m1,Ha)=>{"use strict";Ha.exports=qa()});var Ja=E((y1,Wa)=>{"use strict";var{TimeoutError:hy,AbortError:my}=ko(),{Response:Ga,Request:yy,Headers:Uo,default:gy}=Va(),wy=(e,t={})=>{let r=new XMLHttpRequest;r.open(t.method||"GET",e.toString(),!0);let{timeout:n,headers:o}=t;if(n&&n>0&&n<1/0&&(r.timeout=n),t.overrideMimeType!=null&&r.overrideMimeType(t.overrideMimeType),o)for(let[s,i]of new Uo(o))r.setRequestHeader(s,i);return t.signal&&(t.signal.onabort=()=>r.abort()),t.onUploadProgress&&(r.upload.onprogress=t.onUploadProgress),r.responseType="arraybuffer",new Promise((s,i)=>{let a=c=>{switch(c.type){case"error":{s(Ga.error());break}case"load":{s(new Io(r.responseURL,r.response,{status:r.status,statusText:r.statusText,headers:Sy(r.getAllResponseHeaders())}));break}case"timeout":{i(new hy);break}case"abort":{i(new my);break}default:break}};r.onerror=a,r.onload=a,r.ontimeout=a,r.onabort=a,r.send(t.body)})},by=gy,xy=(e,t={})=>t.onUploadProgress!=null?wy(e,t):by(e,t),Sy=e=>{let t=new Uo;for(let r of e.trim().split(/[\r\n]+/)){let n=r.indexOf(": ");n>0&&t.set(r.slice(0,n),r.slice(n+1))}return t},Io=class extends Ga{constructor(t,r,n){super(r,n),Object.defineProperty(this,"url",{value:t})}};Wa.exports={fetch:xy,Request:yy,Headers:Uo}});var Xa=E((g1,Ka)=>{"use strict";Ka.exports=e=>{if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}});var No=E((ec,tc)=>{"use strict";var qr=Xa(),{hasOwnProperty:Za}=Object.prototype,{propertyIsEnumerable:Ey}=Object,Pt=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),Ty=ec,Qa={concatArrays:!1,ignoreUndefined:!1},Hr=e=>{let t=[];for(let r in e)Za.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){let r=Object.getOwnPropertySymbols(e);for(let n of r)Ey.call(e,n)&&t.push(n)}return t};function At(e){return Array.isArray(e)?Py(e):qr(e)?Ay(e):e}function Py(e){let t=e.slice(0,0);return Hr(e).forEach(r=>{Pt(t,r,At(e[r]))}),t}function Ay(e){let t=Object.getPrototypeOf(e)===null?Object.create(null):{};return Hr(e).forEach(r=>{Pt(t,r,At(e[r]))}),t}var Ya=(e,t,r,n)=>(r.forEach(o=>{typeof t[o]>"u"&&n.ignoreUndefined||(o in e&&e[o]!==Object.getPrototypeOf(e)?Pt(e,o,_o(e[o],t[o],n)):Pt(e,o,At(t[o])))}),e),vy=(e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach(s=>{let i=[];for(let a=0;a<s.length;a++)Za.call(s,a)&&(i.push(String(a)),s===e?Pt(n,o++,s[a]):Pt(n,o++,At(s[a])));n=Ya(n,s,Hr(s).filter(a=>!i.includes(a)),r)}),n};function _o(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?vy(e,t,r):!qr(t)||!qr(e)?At(t):Ya(e,t,Hr(t),r)}tc.exports=function(...e){let t=_o(At(Qa),this!==Ty&&this||{},Qa),r={_:{}};for(let n of e)if(n!==void 0){if(!qr(n))throw new TypeError("`"+n+"` is not an Option Object");r=_o(r,{_:n},t)}return r._}});var Ro=E((w1,nc)=>{"use strict";var Cy=typeof navigator<"u"&&navigator.product==="ReactNative";function ky(){return Cy?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:""}var Zt=self.URL,rc=ky(),Do=class{constructor(t="",r=rc){this.super=new Zt(t,r),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(t){this.super.hash=t}set host(t){this.super.host=t}set hostname(t){this.super.hostname=t}set href(t){this.super.href=t}set password(t){this.super.password=t}set pathname(t){this.super.pathname=t}set port(t){this.super.port=t}set protocol(t){this.super.protocol=t}set search(t){this.super.search=t}set username(t){this.super.username=t}static createObjectURL(t){return Zt.createObjectURL(t)}static revokeObjectURL(t){Zt.revokeObjectURL(t)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function By(e){if(typeof e=="string")return new Zt(e).toString();if(!(e instanceof Zt)){let t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",o=e.protocol?e.protocol+"//":"",s=e.host||"",i=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",d=e.pathname||"",p=e.path||d+a;return`${o}${t||r}${s||i+n}${p}${c}`}}nc.exports={URLWithLegacySupport:Do,URLSearchParams:self.URLSearchParams,defaultBase:rc,format:By}});var ic=E((b1,sc)=>{"use strict";var{URLWithLegacySupport:oc,format:Iy}=Ro();sc.exports=(e,t={},r={},n)=>{let o=t.protocol?t.protocol.replace(":",""):"http";o=(r[o]||n||o)+":";let s;try{s=new oc(e)}catch{s={}}let i=Object.assign({},t,{protocol:o||s.protocol,host:t.host||s.host});return new oc(e,Iy(i)).toString()}});var cc=E((x1,ac)=>{"use strict";var{URLWithLegacySupport:Uy,format:_y,URLSearchParams:Ny,defaultBase:Dy}=Ro(),Ry=ic();ac.exports={URL:Uy,URLSearchParams:Ny,format:_y,relative:Ry,defaultBase:Dy}});var Lo=E((S1,Oo)=>{function uc(e){let t=new globalThis.AbortController;function r(){t.abort();for(let n of e)!n||!n.removeEventListener||n.removeEventListener("abort",r)}for(let n of e)if(!(!n||!n.addEventListener)){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}Oo.exports=uc;Oo.exports.anySignal=uc});var lc=E((E1,fc)=>{"use strict";async function*Oy(e,t={}){let r=e.getReader();try{for(;;){let n=await r.read();if(n.done)return;yield n.value}}finally{t.preventCancel!==!0&&r.cancel(),r.releaseLock()}}fc.exports=Oy});var pc=E((T1,dc)=>{"use strict";var Ly=async e=>{let t=[];for await(let r of e)t.push(r);return t};dc.exports=Ly});var Vr=E((P1,bc)=>{"use strict";var{fetch:Fy,Request:$y,Headers:zy}=Ja(),{TimeoutError:Fo,HTTPError:gc}=ko(),hc=No().bind({ignoreUndefined:!0}),{URL:mc,URLSearchParams:yc}=cc(),jy=Lo(),My=lc(),{isBrowser:qy,isWebWorker:Hy}=Po(),Vy=pc(),Gy=(e,t,r)=>{if(t===void 0)return e;let n=Date.now(),o=()=>Date.now()-n>=t;return new Promise((s,i)=>{let a=setTimeout(()=>{o()&&(i(new Fo),r.abort())},t),c=d=>y=>{if(clearTimeout(a),o()){i(new Fo);return}d(y)};e.then(c(s),c(i))})},Wy={throwHttpErrors:!0,credentials:"same-origin"},J=class{constructor(t={}){this.opts=hc(Wy,t)}async fetch(t,r={}){let n=hc(this.opts,r),o=new zy(n.headers);if(typeof t!="string"&&!(t instanceof mc||t instanceof $y))throw new TypeError("`resource` must be a string, URL, or Request");let s=new mc(t.toString(),n.base),{searchParams:i,transformSearchParams:a,json:c}=n;i&&(typeof a=="function"?s.search=a(new yc(n.searchParams)):s.search=new yc(n.searchParams)),c&&(n.body=JSON.stringify(n.json),o.set("content-type","application/json"));let d=new AbortController,p=jy([d.signal,n.signal]);globalThis.ReadableStream!=null&&n.body instanceof globalThis.ReadableStream&&(qy||Hy)&&(n.body=new Blob(await Vy(My(n.body))));let y=await Gy(Fy(s.toString(),{...n,signal:p,timeout:void 0,headers:o,duplex:"half"}),n.timeout,d);if(!y.ok&&n.throwHttpErrors)throw n.handleError&&await n.handleError(y),new gc(y);return y.iterator=async function*(){yield*wc(y.body)},y.ndjson=async function*(){for await(let x of Jy(y.iterator()))r.transform?yield r.transform(x):yield x},y}post(t,r={}){return this.fetch(t,{...r,method:"POST"})}get(t,r={}){return this.fetch(t,{...r,method:"GET"})}put(t,r={}){return this.fetch(t,{...r,method:"PUT"})}delete(t,r={}){return this.fetch(t,{...r,method:"DELETE"})}options(t,r={}){return this.fetch(t,{...r,method:"OPTIONS"})}},Jy=async function*(e){let t=new TextDecoder,r="";for await(let n of e){r+=t.decode(n,{stream:!0});let o=r.split(/\r?\n/);for(let s=0;s<o.length-1;s++){let i=o[s].trim();i.length>0&&(yield JSON.parse(i))}r=o[o.length-1]}r+=t.decode(),r=r.trim(),r.length!==0&&(yield JSON.parse(r))},wc=e=>{if(Ky(e))return e;if(Qy(e)){let t=e[Symbol.asyncIterator]();return{[Symbol.asyncIterator](){return{next:t.next.bind(t),return(r){return e.destroy(),typeof t.return=="function"?t.return():Promise.resolve({done:!0,value:r})}}}}}if(Xy(e)){let t=e.getReader();return async function*(){try{for(;;){let{done:r,value:n}=await t.read();if(r)return;n&&(yield n)}}finally{t.releaseLock()}}()}throw new TypeError("Body can't be converted to AsyncIterable")},Ky=e=>typeof e=="object"&&e!==null&&typeof e[Symbol.asyncIterator]=="function",Xy=e=>e&&typeof e.getReader=="function",Qy=e=>Object.prototype.hasOwnProperty.call(e,"readable")&&Object.prototype.hasOwnProperty.call(e,"writable");J.HTTPError=gc;J.TimeoutError=Fo;J.streamToAsyncIterator=wc;J.post=(e,t)=>new J(t).post(e,t);J.get=(e,t)=>new J(t).get(e,t);J.put=(e,t)=>new J(t).put(e,t);J.delete=(e,t)=>new J(t).delete(e,t);J.options=(e,t)=>new J(t).options(e,t);bc.exports=J});var $c=E((_x,Fc)=>{"use strict";Fc.exports=pg;function pg(e,t){for(var r=new Array(arguments.length-1),n=0,o=2,s=!0;o<arguments.length;)r[n++]=arguments[o++];return new Promise(function(a,c){r[n]=function(p){if(s)if(s=!1,p)c(p);else{for(var y=new Array(arguments.length-1),x=0;x<y.length;)y[x++]=arguments[x];a.apply(null,y)}};try{e.apply(t||null,r)}catch(d){s&&(s=!1,c(d))}})}});var qc=E(Mc=>{"use strict";var Qr=Mc;Qr.length=function(t){var r=t.length;if(!r)return 0;for(var n=0;--r%4>1&&t.charAt(r)==="=";)++n;return Math.ceil(t.length*3)/4-n};var Ct=new Array(64),jc=new Array(123);for(Ee=0;Ee<64;)jc[Ct[Ee]=Ee<26?Ee+65:Ee<52?Ee+71:Ee<62?Ee-4:Ee-59|43]=Ee++;var Ee;Qr.encode=function(t,r,n){for(var o=null,s=[],i=0,a=0,c;r<n;){var d=t[r++];switch(a){case 0:s[i++]=Ct[d>>2],c=(d&3)<<4,a=1;break;case 1:s[i++]=Ct[c|d>>4],c=(d&15)<<2,a=2;break;case 2:s[i++]=Ct[c|d>>6],s[i++]=Ct[d&63],a=0;break}i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=Ct[c],s[i++]=61,a===1&&(s[i++]=61)),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var zc="invalid encoding";Qr.decode=function(t,r,n){for(var o=n,s=0,i,a=0;a<t.length;){var c=t.charCodeAt(a++);if(c===61&&s>1)break;if((c=jc[c])===void 0)throw Error(zc);switch(s){case 0:i=c,s=1;break;case 1:r[n++]=i<<2|(c&48)>>4,i=c,s=2;break;case 2:r[n++]=(i&15)<<4|(c&60)>>2,i=c,s=3;break;case 3:r[n++]=(i&3)<<6|c,s=0;break}}if(s===1)throw Error(zc);return n-o};Qr.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Vc=E((Dx,Hc)=>{"use strict";Hc.exports=Zr;function Zr(){this._listeners={}}Zr.prototype.on=function(t,r,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:r,ctx:n||this}),this};Zr.prototype.off=function(t,r){if(t===void 0)this._listeners={};else if(r===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],o=0;o<n.length;)n[o].fn===r?n.splice(o,1):++o;return this};Zr.prototype.emit=function(t){var r=this._listeners[t];if(r){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<r.length;)r[o].fn.apply(r[o++].ctx,n)}return this}});var Zc=E((Rx,Qc)=>{"use strict";Qc.exports=Gc(Gc);function Gc(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=r[3]===128;function o(c,d,p){t[0]=c,d[p]=r[0],d[p+1]=r[1],d[p+2]=r[2],d[p+3]=r[3]}function s(c,d,p){t[0]=c,d[p]=r[3],d[p+1]=r[2],d[p+2]=r[1],d[p+3]=r[0]}e.writeFloatLE=n?o:s,e.writeFloatBE=n?s:o;function i(c,d){return r[0]=c[d],r[1]=c[d+1],r[2]=c[d+2],r[3]=c[d+3],t[0]}function a(c,d){return r[3]=c[d],r[2]=c[d+1],r[1]=c[d+2],r[0]=c[d+3],t[0]}e.readFloatLE=n?i:a,e.readFloatBE=n?a:i}():function(){function t(n,o,s,i){var a=o<0?1:0;if(a&&(o=-o),o===0)n(1/o>0?0:2147483648,s,i);else if(isNaN(o))n(2143289344,s,i);else if(o>34028234663852886e22)n((a<<31|2139095040)>>>0,s,i);else if(o<11754943508222875e-54)n((a<<31|Math.round(o/1401298464324817e-60))>>>0,s,i);else{var c=Math.floor(Math.log(o)/Math.LN2),d=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|d)>>>0,s,i)}}e.writeFloatLE=t.bind(null,Wc),e.writeFloatBE=t.bind(null,Jc);function r(n,o,s){var i=n(o,s),a=(i>>31)*2+1,c=i>>>23&255,d=i&8388607;return c===255?d?NaN:a*(1/0):c===0?a*1401298464324817e-60*d:a*Math.pow(2,c-150)*(d+8388608)}e.readFloatLE=r.bind(null,Kc),e.readFloatBE=r.bind(null,Xc)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=r[7]===128;function o(c,d,p){t[0]=c,d[p]=r[0],d[p+1]=r[1],d[p+2]=r[2],d[p+3]=r[3],d[p+4]=r[4],d[p+5]=r[5],d[p+6]=r[6],d[p+7]=r[7]}function s(c,d,p){t[0]=c,d[p]=r[7],d[p+1]=r[6],d[p+2]=r[5],d[p+3]=r[4],d[p+4]=r[3],d[p+5]=r[2],d[p+6]=r[1],d[p+7]=r[0]}e.writeDoubleLE=n?o:s,e.writeDoubleBE=n?s:o;function i(c,d){return r[0]=c[d],r[1]=c[d+1],r[2]=c[d+2],r[3]=c[d+3],r[4]=c[d+4],r[5]=c[d+5],r[6]=c[d+6],r[7]=c[d+7],t[0]}function a(c,d){return r[7]=c[d],r[6]=c[d+1],r[5]=c[d+2],r[4]=c[d+3],r[3]=c[d+4],r[2]=c[d+5],r[1]=c[d+6],r[0]=c[d+7],t[0]}e.readDoubleLE=n?i:a,e.readDoubleBE=n?a:i}():function(){function t(n,o,s,i,a,c){var d=i<0?1:0;if(d&&(i=-i),i===0)n(0,a,c+o),n(1/i>0?0:2147483648,a,c+s);else if(isNaN(i))n(0,a,c+o),n(2146959360,a,c+s);else if(i>17976931348623157e292)n(0,a,c+o),n((d<<31|2146435072)>>>0,a,c+s);else{var p;if(i<22250738585072014e-324)p=i/5e-324,n(p>>>0,a,c+o),n((d<<31|p/4294967296)>>>0,a,c+s);else{var y=Math.floor(Math.log(i)/Math.LN2);y===1024&&(y=1023),p=i*Math.pow(2,-y),n(p*4503599627370496>>>0,a,c+o),n((d<<31|y+1023<<20|p*1048576&1048575)>>>0,a,c+s)}}}e.writeDoubleLE=t.bind(null,Wc,0,4),e.writeDoubleBE=t.bind(null,Jc,4,0);function r(n,o,s,i,a){var c=n(i,a+o),d=n(i,a+s),p=(d>>31)*2+1,y=d>>>20&2047,x=4294967296*(d&1048575)+c;return y===2047?x?NaN:p*(1/0):y===0?p*5e-324*x:p*Math.pow(2,y-1075)*(x+4503599627370496)}e.readDoubleLE=r.bind(null,Kc,0,4),e.readDoubleBE=r.bind(null,Xc,4,0)}(),e}function Wc(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function Jc(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=e&255}function Kc(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Xc(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var Yc=E((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}});var tu=E(eu=>{"use strict";var zo=eu;zo.length=function(t){for(var r=0,n=0,o=0;o<t.length;++o)n=t.charCodeAt(o),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(t.charCodeAt(o+1)&64512)===56320?(++o,r+=4):r+=3;return r};zo.read=function(t,r,n){var o=n-r;if(o<1)return"";for(var s=null,i=[],a=0,c;r<n;)c=t[r++],c<128?i[a++]=c:c>191&&c<224?i[a++]=(c&31)<<6|t[r++]&63:c>239&&c<365?(c=((c&7)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,i[a++]=55296+(c>>10),i[a++]=56320+(c&1023)):i[a++]=(c&15)<<12|(t[r++]&63)<<6|t[r++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,i)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,i.slice(0,a))),s.join("")):String.fromCharCode.apply(String,i.slice(0,a))};zo.write=function(t,r,n){for(var o=n,s,i,a=0;a<t.length;++a)s=t.charCodeAt(a),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((i=t.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(i&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-o}});var nu=E((Lx,ru)=>{"use strict";ru.exports=hg;function hg(e,t,r){var n=r||8192,o=n>>>1,s=null,i=n;return function(c){if(c<1||c>o)return e(c);i+c>n&&(s=e(n),i=0);var d=t.call(s,i,i+=c);return i&7&&(i=(i|7)+1),d}}});var su=E((Fx,ou)=>{"use strict";ou.exports=H;var sr=We();function H(e,t){this.lo=e>>>0,this.hi=t>>>0}var tt=H.zero=new H(0,0);tt.toNumber=function(){return 0};tt.zzEncode=tt.zzDecode=function(){return this};tt.length=function(){return 1};var mg=H.zeroHash="\0\0\0\0\0\0\0\0";H.fromNumber=function(t){if(t===0)return tt;var r=t<0;r&&(t=-t);var n=t>>>0,o=(t-n)/4294967296>>>0;return r&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new H(n,o)};H.from=function(t){if(typeof t=="number")return H.fromNumber(t);if(sr.isString(t))if(sr.Long)t=sr.Long.fromString(t);else return H.fromNumber(parseInt(t,10));return t.low||t.high?new H(t.low>>>0,t.high>>>0):tt};H.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};H.prototype.toLong=function(t){return sr.Long?new sr.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var Ge=String.prototype.charCodeAt;H.fromHash=function(t){return t===mg?tt:new H((Ge.call(t,0)|Ge.call(t,1)<<8|Ge.call(t,2)<<16|Ge.call(t,3)<<24)>>>0,(Ge.call(t,4)|Ge.call(t,5)<<8|Ge.call(t,6)<<16|Ge.call(t,7)<<24)>>>0)};H.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};H.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};H.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};H.prototype.length=function(){var t=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?t<16384?t<128?1:2:t<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var We=E(jo=>{"use strict";var b=jo;b.asPromise=$c();b.base64=qc();b.EventEmitter=Vc();b.float=Zc();b.inquire=Yc();b.utf8=tu();b.pool=nu();b.LongBits=su();b.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);b.global=b.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||jo;b.emptyArray=Object.freeze?Object.freeze([]):[];b.emptyObject=Object.freeze?Object.freeze({}):{};b.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};b.isString=function(t){return typeof t=="string"||t instanceof String};b.isObject=function(t){return t&&typeof t=="object"};b.isset=b.isSet=function(t,r){var n=t[r];return n!=null&&t.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};b.Buffer=function(){try{var e=b.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();b._Buffer_from=null;b._Buffer_allocUnsafe=null;b.newBuffer=function(t){return typeof t=="number"?b.Buffer?b._Buffer_allocUnsafe(t):new b.Array(t):b.Buffer?b._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};b.Array=typeof Uint8Array<"u"?Uint8Array:Array;b.Long=b.global.dcodeIO&&b.global.dcodeIO.Long||b.global.Long||b.inquire("long");b.key2Re=/^true|false|0|1$/;b.key32Re=/^-?(?:0|[1-9][0-9]*)$/;b.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;b.longToHash=function(t){return t?b.LongBits.from(t).toHash():b.LongBits.zeroHash};b.longFromHash=function(t,r){var n=b.LongBits.fromHash(t);return b.Long?b.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))};function iu(e,t,r){for(var n=Object.keys(t),o=0;o<n.length;++o)(e[n[o]]===void 0||!r)&&(e[n[o]]=t[n[o]]);return e}b.merge=iu;b.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function au(e){function t(r,n){if(!(this instanceof t))return new t(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&iu(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}b.newError=au;b.ProtocolError=au("ProtocolError");b.oneOfGetter=function(t){for(var r={},n=0;n<t.length;++n)r[t[n]]=1;return function(){for(var o=Object.keys(this),s=o.length-1;s>-1;--s)if(r[o[s]]===1&&this[o[s]]!==void 0&&this[o[s]]!==null)return o[s]}};b.oneOfSetter=function(t){return function(r){for(var n=0;n<t.length;++n)t[n]!==r&&delete this[t[n]]}};b.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};b._configure=function(){var e=b.Buffer;if(!e){b._Buffer_from=b._Buffer_allocUnsafe=null;return}b._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,n){return new e(r,n)},b._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}}});var Jo=E((zx,lu)=>{"use strict";lu.exports=v;var he=We(),Mo,Yr=he.LongBits,cu=he.base64,uu=he.utf8;function ir(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function Ho(){}function yg(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function v(){this.len=0,this.head=new ir(Ho,0,0),this.tail=this.head,this.states=null}var fu=function(){return he.Buffer?function(){return(v.create=function(){return new Mo})()}:function(){return new v}};v.create=fu();v.alloc=function(t){return new he.Array(t)};he.Array!==Array&&(v.alloc=he.pool(v.alloc,he.Array.prototype.subarray));v.prototype._push=function(t,r,n){return this.tail=this.tail.next=new ir(t,r,n),this.len+=r,this};function Vo(e,t,r){t[r]=e&255}function gg(e,t,r){for(;e>127;)t[r++]=e&127|128,e>>>=7;t[r]=e}function Go(e,t){this.len=e,this.next=void 0,this.val=t}Go.prototype=Object.create(ir.prototype);Go.prototype.fn=gg;v.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Go((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};v.prototype.int32=function(t){return t<0?this._push(Wo,10,Yr.fromNumber(t)):this.uint32(t)};v.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Wo(e,t,r){for(;e.hi;)t[r++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=e.lo&127|128,e.lo=e.lo>>>7;t[r++]=e.lo}v.prototype.uint64=function(t){var r=Yr.from(t);return this._push(Wo,r.length(),r)};v.prototype.int64=v.prototype.uint64;v.prototype.sint64=function(t){var r=Yr.from(t).zzEncode();return this._push(Wo,r.length(),r)};v.prototype.bool=function(t){return this._push(Vo,1,t?1:0)};function qo(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}v.prototype.fixed32=function(t){return this._push(qo,4,t>>>0)};v.prototype.sfixed32=v.prototype.fixed32;v.prototype.fixed64=function(t){var r=Yr.from(t);return this._push(qo,4,r.lo)._push(qo,4,r.hi)};v.prototype.sfixed64=v.prototype.fixed64;v.prototype.float=function(t){return this._push(he.float.writeFloatLE,4,t)};v.prototype.double=function(t){return this._push(he.float.writeDoubleLE,8,t)};var wg=he.Array.prototype.set?function(t,r,n){r.set(t,n)}:function(t,r,n){for(var o=0;o<t.length;++o)r[n+o]=t[o]};v.prototype.bytes=function(t){var r=t.length>>>0;if(!r)return this._push(Vo,1,0);if(he.isString(t)){var n=v.alloc(r=cu.length(t));cu.decode(t,n,0),t=n}return this.uint32(r)._push(wg,r,t)};v.prototype.string=function(t){var r=uu.length(t);return r?this.uint32(r)._push(uu.write,r,t):this._push(Vo,1,0)};v.prototype.fork=function(){return this.states=new yg(this),this.head=this.tail=new ir(Ho,0,0),this.len=0,this};v.prototype.reset=function(){return this.states?(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 ir(Ho,0,0),this.len=0),this};v.prototype.ldelim=function(){var t=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=r,this.len+=n),this};v.prototype.finish=function(){for(var t=this.head.next,r=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,r,n),n+=t.len,t=t.next;return r};v._configure=function(e){Mo=e,v.create=fu(),Mo._configure()}});var hu=E((jx,pu)=>{"use strict";pu.exports=Be;var du=Jo();(Be.prototype=Object.create(du.prototype)).constructor=Be;var Je=We();function Be(){du.call(this)}Be._configure=function(){Be.alloc=Je._Buffer_allocUnsafe,Be.writeBytesBuffer=Je.Buffer&&Je.Buffer.prototype instanceof Uint8Array&&Je.Buffer.prototype.set.name==="set"?function(t,r,n){r.set(t,n)}:function(t,r,n){if(t.copy)t.copy(r,n,0,t.length);else for(var o=0;o<t.length;)r[n++]=t[o++]}};Be.prototype.bytes=function(t){Je.isString(t)&&(t=Je._Buffer_from(t,"base64"));var r=t.length>>>0;return this.uint32(r),r&&this._push(Be.writeBytesBuffer,r,t),this};function bg(e,t,r){e.length<40?Je.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}Be.prototype.string=function(t){var r=Je.Buffer.byteLength(t);return this.uint32(r),r&&this._push(bg,r,t),this};Be._configure()});var Qo=E((Mx,bu)=>{"use strict";bu.exports=R;var Ie=We(),Xo,gu=Ie.LongBits,xg=Ie.utf8;function Te(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function R(e){this.buf=e,this.pos=0,this.len=e.length}var mu=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new R(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new R(t);throw Error("illegal buffer")},wu=function(){return Ie.Buffer?function(r){return(R.create=function(o){return Ie.Buffer.isBuffer(o)?new Xo(o):mu(o)})(r)}:mu};R.create=wu();R.prototype._slice=Ie.Array.prototype.subarray||Ie.Array.prototype.slice;R.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,Te(this,10);return t}}();R.prototype.int32=function(){return this.uint32()|0};R.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Ko(){var e=new gu(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 Te(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 Te(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")}R.prototype.bool=function(){return this.uint32()!==0};function en(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}R.prototype.fixed32=function(){if(this.pos+4>this.len)throw Te(this,4);return en(this.buf,this.pos+=4)};R.prototype.sfixed32=function(){if(this.pos+4>this.len)throw Te(this,4);return en(this.buf,this.pos+=4)|0};function yu(){if(this.pos+8>this.len)throw Te(this,8);return new gu(en(this.buf,this.pos+=4),en(this.buf,this.pos+=4))}R.prototype.float=function(){if(this.pos+4>this.len)throw Te(this,4);var t=Ie.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};R.prototype.double=function(){if(this.pos+8>this.len)throw Te(this,4);var t=Ie.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};R.prototype.bytes=function(){var t=this.uint32(),r=this.pos,n=this.pos+t;if(n>this.len)throw Te(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};R.prototype.string=function(){var t=this.bytes();return xg.read(t,0,t.length)};R.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw Te(this,t);this.pos+=t}else do if(this.pos>=this.len)throw Te(this);while(this.buf[this.pos++]&128);return this};R.prototype.skipType=function(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};R._configure=function(e){Xo=e,R.create=wu(),Xo._configure();var t=Ie.Long?"toLong":"toNumber";Ie.merge(R.prototype,{int64:function(){return Ko.call(this)[t](!1)},uint64:function(){return Ko.call(this)[t](!0)},sint64:function(){return Ko.call(this).zzDecode()[t](!1)},fixed64:function(){return yu.call(this)[t](!0)},sfixed64:function(){return yu.call(this)[t](!1)}})}});var Tu=E((qx,Eu)=>{"use strict";Eu.exports=rt;var Su=Qo();(rt.prototype=Object.create(Su.prototype)).constructor=rt;var xu=We();function rt(e){Su.call(this,e)}rt._configure=function(){xu.Buffer&&(rt.prototype._slice=xu.Buffer.prototype.slice)};rt.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};rt._configure()});var Au=E((Hx,Pu)=>{"use strict";Pu.exports=ar;var Zo=We();(ar.prototype=Object.create(Zo.EventEmitter.prototype)).constructor=ar;function ar(e,t,r){if(typeof e!="function")throw TypeError("rpcImpl must be a function");Zo.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}ar.prototype.rpcCall=function e(t,r,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return Zo.asPromise(e,i,t,r,n,o);if(!i.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return i.rpcImpl(t,r[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,d){if(c)return i.emit("error",c,t),s(c);if(d===null){i.end(!0);return}if(!(d instanceof n))try{d=n[i.responseDelimited?"decodeDelimited":"decode"](d)}catch(p){return i.emit("error",p,t),s(p)}return i.emit("data",d,t),s(null,d)})}catch(a){i.emit("error",a,t),setTimeout(function(){s(a)},0);return}};ar.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Cu=E(vu=>{"use strict";var Sg=vu;Sg.Service=Au()});var Bu=E((Gx,ku)=>{"use strict";ku.exports={}});var _u=E(Uu=>{"use strict";var Z=Uu;Z.build="minimal";Z.Writer=Jo();Z.BufferWriter=hu();Z.Reader=Qo();Z.BufferReader=Tu();Z.util=We();Z.rpc=Cu();Z.roots=Bu();Z.configure=Iu;function Iu(){Z.util._configure(),Z.Writer._configure(Z.BufferWriter),Z.Reader._configure(Z.BufferReader)}Iu()});var Du=E((Jx,Nu)=>{"use strict";Nu.exports=_u()});var vf=E((P6,Af)=>{Af.exports=e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)return;yield n}}finally{t.releaseLock()}}();throw new Error("unknown stream")}});var yd=E(()=>{});var wd=E((Dv,gd)=>{"use strict";var Wg=Vr(),Jg=(e,t)=>({path:decodeURIComponent(new URL(e).pathname.split("/").pop()||""),content:Kg(e,t)});async function*Kg(e,t){yield*(await new Wg().get(e,t)).iterator()}gd.exports=Jg});var Zg={};j(Zg,{CID:()=>h,create:()=>Xg,globSource:()=>Qg,multiaddr:()=>I,urlSource:()=>xd.default});var Cd=e=>Promise.reject(new Error(`No base found for "${e}"`)),lr=class{constructor(t){this._basesByName={},this._basesByPrefix={},this._loadBase=t.loadBase||Cd;for(let r of t.bases)this.addBase(r)}addBase(t){if(this._basesByName[t.name]||this._basesByPrefix[t.prefix])throw new Error(`Codec already exists for codec "${t.name}"`);this._basesByName[t.name]=t,this._basesByPrefix[t.prefix]=t}removeBase(t){delete this._basesByName[t.name],delete this._basesByPrefix[t.prefix]}async getBase(t){if(this._basesByName[t])return this._basesByName[t];if(this._basesByPrefix[t])return this._basesByPrefix[t];let r=await this._loadBase(t);return this._basesByName[r.name]==null&&this._basesByPrefix[r.prefix]==null&&this.addBase(r),r}listBases(){return Object.values(this._basesByName)}};var kd=e=>Promise.reject(new Error(`No codec found for "${e}"`)),dr=class{constructor(t){this._codecsByName={},this._codecsByCode={},this._loadCodec=t.loadCodec||kd;for(let r of t.codecs)this.addCodec(r)}addCodec(t){if(this._codecsByName[t.name]||this._codecsByCode[t.code])throw new Error(`Resolver already exists for codec "${t.name}"`);this._codecsByName[t.name]=t,this._codecsByCode[t.code]=t}removeCodec(t){delete this._codecsByName[t.name],delete this._codecsByCode[t.code]}async getCodec(t){let r=typeof t=="string"?this._codecsByName:this._codecsByCode;if(r[t])return r[t];let n=await this._loadCodec(t);return r[t]==null&&this.addCodec(n),n}listCodecs(){return Object.values(this._codecsByName)}};var Bd=e=>Promise.reject(new Error(`No hasher found for "${e}"`)),pr=class{constructor(t){this._hashersByName={},this._hashersByCode={},this._loadHasher=t.loadHasher||Bd;for(let r of t.hashers)this.addHasher(r)}addHasher(t){if(this._hashersByName[t.name]||this._hashersByCode[t.code])throw new Error(`Resolver already exists for codec "${t.name}"`);this._hashersByName[t.name]=t,this._hashersByCode[t.code]=t}removeHasher(t){delete this._hashersByName[t.name],delete this._hashersByCode[t.code]}async getHasher(t){let r=typeof t=="string"?this._hashersByName:this._hashersByCode;if(r[t])return r[t];let n=await this._loadHasher(t);return r[t]==null&&this.addHasher(n),n}listHashers(){return Object.values(this._hashersByName)}};var In={};j(In,{code:()=>Pp,createLink:()=>Is,createNode:()=>Bs,decode:()=>vp,encode:()=>Ap,name:()=>Tp,prepare:()=>kn,validate:()=>Bn});var Id=fs,cs=128,Ud=127,_d=~Ud,Nd=Math.pow(2,31);function fs(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Nd;)t[r++]=e&255|cs,e/=128;for(;e&_d;)t[r++]=e&255|cs,e>>>=7;return t[r]=e|0,fs.bytes=r-n+1,t}var Dd=wn,Rd=128,us=127;function wn(e,n){var r=0,n=n||0,o=0,s=n,i,a=e.length;do{if(s>=a)throw wn.bytes=0,new RangeError("Could not decode varint");i=e[s++],r+=o<28?(i&us)<<o:(i&us)*Math.pow(2,o),o+=7}while(i>=Rd);return wn.bytes=s-n,r}var Od=Math.pow(2,7),Ld=Math.pow(2,14),Fd=Math.pow(2,21),$d=Math.pow(2,28),zd=Math.pow(2,35),jd=Math.pow(2,42),Md=Math.pow(2,49),qd=Math.pow(2,56),Hd=Math.pow(2,63),Vd=function(e){return e<Od?1:e<Ld?2:e<Fd?3:e<$d?4:e<zd?5:e<jd?6:e<Md?7:e<qd?8:e<Hd?9:10},Gd={encode:Id,decode:Dd,encodingLength:Vd},Wd=Gd,Nt=Wd;var Dt=(e,t=0)=>[Nt.decode(e,t),Nt.decode.bytes],ot=(e,t,r=0)=>(Nt.encode(e,t,r),t),st=e=>Nt.encodingLength(e);var sw=new Uint8Array(0);var ls=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},ge=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")};var ds=e=>new TextEncoder().encode(e),ps=e=>new TextDecoder().decode(e);var ze=(e,t)=>{let r=t.byteLength,n=st(e),o=n+st(r),s=new Uint8Array(o+r);return ot(e,s,0),ot(r,s,n),s.set(t,o),new it(e,r,t,s)},Ke=e=>{let t=ge(e),[r,n]=Dt(t),[o,s]=Dt(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new it(r,o,i,t)},ms=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&ls(e.bytes,r.bytes)}},it=class{constructor(t,r,n,o){this.code=t,this.size=r,this.digest=n,this.bytes=o}};var Tn={};j(Tn,{base58btc:()=>M,base58flickr:()=>Yd});function Jd(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var s=e.charAt(o),i=s.charCodeAt(0);if(r[i]!==255)throw new TypeError(s+" is ambiguous");r[i]=o}var a=e.length,c=e.charAt(0),d=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function y(P){if(P instanceof Uint8Array||(ArrayBuffer.isView(P)?P=new Uint8Array(P.buffer,P.byteOffset,P.byteLength):Array.isArray(P)&&(P=Uint8Array.from(P))),!(P instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(P.length===0)return"";for(var k=0,U=0,z=0,K=P.length;z!==K&&P[z]===0;)z++,k++;for(var ie=(K-z)*p+1>>>0,V=new Uint8Array(ie);z!==K;){for(var ye=P[z],ae=0,Y=ie-1;(ye!==0||ae<U)&&Y!==-1;Y--,ae++)ye+=256*V[Y]>>>0,V[Y]=ye%a>>>0,ye=ye/a>>>0;if(ye!==0)throw new Error("Non-zero carry");U=ae,z++}for(var ce=ie-U;ce!==ie&&V[ce]===0;)ce++;for(var nt=c.repeat(k);ce<ie;++ce)nt+=e.charAt(V[ce]);return nt}function x(P){if(typeof P!="string")throw new TypeError("Expected String");if(P.length===0)return new Uint8Array;var k=0;if(P[k]!==" "){for(var U=0,z=0;P[k]===c;)U++,k++;for(var K=(P.length-k)*d+1>>>0,ie=new Uint8Array(K);P[k];){var V=r[P.charCodeAt(k)];if(V===255)return;for(var ye=0,ae=K-1;(V!==0||ye<z)&&ae!==-1;ae--,ye++)V+=a*ie[ae]>>>0,ie[ae]=V%256>>>0,V=V/256>>>0;if(V!==0)throw new Error("Non-zero carry");z=ye,k++}if(P[k]!==" "){for(var Y=K-z;Y!==K&&ie[Y]===0;)Y++;for(var ce=new Uint8Array(U+(K-Y)),nt=U;Y!==K;)ce[nt++]=ie[Y++];return ce}}}function _(P){var k=x(P);if(k)return k;throw new Error(`Non-${t} character`)}return{encode:y,decodeUnsafe:x,decode:_}}var Kd=Jd,Xd=Kd,ys=Xd;var bn=class{constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},xn=class{constructor(t,r,n){if(this.name=t,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return gs(this,t)}},Sn=class{constructor(t){this.decoders=t}or(t){return gs(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},gs=(e,t)=>new Sn({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),En=class{constructor(t,r,n,o){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=o,this.encoder=new bn(t,r,n),this.decoder=new xn(t,r,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}},at=({name:e,prefix:t,encode:r,decode:n})=>new En(e,t,r,n),je=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:o}=ys(r,t);return at({prefix:e,name:t,encode:n,decode:s=>ge(o(s))})},Qd=(e,t,r,n)=>{let o={};for(let p=0;p<t.length;++p)o[t[p]]=p;let s=e.length;for(;e[s-1]==="=";)--s;let i=new Uint8Array(s*r/8|0),a=0,c=0,d=0;for(let p=0;p<s;++p){let y=o[e[p]];if(y===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|y,a+=r,a>=8&&(a-=8,i[d++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return i},Zd=(e,t,r)=>{let n=t[t.length-1]==="=",o=(1<<r)-1,s="",i=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],i+=8;i>r;)i-=r,s+=t[o&a>>i];if(i&&(s+=t[o&a<<r-i]),n)for(;s.length*r&7;)s+="=";return s},N=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>at({prefix:t,name:e,encode(o){return Zd(o,n,r)},decode(o){return Qd(o,n,r,e)}});var M=je({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Yd=je({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Pn={};j(Pn,{base32:()=>we,base32hex:()=>np,base32hexpad:()=>sp,base32hexpadupper:()=>ip,base32hexupper:()=>op,base32pad:()=>tp,base32padupper:()=>rp,base32