-
Notifications
You must be signed in to change notification settings - Fork 19
/
browser.js
1 lines (1 loc) · 52.6 KB
/
browser.js
1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("ipfs-gateway-tools",[],t):"object"==typeof exports?exports["ipfs-gateway-tools"]=t():e["ipfs-gateway-tools"]=t()}(this,(function(){return(()=>{var e={820:e=>{"use strict";e.exports=function(e){if(e.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 s=0;s<e.length;s++){var r=e.charAt(s),i=r.charCodeAt(0);if(255!==t[i])throw new TypeError(r+" is ambiguous");t[i]=s}var o=e.length,a=e.charAt(0),c=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var n=0;if(" "!==e[n]){for(var s=0,r=0;e[n]===a;)s++,n++;for(var i=(e.length-n)*c+1>>>0,u=new Uint8Array(i);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var k=0,h=i-1;(0!==l||k<r)&&-1!==h;h--,k++)l+=o*u[h]>>>0,u[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");r=k,n++}if(" "!==e[n]){for(var d=i-r;d!==i&&0===u[d];)d++;for(var b=new Uint8Array(s+(i-d)),p=s;d!==i;)b[p++]=u[d++];return b}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,s=0,r=0,i=t.length;r!==i&&0===t[r];)r++,n++;for(var c=(i-r)*u+1>>>0,l=new Uint8Array(c);r!==i;){for(var k=t[r],h=0,d=c-1;(0!==k||h<s)&&-1!==d;d--,h++)k+=256*l[d]>>>0,l[d]=k%o>>>0,k=k/o>>>0;if(0!==k)throw new Error("Non-zero carry");s=h,r++}for(var b=c-s;b!==c&&0===l[b];)b++;for(var p=a.repeat(n);b<c;++b)p+=e.charAt(l[b]);return p},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+o+" character")}}}},303:(e,t,n)=>{"use strict";const s=n(370),r={checkCIDComponents:function(e){if(null==e)return"null values are not valid CIDs";if(0!==e.version&&1!==e.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof e.codec)return"codec must be string";if(0===e.version){if("dag-pb"!==e.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==e.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(e.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{s.validate(e.multihash)}catch(e){let t=e.message;return t||(t="Multihash validation failed"),t}}};e.exports=r},878:(e,t,n)=>{"use strict";const s=n(370),r=n(957),i=n(883),o=n(303),a=n(643),c=n(71),u=n(142),l=i.nameToCode,k=Object.keys(l).reduce(((e,t)=>(e[l[t]]=t,e)),{}),h=Symbol.for("@ipld/js-cid/CID");class d{constructor(e,t,n,o){if(this.version,this.codec,this.multihash,Object.defineProperty(this,h,{value:!0}),d.isCID(e)){const t=e;return this.version=t.version,this.codec=t.codec,this.multihash=t.multihash,void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof e){const t=r.isEncoded(e);if(t){const n=r.decode(e);this.version=parseInt(n[0].toString(),16),this.codec=i.getCodec(n.slice(1)),this.multihash=i.rmPrefix(n.slice(1)),this.multibaseName=t}else this.version=0,this.codec="dag-pb",this.multihash=s.fromB58String(e),this.multibaseName="base58btc";return d.validateCID(this),void Object.defineProperty(this,"string",{value:e})}if(e instanceof Uint8Array){const t=parseInt(e[0].toString(),16);if(1===t){const n=e;this.version=t,this.codec=i.getCodec(n.slice(1)),this.multihash=i.rmPrefix(n.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=e,this.multibaseName="base58btc";d.validateCID(this)}else this.version=e,"number"==typeof t&&(t=k[t]),this.codec=t,this.multihash=n,this.multibaseName=o||(0===e?"base58btc":"base32"),d.validateCID(this)}get bytes(){let e=this._bytes;if(!e){if(0===this.version)e=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const t=i.getCodeVarint(this.codec);e=a([[1],t,this.multihash],1+t.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:e})}return e}get prefix(){const e=i.getCodeVarint(this.codec),t=s.prefix(this.multihash);return a([[this.version],e,t],1+e.byteLength+t.byteLength)}get code(){return l[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:t}=s.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==t)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new d(0,this.codec,this.multihash)}toV1(){return new d(1,this.codec,this.multihash)}toBaseEncodedString(e=this.multibaseName){if(this.string&&0!==this.string.length&&e===this.multibaseName)return this.string;let t;if(0===this.version){if("base58btc"!==e)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");t=s.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");t=c(r.encode(e,this.bytes))}return e===this.multibaseName&&Object.defineProperty(this,"string",{value:t}),t}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(e){return this.toBaseEncodedString(e)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(e){return this.codec===e.codec&&this.version===e.version&&u(this.multihash,e.multihash)}static validateCID(e){const t=o.checkCIDComponents(e);if(t)throw new Error(t)}static isCID(e){return e instanceof d||Boolean(e&&e[h])}}d.codecs=l,e.exports=d},114:e=>{"use strict";function t(e,t){for(const n in t)Object.defineProperty(e,n,{value:t[n],enumerable:!0,configurable:!0});return e}e.exports=function(e,n,s){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");s||(s={}),"object"==typeof n&&(s=n,n=""),n&&(s.code=n);try{return t(e,s)}catch(n){s.message=e.message,s.stack=e.stack;const r=function(){};return r.prototype=Object.create(Object.getPrototypeOf(e)),t(new r,s)}}},3:(e,t,n)=>{"use strict";const s=n(875),r=e=>s({exact:!0}).test(e);r.v4=e=>s.v4({exact:!0}).test(e),r.v6=e=>s.v6({exact:!0}).test(e),r.version=e=>r(e)?r.v4(e)?4:6:void 0,e.exports=r},875:e=>{"use strict";const t="[a-fA-F\\d:]",n=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${t})|(?<=${t})(?=\\s|$))`:"",s="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",r="[a-fA-F\\d]{1,4}",i=`\n(?:\n(?:${r}:){7}(?:${r}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${r}:){6}(?:${s}|:${r}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${r}:){5}(?::${s}|(?::${r}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${r}:){4}(?:(?::${r}){0,1}:${s}|(?::${r}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${r}:){3}(?:(?::${r}){0,2}:${s}|(?::${r}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${r}:){2}(?:(?::${r}){0,3}:${s}|(?::${r}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${r}:){1}(?:(?::${r}){0,4}:${s}|(?::${r}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${r}){0,5}:${s}|(?::${r}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),o=new RegExp(`(?:^${s}$)|(?:^${i}$)`),a=new RegExp(`^${s}$`),c=new RegExp(`^${i}$`),u=e=>e&&e.exact?o:new RegExp(`(?:${n(e)}${s}${n(e)})|(?:${n(e)}${i}${n(e)})`,"g");u.v4=e=>e&&e.exact?a:new RegExp(`${n(e)}${s}${n(e)}`,"g"),u.v6=e=>e&&e.exact?c:new RegExp(`${n(e)}${i}${n(e)}`,"g"),e.exports=u},981:(e,t,n)=>{"use strict";const s=n(370),r=n(957),{Multiaddr:i}=n(584),o=n(175),a=n(878),{URL:c}=n(745),u=n(71),l=/^https?:\/\/[^/]+\/(ip[fn]s)\/([^/?#]+)/,k=/^\/(ip[fn]s)\/([^/?#]+)/,h=/^https?:\/\/([^/]+)\.(ip[fn]s)\.[^/?]+/,d=/^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$/;function b(e){try{return new a(e),!0}catch(e){return!1}}function p(e){if(!e)return!1;if(i.isMultiaddr(e))return!0;try{return new i(e),!0}catch(e){return!1}}function f(e,t,n=1,s=2){const r=w(e);if(!r)return!1;const i=r.match(t);if(!i)return!1;if("ipfs"!==i[n])return!1;let o=i[s];return o&&t===h&&(o=o.toLowerCase()),b(o)}function g(e,t,n=1,s=2){const r=w(e);if(!r)return!1;const i=r.match(t);if(!i)return!1;if("ipns"!==i[n])return!1;let o=i[s];if(o&&t===h){if(o=o.toLowerCase(),b(o))return!0;try{!o.includes(".")&&o.includes("-")&&(o=o.replace(/--/g,"@").replace(/-/g,".").replace(/@/g,"-"));const{hostname:e}=new c(`http://${o}`);return d.test(e)}catch(e){return!1}}return!0}function m(e){return"string"==typeof e}function w(e){return e instanceof Uint8Array?u(e,"base58btc"):!!m(e)&&e}const y=e=>f(e,h,2,1),v=e=>g(e,h,2,1),x=e=>y(e)||v(e),E=e=>f(e,l)||y(e),S=e=>g(e,l)||v(e),A=e=>E(e)||S(e)||x(e),C=e=>f(e,k)||g(e,k);e.exports={multihash:function(e){const t=w(e);try{return s.decode(r.decode("z"+t)),!0}catch(e){return!1}},multiaddr:p,peerMultiaddr:function(e){return p(e)&&o.P2P.matches(e)},cid:b,base32cid:e=>"base32"===function(e){try{return r.isEncoded(e)}catch(e){return!1}}(e)&&b(e),ipfsSubdomain:y,ipnsSubdomain:v,subdomain:x,subdomainGatewayPattern:h,ipfsUrl:E,ipnsUrl:S,url:A,pathGatewayPattern:l,ipfsPath:e=>f(e,k),ipnsPath:e=>g(e,k),path:C,pathPattern:k,urlOrPath:e=>A(e)||C(e),cidPath:e=>m(e)&&!b(e)&&f(`/ipfs/${e}`,k)}},745:(e,t,n)=>{"use strict";const{URLWithLegacySupport:s,format:r,URLSearchParams:i,defaultBase:o}=n(49),a=n(939);e.exports={URL:s,URLSearchParams:i,format:r,relative:a,defaultBase:o}},939:(e,t,n)=>{"use strict";const{URLWithLegacySupport:s,format:r}=n(49);e.exports=(e,t={},n={},i)=>{let o,a=t.protocol?t.protocol.replace(":",""):"http";a=(n[a]||i||a)+":";try{o=new s(e)}catch(e){o={}}const c=Object.assign({},t,{protocol:a||o.protocol,host:t.host||o.host});return new s(e,r(c)).toString()}},49:e=>{"use strict";const t="undefined"!=typeof navigator&&"ReactNative"===navigator.product,n=self.URL,s=t?"http://localhost":self.location.protocol+"//"+self.location.host;e.exports={URLWithLegacySupport:class{constructor(e="",t=s){this.super=new n(e,t),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(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return n.createObjectURL(e)}static revokeObjectURL(e){n.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:s,format:function(e){if("string"==typeof e)return new n(e).toString();if(!(e instanceof n)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",n=e.auth?e.auth+"@":"",s=e.port?":"+e.port:"",r=e.protocol?e.protocol+"//":"",i=e.host||"",o=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"";return`${r}${t||n}${i||o+s}${e.path||u+a}${c}`}}}},175:(e,t,n)=>{"use strict";const{Multiaddr:s}=n(584),r=j("dns4"),i=j("dns6"),o=j("dnsaddr"),a=$(j("dns"),o,r,i),c=$(j("ip4"),j("ip6")),u=$(T(c,j("tcp")),T(a,j("tcp"))),l=T(c,j("udp")),k=T(l,j("utp")),h=T(l,j("quic")),d=$(T(u,j("ws")),T(a,j("ws"))),b=$(T(u,j("wss")),T(a,j("wss"))),p=$(T(u,j("http")),T(c,j("http")),T(a,j("http"))),f=$(T(u,j("https")),T(c,j("https")),T(a,j("https"))),g=$(T(d,j("p2p-webrtc-star"),j("p2p")),T(b,j("p2p-webrtc-star"),j("p2p")),T(d,j("p2p-webrtc-star")),T(b,j("p2p-webrtc-star"))),m=$(T(d,j("p2p-websocket-star"),j("p2p")),T(b,j("p2p-websocket-star"),j("p2p")),T(d,j("p2p-websocket-star")),T(b,j("p2p-websocket-star"))),w=$(T(p,j("p2p-webrtc-direct"),j("p2p")),T(f,j("p2p-webrtc-direct"),j("p2p")),T(p,j("p2p-webrtc-direct")),T(f,j("p2p-webrtc-direct"))),y=$(d,b,p,f,g,w,u,k,h,a),v=$(T(y,j("p2p-stardust"),j("p2p")),T(y,j("p2p-stardust"))),x=$(T(y,j("p2p")),g,w,j("p2p")),E=$(T(x,j("p2p-circuit"),x),T(x,j("p2p-circuit")),T(j("p2p-circuit"),x),T(y,j("p2p-circuit")),T(j("p2p-circuit"),y),j("p2p-circuit")),S=()=>$(T(E,S),E),A=S(),C=$(T(A,x,A),T(x,A),T(A,x),A,x);function U(e){return function(t){if(!s.isMultiaddr(t))try{t=new s(t)}catch(e){return!1}const n=e(t.protoNames());return null!==n&&(!0===n||!1===n?n:0===n.length)}}function T(...e){function t(t){if(t.length<e.length)return null;let n=t;return e.some((e=>(n="function"==typeof e?e().partialMatch(t):e.partialMatch(t),Array.isArray(n)&&(t=n),null===n))),n}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:U(t),partialMatch:t}}function $(...e){function t(t){let n=null;return e.some((e=>{const s="function"==typeof e?e().partialMatch(t):e.partialMatch(t);return!!s&&(n=s,!0)})),n}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:U(t),partialMatch:t}}function j(e){const t=e;return{toString:function(){return t},matches:function(e){if("string"==typeof e)try{e=new s(e)}catch(e){return!1}const n=e.protoNames();return 1===n.length&&n[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}e.exports={DNS:a,DNS4:r,DNS6:i,DNSADDR:o,IP:c,TCP:u,UDP:l,QUIC:h,UTP:k,HTTP:p,HTTPS:f,WebSockets:d,WebSocketsSecure:b,WebSocketStar:m,WebRTCStar:g,WebRTCDirect:w,Reliable:y,Stardust:v,Circuit:A,P2P:C,IPFS:C}},602:e=>{e.exports=function e(t,n){var s,r=0,i=0,o=n=n||0,a=t.length;do{if(o>=a||i>49)throw e.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(127&s)<<i:(127&s)*Math.pow(2,i),i+=7}while(s>=128);return e.bytes=o-n,r}},137:e=>{e.exports=function e(n,s,r){if(Number.MAX_SAFE_INTEGER&&n>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");s=s||[];for(var i=r=r||0;n>=t;)s[r++]=255&n|128,n/=128;for(;-128&n;)s[r++]=255&n|128,n>>>=7;return s[r]=0|n,e.bytes=r-i+1,s};var t=Math.pow(2,31)},328:(e,t,n)=>{e.exports={encode:n(137),decode:n(602),encodingLength:n(766)}},766:e=>{var t=Math.pow(2,7),n=Math.pow(2,14),s=Math.pow(2,21),r=Math.pow(2,28),i=Math.pow(2,35),o=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<n?2:e<s?3:e<r?4:e<i?5:e<o?6:e<a?7:e<c?8:e<u?9:10}},190:(e,t,n)=>{"use strict";const s=n(918),r=n(768),i=n(328),o=n(643),a=n(71);function c(e){const t=[],n=e.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let s=0;s<n.length;s++){const i=n[s],o=r(i);if(0!==o.size){if(s++,s>=n.length)throw w("invalid address: "+e);if(o.path){t.push([i,m(n.slice(s).join("/"))]);break}t.push([i,n[s]])}else t.push([i])}return t}function u(e){const t=[];return e.map((e=>{const n=y(e);return t.push(n.name),e.length>1&&t.push(e[1]),null})),m(t.join("/"))}function l(e){return e.map((e=>{Array.isArray(e)||(e=[e]);const t=y(e);return e.length>1?[t.code,s.toBytes(t.code,e[1])]:[t.code]}))}function k(e){return e.map((e=>{const t=y(e);return e[1]?[t.code,s.toString(t.code,e[1])]:[t.code]}))}function h(e){return f(o(e.map((e=>{const t=y(e);let n=Uint8Array.from(i.encode(t.code));return e.length>1&&(n=o([n,e[1]])),n}))))}function d(e,t){return e.size>0?e.size/8:0===e.size?0:i.decode(t)+i.decode.bytes}function b(e){const t=[];let n=0;for(;n<e.length;){const s=i.decode(e,n),o=i.decode.bytes,c=d(r(s),e.slice(n+o));if(0===c){t.push([s]),n+=o;continue}const u=e.slice(n+o,n+o+c);if(n+=c+o,n>e.length)throw w("Invalid address Uint8Array: "+a(e,"base16"));t.push([s,u])}return t}function p(e){return h(l(c(e=m(e))))}function f(e){const t=g(e);if(t)throw t;return Uint8Array.from(e)}function g(e){try{b(e)}catch(e){return e}}function m(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function w(e){return new Error("Error parsing address: "+e)}function y(e){return r(e[0])}e.exports={stringToStringTuples:c,stringTuplesToString:u,tuplesToStringTuples:k,stringTuplesToTuples:l,bytesToTuples:b,tuplesToBytes:h,bytesToString:function(e){return u(k(b(e)))},stringToBytes:p,fromString:function(e){return p(e)},fromBytes:f,validateBytes:g,isValidBytes:function(e){return void 0===g(e)},cleanPath:m,ParseError:w,protoFromTuple:y,sizeForAddr:d}},918:(e,t,n)=>{"use strict";const s=n(692),r=n(768),i=n(878),o=n(957),a=n(328),c=n(71),u=n(962),l=n(643);function k(e,t){return t instanceof Uint8Array?k.toString(e,t):k.toBytes(e,t)}function h(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function d(e){return new DataView(e.buffer).getUint16(0)}e.exports=k,k.toString=function(e,t){switch(r(e).code){case 4:case 41:return function(e){const t=s.toString(e);if(!t||!s.isIP(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return d(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=a.decode(e);if((e=e.slice(a.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return c(e)}(t);case 421:return function(e){const t=a.decode(e),n=e.slice(a.decode.bytes);if(n.length!==t)throw new Error("inconsistent lengths");return c(n,"base58btc")}(t);case 444:case 445:return function(e){const t=e.slice(0,e.length-2),n=e.slice(e.length-2);return c(t,"base32")+":"+d(n)}(t);default:return c(t,"base16")}},k.toBytes=function(e,t){switch(r(e).code){case 4:case 41:return function(e){if(!s.isIP(e))throw new Error("invalid ip address");return s.toBytes(e)}(t);case 6:case 273:case 33:case 132:return h(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=u(e),n=Uint8Array.from(a.encode(t.length));return l([n,t],n.length+t.length)}(t);case 421:return function(e){const t=new i(e).multihash,n=Uint8Array.from(a.encode(t.length));return l([n,t],n.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(16!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion address.");const n=o.decode("b"+t[0]),s=parseInt(t[1],10);if(s<1||s>65536)throw new Error("Port number is not in range(1, 65536)");const r=h(s);return l([n,r],n.length+r.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(56!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion3 address.");const n=o.decode("b"+t[0]),s=parseInt(t[1],10);if(s<1||s>65536)throw new Error("Port number is not in range(1, 65536)");const r=h(s);return l([n,r],n.length+r.length)}(t);default:return u(t,"base16")}}},584:(e,t,n)=>{"use strict";const s=n(190),r=n(768),i=n(328),o=n(878),a=n(114),c=Symbol.for("nodejs.util.inspect.custom"),u=n(71),l=n(142),k=new Map,h=Symbol.for("@multiformats/js-multiaddr/multiaddr");class d{constructor(e){if(null==e&&(e=""),Object.defineProperty(this,h,{value:!0}),e instanceof Uint8Array)this.bytes=s.fromBytes(e);else if("string"==typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=s.fromString(e)}else{if(!d.isMultiaddr(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=s.fromBytes(e.bytes)}}toString(){return s.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?4:6,e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e}protos(){return this.protoCodes().map((e=>Object.assign({},r(e))))}protoCodes(){const e=[],t=this.bytes;let n=0;for(;n<t.length;){const o=i.decode(t,n),a=i.decode.bytes,c=r(o);n+=s.sizeForAddr(c,t.slice(n+a))+a,e.push(o)}return e}protoNames(){return this.protos().map((e=>e.name))}tuples(){return s.bytesToTuples(this.bytes)}stringTuples(){const e=s.bytesToTuples(this.bytes);return s.tuplesToStringTuples(e)}encapsulate(e){return e=new d(e),new d(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),n=this.toString(),s=n.lastIndexOf(t);if(s<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new d(n.slice(0,s))}decapsulateCode(e){const t=this.tuples();for(let n=t.length-1;n>=0;n--)if(t[n][0]===e)return new d(s.tuplesToBytes(t.slice(0,n)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===r.names.ipfs.code)).pop();return e&&e[1]?u(new o(e[1]).multihash,"base58btc"):null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!!r(e[0]).path))[0][1],e||(e=null)}catch(t){e=null}return e}equals(e){return l(this.bytes,e.bytes)}async resolve(){const e=this.protos().find((e=>e.resolvable));if(!e)return[this];const t=k.get(e.name);if(!t)throw a(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await t(this)).map((e=>new d(e)))}nodeAddress(){const e=this.protoCodes(),t=this.protoNames(),n=this.toString().split("/").slice(1);if(n.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==n[2]&&"udp"!==n[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:n[1],port:parseInt(n[3])}}isThinWaistAddress(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&273!==t[1].code)}static fromNodeAddress(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");let n;switch(e.family){case 4:n="ip4";break;case 6:n="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new d("/"+[n,e.address,t,e.port].join("/"))}static isName(e){return!!d.isMultiaddr(e)&&e.protos().some((e=>e.resolvable))}static isMultiaddr(e){return e instanceof d||Boolean(e&&e[h])}[c](){return"<Multiaddr "+u(this.bytes,"base16")+" - "+s.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+u(this.bytes,"base16")+" - "+s.bytesToString(this.bytes)+">"}}d.protocols=r,d.resolvers=k,e.exports={Multiaddr:d,multiaddr:function(e){return new d(e)},protocols:r,resolvers:k}},692:(e,t,n)=>{"use strict";const s=n(3),r=n(71),i=s,o=s.v4,a=s.v6,c=function(e,t,n){let s;if(n=~~n,o(e))s=t||new Uint8Array(n+4),e.split(/\./g).map((function(e){s[n++]=255&parseInt(e,10)}));else if(a(e)){const a=e.split(":",8);let u;for(u=0;u<a.length;u++){var i;o(a[u])&&(i=c(a[u]),a[u]=r(i.slice(0,2),"base16")),i&&++u<8&&a.splice(u,0,r(i.slice(2,4),"base16"))}if(""===a[0])for(;a.length<8;)a.unshift("0");else if(""===a[a.length-1])for(;a.length<8;)a.push("0");else if(a.length<8){for(u=0;u<a.length&&""!==a[u];u++);const e=[u,"1"];for(u=9-a.length;u>0;u--)e.push("0");a.splice.apply(a,e)}for(s=t||new Uint8Array(n+16),u=0;u<a.length;u++){const e=parseInt(a[u],16);s[n++]=e>>8&255,s[n++]=255&e}}if(!s)throw Error("Invalid ip address: "+e);return s};e.exports={isIP:i,isV4:o,isV6:a,toBytes:c,toString:function(e,t,n){t=~~t,n=n||e.length-t;const s=[];let r;const i=new DataView(e.buffer);if(4===n){for(let r=0;r<n;r++)s.push(e[t+r]);r=s.join(".")}else if(16===n){for(let e=0;e<n;e+=2)s.push(i.getUint16(t+e).toString(16));r=s.join(":"),r=r.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),r=r.replace(/:{3,4}/,"::")}return r}}},768:e=>{"use strict";function t(e){if("number"==typeof e){if(t.codes[e])return t.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e){if(t.names[e])return t.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const n=-1;function s(e,t,n,s,r){return{code:e,size:t,name:n,resolvable:Boolean(s),path:Boolean(r)}}t.lengthPrefixedVarSize=n,t.V=n,t.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,n,"ip6zone"],[53,n,"dns","resolvable"],[54,n,"dns4","resolvable"],[55,n,"dns6","resolvable"],[56,n,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,n,"unix",!1,"path"],[421,n,"ipfs"],[421,n,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,n,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,n,"memory"]],t.names={},t.codes={},t.table.map((e=>{const n=s.apply(null,e);return t.codes[n.code]=n,t.names[n.name]=n,null})),t.object=s,e.exports=t},556:(e,t,n)=>{"use strict";const{encodeText:s}=n(413);e.exports=class{constructor(e,t,n,r){this.name=e,this.code=t,this.codeBuf=s(this.code),this.alphabet=r,this.codec=n(r)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},77:(e,t,n)=>{"use strict";const s=n(820),r=n(556),{rfc4648:i}=n(727),{decodeText:o,encodeText:a}=n(413),c=[["identity","\0",()=>({encode:o,decode:a}),""],["base2","0",i(1),"01"],["base8","7",i(3),"01234567"],["base10","9",s,"0123456789"],["base16","f",i(4),"0123456789abcdef"],["base16upper","F",i(4),"0123456789ABCDEF"],["base32hex","v",i(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",i(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",i(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",i(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",i(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",s,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",s,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",s,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",s,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce(((e,t)=>(e[t[0]]=new r(t[0],t[1],t[2],t[3]),e)),{}),l=c.reduce(((e,t)=>(e[t[1]]=u[t[0]],e)),{});e.exports={names:u,codes:l}},957:(e,t,n)=>{"use strict";const s=n(77),{encodeText:r,decodeText:i,concat:o}=n(413);function a(e){if(Object.prototype.hasOwnProperty.call(s.names,e))return s.names[e];if(Object.prototype.hasOwnProperty.call(s.codes,e))return s.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:n,codeBuf:s}=a(e);return function(e,t){a(e).decode(i(t))}(n,t),o([s,t],s.length+t.length)}).encode=function(e,t){const n=a(e),s=r(n.encode(t));return o([n.codeBuf,s],n.codeBuf.length+s.length)},t.decode=function(e){e instanceof Uint8Array&&(e=i(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=i(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(e){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=i(e)),a(e[0])};const c=Object.freeze(s.names),u=Object.freeze(s.codes);t.names=c,t.codes=u},727:e=>{"use strict";e.exports={rfc4648:e=>t=>({encode:n=>((e,t,n)=>{const s="="===t[t.length-1],r=(1<<n)-1;let i="",o=0,a=0;for(let s=0;s<e.length;++s)for(a=a<<8|e[s],o+=8;o>n;)o-=n,i+=t[r&a>>o];if(o&&(i+=t[r&a<<n-o]),s)for(;i.length*n&7;)i+="=";return i})(n,t,e),decode:n=>((e,t,n)=>{const s={};for(let e=0;e<t.length;++e)s[t[e]]=e;let r=e.length;for(;"="===e[r-1];)--r;const i=new Uint8Array(r*n/8|0);let o=0,a=0,c=0;for(let t=0;t<r;++t){const r=s[e[t]];if(void 0===r)throw new SyntaxError("Invalid character "+e[t]);a=a<<n|r,o+=n,o>=8&&(o-=8,i[c++]=255&a>>o)}if(o>=n||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return i})(n,t,e)})}},413:e=>{"use strict";const t=new TextDecoder,n=new TextEncoder;e.exports={decodeText:e=>t.decode(e),encodeText:e=>n.encode(e),concat:function(e,t){const n=new Uint8Array(t);let s=0;for(const t of e)n.set(t,s),s+=t.length;return n}}},636:e=>{"use strict";const t=Object.freeze({identity:0,cidv1:1,cidv2:2,cidv3:3,ip4:4,tcp:6,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,dccp:33,"murmur3-128":34,"murmur3-32":35,ip6:41,ip6zone:42,path:47,multicodec:48,multihash:49,multiaddr:50,multibase:51,dns:53,dns4:54,dns6:55,dnsaddr:56,protobuf:80,cbor:81,raw:85,"dbl-sha2-256":86,rlp:96,bencode:99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:132,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,docid:206,"stellar-block":208,"stellar-tx":209,md4:212,md5:213,bmt:214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:230,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"bls12_381-g1g2-pub":238,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:301,utp:302,unix:400,thread:406,p2p:421,ipfs:421,https:443,onion:444,onion3:445,garlic64:446,garlic32:447,tls:448,quic:460,ws:477,wss:478,"p2p-websocket-star":479,http:480,json:512,messagepack:513,"libp2p-peer-record":769,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"p256-pub":4608,"p384-pub":4609,"p521-pub":4610,"ed448-pub":4611,"x448-pub":4612,"ed25519-priv":4864,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332,"skynet-ns":11639056});e.exports={baseTable:t}},883:(e,t,n)=>{"use strict";const s=n(676),r=n(643),i=n(945),{nameToVarint:o,constantToCode:a,nameToCode:c,codeToName:u}=n(843);function l(e){const t=s.decode(e),n=u[t];if(void 0===n)throw new Error(`Code "${t}" not found`);return n}function k(e){return u[e]}function h(e){const t=c[e];if(void 0===t)throw new Error(`Codec "${e}" not found`);return t}function d(e){return s.decode(e)}function b(e){const t=o[e];if(void 0===t)throw new Error(`Codec "${e}" not found`);return t}function p(e){return i.varintEncode(e)}e.exports={addPrefix:function(e,t){let n;if(e instanceof Uint8Array)n=i.varintUint8ArrayEncode(e);else{if(!o[e])throw new Error("multicodec not recognized");n=o[e]}return r([n,t],n.length+t.length)},rmPrefix:function(e){return s.decode(e),e.slice(s.decode.bytes)},getNameFromData:l,getNameFromCode:k,getCodeFromName:h,getCodeFromData:d,getVarintFromName:b,getVarintFromCode:p,getCodec:function(e){return l(e)},getName:function(e){return k(e)},getNumber:function(e){return h(e)},getCode:function(e){return d(e)},getCodeVarint:function(e){return b(e)},getVarint:function(e){return Array.from(p(e))},...a,nameToVarint:o,nameToCode:c,codeToName:u}},843:(e,t,n)=>{"use strict";const{baseTable:s}=n(636),r=n(945).varintEncode,i={},o={},a={};for(const e in s){const t=e,n=s[t];i[t]=r(n),o[t.toUpperCase().replace(/-/g,"_")]=n,a[n]||(a[n]=t)}Object.freeze(i),Object.freeze(o),Object.freeze(a);const c=Object.freeze(s);e.exports={nameToVarint:i,constantToCode:o,nameToCode:c,codeToName:a}},945:(e,t,n)=>{"use strict";const s=n(676),r=n(71),i=n(962);function o(e){return parseInt(r(e,"base16"),16)}e.exports={numberToUint8Array:function(e){let t=e.toString(16);return t.length%2==1&&(t="0"+t),i(t,"base16")},uint8ArrayToNumber:o,varintUint8ArrayEncode:function(e){return Uint8Array.from(s.encode(o(e)))},varintEncode:function(e){return Uint8Array.from(s.encode(e))}}},291:e=>{"use strict";const t=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:t}},370:(e,t,n)=>{"use strict";const s=n(957),r=n(676),{names:i}=n(291),o=n(71),a=n(962),c=n(643),u={};for(const e in i){const t=e;u[i[t]]=t}function l(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const t=r.decode(e);if(!d(t))throw new Error(`multihash unknown function code: 0x${t.toString(16)}`);e=e.slice(r.decode.bytes);const n=r.decode(e);if(n<0)throw new Error(`multihash invalid length: ${n}`);if((e=e.slice(r.decode.bytes)).length!==n)throw new Error(`multihash length inconsistent: 0x${o(e,"base16")}`);return{code:t,name:u[t],length:n,digest:e}}function k(e){let t=e;if("string"==typeof e){if(void 0===i[e])throw new Error(`Unrecognized hash function named: ${e}`);t=i[e]}if("number"!=typeof t)throw new Error(`Hash function code should be a number. Got: ${t}`);if(void 0===u[t]&&!h(t))throw new Error(`Unrecognized function code: ${t}`);return t}function h(e){return e>0&&e<16}function d(e){return!!h(e)||!!u[e]}function b(e){l(e)}Object.freeze(u),e.exports={names:i,codes:u,toHexString:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(e,"base16")},fromHexString:function(e){return a(e,"base16")},toB58String:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(s.encode("base58btc",e)).slice(1)},fromB58String:function(e){const t=e instanceof Uint8Array?o(e):e;return s.decode("z"+t)},decode:l,encode:function(e,t,n){if(!e||void 0===t)throw new Error("multihash encode requires at least two args: digest, code");const s=k(t);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==n&&(n=e.length),n&&e.length!==n)throw new Error("digest length should be equal to specified length.");const i=r.encode(s),o=r.encode(n);return c([i,o,e],i.length+o.length+e.length)},coerceCode:k,isAppCode:h,validate:b,prefix:function(e){return b(e),e.subarray(0,2)},isValidCode:d}},643:e=>{"use strict";e.exports=function(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const n=new Uint8Array(t);let s=0;for(const t of e)n.set(t,s),s+=t.length;return n}},142:e=>{"use strict";e.exports=function(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}},962:(e,t,n)=>{"use strict";const{encoding:s}=n(957),r=new TextEncoder;e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?r.encode(e):"ascii"===t?function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(e):s(t).decode(e)}},71:(e,t,n)=>{"use strict";const{encoding:s}=n(957),r=new TextDecoder("utf8");e.exports=function(e,t="utf8"){return"utf8"===t||"utf-8"===t?r.decode(e):"ascii"===t?function(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}(e):s(t).encode(e)}},988:e=>{e.exports=function e(t,n){var s,r=0,i=0,o=n=n||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(127&s)<<i:(127&s)*Math.pow(2,i),i+=7}while(s>=128);return e.bytes=o-n,r}},312:e=>{e.exports=function e(n,s,r){s=s||[];for(var i=r=r||0;n>=t;)s[r++]=255&n|128,n/=128;for(;-128&n;)s[r++]=255&n|128,n>>>=7;return s[r]=0|n,e.bytes=r-i+1,s};var t=Math.pow(2,31)},676:(e,t,n)=>{e.exports={encode:n(312),decode:n(988),encodingLength:n(82)}},82:e=>{var t=Math.pow(2,7),n=Math.pow(2,14),s=Math.pow(2,21),r=Math.pow(2,28),i=Math.pow(2,35),o=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<n?2:e<s?3:e<r?4:e<i?5:e<o?6:e<a?7:e<c?8:e<u?9:10}}},t={};function n(s){var r=t[s];if(void 0!==r)return r.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var s={};return(()=>{"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(s,{default:()=>i});var r=n(981);const i=function n(){var s=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t(this,"containsCID",(function(t){if("string"!=typeof t)throw new Error("url is not string");var n,s=function(t,n){var s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!s){if(Array.isArray(t)||(s=function(t,n){if(t){if("string"==typeof t)return e(t,n);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){s&&(t=s);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,c=!1;return{s:function(){s=s.call(t)},n:function(){var e=s.next();return a=e.done,e},e:function(e){c=!0,o=e},f:function(){try{a||null==s.return||s.return()}finally{if(c)throw o}}}}(t.split("/"));try{for(s.s();!(n=s.n()).done;){var i=n.value;if(r.cid(i))return{containsCid:!0,cid:i};var o=i.split(".")[0];if(r.cid(o))return{containsCid:!0,cid:o}}}catch(e){s.e(e)}finally{s.f()}return{containsCid:!1,cid:null}})),t(this,"convertToDesiredGateway",(function(e,t){var n=s.containsCID(e);if(!0!==n.containsCid)throw new Error("url does not contain CID");if(r.cid(n.cid))return"".concat(t,"/ipfs/").concat(n.cid);var i=e.split(n.cid);if(e.includes("ipfs://".concat(n.cid)))return"".concat(t,"/ipfs/").concat(n.cid).concat(i[1]);if(e.includes("/ipfs/".concat(n.cid)))return"".concat(t,"/ipfs/").concat(n.cid).concat(i[1]);if(e.includes("/ipns/".concat(n.cid)))return"".concat(t,"/ipns/").concat(n.cid).concat(i[1]);throw new Error("unsupported URL pattern, please submit a github issue with the URL utilized")}))}})(),s.default})()}));