protons-runtime
Advanced tools
| import type { Codec } from './codec.ts'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| export declare function streamMessage<T>(buf: Uint8Array | Uint8ArrayList, codec: Pick<Codec<T>, 'stream'>, opts?: any): Generator<any>; | ||
| //# sourceMappingURL=stream.d.ts.map |
| {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,wBAAkB,aAAa,CAAE,CAAC,EAAG,GAAG,EAAE,UAAU,GAAG,cAAc,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAIlI"} |
| import { createReader } from "./utils/reader.js"; | ||
| export function* streamMessage(buf, codec, opts) { | ||
| const reader = createReader(buf); | ||
| yield* codec.stream(reader, undefined, opts); | ||
| } | ||
| //# sourceMappingURL=stream.js.map |
| {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIhD,MAAM,SAAU,CAAC,CAAC,aAAa,CAAM,GAAgC,EAAE,KAA+B,EAAE,IAAU;IAChH,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAA;IAEhC,KAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;AAC/C,CAAC"} |
| import { createReader } from './utils/reader.ts' | ||
| import type { Codec } from './codec.ts' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| export function * streamMessage <T> (buf: Uint8Array | Uint8ArrayList, codec: Pick<Codec<T>, 'stream'>, opts?: any): Generator<any> { | ||
| const reader = createReader(buf) | ||
| yield * codec.stream(reader, undefined, opts) | ||
| } |
| (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ProtonsRuntime = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
| "use strict";var ProtonsRuntime=(()=>{var ct=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var ze=Object.prototype.hasOwnProperty;var p=(r,t)=>{for(var e in t)ct(r,e,{get:t[e],enumerable:!0})},Te=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Re(t))!ze.call(r,i)&&i!==e&&ct(r,i,{get:()=>t[i],enumerable:!(n=Le(t,i))||n.enumerable});return r};var Ve=r=>Te(ct({},"__esModule",{value:!0}),r);var rn={};p(rn,{CodeError:()=>Ot,MaxLengthError:()=>$t,MaxSizeError:()=>vt,NoMessagesFoundError:()=>Pt,ParseError:()=>Gt,decodeMessage:()=>ie,encodeMessage:()=>Ce,enumeration:()=>Ue,message:()=>De,reader:()=>tt,writer:()=>it});function C(r=0){return new Uint8Array(r)}var ke=Math.pow(2,7),_e=Math.pow(2,14),Oe=Math.pow(2,21),jt=Math.pow(2,28),Xt=Math.pow(2,35),qt=Math.pow(2,42),Jt=Math.pow(2,49),u=128,U=127;function P(r){if(r<ke)return 1;if(r<_e)return 2;if(r<Oe)return 3;if(r<jt)return 4;if(r<Xt)return 5;if(r<qt)return 6;if(r<Jt)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Wt(r,t,e=0){switch(P(r)){case 8:t[e++]=r&255|u,r/=128;case 7:t[e++]=r&255|u,r/=128;case 6:t[e++]=r&255|u,r/=128;case 5:t[e++]=r&255|u,r/=128;case 4:t[e++]=r&255|u,r>>>=7;case 3:t[e++]=r&255|u,r>>>=7;case 2:t[e++]=r&255|u,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Ht(r,t){let e=r[t],n=0;if(n+=e&U,e<u||(e=r[t+1],n+=(e&U)<<7,e<u)||(e=r[t+2],n+=(e&U)<<14,e<u)||(e=r[t+3],n+=(e&U)<<21,e<u)||(e=r[t+4],n+=(e&U)*jt,e<u)||(e=r[t+5],n+=(e&U)*Xt,e<u)||(e=r[t+6],n+=(e&U)*qt,e<u)||(e=r[t+7],n+=(e&U)*Jt,e<u))return n;throw new RangeError("Could not decode varint")}var ht=new Float32Array([-0]),D=new Uint8Array(ht.buffer);function Qt(r,t,e){ht[0]=r,t[e]=D[0],t[e+1]=D[1],t[e+2]=D[2],t[e+3]=D[3]}function Kt(r,t){return D[0]=r[t],D[1]=r[t+1],D[2]=r[t+2],D[3]=r[t+3],ht[0]}var at=new Float64Array([-0]),d=new Uint8Array(at.buffer);function Zt(r,t,e){at[0]=r,t[e]=d[0],t[e+1]=d[1],t[e+2]=d[2],t[e+3]=d[3],t[e+4]=d[4],t[e+5]=d[5],t[e+6]=d[6],t[e+7]=d[7]}function Yt(r,t){return d[0]=r[t],d[1]=r[t+1],d[2]=r[t+2],d[3]=r[t+3],d[4]=r[t+4],d[5]=r[t+5],d[6]=r[t+6],d[7]=r[t+7],at[0]}var $e=BigInt(Number.MAX_SAFE_INTEGER),ve=BigInt(Number.MIN_SAFE_INTEGER),l=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 R;if(t<$e&&t>ve)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>te&&(i=0n,++n>te&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return R;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):R}},R=new l(0,0);R.toBigInt=function(){return 0n};R.zzEncode=R.zzDecode=function(){return this};R.length=function(){return 1};var te=4294967296n;function ee(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 re(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 dt(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 b(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Y(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var ut=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,b(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 b(this,4);return Y(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw b(this,4);return Y(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw b(this,4);let t=Kt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw b(this,4);let t=Yt(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 b(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return re(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw b(this,t);this.pos+=t}else do if(this.pos>=this.len)throw b(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 l(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 b(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 b(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 b(this,8);let t=Y(this.buf,this.pos+=4),e=Y(this.buf,this.pos+=4);return new l(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=Ht(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 tt(r){return new ut(r instanceof Uint8Array?r:r.subarray())}function ie(r,t,e){let n=tt(r);return t.decode(n,void 0,e)}var xt={};p(xt,{base10:()=>We});var xn=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 Ge(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,x=r.charAt(0),F=Math.log(c)/Math.log(256),V=Math.log(256)/Math.log(c);function st(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var f=0,L=0,g=0,y=h.length;g!==y&&h[g]===0;)g++,f++;for(var E=(y-g)*V+1>>>0,m=new Uint8Array(E);g!==y;){for(var A=h[g],B=0,w=E-1;(A!==0||B<L)&&w!==-1;w--,B++)A+=256*m[w]>>>0,m[w]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");L=B,g++}for(var I=E-L;I!==E&&m[I]===0;)I++;for(var Z=x.repeat(f);I<E;++I)Z+=r.charAt(m[I]);return Z}function K(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var f=0;if(h[f]!==" "){for(var L=0,g=0;h[f]===x;)L++,f++;for(var y=(h.length-f)*F+1>>>0,E=new Uint8Array(y);h[f];){var m=e[h.charCodeAt(f)];if(m===255)return;for(var A=0,B=y-1;(m!==0||A<g)&&B!==-1;B--,A++)m+=c*E[B]>>>0,E[B]=m%256>>>0,m=m/256>>>0;if(m!==0)throw new Error("Non-zero carry");g=A,f++}if(h[f]!==" "){for(var w=y-g;w!==y&&E[w]===0;)w++;for(var I=new Uint8Array(L+(y-w)),Z=L;w!==y;)I[Z++]=E[w++];return I}}}function Me(h){var f=K(h);if(f)return f;throw new Error(`Non-${t} character`)}return{encode:st,decodeUnsafe:K,decode:Me}}var Pe=Ge,je=Pe,ae=je;var ft=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")}},pt=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)}},lt=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 lt({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var mt=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 ft(t,e,n),this.decoder=new pt(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function k({name:r,prefix:t,encode:e,decode:n}){return new mt(r,t,e,n)}function M({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=ae(e,r);return k({prefix:t,name:r,encode:n,decode:o=>N(i(o))})}function Xe(r,t,e,n){let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*e/8|0),s=0,c=0,x=0;for(let F=0;F<i;++F){let V=t[r[F]];if(V===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|V,s+=e,s>=8&&(s-=8,o[x++]=255&c>>s)}if(s>=e||(255&c<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function qe(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,o="",s=0,c=0;for(let x=0;x<r.length;++x)for(c=c<<8|r[x],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 Je(r){let t={};for(let e=0;e<r.length;++e)t[r[e]]=e;return t}function a({name:r,prefix:t,bitsPerChar:e,alphabet:n}){let i=Je(n);return k({prefix:t,name:r,encode(o){return qe(o,n,e)},decode(o){return Xe(o,i,e,r)}})}var We=M({prefix:"9",name:"base10",alphabet:"0123456789"});var gt={};p(gt,{base16:()=>He,base16upper:()=>Qe});var He=a({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Qe=a({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var wt={};p(wt,{base2:()=>Ke});var Ke=a({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bt={};p(bt,{base256emoji:()=>rr});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}"),Ze=ue.reduce((r,t,e)=>(r[e]=t,r),[]),Ye=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 tr(r){return r.reduce((t,e)=>(t+=Ze[e],t),"")}function er(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let i=Ye[n];if(i==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var rr=k({prefix:"\u{1F680}",name:"base256emoji",encode:tr,decode:er});var yt={};p(yt,{base32:()=>_,base32hex:()=>sr,base32hexpad:()=>hr,base32hexpadupper:()=>ar,base32hexupper:()=>cr,base32pad:()=>ir,base32padupper:()=>or,base32upper:()=>nr,base32z:()=>dr});var _=a({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),nr=a({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ir=a({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),or=a({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),sr=a({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cr=a({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hr=a({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ar=a({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dr=a({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Et={};p(Et,{base36:()=>j,base36upper:()=>ur});var j=M({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ur=M({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var At={};p(At,{base58btc:()=>S,base58flickr:()=>fr});var S=M({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fr=M({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var St={};p(St,{base64:()=>pr,base64pad:()=>lr,base64url:()=>mr,base64urlpad:()=>xr});var pr=a({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),lr=a({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),mr=a({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),xr=a({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var It={};p(It,{base8:()=>gr});var gr=a({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Nt={};p(Nt,{identity:()=>wr});var wr=k({prefix:"\0",name:"identity",encode:r=>ce(r),decode:r=>se(r)});var Ln=new TextEncoder,Rn=new TextDecoder;var Bt={};p(Bt,{identity:()=>vr});var Er=le,fe=128,Ar=127,Sr=~Ar,Ir=Math.pow(2,31);function le(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Ir;)t[e++]=r&255|fe,r/=128;for(;r&Sr;)t[e++]=r&255|fe,r>>>=7;return t[e]=r|0,le.bytes=e-n+1,t}var Nr=Ft,Fr=128,pe=127;function Ft(r,n){var e=0,n=n||0,i=0,o=n,s,c=r.length;do{if(o>=c)throw Ft.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>=Fr);return Ft.bytes=o-n,e}var Br=Math.pow(2,7),Cr=Math.pow(2,14),Ur=Math.pow(2,21),Dr=Math.pow(2,28),Mr=Math.pow(2,35),Lr=Math.pow(2,42),Rr=Math.pow(2,49),zr=Math.pow(2,56),Tr=Math.pow(2,63),Vr=function(r){return r<Br?1:r<Cr?2:r<Ur?3:r<Dr?4:r<Mr?5:r<Lr?6:r<Rr?7:r<zr?8:r<Tr?9:10},kr={encode:Er,decode:Nr,encodingLength:Vr},_r=kr,X=_r;function q(r,t=0){return[X.decode(r,t),X.decode.bytes]}function O(r,t,e=0){return X.encode(r,t,e),t}function $(r){return X.encodingLength(r)}function z(r,t){let e=t.byteLength,n=$(r),i=n+$(e),o=new Uint8Array(i+e);return O(r,o,0),O(e,o,n),o.set(t,i),new v(r,e,t,o)}function me(r){let t=N(r),[e,n]=q(t),[i,o]=q(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new v(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 v=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,Or="identity",we=N;function $r(r){return z(ge,we(r))}var vr={code:ge,name:Or,encode:we,digest:$r};var Dt={};p(Dt,{sha256:()=>Gr,sha512:()=>Pr});function Ut({name:r,code:t,encode:e}){return new Ct(r,t,e)}var Ct=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?z(this.code,e):e.then(n=>z(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 Gr=Ut({name:"sha2-256",code:18,encode:ye("SHA-256")}),Pr=Ut({name:"sha2-512",code:19,encode:ye("SHA-512")});function Ee(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Xr(e,Mt(r),t??S.encoder);default:return qr(e,Mt(r),t??_.encoder)}}var Ae=new WeakMap;function Mt(r){let t=Ae.get(r);if(t==null){let e=new Map;return Ae.set(r,e),e}return t}var rt=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!==Jr)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=z(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??Se(n,i,o.bytes))}else if(e[Wr]===!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=Se(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 v(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[st,K]=q(t.subarray(e));return e+=K,st},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(),x=n(),F=e+x,V=F-s;return{version:i,codec:o,multihashCode:c,digestSize:x,multihashSize:V,size:F}}static parse(t,e){let[n,i]=jr(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 jr(r,t){switch(r[0]){case"Q":{let e=t??S;return[S.prefix,e.decode(`${S.prefix}${r}`)]}case S.prefix:{let e=t??S;return[S.prefix,e.decode(r)]}case _.prefix:{let e=t??_;return[_.prefix,e.decode(r)]}case j.prefix:{let e=t??j;return[j.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 Xr(r,t,e){let{prefix:n}=e;if(n!==S.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 qr(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,Jr=18;function Se(r,t,e){let n=$(r),i=n+$(t),o=new Uint8Array(i+e.byteLength);return O(r,o,0),O(t,o,n),o.set(e,i),o}var Wr=Symbol.for("@ipld/js-cid/CID");var Lt={...Nt,...wt,...It,...xt,...gt,...yt,...Et,...At,...St,...bt},ei={...Dt,...Bt};function Ne(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Ie=Ne("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Rt=Ne("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=C(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Hr={utf8:Ie,"utf-8":Ie,hex:Lt.base16,latin1:Rt,ascii:Rt,binary:Rt,...Lt},Fe=Hr;function Be(r,t="utf8"){let e=Fe[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function zt(r){let t=r??8192,e=t>>>1,n,i=t;return function(s){if(s<1||s>e)return C(s);i+s>t&&(n=C(t),i=0);let c=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),c}}var T=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Tt(){}var kt=class{head;tail;len;next;constructor(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}},Qr=zt();function Kr(r){return globalThis.Buffer!=null?C(r):Qr(r)}var Q=class{len;head;tail;states;constructor(){this.len=0,this.head=new T(Tt,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new T(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(nt,10,l.fromNumber(t)):this.uint32(t)}sint32(t){return this.uint32((t<<1^t>>31)>>>0)}uint64(t){let e=l.fromBigInt(t);return this._push(nt,e.length(),e)}uint64Number(t){return this._push(Wt,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=l.fromBigInt(t).zzEncode();return this._push(nt,e.length(),e)}sint64Number(t){let e=l.fromNumber(t).zzEncode();return this._push(nt,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(H,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=l.fromBigInt(t);return this._push(H,4,e.lo)._push(H,4,e.hi)}fixed64Number(t){let e=l.fromNumber(t);return this._push(H,4,e.lo)._push(H,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(Qt,4,t)}double(t){return this._push(Zt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(Vt,1,0):this.uint32(e)._push(Yr,e,t)}string(t){let e=ee(t);return e!==0?this.uint32(e)._push(dt,e,t):this._push(Vt,1,0)}fork(){return this.states=new kt(this),this.head=this.tail=new T(Tt,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 T(Tt,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=Kr(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 Zr(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var _t=class extends T{next;constructor(t,e){super(Zr,t,e),this.next=void 0}};function nt(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 H(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 Yr(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(tn,t,r),this},Q.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(en,t,r),this});function tn(r,t,e){t.set(r,e)}function en(r,t,e){r.length<40?dt(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Be(r),e)}function it(){return new Q}function Ce(r,t){let e=it();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}var G;(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"})(G||(G={}));function ot(r,t,e,n){return{name:r,type:t,encode:e,decode:n}}function Ue(r){function t(i){if(r[i.toString()]==null)throw new Error("Invalid enum value");return r[i]}let e=function(o,s){let c=t(o);s.int32(c)},n=function(o){let s=o.int32();return t(s)};return ot("enum",G.VARINT,e,n)}function De(r,t){return ot("message",G.LENGTH_DELIMITED,r,t)}var Ot=class extends Error{code;constructor(t,e){super(t),this.code=e}},$t=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"},vt=class extends Error{code="ERR_MAX_SIZE";name="MaxSizeError"},Gt=class extends Error{code="ERR_PARSE_ERROR";name="ParseError"},Pt=class extends Error{code="ERR_NO_MESSAGES_FOUND";name="NoMessagesFoundError"};return Ve(rn);})(); | ||
| "use strict";var ProtonsRuntime=(()=>{var ct=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var _e=Object.prototype.hasOwnProperty;var l=(r,t)=>{for(var e in t)ct(r,e,{get:t[e],enumerable:!0})},Ve=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Re(t))!_e.call(r,i)&&i!==e&&ct(r,i,{get:()=>t[i],enumerable:!(n=ze(t,i))||n.enumerable});return r};var Oe=r=>Ve(ct({},"__esModule",{value:!0}),r);var sn={};l(sn,{CodeError:()=>kt,MaxLengthError:()=>Pt,MaxSizeError:()=>$t,NoMessagesFoundError:()=>Gt,ParseError:()=>vt,decodeMessage:()=>ie,encodeMessage:()=>Be,enumeration:()=>Ue,message:()=>Me,reader:()=>_,streamMessage:()=>Le,writer:()=>nt});function F(r=0){return new Uint8Array(r)}var ke=Math.pow(2,7),Pe=Math.pow(2,14),$e=Math.pow(2,21),qt=Math.pow(2,28),jt=Math.pow(2,35),Xt=Math.pow(2,42),Jt=Math.pow(2,49),u=128,B=127;function G(r){if(r<ke)return 1;if(r<Pe)return 2;if(r<$e)return 3;if(r<qt)return 4;if(r<jt)return 5;if(r<Xt)return 6;if(r<Jt)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Wt(r,t,e=0){switch(G(r)){case 8:t[e++]=r&255|u,r/=128;case 7:t[e++]=r&255|u,r/=128;case 6:t[e++]=r&255|u,r/=128;case 5:t[e++]=r&255|u,r/=128;case 4:t[e++]=r&255|u,r>>>=7;case 3:t[e++]=r&255|u,r>>>=7;case 2:t[e++]=r&255|u,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function Ht(r,t){let e=r[t],n=0;if(n+=e&B,e<u||(e=r[t+1],n+=(e&B)<<7,e<u)||(e=r[t+2],n+=(e&B)<<14,e<u)||(e=r[t+3],n+=(e&B)<<21,e<u)||(e=r[t+4],n+=(e&B)*qt,e<u)||(e=r[t+5],n+=(e&B)*jt,e<u)||(e=r[t+6],n+=(e&B)*Xt,e<u)||(e=r[t+7],n+=(e&B)*Jt,e<u))return n;throw new RangeError("Could not decode varint")}var ht=new Float32Array([-0]),L=new Uint8Array(ht.buffer);function Qt(r,t,e){ht[0]=r,t[e]=L[0],t[e+1]=L[1],t[e+2]=L[2],t[e+3]=L[3]}function Kt(r,t){return L[0]=r[t],L[1]=r[t+1],L[2]=r[t+2],L[3]=r[t+3],ht[0]}var at=new Float64Array([-0]),d=new Uint8Array(at.buffer);function Yt(r,t,e){at[0]=r,t[e]=d[0],t[e+1]=d[1],t[e+2]=d[2],t[e+3]=d[3],t[e+4]=d[4],t[e+5]=d[5],t[e+6]=d[6],t[e+7]=d[7]}function Zt(r,t){return d[0]=r[t],d[1]=r[t+1],d[2]=r[t+2],d[3]=r[t+3],d[4]=r[t+4],d[5]=r[t+5],d[6]=r[t+6],d[7]=r[t+7],at[0]}var ve=BigInt(Number.MAX_SAFE_INTEGER),Ge=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 T;if(t<ve&&t>Ge)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>te&&(i=0n,++n>te&&(n=0n))),new r(Number(i),Number(n))}static fromNumber(t){if(t===0)return T;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):T}},T=new m(0,0);T.toBigInt=function(){return 0n};T.zzEncode=T.zzDecode=function(){return this};T.length=function(){return 1};var te=4294967296n;function ee(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 re(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 dt(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 b(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Z(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}var ut=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,b(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 b(this,4);return Z(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw b(this,4);return Z(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw b(this,4);let t=Kt(this.buf,this.pos);return this.pos+=4,t}double(){if(this.pos+8>this.len)throw b(this,4);let t=Zt(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 b(this,t);return this.pos+=t,e===n?new Uint8Array(0):this.buf.subarray(e,n)}string(){let t=this.bytes();return re(t,0,t.length)}skip(t){if(typeof t=="number"){if(this.pos+t>this.len)throw b(this,t);this.pos+=t}else do if(this.pos>=this.len)throw b(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 b(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 b(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 b(this,8);let t=Z(this.buf,this.pos+=4),e=Z(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=Ht(this.buf,this.pos);return this.pos+=G(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 _(r){return new ut(r instanceof Uint8Array?r:r.subarray())}function ie(r,t,e){let n=_(r);return t.decode(n,void 0,e)}var xt={};l(xt,{base10:()=>Qe});var bn=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 I(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 qe(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,p=r.charAt(0),D=Math.log(c)/Math.log(256),R=Math.log(256)/Math.log(c);function st(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var f=0,M=0,g=0,y=h.length;g!==y&&h[g]===0;)g++,f++;for(var E=(y-g)*R+1>>>0,x=new Uint8Array(E);g!==y;){for(var S=h[g],N=0,w=E-1;(S!==0||N<M)&&w!==-1;w--,N++)S+=256*x[w]>>>0,x[w]=S%c>>>0,S=S/c>>>0;if(S!==0)throw new Error("Non-zero carry");M=N,g++}for(var C=E-M;C!==E&&x[C]===0;)C++;for(var Y=p.repeat(f);C<E;++C)Y+=r.charAt(x[C]);return Y}function K(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var f=0;if(h[f]!==" "){for(var M=0,g=0;h[f]===p;)M++,f++;for(var y=(h.length-f)*D+1>>>0,E=new Uint8Array(y);h[f];){var x=e[h.charCodeAt(f)];if(x===255)return;for(var S=0,N=y-1;(x!==0||S<g)&&N!==-1;N--,S++)x+=c*E[N]>>>0,E[N]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");g=S,f++}if(h[f]!==" "){for(var w=y-g;w!==y&&E[w]===0;)w++;for(var C=new Uint8Array(M+(y-w)),Y=M;w!==y;)C[Y++]=E[w++];return C}}}function Te(h){var f=K(h);if(f)return f;throw new Error(`Non-${t} character`)}return{encode:st,decodeUnsafe:K,decode:Te}}var je=qe,Xe=je,ae=Xe;var ft=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")}},pt=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)}},lt=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 lt({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var mt=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 ft(t,e,n),this.decoder=new pt(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 mt(r,t,e,n)}function U({name:r,prefix:t,alphabet:e}){let{encode:n,decode:i}=ae(e,r);return V({prefix:t,name:r,encode:n,decode:o=>I(i(o))})}function Je(r,t,e,n){let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*e/8|0),s=0,c=0,p=0;for(let D=0;D<i;++D){let R=t[r[D]];if(R===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<e|R,s+=e,s>=8&&(s-=8,o[p++]=255&c>>s)}if(s>=e||(255&c<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function We(r,t,e){let n=t[t.length-1]==="=",i=(1<<e)-1,o="",s=0,c=0;for(let p=0;p<r.length;++p)for(c=c<<8|r[p],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 He(r){let t={};for(let e=0;e<r.length;++e)t[r[e]]=e;return t}function a({name:r,prefix:t,bitsPerChar:e,alphabet:n}){let i=He(n);return V({prefix:t,name:r,encode(o){return We(o,n,e)},decode(o){return Je(o,i,e,r)}})}var Qe=U({prefix:"9",name:"base10",alphabet:"0123456789"});var gt={};l(gt,{base16:()=>Ke,base16upper:()=>Ye});var Ke=a({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ye=a({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var wt={};l(wt,{base2:()=>Ze});var Ze=a({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var bt={};l(bt,{base256emoji:()=>ir});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}"),tr=ue.reduce((r,t,e)=>(r[e]=t,r),[]),er=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 rr(r){return r.reduce((t,e)=>(t+=tr[e],t),"")}function nr(r){let t=[];for(let e of r){let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);let i=er[n];if(i==null)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}var ir=V({prefix:"\u{1F680}",name:"base256emoji",encode:rr,decode:nr});var yt={};l(yt,{base32:()=>O,base32hex:()=>hr,base32hexpad:()=>dr,base32hexpadupper:()=>ur,base32hexupper:()=>ar,base32pad:()=>sr,base32padupper:()=>cr,base32upper:()=>or,base32z:()=>fr});var O=a({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),or=a({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),sr=a({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cr=a({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),hr=a({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ar=a({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),dr=a({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ur=a({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),fr=a({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Et={};l(Et,{base36:()=>q,base36upper:()=>pr});var q=U({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),pr=U({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var St={};l(St,{base58btc:()=>A,base58flickr:()=>lr});var A=U({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lr=U({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var At={};l(At,{base64:()=>mr,base64pad:()=>xr,base64url:()=>gr,base64urlpad:()=>wr});var mr=a({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xr=a({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),gr=a({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),wr=a({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ct={};l(Ct,{base8:()=>br});var br=a({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var It={};l(It,{identity:()=>yr});var yr=V({prefix:"\0",name:"identity",encode:r=>ce(r),decode:r=>se(r)});var Rn=new TextEncoder,_n=new TextDecoder;var Nt={};l(Nt,{identity:()=>Gr});var Ar=le,fe=128,Cr=127,Ir=~Cr,Dr=Math.pow(2,31);function le(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Dr;)t[e++]=r&255|fe,r/=128;for(;r&Ir;)t[e++]=r&255|fe,r>>>=7;return t[e]=r|0,le.bytes=e-n+1,t}var Nr=Dt,Fr=128,pe=127;function Dt(r,n){var e=0,n=n||0,i=0,o=n,s,c=r.length;do{if(o>=c)throw Dt.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>=Fr);return Dt.bytes=o-n,e}var Br=Math.pow(2,7),Lr=Math.pow(2,14),Ur=Math.pow(2,21),Mr=Math.pow(2,28),Tr=Math.pow(2,35),zr=Math.pow(2,42),Rr=Math.pow(2,49),_r=Math.pow(2,56),Vr=Math.pow(2,63),Or=function(r){return r<Br?1:r<Lr?2:r<Ur?3:r<Mr?4:r<Tr?5:r<zr?6:r<Rr?7:r<_r?8:r<Vr?9:10},kr={encode:Ar,decode:Nr,encodingLength:Or},Pr=kr,j=Pr;function X(r,t=0){return[j.decode(r,t),j.decode.bytes]}function k(r,t,e=0){return j.encode(r,t,e),t}function P(r){return j.encodingLength(r)}function v(r,t){let e=t.byteLength,n=P(r),i=n+P(e),o=new Uint8Array(i+e);return k(r,o,0),k(e,o,n),o.set(t,i),new $(r,e,t,o)}function me(r){let t=I(r),[e,n]=X(t),[i,o]=X(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new $(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 $=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,$r="identity",we=I;function vr(r,t){if(t?.truncate!=null&&t.truncate!==r.byteLength){if(t.truncate<0||t.truncate>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,t.truncate)}return v(ge,we(r))}var Gr={code:ge,name:$r,encode:we,digest:vr};var Lt={};l(Lt,{sha256:()=>jr,sha512:()=>Xr});var qr=20;function Bt({name:r,code:t,encode:e,minDigestLength:n,maxDigestLength:i}){return new Ft(r,t,e,n,i)}var Ft=class{name;code;encode;minDigestLength;maxDigestLength;constructor(t,e,n,i,o){this.name=t,this.code=e,this.encode=n,this.minDigestLength=i??qr,this.maxDigestLength=o}digest(t,e){if(e?.truncate!=null){if(e.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&e.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(t instanceof Uint8Array){let n=this.encode(t);return n instanceof Uint8Array?be(n,this.code,e?.truncate):n.then(i=>be(i,this.code,e?.truncate))}else throw Error("Unknown type, must be binary type")}};function be(r,t,e){if(e!=null&&e!==r.byteLength){if(e>r.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${r.byteLength}`);r=r.subarray(0,e)}return v(t,r)}function Ee(r){return async t=>new Uint8Array(await crypto.subtle.digest(r,t))}var jr=Bt({name:"sha2-256",code:18,encode:Ee("SHA-256")}),Xr=Bt({name:"sha2-512",code:19,encode:Ee("SHA-512")});function Se(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return Wr(e,Ut(r),t??A.encoder);default:return Hr(e,Ut(r),t??O.encoder)}}var Ae=new WeakMap;function Ut(r){let t=Ae.get(r);if(t==null){let e=new Map;return Ae.set(r,e),e}return t}var et=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=v(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 Se(this,t)}toJSON(){return{"/":Se(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??Ce(n,i,o.bytes))}else if(e[Kr]===!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=Ce(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=I(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 $(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[st,K]=X(t.subarray(e));return e+=K,st},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(),p=n(),D=e+p,R=D-s;return{version:i,codec:o,multihashCode:c,digestSize:p,multihashSize:R,size:D}}static parse(t,e){let[n,i]=Jr(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 Ut(o).set(n,t),o}};function Jr(r,t){switch(r[0]){case"Q":{let e=t??A;return[A.prefix,e.decode(`${A.prefix}${r}`)]}case A.prefix:{let e=t??A;return[A.prefix,e.decode(r)]}case O.prefix:{let e=t??O;return[O.prefix,e.decode(r)]}case q.prefix:{let e=t??q;return[q.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 Wr(r,t,e){let{prefix:n}=e;if(n!==A.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 Hr(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 Ce(r,t,e){let n=P(r),i=n+P(t),o=new Uint8Array(i+e.byteLength);return k(r,o,0),k(t,o,n),o.set(e,i),o}var Kr=Symbol.for("@ipld/js-cid/CID");var Mt={...It,...wt,...Ct,...xt,...gt,...yt,...Et,...St,...At,...bt},ii={...Lt,...Nt};function De(r,t,e,n){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:n}}}var Ie=De("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Tt=De("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=F(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),Yr={utf8:Ie,"utf-8":Ie,hex:Mt.base16,latin1:Tt,ascii:Tt,binary:Tt,...Mt},Ne=Yr;function Fe(r,t="utf8"){let e=Ne[t];if(e==null)throw new Error(`Unsupported encoding "${t}"`);return e.decoder.decode(`${e.prefix}${r}`)}function zt(r){let t=r??8192,e=t>>>1,n,i=t;return function(s){if(s<1||s>e)return F(s);i+s>t&&(n=F(t),i=0);let c=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),c}}var z=class{fn;len;next;val;constructor(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}};function Rt(){}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}},Zr=zt();function tn(r){return globalThis.Buffer!=null?F(r):Zr(r)}var Q=class{len;head;tail;states;constructor(){this.len=0,this.head=new z(Rt,0,0),this.tail=this.head,this.states=null}_push(t,e,n){return this.tail=this.tail.next=new z(t,e,n),this.len+=e,this}uint32(t){return this.len+=(this.tail=this.tail.next=new Ot((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(rt,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(rt,e.length(),e)}uint64Number(t){return this._push(Wt,G(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(rt,e.length(),e)}sint64Number(t){let e=m.fromNumber(t).zzEncode();return this._push(rt,e.length(),e)}sint64String(t){return this.sint64(BigInt(t))}bool(t){return this._push(_t,1,t?1:0)}fixed32(t){return this._push(H,4,t>>>0)}sfixed32(t){return this.fixed32(t)}fixed64(t){let e=m.fromBigInt(t);return this._push(H,4,e.lo)._push(H,4,e.hi)}fixed64Number(t){let e=m.fromNumber(t);return this._push(H,4,e.lo)._push(H,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(Qt,4,t)}double(t){return this._push(Yt,8,t)}bytes(t){let e=t.length>>>0;return e===0?this._push(_t,1,0):this.uint32(e)._push(rn,e,t)}string(t){let e=ee(t);return e!==0?this.uint32(e)._push(dt,e,t):this._push(_t,1,0)}fork(){return this.states=new Vt(this),this.head=this.tail=new z(Rt,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 z(Rt,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=tn(this.len),n=0;for(;t!=null;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e}};function _t(r,t,e){t[e]=r&255}function en(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}var Ot=class extends z{next;constructor(t,e){super(en,t,e),this.next=void 0}};function rt(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 H(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 rn(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(nn,t,r),this},Q.prototype.string=function(r){let t=globalThis.Buffer.byteLength(r);return this.uint32(t),t>0&&this._push(on,t,r),this});function nn(r,t,e){t.set(r,e)}function on(r,t,e){r.length<40?dt(r,t,e):t.utf8Write!=null?t.utf8Write(r,e):t.set(Fe(r),e)}function nt(){return new Q}function Be(r,t){let e=nt();return t.encode(r,e,{lengthDelimited:!1}),e.finish()}function*Le(r,t,e){let n=_(r);yield*t.stream(n,void 0,e)}var it={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function ot(r,t,e,n,i){return{name:r,type:t,encode:e,decode:n,stream:i}}function Ue(r){function t(o){if(r[o.toString()]==null)throw new Error("Invalid enum value");return r[o]}let e=function(s,c){let p=t(s);c.int32(p)},n=function(s){let c=s.int32();return t(c)},i=function*(s){let c=s.int32();yield t(c)};return ot("enum",it.VARINT,e,n,i)}function Me(r,t,e){return ot("message",it.LENGTH_DELIMITED,r,t,e)}var kt=class extends Error{code;constructor(t,e){super(t),this.code=e}},Pt=class extends Error{code="ERR_MAX_LENGTH";name="MaxLengthError"},$t=class extends Error{code="ERR_MAX_SIZE";name="MaxSizeError"},vt=class extends Error{code="ERR_PARSE_ERROR";name="ParseError"},Gt=class extends Error{code="ERR_NO_MESSAGES_FOUND";name="NoMessagesFoundError"};return Oe(sn);})(); | ||
| return ProtonsRuntime})); | ||
| //# sourceMappingURL=index.min.js.map |
+15
-11
@@ -1,10 +0,10 @@ | ||
| import type { Writer, Reader } from './index.js'; | ||
| export declare enum CODEC_TYPES { | ||
| VARINT = 0, | ||
| BIT64 = 1, | ||
| LENGTH_DELIMITED = 2, | ||
| START_GROUP = 3, | ||
| END_GROUP = 4, | ||
| BIT32 = 5 | ||
| } | ||
| import type { Writer, Reader } from './index.ts'; | ||
| export declare const CODEC_TYPES: { | ||
| VARINT: number; | ||
| BIT64: number; | ||
| LENGTH_DELIMITED: number; | ||
| START_GROUP: number; | ||
| END_GROUP: number; | ||
| BIT32: number; | ||
| }; | ||
| export interface EncodeOptions { | ||
@@ -38,10 +38,14 @@ lengthDelimited?: boolean; | ||
| } | ||
| export interface StreamFunction<T> { | ||
| (reader: Reader, length?: number, prefix?: string, opts?: DecodeOptions<T>): Generator<any>; | ||
| } | ||
| export interface Codec<T> { | ||
| name: string; | ||
| type: CODEC_TYPES; | ||
| type: number; | ||
| encode: EncodeFunction<T>; | ||
| decode: DecodeFunction<T>; | ||
| stream: StreamFunction<T>; | ||
| } | ||
| export declare function createCodec<T>(name: string, type: CODEC_TYPES, encode: EncodeFunction<T>, decode: DecodeFunction<T>): Codec<T>; | ||
| export declare function createCodec<T>(name: string, type: number, encode: EncodeFunction<T>, decode: DecodeFunction<T>, stream: StreamFunction<T>): Codec<T>; | ||
| export {}; | ||
| //# sourceMappingURL=codec.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAGhD,oBAAY,WAAW;IACrB,MAAM,IAAI;IACV,KAAK,IAAA;IACL,gBAAgB,IAAA;IAChB,WAAW,IAAA;IACX,SAAS,IAAA;IACT,KAAK,IAAA;CACN;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC;IA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| ||
| export var CODEC_TYPES; | ||
| (function (CODEC_TYPES) { | ||
| CODEC_TYPES[CODEC_TYPES["VARINT"] = 0] = "VARINT"; | ||
| CODEC_TYPES[CODEC_TYPES["BIT64"] = 1] = "BIT64"; | ||
| CODEC_TYPES[CODEC_TYPES["LENGTH_DELIMITED"] = 2] = "LENGTH_DELIMITED"; | ||
| CODEC_TYPES[CODEC_TYPES["START_GROUP"] = 3] = "START_GROUP"; | ||
| CODEC_TYPES[CODEC_TYPES["END_GROUP"] = 4] = "END_GROUP"; | ||
| CODEC_TYPES[CODEC_TYPES["BIT32"] = 5] = "BIT32"; | ||
| })(CODEC_TYPES || (CODEC_TYPES = {})); | ||
| export function createCodec(name, type, encode, decode) { | ||
| export const CODEC_TYPES = { | ||
| VARINT: 0, | ||
| BIT64: 1, | ||
| LENGTH_DELIMITED: 2, | ||
| START_GROUP: 3, | ||
| END_GROUP: 4, | ||
| BIT32: 5 | ||
| }; | ||
| export function createCodec(name, type, encode, decode, stream) { | ||
| return { | ||
@@ -16,5 +15,6 @@ name, | ||
| encode, | ||
| decode | ||
| decode, | ||
| stream | ||
| }; | ||
| } | ||
| //# sourceMappingURL=codec.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,iDAAU,CAAA;IACV,+CAAK,CAAA;IACL,qEAAgB,CAAA;IAChB,2DAAW,CAAA;IACX,uDAAS,CAAA;IACT,+CAAK,CAAA;AACP,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB;AA0DD,MAAM,UAAU,WAAW,CAAM,IAAY,EAAE,IAAiB,EAAE,MAAyB,EAAE,MAAyB;IACpH,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,MAAM;QACN,MAAM;KACP,CAAA;AACH,CAAC"} | ||
| {"version":3,"file":"codec.js","sourceRoot":"","sources":["../../src/codec.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,gBAAgB,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC;IACd,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;CACT,CAAA;AA+DD,MAAM,UAAU,WAAW,CAAM,IAAY,EAAE,IAAY,EAAE,MAAyB,EAAE,MAAyB,EAAE,MAAyB;IAC1I,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,MAAM;QACN,MAAM;QACN,MAAM;KACP,CAAA;AACH,CAAC"} |
@@ -1,3 +0,3 @@ | ||
| import type { Codec } from '../codec.js'; | ||
| import type { Codec } from '../codec.ts'; | ||
| export declare function enumeration<T>(v: any): Codec<T>; | ||
| //# sourceMappingURL=enum.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/codecs/enum.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkC,KAAK,EAAE,MAAM,aAAa,CAAA;AAExE,wBAAgB,WAAW,CAAE,CAAC,EAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAyBjD"} | ||
| {"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/codecs/enum.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkC,KAAK,EAAkB,MAAM,aAAa,CAAA;AAExF,wBAAgB,WAAW,CAAE,CAAC,EAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CA8BjD"} |
@@ -1,2 +0,2 @@ | ||
| import { createCodec, CODEC_TYPES } from '../codec.js'; | ||
| import { createCodec, CODEC_TYPES } from "../codec.js"; | ||
| export function enumeration(v) { | ||
@@ -19,5 +19,8 @@ function findValue(val) { | ||
| }; | ||
| // @ts-expect-error yeah yeah | ||
| return createCodec('enum', CODEC_TYPES.VARINT, encode, decode); | ||
| const stream = function* enumStream(reader) { | ||
| const val = reader.int32(); | ||
| yield findValue(val); | ||
| }; | ||
| return createCodec('enum', CODEC_TYPES.VARINT, encode, decode, stream); | ||
| } | ||
| //# sourceMappingURL=enum.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/codecs/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGtD,MAAM,UAAU,WAAW,CAAM,CAAM;IACrC,SAAS,SAAS,CAAE,GAAoB;QACtC,uEAAuE;QACvE,2EAA2E;QAC3E,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACvC,CAAC;QAED,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;IACf,CAAC;IAED,MAAM,MAAM,GAAoC,SAAS,UAAU,CAAE,GAAG,EAAE,MAAM;QAC9E,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QAEhC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC,CAAA;IAED,MAAM,MAAM,GAAoC,SAAS,UAAU,CAAE,MAAM;QACzE,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;QAE1B,OAAO,SAAS,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,6BAA6B;IAC7B,OAAO,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAChE,CAAC"} | ||
| {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/codecs/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGtD,MAAM,UAAU,WAAW,CAAM,CAAM;IACrC,SAAS,SAAS,CAAE,GAAQ;QAC1B,uEAAuE;QACvE,2EAA2E;QAC3E,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAA;QACvC,CAAC;QAED,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;IACf,CAAC;IAED,MAAM,MAAM,GAAsB,SAAS,UAAU,CAAE,GAAG,EAAE,MAAM;QAChE,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,CAAA;QAEhC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC,CAAA;IAED,MAAM,MAAM,GAAwB,SAAS,UAAU,CAAE,MAAM;QAC7D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;QAE1B,OAAO,SAAS,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC,CAAA;IAED,MAAM,MAAM,GAAsB,QAAS,CAAC,CAAC,UAAU,CAAE,MAAM;QAC7D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;QAE1B,MAAM,SAAS,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC,CAAA;IAED,OAAO,WAAW,CAAI,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAC3E,CAAC"} |
@@ -1,6 +0,6 @@ | ||
| import type { EncodeFunction, DecodeFunction, Codec } from '../codec.js'; | ||
| import type { EncodeFunction, DecodeFunction, Codec, StreamFunction } from '../codec.ts'; | ||
| export interface Factory<A, T> { | ||
| new (obj: A): T; | ||
| } | ||
| export declare function message<T>(encode: EncodeFunction<T>, decode: DecodeFunction<T>): Codec<T>; | ||
| export declare function message<T>(encode: EncodeFunction<T>, decode: DecodeFunction<T>, stream: StreamFunction<T>): Codec<T>; | ||
| //# sourceMappingURL=message.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/codecs/message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExE,MAAM,WAAW,OAAO,CAAC,CAAC,EAAE,CAAC;IAC3B,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;CAChB;AAED,wBAAgB,OAAO,CAAE,CAAC,EAAG,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAE3F"} | ||
| {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/codecs/message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAExF,MAAM,WAAW,OAAO,CAAC,CAAC,EAAE,CAAC;IAC3B,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;CAChB;AAED,wBAAgB,OAAO,CAAE,CAAC,EAAG,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAEtH"} |
@@ -1,5 +0,5 @@ | ||
| import { createCodec, CODEC_TYPES } from '../codec.js'; | ||
| export function message(encode, decode) { | ||
| return createCodec('message', CODEC_TYPES.LENGTH_DELIMITED, encode, decode); | ||
| import { createCodec, CODEC_TYPES } from "../codec.js"; | ||
| export function message(encode, decode, stream) { | ||
| return createCodec('message', CODEC_TYPES.LENGTH_DELIMITED, encode, decode, stream); | ||
| } | ||
| //# sourceMappingURL=message.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/codecs/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAOtD,MAAM,UAAU,OAAO,CAAM,MAAyB,EAAE,MAAyB;IAC/E,OAAO,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAC7E,CAAC"} | ||
| {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/codecs/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAOtD,MAAM,UAAU,OAAO,CAAM,MAAyB,EAAE,MAAyB,EAAE,MAAyB;IAC1G,OAAO,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AACrF,CAAC"} |
@@ -1,4 +0,4 @@ | ||
| import type { Codec, DecodeOptions } from './codec.js'; | ||
| import type { Codec, DecodeOptions } from './codec.ts'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| export declare function decodeMessage<T>(buf: Uint8Array | Uint8ArrayList, codec: Pick<Codec<T>, 'decode'>, opts?: DecodeOptions<T>): T; | ||
| //# sourceMappingURL=decode.d.ts.map |
@@ -1,2 +0,2 @@ | ||
| import { createReader } from './utils/reader.js'; | ||
| import { createReader } from "./utils/reader.js"; | ||
| export function decodeMessage(buf, codec, opts) { | ||
@@ -3,0 +3,0 @@ const reader = createReader(buf); |
@@ -1,3 +0,3 @@ | ||
| import type { Codec } from './codec.js'; | ||
| import type { Codec } from './codec.ts'; | ||
| export declare function encodeMessage<T>(message: Partial<T>, codec: Pick<Codec<T>, 'encode'>): Uint8Array; | ||
| //# sourceMappingURL=encode.d.ts.map |
@@ -1,2 +0,2 @@ | ||
| import { createWriter } from './utils/writer.js'; | ||
| import { createWriter } from "./utils/writer.js"; | ||
| export function encodeMessage(message, codec) { | ||
@@ -3,0 +3,0 @@ const w = createWriter(); |
@@ -12,3 +12,3 @@ /** | ||
| */ | ||
| import type { Codec } from './codec.js'; | ||
| import type { Codec } from './codec.ts'; | ||
| export interface FieldDef { | ||
@@ -21,9 +21,10 @@ name: string; | ||
| } | ||
| export { decodeMessage } from './decode.js'; | ||
| export { encodeMessage } from './encode.js'; | ||
| export { enumeration } from './codecs/enum.js'; | ||
| export { message } from './codecs/message.js'; | ||
| export { createReader as reader } from './utils/reader.js'; | ||
| export { createWriter as writer } from './utils/writer.js'; | ||
| export type { Codec, EncodeOptions, DecodeOptions } from './codec.js'; | ||
| export { decodeMessage } from './decode.ts'; | ||
| export { encodeMessage } from './encode.ts'; | ||
| export { streamMessage } from './stream.ts'; | ||
| export { enumeration } from './codecs/enum.ts'; | ||
| export { message } from './codecs/message.ts'; | ||
| export { createReader as reader } from './utils/reader.ts'; | ||
| export { createWriter as writer } from './utils/writer.ts'; | ||
| export type { Codec, EncodeOptions, DecodeOptions } from './codec.ts'; | ||
| export interface Writer { | ||
@@ -30,0 +31,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACjB,QAAQ,CAAC,EAAE,IAAI,CAAA;IACf,OAAO,CAAC,EAAE,IAAI,CAAA;IACd,MAAM,CAAC,EAAE,IAAI,CAAA;CACd;AAED,OAAO,EACL,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,C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I,SAA0B;IAC9B,IAAI,SAAyB;CACrC"} |
@@ -12,8 +12,9 @@ /** | ||
| */ | ||
| export { decodeMessage } from './decode.js'; | ||
| export { encodeMessage } from './encode.js'; | ||
| export { enumeration } from './codecs/enum.js'; | ||
| export { message } from './codecs/message.js'; | ||
| export { createReader as reader } from './utils/reader.js'; | ||
| export { createWriter as writer } from './utils/writer.js'; | ||
| export { decodeMessage } from "./decode.js"; | ||
| export { encodeMessage } from "./encode.js"; | ||
| export { streamMessage } from "./stream.js"; | ||
| export { enumeration } from "./codecs/enum.js"; | ||
| export { message } from "./codecs/message.js"; | ||
| export { createReader as reader } from "./utils/reader.js"; | ||
| export { createWriter as writer } from "./utils/writer.js"; | ||
| /** | ||
@@ -20,0 +21,0 @@ * This will be removed in a future release |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,EACL,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,aAAa,EACd,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAoT1D;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAC3B,IAAI,CAAQ;IAEnB,YAAa,OAAe,EAAE,IAAY;QACxC,KAAK,CAAC,OAAO,CAAC,CAAA;QAEd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC;;;;OAIG;IACI,IAAI,GAAG,gBAAgB,CAAA;IACvB,IAAI,GAAG,gBA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AAK;IACrC;;;;OAIG;IACI,IAAI,GAAG,cAAc,CAAA;IACrB,IAAI,GAAG,cAAc,CAAA;CAC7B;AAED,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC;;;;OAIG;IACI,IAAI,GAAG,iBAAiB,CAAA;IACxB,IAAI,GAAG,YAAY,CAAA;CAC3B;AAED,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C;;;;OAIG;IACI,IAAI,GAAG,uBAAuB,CAAA;IAC9B,IAAI,GAAG,sBAAsB,CAAA;CACrC"} |
@@ -1,2 +0,2 @@ | ||
| import type { Reader } from '../index.js'; | ||
| import type { Reader } from '../index.ts'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
@@ -3,0 +3,0 @@ /** |
| import { decodeUint8Array, encodingLength } from 'uint8-varint'; | ||
| import { readFloatLE, readDoubleLE } from './float.js'; | ||
| import { LongBits } from './longbits.js'; | ||
| import * as utf8 from './utf8.js'; | ||
| import { readFloatLE, readDoubleLE } from "./float.js"; | ||
| import { LongBits } from "./longbits.js"; | ||
| import * as utf8 from "./utf8.js"; | ||
| /* istanbul ignore next */ | ||
@@ -6,0 +6,0 @@ function indexOutOfRange(reader, writeLength) { |
@@ -1,2 +0,2 @@ | ||
| import type { Writer } from '../index.js'; | ||
| import type { Writer } from '../index.ts'; | ||
| /** | ||
@@ -3,0 +3,0 @@ * Creates a new writer |
| import { encodeUint8Array, encodingLength } from 'uint8-varint'; | ||
| import { allocUnsafe } from 'uint8arrays/alloc'; | ||
| import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'; | ||
| import { writeFloatLE, writeDoubleLE } from './float.js'; | ||
| import { LongBits } from './longbits.js'; | ||
| import pool from './pool.js'; | ||
| import * as utf8 from './utf8.js'; | ||
| import { writeFloatLE, writeDoubleLE } from "./float.js"; | ||
| import { LongBits } from "./longbits.js"; | ||
| import pool from "./pool.js"; | ||
| import * as utf8 from "./utf8.js"; | ||
| /** | ||
@@ -9,0 +9,0 @@ * Constructs a new writer operation instance. |
@@ -26,3 +26,4 @@ { | ||
| "reader": "https://ipfs.github.io/protons/functions/protons-runtime.reader.html", | ||
| "streamMessage": "https://ipfs.github.io/protons/functions/protons-runtime.streamMessage.html", | ||
| "writer": "https://ipfs.github.io/protons/functions/protons-runtime.writer.html" | ||
| } |
+98
-13
| { | ||
| "name": "protons-runtime", | ||
| "version": "5.6.0", | ||
| "version": "6.0.0", | ||
| "description": "Shared code to make your bundle smaller when running protons in your app", | ||
| "license": "Apache-2.0 OR MIT", | ||
| "homepage": "https://github.com/ipfs/protons/tree/master/packages/protons-runtime#readme", | ||
| "homepage": "https://github.com/ipfs/protons/tree/main/packages/protons-runtime#readme", | ||
| "repository": { | ||
@@ -21,3 +21,2 @@ "type": "git", | ||
| "files": [ | ||
| "protons.proto", | ||
| "src", | ||
@@ -34,8 +33,94 @@ "dist", | ||
| }, | ||
| "eslintConfig": { | ||
| "extends": "ipfs", | ||
| "parserOptions": { | ||
| "project": true, | ||
| "sourceType": "module" | ||
| } | ||
| "release": { | ||
| "branches": [ | ||
| "main" | ||
| ], | ||
| "plugins": [ | ||
| [ | ||
| "@semantic-release/commit-analyzer", | ||
| { | ||
| "preset": "conventionalcommits", | ||
| "releaseRules": [ | ||
| { | ||
| "breaking": true, | ||
| "release": "major" | ||
| }, | ||
| { | ||
| "revert": true, | ||
| "release": "patch" | ||
| }, | ||
| { | ||
| "type": "feat", | ||
| "release": "minor" | ||
| }, | ||
| { | ||
| "type": "fix", | ||
| "release": "patch" | ||
| }, | ||
| { | ||
| "type": "docs", | ||
| "release": "patch" | ||
| }, | ||
| { | ||
| "type": "test", | ||
| "release": "patch" | ||
| }, | ||
| { | ||
| "type": "deps", | ||
| "release": "patch" | ||
| }, | ||
| { | ||
| "scope": "no-release", | ||
| "release": false | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| [ | ||
| "@semantic-release/release-notes-generator", | ||
| { | ||
| "preset": "conventionalcommits", | ||
| "presetConfig": { | ||
| "types": [ | ||
| { | ||
| "type": "feat", | ||
| "section": "Features" | ||
| }, | ||
| { | ||
| "type": "fix", | ||
| "section": "Bug Fixes" | ||
| }, | ||
| { | ||
| "type": "chore", | ||
| "section": "Trivial Changes" | ||
| }, | ||
| { | ||
| "type": "docs", | ||
| "section": "Documentation" | ||
| }, | ||
| { | ||
| "type": "deps", | ||
| "section": "Dependencies" | ||
| }, | ||
| { | ||
| "type": "test", | ||
| "section": "Tests" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "@semantic-release/changelog", | ||
| "@semantic-release/npm", | ||
| "@semantic-release/github", | ||
| [ | ||
| "@semantic-release/git", | ||
| { | ||
| "assets": [ | ||
| "CHANGELOG.md", | ||
| "package.json" | ||
| ] | ||
| } | ||
| ] | ||
| ] | ||
| }, | ||
@@ -51,9 +136,9 @@ "scripts": { | ||
| "dependencies": { | ||
| "uint8-varint": "^2.0.2", | ||
| "uint8arraylist": "^2.4.3", | ||
| "uint8arrays": "^5.0.1" | ||
| "uint8-varint": "^2.0.4", | ||
| "uint8arraylist": "^2.4.8", | ||
| "uint8arrays": "^5.1.0" | ||
| }, | ||
| "devDependencies": { | ||
| "aegir": "^47.0.5" | ||
| "aegir": "^47.0.26" | ||
| } | ||
| } |
+3
-5
@@ -1,2 +0,2 @@ | ||
| # protons-runtime <!-- omit in toc --> | ||
| # protons-runtime | ||
@@ -41,4 +41,2 @@ [](https://ipfs.tech) | ||
| Contains shared code to reduce code duplication between modules transpiled by protons. | ||
| # API Docs | ||
@@ -52,4 +50,4 @@ | ||
| - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>) | ||
| - MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>) | ||
| - Apache 2.0, ([LICENSE-APACHE](https://github.com/ipfs/protons/blob/main/packages/protons-runtime/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>) | ||
| - MIT ([LICENSE-MIT](https://github.com/ipfs/protons/blob/main/packages/protons-runtime/LICENSE-MIT) / <http://opensource.org/licenses/MIT>) | ||
@@ -56,0 +54,0 @@ # Contribute |
+17
-11
@@ -1,11 +0,11 @@ | ||
| import type { Writer, Reader } from './index.js' | ||
| import type { Writer, Reader } from './index.ts' | ||
| // https://developers.google.com/protocol-buffers/docs/encoding#structure | ||
| export enum CODEC_TYPES { | ||
| VARINT = 0, | ||
| BIT64, | ||
| LENGTH_DELIMITED, | ||
| START_GROUP, | ||
| END_GROUP, | ||
| BIT32 | ||
| export const CODEC_TYPES = { | ||
| VARINT: 0, | ||
| BIT64: 1, | ||
| LENGTH_DELIMITED: 2, | ||
| START_GROUP: 3, | ||
| END_GROUP: 4, | ||
| BIT32: 5 | ||
| } | ||
@@ -62,10 +62,15 @@ | ||
| export interface StreamFunction<T> { | ||
| (reader: Reader, length?: number, prefix?: string, opts?: DecodeOptions<T>): Generator<any> | ||
| } | ||
| export interface Codec<T> { | ||
| name: string | ||
| type: CODEC_TYPES | ||
| type: number | ||
| encode: EncodeFunction<T> | ||
| decode: DecodeFunction<T> | ||
| stream: StreamFunction<T> | ||
| } | ||
| export function createCodec <T> (name: string, type: CODEC_TYPES, encode: EncodeFunction<T>, decode: DecodeFunction<T>): Codec<T> { | ||
| export function createCodec <T> (name: string, type: number, encode: EncodeFunction<T>, decode: DecodeFunction<T>, stream: StreamFunction<T>): Codec<T> { | ||
| return { | ||
@@ -75,4 +80,5 @@ name, | ||
| encode, | ||
| decode | ||
| decode, | ||
| stream | ||
| } | ||
| } |
+12
-7
@@ -1,6 +0,6 @@ | ||
| import { createCodec, CODEC_TYPES } from '../codec.js' | ||
| import type { DecodeFunction, EncodeFunction, Codec } from '../codec.js' | ||
| import { createCodec, CODEC_TYPES } from '../codec.ts' | ||
| import type { DecodeFunction, EncodeFunction, Codec, StreamFunction } from '../codec.ts' | ||
| export function enumeration <T> (v: any): Codec<T> { | ||
| function findValue (val: string | number): number { | ||
| function findValue (val: any): number { | ||
| // Use the reverse mapping to look up the enum key for the stored value | ||
@@ -15,3 +15,3 @@ // https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings | ||
| const encode: EncodeFunction<number | string> = function enumEncode (val, writer) { | ||
| const encode: EncodeFunction<T> = function enumEncode (val, writer) { | ||
| const enumValue = findValue(val) | ||
@@ -22,3 +22,3 @@ | ||
| const decode: DecodeFunction<number | string> = function enumDecode (reader) { | ||
| const decode: DecodeFunction<any> = function enumDecode (reader) { | ||
| const val = reader.int32() | ||
@@ -29,4 +29,9 @@ | ||
| // @ts-expect-error yeah yeah | ||
| return createCodec('enum', CODEC_TYPES.VARINT, encode, decode) | ||
| const stream: StreamFunction<T> = function * enumStream (reader) { | ||
| const val = reader.int32() | ||
| yield findValue(val) | ||
| } | ||
| return createCodec<T>('enum', CODEC_TYPES.VARINT, encode, decode, stream) | ||
| } |
@@ -1,3 +0,3 @@ | ||
| import { createCodec, CODEC_TYPES } from '../codec.js' | ||
| import type { EncodeFunction, DecodeFunction, Codec } from '../codec.js' | ||
| import { createCodec, CODEC_TYPES } from '../codec.ts' | ||
| import type { EncodeFunction, DecodeFunction, Codec, StreamFunction } from '../codec.ts' | ||
@@ -8,4 +8,4 @@ export interface Factory<A, T> { | ||
| export function message <T> (encode: EncodeFunction<T>, decode: DecodeFunction<T>): Codec<T> { | ||
| return createCodec('message', CODEC_TYPES.LENGTH_DELIMITED, encode, decode) | ||
| export function message <T> (encode: EncodeFunction<T>, decode: DecodeFunction<T>, stream: StreamFunction<T>): Codec<T> { | ||
| return createCodec('message', CODEC_TYPES.LENGTH_DELIMITED, encode, decode, stream) | ||
| } |
+2
-2
@@ -1,3 +0,3 @@ | ||
| import { createReader } from './utils/reader.js' | ||
| import type { Codec, DecodeOptions } from './codec.js' | ||
| import { createReader } from './utils/reader.ts' | ||
| import type { Codec, DecodeOptions } from './codec.ts' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
@@ -4,0 +4,0 @@ |
+2
-2
@@ -1,3 +0,3 @@ | ||
| import { createWriter } from './utils/writer.js' | ||
| import type { Codec } from './codec.js' | ||
| import { createWriter } from './utils/writer.ts' | ||
| import type { Codec } from './codec.ts' | ||
@@ -4,0 +4,0 @@ export function encodeMessage <T> (message: Partial<T>, codec: Pick<Codec<T>, 'encode'>): Uint8Array { |
+12
-8
@@ -13,3 +13,3 @@ /** | ||
| import type { Codec } from './codec.js' | ||
| import type { Codec } from './codec.ts' | ||
@@ -26,14 +26,18 @@ export interface FieldDef { | ||
| decodeMessage | ||
| } from './decode.js' | ||
| } from './decode.ts' | ||
| export { | ||
| encodeMessage | ||
| } from './encode.js' | ||
| } from './encode.ts' | ||
| export { enumeration } from './codecs/enum.js' | ||
| export { message } from './codecs/message.js' | ||
| export { createReader as reader } from './utils/reader.js' | ||
| export { createWriter as writer } from './utils/writer.js' | ||
| export type { Codec, EncodeOptions, DecodeOptions } from './codec.js' | ||
| export { | ||
| streamMessage | ||
| } from './stream.ts' | ||
| export { enumeration } from './codecs/enum.ts' | ||
| export { message } from './codecs/message.ts' | ||
| export { createReader as reader } from './utils/reader.ts' | ||
| export { createWriter as writer } from './utils/writer.ts' | ||
| export type { Codec, EncodeOptions, DecodeOptions } from './codec.ts' | ||
| export interface Writer { | ||
@@ -40,0 +44,0 @@ /** |
| import { decodeUint8Array, encodingLength } from 'uint8-varint' | ||
| import { readFloatLE, readDoubleLE } from './float.js' | ||
| import { LongBits } from './longbits.js' | ||
| import * as utf8 from './utf8.js' | ||
| import type { Reader } from '../index.js' | ||
| import { readFloatLE, readDoubleLE } from './float.ts' | ||
| import { LongBits } from './longbits.ts' | ||
| import * as utf8 from './utf8.ts' | ||
| import type { Reader } from '../index.ts' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
@@ -7,0 +7,0 @@ |
| import { encodeUint8Array, encodingLength } from 'uint8-varint' | ||
| import { allocUnsafe } from 'uint8arrays/alloc' | ||
| import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' | ||
| import { writeFloatLE, writeDoubleLE } from './float.js' | ||
| import { LongBits } from './longbits.js' | ||
| import pool from './pool.js' | ||
| import * as utf8 from './utf8.js' | ||
| import type { Writer } from '../index.js' | ||
| import { writeFloatLE, writeDoubleLE } from './float.ts' | ||
| import { LongBits } from './longbits.ts' | ||
| import pool from './pool.ts' | ||
| import * as utf8 from './utf8.ts' | ||
| import type { Writer } from '../index.ts' | ||
@@ -10,0 +10,0 @@ interface WriterOperation<T> { |
-4
| This project is dual licensed under MIT and Apache-2.0. | ||
| MIT: https://www.opensource.org/licenses/mit | ||
| Apache-2.0: https://www.apache.org/licenses/license-2.0 |
| syntax = "proto2"; | ||
| import "google/protobuf/descriptor.proto"; | ||
| package protons; | ||
| message ProtonsOptions { | ||
| // limit the number of repeated fields or map entries that will be decoded | ||
| optional int32 limit = 1; | ||
| } | ||
| // custom options available for use by protons | ||
| extend google.protobuf.FieldOptions { | ||
| optional ProtonsOptions options = 1186; | ||
| } |
Sorry, the diff of this file is too big to display
Mixed license
LicensePackage contains multiple licenses.
Found 1 instance in 1 package
339345
2.89%70
4.48%0
-100%3711
1.06%63
-3.08%Updated
Updated
Updated