UNPKG

did-jwt

Version:

Library for Signing and Verifying JWTs that use DIDs as issuers and JWEs that use DIDs as recipients

2 lines โ€ข 124 kB
/*! For license information please see did-jwt.js.LICENSE.txt */ var e={84:e=>{e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var o=e.charAt(n),i=o.charCodeAt(0);if(255!==t[i])throw new TypeError(o+" is ambiguous");t[i]=n}var s=e.length,c=e.charAt(0),a=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function f(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var r=0;if(" "!==e[r]){for(var n=0,o=0;e[r]===c;)n++,r++;for(var i=(e.length-r)*a+1>>>0,u=new Uint8Array(i);e[r];){var f=t[e.charCodeAt(r)];if(255===f)return;for(var h=0,d=i-1;(0!==f||h<o)&&-1!==d;d--,h++)f+=s*u[d]>>>0,u[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,r++}if(" "!==e[r]){for(var l=i-o;l!==i&&0===u[l];)l++;for(var p=new Uint8Array(n+(i-l)),y=n;l!==i;)p[y++]=u[l++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var a=(i-o)*u+1>>>0,f=new Uint8Array(a);o!==i;){for(var h=t[o],d=0,l=a-1;(0!==h||d<n)&&-1!==l;l--,d++)h+=256*f[l]>>>0,f[l]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,o++}for(var p=a-n;p!==a&&0===f[p];)p++;for(var y=c.repeat(r);p<a;++p)y+=e.charAt(f[p]);return y},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},341:e=>{e.exports=function e(t){if("number"==typeof t&&isNaN(t))throw new Error("NaN is not allowed");if("number"==typeof t&&!isFinite(t))throw new Error("Infinity is not allowed");return null===t||"object"!=typeof t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce(((t,r,n)=>`${t}${0===n?"":","}${e(void 0===r||"symbol"==typeof r?null:r)}`),"")}]`:`{${Object.keys(t).sort().reduce(((r,n)=>void 0===t[n]||"symbol"==typeof t[n]?r:`${r}${0===r.length?"":","}${e(n)}:${e(t[n])}`),"")}}`}},633:(e,t,r)=>{const{encodeText:n}=r(703);e.exports=class{constructor(e,t,r,o){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=o,this.codec=r(o)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}}},579:(e,t,r)=>{const n=r(84),o=r(633),{rfc4648:i}=r(417),{decodeText:s,encodeText:c}=r(703),a=[["identity","\0",()=>({encode:s,decode:c}),""],["base2","0",i(1),"01"],["base8","7",i(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",i(4),"0123456789abcdef"],["base16upper","F",i(4),"0123456789ABCDEF"],["base32hex","v",i(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",i(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",i(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",i(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",i(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",i(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",i(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",i(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=a.reduce(((e,t)=>(e[t[0]]=new o(t[0],t[1],t[2],t[3]),e)),{}),f=a.reduce(((e,t)=>(e[t[1]]=u[t[0]],e)),{});e.exports={names:u,codes:f}},466:(e,t,r)=>{const n=r(579),{encodeText:o,decodeText:i,concat:s}=r(703);function c(e){if(Object.prototype.hasOwnProperty.call(n.names,e))return n.names[e];if(Object.prototype.hasOwnProperty.call(n.codes,e))return n.codes[e];throw new Error(`Unsupported encoding: ${e}`)}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=c(e);return function(e,t){c(e).decode(i(t))}(r,t),s([n,t],n.length+t.length)}).encode=function(e,t){const r=c(e),n=o(r.encode(t));return s([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=i(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),c(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=i(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return c(e[0]).name}catch(e){return!1}},t.encoding=c,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=i(e)),c(e[0])};const a=Object.freeze(n.names),u=Object.freeze(n.codes);t.names=a,t.codes=u},417:e=>{e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",s=0,c=0;for(let n=0;n<e.length;++n)for(c=c<<8|e[n],s+=8;s>r;)s-=r,i+=t[o&c>>s];if(s&&(i+=t[o&c<<r-s]),n)for(;i.length*r&7;)i+="=";return i})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const i=new Uint8Array(o*r/8|0);let s=0,c=0,a=0;for(let t=0;t<o;++t){const o=n[e[t]];if(void 0===o)throw new SyntaxError("Invalid character "+e[t]);c=c<<r|o,s+=r,s>=8&&(s-=8,i[a++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return i})(r,t,e)})}},703:e=>{const t=new TextDecoder,r=new TextEncoder;e.exports={decodeText:e=>t.decode(e),encodeText:e=>r.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.d(n,{xG:()=>zi,wB:()=>qi,Eq:()=>Mi,fD:()=>Wi,hV:()=>os,lA:()=>Fi,fJ:()=>Ji,rk:()=>pi,Kp:()=>li,Tl:()=>yi,L6:()=>di,My:()=>ki,n0:()=>Ei,So:()=>Js,vz:()=>Vs,qU:()=>Vi,Hk:()=>Xs,DM:()=>Gs,Pg:()=>Zs,jS:()=>qs,cu:()=>Ms,Pt:()=>Ds,PM:()=>ms,WJ:()=>bs,p0:()=>ws,Xo:()=>Ws,PC:()=>zs,Cg:()=>Hs,Cq:()=>Ps,Ks:()=>Cs,NS:()=>vi,V:()=>Ni,aT:()=>Ai,fr:()=>xi,uV:()=>Fs,k:()=>bi,bm:()=>$i,K:()=>Ts,RO:()=>gs,Vd:()=>nc,fG:()=>ec,K3:()=>ic,sg:()=>rc,hc:()=>_s,b3:()=>$s});var o={};r.r(o),r.d(o,{identity:()=>O});var i={};r.r(i),r.d(i,{base2:()=>K});var s={};r.r(s),r.d(s,{base8:()=>R});var c={};r.r(c),r.d(c,{base10:()=>N});var a={};r.r(a),r.d(a,{base16:()=>C,base16upper:()=>D});var u={};r.r(u),r.d(u,{base32:()=>j,base32hex:()=>V,base32hexpad:()=>J,base32hexpadupper:()=>W,base32hexupper:()=>z,base32pad:()=>_,base32padupper:()=>H,base32upper:()=>$,base32z:()=>M});var f={};r.r(f),r.d(f,{base36:()=>F,base36upper:()=>q});var h={};r.r(h),r.d(h,{base58btc:()=>G,base58flickr:()=>Z});var d={};r.r(d),r.d(d,{base64:()=>X,base64pad:()=>Y,base64url:()=>Q,base64urlpad:()=>ee});var l={};r.r(l),r.d(l,{base256emoji:()=>oe});var p={};r.r(p),r.d(p,{sha256:()=>Pe,sha512:()=>Ue});var y={};r.r(y),r.d(y,{identity:()=>Le});var g={};r.r(g),r.d(g,{code:()=>Ke,decode:()=>Ne,encode:()=>Re,name:()=>Oe});var w={};r.r(w),r.d(w,{code:()=>$e,decode:()=>He,encode:()=>_e,name:()=>je});var b={};function m(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function v(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?m(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function E(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=v(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return m(r)}r.r(b),r.d(b,{aK:()=>Ft,e8:()=>Lt,DO:()=>Tt,dJ:()=>qt,OG:()=>Gt,My:()=>Kt,Ph:()=>$t,lX:()=>_t,Id:()=>Jt,fg:()=>Yt,qj:()=>zt,aT:()=>jt,r4:()=>Mt,aY:()=>Ut,x:()=>tr,lq:()=>Ht,z:()=>Vt,zW:()=>Rt,Q5:()=>er});const x=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var o=0;o<e.length;o++){var i=e.charAt(o),s=i.charCodeAt(0);if(255!==r[s])throw new TypeError(i+" is ambiguous");r[s]=o}var c=e.length,a=e.charAt(0),u=Math.log(c)/Math.log(256),f=Math.log(256)/Math.log(c);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,o=0;e[t]===a;)n++,t++;for(var i=(e.length-t)*u+1>>>0,s=new Uint8Array(i);e[t];){var f=r[e.charCodeAt(t)];if(255===f)return;for(var h=0,d=i-1;(0!==f||h<o)&&-1!==d;d--,h++)f+=c*s[d]>>>0,s[d]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");o=h,t++}if(" "!==e[t]){for(var l=i-o;l!==i&&0===s[l];)l++;for(var p=new Uint8Array(n+(i-l)),y=n;l!==i;)p[y++]=s[l++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,o=0,i=t.length;o!==i&&0===t[o];)o++,r++;for(var s=(i-o)*f+1>>>0,u=new Uint8Array(s);o!==i;){for(var h=t[o],d=0,l=s-1;(0!==h||d<n)&&-1!==l;l--,d++)h+=256*u[l]>>>0,u[l]=h%c>>>0,h=h/c>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,o++}for(var p=s-n;p!==s&&0===u[p];)p++;for(var y=a.repeat(r);p<s;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error(`Non-${t} character`)}}},A=(new Uint8Array(0),e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")});class B{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class S{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return I(this,e)}}class k{constructor(e){this.decoders=e}or(e){return I(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const I=(e,t)=>new k({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class P{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new B(e,t,r),this.decoder=new S(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const U=({name:e,prefix:t,encode:r,decode:n})=>new P(e,t,r,n),T=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:o}=x(r,t);return U({prefix:e,name:t,encode:n,decode:e=>A(o(e))})},L=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>U({prefix:t,name:e,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],o=(1<<r)-1;let i="",s=0,c=0;for(let n=0;n<e.length;++n)for(c=c<<8|e[n],s+=8;s>r;)s-=r,i+=t[o&c>>s];if(s&&(i+=t[o&c<<r-s]),n)for(;i.length*r&7;)i+="=";return i})(e,n,r),decode:t=>((e,t,r,n)=>{const o={};for(let e=0;e<t.length;++e)o[t[e]]=e;let i=e.length;for(;"="===e[i-1];)--i;const s=new Uint8Array(i*r/8|0);let c=0,a=0,u=0;for(let t=0;t<i;++t){const i=o[e[t]];if(void 0===i)throw new SyntaxError(`Non-${n} character`);a=a<<r|i,c+=r,c>=8&&(c-=8,s[u++]=255&a>>c)}if(c>=r||255&a<<8-c)throw new SyntaxError("Unexpected end of data");return s})(t,n,r,e)}),O=U({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),K=L({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),R=L({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),N=T({prefix:"9",name:"base10",alphabet:"0123456789"}),C=L({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),D=L({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),j=L({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),$=L({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),_=L({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),H=L({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),V=L({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),z=L({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),J=L({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),W=L({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),M=L({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),F=T({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),q=T({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),G=T({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Z=T({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),X=L({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Y=L({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Q=L({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ee=L({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),te=Array.from("๐Ÿš€๐Ÿชโ˜„๐Ÿ›ฐ๐ŸŒŒ๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”๐ŸŒ•๐ŸŒ–๐ŸŒ—๐ŸŒ˜๐ŸŒ๐ŸŒ๐ŸŒŽ๐Ÿ‰โ˜€๐Ÿ’ป๐Ÿ–ฅ๐Ÿ’พ๐Ÿ’ฟ๐Ÿ˜‚โค๐Ÿ˜๐Ÿคฃ๐Ÿ˜Š๐Ÿ™๐Ÿ’•๐Ÿ˜ญ๐Ÿ˜˜๐Ÿ‘๐Ÿ˜…๐Ÿ‘๐Ÿ˜๐Ÿ”ฅ๐Ÿฅฐ๐Ÿ’”๐Ÿ’–๐Ÿ’™๐Ÿ˜ข๐Ÿค”๐Ÿ˜†๐Ÿ™„๐Ÿ’ช๐Ÿ˜‰โ˜บ๐Ÿ‘Œ๐Ÿค—๐Ÿ’œ๐Ÿ˜”๐Ÿ˜Ž๐Ÿ˜‡๐ŸŒน๐Ÿคฆ๐ŸŽ‰๐Ÿ’žโœŒโœจ๐Ÿคท๐Ÿ˜ฑ๐Ÿ˜Œ๐ŸŒธ๐Ÿ™Œ๐Ÿ˜‹๐Ÿ’—๐Ÿ’š๐Ÿ˜๐Ÿ’›๐Ÿ™‚๐Ÿ’“๐Ÿคฉ๐Ÿ˜„๐Ÿ˜€๐Ÿ–ค๐Ÿ˜ƒ๐Ÿ’ฏ๐Ÿ™ˆ๐Ÿ‘‡๐ŸŽถ๐Ÿ˜’๐Ÿคญโฃ๐Ÿ˜œ๐Ÿ’‹๐Ÿ‘€๐Ÿ˜ช๐Ÿ˜‘๐Ÿ’ฅ๐Ÿ™‹๐Ÿ˜ž๐Ÿ˜ฉ๐Ÿ˜ก๐Ÿคช๐Ÿ‘Š๐Ÿฅณ๐Ÿ˜ฅ๐Ÿคค๐Ÿ‘‰๐Ÿ’ƒ๐Ÿ˜ณโœ‹๐Ÿ˜š๐Ÿ˜๐Ÿ˜ด๐ŸŒŸ๐Ÿ˜ฌ๐Ÿ™ƒ๐Ÿ€๐ŸŒท๐Ÿ˜ป๐Ÿ˜“โญโœ…๐Ÿฅบ๐ŸŒˆ๐Ÿ˜ˆ๐Ÿค˜๐Ÿ’ฆโœ”๐Ÿ˜ฃ๐Ÿƒ๐Ÿ’โ˜น๐ŸŽŠ๐Ÿ’˜๐Ÿ˜ โ˜๐Ÿ˜•๐ŸŒบ๐ŸŽ‚๐ŸŒป๐Ÿ˜๐Ÿ–•๐Ÿ’๐Ÿ™Š๐Ÿ˜น๐Ÿ—ฃ๐Ÿ’ซ๐Ÿ’€๐Ÿ‘‘๐ŸŽต๐Ÿคž๐Ÿ˜›๐Ÿ”ด๐Ÿ˜ค๐ŸŒผ๐Ÿ˜ซโšฝ๐Ÿค™โ˜•๐Ÿ†๐Ÿคซ๐Ÿ‘ˆ๐Ÿ˜ฎ๐Ÿ™†๐Ÿป๐Ÿƒ๐Ÿถ๐Ÿ’๐Ÿ˜ฒ๐ŸŒฟ๐Ÿงก๐ŸŽโšก๐ŸŒž๐ŸŽˆโŒโœŠ๐Ÿ‘‹๐Ÿ˜ฐ๐Ÿคจ๐Ÿ˜ถ๐Ÿค๐Ÿšถ๐Ÿ’ฐ๐Ÿ“๐Ÿ’ข๐ŸคŸ๐Ÿ™๐Ÿšจ๐Ÿ’จ๐Ÿคฌโœˆ๐ŸŽ€๐Ÿบ๐Ÿค“๐Ÿ˜™๐Ÿ’Ÿ๐ŸŒฑ๐Ÿ˜–๐Ÿ‘ถ๐Ÿฅดโ–ถโžกโ“๐Ÿ’Ž๐Ÿ’ธโฌ‡๐Ÿ˜จ๐ŸŒš๐Ÿฆ‹๐Ÿ˜ท๐Ÿ•บโš ๐Ÿ™…๐Ÿ˜Ÿ๐Ÿ˜ต๐Ÿ‘Ž๐Ÿคฒ๐Ÿค ๐Ÿคง๐Ÿ“Œ๐Ÿ”ต๐Ÿ’…๐Ÿง๐Ÿพ๐Ÿ’๐Ÿ˜—๐Ÿค‘๐ŸŒŠ๐Ÿคฏ๐Ÿทโ˜Ž๐Ÿ’ง๐Ÿ˜ฏ๐Ÿ’†๐Ÿ‘†๐ŸŽค๐Ÿ™‡๐Ÿ‘โ„๐ŸŒด๐Ÿ’ฃ๐Ÿธ๐Ÿ’Œ๐Ÿ“๐Ÿฅ€๐Ÿคข๐Ÿ‘…๐Ÿ’ก๐Ÿ’ฉ๐Ÿ‘๐Ÿ“ธ๐Ÿ‘ป๐Ÿค๐Ÿคฎ๐ŸŽผ๐Ÿฅต๐Ÿšฉ๐ŸŽ๐ŸŠ๐Ÿ‘ผ๐Ÿ’๐Ÿ“ฃ๐Ÿฅ‚"),re=te.reduce(((e,t,r)=>(e[r]=t,e)),[]),ne=te.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]),oe=U({prefix:"๐Ÿš€",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+re[t]),"")},decode:function(e){const t=[];for(const r of e){const e=ne[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var ie=128,se=-128,ce=Math.pow(2,31),ae=128,ue=127,fe=Math.pow(2,7),he=Math.pow(2,14),de=Math.pow(2,21),le=Math.pow(2,28),pe=Math.pow(2,35),ye=Math.pow(2,42),ge=Math.pow(2,49),we=Math.pow(2,56),be=Math.pow(2,63);const me={encode:function e(t,r,n){r=r||[];for(var o=n=n||0;t>=ce;)r[n++]=255&t|ie,t/=128;for(;t&se;)r[n++]=255&t|ie,t>>>=7;return r[n]=0|t,e.bytes=n-o+1,r},decode:function e(t,r){var n,o=0,i=0,s=r=r||0,c=t.length;do{if(s>=c)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],o+=i<28?(n&ue)<<i:(n&ue)*Math.pow(2,i),i+=7}while(n>=ae);return e.bytes=s-r,o},encodingLength:function(e){return e<fe?1:e<he?2:e<de?3:e<le?4:e<pe?5:e<ye?6:e<ge?7:e<we?8:e<be?9:10}},ve=(e,t=0)=>[me.decode(e,t),me.decode.bytes],Ee=(e,t,r=0)=>(me.encode(e,t,r),t),xe=e=>me.encodingLength(e),Ae=(e,t)=>{const r=t.byteLength,n=xe(e),o=n+xe(r),i=new Uint8Array(o+r);return Ee(e,i,0),Ee(r,i,n),i.set(t,o),new Be(e,r,t,i)};class Be{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}const Se=({name:e,code:t,encode:r})=>new ke(e,t,r);class ke{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Ae(this.code,t):t.then((e=>Ae(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Ie=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Pe=Se({name:"sha2-256",code:18,encode:Ie("SHA-256")}),Ue=Se({name:"sha2-512",code:19,encode:Ie("SHA-512")}),Te=A,Le={code:0,name:"identity",encode:Te,digest:e=>Ae(0,Te(e))},Oe="raw",Ke=85,Re=e=>A(e),Ne=e=>A(e),Ce=new TextEncoder,De=new TextDecoder,je="json",$e=512,_e=e=>Ce.encode(JSON.stringify(e)),He=e=>JSON.parse(De.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"),Symbol.for("@ipld/js-cid/CID");const Ve={...o,...i,...s,...c,...a,...u,...f,...h,...d,...l};function ze(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const Je=ze("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),We=ze("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{const t=v((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),Me={utf8:Je,"utf-8":Je,hex:Ve.base16,latin1:We,ascii:We,binary:We,...Ve};function Fe(e,t="utf8"){const r=Me[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.decoder.decode(`${r.prefix}${e}`):m(globalThis.Buffer.from(e,"utf-8"))}function qe(e,t="utf8"){const r=Me[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?r.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function Ge(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ze(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Xe(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ye(e,t){Ze(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}const Qe="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function et(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tt(e,t){return e<<32-t|e>>>t}function rt(e,t){return e<<t|e>>>32-t>>>0}const nt=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function ot(e){for(let r=0;r<e.length;r++)e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;var t}function it(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),Ze(e),e}class st{clone(){return this._cloneInto()}}function ct(e){const t=t=>e().update(it(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function at(e=32){if(Qe&&"function"==typeof Qe.getRandomValues)return Qe.getRandomValues(new Uint8Array(e));if(Qe&&"function"==typeof Qe.randomBytes)return Qe.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}function ut(e,t,r){return e&t^e&r^t&r}class ft extends st{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=et(this.buffer)}update(e){Xe(this);const{view:t,buffer:r,blockLen:n}=this,o=(e=it(e)).length;for(let i=0;i<o;){const s=Math.min(n-this.pos,o-i);if(s!==n)r.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=et(e);for(;n<=o-i;i+=n)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Xe(this),Ye(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:o}=this;let{pos:i}=this;t[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>n-i&&(this.process(r,0),i=0);for(let e=i;e<n;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const o=BigInt(32),i=BigInt(4294967295),s=Number(r>>o&i),c=Number(r&i),a=n?4:0,u=n?0:4;e.setUint32(t+a,s,n),e.setUint32(t+u,c,n)}(r,n-8,BigInt(8*this.length),o),this.process(r,0);const s=et(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const a=c/4,u=this.get();if(a>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<a;e++)s.setUint32(4*e,u[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:o,destroyed:i,pos:s}=this;return e.length=n,e.pos=s,e.finished=o,e.destroyed=i,n%t&&e.buffer.set(r),e}}const ht=BigInt(2**32-1),dt=BigInt(32);function lt(e,t=!1){return t?{h:Number(e&ht),l:Number(e>>dt&ht)}:{h:0|Number(e>>dt&ht),l:0|Number(e&ht)}}function pt(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){const{h:i,l:s}=lt(e[o],t);[r[o],n[o]]=[i,s]}return[r,n]}const yt=(e,t,r)=>e<<r|t>>>32-r,gt=(e,t,r)=>t<<r|e>>>32-r,wt=(e,t,r)=>t<<r-32|e>>>64-r,bt=(e,t,r)=>e<<r-32|t>>>64-r,mt={fromBig:lt,split:pt,toBig:(e,t)=>BigInt(e>>>0)<<dt|BigInt(t>>>0),shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:yt,rotlSL:gt,rotlBH:wt,rotlBL:bt,add:function(e,t,r,n){const o=(t>>>0)+(n>>>0);return{h:e+r+(o/2**32|0)|0,l:0|o}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,o)=>t+r+n+o+(e/2**32|0)|0,add5H:(e,t,r,n,o,i)=>t+r+n+o+i+(e/2**32|0)|0,add5L:(e,t,r,n,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(o>>>0)},[vt,Et]=(()=>mt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),xt=new Uint32Array(80),At=new Uint32Array(80);class Bt extends ft{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:c,Eh:a,El:u,Fh:f,Fl:h,Gh:d,Gl:l,Hh:p,Hl:y}=this;return[e,t,r,n,o,i,s,c,a,u,f,h,d,l,p,y]}set(e,t,r,n,o,i,s,c,a,u,f,h,d,l,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|c,this.Eh=0|a,this.El=0|u,this.Fh=0|f,this.Fl=0|h,this.Gh=0|d,this.Gl=0|l,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)xt[r]=e.getUint32(t),At[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|xt[e-15],r=0|At[e-15],n=mt.rotrSH(t,r,1)^mt.rotrSH(t,r,8)^mt.shrSH(t,r,7),o=mt.rotrSL(t,r,1)^mt.rotrSL(t,r,8)^mt.shrSL(t,r,7),i=0|xt[e-2],s=0|At[e-2],c=mt.rotrSH(i,s,19)^mt.rotrBH(i,s,61)^mt.shrSH(i,s,6),a=mt.rotrSL(i,s,19)^mt.rotrBL(i,s,61)^mt.shrSL(i,s,6),u=mt.add4L(o,a,At[e-7],At[e-16]),f=mt.add4H(u,n,c,xt[e-7],xt[e-16]);xt[e]=0|f,At[e]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:c,Dh:a,Dl:u,Eh:f,El:h,Fh:d,Fl:l,Gh:p,Gl:y,Hh:g,Hl:w}=this;for(let e=0;e<80;e++){const t=mt.rotrSH(f,h,14)^mt.rotrSH(f,h,18)^mt.rotrBH(f,h,41),b=mt.rotrSL(f,h,14)^mt.rotrSL(f,h,18)^mt.rotrBL(f,h,41),m=f&d^~f&p,v=h&l^~h&y,E=mt.add5L(w,b,v,Et[e],At[e]),x=mt.add5H(E,g,t,m,vt[e],xt[e]),A=0|E,B=mt.rotrSH(r,n,28)^mt.rotrBH(r,n,34)^mt.rotrBH(r,n,39),S=mt.rotrSL(r,n,28)^mt.rotrBL(r,n,34)^mt.rotrBL(r,n,39),k=r&o^r&s^o&s,I=n&i^n&c^i&c;g=0|p,w=0|y,p=0|d,y=0|l,d=0|f,l=0|h,({h:f,l:h}=mt.add(0|a,0|u,0|x,0|A)),a=0|s,u=0|c,s=0|o,c=0|i,o=0|r,i=0|n;const P=mt.add3L(A,S,I);r=mt.add3H(P,x,B,k),n=0|P}({h:r,l:n}=mt.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=mt.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:c}=mt.add(0|this.Ch,0|this.Cl,0|s,0|c)),({h:a,l:u}=mt.add(0|this.Dh,0|this.Dl,0|a,0|u)),({h:f,l:h}=mt.add(0|this.Eh,0|this.El,0|f,0|h)),({h:d,l}=mt.add(0|this.Fh,0|this.Fl,0|d,0|l)),({h:p,l:y}=mt.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:w}=mt.add(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,n,o,i,s,c,a,u,f,h,d,l,p,y,g,w)}roundClean(){xt.fill(0),At.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const St=ct((()=>new Bt)),kt=BigInt(0),It=BigInt(1),Pt=BigInt(2);function Ut(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function Tt(e){if(!Ut(e))throw new Error("Uint8Array expected")}function Lt(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}const Ot=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Kt(e){Tt(e);let t="";for(let r=0;r<e.length;r++)t+=Ot[e[r]];return t}function Rt(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function Nt(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?kt:BigInt("0x"+e)}const Ct={_0:48,_9:57,A:65,F:70,a:97,f:102};function Dt(e){return e>=Ct._0&&e<=Ct._9?e-Ct._0:e>=Ct.A&&e<=Ct.F?e-(Ct.A-10):e>=Ct.a&&e<=Ct.f?e-(Ct.a-10):void 0}function jt(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,o=0;t<r;t++,o+=2){const r=Dt(e.charCodeAt(o)),i=Dt(e.charCodeAt(o+1));if(void 0===r||void 0===i){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}n[t]=16*r+i}return n}function $t(e){return Nt(Kt(e))}function _t(e){return Tt(e),Nt(Kt(Uint8Array.from(e).reverse()))}function Ht(e,t){return jt(e.toString(16).padStart(2*t,"0"))}function Vt(e,t){return Ht(e,t).reverse()}function zt(e,t,r){let n;if("string"==typeof t)try{n=jt(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!Ut(t))throw new Error(e+" must be hex string or Uint8Array");n=Uint8Array.from(t)}const o=n.length;if("number"==typeof r&&o!==r)throw new Error(e+" of length "+r+" expected, got "+o);return n}function Jt(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];Tt(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const o=e[t];r.set(o,n),n+=o.length}return r}const Wt=e=>"bigint"==typeof e&&kt<=e;function Mt(e,t,r){return Wt(e)&&Wt(t)&&Wt(r)&&t<=e&&e<r}function Ft(e,t,r,n){if(!Mt(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function qt(e){let t;for(t=0;e>kt;e>>=It,t+=1);return t}const Gt=e=>(Pt<<BigInt(e-1))-It,Zt=e=>new Uint8Array(e),Xt=e=>Uint8Array.from(e);function Yt(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=Zt(e),o=Zt(e),i=0;const s=()=>{n.fill(1),o.fill(0),i=0},c=(...e)=>r(o,n,...e),a=(e=Zt())=>{o=c(Xt([0]),e),n=c(),0!==e.length&&(o=c(Xt([1]),e),n=c())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=c();const t=n.slice();r.push(t),e+=n.length}return Jt(...r)};return(e,t)=>{let r;for(s(),a(e);!(r=t(u()));)a();return s(),r}}const Qt={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||Ut(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function er(e,t,r={}){const n=(t,r,n)=>{const o=Qt[r];if("function"!=typeof o)throw new Error("invalid validator function");const i=e[t];if(!(n&&void 0===i||o(i,e)))throw new Error("param "+String(t)+" is invalid. Expected "+r+", got "+i)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}function tr(e){const t=new WeakMap;return(r,...n)=>{const o=t.get(r);if(void 0!==o)return o;const i=e(r,...n);return t.set(r,i),i}}const rr=BigInt(0),nr=BigInt(1),or=BigInt(2),ir=BigInt(3),sr=BigInt(4),cr=BigInt(5),ar=BigInt(8);function ur(e,t){const r=e%t;return r>=rr?r:t+r}function fr(e,t,r){if(t<rr)throw new Error("invalid exponent, negatives unsupported");if(r<=rr)throw new Error("invalid modulus");if(r===nr)return rr;let n=nr;for(;t>rr;)t&nr&&(n=n*e%r),e=e*e%r,t>>=nr;return n}function hr(e,t,r){let n=e;for(;t-- >rr;)n*=n,n%=r;return n}function dr(e,t){if(e===rr)throw new Error("invert: expected non-zero number");if(t<=rr)throw new Error("invert: expected positive modulus, got "+t);let r=ur(e,t),n=t,o=rr,i=nr,s=nr,c=rr;for(;r!==rr;){const e=n/r,t=n%r,a=o-s*e,u=i-c*e;n=r,r=t,o=s,i=c,s=a,c=u}if(n!==nr)throw new Error("invert: does not exist");return ur(o,t)}const lr=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pr(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function yr(e,t,r=!1,n={}){if(e<=rr)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:o,nByteLength:i}=pr(e,t);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const c=Object.freeze({ORDER:e,isLE:r,BITS:o,BYTES:i,MASK:Gt(o),ZERO:rr,ONE:nr,create:t=>ur(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return rr<=t&&t<e},is0:e=>e===rr,isOdd:e=>(e&nr)===nr,neg:t=>ur(-t,e),eql:(e,t)=>e===t,sqr:t=>ur(t*t,e),add:(t,r)=>ur(t+r,e),sub:(t,r)=>ur(t-r,e),mul:(t,r)=>ur(t*r,e),pow:(e,t)=>function(e,t,r){if(r<rr)throw new Error("invalid exponent, negatives unsupported");if(r===rr)return e.ONE;if(r===nr)return t;let n=e.ONE,o=t;for(;r>rr;)r&nr&&(n=e.mul(n,o)),o=e.sqr(o),r>>=nr;return n}(c,e,t),div:(t,r)=>ur(t*dr(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>dr(t,e),sqrt:n.sqrt||(t=>(s||(s=function(e){if(e%sr===ir){const t=(e+nr)/sr;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%ar===cr){const t=(e-cr)/ar;return function(e,r){const n=e.mul(r,or),o=e.pow(n,t),i=e.mul(r,o),s=e.mul(e.mul(i,or),o),c=e.mul(i,e.sub(s,e.ONE));if(!e.eql(e.sqr(c),r))throw new Error("Cannot find square root");return c}}return function(e){const t=(e-nr)/or;let r,n,o;for(r=e-nr,n=0;r%or===rr;r/=or,n++);for(o=or;o<e&&fr(o,t,e)!==e-nr;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===n){const t=(e+nr)/sr;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}const i=(r+nr)/or;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let c=n,a=e.pow(e.mul(e.ONE,o),r),u=e.pow(s,i),f=e.pow(s,r);for(;!e.eql(f,e.ONE);){if(e.eql(f,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(f);t<c&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const r=e.pow(a,nr<<BigInt(c-t-1));a=e.sqr(r),u=e.mul(u,r),f=e.mul(f,a),c=t}return u}}(e)}(e)),s(c,t))),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n))),e.ONE),o=e.inv(n);return t.reduceRight(((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n))),o),r}(c,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?Vt(e,i):Ht(e,i),fromBytes:e=>{if(e.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+e.length);return r?_t(e):$t(e)}});return Object.freeze(c)}function gr(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function wr(e){const t=gr(e);return t+Math.ceil(t/2)}const br=BigInt(0),mr=BigInt(1);function vr(e,t){const r=t.negate();return e?r:t}function Er(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function xr(e,t){return Er(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}const Ar=new WeakMap,Br=new WeakMap;function Sr(e){return Br.get(e)||1}function kr(e,t){return{constTimeNegate:vr,hasPrecomputes:e=>1!==Sr(e),unsafeLadder(t,r,n=e.ZERO){let o=t;for(;r>br;)r&mr&&(n=n.add(o)),o=o.double(),r>>=mr;return n},precomputeWindow(e,r){const{windows:n,windowSize:o}=xr(r,t),i=[];let s=e,c=s;for(let e=0;e<n;e++){c=s,i.push(c);for(let e=1;e<o;e++)c=c.add(s),i.push(c);s=c.double()}return i},wNAF(r,n,o){const{windows:i,windowSize:s}=xr(r,t);let c=e.ZERO,a=e.BASE;const u=BigInt(2**r-1),f=2**r,h=BigInt(r);for(let e=0;e<i;e++){const t=e*s;let r=Number(o&u);o>>=h,r>s&&(r-=f,o+=mr);const i=t,d=t+Math.abs(r)-1,l=e%2!=0,p=r<0;0===r?a=a.add(vr(l,n[i])):c=c.add(vr(p,n[d]))}return{p:c,f:a}},wNAFUnsafe(r,n,o,i=e.ZERO){const{windows:s,windowSize:c}=xr(r,t),a=BigInt(2**r-1),u=2**r,f=BigInt(r);for(let e=0;e<s;e++){const t=e*c;if(o===br)break;let r=Number(o&a);if(o>>=f,r>c&&(r-=u,o+=mr),0===r)continue;let s=n[t+Math.abs(r)-1];r<0&&(s=s.negate()),i=i.add(s)}return i},getPrecomputes(e,t,r){let n=Ar.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&Ar.set(t,r(n))),n},wNAFCached(e,t,r){const n=Sr(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)},wNAFCachedUnsafe(e,t,r,n){const o=Sr(e);return 1===o?this.unsafeLadder(e,t,n):this.wNAFUnsafe(o,this.getPrecomputes(o,e,r),t,n)},setWindowSize(e,r){Er(r,t),Br.set(e,r),Ar.delete(e)}}}function Ir(e,t,r,n){if(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)}))}(r,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)}))}(n,t),r.length!==n.length)throw new Error("arrays of points and scalars must have equal length");const o=e.ZERO,i=qt(BigInt(r.length)),s=i>12?i-3:i>4?i-2:i?2:1,c=(1<<s)-1,a=new Array(c+1).fill(o);let u=o;for(let e=Math.floor((t.BITS-1)/s)*s;e>=0;e-=s){a.fill(o);for(let t=0;t<n.length;t++){const o=n[t],i=Number(o>>BigInt(e)&BigInt(c));a[i]=a[i].add(r[t])}let t=o;for(let e=a.length-1,r=o;e>0;e--)r=r.add(a[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e<s;e++)u=u.double()}return u}function Pr(e){return er(e.Fp,lr.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),er(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pr(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const Ur=BigInt(0),Tr=BigInt(1),Lr=BigInt(2),Or=BigInt(8),Kr={zip215:!0};const Rr=BigInt(0),Nr=BigInt(1);const Cr=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Dr=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),jr=(BigInt(0),BigInt(1)),$r=BigInt(2),_r=BigInt(3),Hr=BigInt(5),Vr=BigInt(8);function zr(e){const t=BigInt(10),r=BigInt(20),n=BigInt(40),o=BigInt(80),i=Cr,s=e*e%i*e%i,c=hr(s,$r,i)*s%i,a=hr(c,jr,i)*e%i,u=hr(a,Hr,i)*a%i,f=hr(u,t,i)*u%i,h=hr(f,r,i)*f%i,d=hr(h,n,i)*h%i,l=hr(d,o,i)*d%i,p=hr(l,o,i)*d%i,y=hr(p,t,i)*u%i;return{pow_p_5_8:hr(y,$r,i)*e%i,b2:s}}function Jr(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Wr(e,t){const r=Cr,n=ur(t*t*t,r),o=ur(n*n*t,r);let i=ur(e*n*zr(e*o).pow_p_5_8,r);const s=ur(t*i*i,r),c=i,a=ur(i*Dr,r),u=s===e,f=s===ur(-e,r),h=s===ur(-e*Dr,r);return u&&(i=c),(f||h)&&(i=a),(ur(i,r)&nr)===nr&&(i=ur(-i,r)),{isValid:u||f,value:i}}const Mr=(()=>yr(Cr,void 0,!0))(),Fr=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Mr,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Vr,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:St,randomBytes:at,adjustScalarBytes:Jr,uvRatio:Wr}))(),qr=(()=>function(e){const t=function(e){const t=Pr(e);return er(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n,prehash:o,hash:i,randomBytes:s,nByteLength:c,h:a}=t,u=Lr<<BigInt(8*c)-Tr,f=r.create,h=yr(t.n,t.nBitLength),d=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:Ur}}}),l=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,r)=>{if(Lt("phflag",r),t.length||r)throw new Error("Contexts/pre-hash are not supported");return e});function y(e,t){Ft("coordinate "+e,t,Ur,u)}function g(e){if(!(e instanceof m))throw new Error("ExtendedPoint expected")}const w=tr(((e,t)=>{const{ex:n,ey:o,ez:i}=e,s=e.is0();null==t&&(t=s?Or:r.inv(i));const c=f(n*t),a=f(o*t),u=f(i*t);if(s)return{x:Ur,y:Tr};if(u!==Tr)throw new Error("invZ was invalid");return{x:c,y:a}})),b=tr((e=>{const{a:r,d:n}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:o,ey:i,ez:s,et:c}=e,a=f(o*o),u=f(i*i),h=f(s*s),d=f(h*h),l=f(a*r);if(f(h*f(l+u))!==f(d+f(n*f(a*u))))throw new Error("bad point: equation left != right (1)");if(f(o*i)!==f(s*c))throw new Error("bad point: equation left != right (2)");return!0}));class m{constructor(e,t,r,n){this.ex=e,this.ey=t,this.ez=r,this.et=n,y("x",e),y("y",t),y("z",r),y("t",n),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof m)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};return y("x",t),y("y",r),new m(t,r,Tr,f(t*r))}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.ez)));return e.map(((e,r)=>e.toAffine(t[r]))).map(m.fromAffine)}static msm(e,t){return Ir(m,h,e,t)}_setWindowSize(e){x.setWindowSize(this,e)}assertValidity(){b(this)}equals(e){g(e);const{ex:t,ey:r,ez:n}=this,{ex:o,ey:i,ez:s}=e,c=f(t*s),a=f(o*n),u=f(r*s),h=f(i*n);return c===a&&u===h}is0(){return this.equals(m.ZERO)}negate(){return new m(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){const{a:e}=t,{ex:r,ey:n,ez:o}=this,i=f(r*r),s=f(n*n),c=f(Lr*f(o*o)),a=f(e*i),u=r+n,h=f(f(u*u)-i-s),d=a+s,l=d-c,p=a-s,y=f(h*l),g=f(d*p),w=f(h*p),b=f(l*d);return new m(y,g,b,w)}add(e){g(e);const{a:r,d:n}=t,{ex:o,ey:i,ez:s,et:c}=this,{ex:a,ey:u,ez:h,et:d}=e;if(r===BigInt(-1)){const e=f((i-o)*(u+a)),t=f((i+o)*(u-a)),r=f(t-e);if(r===Ur)return this.double();const n=f(s*Lr*d),l=f(c*Lr*h),p=l+n,y=t+e,g=l-n,w=f(p*r),b=f(y*g),v=f(p*g),E=f(r*y);return new m(w,b,E,v)}const l=f(o*a),p=f(i*u),y=f(c*n*d),w=f(s*h),b=f((o+i)*(a+u)-l-p),v=w-y,E=w+y,x=f(p-r*l),A=f(b*v),B=f(E*x),S=f(b*x),k=f(v*E);return new m(A,B,k,S)}subtract(e){return this.add(e.negate())}wNAF(e){return x.wNAFCached(this,e,m.normalizeZ)}multiply(e){const t=e;Ft("scalar",t,Tr,n);const{p:r,f:o}=this.wNAF(t);return m.normalizeZ([r,o])[0]}multiplyUnsafe(e,t=m.ZERO){const r=e;return Ft("scalar",r,Ur,n),r===Ur?E:this.is0()||r===Tr?this:x.wNAFCachedUnsafe(this,r,m.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return x.unsafeLadder(this,n).is0()}toAffine(e){return w(this,e)}clearCofactor(){const{h:e}=t;return e===Tr?this:this.multiplyUnsafe(e)}static fromHex(e,n=!1){const{d:o,a:i}=t,s=r.BYTES;e=zt("pointHex",e,s),Lt("zip215",n);const c=e.slice(),a=e[s-1];c[s-1]=-129&a;const h=_t(c),l=n?u:r.ORDER;Ft("pointHex.y",h,Ur,l);const p=f(h*h),y=f(p-Tr),g=f(o*p-i);let{isValid:w,value:b}=d(y,g);if(!w)throw new Error("Point.fromHex: invalid y coordinate");const v=(b&Tr)===Tr,E=!!(128&a);if(!n&&b===Ur&&E)throw new Error("Point.fromHex: x=0 and x_0=1");return E!==v&&(b=f(-b)),m.fromAffine({x:b,y:h})}static fromPrivateKey(e){return S(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),n=Vt(t,r.BYTES);return n[n.length-1]|=e&Tr?128:0,n}toHex(){return Kt(this.toRawBytes())}}m.BASE=new m(t.Gx,t.Gy,Tr,f(t.Gx*t.Gy)),m.ZERO=new m(Ur,Tr,Tr,Ur);const{BASE:v,ZERO:E}=m,x=kr(m,8*c);function A(e){return ur(e,n)}function B(e){return A(_t(e))}function S(e){const t=r.BYTES;e=zt("private key",e,t);const n=zt("hashed private key",i(e),2*t),o=l(n.slice(0,t)),s=n.slice(t,2*t),c=B(o),a=v.multiply(c),u=a.toRawBytes();return{head:o,prefix:s,scalar:c,point:a,pointBytes:u}}function k(e=new Uint8Array,...t){const r=Jt(...t);return B(i(p(r,zt("context",e),!!o)))}const I=Kr;return v._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return S(e).pointBytes},sign:function(e,t,i={}){e=zt("message",e),o&&(e=o(e));const{prefix:s,scalar:c,pointBytes:a}=S(t),u=k(i.context,s,e),f=v.multiply(u).toRawBytes(),h=A(u+k(i.context,f,a,e)*c);return Ft("signature.s",h,Ur,n),zt("result",Jt(f,Vt(h,r.BYTES)),2*r.BYTES)},verify:function(e,t,n,i=I){const{context:s,zip215:c}=i,a=r.BYTES;e=zt("signature",e,2*a),t=zt("message",t),n=zt("publicKey",n,a),void 0!==c&&Lt("zip215",c),o&&(t=o(t));const u=_t(e.slice(a,2*a));let f,h,d;try{f=m.fromHex(n,c),h=m.fromHex(e.slice(0,a),c),d=v.multiplyUnsafe(u)}catch(e){return!1}if(!c&&f.isSmallOrder())return!1;const l=k(s,h.toRawBytes(),f.toRawBytes(),t);return h.add(f.multiplyUnsafe(l)).subtract(d).clearCofactor().equals(m.ZERO)},ExtendedPoint:m,utils:{getExtendedPublicKey:S,randomPrivateKey:()=>s(r.BYTES),precompute:(e=8,t=m.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}(Fr))(),Gr=(()=>function(e){const t=(er(r=e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r}));var r;const{P:n}=t,o=e=>ur(e,n),i=t.montgomeryBits,s=Math.ceil(i/8),c=t.nByteLength,a=t.adjustScalarBytes||(e=>e),u=t.powPminus2||(e=>fr(e,n-BigInt(2),n));function f(e,t,r){const n=o(e*(t-r));return[t=o(t-n),r=o(r+n)]}const h=(t.a-BigInt(2))/BigInt(4);function d(e){return Vt(o(e),s)}function l(e,t){const r=function(e){const t=zt("u coordinate",e,s);return 32===c&&(t[31]&=127),_t(t)}(t),l=function(e,t){Ft("u",e,Rr,n),Ft("scalar",t,Rr,n);const r=t,s=e;let c,a=Nr,d=Rr,l=e,p=Nr,y=Rr;for(let e=BigInt(i-1);e>=Rr;e--){const t=r>>e&Nr;y^=t,c=f(y,a,l),a=c[0],l=c[1],c=f(y,d,p),d=c[0],p=c[1],y=t;const n=a+d,i=o(n*n),u=a-d,g=o(u*u),w=i-g,b=l+p,m=o((l-p)*n),v=o(b*u),E=m+v,x=m-v;l=o(E*E),p=o(s*o(x*x)),a=o(i*g),d=o(w*(i+o(h*w)))}c=f(y,a,l),a=c[0],l=c[1],c=f(y,d,p),d=c[0],p=c[1];const g=u(d);return o(a*g)}(r,function(e){const t=zt("scalar",e),r=t.length;if(r!==s&&r!==c)throw new Error("invalid scalar, expected "+s+" or "+c+" bytes, got "+r);return _t(a(t))}(e));if(l===Rr)throw new Error("invalid private or public key received");return d(l)}const p=d(t.Gu);function y(e){return l(e,p)}return{scalarMult:l,scalarMultBase:y,getSharedSecret:(e,t)=>l(e,t),getPublicKey:e=>y(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:p}}({P:Cr,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{const t=Cr,{pow_p_5_8:r,b2:n}=zr(e);return ur(hr(r,_r,t)*n,t)},adjustScalarBytes:Jr,randomBytes:at}))();var Zr=r(466);const Xr=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Yr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qr=new Uint32Array(64);class en extends ft{constructor(){super(64,32,8,!1),this.A=0|Yr[0],this.B=0|Yr[1],this.C=0|Yr[2],this.D=0|Yr[3],this.E=0|Yr[4],this.F=0|Yr[5],this.G=0|Yr[6],this.H=0|Yr[7]}get(){const{A:e,B:t,C:r,D:n,E:o,F:i,G:s,H:c}=this;return[e,t,r,n,o,i,s,c]}set(e,t,r,n,o,i,s,c){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|c}process(e,t){for(let r=0;r<16;r++,t+=4)Qr[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Qr[e-15],r=Qr[e-2],n=tt(t,7)^tt(t,18)^t>>>3,o=tt(r,17)^tt(r,19)^r>>>10;Qr[e]=o+Qr[e-7]+n+Qr[e-16]|0}let{A:r,B:n,C:o,D:i,E:s,F:c,G:a,H:u}=this;for(let e=0;e<64;e++){const t=u+(tt(s,6)^tt(s,11)^tt(s,25))+((f=s)&c^~f&a)+Xr[e]+Qr[e]|0,h=(tt(r,2)^tt(r,13)^tt(r,22))+ut(r,n,o)|0;u=a,a=c,c=s,s=i+t|0,i=o,o=n,n=r,r=t+h|0}var f;r=r+this.A|0,n=n+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,c=c+this.F|0,a=a+this.G|0,u=u+this.H|0,this.set(r,n,o,i,s,c,a,u)}roundClean(){Qr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const tn=ct((()=>new en));class rn extends st{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Ge(e.outputLen),Ge(e.blockLen)}(e);const r=it(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),o.fill(0)}update(e){return Xe(this),this.iHash.update(e),this}digestInto(e){Xe(this),Ze(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return e.finished=n,e.destroyed=o,e.blockLen=i,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const nn=(e,t,r)=>new rn(e,t).update(r).digest();function on(e){void 0!==e.lowS&&Lt("lowS",e.lowS),void 0!==e.prehash&&Lt("prehash",e.prehash)}nn.create=(e,t)=>new rn(e,t);const{Ph:sn,aT:cn}=b;class an extends Error{constructor(e=""){super(e)}}const un={Err:an,_tlv:{encode:(e,t)=>{const{Err:r}=un;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,o=Rt(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?Rt(o.length/2|128):"";return Rt(e)+i+o+t},decode(e,t){const{Err:r}=un;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const o=t[n++];let i=0;if(128&o){const e=127&o;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const s=t.subarray(n,n+e);if(s.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(const e of s)i=i<<8|e;if(n+=e,i<128)throw new r("tlv.decode(long): not minimal encoding")}else i=o;const s=t.subarray(n,n+i);if(s.length!==i)throw new r("tlv.decode: wrong value length");return{v:s,l