@libp2p/record 4.0.4-ff951f1a0 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/typedoc-urls.json +6 -0
- package/package.json +2 -2
- package/src/index.ts +2 -2
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PRecord = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PRecord=(()=>{var ot=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var l=(r,t)=>{for(var e in t)ot(r,e,{get:t[e],enumerable:!0})},ze=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Me(t))!Te.call(r,i)&&i!==e&&ot(r,i,{get:()=>t[i],enumerable:!(n=Re(t,i))||n.enumerable});return r};var ke=r=>ze(ot({},"__esModule",{value:!0}),r);var en={};l(en,{Libp2pRecord:()=>Xt});function st(r=0){return new Uint8Array(r)}function D(r=0){return new Uint8Array(r)}var Le=Math.pow(2,7),ve=Math.pow(2,14),Ve=Math.pow(2,21),qt=Math.pow(2,28),Jt=Math.pow(2,35),Ht=Math.pow(2,42),Wt=Math.pow(2,49),f=128,B=127;function P(r){if(r<Le)return 1;if(r<ve)return 2;if(r<Ve)return 3;if(r<qt)return 4;if(r<Jt)return 5;if(r<Ht)return 6;if(r<Wt)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Zt(r,t,e=0){switch(P(r)){case 8:t[e++]=r&255|f,r/=128;case 7:t[e++]=r&255|f,r/=128;case 6:t[e++]=r&255|f,r/=128;case 5:t[e++]=r&255|f,r/=128;case 4:t[e++]=r&255|f,r>>>=7;case 3:t[e++]=r&255|f,r>>>=7;case 2:t[e++]=r&255|f,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Qt(r,t){let e=r[t],n=0;if(n+=e&B,e<f||(e=r[t+1],n+=(e&B)<<7,e<f)||(e=r[t+2],n+=(e&B)<<14,e<f)||(e=r[t+3],n+=(e&B)<<21,e<f)||(e=r[t+4],n+=(e&B)*qt,e<f)||(e=r[t+5],n+=(e&B)*Jt,e<f)||(e=r[t+6],n+=(e&B)*Ht,e<f)||(e=r[t+7],n+=(e&B)*Wt,e<f))return n;throw new RangeError("Could not decode varint")}var ct=new Float32Array([-0]),R=new Uint8Array(ct.buffer);function jt(r,t,e){ct[0]=r,t[e]=R[0],t[e+1]=R[1],t[e+2]=R[2],t[e+3]=R[3]}function Kt(r,t){return R[0]=r[t],R[1]=r[t+1],R[2]=r[t+2],R[3]=r[t+3],ct[0]}var at=new Float64Array([-0]),u=new Uint8Array(at.buffer);function Yt(r,t,e){at[0]=r,t[e]=u[0],t[e+1]=u[1],t[e+2]=u[2],t[e+3]=u[3],t[e+4]=u[4],t[e+5]=u[5],t[e+6]=u[6],t[e+7]=u[7]}function te(r,t){return u[0]=r[t],u[1]=r[t+1],u[2]=r[t+2],u[3]=r[t+3],u[4]=r[t+4],u[5]=r[t+5],u[6]=r[t+6],u[7]=r[t+7],at[0]}var _e=BigInt(Number.MAX_SAFE_INTEGER),$e=BigInt(Number.MIN_SAFE_INTEGER),m=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return z;if(t<_e&&t>$e)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,i=t-(n<<32n);return e&&(n=~n|0n,i=~i|0n,++i>ee&&(i=0n,++n>ee&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return z;let e=t<0;e&&(t=-t);let n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):z}},z=new m(0,0);z.toBigInt=function(){return 0n};z.zzEncode=z.zzDecode=function(){return this};z.length=function(){return 1};var ee=4294967296n;function re(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function ne(r,t,e){if(e-t<1)return"";let i,o=[],s=0,c;for(;t<e;)c=r[t++],c<128?o[s++]=c:c>191&&c<224?o[s++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[s++]=55296+(c>>10),o[s++]=56320+(c&1023)):o[s++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ht(r,t,e){let n=e,i,o;for(let s=0;s<r.length;++s)i=r.charCodeAt(s),i<128?t[e++]=i:i<2048?(t[e++]=i>>6|192,t[e++]=i&63|128):(i&64512)===55296&&((o=r.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,t[e++]=i>>18|240,t[e++]=i>>12&63|128,t[e++]=i>>6&63|128,t[e++]=i&63|128):(t[e++]=i>>12|224,t[e++]=i>>6&63|128,t[e++]=i&63|128);return e-n}function y(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function et(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var dt=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;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,y(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw y(this,4);return et(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw y(this,4);return et(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw y(this,4);let t=Kt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw y(this,4);let t=te(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw y(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return ne(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw y(this,t);this.pos+=t}else do if(this.pos>=this.len)throw y(this);while(this.buf[this.pos++]&128);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new m(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw y(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw y(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw y(this,8);let t=et(this.buf,this.pos+=4),e=et(this.buf,this.pos+=4);return new m(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Qt(this.buf,this.pos);return this.pos+=P(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ut(r){return new dt(r instanceof Uint8Array?r:r.subarray())}function ft(r,t,e){let n=ut(r);return t.decode(n,void 0,e)}var gt={};l(gt,{base10:()=>Je});var mn=new Uint8Array(0);function oe(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function N(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function se(r){return new TextEncoder().encode(r)}function ce(r){return new TextDecoder().decode(r)}function Oe(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),s=o.charCodeAt(0);if(e[s]!==255)throw new TypeError(o+" is ambiguous");e[s]=i}var c=r.length,d=r.charAt(0),C=Math.log(c)/Math.log(256),x=Math.log(256)/Math.log(c);function v(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var p=0,T=0,w=0,E=a.length;w!==E&&a[w]===0;)w++,p++;for(var S=(E-w)*x+1>>>0,g=new Uint8Array(S);w!==E;){for(var A=a[w],U=0,b=S-1;(A!==0||U<T)&&b!==-1;b--,U++)A+=256*g[b]>>>0,g[b]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=U,w++}for(var F=S-T;F!==S&&g[F]===0;)F++;for(var tt=d.repeat(p);F<S;++F)tt+=r.charAt(g[F]);return tt}function Y(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var p=0;if(a[p]!==" "){for(var T=0,w=0;a[p]===d;)T++,p++;for(var E=(a.length-p)*C+1>>>0,S=new Uint8Array(E);a[p];){var g=e[a.charCodeAt(p)];if(g===255)return;for(var A=0,U=E-1;(g!==0||A<w)&&U!==-1;U--,A++)g+=c*S[U]>>>0,S[U]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");w=A,p++}if(a[p]!==" "){for(var b=E-w;b!==E&&S[b]===0;)b++;for(var F=new Uint8Array(T+(E-b)),tt=T;b!==E;)F[tt++]=S[b++];return F}}}function Be(a){var p=Y(a);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:v,decodeUnsafe:Y,decode:Be}}var Ge=Oe,Pe=Ge,he=Pe;var pt=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},lt=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let i=e.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,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 de(this,t)}},mt=class{decoders;constructor(t){this.decoders=t}or(t){return de(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function de(r,t){return new mt({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var xt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new pt(t,e,n),this.decoder=new lt(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function V({name:r,prefix:t,encode:e,decode:n}){return new xt(r,t,e,n)}function M({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=he(e,r);return V({prefix:t,name:r,encode:n,decode:o=>N(i(o))})}function Xe(r,t,e,n){let i={};for(let x=0;x<t.length;++x)i[t[x]]=x;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*e/8|0),c=0,d=0,C=0;for(let x=0;x<o;++x){let v=i[r[x]];if(v===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|v,c+=e,c>=8&&(c-=8,s[C++]=255&d>>c)}if(c>=e||255&d<<8-c)throw new SyntaxError("Unexpected end of data");return s}function qe(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,o="",s=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],s+=8;s>e;)s-=e,o+=t[i&c>>s];if(s!==0&&(o+=t[i&c<<e-s]),n)for(;o.length*e&7;)o+="=";return o}function h({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return V({prefix:t,name:r,encode(i){return qe(i,n,e)},decode(i){return Xe(i,n,e,r)}})}var Je=M({prefix:"9",name:"base10",alphabet:"0123456789"});var wt={};l(wt,{base16:()=>He,base16upper:()=>We});var He=h({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),We=h({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var bt={};l(bt,{base2:()=>Ze});var Ze=h({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var yt={};l(yt,{base256emoji:()=>tr});var ue=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Qe=ue.reduce((r,t,e)=>(r[e]=t,r),[]),je=ue.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Ke(r){return r.reduce((t,e)=>(t+=Qe[e],t),"")}function Ye(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let i=je[n];if(i==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var tr=V({prefix:"\u{1F680}",name:"base256emoji",encode:Ke,decode:Ye});var Et={};l(Et,{base32:()=>_,base32hex:()=>ir,base32hexpad:()=>sr,base32hexpadupper:()=>cr,base32hexupper:()=>or,base32pad:()=>rr,base32padupper:()=>nr,base32upper:()=>er,base32z:()=>ar});var _=h({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),er=h({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rr=h({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nr=h({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ir=h({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),or=h({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sr=h({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cr=h({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ar=h({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var St={};l(St,{base36:()=>X,base36upper:()=>hr});var X=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hr=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var At={};l(At,{base58btc:()=>I,base58flickr:()=>dr});var I=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dr=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var It={};l(It,{base64:()=>ur,base64pad:()=>fr,base64url:()=>pr,base64urlpad:()=>lr});var ur=h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fr=h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pr=h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),lr=h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ft={};l(Ft,{base8:()=>mr});var mr=h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Nt={};l(Nt,{identity:()=>xr});var xr=V({prefix:"\0",name:"identity",encode:r=>ce(r),decode:r=>se(r)});var Rn=new TextEncoder,Mn=new TextDecoder;var Ut={};l(Ut,{identity:()=>_r});var br=le,fe=128,yr=127,Er=~yr,Sr=Math.pow(2,31);function le(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Sr;)t[e++]=r&255|fe,r/=128;for(;r&Er;)t[e++]=r&255|fe,r>>>=7;return t[e]=r|0,le.bytes=e-n+1,t}var Ar=Ct,Ir=128,pe=127;function Ct(r,n){var e=0,n=n||0,i=0,o=n,s,c=r.length;do{if(o>=c)throw Ct.bytes=0,new RangeError("Could not decode varint");s=r[o++],e+=i<28?(s&pe)<<i:(s&pe)*Math.pow(2,i),i+=7}while(s>=Ir);return Ct.bytes=o-n,e}var Fr=Math.pow(2,7),Nr=Math.pow(2,14),Cr=Math.pow(2,21),Ur=Math.pow(2,28),Dr=Math.pow(2,35),Br=Math.pow(2,42),Rr=Math.pow(2,49),Mr=Math.pow(2,56),Tr=Math.pow(2,63),zr=function(r){return r<Fr?1:r<Nr?2:r<Cr?3:r<Ur?4:r<Dr?5:r<Br?6:r<Rr?7:r<Mr?8:r<Tr?9:10},kr={encode:br,decode:Ar,encodingLength:zr},Lr=kr,q=Lr;function J(r,t=0){return[q.decode(r,t),q.decode.bytes]}function $(r,t,e=0){return q.encode(r,t,e),t}function O(r){return q.encodingLength(r)}function k(r,t){let e=t.byteLength,n=O(r),i=n+O(e),o=new Uint8Array(i+e);return $(r,o,0),$(e,o,n),o.set(t,i),new G(r,e,t,o)}function me(r){let t=N(r),[e,n]=J(t),[i,o]=J(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new G(e,i,s,t)}function xe(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&oe(r.bytes,e.bytes)}}var G=class{code;size;digest;bytes;constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var ge=0,vr="identity",we=N;function Vr(r){return k(ge,we(r))}var _r={code:ge,name:vr,encode:we,digest:Vr};var Rt={};l(Rt,{sha256:()=>$r,sha512:()=>Or});function Bt({name:r,code:t,encode:e}){return new Dt(r,t,e)}var Dt=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?k(this.code,e):e.then(n=>k(this.code,n))}else throw Error("Unknown type, must be binary type")}};function ye(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var $r=Bt({name:"sha2-256",code:18,encode:ye("SHA-256")}),Or=Bt({name:"sha2-512",code:19,encode:ye("SHA-512")});function Ee(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Pr(e,Mt(r),t??I.encoder);default:return Xr(e,Mt(r),t??_.encoder)}}var Se=new WeakMap;function Mt(r){let t=Se.get(r);if(t==null){let e=new Map;return Se.set(r,e),e}return t}var nt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,i){this.code=e,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==W)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==qr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=k(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&xe(t.multihash,n.multihash)}toString(t){return Ee(this,t)}toJSON(){return{"/":Ee(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:o,bytes:s}=e;return new r(n,i,o,s??Ae(n,i,o.bytes))}else if(e[Jr]===!0){let{version:n,multihash:i,code:o}=e,s=me(i);return r.create(n,o,s)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==W)throw new Error(`Version 0 CID must use dag-pb (code: ${W}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let i=Ae(t,e,n.bytes);return new r(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,W,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,i=N(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=i.subarray(e.multihashSize-e.digestSize),s=new G(e.multihashCode,e.digestSize,o,i);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[v,Y]=J(t.subarray(e));return e+=Y,v},i=n(),o=W;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=e,c=n(),d=n(),C=e+d,x=C-s;return{version:i,codec:o,multihashCode:c,digestSize:d,multihashSize:x,size:C}}static parse(t,e){let[n,i]=Gr(t,e),o=r.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Mt(o).set(n,t),o}};function Gr(r,t){switch(r[0]){case"Q":{let e=t??I;return[I.prefix,e.decode(`${I.prefix}${r}`)]}case I.prefix:{let e=t??I;return[I.prefix,e.decode(r)]}case _.prefix:{let e=t??_;return[_.prefix,e.decode(r)]}case X.prefix:{let e=t??X;return[X.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Pr(r,t,e){let{prefix:n}=e;if(n!==I.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let o=e.encode(r).slice(1);return t.set(n,o),o}else return i}function Xr(r,t,e){let{prefix:n}=e,i=t.get(n);if(i==null){let o=e.encode(r);return t.set(n,o),o}else return i}var W=112,qr=18;function Ae(r,t,e){let n=O(r),i=n+O(t),o=new Uint8Array(i+e.byteLength);return $(r,o,0),$(t,o,n),o.set(e,i),o}var Jr=Symbol.for("@ipld/js-cid/CID");var Tt={...Nt,...bt,...Ft,...gt,...wt,...Et,...St,...At,...It,...yt},ti={...Rt,...Ut};function Fe(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Ie=Fe("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),zt=Fe("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=D(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Hr={utf8:Ie,"utf-8":Ie,hex:Tt.base16,latin1:zt,ascii:zt,binary:zt,...Tt},Ne=Hr;function Ce(r,t="utf8"){let e=Ne[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function kt(r){let t=r??8192,e=t>>>1,n,i=t;return function(s){if(s<1||s>e)return D(s);i+s>t&&(n=D(t),i=0);let c=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),c}}var L=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Lt(){}var Vt=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Wr=kt();function Zr(r){return globalThis.Buffer!=null?D(r):Wr(r)}var Q=class{len;head;tail;states;constructor(){this.len=0,this.head=new L(Lt,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new L(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new _t((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(it,10,m.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=m.fromBigInt(t);return this._push(it,e.length(),e)}uint64Number(t){return this._push(Zt,P(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=m.fromBigInt(t).zzEncode();return this._push(it,e.length(),e)}sint64Number(t){let e=m.fromNumber(t).zzEncode();return this._push(it,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(vt,1,t?1:0)}fixed32(t){return this._push(Z,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=m.fromBigInt(t);return this._push(Z,4,e.lo)._push(Z,4,e.hi)}fixed64Number(t){let e=m.fromNumber(t);return this._push(Z,4,e.lo)._push(Z,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(jt,4,t)}double(t){return this._push(Yt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(vt,1,0):this.uint32(e)._push(jr,e,t)}string(t){let e=re(t);return e!==0?this.uint32(e)._push(ht,e,t):this._push(vt,1,0)}fork(){return this.states=new Vt(this),this.head=this.tail=new L(Lt,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new L(Lt,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=Zr(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function vt(r,t,e){t[e]=r&255}function Qr(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var _t=class extends L{next;constructor(t,e){super(Qr,t,e),this.next=void 0}};function it(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Z(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function jr(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Q.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Kr,t,r),this},Q.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Yr,t,r),this});function Kr(r,t,e){t.set(r,e)}function Yr(r,t,e){r.length<40?ht(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Ce(r),e)}function $t(){return new Q}function Ot(r,t){let e=$t();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var j;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(j||(j={}));function Gt(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Pt(r,t){return Gt("message",j.LENGTH_DELIMITED,r,t)}var K;(function(r){let t;r.codec=()=>(t==null&&(t=Pt((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.key!=null&&e.key.byteLength>0&&(n.uint32(10),n.bytes(e.key)),e.value!=null&&e.value.byteLength>0&&(n.uint32(18),n.bytes(e.value)),e.timeReceived!=null&&e.timeReceived!==""&&(n.uint32(42),n.string(e.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(e,n,i={})=>{let o={key:st(0),value:st(0),timeReceived:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:{o.key=e.bytes();break}case 2:{o.value=e.bytes();break}case 5:{o.timeReceived=e.string();break}default:{e.skipType(c&7);break}}}return o})),t),r.encode=e=>Ot(e,r.codec()),r.decode=(e,n)=>ft(e,r.codec(),n)})(K||(K={}));function Ue(r){let t=r.getUTCFullYear(),e=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0"),i=String(r.getUTCHours()).padStart(2,"0"),o=String(r.getUTCMinutes()).padStart(2,"0"),s=String(r.getUTCSeconds()).padStart(2,"0"),c=r.getUTCMilliseconds(),d=String(c*1e3*1e3).padStart(9,"0");return`${t}-${e}-${n}T${i}:${o}:${s}.${d}Z`}function De(r){let t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),e=String(r).trim().match(t);if(e==null)throw new Error("Invalid format");let n=parseInt(e[1],10),i=parseInt(e[2],10)-1,o=parseInt(e[3],10),s=parseInt(e[4],10),c=parseInt(e[5],10),d=parseInt(e[6],10),C=parseInt(e[7].slice(0,-6),10);return new Date(Date.UTC(n,i,o,s,c,d,C))}var Xt=class r{key;value;timeReceived;constructor(t,e,n){if(!(t instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(e instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=t,this.value=e,this.timeReceived=n}serialize(){return K.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:Ue(this.timeReceived)}}static deserialize(t){let e=K.decode(t);return new r(e.key,e.value,new Date(e.timeReceived))}static fromDeserialized(t){let e=De(t.timeReceived);if(t.key==null)throw new Error("key missing from deserialized object");if(t.value==null)throw new Error("value missing from deserialized object");return new r(t.key,t.value,e)}};return ke(en);})();
|
|
2
|
+
"use strict";var Libp2PRecord=(()=>{var ot=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var Me=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var l=(r,t)=>{for(var e in t)ot(r,e,{get:t[e],enumerable:!0})},ze=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Me(t))!Te.call(r,i)&&i!==e&&ot(r,i,{get:()=>t[i],enumerable:!(n=Re(t,i))||n.enumerable});return r};var ke=r=>ze(ot({},"__esModule",{value:!0}),r);var en={};l(en,{Libp2pRecord:()=>Xt});function st(r=0){return new Uint8Array(r)}function D(r=0){return new Uint8Array(r)}var Le=Math.pow(2,7),ve=Math.pow(2,14),Ve=Math.pow(2,21),qt=Math.pow(2,28),Jt=Math.pow(2,35),Ht=Math.pow(2,42),Wt=Math.pow(2,49),f=128,B=127;function P(r){if(r<Le)return 1;if(r<ve)return 2;if(r<Ve)return 3;if(r<qt)return 4;if(r<Jt)return 5;if(r<Ht)return 6;if(r<Wt)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Zt(r,t,e=0){switch(P(r)){case 8:t[e++]=r&255|f,r/=128;case 7:t[e++]=r&255|f,r/=128;case 6:t[e++]=r&255|f,r/=128;case 5:t[e++]=r&255|f,r/=128;case 4:t[e++]=r&255|f,r>>>=7;case 3:t[e++]=r&255|f,r>>>=7;case 2:t[e++]=r&255|f,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Qt(r,t){let e=r[t],n=0;if(n+=e&B,e<f||(e=r[t+1],n+=(e&B)<<7,e<f)||(e=r[t+2],n+=(e&B)<<14,e<f)||(e=r[t+3],n+=(e&B)<<21,e<f)||(e=r[t+4],n+=(e&B)*qt,e<f)||(e=r[t+5],n+=(e&B)*Jt,e<f)||(e=r[t+6],n+=(e&B)*Ht,e<f)||(e=r[t+7],n+=(e&B)*Wt,e<f))return n;throw new RangeError("Could not decode varint")}var ct=new Float32Array([-0]),R=new Uint8Array(ct.buffer);function jt(r,t,e){ct[0]=r,t[e]=R[0],t[e+1]=R[1],t[e+2]=R[2],t[e+3]=R[3]}function Kt(r,t){return R[0]=r[t],R[1]=r[t+1],R[2]=r[t+2],R[3]=r[t+3],ct[0]}var at=new Float64Array([-0]),u=new Uint8Array(at.buffer);function Yt(r,t,e){at[0]=r,t[e]=u[0],t[e+1]=u[1],t[e+2]=u[2],t[e+3]=u[3],t[e+4]=u[4],t[e+5]=u[5],t[e+6]=u[6],t[e+7]=u[7]}function te(r,t){return u[0]=r[t],u[1]=r[t+1],u[2]=r[t+2],u[3]=r[t+3],u[4]=r[t+4],u[5]=r[t+5],u[6]=r[t+6],u[7]=r[t+7],at[0]}var _e=BigInt(Number.MAX_SAFE_INTEGER),$e=BigInt(Number.MIN_SAFE_INTEGER),m=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return z;if(t<_e&&t>$e)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,i=t-(n<<32n);return e&&(n=~n|0n,i=~i|0n,++i>ee&&(i=0n,++n>ee&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return z;let e=t<0;e&&(t=-t);let n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new r(n,i)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):z}},z=new m(0,0);z.toBigInt=function(){return 0n};z.zzEncode=z.zzDecode=function(){return this};z.length=function(){return 1};var ee=4294967296n;function re(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function ne(r,t,e){if(e-t<1)return"";let i,o=[],s=0,c;for(;t<e;)c=r[t++],c<128?o[s++]=c:c>191&&c<224?o[s++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,o[s++]=55296+(c>>10),o[s++]=56320+(c&1023)):o[s++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ht(r,t,e){let n=e,i,o;for(let s=0;s<r.length;++s)i=r.charCodeAt(s),i<128?t[e++]=i:i<2048?(t[e++]=i>>6|192,t[e++]=i&63|128):(i&64512)===55296&&((o=r.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,t[e++]=i>>18|240,t[e++]=i>>12&63|128,t[e++]=i>>6&63|128,t[e++]=i&63|128):(t[e++]=i>>12|224,t[e++]=i>>6&63|128,t[e++]=i&63|128);return e-n}function y(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function et(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var dt=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(t){this.buf=t,this.pos=0,this.len=t.length}uint32(){let t=4294967295;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,y(this,10);return t}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw y(this,4);return et(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw y(this,4);return et(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw y(this,4);let t=Kt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw y(this,4);let t=te(this.buf,this.pos);return this.pos+=8,t}bytes(){let t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw y(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return ne(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw y(this,t);this.pos+=t}else do if(this.pos>=this.len)throw y(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${t} at offset ${this.pos}`)}return this}readLongVarint(){let t=new m(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw y(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw y(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw y(this,8);let t=et(this.buf,this.pos+=4),e=et(this.buf,this.pos+=4);return new m(t,e)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let t=Qt(this.buf,this.pos);return this.pos+=P(t),t}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ut(r){return new dt(r instanceof Uint8Array?r:r.subarray())}function ft(r,t,e){let n=ut(r);return t.decode(n,void 0,e)}var gt={};l(gt,{base10:()=>Je});var mn=new Uint8Array(0);function oe(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function N(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function se(r){return new TextEncoder().encode(r)}function ce(r){return new TextDecoder().decode(r)}function Oe(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),s=o.charCodeAt(0);if(e[s]!==255)throw new TypeError(o+" is ambiguous");e[s]=i}var c=r.length,d=r.charAt(0),C=Math.log(c)/Math.log(256),x=Math.log(256)/Math.log(c);function v(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var p=0,T=0,w=0,E=a.length;w!==E&&a[w]===0;)w++,p++;for(var S=(E-w)*x+1>>>0,g=new Uint8Array(S);w!==E;){for(var A=a[w],U=0,b=S-1;(A!==0||U<T)&&b!==-1;b--,U++)A+=256*g[b]>>>0,g[b]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=U,w++}for(var F=S-T;F!==S&&g[F]===0;)F++;for(var tt=d.repeat(p);F<S;++F)tt+=r.charAt(g[F]);return tt}function Y(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;var p=0;if(a[p]!==" "){for(var T=0,w=0;a[p]===d;)T++,p++;for(var E=(a.length-p)*C+1>>>0,S=new Uint8Array(E);a[p];){var g=e[a.charCodeAt(p)];if(g===255)return;for(var A=0,U=E-1;(g!==0||A<w)&&U!==-1;U--,A++)g+=c*S[U]>>>0,S[U]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");w=A,p++}if(a[p]!==" "){for(var b=E-w;b!==E&&S[b]===0;)b++;for(var F=new Uint8Array(T+(E-b)),tt=T;b!==E;)F[tt++]=S[b++];return F}}}function Be(a){var p=Y(a);if(p)return p;throw new Error(`Non-${t} character`)}return{encode:v,decodeUnsafe:Y,decode:Be}}var Ge=Oe,Pe=Ge,he=Pe;var pt=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},lt=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let i=e.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,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 de(this,t)}},mt=class{decoders;constructor(t){this.decoders=t}or(t){return de(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function de(r,t){return new mt({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var xt=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,i){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=i,this.encoder=new pt(t,e,n),this.decoder=new lt(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function V({name:r,prefix:t,encode:e,decode:n}){return new xt(r,t,e,n)}function M({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=he(e,r);return V({prefix:t,name:r,encode:n,decode:o=>N(i(o))})}function Xe(r,t,e,n){let i={};for(let x=0;x<t.length;++x)i[t[x]]=x;let o=r.length;for(;r[o-1]==="=";)--o;let s=new Uint8Array(o*e/8|0),c=0,d=0,C=0;for(let x=0;x<o;++x){let v=i[r[x]];if(v===void 0)throw new SyntaxError(`Non-${n} character`);d=d<<e|v,c+=e,c>=8&&(c-=8,s[C++]=255&d>>c)}if(c>=e||(255&d<<8-c)!==0)throw new SyntaxError("Unexpected end of data");return s}function qe(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,o="",s=0,c=0;for(let d=0;d<r.length;++d)for(c=c<<8|r[d],s+=8;s>e;)s-=e,o+=t[i&c>>s];if(s!==0&&(o+=t[i&c<<e-s]),n)for(;(o.length*e&7)!==0;)o+="=";return o}function h({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return V({prefix:t,name:r,encode(i){return qe(i,n,e)},decode(i){return Xe(i,n,e,r)}})}var Je=M({prefix:"9",name:"base10",alphabet:"0123456789"});var wt={};l(wt,{base16:()=>He,base16upper:()=>We});var He=h({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),We=h({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var bt={};l(bt,{base2:()=>Ze});var Ze=h({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var yt={};l(yt,{base256emoji:()=>tr});var ue=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Qe=ue.reduce((r,t,e)=>(r[e]=t,r),[]),je=ue.reduce((r,t,e)=>{let n=t.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${t}`);return r[n]=e,r},[]);function Ke(r){return r.reduce((t,e)=>(t+=Qe[e],t),"")}function Ye(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let i=je[n];if(i==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var tr=V({prefix:"\u{1F680}",name:"base256emoji",encode:Ke,decode:Ye});var Et={};l(Et,{base32:()=>_,base32hex:()=>ir,base32hexpad:()=>sr,base32hexpadupper:()=>cr,base32hexupper:()=>or,base32pad:()=>rr,base32padupper:()=>nr,base32upper:()=>er,base32z:()=>ar});var _=h({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),er=h({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rr=h({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nr=h({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ir=h({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),or=h({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sr=h({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),cr=h({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ar=h({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var St={};l(St,{base36:()=>X,base36upper:()=>hr});var X=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),hr=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var At={};l(At,{base58btc:()=>I,base58flickr:()=>dr});var I=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dr=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var It={};l(It,{base64:()=>ur,base64pad:()=>fr,base64url:()=>pr,base64urlpad:()=>lr});var ur=h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),fr=h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pr=h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),lr=h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ft={};l(Ft,{base8:()=>mr});var mr=h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Nt={};l(Nt,{identity:()=>xr});var xr=V({prefix:"\0",name:"identity",encode:r=>ce(r),decode:r=>se(r)});var Rn=new TextEncoder,Mn=new TextDecoder;var Ut={};l(Ut,{identity:()=>_r});var br=le,fe=128,yr=127,Er=~yr,Sr=Math.pow(2,31);function le(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Sr;)t[e++]=r&255|fe,r/=128;for(;r&Er;)t[e++]=r&255|fe,r>>>=7;return t[e]=r|0,le.bytes=e-n+1,t}var Ar=Ct,Ir=128,pe=127;function Ct(r,n){var e=0,n=n||0,i=0,o=n,s,c=r.length;do{if(o>=c)throw Ct.bytes=0,new RangeError("Could not decode varint");s=r[o++],e+=i<28?(s&pe)<<i:(s&pe)*Math.pow(2,i),i+=7}while(s>=Ir);return Ct.bytes=o-n,e}var Fr=Math.pow(2,7),Nr=Math.pow(2,14),Cr=Math.pow(2,21),Ur=Math.pow(2,28),Dr=Math.pow(2,35),Br=Math.pow(2,42),Rr=Math.pow(2,49),Mr=Math.pow(2,56),Tr=Math.pow(2,63),zr=function(r){return r<Fr?1:r<Nr?2:r<Cr?3:r<Ur?4:r<Dr?5:r<Br?6:r<Rr?7:r<Mr?8:r<Tr?9:10},kr={encode:br,decode:Ar,encodingLength:zr},Lr=kr,q=Lr;function J(r,t=0){return[q.decode(r,t),q.decode.bytes]}function $(r,t,e=0){return q.encode(r,t,e),t}function O(r){return q.encodingLength(r)}function k(r,t){let e=t.byteLength,n=O(r),i=n+O(e),o=new Uint8Array(i+e);return $(r,o,0),$(e,o,n),o.set(t,i),new G(r,e,t,o)}function me(r){let t=N(r),[e,n]=J(t),[i,o]=J(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new G(e,i,s,t)}function xe(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&oe(r.bytes,e.bytes)}}var G=class{code;size;digest;bytes;constructor(t,e,n,i){this.code=t,this.size=e,this.digest=n,this.bytes=i}};var ge=0,vr="identity",we=N;function Vr(r){return k(ge,we(r))}var _r={code:ge,name:vr,encode:we,digest:Vr};var Rt={};l(Rt,{sha256:()=>$r,sha512:()=>Or});function Bt({name:r,code:t,encode:e}){return new Dt(r,t,e)}var Dt=class{name;code;encode;constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){let e=this.encode(t);return e instanceof Uint8Array?k(this.code,e):e.then(n=>k(this.code,n))}else throw Error("Unknown type, must be binary type")}};function ye(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var $r=Bt({name:"sha2-256",code:18,encode:ye("SHA-256")}),Or=Bt({name:"sha2-512",code:19,encode:ye("SHA-512")});function Ee(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Pr(e,Mt(r),t??I.encoder);default:return Xr(e,Mt(r),t??_.encoder)}}var Se=new WeakMap;function Mt(r){let t=Se.get(r);if(t==null){let e=new Map;return Se.set(r,e),e}return t}var nt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,i){this.code=e,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==W)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==qr)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=k(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&xe(t.multihash,n.multihash)}toString(t){return Ee(this,t)}toJSON(){return{"/":Ee(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:i,multihash:o,bytes:s}=e;return new r(n,i,o,s??Ae(n,i,o.bytes))}else if(e[Jr]===!0){let{version:n,multihash:i,code:o}=e,s=me(i);return r.create(n,o,s)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==W)throw new Error(`Version 0 CID must use dag-pb (code: ${W}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let i=Ae(t,e,n.bytes);return new r(t,e,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,W,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,i=N(t.subarray(n,n+e.multihashSize));if(i.byteLength!==e.multihashSize)throw new Error("Incorrect length");let o=i.subarray(e.multihashSize-e.digestSize),s=new G(e.multihashCode,e.digestSize,o,i);return[e.version===0?r.createV0(s):r.createV1(e.codec,s),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[v,Y]=J(t.subarray(e));return e+=Y,v},i=n(),o=W;if(i===18?(i=0,e=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=e,c=n(),d=n(),C=e+d,x=C-s;return{version:i,codec:o,multihashCode:c,digestSize:d,multihashSize:x,size:C}}static parse(t,e){let[n,i]=Gr(t,e),o=r.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Mt(o).set(n,t),o}};function Gr(r,t){switch(r[0]){case"Q":{let e=t??I;return[I.prefix,e.decode(`${I.prefix}${r}`)]}case I.prefix:{let e=t??I;return[I.prefix,e.decode(r)]}case _.prefix:{let e=t??_;return[_.prefix,e.decode(r)]}case X.prefix:{let e=t??X;return[X.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function Pr(r,t,e){let{prefix:n}=e;if(n!==I.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let i=t.get(n);if(i==null){let o=e.encode(r).slice(1);return t.set(n,o),o}else return i}function Xr(r,t,e){let{prefix:n}=e,i=t.get(n);if(i==null){let o=e.encode(r);return t.set(n,o),o}else return i}var W=112,qr=18;function Ae(r,t,e){let n=O(r),i=n+O(t),o=new Uint8Array(i+e.byteLength);return $(r,o,0),$(t,o,n),o.set(e,i),o}var Jr=Symbol.for("@ipld/js-cid/CID");var Tt={...Nt,...bt,...Ft,...gt,...wt,...Et,...St,...At,...It,...yt},ti={...Rt,...Ut};function Fe(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Ie=Fe("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),zt=Fe("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);let t=D(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Hr={utf8:Ie,"utf-8":Ie,hex:Tt.base16,latin1:zt,ascii:zt,binary:zt,...Tt},Ne=Hr;function Ce(r,t="utf8"){let e=Ne[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function kt(r){let t=r??8192,e=t>>>1,n,i=t;return function(s){if(s<1||s>e)return D(s);i+s>t&&(n=D(t),i=0);let c=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),c}}var L=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Lt(){}var Vt=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Wr=kt();function Zr(r){return globalThis.Buffer!=null?D(r):Wr(r)}var Q=class{len;head;tail;states;constructor(){this.len=0,this.head=new L(Lt,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new L(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new _t((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this}int32(t){return t<0?this._push(it,10,m.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=m.fromBigInt(t);return this._push(it,e.length(),e)}uint64Number(t){return this._push(Zt,P(t),t)}uint64String(t){return this.uint64(BigInt(t))}int64(t){return this.uint64(t)}int64Number(t){return this.uint64Number(t)}int64String(t){return this.uint64String(t)}sint64(t){let e=m.fromBigInt(t).zzEncode();return this._push(it,e.length(),e)}sint64Number(t){let e=m.fromNumber(t).zzEncode();return this._push(it,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(vt,1,t?1:0)}fixed32(t){return this._push(Z,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=m.fromBigInt(t);return this._push(Z,4,e.lo)._push(Z,4,e.hi)}fixed64Number(t){let e=m.fromNumber(t);return this._push(Z,4,e.lo)._push(Z,4,e.hi)}fixed64String(t){return this.fixed64(BigInt(t))}sfixed64(t){return this.fixed64(t)}sfixed64Number(t){return this.fixed64Number(t)}sfixed64String(t){return this.fixed64String(t)}float(t){return this._push(jt,4,t)}double(t){return this._push(Yt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(vt,1,0):this.uint32(e)._push(jr,e,t)}string(t){let e=re(t);return e!==0?this.uint32(e)._push(ht,e,t):this._push(vt,1,0)}fork(){return this.states=new Vt(this),this.head=this.tail=new L(Lt,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new L(Lt,0,0),this.len=0),this}ldelim(){let t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=t.next,this.tail=e,this.len+=n),this}finish(){let t=this.head.next,e=Zr(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function vt(r,t,e){t[e]=r&255}function Qr(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var _t=class extends L{next;constructor(t,e){super(Qr,t,e),this.next=void 0}};function it(r,t,e){for(;r.hi!==0;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}function Z(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function jr(r,t,e){t.set(r,e)}globalThis.Buffer!=null&&(Q.prototype.bytes=function(r){let t=r.length>>>0;return this.uint32(t),t>0&&this._push(Kr,t,r),this},Q.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(Yr,t,r),this});function Kr(r,t,e){t.set(r,e)}function Yr(r,t,e){r.length<40?ht(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Ce(r),e)}function $t(){return new Q}function Ot(r,t){let e=$t();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var j;(function(r){r[r.VARINT=0]="VARINT",r[r.BIT64=1]="BIT64",r[r.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",r[r.START_GROUP=3]="START_GROUP",r[r.END_GROUP=4]="END_GROUP",r[r.BIT32=5]="BIT32"})(j||(j={}));function Gt(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Pt(r,t){return Gt("message",j.LENGTH_DELIMITED,r,t)}var K;(function(r){let t;r.codec=()=>(t==null&&(t=Pt((e,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),e.key!=null&&e.key.byteLength>0&&(n.uint32(10),n.bytes(e.key)),e.value!=null&&e.value.byteLength>0&&(n.uint32(18),n.bytes(e.value)),e.timeReceived!=null&&e.timeReceived!==""&&(n.uint32(42),n.string(e.timeReceived)),i.lengthDelimited!==!1&&n.ldelim()},(e,n,i={})=>{let o={key:st(0),value:st(0),timeReceived:""},s=n==null?e.len:e.pos+n;for(;e.pos<s;){let c=e.uint32();switch(c>>>3){case 1:{o.key=e.bytes();break}case 2:{o.value=e.bytes();break}case 5:{o.timeReceived=e.string();break}default:{e.skipType(c&7);break}}}return o})),t),r.encode=e=>Ot(e,r.codec()),r.decode=(e,n)=>ft(e,r.codec(),n)})(K||(K={}));function Ue(r){let t=r.getUTCFullYear(),e=String(r.getUTCMonth()+1).padStart(2,"0"),n=String(r.getUTCDate()).padStart(2,"0"),i=String(r.getUTCHours()).padStart(2,"0"),o=String(r.getUTCMinutes()).padStart(2,"0"),s=String(r.getUTCSeconds()).padStart(2,"0"),c=r.getUTCMilliseconds(),d=String(c*1e3*1e3).padStart(9,"0");return`${t}-${e}-${n}T${i}:${o}:${s}.${d}Z`}function De(r){let t=new RegExp("(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d+)Z"),e=String(r).trim().match(t);if(e==null)throw new Error("Invalid format");let n=parseInt(e[1],10),i=parseInt(e[2],10)-1,o=parseInt(e[3],10),s=parseInt(e[4],10),c=parseInt(e[5],10),d=parseInt(e[6],10),C=parseInt(e[7].slice(0,-6),10);return new Date(Date.UTC(n,i,o,s,c,d,C))}var Xt=class r{key;value;timeReceived;constructor(t,e,n){if(!(t instanceof Uint8Array))throw new Error("key must be a Uint8Array");if(!(e instanceof Uint8Array))throw new Error("value must be a Uint8Array");this.key=t,this.value=e,this.timeReceived=n}serialize(){return K.encode(this.prepareSerialize())}prepareSerialize(){return{key:this.key,value:this.value,timeReceived:Ue(this.timeReceived)}}static deserialize(t){let e=K.decode(t);return new r(e.key,e.value,new Date(e.timeReceived))}static fromDeserialized(t){let e=De(t.timeReceived);if(t.key==null)throw new Error("key missing from deserialized object");if(t.value==null)throw new Error("value missing from deserialized object");return new r(t.key,t.value,e)}};return ke(en);})();
|
|
3
3
|
return Libp2PRecord}));
|
package/dist/src/index.js
CHANGED
|
@@ -66,14 +66,14 @@ export class Libp2pRecord {
|
|
|
66
66
|
* Create a record from the raw object returned from the protobuf library
|
|
67
67
|
*/
|
|
68
68
|
static fromDeserialized(obj) {
|
|
69
|
-
const
|
|
69
|
+
const receivedTime = utils.parseRFC3339(obj.timeReceived);
|
|
70
70
|
if (obj.key == null) {
|
|
71
71
|
throw new Error('key missing from deserialized object');
|
|
72
72
|
}
|
|
73
73
|
if (obj.value == null) {
|
|
74
74
|
throw new Error('value missing from deserialized object');
|
|
75
75
|
}
|
|
76
|
-
const rec = new Libp2pRecord(obj.key, obj.value,
|
|
76
|
+
const rec = new Libp2pRecord(obj.key, obj.value, receivedTime);
|
|
77
77
|
return rec;
|
|
78
78
|
}
|
|
79
79
|
}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAGnC,MAAM,OAAO,YAAY;IAChB,GAAG,CAAY;IACf,KAAK,CAAY;IACjB,YAAY,CAAM;IAEzB,YAAa,GAAe,EAAE,KAAiB,EAAE,YAAkB;QACjE,IAAI,CAAC,CAAC,GAAG,YAAY,UAAU,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAC/C,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,SAAS;QACP,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAC/C,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;SACjD,CAAA;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAE,GAAgC;QAClD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAE9B,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA;IACzE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAE,GAAW;QAClC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAGnC,MAAM,OAAO,YAAY;IAChB,GAAG,CAAY;IACf,KAAK,CAAY;IACjB,YAAY,CAAM;IAEzB,YAAa,GAAe,EAAE,KAAiB,EAAE,YAAkB;QACjE,IAAI,CAAC,CAAC,GAAG,YAAY,UAAU,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QAED,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAC/C,CAAC;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAED,SAAS;QACP,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAC/C,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC;SACjD,CAAA;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAE,GAAgC;QAClD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QAE9B,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA;IACzE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAE,GAAW;QAClC,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;QAEzD,IAAI,GAAG,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;QACzD,CAAC;QAED,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC3D,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,YAAY,CAC1B,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,YAAY,CACjC,CAAA;QAED,OAAO,GAAG,CAAA;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Record": "https://libp2p.github.io/js-libp2p/classes/_libp2p_kad_dht.Record.html",
|
|
3
|
+
".:Record": "https://libp2p.github.io/js-libp2p/classes/_libp2p_kad_dht.Record.html",
|
|
4
|
+
"Libp2pRecord": "https://libp2p.github.io/js-libp2p/classes/_libp2p_record.Libp2pRecord.html",
|
|
5
|
+
".:Libp2pRecord": "https://libp2p.github.io/js-libp2p/classes/_libp2p_record.Libp2pRecord.html"
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/record",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"description": "libp2p record implementation",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/record#readme",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@types/lodash.random": "^3.2.9",
|
|
66
66
|
"@types/lodash.range": "^3.2.9",
|
|
67
67
|
"@types/which": "^3.0.4",
|
|
68
|
-
"aegir": "^45.
|
|
68
|
+
"aegir": "^45.1.1",
|
|
69
69
|
"multiformats": "^13.3.1",
|
|
70
70
|
"protons": "^7.6.0"
|
|
71
71
|
},
|
package/src/index.ts
CHANGED
|
@@ -79,7 +79,7 @@ export class Libp2pRecord {
|
|
|
79
79
|
* Create a record from the raw object returned from the protobuf library
|
|
80
80
|
*/
|
|
81
81
|
static fromDeserialized (obj: Record): Libp2pRecord {
|
|
82
|
-
const
|
|
82
|
+
const receivedTime = utils.parseRFC3339(obj.timeReceived)
|
|
83
83
|
|
|
84
84
|
if (obj.key == null) {
|
|
85
85
|
throw new Error('key missing from deserialized object')
|
|
@@ -90,7 +90,7 @@ export class Libp2pRecord {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
const rec = new Libp2pRecord(
|
|
93
|
-
obj.key, obj.value,
|
|
93
|
+
obj.key, obj.value, receivedTime
|
|
94
94
|
)
|
|
95
95
|
|
|
96
96
|
return rec
|